mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
NewPanelEdit: Fixed error with custom override properties (#23055)
This commit is contained in:
parent
0ed78068a2
commit
0870ccea7d
@ -204,8 +204,8 @@ function setDynamicConfigValue(config: FieldConfig, value: DynamicConfigValue, c
|
||||
const remove = val === undefined || val === null;
|
||||
|
||||
if (remove) {
|
||||
if (value.custom) {
|
||||
delete (config?.custom as any)[value.prop];
|
||||
if (value.custom && config.custom) {
|
||||
delete config.custom[value.prop];
|
||||
} else {
|
||||
delete (config as any)[value.prop];
|
||||
}
|
||||
|
@ -105,6 +105,33 @@ export const basicSelectPlainValue = () => {
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Uses plain values instead of SelectableValue<T>
|
||||
*/
|
||||
export const SelectWithOptionDescriptions = () => {
|
||||
// TODO this is not working with new Select
|
||||
|
||||
const [value, setValue] = useState<number>();
|
||||
const options = [
|
||||
{ label: 'hello', value: 1, description: 'this is a description' },
|
||||
{ label: 'hello 2', value: 2, description: 'second description' },
|
||||
];
|
||||
|
||||
return (
|
||||
<>
|
||||
<Select
|
||||
options={options}
|
||||
value={value}
|
||||
onChange={v => {
|
||||
setValue(v.value);
|
||||
}}
|
||||
size="md"
|
||||
{...getDynamicProps()}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Uses plain values instead of SelectableValue<T>
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user