mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
VariableEditorForm: Fix multi-value variable runtime error (#80425)
This commit is contained in:
parent
d2293e0848
commit
900fa04c9b
@ -84,7 +84,7 @@ export function VariableEditorForm({ variable, onTypeChange, onGoBack, onDiscard
|
|||||||
|
|
||||||
{EditorToRender && <EditorToRender variable={variable} />}
|
{EditorToRender && <EditorToRender variable={variable} />}
|
||||||
|
|
||||||
{hasVariableOptions(variable) && <VariableValuesPreview options={variable.options} />}
|
{hasVariableOptions(variable) && <VariableValuesPreview options={variable.state.options} />}
|
||||||
|
|
||||||
<div style={{ marginTop: '16px' }}>
|
<div style={{ marginTop: '16px' }}>
|
||||||
<HorizontalGroup spacing="md" height="inherit">
|
<HorizontalGroup spacing="md" height="inherit">
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
QueryVariable,
|
QueryVariable,
|
||||||
AdHocFilterSet,
|
AdHocFilterSet,
|
||||||
SceneVariable,
|
SceneVariable,
|
||||||
VariableValueOption,
|
MultiValueVariable,
|
||||||
} from '@grafana/scenes';
|
} from '@grafana/scenes';
|
||||||
import { VariableType } from '@grafana/schema';
|
import { VariableType } from '@grafana/schema';
|
||||||
|
|
||||||
@ -117,8 +117,6 @@ export function getVariableScene(type: EditableVariableType, initialState: Commo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function hasVariableOptions(
|
export function hasVariableOptions(variable: SceneVariable): variable is MultiValueVariable {
|
||||||
variable: SceneVariable
|
|
||||||
): variable is SceneVariable & { options: VariableValueOption[] } {
|
|
||||||
return 'options' in variable.state;
|
return 'options' in variable.state;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user