mirror of
https://github.com/grafana/grafana.git
synced 2025-02-10 15:45:43 -06:00
Merge pull request #15982 from steven-sheehy/hide-duplicate-column
explore/logs: Hide empty duplicates column
This commit is contained in:
commit
9c4abc9d0c
@ -64,7 +64,7 @@ interface Props {
|
|||||||
interface State {
|
interface State {
|
||||||
deferLogs: boolean;
|
deferLogs: boolean;
|
||||||
renderAll: boolean;
|
renderAll: boolean;
|
||||||
showLabels: boolean | null; // Tristate: null means auto
|
showLabels: boolean;
|
||||||
showLocalTime: boolean;
|
showLocalTime: boolean;
|
||||||
showUtc: boolean;
|
showUtc: boolean;
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ export default class Logs extends PureComponent<Props, State> {
|
|||||||
state = {
|
state = {
|
||||||
deferLogs: true,
|
deferLogs: true,
|
||||||
renderAll: false,
|
renderAll: false,
|
||||||
showLabels: null,
|
showLabels: false,
|
||||||
showLocalTime: true,
|
showLocalTime: true,
|
||||||
showUtc: false,
|
showUtc: false,
|
||||||
};
|
};
|
||||||
@ -166,12 +166,11 @@ export default class Logs extends PureComponent<Props, State> {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { deferLogs, renderAll, showLocalTime, showUtc } = this.state;
|
const { deferLogs, renderAll, showLabels, showLocalTime, showUtc } = this.state;
|
||||||
let { showLabels } = this.state;
|
|
||||||
const { dedupStrategy } = this.props;
|
const { dedupStrategy } = this.props;
|
||||||
const hasData = data && data.rows && data.rows.length > 0;
|
const hasData = data && data.rows && data.rows.length > 0;
|
||||||
const showDuplicates = dedupStrategy !== LogsDedupStrategy.none;
|
|
||||||
const dedupCount = dedupedData.rows.reduce((sum, row) => sum + row.duplicates, 0);
|
const dedupCount = dedupedData.rows.reduce((sum, row) => sum + row.duplicates, 0);
|
||||||
|
const showDuplicates = dedupStrategy !== LogsDedupStrategy.none && dedupCount > 0;
|
||||||
const meta = [...data.meta];
|
const meta = [...data.meta];
|
||||||
|
|
||||||
if (dedupStrategy !== LogsDedupStrategy.none) {
|
if (dedupStrategy !== LogsDedupStrategy.none) {
|
||||||
@ -186,16 +185,6 @@ export default class Logs extends PureComponent<Props, State> {
|
|||||||
const processedRows = dedupedData.rows;
|
const processedRows = dedupedData.rows;
|
||||||
const firstRows = processedRows.slice(0, PREVIEW_LIMIT);
|
const firstRows = processedRows.slice(0, PREVIEW_LIMIT);
|
||||||
const lastRows = processedRows.slice(PREVIEW_LIMIT);
|
const lastRows = processedRows.slice(PREVIEW_LIMIT);
|
||||||
|
|
||||||
// Check for labels
|
|
||||||
if (showLabels === null) {
|
|
||||||
if (hasData) {
|
|
||||||
showLabels = data.rows.some(row => _.size(row.uniqueLabels) > 0);
|
|
||||||
} else {
|
|
||||||
showLabels = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const scanText = scanRange ? `Scanning ${rangeUtil.describeTimeRange(scanRange)}` : 'Scanning...';
|
const scanText = scanRange ? `Scanning ${rangeUtil.describeTimeRange(scanRange)}` : 'Scanning...';
|
||||||
|
|
||||||
// React profiler becomes unusable if we pass all rows to all rows and their labels, using getter instead
|
// React profiler becomes unusable if we pass all rows to all rows and their labels, using getter instead
|
||||||
|
@ -173,7 +173,7 @@ $column-horizontal-spacing: 10px;
|
|||||||
|
|
||||||
.logs-row__duplicates {
|
.logs-row__duplicates {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
width: 4.5em;
|
width: 4em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logs-row__field-highlight {
|
.logs-row__field-highlight {
|
||||||
|
Loading…
Reference in New Issue
Block a user