mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
OverrideEditor: Use field config default value when adding a new override (#24347)
This commit is contained in:
parent
66b7398fb6
commit
75ce947267
@ -82,14 +82,18 @@ export const OverrideEditor: React.FC<OverrideEditorProps> = ({
|
|||||||
|
|
||||||
const onDynamicConfigValueAdd = useCallback(
|
const onDynamicConfigValueAdd = useCallback(
|
||||||
(id: string) => {
|
(id: string) => {
|
||||||
|
const registryItem = registry.get(id);
|
||||||
const propertyConfig: DynamicConfigValue = {
|
const propertyConfig: DynamicConfigValue = {
|
||||||
id,
|
id,
|
||||||
|
value: registryItem.defaultValue,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (override.properties) {
|
if (override.properties) {
|
||||||
override.properties.push(propertyConfig);
|
override.properties.push(propertyConfig);
|
||||||
} else {
|
} else {
|
||||||
override.properties = [propertyConfig];
|
override.properties = [propertyConfig];
|
||||||
}
|
}
|
||||||
|
|
||||||
onChange(override);
|
onChange(override);
|
||||||
},
|
},
|
||||||
[override, onChange]
|
[override, onChange]
|
||||||
|
Loading…
Reference in New Issue
Block a user