mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
stackdriver: fix default value bug
This commit is contained in:
parent
042d156e5f
commit
fcf39a0839
@ -57,7 +57,7 @@ export class StackdriverTemplateQueryComponent extends PureComponent<TemplateQue
|
||||
metricTypes,
|
||||
selectedMetricType,
|
||||
metricDescriptors,
|
||||
...await this.getLabels(this.state.selectedMetricType),
|
||||
...await this.getLabels(selectedMetricType),
|
||||
};
|
||||
this.setState(state);
|
||||
}
|
||||
@ -95,7 +95,7 @@ export class StackdriverTemplateQueryComponent extends PureComponent<TemplateQue
|
||||
}
|
||||
|
||||
componentDidUpdate() {
|
||||
const { metricDescriptors, labels, ...queryModel } = this.state;
|
||||
const { metricDescriptors, labels, metricTypes, services, ...queryModel } = this.state;
|
||||
this.props.onChange(queryModel);
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ export const getMetricTypes = (metricDescriptors, metricType, selectedService) =
|
||||
name: m.displayName,
|
||||
}));
|
||||
const metricTypeExistInArray = metricTypes.some(m => m.value === metricType);
|
||||
const selectedMetricType = metricTypeExistInArray ? metricTypeExistInArray.value : metricTypes[0].value;
|
||||
const selectedMetricType = metricTypeExistInArray ? metricType : metricTypes[0].value;
|
||||
return {
|
||||
metricTypes,
|
||||
selectedMetricType,
|
||||
|
Loading…
Reference in New Issue
Block a user