From 07c02ca97a0e6037d40f774a4a77f37f23b31dd4 Mon Sep 17 00:00:00 2001 From: Alexander Zobnin Date: Mon, 20 Mar 2023 17:20:44 +0100 Subject: [PATCH] Problems: filter by particular severity, fixes #572 --- .../QueryEditor/ProblemsQueryEditor.tsx | 19 ++++++++++--------- src/datasource/datasource.ts | 7 ++++--- src/datasource/migrations.ts | 12 +++++++++++- 3 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/datasource/components/QueryEditor/ProblemsQueryEditor.tsx b/src/datasource/components/QueryEditor/ProblemsQueryEditor.tsx index 4cc5503..ec6d6bc 100644 --- a/src/datasource/components/QueryEditor/ProblemsQueryEditor.tsx +++ b/src/datasource/components/QueryEditor/ProblemsQueryEditor.tsx @@ -3,7 +3,7 @@ import React, { useEffect, FormEvent } from 'react'; import { useAsyncFn } from 'react-use'; import { SelectableValue } from '@grafana/data'; -import { InlineField, Input, Select } from '@grafana/ui'; +import { InlineField, Input, MultiSelect, Select } from '@grafana/ui'; import { QueryEditorRow } from './QueryEditorRow'; import { MetricPicker } from '../../../components'; import { getVariableOptions } from './utils'; @@ -143,9 +143,9 @@ export const ProblemsQueryEditor = ({ query, datasource, onChange }: Props) => { }; }; - const onMinSeverityChange = (option: SelectableValue) => { - if (option.value !== null) { - onChange({ ...query, options: { ...query.options, minSeverity: option.value } }); + const onSeveritiesChange = (options: SelectableValue[]) => { + if (options !== null) { + onChange({ ...query, options: { ...query.options, severities: options.map((o) => o.value) } }); } }; @@ -217,13 +217,14 @@ export const ProblemsQueryEditor = ({ query, datasource, onChange }: Props) => { onChange={onPropChange('showProblems')} /> - -