Skip to content

Commit a91ca14

Browse files
author
Óscar Nájera
committed
Filter METRIC_ graph templates on CEE
These entries are not filtered out of the checkmk endpoint, because the GUI crawler does require some single metric templates. The connector has its dedicated single metric selector.
1 parent f173d1a commit a91ca14

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/components/fields.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,20 @@ export const GraphSelect = (props: EditorProps) => {
103103
const label = titleCase(graphMode);
104104
const autocompleter = vsAutocomplete(props.datasource, completionVS);
105105

106+
const autocompleter_wrap = (inputValue: string) =>
107+
autocompleter(inputValue).then((choices) => {
108+
if (graphMode === 'template') {
109+
return choices.filter(({ value }: SelectableValue<string>) => value && !value.startsWith('METRIC_'));
110+
} else {
111+
return choices;
112+
}
113+
});
114+
106115
return (
107116
<>
108117
<GraphType contextPath="params.graphMode" {...props} autocompleter={(_) => new Promise(() => ({}))} />
109118
<InlineField labelWidth={14} label={label}>
110-
<AsyncAutocomplete autocompleter={autocompleter} contextPath={'params.graph_name'} {...props} />
119+
<AsyncAutocomplete autocompleter={autocompleter_wrap} contextPath={'params.graph_name'} {...props} />
111120
</InlineField>
112121
</>
113122
);

0 commit comments

Comments
 (0)