2024-06-25 19:43:47 +08:00
|
|
|
import { FormEvent } from 'react';
|
2024-01-18 18:04:29 +08:00
|
|
|
|
|
|
|
import { selectors } from '@grafana/e2e-selectors';
|
|
|
|
|
|
|
|
import { VariableLegend } from './VariableLegend';
|
|
|
|
import { VariableTextField } from './VariableTextField';
|
|
|
|
|
|
|
|
interface ConstantVariableFormProps {
|
|
|
|
constantValue: string;
|
|
|
|
onChange: (event: FormEvent<HTMLInputElement>) => void;
|
|
|
|
}
|
|
|
|
|
|
|
|
export function ConstantVariableForm({ onChange, constantValue }: ConstantVariableFormProps) {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<VariableLegend>Constant options</VariableLegend>
|
|
|
|
<VariableTextField
|
|
|
|
defaultValue={constantValue}
|
|
|
|
name="Value"
|
|
|
|
placeholder="your metric prefix"
|
|
|
|
onBlur={onChange}
|
|
|
|
testId={selectors.pages.Dashboard.Settings.Variables.Edit.ConstantVariable.constantOptionsQueryInputV2}
|
|
|
|
width={30}
|
|
|
|
/>
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
}
|