@oneuptime/common 7.0.3202 → 7.0.3206
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.
- package/Models/DatabaseModels/StatusPage.ts +38 -0
- package/Models/DatabaseModels/StatusPageSubscriber.ts +70 -0
- package/Server/API/StatusPageAPI.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1730117995642-MigrationName.ts +29 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
- package/Server/Services/ScheduledMaintenanceService.ts +2 -0
- package/Server/Services/StatusPageService.ts +1 -6
- package/Server/Services/StatusPageSubscriberService.ts +54 -27
- package/Server/Utils/Monitor/MonitorResource.ts +21 -0
- package/Types/Monitor/CriteriaFilter.ts +2 -0
- package/Types/StatusPage/StatusPageEventType.ts +7 -0
- package/UI/Utils/StatusPage.ts +7 -0
- package/build/dist/Models/DatabaseModels/StatusPage.js +39 -0
- package/build/dist/Models/DatabaseModels/StatusPage.js.map +1 -1
- package/build/dist/Models/DatabaseModels/StatusPageSubscriber.js +71 -0
- package/build/dist/Models/DatabaseModels/StatusPageSubscriber.js.map +1 -1
- package/build/dist/Server/API/StatusPageAPI.js +11 -0
- package/build/dist/Server/API/StatusPageAPI.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1730117995642-MigrationName.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1730117995642-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/ScheduledMaintenanceService.js +2 -0
- package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageService.js +1 -5
- package/build/dist/Server/Services/StatusPageService.js.map +1 -1
- package/build/dist/Server/Services/StatusPageSubscriberService.js +40 -23
- package/build/dist/Server/Services/StatusPageSubscriberService.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +12 -0
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +3 -0
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/Types/StatusPage/StatusPageEventType.js +8 -0
- package/build/dist/Types/StatusPage/StatusPageEventType.js.map +1 -0
- package/build/dist/UI/Utils/StatusPage.js +5 -0
- package/build/dist/UI/Utils/StatusPage.js.map +1 -1
- package/package.json +2 -2
|
@@ -1061,6 +1061,44 @@ export default class StatusPage extends BaseModel {
|
|
|
1061
1061
|
})
|
|
1062
1062
|
public allowSubscribersToChooseResources?: boolean = undefined;
|
|
1063
1063
|
|
|
1064
|
+
@ColumnAccessControl({
|
|
1065
|
+
create: [
|
|
1066
|
+
Permission.ProjectOwner,
|
|
1067
|
+
Permission.ProjectAdmin,
|
|
1068
|
+
Permission.ProjectMember,
|
|
1069
|
+
Permission.CreateProjectStatusPage,
|
|
1070
|
+
],
|
|
1071
|
+
read: [
|
|
1072
|
+
Permission.ProjectOwner,
|
|
1073
|
+
Permission.ProjectAdmin,
|
|
1074
|
+
Permission.ProjectMember,
|
|
1075
|
+
Permission.ReadProjectStatusPage,
|
|
1076
|
+
],
|
|
1077
|
+
update: [
|
|
1078
|
+
Permission.ProjectOwner,
|
|
1079
|
+
Permission.ProjectAdmin,
|
|
1080
|
+
Permission.ProjectMember,
|
|
1081
|
+
Permission.EditProjectStatusPage,
|
|
1082
|
+
],
|
|
1083
|
+
})
|
|
1084
|
+
@TableColumn({
|
|
1085
|
+
isDefaultValueColumn: true,
|
|
1086
|
+
type: TableColumnType.Boolean,
|
|
1087
|
+
title: "Allow Subscribers to subscribe to event types",
|
|
1088
|
+
description:
|
|
1089
|
+
"Can subscribers choose which event type like Announcements, Incidents, Scheduled Events to subscribe to?",
|
|
1090
|
+
})
|
|
1091
|
+
@Column({
|
|
1092
|
+
type: ColumnType.Boolean,
|
|
1093
|
+
default: false,
|
|
1094
|
+
})
|
|
1095
|
+
@ColumnBillingAccessControl({
|
|
1096
|
+
read: PlanType.Free,
|
|
1097
|
+
update: PlanType.Scale,
|
|
1098
|
+
create: PlanType.Free,
|
|
1099
|
+
})
|
|
1100
|
+
public allowSubscribersToChooseEventTypes?: boolean = undefined;
|
|
1101
|
+
|
|
1064
1102
|
@ColumnAccessControl({
|
|
1065
1103
|
create: [
|
|
1066
1104
|
Permission.ProjectOwner,
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
ManyToMany,
|
|
33
33
|
ManyToOne,
|
|
34
34
|
} from "typeorm";
|
|
35
|
+
import StatusPageEventType from "../../Types/StatusPage/StatusPageEventType";
|
|
35
36
|
|
|
36
37
|
@EnableDocumentation()
|
|
37
38
|
@EnableWorkflow({
|
|
@@ -528,6 +529,40 @@ export default class StatusPageSubscriber extends BaseModel {
|
|
|
528
529
|
})
|
|
529
530
|
public isSubscribedToAllResources?: boolean = undefined;
|
|
530
531
|
|
|
532
|
+
@ColumnAccessControl({
|
|
533
|
+
create: [
|
|
534
|
+
Permission.ProjectOwner,
|
|
535
|
+
Permission.ProjectAdmin,
|
|
536
|
+
Permission.ProjectMember,
|
|
537
|
+
Permission.CreateStatusPageSubscriber,
|
|
538
|
+
Permission.Public,
|
|
539
|
+
],
|
|
540
|
+
read: [
|
|
541
|
+
Permission.ProjectOwner,
|
|
542
|
+
Permission.ProjectAdmin,
|
|
543
|
+
Permission.ProjectMember,
|
|
544
|
+
Permission.ReadStatusPageSubscriber,
|
|
545
|
+
],
|
|
546
|
+
update: [
|
|
547
|
+
Permission.ProjectOwner,
|
|
548
|
+
Permission.ProjectAdmin,
|
|
549
|
+
Permission.ProjectMember,
|
|
550
|
+
Permission.EditStatusPageSubscriber,
|
|
551
|
+
],
|
|
552
|
+
})
|
|
553
|
+
@TableColumn({
|
|
554
|
+
isDefaultValueColumn: true,
|
|
555
|
+
type: TableColumnType.Boolean,
|
|
556
|
+
title: "Is Subscribed to All Event Types",
|
|
557
|
+
description:
|
|
558
|
+
"Is Subscriber Subscribed to All Event Types (like Incidents, Scheduled Events, Announcements) on this status page?",
|
|
559
|
+
})
|
|
560
|
+
@Column({
|
|
561
|
+
type: ColumnType.Boolean,
|
|
562
|
+
default: true,
|
|
563
|
+
})
|
|
564
|
+
public isSubscribedToAllEventTypes?: boolean = undefined;
|
|
565
|
+
|
|
531
566
|
@ColumnAccessControl({
|
|
532
567
|
create: [
|
|
533
568
|
Permission.ProjectOwner,
|
|
@@ -575,4 +610,39 @@ export default class StatusPageSubscriber extends BaseModel {
|
|
|
575
610
|
},
|
|
576
611
|
})
|
|
577
612
|
public statusPageResources?: Array<StatusPageResource> = undefined;
|
|
613
|
+
|
|
614
|
+
@ColumnAccessControl({
|
|
615
|
+
create: [
|
|
616
|
+
Permission.ProjectOwner,
|
|
617
|
+
Permission.ProjectAdmin,
|
|
618
|
+
Permission.ProjectMember,
|
|
619
|
+
Permission.CreateStatusPageSubscriber,
|
|
620
|
+
Permission.Public,
|
|
621
|
+
],
|
|
622
|
+
read: [
|
|
623
|
+
Permission.ProjectOwner,
|
|
624
|
+
Permission.ProjectAdmin,
|
|
625
|
+
Permission.ProjectMember,
|
|
626
|
+
Permission.ReadStatusPageSubscriber,
|
|
627
|
+
],
|
|
628
|
+
update: [
|
|
629
|
+
Permission.ProjectOwner,
|
|
630
|
+
Permission.ProjectAdmin,
|
|
631
|
+
Permission.ProjectMember,
|
|
632
|
+
Permission.EditStatusPageSubscriber,
|
|
633
|
+
],
|
|
634
|
+
})
|
|
635
|
+
@TableColumn({
|
|
636
|
+
required: false,
|
|
637
|
+
type: TableColumnType.JSON,
|
|
638
|
+
title: "Subscribed to Event Types",
|
|
639
|
+
description:
|
|
640
|
+
"Which event types is the subscriber subscribed to (like Incidents, Scheduled Events, Announcements)",
|
|
641
|
+
})
|
|
642
|
+
@Column({
|
|
643
|
+
type: ColumnType.JSON,
|
|
644
|
+
nullable: true,
|
|
645
|
+
default: [],
|
|
646
|
+
})
|
|
647
|
+
public statusPageEventTypes?: Array<StatusPageEventType> = undefined;
|
|
578
648
|
}
|
|
@@ -73,6 +73,7 @@ import StatusPageHistoryChartBarColorRule from "Common/Models/DatabaseModels/Sta
|
|
|
73
73
|
import StatusPageResource from "Common/Models/DatabaseModels/StatusPageResource";
|
|
74
74
|
import StatusPageSSO from "Common/Models/DatabaseModels/StatusPageSso";
|
|
75
75
|
import StatusPageSubscriber from "Common/Models/DatabaseModels/StatusPageSubscriber";
|
|
76
|
+
import StatusPageEventType from "../../Types/StatusPage/StatusPageEventType";
|
|
76
77
|
|
|
77
78
|
export default class StatusPageAPI extends BaseAPI<
|
|
78
79
|
StatusPage,
|
|
@@ -250,6 +251,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
250
251
|
enableSmsSubscribers: true,
|
|
251
252
|
isPublicStatusPage: true,
|
|
252
253
|
allowSubscribersToChooseResources: true,
|
|
254
|
+
allowSubscribersToChooseEventTypes: true,
|
|
253
255
|
requireSsoForLogin: true,
|
|
254
256
|
coverImageFile: {
|
|
255
257
|
file: true,
|
|
@@ -1750,6 +1752,7 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1750
1752
|
enableEmailSubscribers: true,
|
|
1751
1753
|
enableSmsSubscribers: true,
|
|
1752
1754
|
allowSubscribersToChooseResources: true,
|
|
1755
|
+
allowSubscribersToChooseEventTypes: true,
|
|
1753
1756
|
},
|
|
1754
1757
|
props: {
|
|
1755
1758
|
isRoot: true,
|
|
@@ -1838,6 +1841,15 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1838
1841
|
);
|
|
1839
1842
|
}
|
|
1840
1843
|
|
|
1844
|
+
if (
|
|
1845
|
+
req.body.data["statusPageEventTypes"] &&
|
|
1846
|
+
!statusPage.allowSubscribersToChooseEventTypes
|
|
1847
|
+
) {
|
|
1848
|
+
throw new BadDataException(
|
|
1849
|
+
"Subscribers are not allowed to choose event types for this status page.",
|
|
1850
|
+
);
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1841
1853
|
statusPageSubscriber.statusPageId = objectId;
|
|
1842
1854
|
statusPageSubscriber.sendYouHaveSubscribedMessage = true;
|
|
1843
1855
|
statusPageSubscriber.projectId = statusPage.projectId!;
|
|
@@ -1845,6 +1857,10 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1845
1857
|
req.body.data["isSubscribedToAllResources"],
|
|
1846
1858
|
);
|
|
1847
1859
|
|
|
1860
|
+
statusPageSubscriber.isSubscribedToAllEventTypes = Boolean(
|
|
1861
|
+
req.body.data["isSubscribedToAllEventTypes"],
|
|
1862
|
+
);
|
|
1863
|
+
|
|
1848
1864
|
if (
|
|
1849
1865
|
req.body.data["statusPageResources"] &&
|
|
1850
1866
|
req.body.data["statusPageResources"].length > 0
|
|
@@ -1854,6 +1870,15 @@ export default class StatusPageAPI extends BaseAPI<
|
|
|
1854
1870
|
] as Array<StatusPageResource>;
|
|
1855
1871
|
}
|
|
1856
1872
|
|
|
1873
|
+
if (
|
|
1874
|
+
req.body.data["statusPageEventTypes"] &&
|
|
1875
|
+
req.body.data["statusPageEventTypes"].length > 0
|
|
1876
|
+
) {
|
|
1877
|
+
statusPageSubscriber.statusPageEventTypes = req.body.data[
|
|
1878
|
+
"statusPageEventTypes"
|
|
1879
|
+
] as Array<StatusPageEventType>;
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1857
1882
|
if (isUpdate) {
|
|
1858
1883
|
// check isUnsubscribed is set to false.
|
|
1859
1884
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1730117995642 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1730117995642";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`ALTER TABLE "StatusPage" ADD "allowSubscribersToChooseEventTypes" boolean NOT NULL DEFAULT false`,
|
|
9
|
+
);
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`ALTER TABLE "StatusPageSubscriber" ADD "isSubscribedToAllEventTypes" boolean NOT NULL DEFAULT true`,
|
|
12
|
+
);
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`ALTER TABLE "StatusPageSubscriber" ADD "statusPageEventTypes" jsonb DEFAULT '[]'`,
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`ALTER TABLE "StatusPageSubscriber" DROP COLUMN "statusPageEventTypes"`,
|
|
21
|
+
);
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`ALTER TABLE "StatusPageSubscriber" DROP COLUMN "isSubscribedToAllEventTypes"`,
|
|
24
|
+
);
|
|
25
|
+
await queryRunner.query(
|
|
26
|
+
`ALTER TABLE "StatusPage" DROP COLUMN "allowSubscribersToChooseEventTypes"`,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -75,6 +75,7 @@ import { MigrationName1727894983857 } from "./1727894983857-MigrationName";
|
|
|
75
75
|
import { MigrationName1727906598804 } from "./1727906598804-MigrationName";
|
|
76
76
|
import { MigrationName1728472625805 } from "./1728472625805-MigrationName";
|
|
77
77
|
import { MigrationName1729682875503 } from "./1729682875503-MigrationName";
|
|
78
|
+
import { MigrationName1730117995642 } from "./1730117995642-MigrationName";
|
|
78
79
|
|
|
79
80
|
export default [
|
|
80
81
|
InitialMigration,
|
|
@@ -154,4 +155,5 @@ export default [
|
|
|
154
155
|
MigrationName1727906598804,
|
|
155
156
|
MigrationName1728472625805,
|
|
156
157
|
MigrationName1729682875503,
|
|
158
|
+
MigrationName1730117995642,
|
|
157
159
|
];
|
|
@@ -46,6 +46,7 @@ import StatusPageSubscriber from "Common/Models/DatabaseModels/StatusPageSubscri
|
|
|
46
46
|
import Hostname from "../../Types/API/Hostname";
|
|
47
47
|
import Protocol from "../../Types/API/Protocol";
|
|
48
48
|
import { IsBillingEnabled } from "../EnvironmentConfig";
|
|
49
|
+
import StatusPageEventType from "../../Types/StatusPage/StatusPageEventType";
|
|
49
50
|
|
|
50
51
|
export class Service extends DatabaseService<Model> {
|
|
51
52
|
public constructor() {
|
|
@@ -165,6 +166,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
165
166
|
subscriber: subscriber,
|
|
166
167
|
statusPageResources: statusPageToResources[statuspage._id!] || [],
|
|
167
168
|
statusPage: statuspage,
|
|
169
|
+
eventType: StatusPageEventType.ScheduledEvent,
|
|
168
170
|
});
|
|
169
171
|
|
|
170
172
|
if (!shouldNotifySubscriber) {
|
|
@@ -699,12 +699,7 @@ export class Service extends DatabaseService<StatusPage> {
|
|
|
699
699
|
continue;
|
|
700
700
|
}
|
|
701
701
|
|
|
702
|
-
const shouldNotifySubscriber: boolean =
|
|
703
|
-
StatusPageSubscriberService.shouldSendNotification({
|
|
704
|
-
subscriber: subscriber,
|
|
705
|
-
statusPageResources: [],
|
|
706
|
-
statusPage: statuspage,
|
|
707
|
-
});
|
|
702
|
+
const shouldNotifySubscriber: boolean = !subscriber.isUnsubscribed;
|
|
708
703
|
|
|
709
704
|
if (!shouldNotifySubscriber) {
|
|
710
705
|
continue;
|
|
@@ -28,6 +28,7 @@ import StatusPage from "Common/Models/DatabaseModels/StatusPage";
|
|
|
28
28
|
import StatusPageResource from "Common/Models/DatabaseModels/StatusPageResource";
|
|
29
29
|
import Model from "Common/Models/DatabaseModels/StatusPageSubscriber";
|
|
30
30
|
import PositiveNumber from "../../Types/PositiveNumber";
|
|
31
|
+
import StatusPageEventType from "../../Types/StatusPage/StatusPageEventType";
|
|
31
32
|
|
|
32
33
|
export class Service extends DatabaseService<Model> {
|
|
33
34
|
public constructor() {
|
|
@@ -153,17 +154,6 @@ export class Service extends DatabaseService<Model> {
|
|
|
153
154
|
},
|
|
154
155
|
);
|
|
155
156
|
|
|
156
|
-
if (statuspage && !statuspage.allowSubscribersToChooseResources) {
|
|
157
|
-
data.data.isSubscribedToAllResources = true;
|
|
158
|
-
} else if (
|
|
159
|
-
!data.data.statusPageResources ||
|
|
160
|
-
data.data.statusPageResources.length === 0
|
|
161
|
-
) {
|
|
162
|
-
if (!data.data.isSubscribedToAllResources) {
|
|
163
|
-
throw new BadDataException("Select resources to subscribe to.");
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
|
|
167
157
|
if (!statuspage || !statuspage.projectId) {
|
|
168
158
|
throw new BadDataException("Status Page not found");
|
|
169
159
|
}
|
|
@@ -305,6 +295,8 @@ export class Service extends DatabaseService<Model> {
|
|
|
305
295
|
subscriberWebhook: true,
|
|
306
296
|
isSubscribedToAllResources: true,
|
|
307
297
|
statusPageResources: true,
|
|
298
|
+
isSubscribedToAllEventTypes: true,
|
|
299
|
+
statusPageEventTypes: true,
|
|
308
300
|
},
|
|
309
301
|
skip: 0,
|
|
310
302
|
limit: LIMIT_MAX,
|
|
@@ -325,33 +317,67 @@ export class Service extends DatabaseService<Model> {
|
|
|
325
317
|
subscriber: Model;
|
|
326
318
|
statusPageResources: Array<StatusPageResource>;
|
|
327
319
|
statusPage: StatusPage;
|
|
320
|
+
eventType: StatusPageEventType;
|
|
328
321
|
}): boolean {
|
|
322
|
+
let shouldSendNotification: boolean = true; // default to true.
|
|
323
|
+
|
|
329
324
|
if (data.subscriber.isUnsubscribed) {
|
|
330
|
-
|
|
325
|
+
shouldSendNotification = false;
|
|
326
|
+
return shouldSendNotification;
|
|
331
327
|
}
|
|
332
328
|
|
|
333
|
-
if (
|
|
334
|
-
|
|
335
|
-
|
|
329
|
+
if (
|
|
330
|
+
data.statusPage.allowSubscribersToChooseResources &&
|
|
331
|
+
!data.subscriber.isSubscribedToAllResources &&
|
|
332
|
+
data.eventType !== StatusPageEventType.Announcement // announcements dont have resources
|
|
333
|
+
) {
|
|
334
|
+
const subscriberResourceIds: Array<string> =
|
|
335
|
+
data.subscriber.statusPageResources?.map(
|
|
336
|
+
(resource: StatusPageResource) => {
|
|
337
|
+
return resource.id?.toString() as string;
|
|
338
|
+
},
|
|
339
|
+
) || [];
|
|
340
|
+
|
|
341
|
+
let shouldSendNotificationForResource: boolean = false;
|
|
342
|
+
|
|
343
|
+
if (subscriberResourceIds.length === 0) {
|
|
344
|
+
shouldSendNotificationForResource = false;
|
|
345
|
+
} else {
|
|
346
|
+
for (const resource of data.statusPageResources) {
|
|
347
|
+
if (
|
|
348
|
+
subscriberResourceIds.includes(resource.id?.toString() as string)
|
|
349
|
+
) {
|
|
350
|
+
shouldSendNotificationForResource = true;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
336
354
|
|
|
337
|
-
|
|
338
|
-
|
|
355
|
+
if (!shouldSendNotificationForResource) {
|
|
356
|
+
shouldSendNotification = false;
|
|
357
|
+
}
|
|
339
358
|
}
|
|
340
359
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
360
|
+
// now do for event types
|
|
361
|
+
|
|
362
|
+
if (
|
|
363
|
+
data.statusPage.allowSubscribersToChooseEventTypes &&
|
|
364
|
+
!data.subscriber.isSubscribedToAllEventTypes
|
|
365
|
+
) {
|
|
366
|
+
const subscriberEventTypes: Array<StatusPageEventType> =
|
|
367
|
+
data.subscriber.statusPageEventTypes || [];
|
|
368
|
+
|
|
369
|
+
let shouldSendNotificationForEventType: boolean = false;
|
|
370
|
+
|
|
371
|
+
if (subscriberEventTypes.includes(data.eventType)) {
|
|
372
|
+
shouldSendNotificationForEventType = true;
|
|
373
|
+
}
|
|
347
374
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
return true;
|
|
375
|
+
if (!shouldSendNotificationForEventType) {
|
|
376
|
+
shouldSendNotification = false;
|
|
351
377
|
}
|
|
352
378
|
}
|
|
353
379
|
|
|
354
|
-
return
|
|
380
|
+
return shouldSendNotification;
|
|
355
381
|
}
|
|
356
382
|
|
|
357
383
|
public async getStatusPagesToSendNotification(
|
|
@@ -375,6 +401,7 @@ export class Service extends DatabaseService<Model> {
|
|
|
375
401
|
isPublicStatusPage: true,
|
|
376
402
|
logoFileId: true,
|
|
377
403
|
allowSubscribersToChooseResources: true,
|
|
404
|
+
allowSubscribersToChooseEventTypes: true,
|
|
378
405
|
smtpConfig: {
|
|
379
406
|
_id: true,
|
|
380
407
|
hostname: true,
|
|
@@ -653,6 +653,27 @@ export default class MonitorResourceUtil {
|
|
|
653
653
|
}
|
|
654
654
|
}
|
|
655
655
|
|
|
656
|
+
if (
|
|
657
|
+
(data.dataToProcess as ProbeMonitorResponse).customCodeMonitorResponse
|
|
658
|
+
?.executionTimeInMS
|
|
659
|
+
) {
|
|
660
|
+
const monitorMetricsByMinute: MonitorMetricsByMinute =
|
|
661
|
+
new MonitorMetricsByMinute();
|
|
662
|
+
monitorMetricsByMinute.monitorId = data.monitorId;
|
|
663
|
+
monitorMetricsByMinute.projectId = data.projectId;
|
|
664
|
+
monitorMetricsByMinute.metricType = CheckOn.ExecutionTime;
|
|
665
|
+
monitorMetricsByMinute.metricValue = (
|
|
666
|
+
data.dataToProcess as ProbeMonitorResponse
|
|
667
|
+
).customCodeMonitorResponse?.executionTimeInMS;
|
|
668
|
+
monitorMetricsByMinute.miscData = {
|
|
669
|
+
probeId: (
|
|
670
|
+
data.dataToProcess as ProbeMonitorResponse
|
|
671
|
+
).probeId.toString(),
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
itemsToSave.push(monitorMetricsByMinute);
|
|
675
|
+
}
|
|
676
|
+
|
|
656
677
|
if ((data.dataToProcess as ProbeMonitorResponse).responseTimeInMs) {
|
|
657
678
|
const monitorMetricsByMinute: MonitorMetricsByMinute =
|
|
658
679
|
new MonitorMetricsByMinute();
|
package/UI/Utils/StatusPage.ts
CHANGED
|
@@ -9,8 +9,15 @@ import { LIMIT_PER_PROJECT } from "Common/Types/Database/LimitMax";
|
|
|
9
9
|
import ObjectID from "Common/Types/ObjectID";
|
|
10
10
|
import StatusPageGroup from "Common/Models/DatabaseModels/StatusPageGroup";
|
|
11
11
|
import StatusPageResource from "Common/Models/DatabaseModels/StatusPageResource";
|
|
12
|
+
import DropdownUtil from "./Dropdown";
|
|
13
|
+
import StatusPageEventType from "../../Types/StatusPage/StatusPageEventType";
|
|
14
|
+
import { DropdownOption } from "../Components/Dropdown/Dropdown";
|
|
12
15
|
|
|
13
16
|
export default class StatusPageUtil {
|
|
17
|
+
public static getDropdownPropsBasedOnEventTypes(): Array<DropdownOption> {
|
|
18
|
+
return DropdownUtil.getDropdownOptionsFromEnum(StatusPageEventType);
|
|
19
|
+
}
|
|
20
|
+
|
|
14
21
|
public static async getCategoryCheckboxPropsBasedOnResources(
|
|
15
22
|
statusPageId: ObjectID,
|
|
16
23
|
overrideRequestUrl?: URL,
|
|
@@ -72,6 +72,7 @@ let StatusPage = class StatusPage extends BaseModel {
|
|
|
72
72
|
this.enableSubscribers = undefined;
|
|
73
73
|
this.enableEmailSubscribers = undefined;
|
|
74
74
|
this.allowSubscribersToChooseResources = undefined;
|
|
75
|
+
this.allowSubscribersToChooseEventTypes = undefined;
|
|
75
76
|
this.enableSmsSubscribers = undefined;
|
|
76
77
|
this.copyrightText = undefined;
|
|
77
78
|
this.customFields = undefined;
|
|
@@ -1069,6 +1070,44 @@ __decorate([
|
|
|
1069
1070
|
}),
|
|
1070
1071
|
__metadata("design:type", Boolean)
|
|
1071
1072
|
], StatusPage.prototype, "allowSubscribersToChooseResources", void 0);
|
|
1073
|
+
__decorate([
|
|
1074
|
+
ColumnAccessControl({
|
|
1075
|
+
create: [
|
|
1076
|
+
Permission.ProjectOwner,
|
|
1077
|
+
Permission.ProjectAdmin,
|
|
1078
|
+
Permission.ProjectMember,
|
|
1079
|
+
Permission.CreateProjectStatusPage,
|
|
1080
|
+
],
|
|
1081
|
+
read: [
|
|
1082
|
+
Permission.ProjectOwner,
|
|
1083
|
+
Permission.ProjectAdmin,
|
|
1084
|
+
Permission.ProjectMember,
|
|
1085
|
+
Permission.ReadProjectStatusPage,
|
|
1086
|
+
],
|
|
1087
|
+
update: [
|
|
1088
|
+
Permission.ProjectOwner,
|
|
1089
|
+
Permission.ProjectAdmin,
|
|
1090
|
+
Permission.ProjectMember,
|
|
1091
|
+
Permission.EditProjectStatusPage,
|
|
1092
|
+
],
|
|
1093
|
+
}),
|
|
1094
|
+
TableColumn({
|
|
1095
|
+
isDefaultValueColumn: true,
|
|
1096
|
+
type: TableColumnType.Boolean,
|
|
1097
|
+
title: "Allow Subscribers to subscribe to event types",
|
|
1098
|
+
description: "Can subscribers choose which event type like Announcements, Incidents, Scheduled Events to subscribe to?",
|
|
1099
|
+
}),
|
|
1100
|
+
Column({
|
|
1101
|
+
type: ColumnType.Boolean,
|
|
1102
|
+
default: false,
|
|
1103
|
+
}),
|
|
1104
|
+
ColumnBillingAccessControl({
|
|
1105
|
+
read: PlanType.Free,
|
|
1106
|
+
update: PlanType.Scale,
|
|
1107
|
+
create: PlanType.Free,
|
|
1108
|
+
}),
|
|
1109
|
+
__metadata("design:type", Boolean)
|
|
1110
|
+
], StatusPage.prototype, "allowSubscribersToChooseEventTypes", void 0);
|
|
1072
1111
|
__decorate([
|
|
1073
1112
|
ColumnAccessControl({
|
|
1074
1113
|
create: [
|