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
22390665
Commit
22390665
authored
Mar 07, 2019
by
ryan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't include stuff from app/...
parent
eed9a201
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
19 deletions
+12
-19
packages/grafana-ui/src/components/Table/Table.test.ts
+7
-8
packages/grafana-ui/src/components/Table/Table.tsx
+5
-11
No files found.
packages/grafana-ui/src/components/Table/Table.test.ts
View file @
22390665
import
_
from
'lodash'
;
import
TableModel
from
'app/core/table_model'
;
import
{
getColorDefinitionByName
}
from
'@grafana/ui'
;
import
{
ScopedVars
}
from
'@grafana/ui/src/types'
;
import
{
ScopedVars
,
TableData
}
from
'@grafana/ui/src/types'
;
import
{
getTheme
}
from
'../../themes'
;
import
Table
,
{
ColumnStyle
}
from
'./Table'
;
...
...
@@ -12,8 +11,9 @@ xdescribe('when rendering table', () => {
const
SemiDarkOrange
=
getColorDefinitionByName
(
'semi-dark-orange'
);
describe
(
'given 13 columns'
,
()
=>
{
const
table
=
new
TableModel
();
table
.
columns
=
[
const
table
=
{
type
:
'table'
,
columns
:
[
{
text
:
'Time'
},
{
text
:
'Value'
},
{
text
:
'Colored'
},
...
...
@@ -27,10 +27,9 @@ xdescribe('when rendering table', () => {
{
text
:
'RangeMapping'
},
{
text
:
'MappingColored'
},
{
text
:
'RangeMappingColored'
},
];
table
.
rows
=
[
[
1388556366666
,
1230
,
40
,
undefined
,
''
,
''
,
'my.host.com'
,
'host1'
,
[
'value1'
,
'value2'
],
1
,
2
,
1
,
2
],
];
],
rows
:
[[
1388556366666
,
1230
,
40
,
undefined
,
''
,
''
,
'my.host.com'
,
'host1'
,
[
'value1'
,
'value2'
],
1
,
2
,
1
,
2
]],
}
as
TableData
;
const
styles
:
ColumnStyle
[]
=
[
{
...
...
packages/grafana-ui/src/components/Table/Table.tsx
View file @
22390665
...
...
@@ -13,16 +13,14 @@ import { Themeable } from '../../types/theme';
import
{
sortTableData
}
from
'../../utils/processTimeSeries'
;
import
{
sanitize
}
from
'app/core/utils/text'
;
import
moment
from
'moment'
;
import
{
getValueFormat
,
TableData
,
getColorFromHexRgbOrName
,
InterpolateFunction
,
Column
}
from
'@grafana/ui'
;
import
{
Index
}
from
'react-virtualized'
;
import
{
ColumnStyle
}
from
'./Table'
;
//
Types
import
kbn
from
'app/core/utils/kbn'
;
//
APP Imports!!!
//
import kbn from 'app/core/utils/kbn';
// Made to match the existing (untyped) settings in the angular table
export
interface
ColumnStyle
{
...
...
@@ -36,7 +34,7 @@ export interface ColumnStyle {
type
?:
'date'
|
'number'
|
'string'
|
'hidden'
;
unit
?:
string
;
dateFormat
?:
string
;
sanitize
?:
boolean
;
sanitize
?:
boolean
;
// not used in react
mappingType
?:
any
;
valueMaps
?:
any
;
rangeMaps
?:
any
;
...
...
@@ -126,7 +124,7 @@ export class Table extends Component<Props, State> {
// Find the style based on the text
for
(
let
i
=
0
;
i
<
styles
.
length
;
i
++
)
{
const
s
=
styles
[
i
];
const
regex
=
kbn
.
stringToJsRegex
(
s
.
pattern
);
const
regex
=
'XXX'
;
//
kbn.stringToJsRegex(s.pattern);
if
(
title
.
match
(
regex
))
{
style
=
s
;
if
(
s
.
alias
)
{
...
...
@@ -172,11 +170,7 @@ export class Table extends Component<Props, State> {
v
=
v
.
join
(
', '
);
}
if
(
style
&&
style
.
sanitize
)
{
return
sanitize
(
v
);
}
else
{
return
_
.
escape
(
v
);
}
return
v
;
// react will sanitize
}
createColumnFormatter
(
schema
:
Column
,
style
?:
ColumnStyle
):
CellFormatter
{
...
...
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