mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
fix template variable bug
This commit is contained in:
parent
93d2588c22
commit
3ce4287e8c
@ -22,6 +22,12 @@ export class AliasBy extends Component<Props, State> {
|
||||
this.setState({ value: this.props.value });
|
||||
}
|
||||
|
||||
componentWillReceiveProps(nextProps: Props) {
|
||||
if (nextProps.value !== this.props.value) {
|
||||
this.setState({ value: nextProps.value });
|
||||
}
|
||||
}
|
||||
|
||||
handleChange(e) {
|
||||
this.setState({ value: e.target.value });
|
||||
this.onChange(e.target.value);
|
||||
|
@ -119,7 +119,7 @@ export class Metrics extends React.Component<Props, State> {
|
||||
handleMetricTypeChange(value) {
|
||||
const metricDescriptor = this.getSelectedMetricDescriptor(value);
|
||||
this.setState({ metricDescriptor });
|
||||
this.props.onChange(metricDescriptor);
|
||||
this.props.onChange({ ...metricDescriptor, type: value });
|
||||
}
|
||||
|
||||
getServicesList(metricDescriptors) {
|
||||
@ -170,7 +170,13 @@ export class Metrics extends React.Component<Props, State> {
|
||||
onChange={value => this.handleMetricTypeChange(value)}
|
||||
value={metricType}
|
||||
variables={templateSrv.variables}
|
||||
options={metrics}
|
||||
options={[
|
||||
{
|
||||
label: 'Metrics',
|
||||
expanded: true,
|
||||
options: metrics,
|
||||
},
|
||||
]}
|
||||
placeholder="Select Metric"
|
||||
className="width-15"
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user