Skip to content
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
a98faba
[RAM] Add data model for scheduled and recurring snoozes
Zacqary Apr 26, 2022
fdbe1b5
Merge remote-tracking branch 'upstream/main' into 130724-snooze-sched…
Zacqary Apr 26, 2022
bc20443
Update migration tests
Zacqary Apr 26, 2022
de7a37f
Make snoozeIndefinitely required
Zacqary Apr 26, 2022
7fec109
Fix remaining muteAlls
Zacqary Apr 26, 2022
ab4f21b
Replace snoozeEndTime with snoozeSchedule
Zacqary Apr 26, 2022
27c5702
Merge remote-tracking branch 'upstream/main' into 130724-snooze-sched…
Zacqary Apr 26, 2022
29173d8
Fix typecheck
Zacqary Apr 26, 2022
0822788
Merge branch 'main' into 130724-snooze-sched-datamodel
Zacqary Apr 26, 2022
274c0c0
Fix typecheck
Zacqary Apr 26, 2022
cabd5c3
Merge branch '130724-snooze-sched-datamodel' of https://github.com/Za…
Zacqary Apr 26, 2022
7c918a5
Revert muteAll => snoozeIndefinitely rename
Zacqary Apr 27, 2022
5b57cb8
Revert more snoozeIndefinitely refs
Zacqary Apr 27, 2022
5df3868
Revert README
Zacqary Apr 27, 2022
7f8acf1
Merge remote-tracking branch 'upstream/main' into 130724-snooze-sched…
Zacqary Apr 27, 2022
d128eac
Restore updated taskrunner test
Zacqary Apr 27, 2022
59c5a1b
Fix RuleStatusDropdown test
Zacqary Apr 27, 2022
03d2d29
Add timeZone to SO
Zacqary Apr 28, 2022
32344fe
Merge remote-tracking branch 'upstream/main' into 130724-snooze-sched…
Zacqary Apr 28, 2022
e3c28e8
Update timezone usage
Zacqary Apr 28, 2022
b93d460
Implement RRule
Zacqary Apr 28, 2022
f9dfc6e
Merge remote-tracking branch 'upstream/main' into 130724-snooze-sched…
Zacqary Apr 29, 2022
370fd45
Fix task runner test
Zacqary Apr 29, 2022
6dda9a2
Add rrule types
Zacqary Apr 29, 2022
128950f
Push snoozeEndTime from server and fix unsnooze
Zacqary Apr 29, 2022
8f3546f
Fix Jest Tests 5
Zacqary Apr 29, 2022
8b69fad
Fix rulestatusdropdown test
Zacqary Apr 29, 2022
01ae2b2
Fix jest tests 1
Zacqary Apr 29, 2022
3af6c23
Fix snooze_end_time refs in functional tests
Zacqary Apr 29, 2022
c526de9
Fix snooze API integration tests
Zacqary May 2, 2022
6527c36
Move isRuleSnoozed to server
Zacqary May 2, 2022
0f9826b
Merge remote-tracking branch 'upstream/main' into 130724-snooze-sched…
Zacqary May 2, 2022
7eec7af
Update x-pack/plugins/alerting/server/lib/is_rule_snoozed.ts
Zacqary May 4, 2022
41414cb
Require timeZone in rulesnooze
Zacqary May 4, 2022
fda4b4b
Merge remote-tracking branch 'upstream/main' into 130724-snooze-sched…
Zacqary May 4, 2022
d2542a5
Merge remote-tracking branch 'upstream/main' into 130724-snooze-sched…
Zacqary May 4, 2022
fadb744
Merge remote-tracking branch 'upstream/main' into 130724-snooze-sched…
Zacqary May 10, 2022
0603855
Add automatic isSnoozedUntil savedobject flag
Zacqary May 10, 2022
fc99605
Check isSnoozedUntil against now
Zacqary May 10, 2022
857c36f
Fix jest
Zacqary May 11, 2022
4e1cc32
Merge remote-tracking branch 'upstream/main' into 130724-snooze-sched…
Zacqary May 11, 2022
52f281f
Fix typecheck
Zacqary May 11, 2022
92511d2
Merge remote-tracking branch 'upstream/main' into 130724-snooze-sched…
Zacqary May 11, 2022
2434080
Fix jest
Zacqary May 11, 2022
70a2aa7
Fix snoozedUntil date parsing
Zacqary May 11, 2022
3646458
Fix rewriterule
Zacqary May 12, 2022
2c53cb7
Add error handling for RRule
Zacqary May 12, 2022
ed75133
Fix re-snoozing
Zacqary May 16, 2022
20c37dc
Merge remote-tracking branch 'upstream/main' into 130724-snooze-sched…
Zacqary May 16, 2022
083782c
Add comments to rulesnoozetype
Zacqary May 16, 2022
f11125d
Restructure data model to use rRule for everything
Zacqary May 16, 2022
409c606
Fix functional tests
Zacqary May 16, 2022
eb1f391
Fix jest
Zacqary May 17, 2022
ffeb94d
Fix functional tests
Zacqary May 17, 2022
f8fe600
Fix functional tests
Zacqary May 17, 2022
22e839e
Fix functional tests
Zacqary May 18, 2022
25f8f7d
Clarify isRuleSnoozed
Zacqary May 18, 2022
3edaa0c
Merge remote-tracking branch 'upstream/main' into 130724-snooze-sched…
Zacqary May 18, 2022
02baeea
Use rrule to parse byweekday
Zacqary May 18, 2022
07bb7e9
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
kibanamachine May 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"@types/mapbox__vector-tile": "1.3.0",
"@types/moment-duration-format": "^2.2.3",
"@types/react-is": "^16.7.1",
"@types/rrule": "^2.2.9",
"JSONStream": "1.3.5",
"abort-controller": "^3.0.0",
"antlr4ts": "^0.5.0-alpha.3",
Expand Down Expand Up @@ -309,6 +310,7 @@
"loader-utils": "^1.2.3",
"lodash": "^4.17.21",
"lru-cache": "^4.1.5",
"luxon": "^2.3.2",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a peer dependency of rrule

"lz-string": "^1.4.4",
"mapbox-gl-draw-rectangle-mode": "1.0.4",
"maplibre-gl": "2.1.9",
Expand Down Expand Up @@ -405,6 +407,7 @@
"reselect": "^4.0.0",
"resize-observer-polyfill": "^1.5.1",
"rison-node": "1.0.2",
"rrule": "2.6.4",
"rxjs": "^7.5.5",
"safe-squel": "^5.12.5",
"seedrandom": "^3.0.5",
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/alerting/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export * from './disabled_action_groups';
export * from './rule_notify_when_type';
export * from './parse_duration';
export * from './execution_log_types';
export * from './rule_snooze_type';

export interface AlertingFrameworkHealth {
isSufficientlySecure: boolean;
Expand Down
6 changes: 4 additions & 2 deletions x-pack/plugins/alerting/common/rule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
} from '@kbn/core/server';
import { RuleNotifyWhenType } from './rule_notify_when_type';
import { RuleSnooze } from './rule_snooze_type';

export type RuleTypeState = Record<string, unknown>;
export type RuleTypeParams = Record<string, unknown>;
Expand Down Expand Up @@ -104,12 +105,13 @@ export interface Rule<Params extends RuleTypeParams = never> {
apiKey: string | null;
apiKeyOwner: string | null;
throttle: string | null;
notifyWhen: RuleNotifyWhenType | null;
muteAll: boolean;
notifyWhen: RuleNotifyWhenType | null;
mutedInstanceIds: string[];
executionStatus: RuleExecutionStatus;
monitoring?: RuleMonitoring;
snoozeEndTime?: Date | null; // Remove ? when this parameter is made available in the public API
snoozeSchedule?: RuleSnooze; // Remove ? when this parameter is made available in the public API
isSnoozedUntil?: Date | null;
}

export type SanitizedRule<Params extends RuleTypeParams = never> = Omit<Rule<Params>, 'apiKey'>;
Expand Down
35 changes: 35 additions & 0 deletions x-pack/plugins/alerting/common/rule_snooze_type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import type { WeekdayStr } from 'rrule';

export type RuleSnooze = Array<{
Comment thread
pmuellr marked this conversation as resolved.
duration: number;
rRule: Partial<RRuleRecord> & Pick<RRuleRecord, 'dtstart' | 'tzid'>;
// For scheduled/recurring snoozes, `id` uniquely identifies them so that they can be displayed, modified, and deleted individually
id?: string;
}>;

// An iCal RRULE to define a recurrence schedule, see https://github.com/jakubroztocil/rrule for the spec
export interface RRuleRecord {
dtstart: string;
tzid: string;
freq?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
until?: string;
count?: number;
interval?: number;
wkst?: WeekdayStr;
byweekday?: Array<string | number>;
bymonth?: number[];
bysetpos?: number[];
bymonthday: number;
byyearday: number[];
byweekno: number[];
byhour: number[];
byminute: number[];
bysecond: number[];
}
1 change: 1 addition & 0 deletions x-pack/plugins/alerting/server/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ export {
} from './rule_execution_status';
export { getRecoveredAlerts } from './get_recovered_alerts';
export { createWrappedScopedClusterClientFactory } from './wrap_scoped_cluster_client';
export { isRuleSnoozed, getRuleSnoozeEndTime } from './is_rule_snoozed';
export { convertRuleIdsToKueryNode } from './convert_rule_ids_to_kuery_node';
Loading