From 03d4b61208dec3d4800add4a8da915f467c71e11 Mon Sep 17 00:00:00 2001 From: sridhar-komati <32507423+sridhar-komati@users.noreply.github.com> Date: Wed, 13 Mar 2019 20:42:19 +0530 Subject: [PATCH 1/5] used regex instead of string replacing --- public/app/features/templating/custom_variable.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/app/features/templating/custom_variable.ts b/public/app/features/templating/custom_variable.ts index c98048f04ca..f983c4b367b 100644 --- a/public/app/features/templating/custom_variable.ts +++ b/public/app/features/templating/custom_variable.ts @@ -40,7 +40,7 @@ export class CustomVariable implements Variable { updateOptions() { // extract options in comma separated string (use backslash to escape wanted commas) this.options = _.map(this.query.match(/(?:\\,|[^,])+/g), text => { - text = text.replace('\\,', ','); + text = text.replace(/\\,/g, ','); return { text: text.trim(), value: text.trim() }; }); From 8acc00aa663a78ca67a21a28ef1ca2fc1f627983 Mon Sep 17 00:00:00 2001 From: sridhar-komati <32507423+sridhar-komati@users.noreply.github.com> Date: Wed, 13 Mar 2019 21:38:16 +0530 Subject: [PATCH 2/5] fix for firefox checkboxes not appearing properly, added appearance as none --- public/sass/components/_switch.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/public/sass/components/_switch.scss b/public/sass/components/_switch.scss index 09b32463370..fc7abcc3f26 100644 --- a/public/sass/components/_switch.scss +++ b/public/sass/components/_switch.scss @@ -94,6 +94,7 @@ input:checked + .gf-form-switch__slider::before { opacity: 0; width: 0; height: 0; + appearance: none; } &--transparent { From 17184257afe8ea70aa9eadf09ec71c3cc27ef2f8 Mon Sep 17 00:00:00 2001 From: Steven Sheehy Date: Wed, 13 Mar 2019 11:10:09 -0500 Subject: [PATCH 3/5] explore/logs: Hide empty duplicates column Signed-off-by: Steven Sheehy --- public/app/features/explore/Logs.tsx | 19 ++++--------------- public/sass/components/_panel_logs.scss | 2 +- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/public/app/features/explore/Logs.tsx b/public/app/features/explore/Logs.tsx index f8e833d9ee1..2f4cf93dbf7 100644 --- a/public/app/features/explore/Logs.tsx +++ b/public/app/features/explore/Logs.tsx @@ -64,7 +64,7 @@ interface Props { interface State { deferLogs: boolean; renderAll: boolean; - showLabels: boolean | null; // Tristate: null means auto + showLabels: boolean; showLocalTime: boolean; showUtc: boolean; } @@ -76,7 +76,7 @@ export default class Logs extends PureComponent { state = { deferLogs: true, renderAll: false, - showLabels: null, + showLabels: false, showLocalTime: true, showUtc: false, }; @@ -166,12 +166,11 @@ export default class Logs extends PureComponent { return null; } - const { deferLogs, renderAll, showLocalTime, showUtc } = this.state; - let { showLabels } = this.state; + const { deferLogs, renderAll, showLabels, showLocalTime, showUtc } = this.state; const { dedupStrategy } = this.props; 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 showDuplicates = dedupStrategy !== LogsDedupStrategy.none && dedupCount > 0; const meta = [...data.meta]; if (dedupStrategy !== LogsDedupStrategy.none) { @@ -186,16 +185,6 @@ export default class Logs extends PureComponent { const processedRows = dedupedData.rows; const firstRows = processedRows.slice(0, 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...'; // React profiler becomes unusable if we pass all rows to all rows and their labels, using getter instead diff --git a/public/sass/components/_panel_logs.scss b/public/sass/components/_panel_logs.scss index 5d35f8fddc0..8262df4b45f 100644 --- a/public/sass/components/_panel_logs.scss +++ b/public/sass/components/_panel_logs.scss @@ -173,7 +173,7 @@ $column-horizontal-spacing: 10px; .logs-row__duplicates { text-align: right; - width: 4.5em; + width: 4em; } .logs-row__field-highlight { From 36d67f22e9beef4479ab60ddd9f481707272f455 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 13 Mar 2019 11:24:18 -0700 Subject: [PATCH 4/5] generic repeater --- .../src/components/VizRepeater/VizRepeater.tsx | 18 +++++++++--------- .../plugins/panel/bargauge/BarGaugePanel.tsx | 2 +- public/app/plugins/panel/gauge/GaugePanel.tsx | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/grafana-ui/src/components/VizRepeater/VizRepeater.tsx b/packages/grafana-ui/src/components/VizRepeater/VizRepeater.tsx index 767be6764ca..a78a362d616 100644 --- a/packages/grafana-ui/src/components/VizRepeater/VizRepeater.tsx +++ b/packages/grafana-ui/src/components/VizRepeater/VizRepeater.tsx @@ -1,23 +1,23 @@ import React, { PureComponent } from 'react'; -import { SingleStatValueInfo, VizOrientation } from '../../types'; +import { VizOrientation } from '../../types'; -interface RenderProps { +interface RenderProps { vizWidth: number; vizHeight: number; - valueInfo: SingleStatValueInfo; + value: T; } -interface Props { - children: (renderProps: RenderProps) => JSX.Element | JSX.Element[]; +interface Props { + children: (renderProps: RenderProps) => JSX.Element | JSX.Element[]; height: number; width: number; - values: SingleStatValueInfo[]; + values: T[]; orientation: VizOrientation; } const SPACE_BETWEEN = 10; -export class VizRepeater extends PureComponent { +export class VizRepeater extends PureComponent> { getOrientation(): VizOrientation { const { orientation, width, height } = this.props; @@ -64,10 +64,10 @@ export class VizRepeater extends PureComponent { return (
- {values.map((valueInfo, index) => { + {values.map((value, index) => { return (
- {children({ vizHeight, vizWidth, valueInfo })} + {children({ vizHeight, vizWidth, value })}
); })} diff --git a/public/app/plugins/panel/bargauge/BarGaugePanel.tsx b/public/app/plugins/panel/bargauge/BarGaugePanel.tsx index cef28414e73..aad6b00fdc0 100644 --- a/public/app/plugins/panel/bargauge/BarGaugePanel.tsx +++ b/public/app/plugins/panel/bargauge/BarGaugePanel.tsx @@ -49,7 +49,7 @@ export class BarGaugePanel extends PureComponent { return ( - {({ vizHeight, vizWidth, valueInfo }) => this.renderBarGauge(valueInfo.value, vizWidth, vizHeight)} + {({ vizHeight, vizWidth, value }) => this.renderBarGauge(value, vizWidth, vizHeight)} ); } diff --git a/public/app/plugins/panel/gauge/GaugePanel.tsx b/public/app/plugins/panel/gauge/GaugePanel.tsx index ca7f4d5057e..f2f53cdc2ee 100644 --- a/public/app/plugins/panel/gauge/GaugePanel.tsx +++ b/public/app/plugins/panel/gauge/GaugePanel.tsx @@ -52,7 +52,7 @@ export class GaugePanel extends PureComponent { return ( - {({ vizHeight, vizWidth, valueInfo }) => this.renderGauge(valueInfo.value, vizWidth, vizHeight)} + {({ vizHeight, vizWidth, value }) => this.renderGauge(value, vizWidth, vizHeight)} ); } From 6472c2bcd9484b03416c9aa34976c93670959b84 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 13 Mar 2019 11:30:52 -0700 Subject: [PATCH 5/5] generic repeater --- public/app/plugins/panel/bargauge/BarGaugePanel.tsx | 6 +++--- public/app/plugins/panel/gauge/GaugePanel.tsx | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/public/app/plugins/panel/bargauge/BarGaugePanel.tsx b/public/app/plugins/panel/bargauge/BarGaugePanel.tsx index aad6b00fdc0..9f60c3440eb 100644 --- a/public/app/plugins/panel/bargauge/BarGaugePanel.tsx +++ b/public/app/plugins/panel/bargauge/BarGaugePanel.tsx @@ -10,12 +10,12 @@ import { BarGauge, VizRepeater } from '@grafana/ui'; // Types import { BarGaugeOptions } from './types'; -import { PanelProps } from '@grafana/ui/src/types'; +import { PanelProps, SingleStatValueInfo } from '@grafana/ui/src/types'; interface Props extends PanelProps {} export class BarGaugePanel extends PureComponent { - renderBarGauge(value, width, height) { + renderBarGauge(value: SingleStatValueInfo, width, height) { const { replaceVariables, options } = this.props; const { valueOptions } = options; @@ -24,7 +24,7 @@ export class BarGaugePanel extends PureComponent { return ( {} export class GaugePanel extends PureComponent { - renderGauge(value, width, height) { + renderGauge(value: SingleStatValueInfo, width, height) { const { replaceVariables, options } = this.props; const { valueOptions } = options; @@ -24,7 +24,7 @@ export class GaugePanel extends PureComponent { return (