From 6980d2e1421652e8ed8e1c1d842d8c25136063b5 Mon Sep 17 00:00:00 2001 From: David Kaltschmidt Date: Tue, 4 Dec 2018 16:18:07 +0100 Subject: [PATCH] Explore: Display duplicate row count as number - the pips were hard to see - make it really clear which rows are duplicates by allocating a column to show number --- public/app/features/explore/Logs.tsx | 35 +++++++++++++++++++--------- public/sass/pages/_explore.scss | 19 ++------------- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/public/app/features/explore/Logs.tsx b/public/app/features/explore/Logs.tsx index 5a43591df4f..3a584cd5664 100644 --- a/public/app/features/explore/Logs.tsx +++ b/public/app/features/explore/Logs.tsx @@ -40,13 +40,23 @@ interface RowProps { allRows: LogRow[]; highlighterExpressions?: string[]; row: LogRow; + showDuplicates: boolean; showLabels: boolean | null; // Tristate: null means auto showLocalTime: boolean; showUtc: boolean; onClickLabel?: (label: string, value: string) => void; } -function Row({ allRows, highlighterExpressions, onClickLabel, row, showLabels, showLocalTime, showUtc }: RowProps) { +function Row({ + allRows, + highlighterExpressions, + onClickLabel, + row, + showDuplicates, + showLabels, + showLocalTime, + showUtc, +}: RowProps) { const previewHighlights = highlighterExpressions && !_.isEqual(highlighterExpressions, row.searchWords); const highlights = previewHighlights ? highlighterExpressions : row.searchWords; const needsHighlighter = highlights && highlights.length > 0; @@ -55,15 +65,10 @@ function Row({ allRows, highlighterExpressions, onClickLabel, row, showLabels, s }); return ( <> -
- {row.duplicates > 0 && ( -
- {Array.apply(null, { length: row.duplicates }).map((bogus, index) => ( -
- ))} -
- )} -
+ {showDuplicates && ( +
{row.duplicates > 0 ? `${row.duplicates + 1}x` : null}
+ )} +
{showUtc && (
{row.timestamp} @@ -228,6 +233,7 @@ export default class Logs extends PureComponent { const { dedup, deferLogs, hiddenLogLevels, renderAll, showLocalTime, showUtc } = this.state; let { showLabels } = this.state; const hasData = data && data.rows && data.rows.length > 0; + const showDuplicates = dedup !== LogsDedupStrategy.none; // Filtering const filteredData = filterLogLevels(data, hiddenLogLevels); @@ -257,7 +263,12 @@ export default class Logs extends PureComponent { } // Grid options - const cssColumnSizes = ['3px']; // Log-level indicator line + const cssColumnSizes = []; + if (showDuplicates) { + cssColumnSizes.push('max-content'); + } + // Log-level indicator line + cssColumnSizes.push('3px'); if (showUtc) { cssColumnSizes.push('minmax(100px, max-content)'); } @@ -341,6 +352,7 @@ export default class Logs extends PureComponent { allRows={processedRows} highlighterExpressions={highlighterExpressions} row={row} + showDuplicates={showDuplicates} showLabels={showLabels} showLocalTime={showLocalTime} showUtc={showUtc} @@ -355,6 +367,7 @@ export default class Logs extends PureComponent { key={row.key + row.duplicates} allRows={processedRows} row={row} + showDuplicates={showDuplicates} showLabels={showLabels} showLocalTime={showLocalTime} showUtc={showUtc} diff --git a/public/sass/pages/_explore.scss b/public/sass/pages/_explore.scss index 8ae2cd5456e..5e69b9a1f1a 100644 --- a/public/sass/pages/_explore.scss +++ b/public/sass/pages/_explore.scss @@ -346,23 +346,8 @@ background-color: #6ed0e0; } - .logs-row-level__duplicates { - position: absolute; - width: 9px; - height: 100%; - top: 0; - left: 5px; - display: flex; - flex-wrap: wrap; - align-items: flex-start; - align-content: flex-start; - } - - .logs-row-level__duplicate { - width: 2px; - height: 3px; - background-color: #1f78c1; - margin: 0 1px 1px 0; + .logs-row-duplicates { + text-align: right; } .logs-label {