@oneuptime/common 10.0.94 → 10.0.97
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/AnalyticsModels/Log.ts +6 -0
- package/Models/AnalyticsModels/Metric.ts +6 -0
- package/Models/AnalyticsModels/Profile.ts +6 -0
- package/Models/AnalyticsModels/Span.ts +6 -0
- package/Models/DatabaseModels/Alert.ts +52 -0
- package/Models/DatabaseModels/DockerHost.ts +3 -10
- package/Models/DatabaseModels/Host.ts +1015 -0
- package/Models/DatabaseModels/HostOwnerTeam.ts +462 -0
- package/Models/DatabaseModels/HostOwnerUser.ts +461 -0
- package/Models/DatabaseModels/Incident.ts +52 -0
- package/Models/DatabaseModels/Index.ts +6 -0
- package/Models/DatabaseModels/KubernetesCluster.ts +0 -7
- package/Server/Infrastructure/Postgres/SchemaMigrations/1778006035712-AddHostTables.ts +201 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1778013317872-AddHostIpAddresses.ts +15 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1778066346303-WidenHostOsVersionToLongText.ts +42 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/1778070278986-MigrationName.ts +79 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +8 -0
- package/Server/Services/HostOwnerTeamService.ts +10 -0
- package/Server/Services/HostOwnerUserService.ts +10 -0
- package/Server/Services/HostService.ts +227 -0
- package/Server/Services/LogAggregationService.ts +10 -3
- package/Server/Services/MetricService.ts +200 -0
- package/Server/Services/MonitorTemplateService.ts +11 -3
- package/Server/Services/TraceAggregationService.ts +8 -3
- package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +46 -18
- package/Server/Utils/Monitor/MonitorAlert.ts +31 -0
- package/Server/Utils/Monitor/MonitorIncident.ts +31 -0
- package/Server/Utils/VM/VMRunner.ts +62 -0
- package/Tests/Server/Services/LogAggregationService.test.ts +25 -0
- package/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.ts +145 -0
- package/Types/Metrics/MetricQueryConfigData.ts +9 -0
- package/Types/Permission.ts +134 -0
- package/UI/Components/Charts/Area/AreaChart.tsx +1 -1
- package/UI/Components/Charts/Bar/BarChart.tsx +1 -1
- package/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.tsx +15 -8
- package/UI/Components/Charts/ChartLibrary/BarChart/BarChart.tsx +12 -9
- package/UI/Components/Charts/ChartLibrary/LineChart/LineChart.tsx +17 -10
- package/UI/Components/Charts/Line/LineChart.tsx +1 -1
- package/UI/Components/ExpandableText/ExpandableText.tsx +29 -7
- package/UI/Components/JSONTable/JSONTable.tsx +27 -1
- package/UI/Components/LogsViewer/LogsViewer.tsx +3 -0
- package/UI/Components/LogsViewer/components/LogDetailsPanel.tsx +109 -23
- package/UI/Components/LogsViewer/components/LogSearchBar.tsx +11 -4
- package/UI/Components/Navbar/NavBarMenu.tsx +17 -2
- package/UI/Components/TelemetryViewer/components/TelemetrySearchBar.tsx +10 -3
- package/Utils/ValueFormatter.ts +57 -3
- package/build/dist/Models/AnalyticsModels/Log.js +6 -0
- package/build/dist/Models/AnalyticsModels/Log.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/Metric.js +6 -0
- package/build/dist/Models/AnalyticsModels/Metric.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/Profile.js +6 -0
- package/build/dist/Models/AnalyticsModels/Profile.js.map +1 -1
- package/build/dist/Models/AnalyticsModels/Span.js +6 -0
- package/build/dist/Models/AnalyticsModels/Span.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Alert.js +51 -0
- package/build/dist/Models/DatabaseModels/Alert.js.map +1 -1
- package/build/dist/Models/DatabaseModels/DockerHost.js +3 -10
- package/build/dist/Models/DatabaseModels/DockerHost.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Host.js +1041 -0
- package/build/dist/Models/DatabaseModels/Host.js.map +1 -0
- package/build/dist/Models/DatabaseModels/HostOwnerTeam.js +480 -0
- package/build/dist/Models/DatabaseModels/HostOwnerTeam.js.map +1 -0
- package/build/dist/Models/DatabaseModels/HostOwnerUser.js +479 -0
- package/build/dist/Models/DatabaseModels/HostOwnerUser.js.map +1 -0
- package/build/dist/Models/DatabaseModels/Incident.js +51 -0
- package/build/dist/Models/DatabaseModels/Incident.js.map +1 -1
- package/build/dist/Models/DatabaseModels/Index.js +6 -0
- package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
- package/build/dist/Models/DatabaseModels/KubernetesCluster.js +0 -7
- package/build/dist/Models/DatabaseModels/KubernetesCluster.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778006035712-AddHostTables.js +76 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778006035712-AddHostTables.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778013317872-AddHostIpAddresses.js +12 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778013317872-AddHostIpAddresses.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778066346303-WidenHostOsVersionToLongText.js +31 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778066346303-WidenHostOsVersionToLongText.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778070278986-MigrationName.js +34 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1778070278986-MigrationName.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +8 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Services/HostOwnerTeamService.js +9 -0
- package/build/dist/Server/Services/HostOwnerTeamService.js.map +1 -0
- package/build/dist/Server/Services/HostOwnerUserService.js +9 -0
- package/build/dist/Server/Services/HostOwnerUserService.js.map +1 -0
- package/build/dist/Server/Services/HostService.js +206 -0
- package/build/dist/Server/Services/HostService.js.map +1 -0
- package/build/dist/Server/Services/LogAggregationService.js +10 -3
- package/build/dist/Server/Services/LogAggregationService.js.map +1 -1
- package/build/dist/Server/Services/MetricService.js +160 -0
- package/build/dist/Server/Services/MetricService.js.map +1 -1
- package/build/dist/Server/Services/MonitorTemplateService.js +7 -0
- package/build/dist/Server/Services/MonitorTemplateService.js.map +1 -1
- package/build/dist/Server/Services/TraceAggregationService.js +8 -3
- package/build/dist/Server/Services/TraceAggregationService.js.map +1 -1
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +46 -18
- package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js +26 -0
- package/build/dist/Server/Utils/Monitor/MonitorAlert.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js +26 -0
- package/build/dist/Server/Utils/Monitor/MonitorIncident.js.map +1 -1
- package/build/dist/Server/Utils/VM/VMRunner.js +61 -0
- package/build/dist/Server/Utils/VM/VMRunner.js.map +1 -1
- package/build/dist/Tests/Server/Services/LogAggregationService.test.js +13 -0
- package/build/dist/Tests/Server/Services/LogAggregationService.test.js.map +1 -1
- package/build/dist/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.js +123 -0
- package/build/dist/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.js.map +1 -1
- package/build/dist/Types/Permission.js +120 -0
- package/build/dist/Types/Permission.js.map +1 -1
- package/build/dist/UI/Components/Charts/Area/AreaChart.js +1 -1
- package/build/dist/UI/Components/Charts/Bar/BarChart.js +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js +13 -7
- package/build/dist/UI/Components/Charts/ChartLibrary/AreaChart/AreaChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js +11 -9
- package/build/dist/UI/Components/Charts/ChartLibrary/BarChart/BarChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js +16 -10
- package/build/dist/UI/Components/Charts/ChartLibrary/LineChart/LineChart.js.map +1 -1
- package/build/dist/UI/Components/Charts/Line/LineChart.js +1 -1
- package/build/dist/UI/Components/ExpandableText/ExpandableText.js +10 -5
- package/build/dist/UI/Components/ExpandableText/ExpandableText.js.map +1 -1
- package/build/dist/UI/Components/JSONTable/JSONTable.js +8 -1
- package/build/dist/UI/Components/JSONTable/JSONTable.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js +1 -1
- package/build/dist/UI/Components/LogsViewer/LogsViewer.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogDetailsPanel.js +40 -14
- package/build/dist/UI/Components/LogsViewer/components/LogDetailsPanel.js.map +1 -1
- package/build/dist/UI/Components/LogsViewer/components/LogSearchBar.js +10 -4
- package/build/dist/UI/Components/LogsViewer/components/LogSearchBar.js.map +1 -1
- package/build/dist/UI/Components/Navbar/NavBarMenu.js +15 -2
- package/build/dist/UI/Components/Navbar/NavBarMenu.js.map +1 -1
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js +10 -3
- package/build/dist/UI/Components/TelemetryViewer/components/TelemetrySearchBar.js.map +1 -1
- package/build/dist/Utils/ValueFormatter.js +47 -3
- package/build/dist/Utils/ValueFormatter.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
import Host from "./Host";
|
|
2
|
+
import Project from "./Project";
|
|
3
|
+
import User from "./User";
|
|
4
|
+
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
|
|
5
|
+
import Route from "../../Types/API/Route";
|
|
6
|
+
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
|
|
7
|
+
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
|
|
8
|
+
import ColumnType from "../../Types/Database/ColumnType";
|
|
9
|
+
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
10
|
+
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
|
|
11
|
+
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
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 ObjectID from "../../Types/ObjectID";
|
|
18
|
+
import Permission from "../../Types/Permission";
|
|
19
|
+
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
|
|
20
|
+
|
|
21
|
+
@EnableDocumentation()
|
|
22
|
+
@TenantColumn("projectId")
|
|
23
|
+
@TableAccessControl({
|
|
24
|
+
create: [
|
|
25
|
+
Permission.ProjectOwner,
|
|
26
|
+
Permission.ProjectAdmin,
|
|
27
|
+
Permission.ProjectMember,
|
|
28
|
+
Permission.SettingsManager,
|
|
29
|
+
Permission.CreateHostOwnerUser,
|
|
30
|
+
],
|
|
31
|
+
read: [
|
|
32
|
+
Permission.ProjectOwner,
|
|
33
|
+
Permission.ProjectAdmin,
|
|
34
|
+
Permission.ProjectMember,
|
|
35
|
+
Permission.Viewer,
|
|
36
|
+
Permission.SettingsManager,
|
|
37
|
+
Permission.ReadHostOwnerUser,
|
|
38
|
+
Permission.ReadAllProjectResources,
|
|
39
|
+
],
|
|
40
|
+
delete: [
|
|
41
|
+
Permission.ProjectOwner,
|
|
42
|
+
Permission.ProjectAdmin,
|
|
43
|
+
Permission.ProjectMember,
|
|
44
|
+
Permission.SettingsManager,
|
|
45
|
+
Permission.DeleteHostOwnerUser,
|
|
46
|
+
],
|
|
47
|
+
update: [
|
|
48
|
+
Permission.ProjectOwner,
|
|
49
|
+
Permission.ProjectAdmin,
|
|
50
|
+
Permission.ProjectMember,
|
|
51
|
+
Permission.SettingsManager,
|
|
52
|
+
Permission.EditHostOwnerUser,
|
|
53
|
+
],
|
|
54
|
+
})
|
|
55
|
+
@EnableWorkflow({
|
|
56
|
+
create: true,
|
|
57
|
+
delete: true,
|
|
58
|
+
update: true,
|
|
59
|
+
read: true,
|
|
60
|
+
})
|
|
61
|
+
@CrudApiEndpoint(new Route("/host-owner-user"))
|
|
62
|
+
@TableMetadata({
|
|
63
|
+
tableName: "HostOwnerUser",
|
|
64
|
+
singularName: "Host User Owner",
|
|
65
|
+
pluralName: "Host User Owners",
|
|
66
|
+
icon: IconProp.Server,
|
|
67
|
+
tableDescription: "Add users as owners to your hosts.",
|
|
68
|
+
})
|
|
69
|
+
@Entity({
|
|
70
|
+
name: "HostOwnerUser",
|
|
71
|
+
})
|
|
72
|
+
export default class HostOwnerUser extends BaseModel {
|
|
73
|
+
@ColumnAccessControl({
|
|
74
|
+
create: [
|
|
75
|
+
Permission.ProjectOwner,
|
|
76
|
+
Permission.ProjectAdmin,
|
|
77
|
+
Permission.ProjectMember,
|
|
78
|
+
Permission.SettingsManager,
|
|
79
|
+
Permission.CreateHostOwnerUser,
|
|
80
|
+
],
|
|
81
|
+
read: [
|
|
82
|
+
Permission.ProjectOwner,
|
|
83
|
+
Permission.ProjectAdmin,
|
|
84
|
+
Permission.ProjectMember,
|
|
85
|
+
Permission.Viewer,
|
|
86
|
+
Permission.SettingsManager,
|
|
87
|
+
Permission.ReadHostOwnerUser,
|
|
88
|
+
Permission.ReadAllProjectResources,
|
|
89
|
+
],
|
|
90
|
+
update: [],
|
|
91
|
+
})
|
|
92
|
+
@TableColumn({
|
|
93
|
+
manyToOneRelationColumn: "projectId",
|
|
94
|
+
type: TableColumnType.Entity,
|
|
95
|
+
modelType: Project,
|
|
96
|
+
title: "Project",
|
|
97
|
+
description: "Relation to Project Resource in which this object belongs",
|
|
98
|
+
})
|
|
99
|
+
@ManyToOne(
|
|
100
|
+
() => {
|
|
101
|
+
return Project;
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
eager: false,
|
|
105
|
+
nullable: false,
|
|
106
|
+
onDelete: "CASCADE",
|
|
107
|
+
orphanedRowAction: "nullify",
|
|
108
|
+
},
|
|
109
|
+
)
|
|
110
|
+
@JoinColumn({ name: "projectId" })
|
|
111
|
+
public project?: Project = undefined;
|
|
112
|
+
|
|
113
|
+
@ColumnAccessControl({
|
|
114
|
+
create: [
|
|
115
|
+
Permission.ProjectOwner,
|
|
116
|
+
Permission.ProjectAdmin,
|
|
117
|
+
Permission.ProjectMember,
|
|
118
|
+
Permission.SettingsManager,
|
|
119
|
+
Permission.CreateHostOwnerUser,
|
|
120
|
+
],
|
|
121
|
+
read: [
|
|
122
|
+
Permission.ProjectOwner,
|
|
123
|
+
Permission.ProjectAdmin,
|
|
124
|
+
Permission.ProjectMember,
|
|
125
|
+
Permission.Viewer,
|
|
126
|
+
Permission.SettingsManager,
|
|
127
|
+
Permission.ReadHostOwnerUser,
|
|
128
|
+
Permission.ReadAllProjectResources,
|
|
129
|
+
],
|
|
130
|
+
update: [],
|
|
131
|
+
})
|
|
132
|
+
@Index()
|
|
133
|
+
@TableColumn({
|
|
134
|
+
type: TableColumnType.ObjectID,
|
|
135
|
+
required: true,
|
|
136
|
+
canReadOnRelationQuery: true,
|
|
137
|
+
title: "Project ID",
|
|
138
|
+
description: "ID of your OneUptime Project in which this object belongs",
|
|
139
|
+
})
|
|
140
|
+
@Column({
|
|
141
|
+
type: ColumnType.ObjectID,
|
|
142
|
+
nullable: false,
|
|
143
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
144
|
+
})
|
|
145
|
+
public projectId?: ObjectID = undefined;
|
|
146
|
+
|
|
147
|
+
@ColumnAccessControl({
|
|
148
|
+
create: [
|
|
149
|
+
Permission.ProjectOwner,
|
|
150
|
+
Permission.ProjectAdmin,
|
|
151
|
+
Permission.ProjectMember,
|
|
152
|
+
Permission.SettingsManager,
|
|
153
|
+
Permission.CreateHostOwnerUser,
|
|
154
|
+
],
|
|
155
|
+
read: [
|
|
156
|
+
Permission.ProjectOwner,
|
|
157
|
+
Permission.ProjectAdmin,
|
|
158
|
+
Permission.ProjectMember,
|
|
159
|
+
Permission.Viewer,
|
|
160
|
+
Permission.SettingsManager,
|
|
161
|
+
Permission.ReadHostOwnerUser,
|
|
162
|
+
Permission.ReadAllProjectResources,
|
|
163
|
+
],
|
|
164
|
+
update: [],
|
|
165
|
+
})
|
|
166
|
+
@TableColumn({
|
|
167
|
+
manyToOneRelationColumn: "userId",
|
|
168
|
+
type: TableColumnType.Entity,
|
|
169
|
+
modelType: User,
|
|
170
|
+
title: "User",
|
|
171
|
+
description:
|
|
172
|
+
"User that is the owner. This user will receive notifications. ",
|
|
173
|
+
})
|
|
174
|
+
@ManyToOne(
|
|
175
|
+
() => {
|
|
176
|
+
return User;
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
eager: false,
|
|
180
|
+
nullable: true,
|
|
181
|
+
onDelete: "CASCADE",
|
|
182
|
+
orphanedRowAction: "nullify",
|
|
183
|
+
},
|
|
184
|
+
)
|
|
185
|
+
@JoinColumn({ name: "userId" })
|
|
186
|
+
public user?: User = undefined;
|
|
187
|
+
|
|
188
|
+
@ColumnAccessControl({
|
|
189
|
+
create: [
|
|
190
|
+
Permission.ProjectOwner,
|
|
191
|
+
Permission.ProjectAdmin,
|
|
192
|
+
Permission.ProjectMember,
|
|
193
|
+
Permission.SettingsManager,
|
|
194
|
+
Permission.CreateHostOwnerUser,
|
|
195
|
+
],
|
|
196
|
+
read: [
|
|
197
|
+
Permission.ProjectOwner,
|
|
198
|
+
Permission.ProjectAdmin,
|
|
199
|
+
Permission.ProjectMember,
|
|
200
|
+
Permission.Viewer,
|
|
201
|
+
Permission.SettingsManager,
|
|
202
|
+
Permission.ReadHostOwnerUser,
|
|
203
|
+
Permission.ReadAllProjectResources,
|
|
204
|
+
],
|
|
205
|
+
update: [],
|
|
206
|
+
})
|
|
207
|
+
@Index()
|
|
208
|
+
@TableColumn({
|
|
209
|
+
type: TableColumnType.ObjectID,
|
|
210
|
+
required: true,
|
|
211
|
+
canReadOnRelationQuery: true,
|
|
212
|
+
title: "User ID",
|
|
213
|
+
description: "ID of your OneUptime User in which this object belongs",
|
|
214
|
+
})
|
|
215
|
+
@Column({
|
|
216
|
+
type: ColumnType.ObjectID,
|
|
217
|
+
nullable: false,
|
|
218
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
219
|
+
})
|
|
220
|
+
public userId?: ObjectID = undefined;
|
|
221
|
+
|
|
222
|
+
@ColumnAccessControl({
|
|
223
|
+
create: [
|
|
224
|
+
Permission.ProjectOwner,
|
|
225
|
+
Permission.ProjectAdmin,
|
|
226
|
+
Permission.ProjectMember,
|
|
227
|
+
Permission.SettingsManager,
|
|
228
|
+
Permission.CreateHostOwnerUser,
|
|
229
|
+
],
|
|
230
|
+
read: [
|
|
231
|
+
Permission.ProjectOwner,
|
|
232
|
+
Permission.ProjectAdmin,
|
|
233
|
+
Permission.ProjectMember,
|
|
234
|
+
Permission.Viewer,
|
|
235
|
+
Permission.SettingsManager,
|
|
236
|
+
Permission.ReadHostOwnerUser,
|
|
237
|
+
Permission.ReadAllProjectResources,
|
|
238
|
+
],
|
|
239
|
+
update: [],
|
|
240
|
+
})
|
|
241
|
+
@TableColumn({
|
|
242
|
+
manyToOneRelationColumn: "hostId",
|
|
243
|
+
type: TableColumnType.Entity,
|
|
244
|
+
modelType: Host,
|
|
245
|
+
title: "Host",
|
|
246
|
+
description: "Relation to Host Resource in which this object belongs",
|
|
247
|
+
})
|
|
248
|
+
@ManyToOne(
|
|
249
|
+
() => {
|
|
250
|
+
return Host;
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
eager: false,
|
|
254
|
+
nullable: true,
|
|
255
|
+
onDelete: "CASCADE",
|
|
256
|
+
orphanedRowAction: "nullify",
|
|
257
|
+
},
|
|
258
|
+
)
|
|
259
|
+
@JoinColumn({ name: "hostId" })
|
|
260
|
+
public host?: Host = undefined;
|
|
261
|
+
|
|
262
|
+
@ColumnAccessControl({
|
|
263
|
+
create: [
|
|
264
|
+
Permission.ProjectOwner,
|
|
265
|
+
Permission.ProjectAdmin,
|
|
266
|
+
Permission.ProjectMember,
|
|
267
|
+
Permission.SettingsManager,
|
|
268
|
+
Permission.CreateHostOwnerUser,
|
|
269
|
+
],
|
|
270
|
+
read: [
|
|
271
|
+
Permission.ProjectOwner,
|
|
272
|
+
Permission.ProjectAdmin,
|
|
273
|
+
Permission.ProjectMember,
|
|
274
|
+
Permission.Viewer,
|
|
275
|
+
Permission.SettingsManager,
|
|
276
|
+
Permission.ReadHostOwnerUser,
|
|
277
|
+
Permission.ReadAllProjectResources,
|
|
278
|
+
],
|
|
279
|
+
update: [],
|
|
280
|
+
})
|
|
281
|
+
@Index()
|
|
282
|
+
@TableColumn({
|
|
283
|
+
type: TableColumnType.ObjectID,
|
|
284
|
+
required: true,
|
|
285
|
+
canReadOnRelationQuery: true,
|
|
286
|
+
title: "Host ID",
|
|
287
|
+
description: "ID of your OneUptime Host in which this object belongs",
|
|
288
|
+
})
|
|
289
|
+
@Column({
|
|
290
|
+
type: ColumnType.ObjectID,
|
|
291
|
+
nullable: false,
|
|
292
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
293
|
+
})
|
|
294
|
+
public hostId?: ObjectID = undefined;
|
|
295
|
+
|
|
296
|
+
@ColumnAccessControl({
|
|
297
|
+
create: [
|
|
298
|
+
Permission.ProjectOwner,
|
|
299
|
+
Permission.ProjectAdmin,
|
|
300
|
+
Permission.ProjectMember,
|
|
301
|
+
Permission.SettingsManager,
|
|
302
|
+
Permission.CreateHostOwnerUser,
|
|
303
|
+
],
|
|
304
|
+
read: [
|
|
305
|
+
Permission.ProjectOwner,
|
|
306
|
+
Permission.ProjectAdmin,
|
|
307
|
+
Permission.ProjectMember,
|
|
308
|
+
Permission.Viewer,
|
|
309
|
+
Permission.SettingsManager,
|
|
310
|
+
Permission.ReadHostOwnerUser,
|
|
311
|
+
Permission.ReadAllProjectResources,
|
|
312
|
+
],
|
|
313
|
+
update: [],
|
|
314
|
+
})
|
|
315
|
+
@TableColumn({
|
|
316
|
+
manyToOneRelationColumn: "createdByUserId",
|
|
317
|
+
type: TableColumnType.Entity,
|
|
318
|
+
modelType: User,
|
|
319
|
+
title: "Created by User",
|
|
320
|
+
description:
|
|
321
|
+
"Relation to User who created this object (if this object was created by a User)",
|
|
322
|
+
})
|
|
323
|
+
@ManyToOne(
|
|
324
|
+
() => {
|
|
325
|
+
return User;
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
eager: false,
|
|
329
|
+
nullable: true,
|
|
330
|
+
onDelete: "SET NULL",
|
|
331
|
+
orphanedRowAction: "nullify",
|
|
332
|
+
},
|
|
333
|
+
)
|
|
334
|
+
@JoinColumn({ name: "createdByUserId" })
|
|
335
|
+
public createdByUser?: User = undefined;
|
|
336
|
+
|
|
337
|
+
@ColumnAccessControl({
|
|
338
|
+
create: [
|
|
339
|
+
Permission.ProjectOwner,
|
|
340
|
+
Permission.ProjectAdmin,
|
|
341
|
+
Permission.ProjectMember,
|
|
342
|
+
Permission.SettingsManager,
|
|
343
|
+
Permission.CreateHostOwnerUser,
|
|
344
|
+
],
|
|
345
|
+
read: [
|
|
346
|
+
Permission.ProjectOwner,
|
|
347
|
+
Permission.ProjectAdmin,
|
|
348
|
+
Permission.ProjectMember,
|
|
349
|
+
Permission.Viewer,
|
|
350
|
+
Permission.SettingsManager,
|
|
351
|
+
Permission.ReadHostOwnerUser,
|
|
352
|
+
Permission.ReadAllProjectResources,
|
|
353
|
+
],
|
|
354
|
+
update: [],
|
|
355
|
+
})
|
|
356
|
+
@TableColumn({
|
|
357
|
+
type: TableColumnType.ObjectID,
|
|
358
|
+
title: "Created by User ID",
|
|
359
|
+
description:
|
|
360
|
+
"User ID who created this object (if this object was created by a User)",
|
|
361
|
+
})
|
|
362
|
+
@Column({
|
|
363
|
+
type: ColumnType.ObjectID,
|
|
364
|
+
nullable: true,
|
|
365
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
366
|
+
})
|
|
367
|
+
public createdByUserId?: ObjectID = undefined;
|
|
368
|
+
|
|
369
|
+
@ColumnAccessControl({
|
|
370
|
+
create: [],
|
|
371
|
+
read: [
|
|
372
|
+
Permission.ProjectOwner,
|
|
373
|
+
Permission.ProjectAdmin,
|
|
374
|
+
Permission.ProjectMember,
|
|
375
|
+
Permission.Viewer,
|
|
376
|
+
Permission.SettingsManager,
|
|
377
|
+
Permission.ReadHostOwnerUser,
|
|
378
|
+
Permission.ReadAllProjectResources,
|
|
379
|
+
],
|
|
380
|
+
update: [],
|
|
381
|
+
})
|
|
382
|
+
@TableColumn({
|
|
383
|
+
manyToOneRelationColumn: "deletedByUserId",
|
|
384
|
+
type: TableColumnType.Entity,
|
|
385
|
+
title: "Deleted by User",
|
|
386
|
+
modelType: User,
|
|
387
|
+
description:
|
|
388
|
+
"Relation to User who deleted this object (if this object was deleted by a User)",
|
|
389
|
+
})
|
|
390
|
+
@ManyToOne(
|
|
391
|
+
() => {
|
|
392
|
+
return User;
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
cascade: false,
|
|
396
|
+
eager: false,
|
|
397
|
+
nullable: true,
|
|
398
|
+
onDelete: "SET NULL",
|
|
399
|
+
orphanedRowAction: "nullify",
|
|
400
|
+
},
|
|
401
|
+
)
|
|
402
|
+
@JoinColumn({ name: "deletedByUserId" })
|
|
403
|
+
public deletedByUser?: User = undefined;
|
|
404
|
+
|
|
405
|
+
@ColumnAccessControl({
|
|
406
|
+
create: [],
|
|
407
|
+
read: [
|
|
408
|
+
Permission.ProjectOwner,
|
|
409
|
+
Permission.ProjectAdmin,
|
|
410
|
+
Permission.ProjectMember,
|
|
411
|
+
Permission.Viewer,
|
|
412
|
+
Permission.SettingsManager,
|
|
413
|
+
Permission.ReadHostOwnerUser,
|
|
414
|
+
Permission.ReadAllProjectResources,
|
|
415
|
+
],
|
|
416
|
+
update: [],
|
|
417
|
+
})
|
|
418
|
+
@TableColumn({
|
|
419
|
+
type: TableColumnType.ObjectID,
|
|
420
|
+
title: "Deleted by User ID",
|
|
421
|
+
description:
|
|
422
|
+
"User ID who deleted this object (if this object was deleted by a User)",
|
|
423
|
+
})
|
|
424
|
+
@Column({
|
|
425
|
+
type: ColumnType.ObjectID,
|
|
426
|
+
nullable: true,
|
|
427
|
+
transformer: ObjectID.getDatabaseTransformer(),
|
|
428
|
+
})
|
|
429
|
+
public deletedByUserId?: ObjectID = undefined;
|
|
430
|
+
|
|
431
|
+
@ColumnAccessControl({
|
|
432
|
+
create: [],
|
|
433
|
+
read: [
|
|
434
|
+
Permission.ProjectOwner,
|
|
435
|
+
Permission.ProjectAdmin,
|
|
436
|
+
Permission.ProjectMember,
|
|
437
|
+
Permission.Viewer,
|
|
438
|
+
Permission.SettingsManager,
|
|
439
|
+
Permission.ReadHostOwnerUser,
|
|
440
|
+
Permission.ReadAllProjectResources,
|
|
441
|
+
],
|
|
442
|
+
update: [],
|
|
443
|
+
})
|
|
444
|
+
@Index()
|
|
445
|
+
@TableColumn({
|
|
446
|
+
type: TableColumnType.Boolean,
|
|
447
|
+
computed: true,
|
|
448
|
+
hideColumnInDocumentation: true,
|
|
449
|
+
required: true,
|
|
450
|
+
isDefaultValueColumn: true,
|
|
451
|
+
title: "Are Owners Notified",
|
|
452
|
+
description: "Are owners notified of this resource ownership?",
|
|
453
|
+
defaultValue: false,
|
|
454
|
+
})
|
|
455
|
+
@Column({
|
|
456
|
+
type: ColumnType.Boolean,
|
|
457
|
+
nullable: false,
|
|
458
|
+
default: false,
|
|
459
|
+
})
|
|
460
|
+
public isOwnerNotified?: boolean = undefined;
|
|
461
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Host from "./Host";
|
|
1
2
|
import IncidentEpisode from "./IncidentEpisode";
|
|
2
3
|
import IncidentSeverity from "./IncidentSeverity";
|
|
3
4
|
import IncidentState from "./IncidentState";
|
|
@@ -506,6 +507,57 @@ export default class Incident extends BaseModel {
|
|
|
506
507
|
})
|
|
507
508
|
public monitors?: Array<Monitor> = undefined; // monitors affected by this incident.
|
|
508
509
|
|
|
510
|
+
@ColumnAccessControl({
|
|
511
|
+
create: [
|
|
512
|
+
Permission.ProjectOwner,
|
|
513
|
+
Permission.ProjectAdmin,
|
|
514
|
+
Permission.ProjectMember,
|
|
515
|
+
Permission.IncidentManager,
|
|
516
|
+
Permission.CreateProjectIncident,
|
|
517
|
+
],
|
|
518
|
+
read: [
|
|
519
|
+
Permission.ProjectOwner,
|
|
520
|
+
Permission.ProjectAdmin,
|
|
521
|
+
Permission.ProjectMember,
|
|
522
|
+
Permission.Viewer,
|
|
523
|
+
Permission.IncidentManager,
|
|
524
|
+
Permission.ReadProjectIncident,
|
|
525
|
+
Permission.ReadAllProjectResources,
|
|
526
|
+
],
|
|
527
|
+
update: [
|
|
528
|
+
Permission.ProjectOwner,
|
|
529
|
+
Permission.ProjectAdmin,
|
|
530
|
+
Permission.ProjectMember,
|
|
531
|
+
Permission.IncidentManager,
|
|
532
|
+
Permission.EditProjectIncident,
|
|
533
|
+
],
|
|
534
|
+
})
|
|
535
|
+
@TableColumn({
|
|
536
|
+
required: false,
|
|
537
|
+
type: TableColumnType.EntityArray,
|
|
538
|
+
modelType: Host,
|
|
539
|
+
title: "Hosts",
|
|
540
|
+
description: "List of hosts affected by this incident.",
|
|
541
|
+
})
|
|
542
|
+
@ManyToMany(
|
|
543
|
+
() => {
|
|
544
|
+
return Host;
|
|
545
|
+
},
|
|
546
|
+
{ eager: false },
|
|
547
|
+
)
|
|
548
|
+
@JoinTable({
|
|
549
|
+
name: "IncidentHost",
|
|
550
|
+
inverseJoinColumn: {
|
|
551
|
+
name: "hostId",
|
|
552
|
+
referencedColumnName: "_id",
|
|
553
|
+
},
|
|
554
|
+
joinColumn: {
|
|
555
|
+
name: "incidentId",
|
|
556
|
+
referencedColumnName: "_id",
|
|
557
|
+
},
|
|
558
|
+
})
|
|
559
|
+
public hosts?: Array<Host> = undefined; // hosts affected by this incident.
|
|
560
|
+
|
|
509
561
|
@ColumnAccessControl({
|
|
510
562
|
create: [
|
|
511
563
|
Permission.ProjectOwner,
|
|
@@ -9,6 +9,9 @@ import DockerHost from "./DockerHost";
|
|
|
9
9
|
import DockerHostOwnerTeam from "./DockerHostOwnerTeam";
|
|
10
10
|
import DockerHostOwnerUser from "./DockerHostOwnerUser";
|
|
11
11
|
import DockerResource from "./DockerResource";
|
|
12
|
+
import Host from "./Host";
|
|
13
|
+
import HostOwnerTeam from "./HostOwnerTeam";
|
|
14
|
+
import HostOwnerUser from "./HostOwnerUser";
|
|
12
15
|
// API Keys
|
|
13
16
|
import ApiKey from "./ApiKey";
|
|
14
17
|
import ApiKeyPermission from "./ApiKeyPermission";
|
|
@@ -542,6 +545,9 @@ const AllModelTypes: Array<{
|
|
|
542
545
|
DockerHostOwnerTeam,
|
|
543
546
|
DockerHostOwnerUser,
|
|
544
547
|
DockerResource,
|
|
548
|
+
Host,
|
|
549
|
+
HostOwnerTeam,
|
|
550
|
+
HostOwnerUser,
|
|
545
551
|
];
|
|
546
552
|
|
|
547
553
|
const modelTypeMap: { [key: string]: { new (): BaseModel } } = {};
|
|
@@ -10,7 +10,6 @@ import ColumnLength from "../../Types/Database/ColumnLength";
|
|
|
10
10
|
import ColumnType from "../../Types/Database/ColumnType";
|
|
11
11
|
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
|
|
12
12
|
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
|
|
13
|
-
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
|
|
14
13
|
import SlugifyColumn from "../../Types/Database/SlugifyColumn";
|
|
15
14
|
import TableColumn from "../../Types/Database/TableColumn";
|
|
16
15
|
import TableColumnType from "../../Types/Database/TableColumnType";
|
|
@@ -65,12 +64,6 @@ import {
|
|
|
65
64
|
Permission.EditKubernetesCluster,
|
|
66
65
|
],
|
|
67
66
|
})
|
|
68
|
-
@EnableWorkflow({
|
|
69
|
-
create: true,
|
|
70
|
-
delete: true,
|
|
71
|
-
update: true,
|
|
72
|
-
read: true,
|
|
73
|
-
})
|
|
74
67
|
@CrudApiEndpoint(new Route("/kubernetes-cluster"))
|
|
75
68
|
@SlugifyColumn("name", "slug")
|
|
76
69
|
/*
|