mirror of
https://github.com/grafana/grafana.git
synced 2024-11-28 19:54:10 -06:00
FieldOverride: Fixed number override so that it return undefined for null/undefined values and not NaN (#23344)
* FieldOverride: Fixed number override so that it return undefined for null/undefined values and not NaN * Made process function be able to return undefined an null
This commit is contained in:
parent
dea91c1fd6
commit
3fae28be52
@ -17,11 +17,11 @@ export const numberOverrideProcessor = (
|
||||
context: FieldOverrideContext,
|
||||
settings?: NumberFieldConfigSettings
|
||||
) => {
|
||||
const v = parseFloat(`${value}`);
|
||||
if (settings && settings.max && v > settings.max) {
|
||||
// ????
|
||||
if (value === undefined || value === null) {
|
||||
return undefined;
|
||||
}
|
||||
return v;
|
||||
|
||||
return parseFloat(value);
|
||||
};
|
||||
|
||||
export interface DataLinksFieldConfigSettings {}
|
||||
|
@ -69,7 +69,7 @@ export interface FieldPropertyEditorItem<TOptions = any, TValue = any, TSettings
|
||||
override: ComponentType<FieldOverrideEditorProps<TValue, TSettings>>;
|
||||
|
||||
// Convert the override value to a well typed value
|
||||
process: (value: any, context: FieldOverrideContext, settings?: TSettings) => TValue;
|
||||
process: (value: any, context: FieldOverrideContext, settings?: TSettings) => TValue | undefined | null;
|
||||
|
||||
// Checks if field should be processed
|
||||
shouldApply: (field: Field) => boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user