From 2463dcb2dbdfdb837d1f0664e28909b54b2c6142 Mon Sep 17 00:00:00 2001 From: Nawaz Dhandala Date: Mon, 26 Jan 2026 22:26:17 +0000 Subject: [PATCH] fix: update alert episode handling in ExecutionLogsTable; add support for triggeredByAlertEpisodeId --- .../Services/OnCallDutyPolicyService.ts | 12 +++++++++- .../ExecutionLogs/ExecutionLogsTable.tsx | 24 +++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/Common/Server/Services/OnCallDutyPolicyService.ts b/Common/Server/Services/OnCallDutyPolicyService.ts index d817794b46..9271304a9d 100644 --- a/Common/Server/Services/OnCallDutyPolicyService.ts +++ b/Common/Server/Services/OnCallDutyPolicyService.ts @@ -285,7 +285,17 @@ ${onCallPolicy.description || "No description provided."} !options.triggeredByAlertId ) { throw new BadDataException( - "triggeredByAlertId is required when userNotificationEventType is IncidentCreated", + "triggeredByAlertId is required when userNotificationEventType is AlertCreated", + ); + } + + if ( + UserNotificationEventType.AlertEpisodeCreated === + options.userNotificationEventType && + !options.triggeredByAlertEpisodeId + ) { + throw new BadDataException( + "triggeredByAlertEpisodeId is required when userNotificationEventType is AlertEpisodeCreated", ); } diff --git a/Dashboard/src/Components/OnCallPolicy/ExecutionLogs/ExecutionLogsTable.tsx b/Dashboard/src/Components/OnCallPolicy/ExecutionLogs/ExecutionLogsTable.tsx index b25bf8a464..d52502f6be 100644 --- a/Dashboard/src/Components/OnCallPolicy/ExecutionLogs/ExecutionLogsTable.tsx +++ b/Dashboard/src/Components/OnCallPolicy/ExecutionLogs/ExecutionLogsTable.tsx @@ -21,6 +21,8 @@ import OnCallDutyPolicyExecutionLog from "Common/Models/DatabaseModels/OnCallDut import React, { FunctionComponent, ReactElement, useState } from "react"; import Alert from "Common/Models/DatabaseModels/Alert"; import AlertView from "../../../Components/Alert/Alert"; +import AlertEpisode from "Common/Models/DatabaseModels/AlertEpisode"; +import AlertEpisodeView from "../../../Components/AlertEpisode/AlertEpisode"; import RouteMap, { RouteUtil } from "../../../Utils/RouteMap"; import PageMap from "../../../Utils/PageMap"; @@ -28,6 +30,7 @@ export interface ComponentProps { onCallDutyPolicyId?: ObjectID | undefined; // if this is undefined. then it'll show logs for all policies. incidentId?: ObjectID | undefined; alertId?: ObjectID | undefined; + alertEpisodeId?: ObjectID | undefined; } const ExecutionLogsTable: FunctionComponent = ( @@ -53,6 +56,10 @@ const ExecutionLogsTable: FunctionComponent = ( query.triggeredByAlertId = props.alertId; } + if (props.alertEpisodeId) { + query.triggeredByAlertEpisodeId = props.alertEpisodeId; + } + let columns: Columns = []; let filters: Array> = []; @@ -125,6 +132,9 @@ const ExecutionLogsTable: FunctionComponent = ( triggeredByIncident: { title: true, }, + triggeredByAlertEpisode: { + title: true, + }, }, title: "Triggered By", type: FieldType.Element, @@ -149,6 +159,17 @@ const ExecutionLogsTable: FunctionComponent = ( ); } + if (item.triggeredByAlertEpisode) { + return ( +
+

Alert Episode:

+ +
+ ); + } + return

-

; }, }, @@ -226,6 +247,9 @@ const ExecutionLogsTable: FunctionComponent = ( triggeredByAlert: { title: true, }, + triggeredByAlertEpisode: { + title: true, + }, }} noItemsMessage={"This policy has not executed so far."} onViewPage={async (item: OnCallDutyPolicyExecutionLog) => {