From 22282334c761641bce0b6b087cd33414e8ba8b37 Mon Sep 17 00:00:00 2001 From: zenador Date: Thu, 9 Jan 2025 15:24:56 +0800 Subject: [PATCH] Prometheus datasource: Update info annotations without missing severity level (#98485) Update how info severity level is handled along with changes in plugin-sdk-go --- .../query/components/QueryEditorRow.test.tsx | 2 ++ .../app/features/query/components/QueryEditorRow.tsx | 12 +----------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/public/app/features/query/components/QueryEditorRow.test.tsx b/public/app/features/query/components/QueryEditorRow.test.tsx index b10e0617b8e..ae1bf9acc33 100644 --- a/public/app/features/query/components/QueryEditorRow.test.tsx +++ b/public/app/features/query/components/QueryEditorRow.test.tsx @@ -181,6 +181,7 @@ describe('frame results with warnings', () => { const metaInfo = { notices: [ { + severity: 'info', text: 'For your info, something is up.', }, ], @@ -192,6 +193,7 @@ describe('frame results with warnings', () => { text: 'Reduce operation is not needed. Input query or expression A is already reduced data.', }, { + severity: 'info', text: 'For your info, something is up.', }, ], diff --git a/public/app/features/query/components/QueryEditorRow.tsx b/public/app/features/query/components/QueryEditorRow.tsx index 143a5b8a384..7094901511f 100644 --- a/public/app/features/query/components/QueryEditorRow.tsx +++ b/public/app/features/query/components/QueryEditorRow.tsx @@ -398,17 +398,7 @@ export class QueryEditorRow extends PureComponent item.severity === 'warning'; - } else { - // The first condition is because sometimes info notices are not marked as info. - // We don't filter on severity not being equal to warnings because there's still - // the error severity, which does not seem to be used as errors are indicated - // separately, but we do this just to be safe. - criterion = (item: QueryResultMetaNotice) => !('severity' in item) || item.severity === 'info'; - } - const warnings = filter(serie.meta.notices, criterion) ?? []; + const warnings = filter(serie.meta.notices, (item: QueryResultMetaNotice) => item.severity === type) ?? []; return acc.concat(warnings); }, []);