Add system comments on close events
Manual close: "Manually closed." Auto-resolve: "Condition resolved — alert closed automatically." (reopen comments were already in place) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+14
-1
@@ -185,6 +185,12 @@ export function upsertAlerts(candidates: AlertCandidate[]): number {
|
||||
alert.closeReason = "resolved";
|
||||
alert.closedAt = nowISO;
|
||||
alert.suppressedUntil = null;
|
||||
alert.comments.push({
|
||||
id: store.nextCommentId++,
|
||||
body: "Condition resolved — alert closed automatically.",
|
||||
createdAt: nowISO,
|
||||
author: "system",
|
||||
});
|
||||
}
|
||||
|
||||
save(store);
|
||||
@@ -221,10 +227,17 @@ export function closeAlert(id: number): Alert | null {
|
||||
suppressedUntil = d.toISOString();
|
||||
}
|
||||
|
||||
const now = new Date().toISOString();
|
||||
alert.status = "closed";
|
||||
alert.closeReason = "manual";
|
||||
alert.closedAt = new Date().toISOString();
|
||||
alert.closedAt = now;
|
||||
alert.suppressedUntil = suppressedUntil;
|
||||
alert.comments.push({
|
||||
id: store.nextCommentId++,
|
||||
body: "Manually closed.",
|
||||
createdAt: now,
|
||||
author: "system",
|
||||
});
|
||||
save(store);
|
||||
return toAlert(alert);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user