Alerting: Small cleanup to remove mute timing as inheritable property (#79680)

This commit is contained in:
Gilles De Mey 2023-12-19 13:39:31 +01:00 committed by GitHub
parent c58ed41d50
commit d0714a5303
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 14 deletions

View File

@ -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:

View File

@ -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<Route, InheritableKeys[number]>;
type LabelsMatch = Map<Label, LabelMatchResult>;
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(