@oneuptime/common 7.0.3035 → 7.0.3040

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.
Files changed (97) hide show
  1. package/Models/DatabaseModels/IncidentNoteTemplate.ts +8 -0
  2. package/Models/DatabaseModels/IncidentTemplate.ts +8 -0
  3. package/Models/DatabaseModels/Index.ts +6 -0
  4. package/Models/DatabaseModels/ScheduledMaintenance.ts +70 -0
  5. package/Models/DatabaseModels/ScheduledMaintenanceTemplate.ts +988 -0
  6. package/Models/DatabaseModels/ScheduledMaintenanceTemplateOwnerTeam.ts +390 -0
  7. package/Models/DatabaseModels/ScheduledMaintenanceTemplateOwnerUser.ts +389 -0
  8. package/Server/Infrastructure/Postgres/SchemaMigrations/1725880508430-MigrationName.ts +269 -0
  9. package/Server/Infrastructure/Postgres/SchemaMigrations/1725881099935-MigrationName.ts +17 -0
  10. package/Server/Infrastructure/Postgres/SchemaMigrations/1725881475134-MigrationName.ts +35 -0
  11. package/Server/Infrastructure/Postgres/SchemaMigrations/1725884177663-MigrationName.ts +29 -0
  12. package/Server/Infrastructure/Postgres/SchemaMigrations/1725898621366-MigrationName.ts +29 -0
  13. package/Server/Infrastructure/Postgres/SchemaMigrations/1725900315712-MigrationName.ts +59 -0
  14. package/Server/Infrastructure/Postgres/SchemaMigrations/1725901024444-MigrationName.ts +23 -0
  15. package/Server/Infrastructure/Postgres/SchemaMigrations/1725975175669-MigrationName.ts +29 -0
  16. package/Server/Infrastructure/Postgres/SchemaMigrations/1725976810107-MigrationName.ts +17 -0
  17. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +18 -0
  18. package/Server/Services/IncidentService.ts +45 -0
  19. package/Server/Services/IncidentStateService.ts +47 -6
  20. package/Server/Services/Index.ts +8 -0
  21. package/Server/Services/ScheduledMaintenanceService.ts +308 -1
  22. package/Server/Services/ScheduledMaintenanceTemplateOwnerTeamService.ts +10 -0
  23. package/Server/Services/ScheduledMaintenanceTemplateOwnerUserService.ts +10 -0
  24. package/Server/Services/ScheduledMaintenanceTemplateService.ts +318 -0
  25. package/Types/Database/DatabaseProperty.ts +6 -3
  26. package/Types/Events/Recurring.ts +86 -41
  27. package/Types/Permission.ts +115 -1
  28. package/Types/SerializableObjectDictionary.ts +2 -0
  29. package/UI/Components/Detail/Detail.tsx +12 -3
  30. package/UI/Components/Detail/Field.ts +1 -1
  31. package/UI/Components/Events/RecurringArrayFieldElement.tsx +104 -0
  32. package/UI/Components/Events/RecurringArrayViewElement.tsx +37 -0
  33. package/UI/Components/Events/RecurringViewElement.tsx +2 -0
  34. package/build/dist/Models/DatabaseModels/IncidentNoteTemplate.js +8 -0
  35. package/build/dist/Models/DatabaseModels/IncidentNoteTemplate.js.map +1 -1
  36. package/build/dist/Models/DatabaseModels/IncidentTemplate.js +8 -0
  37. package/build/dist/Models/DatabaseModels/IncidentTemplate.js.map +1 -1
  38. package/build/dist/Models/DatabaseModels/Index.js +6 -0
  39. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  40. package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js +73 -0
  41. package/build/dist/Models/DatabaseModels/ScheduledMaintenance.js.map +1 -1
  42. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplate.js +1012 -0
  43. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplate.js.map +1 -0
  44. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplateOwnerTeam.js +402 -0
  45. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplateOwnerTeam.js.map +1 -0
  46. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplateOwnerUser.js +401 -0
  47. package/build/dist/Models/DatabaseModels/ScheduledMaintenanceTemplateOwnerUser.js.map +1 -0
  48. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725880508430-MigrationName.js +98 -0
  49. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725880508430-MigrationName.js.map +1 -0
  50. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725881099935-MigrationName.js +12 -0
  51. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725881099935-MigrationName.js.map +1 -0
  52. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725881475134-MigrationName.js +18 -0
  53. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725881475134-MigrationName.js.map +1 -0
  54. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725884177663-MigrationName.js +16 -0
  55. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725884177663-MigrationName.js.map +1 -0
  56. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725898621366-MigrationName.js +16 -0
  57. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725898621366-MigrationName.js.map +1 -0
  58. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725900315712-MigrationName.js +26 -0
  59. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725900315712-MigrationName.js.map +1 -0
  60. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725901024444-MigrationName.js +14 -0
  61. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725901024444-MigrationName.js.map +1 -0
  62. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725975175669-MigrationName.js +16 -0
  63. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725975175669-MigrationName.js.map +1 -0
  64. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725976810107-MigrationName.js +12 -0
  65. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1725976810107-MigrationName.js.map +1 -0
  66. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +18 -0
  67. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  68. package/build/dist/Server/Services/IncidentService.js +34 -0
  69. package/build/dist/Server/Services/IncidentService.js.map +1 -1
  70. package/build/dist/Server/Services/IncidentStateService.js +25 -2
  71. package/build/dist/Server/Services/IncidentStateService.js.map +1 -1
  72. package/build/dist/Server/Services/Index.js +7 -0
  73. package/build/dist/Server/Services/Index.js.map +1 -1
  74. package/build/dist/Server/Services/ScheduledMaintenanceService.js +209 -1
  75. package/build/dist/Server/Services/ScheduledMaintenanceService.js.map +1 -1
  76. package/build/dist/Server/Services/ScheduledMaintenanceTemplateOwnerTeamService.js +9 -0
  77. package/build/dist/Server/Services/ScheduledMaintenanceTemplateOwnerTeamService.js.map +1 -0
  78. package/build/dist/Server/Services/ScheduledMaintenanceTemplateOwnerUserService.js +9 -0
  79. package/build/dist/Server/Services/ScheduledMaintenanceTemplateOwnerUserService.js.map +1 -0
  80. package/build/dist/Server/Services/ScheduledMaintenanceTemplateService.js +203 -0
  81. package/build/dist/Server/Services/ScheduledMaintenanceTemplateService.js.map +1 -0
  82. package/build/dist/Types/Database/DatabaseProperty.js.map +1 -1
  83. package/build/dist/Types/Events/Recurring.js +47 -20
  84. package/build/dist/Types/Events/Recurring.js.map +1 -1
  85. package/build/dist/Types/Permission.js +97 -1
  86. package/build/dist/Types/Permission.js.map +1 -1
  87. package/build/dist/Types/SerializableObjectDictionary.js +2 -0
  88. package/build/dist/Types/SerializableObjectDictionary.js.map +1 -1
  89. package/build/dist/UI/Components/Detail/Detail.js +9 -1
  90. package/build/dist/UI/Components/Detail/Detail.js.map +1 -1
  91. package/build/dist/UI/Components/Events/RecurringArrayFieldElement.js +49 -0
  92. package/build/dist/UI/Components/Events/RecurringArrayFieldElement.js.map +1 -0
  93. package/build/dist/UI/Components/Events/RecurringArrayViewElement.js +18 -0
  94. package/build/dist/UI/Components/Events/RecurringArrayViewElement.js.map +1 -0
  95. package/build/dist/UI/Components/Events/RecurringViewElement.js +2 -1
  96. package/build/dist/UI/Components/Events/RecurringViewElement.js.map +1 -1
  97. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
1
  import DatabaseProperty from "../Database/DatabaseProperty";
2
2
  import OneUptimeDate from "../Date";
3
3
  import BadDataException from "../Exception/BadDataException";
4
- import { JSONObject, ObjectType } from "../JSON";
4
+ import { JSONArray, JSONObject, ObjectType } from "../JSON";
5
5
  import JSONFunctions from "../JSONFunctions";
6
6
  import PositiveNumber from "../PositiveNumber";
7
7
  import EventInterval from "./EventInterval";
@@ -20,10 +20,58 @@ export default class Recurring extends DatabaseProperty {
20
20
  };
21
21
  }
22
22
 
23
- public static getNextDate(startDate: Date, rotation: Recurring): Date {
23
+ public static getNextDateInterval(
24
+ startDate: Date,
25
+ rotation: Recurring,
26
+ getDateInThePast?: boolean | undefined,
27
+ ): Date {
24
28
  const intervalType: EventInterval = rotation.intervalType;
25
29
  const intervalCount: PositiveNumber = rotation.intervalCount;
26
30
 
31
+ // past or present date.
32
+ const multiplier: number = getDateInThePast ? -1 : 1;
33
+
34
+ let nextDate: Date = OneUptimeDate.fromString(startDate);
35
+
36
+ switch (intervalType) {
37
+ case EventInterval.Hour:
38
+ nextDate = OneUptimeDate.addRemoveHours(
39
+ nextDate,
40
+ intervalCount.toNumber() * multiplier,
41
+ );
42
+ break;
43
+ case EventInterval.Day:
44
+ nextDate = OneUptimeDate.addRemoveDays(
45
+ nextDate,
46
+ intervalCount.toNumber() * multiplier,
47
+ );
48
+ break;
49
+ case EventInterval.Week:
50
+ nextDate = OneUptimeDate.addRemoveDays(
51
+ nextDate,
52
+ intervalCount.toNumber() * 7 * multiplier,
53
+ );
54
+ break;
55
+ case EventInterval.Month:
56
+ nextDate = OneUptimeDate.addRemoveMonths(
57
+ nextDate,
58
+ intervalCount.toNumber() * multiplier,
59
+ );
60
+ break;
61
+ case EventInterval.Year:
62
+ nextDate = OneUptimeDate.addRemoveYears(
63
+ nextDate,
64
+ intervalCount.toNumber() * multiplier,
65
+ );
66
+ break;
67
+ default:
68
+ throw new BadDataException("Invalid Interval Type: " + intervalType);
69
+ }
70
+
71
+ return nextDate;
72
+ }
73
+
74
+ public static getNextDate(startDate: Date, rotation: Recurring): Date {
27
75
  let nextDate: Date = OneUptimeDate.fromString(startDate);
28
76
  const dateNow: Date = OneUptimeDate.getCurrentDate();
29
77
 
@@ -33,42 +81,7 @@ export default class Recurring extends DatabaseProperty {
33
81
 
34
82
  if (nextDate.getTime() <= dateNow.getTime()) {
35
83
  while (nextDate.getTime() <= dateNow.getTime()) {
36
- switch (intervalType) {
37
- case EventInterval.Hour:
38
- nextDate = OneUptimeDate.addRemoveHours(
39
- nextDate,
40
- intervalCount.toNumber(),
41
- );
42
- break;
43
- case EventInterval.Day:
44
- nextDate = OneUptimeDate.addRemoveDays(
45
- nextDate,
46
- intervalCount.toNumber(),
47
- );
48
- break;
49
- case EventInterval.Week:
50
- nextDate = OneUptimeDate.addRemoveDays(
51
- nextDate,
52
- intervalCount.toNumber() * 7,
53
- );
54
- break;
55
- case EventInterval.Month:
56
- nextDate = OneUptimeDate.addRemoveMonths(
57
- nextDate,
58
- intervalCount.toNumber(),
59
- );
60
- break;
61
- case EventInterval.Year:
62
- nextDate = OneUptimeDate.addRemoveYears(
63
- nextDate,
64
- intervalCount.toNumber(),
65
- );
66
- break;
67
- default:
68
- throw new BadDataException(
69
- "Invalid Interval Type: " + intervalType,
70
- );
71
- }
84
+ nextDate = this.getNextDateInterval(startDate, rotation);
72
85
  }
73
86
  }
74
87
 
@@ -114,6 +127,18 @@ export default class Recurring extends DatabaseProperty {
114
127
  });
115
128
  }
116
129
 
130
+ public static fromJSONArray(
131
+ json: JSONArray | Array<Recurring>,
132
+ ): Array<Recurring> {
133
+ const arrayToReturn: Array<Recurring> = [];
134
+
135
+ for (const item of json) {
136
+ arrayToReturn.push(this.fromJSON(item) as Recurring);
137
+ }
138
+
139
+ return arrayToReturn;
140
+ }
141
+
117
142
  public static override fromJSON(json: JSONObject | Recurring): Recurring {
118
143
  if (json instanceof Recurring) {
119
144
  return json;
@@ -151,9 +176,23 @@ export default class Recurring extends DatabaseProperty {
151
176
  return rotation;
152
177
  }
153
178
 
179
+ public static toJSONArray(recurrings: Array<Recurring>): JSONArray {
180
+ const arrayToReturn: JSONArray = [];
181
+
182
+ for (const item of recurrings) {
183
+ arrayToReturn.push(item.toJSON());
184
+ }
185
+
186
+ return arrayToReturn;
187
+ }
188
+
154
189
  protected static override toDatabase(
155
- value: Recurring | FindOperator<Recurring>,
156
- ): JSONObject | null {
190
+ value: Recurring | Array<Recurring> | FindOperator<Recurring>,
191
+ ): JSONObject | Array<JSONObject> | null {
192
+ if (Array.isArray(value)) {
193
+ return this.toJSONArray(value as Array<Recurring>);
194
+ }
195
+
157
196
  if (value && value instanceof Recurring) {
158
197
  return (value as Recurring).toJSON();
159
198
  } else if (value) {
@@ -163,7 +202,13 @@ export default class Recurring extends DatabaseProperty {
163
202
  return null;
164
203
  }
165
204
 
166
- protected static override fromDatabase(value: JSONObject): Recurring | null {
205
+ protected static override fromDatabase(
206
+ value: JSONObject | Array<JSONObject>,
207
+ ): Recurring | Array<Recurring> | null {
208
+ if (Array.isArray(value)) {
209
+ return Recurring.fromJSONArray(value as Array<JSONObject>);
210
+ }
211
+
167
212
  if (value) {
168
213
  return Recurring.fromJSON(value);
169
214
  }
@@ -174,11 +174,21 @@ enum Permission {
174
174
  EditScheduledMaintenanceOwnerTeam = "EditScheduledMaintenanceOwnerTeam",
175
175
  ReadScheduledMaintenanceOwnerTeam = "ReadScheduledMaintenanceOwnerTeam",
176
176
 
177
- CreateScheduledMaintenanceOwnerUser = "CreateScheduledMaintenanceOwner",
177
+ CreateScheduledMaintenanceOwnerUser = "CreateScheduledMaintenanceOwnerUser",
178
178
  DeleteScheduledMaintenanceOwnerUser = "DeleteScheduledMaintenanceOwnerUser",
179
179
  EditScheduledMaintenanceOwnerUser = "EditScheduledMaintenanceOwnerUser",
180
180
  ReadScheduledMaintenanceOwnerUser = "ReadScheduledMaintenanceOwnerUser",
181
181
 
182
+ CreateScheduledMaintenanceTemplateOwnerUser = "CreateScheduledMaintenanceOwnerUser",
183
+ DeleteScheduledMaintenanceTemplateOwnerUser = "DeleteScheduledMaintenanceTemplateOwnerUser",
184
+ EditScheduledMaintenanceTemplateOwnerUser = "EditScheduledMaintenanceTemplateOwnerUser",
185
+ ReadScheduledMaintenanceTemplateOwnerUser = "ReadScheduledMaintenanceTemplateOwnerUser",
186
+
187
+ CreateScheduledMaintenanceTemplateOwnerTeam = "CreateScheduledMaintenanceOwnerTeam",
188
+ DeleteScheduledMaintenanceTemplateOwnerTeam = "DeleteScheduledMaintenanceTemplateOwnerTeam",
189
+ EditScheduledMaintenanceTemplateOwnerTeam = "EditScheduledMaintenanceTemplateOwnerTeam",
190
+ ReadScheduledMaintenanceTemplateOwnerTeam = "ReadScheduledMaintenanceTemplateOwnerTeam",
191
+
182
192
  CreateStatusPageOwnerTeam = "CreateStatusPageOwnerTeam",
183
193
  DeleteStatusPageOwnerTeam = "DeleteStatusPageOwnerTeam",
184
194
  EditStatusPageOwnerTeam = "EditStatusPageOwnerTeam",
@@ -234,6 +244,11 @@ enum Permission {
234
244
  EditProjectIncident = "EditProjectIncident",
235
245
  ReadProjectIncident = "ReadProjectIncident",
236
246
 
247
+ CreateScheduledMaintenanceTemplate = "CreateScheduledMaintenanceTemplate",
248
+ DeleteScheduledMaintenanceTemplate = "DeleteScheduledMaintenanceTemplate",
249
+ EditScheduledMaintenanceTemplate = "EditScheduledMaintenanceTemplate",
250
+ ReadScheduledMaintenanceTemplate = "ReadScheduledMaintenanceTemplate",
251
+
237
252
  CreateStatusPageSubscriber = "CreateStatusPageSubscriber",
238
253
  DeleteStatusPageSubscriber = "DeleteStatusPageSubscriber",
239
254
  EditStatusPageSubscriber = "EditStatusPageSubscriber",
@@ -2904,6 +2919,72 @@ export class PermissionHelper {
2904
2919
  isAccessControlPermission: false,
2905
2920
  },
2906
2921
 
2922
+ {
2923
+ permission: Permission.CreateScheduledMaintenanceTemplateOwnerUser,
2924
+ title: "Create Scheduled Maintenance Template User Owner",
2925
+ description:
2926
+ "This permission can create Scheduled Maintenance Template User Owner this project.",
2927
+ isAssignableToTenant: true,
2928
+ isAccessControlPermission: false,
2929
+ },
2930
+ {
2931
+ permission: Permission.DeleteScheduledMaintenanceTemplateOwnerUser,
2932
+ title: "Delete Scheduled Maintenance Template User Owner",
2933
+ description:
2934
+ "This permission can delete Scheduled Maintenance Template User Owner of this project.",
2935
+ isAssignableToTenant: true,
2936
+ isAccessControlPermission: false,
2937
+ },
2938
+ {
2939
+ permission: Permission.EditScheduledMaintenanceTemplateOwnerUser,
2940
+ title: "Edit Scheduled Maintenance Template User Owner",
2941
+ description:
2942
+ "This permission can edit Scheduled Maintenance Template User Owner of this project.",
2943
+ isAssignableToTenant: true,
2944
+ isAccessControlPermission: false,
2945
+ },
2946
+ {
2947
+ permission: Permission.ReadScheduledMaintenanceTemplateOwnerUser,
2948
+ title: "Read Scheduled Maintenance Template User Owner",
2949
+ description:
2950
+ "This permission can read Scheduled Maintenance Template User Owner of this project.",
2951
+ isAssignableToTenant: true,
2952
+ isAccessControlPermission: false,
2953
+ },
2954
+
2955
+ {
2956
+ permission: Permission.CreateScheduledMaintenanceTemplateOwnerTeam,
2957
+ title: "Create Scheduled Maintenance Template User Team",
2958
+ description:
2959
+ "This permission can create Scheduled Maintenance Template User Owner this project.",
2960
+ isAssignableToTenant: true,
2961
+ isAccessControlPermission: false,
2962
+ },
2963
+ {
2964
+ permission: Permission.DeleteScheduledMaintenanceTemplateOwnerTeam,
2965
+ title: "Delete Scheduled Maintenance Template User Team",
2966
+ description:
2967
+ "This permission can delete Scheduled Maintenance Template User Owner of this project.",
2968
+ isAssignableToTenant: true,
2969
+ isAccessControlPermission: false,
2970
+ },
2971
+ {
2972
+ permission: Permission.EditScheduledMaintenanceTemplateOwnerTeam,
2973
+ title: "Edit Scheduled Maintenance Template User Team",
2974
+ description:
2975
+ "This permission can edit Scheduled Maintenance Template User Owner of this project.",
2976
+ isAssignableToTenant: true,
2977
+ isAccessControlPermission: false,
2978
+ },
2979
+ {
2980
+ permission: Permission.ReadScheduledMaintenanceTemplateOwnerTeam,
2981
+ title: "Read Scheduled Maintenance Template User Team",
2982
+ description:
2983
+ "This permission can read Scheduled Maintenance Template User Owner of this project.",
2984
+ isAssignableToTenant: true,
2985
+ isAccessControlPermission: false,
2986
+ },
2987
+
2907
2988
  {
2908
2989
  permission: Permission.CreateIncidentOwnerTeam,
2909
2990
  title: "Create Incident Team Owner",
@@ -3461,6 +3542,39 @@ export class PermissionHelper {
3461
3542
  isAccessControlPermission: true,
3462
3543
  },
3463
3544
 
3545
+ {
3546
+ permission: Permission.CreateScheduledMaintenanceTemplate,
3547
+ title: "Create Scheduled Maintenance Template",
3548
+ description:
3549
+ "This permission can create scheduled maintenance template in the project.",
3550
+ isAssignableToTenant: true,
3551
+ isAccessControlPermission: false,
3552
+ },
3553
+ {
3554
+ permission: Permission.DeleteScheduledMaintenanceTemplate,
3555
+ title: "Delete Scheduled Maintenance Template",
3556
+ description:
3557
+ "This permission can delete scheduled maintenance template in the project.",
3558
+ isAssignableToTenant: true,
3559
+ isAccessControlPermission: false,
3560
+ },
3561
+ {
3562
+ permission: Permission.EditScheduledMaintenanceTemplate,
3563
+ title: "Edit Scheduled Maintenance Template",
3564
+ description:
3565
+ "This permission can edit scheduled maintenance template in the project.",
3566
+ isAssignableToTenant: true,
3567
+ isAccessControlPermission: false,
3568
+ },
3569
+ {
3570
+ permission: Permission.ReadScheduledMaintenanceTemplate,
3571
+ title: "Read Scheduled Maintenance Template",
3572
+ description:
3573
+ "This permission can read scheduled maintenance template in the project.",
3574
+ isAssignableToTenant: true,
3575
+ isAccessControlPermission: false,
3576
+ },
3577
+
3464
3578
  {
3465
3579
  permission: Permission.CreateStatusPageSubscriber,
3466
3580
  title: "Create Status Page Subscriber",
@@ -17,6 +17,7 @@ import OneUptimeDate from "./Date";
17
17
  import Dictionary from "./Dictionary";
18
18
  import Domain from "./Domain";
19
19
  import Email from "./Email";
20
+ import Recurring from "./Events/Recurring";
20
21
  import HashedString from "./HashedString";
21
22
  import IP from "./IP/IP";
22
23
  import { ObjectType } from "./JSON";
@@ -60,6 +61,7 @@ const SerializableObjectDictionary: Dictionary<any> = {
60
61
  [ObjectType.Includes]: Includes,
61
62
  [ObjectType.NotNull]: NotNull,
62
63
  [ObjectType.IsNull]: IsNull,
64
+ [ObjectType.Recurring]: Recurring,
63
65
  };
64
66
 
65
67
  export default SerializableObjectDictionary;
@@ -405,9 +405,18 @@ const Detail: DetailFunction = <T extends GenericObject>(
405
405
  >
406
406
  {props.fields &&
407
407
  props.fields.length > 0 &&
408
- props.fields.map((field: Field<T>, i: number) => {
409
- return getField(field, i);
410
- })}
408
+ props.fields
409
+ .filter((field: Field<T>) => {
410
+ // check if showIf exists.
411
+ if (field.showIf) {
412
+ return field.showIf(props.item);
413
+ }
414
+
415
+ return true;
416
+ })
417
+ .map((field: Field<T>, i: number) => {
418
+ return getField(field, i);
419
+ })}
411
420
  </div>
412
421
  );
413
422
  };
@@ -17,12 +17,12 @@ export interface FieldBase<T> {
17
17
  title?: string;
18
18
  description?: string;
19
19
  fieldTitleSize?: Size | undefined;
20
-
21
20
  fieldType?: FieldType;
22
21
  dropdownOptions?: Array<DropdownOption> | undefined;
23
22
  colSpan?: number | undefined;
24
23
  alignItem?: AlignItem | undefined;
25
24
  contentClassName?: string | undefined;
25
+ showIf?: ((item: T) => boolean) | undefined;
26
26
  getElement?:
27
27
  | ((
28
28
  item: T,
@@ -0,0 +1,104 @@
1
+ import EventInterval from "Common/Types/Events/EventInterval";
2
+ import Recurring from "Common/Types/Events/Recurring";
3
+ import PositiveNumber from "Common/Types/PositiveNumber";
4
+ import React, { FunctionComponent, ReactElement, useState } from "react";
5
+ import RecurringFieldElement from "./RecurringFieldElement";
6
+ import Button, { ButtonSize, ButtonStyleType } from "../Button/Button";
7
+ import IconProp from "../../../Types/Icon/IconProp";
8
+
9
+ export interface ComponentProps {
10
+ error?: string | undefined;
11
+ onChange?: ((value: Array<Recurring>) => void) | undefined;
12
+ initialValue?: Array<Recurring> | undefined;
13
+ }
14
+
15
+ const RecurringArrayFieldElement: FunctionComponent<ComponentProps> = (
16
+ props: ComponentProps,
17
+ ): ReactElement => {
18
+ const [recurrings, setRecurrings] = useState<Array<Recurring> | undefined>(
19
+ props.initialValue && props.initialValue.length > 0
20
+ ? Recurring.fromJSONArray(props.initialValue)
21
+ : undefined,
22
+ );
23
+
24
+ type UpdateRecurringFunction = (recurring: Recurring, index: number) => void;
25
+
26
+ const updateRecurrings: UpdateRecurringFunction = (
27
+ recurring: Recurring,
28
+ index: number,
29
+ ): void => {
30
+ const existingRecurrings: Array<Recurring> = [...(recurrings || [])];
31
+
32
+ existingRecurrings[index] = recurring;
33
+
34
+ setRecurrings(existingRecurrings);
35
+
36
+ if (props.onChange) {
37
+ props.onChange(existingRecurrings);
38
+ }
39
+ };
40
+
41
+ return (
42
+ <div>
43
+ {recurrings &&
44
+ recurrings.map((recurring: Recurring, index: number) => {
45
+ return (
46
+ <div key={index} className="flex">
47
+ <div className="">
48
+ <RecurringFieldElement
49
+ initialValue={recurring}
50
+ onChange={(recurring: Recurring) => {
51
+ updateRecurrings(recurring, index);
52
+ }}
53
+ />
54
+ </div>
55
+
56
+ <div>
57
+ <Button
58
+ dataTestId={`delete-${index}`}
59
+ title="Delete"
60
+ buttonStyle={ButtonStyleType.ICON}
61
+ icon={IconProp.Trash}
62
+ onClick={() => {
63
+ const newData: Array<Recurring> = [...(recurrings || [])];
64
+ newData.splice(index, 1);
65
+ setRecurrings(newData);
66
+ props.onChange && props.onChange(newData);
67
+ }}
68
+ />
69
+ </div>
70
+ </div>
71
+ );
72
+ })}
73
+
74
+ <div className="flex space-x-3 mt-3 -ml-3">
75
+ <Button
76
+ dataTestId={`add-recurring`}
77
+ title="Add"
78
+ buttonStyle={ButtonStyleType.NORMAL}
79
+ buttonSize={ButtonSize.Small}
80
+ icon={IconProp.Add}
81
+ onClick={() => {
82
+ const newData: Array<Recurring> = [...(recurrings || [])];
83
+
84
+ const recurring: Recurring = new Recurring();
85
+ recurring.intervalCount = new PositiveNumber(1);
86
+ recurring.intervalType = EventInterval.Day;
87
+
88
+ newData.push(recurring);
89
+ setRecurrings(newData);
90
+ props.onChange && props.onChange(newData);
91
+ }}
92
+ />
93
+ </div>
94
+
95
+ {props.error && (
96
+ <p data-testid="error-message" className="mt-1 text-sm text-red-400">
97
+ {props.error}
98
+ </p>
99
+ )}
100
+ </div>
101
+ );
102
+ };
103
+
104
+ export default RecurringArrayFieldElement;
@@ -0,0 +1,37 @@
1
+ import Recurring from "Common/Types/Events/Recurring";
2
+ import React, { FunctionComponent, ReactElement } from "react";
3
+ import RecurringViewElement from "./RecurringViewElement";
4
+
5
+ export interface ComponentProps {
6
+ value?: Array<Recurring> | undefined;
7
+ postfix?: string | undefined;
8
+ }
9
+
10
+ const RecurringArrayViewElement: FunctionComponent<ComponentProps> = (
11
+ props: ComponentProps,
12
+ ): ReactElement => {
13
+ if (!props.value) {
14
+ return <p>-</p>;
15
+ }
16
+
17
+ const items: Array<Recurring> = Recurring.fromJSONArray(props.value);
18
+
19
+ return (
20
+ <div className="space-y-2">
21
+ {items &&
22
+ items.length > 0 &&
23
+ items.map((item: Recurring, index: number) => {
24
+ return (
25
+ <RecurringViewElement
26
+ key={index}
27
+ value={item}
28
+ postfix={props.postfix}
29
+ />
30
+ );
31
+ })}
32
+ {(!items || items.length === 0) && <p>-</p>}
33
+ </div>
34
+ );
35
+ };
36
+
37
+ export default RecurringArrayViewElement;
@@ -4,6 +4,7 @@ import React, { FunctionComponent, ReactElement } from "react";
4
4
 
5
5
  export interface ComponentProps {
6
6
  value?: Recurring | undefined;
7
+ postfix?: string | undefined;
7
8
  }
8
9
 
9
10
  const RecurringViewElement: FunctionComponent<ComponentProps> = (
@@ -20,6 +21,7 @@ const RecurringViewElement: FunctionComponent<ComponentProps> = (
20
21
  {value.intervalCount?.toString()}{" "}
21
22
  {EventInterval[value.intervalType]?.toString()}
22
23
  {value.intervalCount && value.intervalCount.toNumber() > 1 ? "s" : ""}
24
+ {props.postfix || ""}
23
25
  </p>
24
26
  );
25
27
  };
@@ -26,6 +26,8 @@ import IconProp from "../../Types/Icon/IconProp";
26
26
  import ObjectID from "../../Types/ObjectID";
27
27
  import Permission from "../../Types/Permission";
28
28
  import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
29
+ import TableBillingAccessControl from "../../Types/Database/AccessControl/TableBillingAccessControl";
30
+ import { PlanType } from "../../Types/Billing/SubscriptionPlan";
29
31
  let IncidentNoteTemplate = class IncidentNoteTemplate extends BaseModel {
30
32
  constructor() {
31
33
  super(...arguments);
@@ -314,6 +316,12 @@ __decorate([
314
316
  __metadata("design:type", ObjectID)
315
317
  ], IncidentNoteTemplate.prototype, "deletedByUserId", void 0);
316
318
  IncidentNoteTemplate = __decorate([
319
+ TableBillingAccessControl({
320
+ create: PlanType.Growth,
321
+ read: PlanType.Growth,
322
+ update: PlanType.Growth,
323
+ delete: PlanType.Growth,
324
+ }),
317
325
  EnableDocumentation(),
318
326
  TenantColumn("projectId"),
319
327
  TableAccessControl({
@@ -1 +1 @@
1
- {"version":3,"file":"IncidentNoteTemplate.js","sourceRoot":"","sources":["../../../../Models/DatabaseModels/IncidentNoteTemplate.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B,OAAO,SAAS,MAAM,uCAAuC,CAAC;AAC9D,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAC1C,OAAO,mBAAmB,MAAM,wDAAwD,CAAC;AACzF,OAAO,kBAAkB,MAAM,uDAAuD,CAAC;AACvF,OAAO,YAAY,MAAM,mCAAmC,CAAC;AAC7D,OAAO,UAAU,MAAM,iCAAiC,CAAC;AACzD,OAAO,eAAe,MAAM,sCAAsC,CAAC;AACnE,OAAO,mBAAmB,MAAM,0CAA0C,CAAC;AAC3E,OAAO,cAAc,MAAM,qCAAqC,CAAC;AACjE,OAAO,WAAW,MAAM,kCAAkC,CAAC;AAC3D,OAAO,eAAe,MAAM,sCAAsC,C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U,CAAC,YAAY;YACvB,UAAU,CAAC,YAAY;YACvB,UAAU,CAAC,aAAa;YACxB,UAAU,CAAC,0BAA0B;SACtC;QACD,IAAI,EAAE;YACJ,UAAU,CAAC,YAAY;YACvB,UAAU,CAAC,YAAY;YACvB,UAAU,CAAC,aAAa;YACxB,UAAU,CAAC,wBAAwB;SACpC;QACD,MAAM,EAAE;YACN,UAAU,CAAC,YAAY;YACvB,UAAU,CAAC,YAAY;YACvB,UAAU,CAAC,aAAa;YACxB,UAAU,CAAC,0BAA0B;SACtC;QACD,MAAM,EAAE;YACN,UAAU,CAAC,YAAY;YACvB,UAAU,CAAC,YAAY;YACvB,UAAU,CAAC,aAAa;YACxB,UAAU,CAAC,wBAAwB;SACpC;KACF,CAAC;IACD,eAAe,CAAC,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACrD,MAAM,CAAC;QACN,IAAI,EAAE,sBAAsB;KAC7B,CAAC;IACD,cAAc,CAAC;QACd,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,IAAI,EAAE,IAAI;KACX,CAAC;IACD,aAAa,CAAC;QACb,SAAS,EAAE,sBAAsB;QACjC,YAAY,EAAE,wBAAwB;QACtC,UAAU,EAAE,yBAAyB;QACrC,IAAI,EAAE,QAAQ,CAAC,KAAK;QACpB,gBAAgB,EAAE,iDAAiD;KACpE,CAAC;GACmB,oBAAoB,CAsRxC;eAtRoB,oBAAoB"}
@@ -34,6 +34,8 @@ import IconProp from "../../Types/Icon/IconProp";
34
34
  import ObjectID from "../../Types/ObjectID";
35
35
  import Permission from "../../Types/Permission";
36
36
  import { Column, Entity, Index, JoinColumn, JoinTable, ManyToMany, ManyToOne, } from "typeorm";
37
+ import TableBillingAccessControl from "../../Types/Database/AccessControl/TableBillingAccessControl";
38
+ import { PlanType } from "../../Types/Billing/SubscriptionPlan";
37
39
  let IncidentTemplate = class IncidentTemplate extends BaseModel {
38
40
  constructor() {
39
41
  super(...arguments);
@@ -706,6 +708,12 @@ __decorate([
706
708
  __metadata("design:type", Object)
707
709
  ], IncidentTemplate.prototype, "customFields", void 0);
708
710
  IncidentTemplate = __decorate([
711
+ TableBillingAccessControl({
712
+ create: PlanType.Growth,
713
+ read: PlanType.Growth,
714
+ update: PlanType.Growth,
715
+ delete: PlanType.Growth,
716
+ }),
709
717
  EnableDocumentation(),
710
718
  AccessControlColumn("labels"),
711
719
  TenantColumn("projectId"),