Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
2a52dbfb
Unverified
Commit
2a52dbfb
authored
May 24, 2019
by
Ryan McKinley
Committed by
GitHub
May 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Table: various minor fixes (alpha panel) (#17258)
parent
6acc7d37
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
10 deletions
+58
-10
packages/grafana-ui/src/components/Table/Table.test.tsx
+48
-0
packages/grafana-ui/src/components/Table/Table.tsx
+8
-6
packages/grafana-ui/src/components/Table/TableCellBuilder.tsx
+1
-4
packages/grafana-ui/src/components/Table/_Table.scss
+1
-0
No files found.
packages/grafana-ui/src/components/Table/Table.test.tsx
0 → 100644
View file @
2a52dbfb
import
React
from
'react'
;
import
{
readCSV
}
from
'../../utils/csv'
;
import
{
Table
,
Props
}
from
'./Table'
;
import
{
getTheme
}
from
'../../themes/index'
;
import
{
GrafanaThemeType
}
from
'../../types/theme'
;
import
renderer
from
'react-test-renderer'
;
const
series
=
readCSV
(
'a,b,c
\
n1,2,3
\
n4,5,6'
)[
0
];
const
setup
=
(
propOverrides
?:
object
)
=>
{
const
props
:
Props
=
{
data
:
series
,
minColumnWidth
:
100
,
showHeader
:
true
,
fixedHeader
:
true
,
fixedColumns
:
0
,
rotate
:
false
,
styles
:
[],
replaceVariables
:
(
value
:
string
)
=>
value
,
width
:
600
,
height
:
800
,
theme
:
getTheme
(
GrafanaThemeType
.
Dark
),
};
// partial
Object
.
assign
(
props
,
propOverrides
);
const
tree
=
renderer
.
create
(<
Table
{
...
props
}
/>);
const
instance
=
(
tree
.
getInstance
()
as
unknown
)
as
Table
;
return
{
tree
,
instance
,
};
};
describe
(
'Table'
,
()
=>
{
it
(
'ignore invalid properties'
,
()
=>
{
const
{
tree
,
instance
}
=
setup
();
expect
(
tree
.
toJSON
()
+
''
).
toEqual
(
setup
({
id
:
3
,
// Don't pass invalid parameters to MultiGrid
}).
tree
.
toJSON
()
+
''
);
expect
(
instance
.
measurer
.
has
(
0
,
0
)).
toBeTruthy
();
});
});
packages/grafana-ui/src/components/Table/Table.tsx
View file @
2a52dbfb
...
...
@@ -282,14 +282,16 @@ export class Table extends Component<Props, State> {
this
.
scrollToTop
=
false
;
}
// Force MultiGrid to rerender if these options change
// See: https://github.com/bvaughn/react-virtualized#pass-thru-props
const
refreshKeys
=
{
...
this
.
state
,
// Includes data and sort parameters
d1
:
this
.
props
.
data
,
s0
:
this
.
props
.
styles
,
};
return
(
<
MultiGrid
{
...
this
.
state
/** Force MultiGrid to update when data changes */
}
{
...
this
.
props
/** Force MultiGrid to update when data changes */
}
{
...
refreshKeys
}
scrollToRow=
{
scrollToRow
}
columnCount=
{
columnCount
}
scrollToColumn=
{
scrollToColumn
}
...
...
packages/grafana-ui/src/components/Table/TableCellBuilder.tsx
View file @
2a52dbfb
...
...
@@ -157,10 +157,7 @@ class CellBuilderWithStyle {
private
column
:
Field
,
private
replaceVariables
:
InterpolateFunction
,
private
fmt
?:
ValueFormatter
)
{
//
console
.
log
(
'COLUMN'
,
column
.
name
,
theme
);
}
)
{}
getColorForValue
=
(
value
:
any
):
string
|
null
=>
{
const
{
thresholds
,
colors
}
=
this
.
style
;
...
...
packages/grafana-ui/src/components/Table/_Table.scss
View file @
2a52dbfb
...
...
@@ -70,6 +70,7 @@
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
overflow
:
hidden
;
border-right
:
2px
solid
$body-bg
;
border-bottom
:
2px
solid
$body-bg
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment