mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
stackdriver: use arrow functions
This commit is contained in:
parent
e698202fae
commit
2e0cbe75ee
@ -5,8 +5,6 @@ export default class DefaultVariableQueryEditor extends PureComponent<VariableQu
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = { value: props.query };
|
this.state = { value: props.query };
|
||||||
this.handleChange = this.handleChange.bind(this);
|
|
||||||
this.handleBlur = this.handleBlur.bind(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChange(event) {
|
handleChange(event) {
|
||||||
@ -25,8 +23,8 @@ export default class DefaultVariableQueryEditor extends PureComponent<VariableQu
|
|||||||
type="text"
|
type="text"
|
||||||
className="gf-form-input"
|
className="gf-form-input"
|
||||||
value={this.state.value}
|
value={this.state.value}
|
||||||
onChange={this.handleChange}
|
onChange={e => this.handleChange(e)}
|
||||||
onBlur={this.handleBlur}
|
onBlur={e => this.handleBlur(e)}
|
||||||
placeholder="metric name or tags query"
|
placeholder="metric name or tags query"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
@ -29,10 +29,6 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
|
|||||||
|
|
||||||
constructor(props: VariableQueryProps) {
|
constructor(props: VariableQueryProps) {
|
||||||
super(props);
|
super(props);
|
||||||
this.handleQueryTypeChange = this.handleQueryTypeChange.bind(this);
|
|
||||||
this.onServiceChange = this.onServiceChange.bind(this);
|
|
||||||
this.onMetricTypeChange = this.onMetricTypeChange.bind(this);
|
|
||||||
this.onLabelKeyChange = this.onLabelKeyChange.bind(this);
|
|
||||||
this.state = Object.assign(this.defaults, this.props.query);
|
this.state = Object.assign(this.defaults, this.props.query);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +123,7 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
|
|||||||
<SimpleSelect
|
<SimpleSelect
|
||||||
value={this.state.selectedService}
|
value={this.state.selectedService}
|
||||||
options={this.state.services}
|
options={this.state.services}
|
||||||
onValueChange={this.onServiceChange}
|
onValueChange={e => this.onServiceChange(e)}
|
||||||
label="Services"
|
label="Services"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
@ -139,20 +135,20 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
|
|||||||
<SimpleSelect
|
<SimpleSelect
|
||||||
value={this.state.selectedService}
|
value={this.state.selectedService}
|
||||||
options={this.state.services}
|
options={this.state.services}
|
||||||
onValueChange={this.onServiceChange}
|
onValueChange={e => this.onServiceChange(e)}
|
||||||
label="Services"
|
label="Services"
|
||||||
/>
|
/>
|
||||||
<SimpleSelect
|
<SimpleSelect
|
||||||
value={this.state.selectedMetricType}
|
value={this.state.selectedMetricType}
|
||||||
options={this.state.metricTypes}
|
options={this.state.metricTypes}
|
||||||
onValueChange={this.onMetricTypeChange}
|
onValueChange={e => this.onMetricTypeChange(e)}
|
||||||
label="Metric Types"
|
label="Metric Types"
|
||||||
/>
|
/>
|
||||||
{queryType !== MetricFindQueryTypes.ResourceTypes && (
|
{queryType !== MetricFindQueryTypes.ResourceTypes && (
|
||||||
<SimpleSelect
|
<SimpleSelect
|
||||||
value={this.state.labelKey}
|
value={this.state.labelKey}
|
||||||
options={this.state.labels.map(l => ({ value: l, name: l }))}
|
options={this.state.labels.map(l => ({ value: l, name: l }))}
|
||||||
onValueChange={this.onLabelKeyChange}
|
onValueChange={e => this.onLabelKeyChange(e)}
|
||||||
label={
|
label={
|
||||||
this.state.selectedQueryType === MetricFindQueryTypes.ResourceLabels
|
this.state.selectedQueryType === MetricFindQueryTypes.ResourceLabels
|
||||||
? 'Resource Label Key'
|
? 'Resource Label Key'
|
||||||
@ -169,13 +165,13 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
|
|||||||
<SimpleSelect
|
<SimpleSelect
|
||||||
value={this.state.selectedService}
|
value={this.state.selectedService}
|
||||||
options={this.state.services}
|
options={this.state.services}
|
||||||
onValueChange={this.onServiceChange}
|
onValueChange={e => this.onServiceChange(e)}
|
||||||
label="Services"
|
label="Services"
|
||||||
/>
|
/>
|
||||||
<SimpleSelect
|
<SimpleSelect
|
||||||
value={this.state.selectedMetricType}
|
value={this.state.selectedMetricType}
|
||||||
options={this.state.metricTypes}
|
options={this.state.metricTypes}
|
||||||
onValueChange={this.onMetricTypeChange}
|
onValueChange={e => this.onMetricTypeChange(e)}
|
||||||
label="Metric Types"
|
label="Metric Types"
|
||||||
/>
|
/>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
@ -191,7 +187,7 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
|
|||||||
<SimpleSelect
|
<SimpleSelect
|
||||||
value={this.state.selectedQueryType}
|
value={this.state.selectedQueryType}
|
||||||
options={this.queryTypes}
|
options={this.queryTypes}
|
||||||
onValueChange={this.handleQueryTypeChange}
|
onValueChange={e => this.handleQueryTypeChange(e)}
|
||||||
label="Query Types"
|
label="Query Types"
|
||||||
/>
|
/>
|
||||||
{this.renderQueryTypeSwitch(this.state.selectedQueryType)}
|
{this.renderQueryTypeSwitch(this.state.selectedQueryType)}
|
||||||
|
Loading…
Reference in New Issue
Block a user