diff --git a/Common/Models/DatabaseModels/Incident.ts b/Common/Models/DatabaseModels/Incident.ts index 5acc084fc0..025a727552 100644 --- a/Common/Models/DatabaseModels/Incident.ts +++ b/Common/Models/DatabaseModels/Incident.ts @@ -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, diff --git a/Common/Server/API/StatusPageAPI.ts b/Common/Server/API/StatusPageAPI.ts index fa343ccfce..86d3f48a0e 100644 --- a/Common/Server/API/StatusPageAPI.ts +++ b/Common/Server/API/StatusPageAPI.ts @@ -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, diff --git a/Dashboard/src/Pages/Incidents/View/Postmortem.tsx b/Dashboard/src/Pages/Incidents/View/Postmortem.tsx index 139dfefa8d..9a09147a55 100644 --- a/Dashboard/src/Pages/Incidents/View/Postmortem.tsx +++ b/Dashboard/src/Pages/Incidents/View/Postmortem.tsx @@ -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 = [ 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: { diff --git a/StatusPage/src/Pages/Incidents/Detail.tsx b/StatusPage/src/Pages/Incidents/Detail.tsx index b149d57b7b..a2a862e5bd 100644 --- a/StatusPage/src/Pages/Incidents/Detail.tsx +++ b/StatusPage/src/Pages/Incidents/Detail.tsx @@ -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);