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
fdedb917
Unverified
Commit
fdedb917
authored
Nov 05, 2018
by
Marcus Efraimsson
Committed by
GitHub
Nov 05, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #13892 from grisme/13606-table-cell-background-color
Fix bug with background color in table cell with link
parents
5882e5bb
32c93793
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
116 additions
and
8 deletions
+116
-8
devenv/dev-dashboards/panel_tests_table.json
+109
-2
public/app/plugins/panel/table/renderer.ts
+7
-6
No files found.
devenv/dev-dashboards/panel_tests_table.json
View file @
fdedb917
...
...
@@ -404,6 +404,112 @@
"title"
:
"Column style thresholds & units"
,
"transform"
:
"timeseries_to_columns"
,
"type"
:
"table"
},
{
"columns"
:
[],
"datasource"
:
"gdev-testdata"
,
"fontSize"
:
"100%"
,
"gridPos"
:
{
"h"
:
10
,
"w"
:
24
,
"x"
:
0
,
"y"
:
26
},
"id"
:
6
,
"links"
:
[],
"pageSize"
:
20
,
"scroll"
:
true
,
"showHeader"
:
true
,
"sort"
:
{
"col"
:
0
,
"desc"
:
true
},
"styles"
:
[
{
"alias"
:
"Time"
,
"dateFormat"
:
"YYYY-MM-DD HH:mm:ss"
,
"pattern"
:
"Time"
,
"type"
:
"date"
},
{
"alias"
:
""
,
"colorMode"
:
"cell"
,
"colors"
:
[
"rgba(245, 54, 54, 0.5)"
,
"rgba(237, 129, 40, 0.5)"
,
"rgba(50, 172, 45, 0.5)"
],
"dateFormat"
:
"YYYY-MM-DD HH:mm:ss"
,
"decimals"
:
2
,
"link"
:
true
,
"linkTargetBlank"
:
true
,
"linkTooltip"
:
""
,
"linkUrl"
:
"http://www.grafana.com"
,
"mappingType"
:
1
,
"pattern"
:
"ColorCell"
,
"thresholds"
:
[
"5"
,
"10"
],
"type"
:
"number"
,
"unit"
:
"currencyUSD"
},
{
"alias"
:
""
,
"colorMode"
:
"value"
,
"colors"
:
[
"rgba(245, 54, 54, 0.5)"
,
"rgba(237, 129, 40, 0.5)"
,
"rgba(50, 172, 45, 0.5)"
],
"dateFormat"
:
"YYYY-MM-DD HH:mm:ss"
,
"decimals"
:
2
,
"link"
:
true
,
"linkUrl"
:
"http://www.grafana.com"
,
"mappingType"
:
1
,
"pattern"
:
"ColorValue"
,
"thresholds"
:
[
"5"
,
"10"
],
"type"
:
"number"
,
"unit"
:
"Bps"
},
{
"alias"
:
""
,
"colorMode"
:
null
,
"colors"
:
[
"rgba(245, 54, 54, 0.9)"
,
"rgba(237, 129, 40, 0.89)"
,
"rgba(50, 172, 45, 0.97)"
],
"decimals"
:
2
,
"pattern"
:
"/.*/"
,
"thresholds"
:
[],
"type"
:
"number"
,
"unit"
:
"short"
}
],
"targets"
:
[
{
"alias"
:
"ColorValue"
,
"expr"
:
""
,
"format"
:
"table"
,
"intervalFactor"
:
1
,
"refId"
:
"A"
,
"scenarioId"
:
"csv_metric_values"
,
"stringInput"
:
"null,1,20,90,30,5,0,20,10"
},
{
"alias"
:
"ColorCell"
,
"refId"
:
"B"
,
"scenarioId"
:
"csv_metric_values"
,
"stringInput"
:
"null,5,1,2,3,4,5,10,20"
}
],
"title"
:
"Column style thresholds and links"
,
"transform"
:
"timeseries_to_columns"
,
"type"
:
"table"
}
],
"refresh"
:
false
,
...
...
@@ -449,5 +555,5 @@
"timezone"
:
"browser"
,
"title"
:
"Panel Tests - Table"
,
"uid"
:
"pttable"
,
"version"
:
1
}
"version"
:
2
}
\ No newline at end of file
public/app/plugins/panel/table/renderer.ts
View file @
fdedb917
...
...
@@ -211,16 +211,17 @@ export class TableRenderer {
value
=
this
.
formatColumnValue
(
columnIndex
,
value
);
const
column
=
this
.
table
.
columns
[
columnIndex
];
let
style
=
''
;
let
cellStyle
=
''
;
let
textStyle
=
''
;
const
cellClasses
=
[];
let
cellClass
=
''
;
if
(
this
.
colorState
.
cell
)
{
s
tyle
=
' style="background-color:'
+
this
.
colorState
.
cell
+
'"'
;
cellS
tyle
=
' style="background-color:'
+
this
.
colorState
.
cell
+
'"'
;
cellClasses
.
push
(
'table-panel-color-cell'
);
this
.
colorState
.
cell
=
null
;
}
else
if
(
this
.
colorState
.
value
)
{
s
tyle
=
' style="color:'
+
this
.
colorState
.
value
+
'"'
;
textS
tyle
=
' style="color:'
+
this
.
colorState
.
value
+
'"'
;
this
.
colorState
.
value
=
null
;
}
// because of the fixed table headers css only solution
...
...
@@ -232,7 +233,7 @@ export class TableRenderer {
}
if
(
value
===
undefined
)
{
s
tyle
=
' style="display:none;"'
;
cellS
tyle
=
' style="display:none;"'
;
column
.
hidden
=
true
;
}
else
{
column
.
hidden
=
false
;
...
...
@@ -258,7 +259,7 @@ export class TableRenderer {
cellClasses
.
push
(
'table-panel-cell-link'
);
columnHtml
+=
`
<a href="
${
cellLink
}
" target="
${
cellTarget
}
" data-link-tooltip data-original-title="
${
cellLinkTooltip
}
" data-placement="right"
${
s
tyle
}
>
<a href="
${
cellLink
}
" target="
${
cellTarget
}
" data-link-tooltip data-original-title="
${
cellLinkTooltip
}
" data-placement="right"
${
textS
tyle
}
>
${
value
}
</a>
`
;
...
...
@@ -283,7 +284,7 @@ export class TableRenderer {
cellClass
=
' class="'
+
cellClasses
.
join
(
' '
)
+
'"'
;
}
columnHtml
=
'<td'
+
cellClass
+
s
tyle
+
'>'
+
columnHtml
+
'</td>'
;
columnHtml
=
'<td'
+
cellClass
+
cellStyle
+
textS
tyle
+
'>'
+
columnHtml
+
'</td>'
;
return
columnHtml
;
}
...
...
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