From ff0ca6b7e214d0ca9b107058f2942ed289b5e615 Mon Sep 17 00:00:00 2001 From: Patrick O'Carroll Date: Thu, 2 Aug 2018 15:25:48 +0200 Subject: [PATCH] added two new classes for color, fixed so link has value color --- public/app/plugins/panel/table/renderer.ts | 20 ++++++++++++-------- public/sass/components/_panel_table.scss | 20 ++++++++++++++------ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/public/app/plugins/panel/table/renderer.ts b/public/app/plugins/panel/table/renderer.ts index e4d3626c3b9..95f54a64904 100644 --- a/public/app/plugins/panel/table/renderer.ts +++ b/public/app/plugins/panel/table/renderer.ts @@ -216,8 +216,8 @@ export class TableRenderer { var cellClass = ''; if (this.colorState.cell) { - style = ' style="background-color:' + this.colorState.cell + ';color: white"'; - cellClasses.push('white'); + style = ' style="background-color:' + this.colorState.cell + '"'; + cellClasses.push('table-panel-color-cell'); this.colorState.cell = null; } else if (this.colorState.value) { style = ' style="color:' + this.colorState.value + '"'; @@ -253,11 +253,8 @@ export class TableRenderer { cellClasses.push('table-panel-cell-link'); - if (this.colorState.row) { - cellClasses.push('white'); - } columnHtml += ` - + ${value} `; @@ -291,6 +288,8 @@ export class TableRenderer { let startPos = page * pageSize; let endPos = Math.min(startPos + pageSize, this.table.rows.length); var html = ''; + let rowClasses = []; + let rowClass = ''; for (var y = startPos; y < endPos; y++) { let row = this.table.rows[y]; @@ -301,11 +300,16 @@ export class TableRenderer { } if (this.colorState.row) { - rowStyle = ' style="background-color:' + this.colorState.row + ';color: white"'; + rowStyle = ' style="background-color:' + this.colorState.row + '"'; + rowClasses.push('table-panel-color-row'); this.colorState.row = null; } - html += '' + cellHtml + ''; + if (rowClasses.length) { + rowClass = ' class="' + rowClasses.join(' ') + '"'; + } + + html += '' + cellHtml + ''; } return html; diff --git a/public/sass/components/_panel_table.scss b/public/sass/components/_panel_table.scss index fc14236c2b7..225238b102c 100644 --- a/public/sass/components/_panel_table.scss +++ b/public/sass/components/_panel_table.scss @@ -87,12 +87,6 @@ height: 100%; display: inline-block; } - - &.white { - a { - color: white; - } - } } &.cell-highlighted:hover { @@ -139,3 +133,17 @@ height: 0px; line-height: 0px; } + +.table-panel-color-cell { + color: white; + a { + color: white; + } +} + +.table-panel-color-row { + color: white; + a { + color: white; + } +}