mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Small cleanup to remove mute timing as inheritable property (#79680)
This commit is contained in:
parent
c58ed41d50
commit
d0714a5303
@ -589,8 +589,6 @@ const routePropertyToLabel = (key: keyof InhertitableProperties | string): strin
|
|||||||
return 'Group interval';
|
return 'Group interval';
|
||||||
case 'group_wait':
|
case 'group_wait':
|
||||||
return 'Group wait';
|
return 'Group wait';
|
||||||
case 'mute_time_intervals':
|
|
||||||
return 'Mute timings';
|
|
||||||
case 'repeat_interval':
|
case 'repeat_interval':
|
||||||
return 'Repeat interval';
|
return 'Repeat interval';
|
||||||
default:
|
default:
|
||||||
|
@ -18,6 +18,10 @@ interface LabelMatchResult {
|
|||||||
matcher: ObjectMatcher | null;
|
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>;
|
type LabelsMatch = Map<Label, LabelMatchResult>;
|
||||||
|
|
||||||
interface MatchingResult {
|
interface MatchingResult {
|
||||||
@ -150,11 +154,6 @@ function findMatchingAlertGroups(
|
|||||||
}, matchingGroups);
|
}, 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
|
// inherited properties are config properties that exist on the parent route (or its inherited properties) but not on the child route
|
||||||
function getInheritedProperties(
|
function getInheritedProperties(
|
||||||
parentRoute: Route,
|
parentRoute: Route,
|
||||||
@ -163,13 +162,7 @@ function getInheritedProperties(
|
|||||||
) {
|
) {
|
||||||
const fullParentProperties = merge({}, parentRoute, propertiesParentInherited);
|
const fullParentProperties = merge({}, parentRoute, propertiesParentInherited);
|
||||||
|
|
||||||
const inheritableProperties: InhertitableProperties = pick(fullParentProperties, [
|
const inheritableProperties: InhertitableProperties = pick(fullParentProperties, INHERITABLE_KEYS);
|
||||||
'receiver',
|
|
||||||
'group_by',
|
|
||||||
'group_wait',
|
|
||||||
'group_interval',
|
|
||||||
'repeat_interval',
|
|
||||||
]);
|
|
||||||
|
|
||||||
// TODO how to solve this TypeScript mystery?
|
// TODO how to solve this TypeScript mystery?
|
||||||
const inherited = reduce(
|
const inherited = reduce(
|
||||||
|
Loading…
Reference in New Issue
Block a user