stackdriver: use arrow functions

This commit is contained in:
Erik Sundell 2018-11-13 11:06:08 +01:00
parent e698202fae
commit 2e0cbe75ee
2 changed files with 9 additions and 15 deletions

View File

@ -5,8 +5,6 @@ export default class DefaultVariableQueryEditor extends PureComponent<VariableQu
constructor(props) {
super(props);
this.state = { value: props.query };
this.handleChange = this.handleChange.bind(this);
this.handleBlur = this.handleBlur.bind(this);
}
handleChange(event) {
@ -25,8 +23,8 @@ export default class DefaultVariableQueryEditor extends PureComponent<VariableQu
type="text"
className="gf-form-input"
value={this.state.value}
onChange={this.handleChange}
onBlur={this.handleBlur}
onChange={e => this.handleChange(e)}
onBlur={e => this.handleBlur(e)}
placeholder="metric name or tags query"
required
/>

View File

@ -29,10 +29,6 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
constructor(props: VariableQueryProps) {
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);
}
@ -127,7 +123,7 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
<SimpleSelect
value={this.state.selectedService}
options={this.state.services}
onValueChange={this.onServiceChange}
onValueChange={e => this.onServiceChange(e)}
label="Services"
/>
);
@ -139,20 +135,20 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
<SimpleSelect
value={this.state.selectedService}
options={this.state.services}
onValueChange={this.onServiceChange}
onValueChange={e => this.onServiceChange(e)}
label="Services"
/>
<SimpleSelect
value={this.state.selectedMetricType}
options={this.state.metricTypes}
onValueChange={this.onMetricTypeChange}
onValueChange={e => this.onMetricTypeChange(e)}
label="Metric Types"
/>
{queryType !== MetricFindQueryTypes.ResourceTypes && (
<SimpleSelect
value={this.state.labelKey}
options={this.state.labels.map(l => ({ value: l, name: l }))}
onValueChange={this.onLabelKeyChange}
onValueChange={e => this.onLabelKeyChange(e)}
label={
this.state.selectedQueryType === MetricFindQueryTypes.ResourceLabels
? 'Resource Label Key'
@ -169,13 +165,13 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
<SimpleSelect
value={this.state.selectedService}
options={this.state.services}
onValueChange={this.onServiceChange}
onValueChange={e => this.onServiceChange(e)}
label="Services"
/>
<SimpleSelect
value={this.state.selectedMetricType}
options={this.state.metricTypes}
onValueChange={this.onMetricTypeChange}
onValueChange={e => this.onMetricTypeChange(e)}
label="Metric Types"
/>
</React.Fragment>
@ -191,7 +187,7 @@ export class StackdriverVariableQueryEditor extends PureComponent<VariableQueryP
<SimpleSelect
value={this.state.selectedQueryType}
options={this.queryTypes}
onValueChange={this.handleQueryTypeChange}
onValueChange={e => this.handleQueryTypeChange(e)}
label="Query Types"
/>
{this.renderQueryTypeSwitch(this.state.selectedQueryType)}