@oneuptime/common 7.0.3206 → 7.0.3211
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/Index.ts +4 -0
- package/Models/DatabaseModels/MonitorTest.ts +477 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1730209089495-MigrationName.ts +51 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1730223198692-MigrationName.ts +29 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +4 -0
- package/Server/Services/MonitorTestService.ts +11 -0
- package/Server/Utils/Monitor/MonitorResource.ts +30 -0
- package/Types/Monitor/CriteriaFilter.ts +4 -1
- package/UI/Components/Loader/Loader.tsx +4 -2
- package/UI/Components/Modal/Modal.tsx +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +2 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/MonitorTest.js +501 -0
- package/build/dist/Models/DatabaseModels/MonitorTest.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1730209089495-MigrationName.js +24 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1730209089495-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1730223198692-MigrationName.js +16 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1730223198692-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +4 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/MonitorTestService.js +10 -0
- package/build/dist/Server/Services/MonitorTestService.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/MonitorResource.js +19 -0
- package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js +2 -1
- package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
- package/build/dist/UI/Components/Loader/Loader.js +2 -2
- package/build/dist/UI/Components/Loader/Loader.js.map +1 -1
- package/build/dist/UI/Components/Modal/Modal.js +1 -1
- package/build/dist/UI/Components/Modal/Modal.js.map +1 -1
- package/package.json +2 -2
|
@@ -154,6 +154,8 @@ import AlertNoteTemplate from "./AlertNoteTemplate";
|
|
|
154
154
|
import TableView from "./TableView";
|
|
155
155
|
import Dashboard from "./Dashboard";
|
|
156
156
|
|
|
157
|
+
import MonitorTest from "./MonitorTest";
|
|
158
|
+
|
|
157
159
|
const AllModelTypes: Array<{
|
|
158
160
|
new (): BaseModel;
|
|
159
161
|
}> = [
|
|
@@ -331,6 +333,8 @@ const AllModelTypes: Array<{
|
|
|
331
333
|
|
|
332
334
|
// Dashboards
|
|
333
335
|
Dashboard,
|
|
336
|
+
|
|
337
|
+
MonitorTest,
|
|
334
338
|
];
|
|
335
339
|
|
|
336
340
|
const modelTypeMap: { [key: string]: { new (): BaseModel } } = {};
|
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
import Project from "./Project";
|
|
2
|
+
import User from "./User";
|
|
3
|
+
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
4
|
+
import Route from "../../Types/API/Route";
|
|
5
|
+
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
|
|
6
|
+
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
|
|
7
|
+
import ColumnLength from "../../Types/Database/ColumnLength";
|
|
8
|
+
import ColumnType from "../../Types/Database/ColumnType";
|
|
9
|
+
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
10
|
+
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
11
|
+
import SlugifyColumn from "../../Types/Database/SlugifyColumn";
|
|
12
|
+
import TableColumn from "../../Types/Database/TableColumn";
|
|
13
|
+
import TableColumnType from "../../Types/Database/TableColumnType";
|
|
14
|
+
import TableMetadata from "../../Types/Database/TableMetadata";
|
|
15
|
+
import TenantColumn from "../../Types/Database/TenantColumn";
|
|
16
|
+
import IconProp from "../../Types/Icon/IconProp";
|
|
17
|
+
import MonitorSteps from "../../Types/Monitor/MonitorSteps";
|
|
18
|
+
import MonitorType from "../../Types/Monitor/MonitorType";
|
|
19
|
+
import ObjectID from "../../Types/ObjectID";
|
|
20
|
+
import Permission from "../../Types/Permission";
|
|
21
|
+
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
22
|
+
import { MonitorStepProbeResponse } from "./MonitorProbe";
|
|
23
|
+
import Probe from "./Probe";
|
|
24
|
+
|
|
25
|
+
@TenantColumn("projectId")
|
|
26
|
+
@TableAccessControl({
|
|
27
|
+
create: [
|
|
28
|
+
Permission.ProjectOwner,
|
|
29
|
+
Permission.ProjectAdmin,
|
|
30
|
+
Permission.ProjectMember,
|
|
31
|
+
Permission.CreateProjectMonitor,
|
|
32
|
+
],
|
|
33
|
+
read: [
|
|
34
|
+
Permission.ProjectOwner,
|
|
35
|
+
Permission.ProjectAdmin,
|
|
36
|
+
Permission.ProjectMember,
|
|
37
|
+
Permission.ReadProjectMonitor,
|
|
38
|
+
],
|
|
39
|
+
delete: [
|
|
40
|
+
Permission.ProjectOwner,
|
|
41
|
+
Permission.ProjectAdmin,
|
|
42
|
+
Permission.ProjectMember,
|
|
43
|
+
Permission.DeleteProjectMonitor,
|
|
44
|
+
],
|
|
45
|
+
update: [
|
|
46
|
+
Permission.ProjectOwner,
|
|
47
|
+
Permission.ProjectAdmin,
|
|
48
|
+
Permission.ProjectMember,
|
|
49
|
+
Permission.EditProjectMonitor,
|
|
50
|
+
],
|
|
51
|
+
})
|
|
52
|
+
@EnableWorkflow({
|
|
53
|
+
create: true,
|
|
54
|
+
delete: true,
|
|
55
|
+
update: true,
|
|
56
|
+
read: true,
|
|
57
|
+
})
|
|
58
|
+
@CrudApiEndpoint(new Route("/monitor-test"))
|
|
59
|
+
@SlugifyColumn("name", "slug")
|
|
60
|
+
@Entity({
|
|
61
|
+
name: "MonitorTest",
|
|
62
|
+
})
|
|
63
|
+
@TableMetadata({
|
|
64
|
+
tableName: "MonitorTest",
|
|
65
|
+
singularName: "Monitor Test",
|
|
66
|
+
pluralName: "Monitor Tests",
|
|
67
|
+
icon: IconProp.AltGlobe,
|
|
68
|
+
tableDescription:
|
|
69
|
+
"Monitor Test allows you to test monitor configurations before you save them.",
|
|
70
|
+
})
|
|
71
|
+
export default class MonitorTest extends BaseModel {
|
|
72
|
+
@ColumnAccessControl({
|
|
73
|
+
create: [
|
|
74
|
+
Permission.ProjectOwner,
|
|
75
|
+
Permission.ProjectAdmin,
|
|
76
|
+
Permission.ProjectMember,
|
|
77
|
+
Permission.CreateProjectMonitor,
|
|
78
|
+
],
|
|
79
|
+
read: [
|
|
80
|
+
Permission.ProjectOwner,
|
|
81
|
+
Permission.ProjectAdmin,
|
|
82
|
+
Permission.ProjectMember,
|
|
83
|
+
Permission.ReadProjectMonitor,
|
|
84
|
+
],
|
|
85
|
+
update: [],
|
|
86
|
+
})
|
|
87
|
+
@TableColumn({
|
|
88
|
+
manyToOneRelationColumn: "projectId",
|
|
89
|
+
type: TableColumnType.Entity,
|
|
90
|
+
modelType: Project,
|
|
91
|
+
title: "Project",
|
|
92
|
+
description: "Relation to Project Resource in which this object belongs",
|
|
93
|
+
})
|
|
94
|
+
@ManyToOne(
|
|
95
|
+
() => {
|
|
96
|
+
return Project;
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
eager: false,
|
|
100
|
+
nullable: true,
|
|
101
|
+
onDelete: "CASCADE",
|
|
102
|
+
orphanedRowAction: "nullify",
|
|
103
|
+
},
|
|
104
|
+
)
|
|
105
|
+
@JoinColumn({ name: "projectId" })
|
|
106
|
+
public project?: Project = undefined;
|
|
107
|
+
|
|
108
|
+
@ColumnAccessControl({
|
|
109
|
+
create: [
|
|
110
|
+
Permission.ProjectOwner,
|
|
111
|
+
Permission.ProjectAdmin,
|
|
112
|
+
Permission.ProjectMember,
|
|
113
|
+
Permission.CreateProjectMonitor,
|
|
114
|
+
],
|
|
115
|
+
read: [
|
|
116
|
+
Permission.ProjectOwner,
|
|
117
|
+
Permission.ProjectAdmin,
|
|
118
|
+
Permission.ProjectMember,
|
|
119
|
+
Permission.ReadProjectMonitor,
|
|
120
|
+
],
|
|
121
|
+
update: [],
|
|
122
|
+
})
|
|
123
|
+
@Index()
|
|
124
|
+
@TableColumn({
|
|
125
|
+
type: TableColumnType.ObjectID,
|
|
126
|
+
required: true,
|
|
127
|
+
canReadOnRelationQuery: true,
|
|
128
|
+
title: "Project ID",
|
|
129
|
+
description: "ID of your OneUptime Project in which this object belongs",
|
|
130
|
+
})
|
|
131
|
+
@Column({
|
|
132
|
+
type: ColumnType.ObjectID,
|
|
133
|
+
nullable: false,
|
|
134
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
135
|
+
})
|
|
136
|
+
public projectId?: ObjectID = undefined;
|
|
137
|
+
|
|
138
|
+
@ColumnAccessControl({
|
|
139
|
+
create: [
|
|
140
|
+
Permission.ProjectOwner,
|
|
141
|
+
Permission.ProjectAdmin,
|
|
142
|
+
Permission.ProjectMember,
|
|
143
|
+
Permission.CreateProjectMonitor,
|
|
144
|
+
],
|
|
145
|
+
read: [
|
|
146
|
+
Permission.ProjectOwner,
|
|
147
|
+
Permission.ProjectAdmin,
|
|
148
|
+
Permission.ProjectMember,
|
|
149
|
+
Permission.ReadProjectMonitor,
|
|
150
|
+
],
|
|
151
|
+
update: [],
|
|
152
|
+
})
|
|
153
|
+
@TableColumn({
|
|
154
|
+
manyToOneRelationColumn: "createdByUserId",
|
|
155
|
+
type: TableColumnType.Entity,
|
|
156
|
+
modelType: User,
|
|
157
|
+
title: "Created by User",
|
|
158
|
+
description:
|
|
159
|
+
"Relation to User who created this object (if this object was created by a User)",
|
|
160
|
+
})
|
|
161
|
+
@ManyToOne(
|
|
162
|
+
() => {
|
|
163
|
+
return User;
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
eager: false,
|
|
167
|
+
nullable: true,
|
|
168
|
+
onDelete: "SET NULL",
|
|
169
|
+
orphanedRowAction: "nullify",
|
|
170
|
+
},
|
|
171
|
+
)
|
|
172
|
+
@JoinColumn({ name: "createdByUserId" })
|
|
173
|
+
public createdByUser?: User = undefined;
|
|
174
|
+
|
|
175
|
+
@ColumnAccessControl({
|
|
176
|
+
create: [
|
|
177
|
+
Permission.ProjectOwner,
|
|
178
|
+
Permission.ProjectAdmin,
|
|
179
|
+
Permission.ProjectMember,
|
|
180
|
+
Permission.CreateProjectMonitor,
|
|
181
|
+
],
|
|
182
|
+
read: [
|
|
183
|
+
Permission.ProjectOwner,
|
|
184
|
+
Permission.ProjectAdmin,
|
|
185
|
+
Permission.ProjectMember,
|
|
186
|
+
Permission.ReadProjectMonitor,
|
|
187
|
+
],
|
|
188
|
+
update: [],
|
|
189
|
+
})
|
|
190
|
+
@TableColumn({
|
|
191
|
+
type: TableColumnType.ObjectID,
|
|
192
|
+
title: "Created by User ID",
|
|
193
|
+
description:
|
|
194
|
+
"User ID who created this object (if this object was created by a User)",
|
|
195
|
+
})
|
|
196
|
+
@Column({
|
|
197
|
+
type: ColumnType.ObjectID,
|
|
198
|
+
nullable: true,
|
|
199
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
200
|
+
})
|
|
201
|
+
public createdByUserId?: ObjectID = undefined;
|
|
202
|
+
|
|
203
|
+
@ColumnAccessControl({
|
|
204
|
+
create: [],
|
|
205
|
+
read: [],
|
|
206
|
+
update: [],
|
|
207
|
+
})
|
|
208
|
+
@TableColumn({
|
|
209
|
+
manyToOneRelationColumn: "deletedByUserId",
|
|
210
|
+
type: TableColumnType.Entity,
|
|
211
|
+
title: "Deleted by User",
|
|
212
|
+
description:
|
|
213
|
+
"Relation to User who deleted this object (if this object was deleted by a User)",
|
|
214
|
+
})
|
|
215
|
+
@ManyToOne(
|
|
216
|
+
() => {
|
|
217
|
+
return User;
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
cascade: false,
|
|
221
|
+
eager: false,
|
|
222
|
+
nullable: true,
|
|
223
|
+
onDelete: "SET NULL",
|
|
224
|
+
orphanedRowAction: "nullify",
|
|
225
|
+
},
|
|
226
|
+
)
|
|
227
|
+
@JoinColumn({ name: "deletedByUserId" })
|
|
228
|
+
public deletedByUser?: User = undefined;
|
|
229
|
+
|
|
230
|
+
@ColumnAccessControl({
|
|
231
|
+
create: [],
|
|
232
|
+
read: [],
|
|
233
|
+
update: [],
|
|
234
|
+
})
|
|
235
|
+
@TableColumn({
|
|
236
|
+
type: TableColumnType.ObjectID,
|
|
237
|
+
title: "Deleted by User ID",
|
|
238
|
+
description:
|
|
239
|
+
"User ID who deleted this object (if this object was deleted by a User)",
|
|
240
|
+
})
|
|
241
|
+
@Column({
|
|
242
|
+
type: ColumnType.ObjectID,
|
|
243
|
+
nullable: true,
|
|
244
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
245
|
+
})
|
|
246
|
+
public deletedByUserId?: ObjectID = undefined;
|
|
247
|
+
|
|
248
|
+
@ColumnAccessControl({
|
|
249
|
+
create: [
|
|
250
|
+
Permission.ProjectOwner,
|
|
251
|
+
Permission.ProjectAdmin,
|
|
252
|
+
Permission.ProjectMember,
|
|
253
|
+
Permission.CreateProjectMonitor,
|
|
254
|
+
],
|
|
255
|
+
read: [
|
|
256
|
+
Permission.ProjectOwner,
|
|
257
|
+
Permission.ProjectAdmin,
|
|
258
|
+
Permission.ProjectMember,
|
|
259
|
+
Permission.ReadProjectMonitor,
|
|
260
|
+
],
|
|
261
|
+
update: [],
|
|
262
|
+
})
|
|
263
|
+
@TableColumn({
|
|
264
|
+
required: true,
|
|
265
|
+
type: TableColumnType.MonitorType,
|
|
266
|
+
title: "Monitor Type",
|
|
267
|
+
description: "What is the type of this monitor? Website? API? etc.",
|
|
268
|
+
})
|
|
269
|
+
@Column({
|
|
270
|
+
nullable: false,
|
|
271
|
+
type: ColumnType.ShortText,
|
|
272
|
+
length: ColumnLength.ShortText,
|
|
273
|
+
})
|
|
274
|
+
public monitorType?: MonitorType = undefined;
|
|
275
|
+
|
|
276
|
+
@ColumnAccessControl({
|
|
277
|
+
create: [
|
|
278
|
+
Permission.ProjectOwner,
|
|
279
|
+
Permission.ProjectAdmin,
|
|
280
|
+
Permission.ProjectMember,
|
|
281
|
+
Permission.CreateProjectMonitor,
|
|
282
|
+
],
|
|
283
|
+
read: [
|
|
284
|
+
Permission.ProjectOwner,
|
|
285
|
+
Permission.ProjectAdmin,
|
|
286
|
+
Permission.ProjectMember,
|
|
287
|
+
Permission.ReadProjectMonitor,
|
|
288
|
+
],
|
|
289
|
+
update: [
|
|
290
|
+
Permission.ProjectOwner,
|
|
291
|
+
Permission.ProjectAdmin,
|
|
292
|
+
Permission.ProjectMember,
|
|
293
|
+
Permission.EditProjectMonitor,
|
|
294
|
+
],
|
|
295
|
+
})
|
|
296
|
+
@TableColumn({
|
|
297
|
+
type: TableColumnType.JSON,
|
|
298
|
+
required: false,
|
|
299
|
+
title: "Monitor Steps",
|
|
300
|
+
description: "What would you like to monitor and what is the criteria?",
|
|
301
|
+
})
|
|
302
|
+
@Column({
|
|
303
|
+
type: ColumnType.JSON,
|
|
304
|
+
nullable: true,
|
|
305
|
+
transformer: MonitorSteps.getDatabaseTransformer(),
|
|
306
|
+
})
|
|
307
|
+
public monitorSteps?: MonitorSteps = undefined;
|
|
308
|
+
|
|
309
|
+
@ColumnAccessControl({
|
|
310
|
+
create: [
|
|
311
|
+
Permission.ProjectOwner,
|
|
312
|
+
Permission.ProjectAdmin,
|
|
313
|
+
Permission.ProjectMember,
|
|
314
|
+
Permission.CreateProjectMonitor,
|
|
315
|
+
],
|
|
316
|
+
read: [
|
|
317
|
+
Permission.ProjectOwner,
|
|
318
|
+
Permission.ProjectAdmin,
|
|
319
|
+
Permission.ProjectMember,
|
|
320
|
+
Permission.ReadProjectMonitor,
|
|
321
|
+
],
|
|
322
|
+
update: [
|
|
323
|
+
Permission.ProjectOwner,
|
|
324
|
+
Permission.ProjectAdmin,
|
|
325
|
+
Permission.ProjectMember,
|
|
326
|
+
Permission.EditProjectMonitor,
|
|
327
|
+
],
|
|
328
|
+
})
|
|
329
|
+
@TableColumn({
|
|
330
|
+
manyToOneRelationColumn: "probeId",
|
|
331
|
+
type: TableColumnType.Entity,
|
|
332
|
+
modelType: Probe,
|
|
333
|
+
title: "Probe",
|
|
334
|
+
description: "Relation to Probe Resource in which this object belongs",
|
|
335
|
+
})
|
|
336
|
+
@ManyToOne(
|
|
337
|
+
() => {
|
|
338
|
+
return Probe;
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
eager: false,
|
|
342
|
+
nullable: true,
|
|
343
|
+
onDelete: "CASCADE",
|
|
344
|
+
orphanedRowAction: "nullify",
|
|
345
|
+
},
|
|
346
|
+
)
|
|
347
|
+
@JoinColumn({ name: "probeId" })
|
|
348
|
+
public probe?: Probe = undefined;
|
|
349
|
+
|
|
350
|
+
@ColumnAccessControl({
|
|
351
|
+
create: [
|
|
352
|
+
Permission.ProjectOwner,
|
|
353
|
+
Permission.ProjectAdmin,
|
|
354
|
+
Permission.ProjectMember,
|
|
355
|
+
Permission.CreateProjectMonitor,
|
|
356
|
+
],
|
|
357
|
+
read: [
|
|
358
|
+
Permission.ProjectOwner,
|
|
359
|
+
Permission.ProjectAdmin,
|
|
360
|
+
Permission.ProjectMember,
|
|
361
|
+
Permission.ReadProjectMonitor,
|
|
362
|
+
],
|
|
363
|
+
update: [
|
|
364
|
+
Permission.ProjectOwner,
|
|
365
|
+
Permission.ProjectAdmin,
|
|
366
|
+
Permission.ProjectMember,
|
|
367
|
+
Permission.EditProjectMonitor,
|
|
368
|
+
],
|
|
369
|
+
})
|
|
370
|
+
@Index()
|
|
371
|
+
@TableColumn({
|
|
372
|
+
type: TableColumnType.ObjectID,
|
|
373
|
+
required: true,
|
|
374
|
+
canReadOnRelationQuery: true,
|
|
375
|
+
title: "Probe ID",
|
|
376
|
+
description: "ID of your OneUptime Probe in which this object belongs",
|
|
377
|
+
})
|
|
378
|
+
@Column({
|
|
379
|
+
type: ColumnType.ObjectID,
|
|
380
|
+
nullable: false,
|
|
381
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
382
|
+
})
|
|
383
|
+
public probeId?: ObjectID = undefined;
|
|
384
|
+
|
|
385
|
+
@ColumnAccessControl({
|
|
386
|
+
create: [
|
|
387
|
+
Permission.ProjectOwner,
|
|
388
|
+
Permission.ProjectAdmin,
|
|
389
|
+
Permission.ProjectMember,
|
|
390
|
+
Permission.CreateProjectMonitor,
|
|
391
|
+
],
|
|
392
|
+
read: [
|
|
393
|
+
Permission.ProjectOwner,
|
|
394
|
+
Permission.ProjectAdmin,
|
|
395
|
+
Permission.ProjectMember,
|
|
396
|
+
Permission.ReadProjectMonitor,
|
|
397
|
+
],
|
|
398
|
+
update: [
|
|
399
|
+
Permission.ProjectOwner,
|
|
400
|
+
Permission.ProjectAdmin,
|
|
401
|
+
Permission.ProjectMember,
|
|
402
|
+
Permission.EditProjectMonitor,
|
|
403
|
+
],
|
|
404
|
+
})
|
|
405
|
+
@TableColumn({ type: TableColumnType.Date })
|
|
406
|
+
@Column({
|
|
407
|
+
type: ColumnType.Date,
|
|
408
|
+
nullable: true,
|
|
409
|
+
unique: false,
|
|
410
|
+
})
|
|
411
|
+
public testedAt?: Date = undefined;
|
|
412
|
+
|
|
413
|
+
@ColumnAccessControl({
|
|
414
|
+
create: [
|
|
415
|
+
Permission.ProjectOwner,
|
|
416
|
+
Permission.ProjectAdmin,
|
|
417
|
+
Permission.ProjectMember,
|
|
418
|
+
Permission.CreateProjectMonitor,
|
|
419
|
+
],
|
|
420
|
+
read: [
|
|
421
|
+
Permission.ProjectOwner,
|
|
422
|
+
Permission.ProjectAdmin,
|
|
423
|
+
Permission.ProjectMember,
|
|
424
|
+
Permission.ReadProjectMonitor,
|
|
425
|
+
],
|
|
426
|
+
update: [
|
|
427
|
+
Permission.ProjectOwner,
|
|
428
|
+
Permission.ProjectAdmin,
|
|
429
|
+
Permission.ProjectMember,
|
|
430
|
+
Permission.EditProjectMonitor,
|
|
431
|
+
],
|
|
432
|
+
})
|
|
433
|
+
@TableColumn({
|
|
434
|
+
isDefaultValueColumn: false,
|
|
435
|
+
required: false,
|
|
436
|
+
type: TableColumnType.JSON,
|
|
437
|
+
})
|
|
438
|
+
@Column({
|
|
439
|
+
type: ColumnType.JSON,
|
|
440
|
+
nullable: true,
|
|
441
|
+
unique: false,
|
|
442
|
+
})
|
|
443
|
+
public monitorStepProbeResponse?: MonitorStepProbeResponse = undefined;
|
|
444
|
+
|
|
445
|
+
@ColumnAccessControl({
|
|
446
|
+
create: [
|
|
447
|
+
Permission.ProjectOwner,
|
|
448
|
+
Permission.ProjectAdmin,
|
|
449
|
+
Permission.ProjectMember,
|
|
450
|
+
Permission.CreateProjectMonitor,
|
|
451
|
+
],
|
|
452
|
+
read: [
|
|
453
|
+
Permission.ProjectOwner,
|
|
454
|
+
Permission.ProjectAdmin,
|
|
455
|
+
Permission.ProjectMember,
|
|
456
|
+
Permission.ReadProjectMonitor,
|
|
457
|
+
],
|
|
458
|
+
update: [
|
|
459
|
+
Permission.ProjectOwner,
|
|
460
|
+
Permission.ProjectAdmin,
|
|
461
|
+
Permission.ProjectMember,
|
|
462
|
+
Permission.EditProjectMonitor,
|
|
463
|
+
],
|
|
464
|
+
})
|
|
465
|
+
@TableColumn({
|
|
466
|
+
isDefaultValueColumn: false,
|
|
467
|
+
required: true,
|
|
468
|
+
type: TableColumnType.Boolean,
|
|
469
|
+
})
|
|
470
|
+
@Column({
|
|
471
|
+
type: ColumnType.Boolean,
|
|
472
|
+
nullable: true,
|
|
473
|
+
unique: false,
|
|
474
|
+
default: true,
|
|
475
|
+
})
|
|
476
|
+
public isInQueue?: boolean = undefined;
|
|
477
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1730209089495 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1730209089495";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`CREATE TABLE "MonitorTest" ("_id" uuid NOT NULL DEFAULT uuid_generate_v4(), "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), "deletedAt" TIMESTAMP WITH TIME ZONE, "version" integer NOT NULL, "projectId" uuid NOT NULL, "createdByUserId" uuid, "deletedByUserId" uuid, "monitorType" character varying(100) NOT NULL, "monitorSteps" jsonb, "probeId" uuid NOT NULL, "testedAt" TIMESTAMP WITH TIME ZONE, "lastMonitoringLog" jsonb, CONSTRAINT "PK_7ce3477c7bb3d7b8961c8465935" PRIMARY KEY ("_id"))`,
|
|
9
|
+
);
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`CREATE INDEX "IDX_6de87954a2a0587defe52aeb86" ON "MonitorTest" ("projectId") `,
|
|
12
|
+
);
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`CREATE INDEX "IDX_fd6b1e330eb08de988307b6052" ON "MonitorTest" ("probeId") `,
|
|
15
|
+
);
|
|
16
|
+
await queryRunner.query(
|
|
17
|
+
`ALTER TABLE "MonitorTest" ADD CONSTRAINT "FK_6de87954a2a0587defe52aeb86c" FOREIGN KEY ("projectId") REFERENCES "Project"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
18
|
+
);
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`ALTER TABLE "MonitorTest" ADD CONSTRAINT "FK_f94c5a7356b7b55785e3a3dac5b" FOREIGN KEY ("createdByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
21
|
+
);
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`ALTER TABLE "MonitorTest" ADD CONSTRAINT "FK_b92a71b1f5f6c072455cd242ed6" FOREIGN KEY ("deletedByUserId") REFERENCES "User"("_id") ON DELETE SET NULL ON UPDATE NO ACTION`,
|
|
24
|
+
);
|
|
25
|
+
await queryRunner.query(
|
|
26
|
+
`ALTER TABLE "MonitorTest" ADD CONSTRAINT "FK_fd6b1e330eb08de988307b60524" FOREIGN KEY ("probeId") REFERENCES "Probe"("_id") ON DELETE CASCADE ON UPDATE NO ACTION`,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
31
|
+
await queryRunner.query(
|
|
32
|
+
`ALTER TABLE "MonitorTest" DROP CONSTRAINT "FK_fd6b1e330eb08de988307b60524"`,
|
|
33
|
+
);
|
|
34
|
+
await queryRunner.query(
|
|
35
|
+
`ALTER TABLE "MonitorTest" DROP CONSTRAINT "FK_b92a71b1f5f6c072455cd242ed6"`,
|
|
36
|
+
);
|
|
37
|
+
await queryRunner.query(
|
|
38
|
+
`ALTER TABLE "MonitorTest" DROP CONSTRAINT "FK_f94c5a7356b7b55785e3a3dac5b"`,
|
|
39
|
+
);
|
|
40
|
+
await queryRunner.query(
|
|
41
|
+
`ALTER TABLE "MonitorTest" DROP CONSTRAINT "FK_6de87954a2a0587defe52aeb86c"`,
|
|
42
|
+
);
|
|
43
|
+
await queryRunner.query(
|
|
44
|
+
`DROP INDEX "public"."IDX_fd6b1e330eb08de988307b6052"`,
|
|
45
|
+
);
|
|
46
|
+
await queryRunner.query(
|
|
47
|
+
`DROP INDEX "public"."IDX_6de87954a2a0587defe52aeb86"`,
|
|
48
|
+
);
|
|
49
|
+
await queryRunner.query(`DROP TABLE "MonitorTest"`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MigrationInterface, QueryRunner } from "typeorm";
|
|
2
|
+
|
|
3
|
+
export class MigrationName1730223198692 implements MigrationInterface {
|
|
4
|
+
public name = "MigrationName1730223198692";
|
|
5
|
+
|
|
6
|
+
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
7
|
+
await queryRunner.query(
|
|
8
|
+
`ALTER TABLE "MonitorTest" DROP COLUMN "lastMonitoringLog"`,
|
|
9
|
+
);
|
|
10
|
+
await queryRunner.query(
|
|
11
|
+
`ALTER TABLE "MonitorTest" ADD "monitorStepProbeResponse" jsonb`,
|
|
12
|
+
);
|
|
13
|
+
await queryRunner.query(
|
|
14
|
+
`ALTER TABLE "MonitorTest" ADD "isInQueue" boolean DEFAULT true`,
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
19
|
+
await queryRunner.query(
|
|
20
|
+
`ALTER TABLE "MonitorTest" DROP COLUMN "isInQueue"`,
|
|
21
|
+
);
|
|
22
|
+
await queryRunner.query(
|
|
23
|
+
`ALTER TABLE "MonitorTest" DROP COLUMN "monitorStepProbeResponse"`,
|
|
24
|
+
);
|
|
25
|
+
await queryRunner.query(
|
|
26
|
+
`ALTER TABLE "MonitorTest" ADD "lastMonitoringLog" jsonb`,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -76,6 +76,8 @@ import { MigrationName1727906598804 } from "./1727906598804-MigrationName";
|
|
|
76
76
|
import { MigrationName1728472625805 } from "./1728472625805-MigrationName";
|
|
77
77
|
import { MigrationName1729682875503 } from "./1729682875503-MigrationName";
|
|
78
78
|
import { MigrationName1730117995642 } from "./1730117995642-MigrationName";
|
|
79
|
+
import { MigrationName1730209089495 } from "./1730209089495-MigrationName";
|
|
80
|
+
import { MigrationName1730223198692 } from "./1730223198692-MigrationName";
|
|
79
81
|
|
|
80
82
|
export default [
|
|
81
83
|
InitialMigration,
|
|
@@ -156,4 +158,6 @@ export default [
|
|
|
156
158
|
MigrationName1728472625805,
|
|
157
159
|
MigrationName1729682875503,
|
|
158
160
|
MigrationName1730117995642,
|
|
161
|
+
MigrationName1730209089495,
|
|
162
|
+
MigrationName1730223198692,
|
|
159
163
|
];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import DatabaseService from "./DatabaseService";
|
|
2
|
+
import MonitorTest from "Common/Models/DatabaseModels/MonitorTest";
|
|
3
|
+
|
|
4
|
+
export class Service extends DatabaseService<MonitorTest> {
|
|
5
|
+
public constructor() {
|
|
6
|
+
super(MonitorTest);
|
|
7
|
+
this.hardDeleteItemsOlderThanInDays("createdAt", 2); // this is temporary data. Clear it after 2 days.
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export default new Service();
|
|
@@ -674,6 +674,36 @@ export default class MonitorResourceUtil {
|
|
|
674
674
|
itemsToSave.push(monitorMetricsByMinute);
|
|
675
675
|
}
|
|
676
676
|
|
|
677
|
+
if (
|
|
678
|
+
(data.dataToProcess as ProbeMonitorResponse) &&
|
|
679
|
+
(data.dataToProcess as ProbeMonitorResponse).syntheticMonitorResponse &&
|
|
680
|
+
(
|
|
681
|
+
(data.dataToProcess as ProbeMonitorResponse).syntheticMonitorResponse ||
|
|
682
|
+
[]
|
|
683
|
+
).length > 0
|
|
684
|
+
) {
|
|
685
|
+
for (const syntheticMonitorResponse of (
|
|
686
|
+
data.dataToProcess as ProbeMonitorResponse
|
|
687
|
+
).syntheticMonitorResponse || []) {
|
|
688
|
+
const monitorMetricsByMinute: MonitorMetricsByMinute =
|
|
689
|
+
new MonitorMetricsByMinute();
|
|
690
|
+
monitorMetricsByMinute.monitorId = data.monitorId;
|
|
691
|
+
monitorMetricsByMinute.projectId = data.projectId;
|
|
692
|
+
monitorMetricsByMinute.metricType = CheckOn.ExecutionTime;
|
|
693
|
+
monitorMetricsByMinute.metricValue =
|
|
694
|
+
syntheticMonitorResponse.executionTimeInMS;
|
|
695
|
+
monitorMetricsByMinute.miscData = {
|
|
696
|
+
probeId: (
|
|
697
|
+
data.dataToProcess as ProbeMonitorResponse
|
|
698
|
+
).probeId.toString(),
|
|
699
|
+
browserType: syntheticMonitorResponse.browserType,
|
|
700
|
+
screenSizeType: syntheticMonitorResponse.screenSizeType,
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
itemsToSave.push(monitorMetricsByMinute);
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
|
|
677
707
|
if ((data.dataToProcess as ProbeMonitorResponse).responseTimeInMs) {
|
|
678
708
|
const monitorMetricsByMinute: MonitorMetricsByMinute =
|
|
679
709
|
new MonitorMetricsByMinute();
|
|
@@ -166,7 +166,10 @@ export class CriteriaFilterUtil {
|
|
|
166
166
|
CheckOn.CPUUsagePercent,
|
|
167
167
|
CheckOn.MemoryUsagePercent,
|
|
168
168
|
];
|
|
169
|
-
} else if (
|
|
169
|
+
} else if (
|
|
170
|
+
monitorType === MonitorType.CustomJavaScriptCode ||
|
|
171
|
+
monitorType === MonitorType.SyntheticMonitor
|
|
172
|
+
) {
|
|
170
173
|
return [CheckOn.ExecutionTime];
|
|
171
174
|
}
|
|
172
175
|
return [];
|
|
@@ -13,18 +13,20 @@ export interface ComponentProps {
|
|
|
13
13
|
size?: undefined | number;
|
|
14
14
|
color?: undefined | Color;
|
|
15
15
|
loaderType?: undefined | LoaderType;
|
|
16
|
+
className?: string;
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
const Loader: FunctionComponent<ComponentProps> = ({
|
|
19
20
|
size = 50,
|
|
20
21
|
color = VeryLightGray,
|
|
21
22
|
loaderType = LoaderType.Bar,
|
|
23
|
+
className = "",
|
|
22
24
|
}: ComponentProps) => {
|
|
23
25
|
if (loaderType === LoaderType.Bar) {
|
|
24
26
|
return (
|
|
25
27
|
<div
|
|
26
|
-
role=
|
|
27
|
-
className="justify-center"
|
|
28
|
+
role={`bar-loader mt-1 ${className}`}
|
|
29
|
+
className="flex justify-center"
|
|
28
30
|
data-testid="loader"
|
|
29
31
|
>
|
|
30
32
|
<BarLoader height={4} width={size} color={color.toString()} />
|
|
@@ -59,7 +59,7 @@ const Modal: FunctionComponent<ComponentProps> = (
|
|
|
59
59
|
<div className="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"></div>
|
|
60
60
|
|
|
61
61
|
<div className="fixed inset-0 z-20 overflow-y-auto">
|
|
62
|
-
<div className="flex min-h-
|
|
62
|
+
<div className="flex min-h-screen items-end justify-center p-4 text-center sm:items-center sm:p-0">
|
|
63
63
|
<div
|
|
64
64
|
className={`relative transform rounded-lg bg-white text-left shadow-xl transition-all sm:my-8 sm:w-full ${
|
|
65
65
|
props.modalWidth && props.modalWidth === ModalWidth.Large
|