mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
parent
3958fb9e0a
commit
22282334c7
@ -181,6 +181,7 @@ describe('frame results with warnings', () => {
|
|||||||
const metaInfo = {
|
const metaInfo = {
|
||||||
notices: [
|
notices: [
|
||||||
{
|
{
|
||||||
|
severity: 'info',
|
||||||
text: 'For your info, something is up.',
|
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.',
|
text: 'Reduce operation is not needed. Input query or expression A is already reduced data.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
severity: 'info',
|
||||||
text: 'For your info, something is up.',
|
text: 'For your info, something is up.',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -398,17 +398,7 @@ export class QueryEditorRow<TQuery extends DataQuery> extends PureComponent<Prop
|
|||||||
return acc;
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
let criterion;
|
const warnings = filter(serie.meta.notices, (item: QueryResultMetaNotice) => item.severity === type) ?? [];
|
||||||
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) ?? [];
|
|
||||||
return acc.concat(warnings);
|
return acc.concat(warnings);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user