feat: add postmortemPostedAt field and update related components for incident tracking

This commit is contained in:
Nawaz Dhandala 2025-12-03 13:09:23 +00:00
parent faaded049a
commit adf5a9c1f3
No known key found for this signature in database
GPG key ID: 96C5DCA24769DBCA
4 changed files with 58 additions and 7 deletions

View file

@ -1031,6 +1031,39 @@ export default class Incident extends BaseModel {
})
public showPostmortemOnStatusPage?: boolean = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.CreateProjectIncident,
],
read: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.ReadProjectIncident,
],
update: [
Permission.ProjectOwner,
Permission.ProjectAdmin,
Permission.ProjectMember,
Permission.EditProjectIncident,
],
})
@TableColumn({
type: TableColumnType.Date,
title: "Postmortem Posted At",
description:
"Timestamp that will be shown alongside the published postmortem on the status page.",
required: false,
})
@Column({
type: ColumnType.Date,
nullable: true,
})
public postmortemPostedAt?: Date = undefined;
@ColumnAccessControl({
create: [
Permission.ProjectOwner,

View file

@ -1441,6 +1441,7 @@ export default class StatusPageAPI extends BaseAPI<
description: true,
_id: true,
postmortemNote: true,
postmortemPostedAt: true,
showPostmortemOnStatusPage: true,
postmortemAttachments: {
_id: true,
@ -3332,6 +3333,7 @@ export default class StatusPageAPI extends BaseAPI<
description: true,
_id: true,
postmortemNote: true,
postmortemPostedAt: true,
showPostmortemOnStatusPage: true,
postmortemAttachments: {
_id: true,

View file

@ -3,6 +3,7 @@ import PageComponentProps from "../../PageComponentProps";
import { JSONObject } from "Common/Types/JSON";
import ObjectID from "Common/Types/ObjectID";
import { LIMIT_PER_PROJECT } from "Common/Types/Database/LimitMax";
import OneUptimeDate from "Common/Types/Date";
import { ButtonStyleType } from "Common/UI/Components/Button/Button";
import BasicFormModal from "Common/UI/Components/FormModal/BasicFormModal";
import FormFieldSchemaType from "Common/UI/Components/Forms/Types/FormFieldSchemaType";
@ -53,6 +54,19 @@ const POSTMORTEM_FORM_FIELDS: Fields<Incident> = [
description:
"Upload supporting evidence (images, reports, timelines) that can be shared once the postmortem is public.",
},
{
field: {
postmortemPostedAt: true,
},
title: "Postmortem Published At",
fieldType: FormFieldSchemaType.DateTime,
required: false,
description:
"Set the posted-on timestamp subscribers will see. This is in " +
OneUptimeDate.getCurrentTimezoneString() +
".",
placeholder: "Select date and time",
},
{
field: {
showPostmortemOnStatusPage: true,
@ -186,13 +200,6 @@ const IncidentPostmortem: FunctionComponent<
modelType: Incident,
id: "model-detail-incident-postmortem-note",
selectMoreFields: {
postmortemAttachments: {
_id: true,
name: true,
fileType: true,
createdAt: true,
},
showPostmortemOnStatusPage: true,
},
fields: [
{
@ -210,6 +217,14 @@ const IncidentPostmortem: FunctionComponent<
title: "Visible on Status Page?",
fieldType: FieldType.Boolean,
},
{
field: {
postmortemPostedAt: true,
},
title: "Postmortem Published At",
fieldType: FieldType.DateTime,
placeholder: "Not scheduled yet.",
},
{
field: {
postmortemAttachments: {

View file

@ -209,6 +209,7 @@ export const getIncidentEventItem: GetIncidentEventItemFunction = (
incident.postmortemNote.trim() !== ""
) {
const postmortemDate: Date =
incident.postmortemPostedAt ||
(incident.updatedAt as Date | undefined) ||
incident.declaredAt ||
(incident.createdAt as Date);