Skip to content

Commit

Permalink
fixes after merge with system_actions_mvp branch
Browse files Browse the repository at this point in the history
  • Loading branch information
guskovaue committed Oct 26, 2023
1 parent b66fd6d commit 853d376
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 44 deletions.
2 changes: 0 additions & 2 deletions x-pack/plugins/alerting/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ export * from './rule_circuit_breaker_error_message';

export { isSystemAction } from './system_actions/is_system_action';

export { isSystemAction } from './system_actions/is_system_action';

export type {
MaintenanceWindowModificationMetadata,
DateRange,
Expand Down
42 changes: 2 additions & 40 deletions x-pack/plugins/alerting/common/routes/rule/response/schemas/v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import { schema } from '@kbn/config-schema';
import { rRuleResponseSchemaV1 } from '../../../r_rule';
import {
ruleNotifyWhen as ruleNotifyWhenV1,
ruleExecutionStatusValues as ruleExecutionStatusValuesV1,
Expand Down Expand Up @@ -180,48 +181,9 @@ export const monitoringSchema = schema.object({
}),
});

export const rRuleSchema = schema.object({
dtstart: schema.string(),
tzid: schema.string(),
freq: schema.maybe(
schema.oneOf([
schema.literal(0),
schema.literal(1),
schema.literal(2),
schema.literal(3),
schema.literal(4),
schema.literal(5),
schema.literal(6),
])
),
until: schema.maybe(schema.string()),
count: schema.maybe(schema.number()),
interval: schema.maybe(schema.number()),
wkst: schema.maybe(
schema.oneOf([
schema.literal('MO'),
schema.literal('TU'),
schema.literal('WE'),
schema.literal('TH'),
schema.literal('FR'),
schema.literal('SA'),
schema.literal('SU'),
])
),
byweekday: schema.maybe(schema.arrayOf(schema.oneOf([schema.string(), schema.number()]))),
bymonth: schema.maybe(schema.arrayOf(schema.number())),
bysetpos: schema.maybe(schema.arrayOf(schema.number())),
bymonthday: schema.arrayOf(schema.number()),
byyearday: schema.arrayOf(schema.number()),
byweekno: schema.arrayOf(schema.number()),
byhour: schema.arrayOf(schema.number()),
byminute: schema.arrayOf(schema.number()),
bysecond: schema.arrayOf(schema.number()),
});

export const ruleSnoozeScheduleSchema = schema.object({
duration: schema.number(),
rRule: rRuleSchema,
rRule: rRuleResponseSchemaV1,
id: schema.maybe(schema.string()),
skipRecurrences: schema.maybe(schema.arrayOf(schema.string())),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import {
} from '../../transforms';
import { validateScheduleLimit, ValidateScheduleLimitResult } from '../get_schedule_frequency';
import { bulkEditOperationsSchema } from './schemas';
import { denormalizeActions } from '../../../../rules_client/lib/denormalize_actions';

const isValidInterval = (interval: string | undefined): interval is string => {
return interval !== undefined;
Expand Down Expand Up @@ -546,9 +547,13 @@ async function updateRuleAttributesAndParamsInMemory<Params extends RuleParams>(
validatedMutatedAlertTypeParams
);

const ruleAttributes = await transformRuleDomainToRuleAttributes({
actions: updatedRuleActions as NormalizedAlertActionWithGeneratedValues[],
const { actions: actionsWithRefs } = await denormalizeActions(
context,
updatedRuleActions as NormalizedAlertActionWithGeneratedValues[]
);

const ruleAttributes = transformRuleDomainToRuleAttributes({
actionsWithRefs,
rule: updatedRule,
params: {
legacyId: rule.attributes.legacyId,
Expand Down

0 comments on commit 853d376

Please sign in to comment.