FieldMatchers: Add match by value (reducer) (#64477)

Co-authored-by: Ryan McKinley <ryantxu@gmail.com>
This commit is contained in:
Leon Sorokin
2023-03-10 17:17:29 -06:00
committed by GitHub
parent 75f89e67af
commit 18e3e0ca8d
19 changed files with 349 additions and 49 deletions

View File

@@ -10,6 +10,7 @@ import {
DynamicConfigValue,
ConfigOverrideRule,
GrafanaTheme2,
fieldMatchers,
} from '@grafana/data';
import { fieldMatchersUI, useStyles2, ValuePicker } from '@grafana/ui';
import { getDataLinksVariableSuggestions } from 'app/features/panel/panellinks/link_srv';
@@ -46,13 +47,19 @@ export function getFieldOverrideCategories(
};
const onOverrideAdd = (value: SelectableValue<string>) => {
const info = fieldMatchers.get(value.value!);
if (!info) {
return;
}
props.onFieldConfigsChange({
...currentFieldConfig,
overrides: [
...currentFieldConfig.overrides,
{
matcher: {
id: value.value!,
id: info.id,
options: info.defaultOptions,
},
properties: [],
},