Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | import { store } from "../../../store"; import { dynamicAlertSelector } from "../../../store/features/dynamicAlerts/selectors"; import { DynamicAlertType } from "../../../types"; import { TimezoneTypes } from "../../workflow/types"; import stateToPlaybook from "../playbook/stateToPlaybook"; export const stateToDynamicAlert = () => { const dynamicAlert: DynamicAlertType = dynamicAlertSelector(store.getState()); return { id: dynamicAlert.id, name: dynamicAlert.name, type: "DYNAMIC_ALERT", schedule: { type: "CRON", cron: { keep_alive: true, rule: "*/5 * * * *", timezone: TimezoneTypes.UTC, }, }, playbooks: [ { ...stateToPlaybook(), name: `${dynamicAlert.name}_playbook` }, ], entry_points: [ { type: "API", api: {}, }, ], actions: [], configuration: { generate_summary: true, evaluation_window_in_seconds: dynamicAlert.evaluationWindowInMinutes ? parseInt(dynamicAlert.evaluationWindowInMinutes.toString(), 10) * 60 : undefined, }, }; }; |