fix(explore): changing metric aggregate doesn't update label (#11946)

* fix: [chart]heatmap selecting metrics does not update the query results
fixes issue #11866
title's label is overriding metric label.

* Using custom label to decide label of metrics.

* lint

* Tests fixed

* early metric label check while saving from ui

* early custom label check

* removed extra space

* no state mutations

* simplify

* removed log

* nned to fix linting issue

* Lint fixed
This commit is contained in:
Mayur Newase 2020-12-10 13:00:57 +05:30 committed by GitHub
parent c73904b02e
commit 8cc566792a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 3 deletions

View File

@ -100,10 +100,19 @@ export default class AdhocMetricEditPopover extends React.Component {
}
onSave() {
// unset isNew here in case save button was clicked when no changes were made
const { title } = this.props;
const { hasCustomLabel } = title;
let { label } = title;
const { adhocMetric } = this.state;
const metricLabel = adhocMetric.label;
if (!hasCustomLabel) {
label = metricLabel;
}
this.props.onChange({
...this.state.adhocMetric,
...this.props.title,
...adhocMetric,
label,
hasCustomLabel,
// unset isNew here in case save button was clicked when no changes were made
isNew: false,
});
this.props.onClose();