mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Fix used badge in contact points list (#84714)
Fix used badge in contact points list
This commit is contained in:
parent
a095888522
commit
b38436eeb0
@ -8,6 +8,7 @@ export const UnusedContactPointBadge = () => (
|
|||||||
aria-label="unused"
|
aria-label="unused"
|
||||||
color="orange"
|
color="orange"
|
||||||
icon="exclamation-triangle"
|
icon="exclamation-triangle"
|
||||||
tooltip="This contact point is not used in any notification policy and it will not receive any alerts"
|
// is not used in any policy, but it can receive notifications from an auto auto generated policy. Non admin users can't see auto generated policies.
|
||||||
|
tooltip="This contact point is not used in any notification policy"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -168,8 +168,7 @@ export function isAutoGeneratedPolicy(route: Route) {
|
|||||||
|
|
||||||
export function getUsedContactPoints(route: Route): string[] {
|
export function getUsedContactPoints(route: Route): string[] {
|
||||||
const childrenContactPoints = route.routes?.flatMap((route) => getUsedContactPoints(route)) ?? [];
|
const childrenContactPoints = route.routes?.flatMap((route) => getUsedContactPoints(route)) ?? [];
|
||||||
// we don't want to count the autogenerated policy for receiver level, for checking if a contact point is used
|
if (route.receiver) {
|
||||||
if (route.receiver && !isAutoGeneratedPolicy(route)) {
|
|
||||||
return [route.receiver, ...childrenContactPoints];
|
return [route.receiver, ...childrenContactPoints];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user