@oneuptime/common 7.0.3695 → 7.0.3697

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2006,4 +2006,118 @@ export default class StatusPage extends BaseModel {
2006
2006
  type: ColumnType.VeryLongText,
2007
2007
  })
2008
2008
  public subscriberEmailNotificationFooterText?: string = undefined;
2009
+
2010
+ @ColumnAccessControl({
2011
+ create: [
2012
+ Permission.ProjectOwner,
2013
+ Permission.ProjectAdmin,
2014
+ Permission.ProjectMember,
2015
+ Permission.CreateProjectStatusPage,
2016
+ ],
2017
+ read: [
2018
+ Permission.ProjectOwner,
2019
+ Permission.ProjectAdmin,
2020
+ Permission.ProjectMember,
2021
+ Permission.ReadProjectStatusPage,
2022
+ ],
2023
+ update: [
2024
+ Permission.ProjectOwner,
2025
+ Permission.ProjectAdmin,
2026
+ Permission.ProjectMember,
2027
+ Permission.EditProjectStatusPage,
2028
+ ],
2029
+ })
2030
+ @TableColumn({
2031
+ isDefaultValueColumn: true,
2032
+ type: TableColumnType.Boolean,
2033
+ title: "Show Incidents on Status Page",
2034
+ description: "Show Incidents on Status Page?",
2035
+ })
2036
+ @Column({
2037
+ type: ColumnType.Boolean,
2038
+ default: true,
2039
+ nullable: false,
2040
+ })
2041
+ @ColumnBillingAccessControl({
2042
+ read: PlanType.Free,
2043
+ update: PlanType.Growth,
2044
+ create: PlanType.Free,
2045
+ })
2046
+ public showIncidentsOnStatusPage?: boolean = undefined;
2047
+
2048
+ @ColumnAccessControl({
2049
+ create: [
2050
+ Permission.ProjectOwner,
2051
+ Permission.ProjectAdmin,
2052
+ Permission.ProjectMember,
2053
+ Permission.CreateProjectStatusPage,
2054
+ ],
2055
+ read: [
2056
+ Permission.ProjectOwner,
2057
+ Permission.ProjectAdmin,
2058
+ Permission.ProjectMember,
2059
+ Permission.ReadProjectStatusPage,
2060
+ ],
2061
+ update: [
2062
+ Permission.ProjectOwner,
2063
+ Permission.ProjectAdmin,
2064
+ Permission.ProjectMember,
2065
+ Permission.EditProjectStatusPage,
2066
+ ],
2067
+ })
2068
+ @TableColumn({
2069
+ isDefaultValueColumn: true,
2070
+ type: TableColumnType.Boolean,
2071
+ title: "Show Announcements on Status Page",
2072
+ description: "Show Announcements on Status Page?",
2073
+ })
2074
+ @Column({
2075
+ type: ColumnType.Boolean,
2076
+ default: true,
2077
+ nullable: false,
2078
+ })
2079
+ @ColumnBillingAccessControl({
2080
+ read: PlanType.Free,
2081
+ update: PlanType.Growth,
2082
+ create: PlanType.Free,
2083
+ })
2084
+ public showAnnouncementsOnStatusPage?: boolean = undefined;
2085
+
2086
+ @ColumnAccessControl({
2087
+ create: [
2088
+ Permission.ProjectOwner,
2089
+ Permission.ProjectAdmin,
2090
+ Permission.ProjectMember,
2091
+ Permission.CreateProjectStatusPage,
2092
+ ],
2093
+ read: [
2094
+ Permission.ProjectOwner,
2095
+ Permission.ProjectAdmin,
2096
+ Permission.ProjectMember,
2097
+ Permission.ReadProjectStatusPage,
2098
+ ],
2099
+ update: [
2100
+ Permission.ProjectOwner,
2101
+ Permission.ProjectAdmin,
2102
+ Permission.ProjectMember,
2103
+ Permission.EditProjectStatusPage,
2104
+ ],
2105
+ })
2106
+ @TableColumn({
2107
+ isDefaultValueColumn: true,
2108
+ type: TableColumnType.Boolean,
2109
+ title: "Show Scheduled Maintenance Events on Status Page",
2110
+ description: "Show Scheduled Maintenance Events on Status Page?",
2111
+ })
2112
+ @Column({
2113
+ type: ColumnType.Boolean,
2114
+ default: true,
2115
+ nullable: false,
2116
+ })
2117
+ @ColumnBillingAccessControl({
2118
+ read: PlanType.Free,
2119
+ update: PlanType.Growth,
2120
+ create: PlanType.Free,
2121
+ })
2122
+ public showScheduledMaintenanceEventsOnStatusPage?: boolean = undefined;
2009
2123
  }
@@ -335,6 +335,9 @@ export default class StatusPageAPI extends BaseAPI<
335
335
  type: true,
336
336
  name: true,
337
337
  },
338
+ showIncidentsOnStatusPage: true,
339
+ showAnnouncementsOnStatusPage: true,
340
+ showScheduledMaintenanceEventsOnStatusPage: true,
338
341
  };
339
342
 
340
343
  const hasEnabledSSO: PositiveNumber =
@@ -914,26 +917,28 @@ export default class StatusPageAPI extends BaseAPI<
914
917
  return state.id!;
915
918
  });
916
919
 
917
- activeIncidents = await IncidentService.findBy({
918
- query: {
919
- monitors: monitorsOnStatusPage as any,
920
- currentIncidentStateId: QueryHelper.any(
921
- unresolvedIncidentStateIds,
922
- ),
923
- isVisibleOnStatusPage: true,
924
- projectId: statusPage.projectId!,
925
- },
926
- select: select,
927
- sort: {
928
- createdAt: SortOrder.Ascending,
929
- },
920
+ if (statusPage.showIncidentsOnStatusPage) {
921
+ activeIncidents = await IncidentService.findBy({
922
+ query: {
923
+ monitors: monitorsOnStatusPage as any,
924
+ currentIncidentStateId: QueryHelper.any(
925
+ unresolvedIncidentStateIds,
926
+ ),
927
+ isVisibleOnStatusPage: true,
928
+ projectId: statusPage.projectId!,
929
+ },
930
+ select: select,
931
+ sort: {
932
+ createdAt: SortOrder.Ascending,
933
+ },
930
934
 
931
- skip: 0,
932
- limit: LIMIT_PER_PROJECT,
933
- props: {
934
- isRoot: true,
935
- },
936
- });
935
+ skip: 0,
936
+ limit: LIMIT_PER_PROJECT,
937
+ props: {
938
+ isRoot: true,
939
+ },
940
+ });
941
+ }
937
942
  }
938
943
 
939
944
  const incidentsOnStatusPage: Array<ObjectID> = activeIncidents.map(
@@ -1003,8 +1008,10 @@ export default class StatusPageAPI extends BaseAPI<
1003
1008
 
1004
1009
  const today: Date = OneUptimeDate.getCurrentDate();
1005
1010
 
1006
- const activeAnnouncements: Array<StatusPageAnnouncement> =
1007
- await StatusPageAnnouncementService.findBy({
1011
+ let activeAnnouncements: Array<StatusPageAnnouncement> = [];
1012
+
1013
+ if (statusPage.showAnnouncementsOnStatusPage) {
1014
+ activeAnnouncements = await StatusPageAnnouncementService.findBy({
1008
1015
  query: {
1009
1016
  statusPages: objectId as any,
1010
1017
  showAnnouncementAt: QueryHelper.lessThan(today),
@@ -1025,6 +1032,7 @@ export default class StatusPageAPI extends BaseAPI<
1025
1032
  isRoot: true,
1026
1033
  },
1027
1034
  });
1035
+ }
1028
1036
 
1029
1037
  // check if status page has active scheduled events.
1030
1038
 
@@ -1057,47 +1065,56 @@ export default class StatusPageAPI extends BaseAPI<
1057
1065
  };
1058
1066
  }
1059
1067
 
1060
- const scheduledMaintenanceEvents: Array<ScheduledMaintenance> =
1061
- await ScheduledMaintenanceService.findBy({
1062
- query: {
1063
- currentScheduledMaintenanceState: {
1064
- isOngoingState: true,
1065
- } as any,
1066
- statusPages: objectId as any,
1067
- projectId: statusPage.projectId!,
1068
- isVisibleOnStatusPage: true,
1069
- },
1070
- select: scheduledEventsSelect,
1071
- sort: {
1072
- startsAt: SortOrder.Ascending,
1073
- },
1074
- skip: 0,
1075
- limit: LIMIT_PER_PROJECT,
1076
- props: {
1077
- isRoot: true,
1078
- },
1079
- });
1068
+ let scheduledMaintenanceEvents: Array<ScheduledMaintenance> = [];
1080
1069
 
1081
- const futureScheduledMaintenanceEvents: Array<ScheduledMaintenance> =
1082
- await ScheduledMaintenanceService.findBy({
1083
- query: {
1084
- currentScheduledMaintenanceState: {
1085
- isScheduledState: true,
1086
- } as any,
1087
- statusPages: objectId as any,
1088
- projectId: statusPage.projectId!,
1089
- isVisibleOnStatusPage: true,
1090
- },
1091
- select: scheduledEventsSelect,
1092
- sort: {
1093
- startsAt: SortOrder.Ascending,
1094
- },
1095
- skip: 0,
1096
- limit: LIMIT_PER_PROJECT,
1097
- props: {
1098
- isRoot: true,
1099
- },
1100
- });
1070
+ if (statusPage.showScheduledMaintenanceEventsOnStatusPage) {
1071
+ scheduledMaintenanceEvents =
1072
+ await ScheduledMaintenanceService.findBy({
1073
+ query: {
1074
+ currentScheduledMaintenanceState: {
1075
+ isOngoingState: true,
1076
+ } as any,
1077
+ statusPages: objectId as any,
1078
+ projectId: statusPage.projectId!,
1079
+ isVisibleOnStatusPage: true,
1080
+ },
1081
+ select: scheduledEventsSelect,
1082
+ sort: {
1083
+ startsAt: SortOrder.Ascending,
1084
+ },
1085
+ skip: 0,
1086
+ limit: LIMIT_PER_PROJECT,
1087
+ props: {
1088
+ isRoot: true,
1089
+ },
1090
+ });
1091
+ }
1092
+
1093
+ let futureScheduledMaintenanceEvents: Array<ScheduledMaintenance> =
1094
+ [];
1095
+
1096
+ if (statusPage.showScheduledMaintenanceEventsOnStatusPage) {
1097
+ futureScheduledMaintenanceEvents =
1098
+ await ScheduledMaintenanceService.findBy({
1099
+ query: {
1100
+ currentScheduledMaintenanceState: {
1101
+ isScheduledState: true,
1102
+ } as any,
1103
+ statusPages: objectId as any,
1104
+ projectId: statusPage.projectId!,
1105
+ isVisibleOnStatusPage: true,
1106
+ },
1107
+ select: scheduledEventsSelect,
1108
+ sort: {
1109
+ startsAt: SortOrder.Ascending,
1110
+ },
1111
+ skip: 0,
1112
+ limit: LIMIT_PER_PROJECT,
1113
+ props: {
1114
+ isRoot: true,
1115
+ },
1116
+ });
1117
+ }
1101
1118
 
1102
1119
  futureScheduledMaintenanceEvents.forEach(
1103
1120
  (event: ScheduledMaintenance) => {
@@ -1509,6 +1526,7 @@ export default class StatusPageAPI extends BaseAPI<
1509
1526
  projectId: true,
1510
1527
  showScheduledEventHistoryInDays: true,
1511
1528
  showScheduledEventLabelsOnStatusPage: true,
1529
+ showScheduledMaintenanceEventsOnStatusPage: true,
1512
1530
  },
1513
1531
  props: {
1514
1532
  isRoot: true,
@@ -1519,6 +1537,12 @@ export default class StatusPageAPI extends BaseAPI<
1519
1537
  throw new BadDataException("Status Page not found");
1520
1538
  }
1521
1539
 
1540
+ if (!statusPage.showScheduledMaintenanceEventsOnStatusPage) {
1541
+ throw new BadDataException(
1542
+ "Scheduled Maintenance Events are not enabled on this status page",
1543
+ );
1544
+ }
1545
+
1522
1546
  // get monitors on status page.
1523
1547
  const statusPageResources: Array<StatusPageResource> =
1524
1548
  await StatusPageService.getStatusPageResources({
@@ -1818,6 +1842,7 @@ export default class StatusPageAPI extends BaseAPI<
1818
1842
  _id: true,
1819
1843
  projectId: true,
1820
1844
  showAnnouncementHistoryInDays: true,
1845
+ showAnnouncementsOnStatusPage: true,
1821
1846
  },
1822
1847
  props: {
1823
1848
  isRoot: true,
@@ -1828,6 +1853,12 @@ export default class StatusPageAPI extends BaseAPI<
1828
1853
  throw new BadDataException("Status Page not found");
1829
1854
  }
1830
1855
 
1856
+ if (!statusPage.showAnnouncementsOnStatusPage) {
1857
+ throw new BadDataException(
1858
+ "Announcements are not enabled for this status page.",
1859
+ );
1860
+ }
1861
+
1831
1862
  // check if status page has active announcement.
1832
1863
 
1833
1864
  const today: Date = OneUptimeDate.getCurrentDate();
@@ -2176,6 +2207,7 @@ export default class StatusPageAPI extends BaseAPI<
2176
2207
  projectId: true,
2177
2208
  showIncidentHistoryInDays: true,
2178
2209
  showIncidentLabelsOnStatusPage: true,
2210
+ showIncidentsOnStatusPage: true,
2179
2211
  },
2180
2212
  props: {
2181
2213
  isRoot: true,
@@ -2186,6 +2218,12 @@ export default class StatusPageAPI extends BaseAPI<
2186
2218
  throw new BadDataException("Status Page not found");
2187
2219
  }
2188
2220
 
2221
+ if (!statusPage.showIncidentsOnStatusPage) {
2222
+ throw new BadDataException(
2223
+ "Incidents are not enabled on this status page.",
2224
+ );
2225
+ }
2226
+
2189
2227
  // get monitors on status page.
2190
2228
  const statusPageResources: Array<StatusPageResource> =
2191
2229
  await StatusPageService.getStatusPageResources({
@@ -2491,6 +2529,9 @@ export default class StatusPageAPI extends BaseAPI<
2491
2529
  defaultBarColor: true,
2492
2530
  showOverallUptimePercentOnStatusPage: true,
2493
2531
  overallUptimePercentPrecision: true,
2532
+ showAnnouncementsOnStatusPage: true,
2533
+ showIncidentsOnStatusPage: true,
2534
+ showScheduledMaintenanceEventsOnStatusPage: true,
2494
2535
  },
2495
2536
  props: {
2496
2537
  isRoot: true,
@@ -0,0 +1,29 @@
1
+ import { MigrationInterface, QueryRunner } from "typeorm";
2
+
3
+ export class MigrationName1740419151825 implements MigrationInterface {
4
+ public name = "MigrationName1740419151825";
5
+
6
+ public async up(queryRunner: QueryRunner): Promise<void> {
7
+ await queryRunner.query(
8
+ `ALTER TABLE "StatusPage" ADD "showIncidentsOnStatusPage" boolean NOT NULL DEFAULT true`,
9
+ );
10
+ await queryRunner.query(
11
+ `ALTER TABLE "StatusPage" ADD "showAnnouncementsOnStatusPage" boolean NOT NULL DEFAULT true`,
12
+ );
13
+ await queryRunner.query(
14
+ `ALTER TABLE "StatusPage" ADD "showScheduledMaintenanceEventsOnStatusPage" boolean NOT NULL DEFAULT true`,
15
+ );
16
+ }
17
+
18
+ public async down(queryRunner: QueryRunner): Promise<void> {
19
+ await queryRunner.query(
20
+ `ALTER TABLE "StatusPage" DROP COLUMN "showScheduledMaintenanceEventsOnStatusPage"`,
21
+ );
22
+ await queryRunner.query(
23
+ `ALTER TABLE "StatusPage" DROP COLUMN "showAnnouncementsOnStatusPage"`,
24
+ );
25
+ await queryRunner.query(
26
+ `ALTER TABLE "StatusPage" DROP COLUMN "showIncidentsOnStatusPage"`,
27
+ );
28
+ }
29
+ }
@@ -106,6 +106,7 @@ import { MigrationName1739282331053 } from "./1739282331053-MigrationName";
106
106
  import { MigrationName1739374537088 } from "./1739374537088-MigrationName";
107
107
  import { MigrationName1739569321582 } from "./1739569321582-MigrationName";
108
108
  import { MigrationName1740164199817 } from "./1740164199817-MigrationName";
109
+ import { MigrationName1740419151825 } from "./1740419151825-MigrationName";
109
110
 
110
111
  export default [
111
112
  InitialMigration,
@@ -216,4 +217,5 @@ export default [
216
217
  MigrationName1739374537088,
217
218
  MigrationName1739569321582,
218
219
  MigrationName1740164199817,
220
+ MigrationName1740419151825,
219
221
  ];
@@ -99,6 +99,9 @@ let StatusPage = class StatusPage extends BaseModel {
99
99
  this.showOverallUptimePercentOnStatusPage = undefined;
100
100
  this.overallUptimePercentPrecision = undefined;
101
101
  this.subscriberEmailNotificationFooterText = undefined;
102
+ this.showIncidentsOnStatusPage = undefined;
103
+ this.showAnnouncementsOnStatusPage = undefined;
104
+ this.showScheduledMaintenanceEventsOnStatusPage = undefined;
102
105
  }
103
106
  };
104
107
  __decorate([
@@ -2023,6 +2026,123 @@ __decorate([
2023
2026
  }),
2024
2027
  __metadata("design:type", String)
2025
2028
  ], StatusPage.prototype, "subscriberEmailNotificationFooterText", void 0);
2029
+ __decorate([
2030
+ ColumnAccessControl({
2031
+ create: [
2032
+ Permission.ProjectOwner,
2033
+ Permission.ProjectAdmin,
2034
+ Permission.ProjectMember,
2035
+ Permission.CreateProjectStatusPage,
2036
+ ],
2037
+ read: [
2038
+ Permission.ProjectOwner,
2039
+ Permission.ProjectAdmin,
2040
+ Permission.ProjectMember,
2041
+ Permission.ReadProjectStatusPage,
2042
+ ],
2043
+ update: [
2044
+ Permission.ProjectOwner,
2045
+ Permission.ProjectAdmin,
2046
+ Permission.ProjectMember,
2047
+ Permission.EditProjectStatusPage,
2048
+ ],
2049
+ }),
2050
+ TableColumn({
2051
+ isDefaultValueColumn: true,
2052
+ type: TableColumnType.Boolean,
2053
+ title: "Show Incidents on Status Page",
2054
+ description: "Show Incidents on Status Page?",
2055
+ }),
2056
+ Column({
2057
+ type: ColumnType.Boolean,
2058
+ default: true,
2059
+ nullable: false,
2060
+ }),
2061
+ ColumnBillingAccessControl({
2062
+ read: PlanType.Free,
2063
+ update: PlanType.Growth,
2064
+ create: PlanType.Free,
2065
+ }),
2066
+ __metadata("design:type", Boolean)
2067
+ ], StatusPage.prototype, "showIncidentsOnStatusPage", void 0);
2068
+ __decorate([
2069
+ ColumnAccessControl({
2070
+ create: [
2071
+ Permission.ProjectOwner,
2072
+ Permission.ProjectAdmin,
2073
+ Permission.ProjectMember,
2074
+ Permission.CreateProjectStatusPage,
2075
+ ],
2076
+ read: [
2077
+ Permission.ProjectOwner,
2078
+ Permission.ProjectAdmin,
2079
+ Permission.ProjectMember,
2080
+ Permission.ReadProjectStatusPage,
2081
+ ],
2082
+ update: [
2083
+ Permission.ProjectOwner,
2084
+ Permission.ProjectAdmin,
2085
+ Permission.ProjectMember,
2086
+ Permission.EditProjectStatusPage,
2087
+ ],
2088
+ }),
2089
+ TableColumn({
2090
+ isDefaultValueColumn: true,
2091
+ type: TableColumnType.Boolean,
2092
+ title: "Show Announcements on Status Page",
2093
+ description: "Show Announcements on Status Page?",
2094
+ }),
2095
+ Column({
2096
+ type: ColumnType.Boolean,
2097
+ default: true,
2098
+ nullable: false,
2099
+ }),
2100
+ ColumnBillingAccessControl({
2101
+ read: PlanType.Free,
2102
+ update: PlanType.Growth,
2103
+ create: PlanType.Free,
2104
+ }),
2105
+ __metadata("design:type", Boolean)
2106
+ ], StatusPage.prototype, "showAnnouncementsOnStatusPage", void 0);
2107
+ __decorate([
2108
+ ColumnAccessControl({
2109
+ create: [
2110
+ Permission.ProjectOwner,
2111
+ Permission.ProjectAdmin,
2112
+ Permission.ProjectMember,
2113
+ Permission.CreateProjectStatusPage,
2114
+ ],
2115
+ read: [
2116
+ Permission.ProjectOwner,
2117
+ Permission.ProjectAdmin,
2118
+ Permission.ProjectMember,
2119
+ Permission.ReadProjectStatusPage,
2120
+ ],
2121
+ update: [
2122
+ Permission.ProjectOwner,
2123
+ Permission.ProjectAdmin,
2124
+ Permission.ProjectMember,
2125
+ Permission.EditProjectStatusPage,
2126
+ ],
2127
+ }),
2128
+ TableColumn({
2129
+ isDefaultValueColumn: true,
2130
+ type: TableColumnType.Boolean,
2131
+ title: "Show Scheduled Maintenance Events on Status Page",
2132
+ description: "Show Scheduled Maintenance Events on Status Page?",
2133
+ }),
2134
+ Column({
2135
+ type: ColumnType.Boolean,
2136
+ default: true,
2137
+ nullable: false,
2138
+ }),
2139
+ ColumnBillingAccessControl({
2140
+ read: PlanType.Free,
2141
+ update: PlanType.Growth,
2142
+ create: PlanType.Free,
2143
+ }),
2144
+ __metadata("design:type", Boolean)
2145
+ ], StatusPage.prototype, "showScheduledMaintenanceEventsOnStatusPage", void 0);
2026
2146
  StatusPage = __decorate([
2027
2147
  EnableDocumentation(),
2028
2148
  AccessControlColumn("labels"),