diff --git a/CHANGELOG.md b/CHANGELOG.md index 4486992..2ebe70f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Development +### Added + +- Default Percentile Value when percentile metric is selected + ## 1.1.1 ### Added diff --git a/src/components/QueryEditor.tsx b/src/components/QueryEditor.tsx index b74ae5e..ce3c8c5 100644 --- a/src/components/QueryEditor.tsx +++ b/src/components/QueryEditor.tsx @@ -69,7 +69,17 @@ export function QueryEditor(props: Props) { }; const handleAggregationChange = (item: SelectableValue) => { - props.onChange({ ...query, metric: item.value }); + // set a default value when percentile is selected and delete percentileValue when percentile is deselected + // to not pollute the dashboard.json file + let percentile = undefined; + if (item.value === 'percentile' && percentileValue == null) { + setPercentileValue(95); + percentile = 95; + } else { + setPercentileValue(undefined); + } + + props.onChange({ ...query, metric: item.value, percentileValue: percentile }); props.onRunQuery(); };