Commit fcf39a08 by Erik Sundell

stackdriver: fix default value bug

parent 042d156e
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment