Skip to content

Commit

Permalink
[Custom threshold rule] Fix error loading alert details page (elastic…
Browse files Browse the repository at this point in the history
  • Loading branch information
benakansara authored and lcawl committed Jan 26, 2024
1 parent 7973f75 commit 6066396
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ export default function AlertDetailsAppSection({
};
const timeRange = getPaddedAlertTimeRange(alert.fields[ALERT_START]!, alert.fields[ALERT_END]);
const alertEnd = alert.fields[ALERT_END] ? moment(alert.fields[ALERT_END]).valueOf() : undefined;
const groups = alert.fields[ALERT_GROUP];
const tags = alert.fields[TAGS];

const annotations = [
<AlertAnnotation
alertStart={alert.start}
Expand All @@ -101,8 +104,6 @@ export default function AlertDetailsAppSection({
];

useEffect(() => {
const groups = alert.fields[ALERT_GROUP];
const tags = alert.fields[TAGS];
const alertSummaryFields = [];
if (groups) {
alertSummaryFields.push({
Expand Down Expand Up @@ -141,7 +142,7 @@ export default function AlertDetailsAppSection({
});

setAlertSummaryFields(alertSummaryFields);
}, [alert, rule, ruleLink, setAlertSummaryFields]);
}, [groups, tags, rule, ruleLink, setAlertSummaryFields]);

const derivedIndexPattern = useMemo<DataViewBase>(
() => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ export function AlertDetails() {
<HeaderMenu />
<AlertSummary alertSummaryFields={summaryFields} />
<EuiSpacer size="l" />
{AlertDetailsAppSection && rule && (
{AlertDetailsAppSection && rule && alertDetail?.formatted && (
<AlertDetailsAppSection
alert={alertDetail}
alert={alertDetail.formatted}
rule={rule}
timeZone={timeZone}
setAlertSummaryFields={setSummaryFields}
Expand Down

0 comments on commit 6066396

Please sign in to comment.