|
|
@ -18,7 +18,7 @@ const fieldNamePickerSettings = { |
|
|
|
} as any; |
|
|
|
} as any; |
|
|
|
|
|
|
|
|
|
|
|
export function UseMetricEditor({ onChange, value, context }: StandardEditorProps<UseMetricConfig>) { |
|
|
|
export function UseMetricEditor({ onChange, value, context }: StandardEditorProps<UseMetricConfig>) { |
|
|
|
const config = value; |
|
|
|
let config: UseMetricConfig = value; |
|
|
|
|
|
|
|
|
|
|
|
const onFieldChange = (field: keyof UseMetricConfig, value: any) => { |
|
|
|
const onFieldChange = (field: keyof UseMetricConfig, value: any) => { |
|
|
|
// @ts-ignore
|
|
|
|
// @ts-ignore
|
|
|
@ -31,22 +31,22 @@ export function UseMetricEditor({ onChange, value, context }: StandardEditorProp |
|
|
|
<HorizontalGroup> |
|
|
|
<HorizontalGroup> |
|
|
|
<InlineField label="Use metric"> |
|
|
|
<InlineField label="Use metric"> |
|
|
|
<InlineSwitch |
|
|
|
<InlineSwitch |
|
|
|
value={config.useMetric} |
|
|
|
value={config?.useMetric} |
|
|
|
onChange={(evt) => onFieldChange('useMetric', (evt.target as any).checked)} |
|
|
|
onChange={(evt) => onFieldChange('useMetric', (evt.target as any).checked)} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</InlineField> |
|
|
|
</InlineField> |
|
|
|
<InlineField> |
|
|
|
<InlineField> |
|
|
|
{config.useMetric ? ( |
|
|
|
{config?.useMetric ? ( |
|
|
|
<FieldNamePicker |
|
|
|
<FieldNamePicker |
|
|
|
context={context} |
|
|
|
context={context} |
|
|
|
value={config.metricName as string} |
|
|
|
value={config?.metricName as string} |
|
|
|
onChange={(newVal: any) => onFieldChange('metricName', newVal)} |
|
|
|
onChange={(newVal: any) => onFieldChange('metricName', newVal)} |
|
|
|
item={fieldNamePickerSettings} |
|
|
|
item={fieldNamePickerSettings} |
|
|
|
/> |
|
|
|
/> |
|
|
|
) : ( |
|
|
|
) : ( |
|
|
|
<Input |
|
|
|
<Input |
|
|
|
placeholder="value" |
|
|
|
placeholder="value" |
|
|
|
value={config.value} |
|
|
|
value={config?.value} |
|
|
|
width={24} |
|
|
|
width={24} |
|
|
|
onChange={(evt) => onFieldChange('value', (evt.target as any).value)} |
|
|
|
onChange={(evt) => onFieldChange('value', (evt.target as any).value)} |
|
|
|
/> |
|
|
|
/> |
|
|
|