Prometheus datasource: Update info annotations without missing severity level (#98485)

Update how info severity level is handled along with changes in plugin-sdk-go
This commit is contained in:
zenador 2025-01-09 15:24:56 +08:00 committed by GitHub
parent 3958fb9e0a
commit 22282334c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 11 deletions

View File

@ -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.',
},
],

View File

@ -398,17 +398,7 @@ export class QueryEditorRow<TQuery extends DataQuery> extends PureComponent<Prop
return acc;
}
let criterion;
if (type === 'warning') {
criterion = (item: QueryResultMetaNotice) => 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);
}, []);