From d0714a53032987e296c3bfcd413c6354d8b22cd6 Mon Sep 17 00:00:00 2001 From: Gilles De Mey Date: Tue, 19 Dec 2023 13:39:31 +0100 Subject: [PATCH] Alerting: Small cleanup to remove mute timing as inheritable property (#79680) --- .../components/notification-policies/Policy.tsx | 2 -- .../unified/utils/notification-policies.ts | 17 +++++------------ 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/public/app/features/alerting/unified/components/notification-policies/Policy.tsx b/public/app/features/alerting/unified/components/notification-policies/Policy.tsx index 37a9fca04b9..d5e766bc342 100644 --- a/public/app/features/alerting/unified/components/notification-policies/Policy.tsx +++ b/public/app/features/alerting/unified/components/notification-policies/Policy.tsx @@ -589,8 +589,6 @@ const routePropertyToLabel = (key: keyof InhertitableProperties | string): strin return 'Group interval'; case 'group_wait': return 'Group wait'; - case 'mute_time_intervals': - return 'Mute timings'; case 'repeat_interval': return 'Repeat interval'; default: diff --git a/public/app/features/alerting/unified/utils/notification-policies.ts b/public/app/features/alerting/unified/utils/notification-policies.ts index dceaf3ba201..504f162f3c1 100644 --- a/public/app/features/alerting/unified/utils/notification-policies.ts +++ b/public/app/features/alerting/unified/utils/notification-policies.ts @@ -18,6 +18,10 @@ interface LabelMatchResult { matcher: ObjectMatcher | null; } +export const INHERITABLE_KEYS = ['receiver', 'group_by', 'group_wait', 'group_interval', 'repeat_interval'] as const; +export type InheritableKeys = typeof INHERITABLE_KEYS; +export type InhertitableProperties = Pick; + type LabelsMatch = Map; interface MatchingResult { @@ -150,11 +154,6 @@ function findMatchingAlertGroups( }, matchingGroups); } -export type InhertitableProperties = Pick< - Route, - 'receiver' | 'group_by' | 'group_wait' | 'group_interval' | 'repeat_interval' | 'mute_time_intervals' ->; - // inherited properties are config properties that exist on the parent route (or its inherited properties) but not on the child route function getInheritedProperties( parentRoute: Route, @@ -163,13 +162,7 @@ function getInheritedProperties( ) { const fullParentProperties = merge({}, parentRoute, propertiesParentInherited); - const inheritableProperties: InhertitableProperties = pick(fullParentProperties, [ - 'receiver', - 'group_by', - 'group_wait', - 'group_interval', - 'repeat_interval', - ]); + const inheritableProperties: InhertitableProperties = pick(fullParentProperties, INHERITABLE_KEYS); // TODO how to solve this TypeScript mystery? const inherited = reduce(