mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
fix: update alert episode handling in ExecutionLogsTable; add support for triggeredByAlertEpisodeId
This commit is contained in:
@@ -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",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<ComponentProps> = (
|
||||
@@ -53,6 +56,10 @@ const ExecutionLogsTable: FunctionComponent<ComponentProps> = (
|
||||
query.triggeredByAlertId = props.alertId;
|
||||
}
|
||||
|
||||
if (props.alertEpisodeId) {
|
||||
query.triggeredByAlertEpisodeId = props.alertEpisodeId;
|
||||
}
|
||||
|
||||
let columns: Columns<OnCallDutyPolicyExecutionLog> = [];
|
||||
let filters: Array<Filter<OnCallDutyPolicyExecutionLog>> = [];
|
||||
|
||||
@@ -125,6 +132,9 @@ const ExecutionLogsTable: FunctionComponent<ComponentProps> = (
|
||||
triggeredByIncident: {
|
||||
title: true,
|
||||
},
|
||||
triggeredByAlertEpisode: {
|
||||
title: true,
|
||||
},
|
||||
},
|
||||
title: "Triggered By",
|
||||
type: FieldType.Element,
|
||||
@@ -149,6 +159,17 @@ const ExecutionLogsTable: FunctionComponent<ComponentProps> = (
|
||||
);
|
||||
}
|
||||
|
||||
if (item.triggeredByAlertEpisode) {
|
||||
return (
|
||||
<div>
|
||||
<p>Alert Episode:</p>
|
||||
<AlertEpisodeView
|
||||
alertEpisode={item["triggeredByAlertEpisode"] as AlertEpisode}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return <p>-</p>;
|
||||
},
|
||||
},
|
||||
@@ -226,6 +247,9 @@ const ExecutionLogsTable: FunctionComponent<ComponentProps> = (
|
||||
triggeredByAlert: {
|
||||
title: true,
|
||||
},
|
||||
triggeredByAlertEpisode: {
|
||||
title: true,
|
||||
},
|
||||
}}
|
||||
noItemsMessage={"This policy has not executed so far."}
|
||||
onViewPage={async (item: OnCallDutyPolicyExecutionLog) => {
|
||||
|
||||
Reference in New Issue
Block a user