mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 17:43:35 -06:00
* Update formatRegistry.ts * text edits * Update adapter.ts * Update adapter.ts * text edits * Update SelectionOptionsEditor.tsx * Update CustomVariableEditor.tsx * Update DataSourceVariableEditor.tsx * Update IntervalVariableEditor.tsx * Update VariableEditorList.tsx * Update adapter.ts * Update actions.ts * Update NetworkGraphModal.tsx * Update actions.ts * Update operators.ts * text edits
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import React, { FormEvent, PureComponent } from 'react';
|
|
import { selectors } from '@grafana/e2e-selectors';
|
|
import { VerticalGroup } from '@grafana/ui';
|
|
|
|
import { ConstantVariableModel } from '../types';
|
|
import { VariableEditorProps } from '../editor/types';
|
|
import { VariableSectionHeader } from '../editor/VariableSectionHeader';
|
|
import { VariableTextField } from '../editor/VariableTextField';
|
|
|
|
export interface Props extends VariableEditorProps<ConstantVariableModel> {}
|
|
|
|
export class ConstantVariableEditor extends PureComponent<Props> {
|
|
onChange = (event: FormEvent<HTMLInputElement>) => {
|
|
this.props.onPropChange({
|
|
propName: 'query',
|
|
propValue: event.currentTarget.value,
|
|
});
|
|
};
|
|
|
|
onBlur = (event: FormEvent<HTMLInputElement>) => {
|
|
this.props.onPropChange({
|
|
propName: 'query',
|
|
propValue: event.currentTarget.value,
|
|
updateOptions: true,
|
|
});
|
|
};
|
|
|
|
render() {
|
|
return (
|
|
<VerticalGroup spacing="xs">
|
|
<VariableSectionHeader name="Constant options" />
|
|
<VariableTextField
|
|
value={this.props.variable.query}
|
|
name="Value"
|
|
placeholder="your metric prefix"
|
|
onChange={this.onChange}
|
|
onBlur={this.onBlur}
|
|
labelWidth={20}
|
|
ariaLabel={selectors.pages.Dashboard.Settings.Variables.Edit.ConstantVariable.constantOptionsQueryInput}
|
|
grow
|
|
/>
|
|
</VerticalGroup>
|
|
);
|
|
}
|
|
}
|