@dative-gpi/foundation-shared-domain 1.0.26 → 1.0.28-remove-deprecated2
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/enums/actions.ts +6 -0
- package/enums/agendas.ts +6 -0
- package/enums/applications.ts +25 -0
- package/enums/charts.ts +115 -0
- package/enums/customProperties.ts +12 -0
- package/{models/enums/dashboardEnums.ts → enums/dashboards.ts} +5 -3
- package/enums/datas.ts +7 -0
- package/{models/enums/dateEnums.ts → enums/dates.ts} +23 -0
- package/enums/deviceExplorerElements.ts +5 -0
- package/enums/filters.ts +12 -0
- package/enums/index.ts +18 -0
- package/enums/lists.ts +4 -0
- package/enums/messages.ts +16 -0
- package/enums/roles.ts +7 -0
- package/enums/users.ts +14 -0
- package/models/authTokens/authTokenInfos.ts +3 -3
- package/models/index.ts +5 -3
- package/models/legalInformations/index.ts +2 -0
- package/models/legalInformations/legalInformationDetails.ts +10 -0
- package/models/legalInformations/legalInformationInfos.ts +17 -0
- package/models/notifications/index.ts +2 -0
- package/models/notifications/notificationDetails.ts +10 -0
- package/models/notifications/notificationInfos.ts +56 -0
- package/models/organisationTypes/organisationTypeDetails.ts +1 -1
- package/models/organisationTypes/organisationTypeInfos.ts +1 -1
- package/models/organisations/organisationDetails.ts +1 -1
- package/models/terminals/terminalInfos.ts +2 -2
- package/models/userLegalInformations/index.ts +2 -0
- package/models/userLegalInformations/userLegalInformationDetails.ts +14 -0
- package/models/userLegalInformations/userLegalInformationInfos.ts +17 -0
- package/package.json +2 -2
- package/tools/autoRefresh.ts +22 -0
- package/tools/datesTools.ts +13 -1
- package/tools/deviceExplorerElements.ts +34 -0
- package/tools/enumTools.ts +5 -0
- package/tools/index.ts +4 -0
- package/tools/notificationsTools.ts +39 -0
- package/models/enums/applicationEnums.ts +0 -5
- package/models/enums/index.ts +0 -6
- /package/{models/enums/alertEnums.ts → enums/alerts.ts} +0 -0
- /package/{models/enums/deviceEnums.ts → enums/connectivities.ts} +0 -0
- /package/{models/enums/timeUnit.ts → enums/times.ts} +0 -0
package/enums/actions.ts
ADDED
package/enums/agendas.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export enum Scope {
|
|
2
|
+
None = 0,
|
|
3
|
+
Public = 0b1111,
|
|
4
|
+
Application = 0b1000,
|
|
5
|
+
Organisation = 0b0100,
|
|
6
|
+
User = 0b0010,
|
|
7
|
+
UserOrganisation = 0b0001
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export enum ApplicationScope {
|
|
11
|
+
None = 0,
|
|
12
|
+
OrganisationType = 1,
|
|
13
|
+
Organisation = 2
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export enum EntityType {
|
|
17
|
+
None = 0,
|
|
18
|
+
Model = 1,
|
|
19
|
+
Group = 2,
|
|
20
|
+
Location = 3,
|
|
21
|
+
Device = 5,
|
|
22
|
+
User = 6,
|
|
23
|
+
Dashboard = 7,
|
|
24
|
+
Folder = 8
|
|
25
|
+
}
|
package/enums/charts.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
export enum ChartOrigin {
|
|
2
|
+
None = 0,
|
|
3
|
+
Organisation = 1,
|
|
4
|
+
OrganisationType = 2
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export enum ChartType {
|
|
8
|
+
None = 0,
|
|
9
|
+
XY = 1,
|
|
10
|
+
Pie = 2,
|
|
11
|
+
Heatmap = 3,
|
|
12
|
+
Slider = 4,
|
|
13
|
+
Gauge = 5,
|
|
14
|
+
ScoreCard = 6,
|
|
15
|
+
Table = 7
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export enum ColorSets {
|
|
19
|
+
Default = 0,
|
|
20
|
+
Grafana = 1,
|
|
21
|
+
Kelly = 2,
|
|
22
|
+
Armytage = 3,
|
|
23
|
+
ZeileisHornikMurrell = 4,
|
|
24
|
+
Hash = 5
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export enum AxisType {
|
|
28
|
+
None = 0,
|
|
29
|
+
Date = 1,
|
|
30
|
+
Value = 2,
|
|
31
|
+
Category = 3
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export enum SerieType {
|
|
35
|
+
None = 0,
|
|
36
|
+
Lines = 1,
|
|
37
|
+
Area = 2,
|
|
38
|
+
Range = 3,
|
|
39
|
+
Histogram = 4,
|
|
40
|
+
Operation = 5,
|
|
41
|
+
Planning = 6,
|
|
42
|
+
ScatterPlot = 7,
|
|
43
|
+
Top = 8,
|
|
44
|
+
Bars = 9,
|
|
45
|
+
StackedBars = 10,
|
|
46
|
+
Pie = 11,
|
|
47
|
+
Heatmap = 12,
|
|
48
|
+
Slider = 13,
|
|
49
|
+
Gauge = 14,
|
|
50
|
+
ScoreCard = 15,
|
|
51
|
+
Table = 16
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export enum PlotPer {
|
|
55
|
+
None = 0,
|
|
56
|
+
SinglePlot = 1,
|
|
57
|
+
Model = 2,
|
|
58
|
+
Group = 3,
|
|
59
|
+
Location = 4,
|
|
60
|
+
Device = 5
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export enum AggregationType {
|
|
64
|
+
None = 0,
|
|
65
|
+
Sum = 1,
|
|
66
|
+
Cardinal = 2,
|
|
67
|
+
Mean = 3,
|
|
68
|
+
Median = 4,
|
|
69
|
+
First = 5,
|
|
70
|
+
Last = 6,
|
|
71
|
+
Difference = 7,
|
|
72
|
+
Minimum = 8,
|
|
73
|
+
Maximum = 9,
|
|
74
|
+
Range = 10
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export enum PlanningType {
|
|
78
|
+
None = 0,
|
|
79
|
+
UntilNext = 1,
|
|
80
|
+
ElapsedTime = 2,
|
|
81
|
+
SinglePoint = 3
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export enum DisplayAs {
|
|
85
|
+
None = 0,
|
|
86
|
+
Bars = 1,
|
|
87
|
+
Lines = 2,
|
|
88
|
+
Points = 3
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export enum OperationOn {
|
|
92
|
+
None = 0,
|
|
93
|
+
SameGroup = 1,
|
|
94
|
+
SameEntity = 2,
|
|
95
|
+
SameGroupAndEntity = 3
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export enum HeatmapRule {
|
|
99
|
+
None = 0,
|
|
100
|
+
Gradient = 1,
|
|
101
|
+
Ranges = 2,
|
|
102
|
+
Fixed = 3
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export enum PieBreakdown {
|
|
106
|
+
Entity = 0,
|
|
107
|
+
Serie = 1,
|
|
108
|
+
Group = 2
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export enum Position {
|
|
112
|
+
None = 0,
|
|
113
|
+
Abscissa = 1,
|
|
114
|
+
Ordinate = 2
|
|
115
|
+
}
|
package/enums/datas.ts
ADDED
|
@@ -40,4 +40,27 @@ export enum Days {
|
|
|
40
40
|
Saturday = 5,
|
|
41
41
|
Sunday = 6,
|
|
42
42
|
AllDays = 7
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export enum DateType {
|
|
46
|
+
None = 0,
|
|
47
|
+
Local = 1,
|
|
48
|
+
UTC = 2
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export enum Months {
|
|
52
|
+
None = 0,
|
|
53
|
+
January = 1,
|
|
54
|
+
February = 2,
|
|
55
|
+
March = 3,
|
|
56
|
+
April = 4,
|
|
57
|
+
May = 5,
|
|
58
|
+
June = 6,
|
|
59
|
+
July = 7,
|
|
60
|
+
August = 8,
|
|
61
|
+
September = 9,
|
|
62
|
+
October = 10,
|
|
63
|
+
November = 11,
|
|
64
|
+
December = 12,
|
|
65
|
+
AllMonths = 13
|
|
43
66
|
}
|
package/enums/filters.ts
ADDED
package/enums/index.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from "./actions";
|
|
2
|
+
export * from "./agendas";
|
|
3
|
+
export * from "./alerts";
|
|
4
|
+
export * from "./applications";
|
|
5
|
+
export * from "./charts";
|
|
6
|
+
export * from "./connectivities";
|
|
7
|
+
export * from "./customProperties";
|
|
8
|
+
export * from "./dashboards";
|
|
9
|
+
export * from "./datas";
|
|
10
|
+
export * from "./dates";
|
|
11
|
+
export * from "./deviceExplorerElements";
|
|
12
|
+
export * from "./filters";
|
|
13
|
+
export * from "./index";
|
|
14
|
+
export * from "./lists";
|
|
15
|
+
export * from "./messages";
|
|
16
|
+
export * from "./roles";
|
|
17
|
+
export * from "./times";
|
|
18
|
+
export * from "./users";
|
package/enums/lists.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export enum MessageType {
|
|
2
|
+
None = 0,
|
|
3
|
+
UserApplicationCreation = 1,
|
|
4
|
+
UserOrganisationCreation = 2,
|
|
5
|
+
OrganisationCreation = 3,
|
|
6
|
+
UserApplicationAffectation = 4,
|
|
7
|
+
UserOrganisationAffectation = 5,
|
|
8
|
+
OrganisationAdminElevation = 6,
|
|
9
|
+
AccountInvitation = 7,
|
|
10
|
+
AccountValidation = 8,
|
|
11
|
+
PasswordReinitialisation = 9,
|
|
12
|
+
AlertCreation = 10,
|
|
13
|
+
AlertResolution = 11,
|
|
14
|
+
ConnectivityAlertCreation = 12,
|
|
15
|
+
ConnectivityAlertResolution = 13
|
|
16
|
+
}
|
package/enums/roles.ts
ADDED
package/enums/users.ts
ADDED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isoToEpoch } from "../../tools";
|
|
2
2
|
|
|
3
3
|
export class AuthTokenInfos {
|
|
4
4
|
id: string;
|
|
@@ -9,8 +9,8 @@ export class AuthTokenInfos {
|
|
|
9
9
|
constructor(params: AuthTokenInfosDTO) {
|
|
10
10
|
this.id = params.id;
|
|
11
11
|
this.label = params.label;
|
|
12
|
-
this.creationDate =
|
|
13
|
-
this.dateMax =
|
|
12
|
+
this.creationDate = isoToEpoch(params.creationDate);
|
|
13
|
+
this.dateMax = isoToEpoch(params.dateMax);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
package/models/index.ts
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
export * from "./applications";
|
|
2
2
|
export * from "./authTokens";
|
|
3
|
-
export * from "./enums"; // No service
|
|
4
3
|
export * from "./images";
|
|
5
|
-
export * from "./languages";
|
|
4
|
+
export * from "./languages"; // No service
|
|
5
|
+
export * from "./legalInformations";
|
|
6
6
|
export * from "./locations";
|
|
7
|
+
export * from "./notifications";
|
|
7
8
|
export * from "./organisations";
|
|
8
|
-
export * from "./organisationTypes";
|
|
9
|
+
export * from "./organisationTypes"; // No service
|
|
9
10
|
export * from "./permissions";
|
|
10
11
|
export * from "./terminals";
|
|
11
12
|
export * from "./timeZones";
|
|
12
13
|
export * from "./translations";
|
|
14
|
+
export * from "./userLegalInformations";
|
|
13
15
|
export * from "./users";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LegalInformationInfos, type LegalInformationInfosDTO } from "./legalInformationInfos";
|
|
2
|
+
|
|
3
|
+
export class LegalInformationDetails extends LegalInformationInfos {
|
|
4
|
+
constructor(params: LegalInformationDetailsDTO) {
|
|
5
|
+
super(params);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface LegalInformationDetailsDTO extends LegalInformationInfosDTO {
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class LegalInformationInfos {
|
|
2
|
+
id: string;
|
|
3
|
+
privacyPolicyId: string;
|
|
4
|
+
generalConditionsId: string;
|
|
5
|
+
|
|
6
|
+
constructor(params: LegalInformationInfosDTO) {
|
|
7
|
+
this.id = params.id;
|
|
8
|
+
this.privacyPolicyId = params.privacyPolicyId;
|
|
9
|
+
this.generalConditionsId = params.generalConditionsId;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface LegalInformationInfosDTO {
|
|
14
|
+
id: string;
|
|
15
|
+
privacyPolicyId: string;
|
|
16
|
+
generalConditionsId: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { NotificationInfos, type NotificationInfosDTO } from "./notificationInfos";
|
|
2
|
+
|
|
3
|
+
export class NotificationDetails extends NotificationInfos {
|
|
4
|
+
constructor(params: NotificationDetailsDTO) {
|
|
5
|
+
super(params);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface NotificationDetailsDTO extends NotificationInfosDTO {
|
|
10
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type Criticity, type MessageType, type Scope } from "@dative-gpi/foundation-shared-domain/enums";
|
|
2
|
+
import { isoToEpoch } from "@dative-gpi/foundation-shared-domain/tools";
|
|
3
|
+
|
|
4
|
+
export class NotificationInfos {
|
|
5
|
+
id: string;
|
|
6
|
+
title: string;
|
|
7
|
+
body: string;
|
|
8
|
+
pageUrl: string;
|
|
9
|
+
audienceId: string;
|
|
10
|
+
audienceScope: Scope;
|
|
11
|
+
organisationId?: string;
|
|
12
|
+
entityId?: string;
|
|
13
|
+
type: MessageType;
|
|
14
|
+
criticity: Criticity;
|
|
15
|
+
timestamp: number;
|
|
16
|
+
acknowledged: boolean | null;
|
|
17
|
+
acknowledgingTimestamp: number | null;
|
|
18
|
+
|
|
19
|
+
constructor(params: NotificationInfosDTO) {
|
|
20
|
+
this.id = params.id;
|
|
21
|
+
this.title = params.title;
|
|
22
|
+
this.body = params.body;
|
|
23
|
+
this.pageUrl = params.pageUrl;
|
|
24
|
+
this.audienceId = params.audienceId;
|
|
25
|
+
this.audienceScope = params.audienceScope as Scope;
|
|
26
|
+
this.organisationId = params.organisationId;
|
|
27
|
+
this.entityId = params.entityId;
|
|
28
|
+
this.type = params.type as MessageType;
|
|
29
|
+
this.criticity = params.criticity as Criticity;
|
|
30
|
+
this.timestamp = isoToEpoch(params.timestamp);
|
|
31
|
+
this.acknowledged = params.acknowledged;
|
|
32
|
+
this.acknowledgingTimestamp = params.acknowledgingTimestamp ?
|
|
33
|
+
isoToEpoch(params.acknowledgingTimestamp) : null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface NotificationInfosDTO {
|
|
38
|
+
id: string;
|
|
39
|
+
title: string;
|
|
40
|
+
body: string;
|
|
41
|
+
pageUrl: string;
|
|
42
|
+
audienceId: string;
|
|
43
|
+
audienceScope: number;
|
|
44
|
+
organisationId?: string;
|
|
45
|
+
entityId?: string;
|
|
46
|
+
type: number;
|
|
47
|
+
criticity: number;
|
|
48
|
+
timestamp: string;
|
|
49
|
+
acknowledged: boolean | null;
|
|
50
|
+
acknowledgingTimestamp: string | null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface NotificationFilters {
|
|
54
|
+
type?: MessageType | null;
|
|
55
|
+
criticity?: Criticity | null;
|
|
56
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OrganisationTypeInfosDTO } from "./organisationTypeInfos";
|
|
2
2
|
import { OrganisationTypeInfos } from "./organisationTypeInfos";
|
|
3
|
-
import type { DashboardType } from "
|
|
3
|
+
import type { DashboardType } from "../../enums/dashboards";
|
|
4
4
|
|
|
5
5
|
export class OrganisationTypeDetails extends OrganisationTypeInfos {
|
|
6
6
|
description: string;
|
|
@@ -2,7 +2,7 @@ import type { PermissionInfosDTO } from "../permissions/permissionInfos";
|
|
|
2
2
|
import { PermissionInfos } from "../permissions/permissionInfos";
|
|
3
3
|
import type { OrganisationInfosDTO } from "./organisationInfos";
|
|
4
4
|
import { OrganisationInfos } from "./organisationInfos";
|
|
5
|
-
import type { DashboardType } from "
|
|
5
|
+
import type { DashboardType } from "../../enums/dashboards";
|
|
6
6
|
|
|
7
7
|
export class OrganisationDetails extends OrganisationInfos {
|
|
8
8
|
code: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isoToEpoch } from "../../tools";
|
|
2
2
|
|
|
3
3
|
export class TerminalInfos {
|
|
4
4
|
id: string;
|
|
@@ -17,7 +17,7 @@ export class TerminalInfos {
|
|
|
17
17
|
this.icon = params.icon;
|
|
18
18
|
this.key = params.key;
|
|
19
19
|
this.location = params.location;
|
|
20
|
-
this.lastConnection =
|
|
20
|
+
this.lastConnection = isoToEpoch(params.lastConnection);
|
|
21
21
|
this.token = params.token;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { UserLegalInformationInfos, type UserLegalInformationInfosDTO } from "./userLegalInformationInfos";
|
|
2
|
+
|
|
3
|
+
export class UserLegalInformationDetails extends UserLegalInformationInfos {
|
|
4
|
+
constructor(params: UserLegalInformationDetailsDTO) {
|
|
5
|
+
super(params);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface UserLegalInformationDetailsDTO extends UserLegalInformationInfosDTO {
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface CreateUserLegalInformationDTO {
|
|
13
|
+
legalInformationId: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class UserLegalInformationInfos {
|
|
2
|
+
id: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
legalInformationId: string;
|
|
5
|
+
|
|
6
|
+
constructor(params: UserLegalInformationInfosDTO) {
|
|
7
|
+
this.id = params.id;
|
|
8
|
+
this.userId = params.userId;
|
|
9
|
+
this.legalInformationId = params.legalInformationId;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface UserLegalInformationInfosDTO {
|
|
14
|
+
id: string;
|
|
15
|
+
userId: string;
|
|
16
|
+
legalInformationId: string;
|
|
17
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-domain",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.28-remove-deprecated2",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
"peerDependencies": {
|
|
13
13
|
"date-fns": "^3.6.0"
|
|
14
14
|
},
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "65c182fd697939a07ad87c683a2f4c2fb765a7c7"
|
|
16
16
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AutoRefresh } from '../enums';
|
|
2
|
+
|
|
3
|
+
export const autoRefreshToSeconds = (autoRefresh: AutoRefresh): number => {
|
|
4
|
+
switch (autoRefresh) {
|
|
5
|
+
case AutoRefresh.FifteenSeconds:
|
|
6
|
+
return 15;
|
|
7
|
+
case AutoRefresh.ThirtySeconds:
|
|
8
|
+
return 30;
|
|
9
|
+
case AutoRefresh.OneMinute:
|
|
10
|
+
return 60;
|
|
11
|
+
case AutoRefresh.FiveMinutes:
|
|
12
|
+
return 300;
|
|
13
|
+
case AutoRefresh.FifteenMinutes:
|
|
14
|
+
return 900;
|
|
15
|
+
case AutoRefresh.ThirtyMinutes:
|
|
16
|
+
return 1800;
|
|
17
|
+
case AutoRefresh.OneHour:
|
|
18
|
+
return 3600;
|
|
19
|
+
default:
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
}
|
package/tools/datesTools.ts
CHANGED
|
@@ -3,6 +3,10 @@ import { parse } from "date-fns";
|
|
|
3
3
|
export const ISO_FORMAT: string = "yyyy-MM-dd'T'HH:mm:ss";
|
|
4
4
|
|
|
5
5
|
export const OPTIONS: { [key: string]: Intl.DateTimeFormatOptions } = {
|
|
6
|
+
dayMonthLongOnly: {
|
|
7
|
+
day: "2-digit",
|
|
8
|
+
month: "long"
|
|
9
|
+
},
|
|
6
10
|
shortDate: {
|
|
7
11
|
day: "2-digit",
|
|
8
12
|
month: "2-digit",
|
|
@@ -31,14 +35,22 @@ export const OPTIONS: { [key: string]: Intl.DateTimeFormatOptions } = {
|
|
|
31
35
|
minute: "2-digit",
|
|
32
36
|
second: "2-digit"
|
|
33
37
|
},
|
|
38
|
+
monthYearOnly: {
|
|
39
|
+
month: "long",
|
|
40
|
+
year: "numeric"
|
|
41
|
+
},
|
|
34
42
|
time: {
|
|
35
43
|
hour: "2-digit",
|
|
36
44
|
minute: "2-digit",
|
|
37
45
|
second: "2-digit"
|
|
46
|
+
},
|
|
47
|
+
shortTimeOnly: {
|
|
48
|
+
hour: "2-digit",
|
|
49
|
+
minute: "2-digit"
|
|
38
50
|
}
|
|
39
51
|
};
|
|
40
52
|
|
|
41
|
-
export const
|
|
53
|
+
export const isoToEpoch = (value: string): number => {
|
|
42
54
|
return parse(value.substring(0, 19) + "Z", ISO_FORMAT + "X", new Date()).getTime();
|
|
43
55
|
};
|
|
44
56
|
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type DeviceExplorerElementInfos, type DeviceOrganisationInfos, type GroupInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
2
|
+
|
|
3
|
+
import { DeviceExplorerElementType } from "../enums";
|
|
4
|
+
|
|
5
|
+
export const fromDeviceOrganisation = (deviceOrganisation: DeviceOrganisationInfos): DeviceExplorerElementInfos => ({
|
|
6
|
+
...deviceOrganisation,
|
|
7
|
+
type: DeviceExplorerElementType.DeviceOrganisation,
|
|
8
|
+
parentId: deviceOrganisation.groupId,
|
|
9
|
+
icon: null,
|
|
10
|
+
groupsIds: null,
|
|
11
|
+
deviceOrganisationsIds: null,
|
|
12
|
+
modelsIds: null,
|
|
13
|
+
recursiveGroupsIds: null,
|
|
14
|
+
recursiveDeviceOrganisationsIds: null,
|
|
15
|
+
recursiveModelsIds: null
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const fromGroup = (group: GroupInfos): DeviceExplorerElementInfos => ({
|
|
19
|
+
...group,
|
|
20
|
+
type: DeviceExplorerElementType.Group,
|
|
21
|
+
manufacturerLabel: null,
|
|
22
|
+
articleLabel: null,
|
|
23
|
+
modelLabel: null,
|
|
24
|
+
ownerLabel: null,
|
|
25
|
+
managerName: null,
|
|
26
|
+
unrestricted: null,
|
|
27
|
+
online: null,
|
|
28
|
+
meta: null,
|
|
29
|
+
modelStatuses: null,
|
|
30
|
+
status: null,
|
|
31
|
+
connectivity: null,
|
|
32
|
+
alerts: null,
|
|
33
|
+
worstAlert: null
|
|
34
|
+
});
|
package/tools/index.ts
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type NotificationInfos } from "../models";
|
|
2
|
+
import { Criticity, Scope } from "../enums";
|
|
3
|
+
|
|
4
|
+
export const getFromAudience = (
|
|
5
|
+
notifications: NotificationInfos[],
|
|
6
|
+
application: boolean,
|
|
7
|
+
criticity: Criticity,
|
|
8
|
+
organisationId?: string | null,
|
|
9
|
+
userId?: string | null,
|
|
10
|
+
): NotificationInfos[] => notifications.filter((n: NotificationInfos) => {
|
|
11
|
+
if (n.acknowledged) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (![Criticity.None, n.criticity].includes(criticity)) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
switch (n.audienceScope) {
|
|
18
|
+
case Scope.Organisation :
|
|
19
|
+
case Scope.UserOrganisation: return organisationId && n.organisationId && n.organisationId === organisationId;
|
|
20
|
+
case Scope.User : return userId && n.audienceId === userId;
|
|
21
|
+
case Scope.Application :
|
|
22
|
+
case Scope.Public : return application;
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
return false;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export const getForDrawer = (
|
|
29
|
+
notifications: NotificationInfos[],
|
|
30
|
+
organisationId: string,
|
|
31
|
+
userId: string,
|
|
32
|
+
criticity: Criticity = Criticity.None
|
|
33
|
+
): NotificationInfos[] => getFromAudience(notifications, true, criticity, organisationId, userId);
|
|
34
|
+
|
|
35
|
+
export const getForCard = (
|
|
36
|
+
notifications: NotificationInfos[],
|
|
37
|
+
organisationId: string,
|
|
38
|
+
criticity: Criticity = Criticity.None
|
|
39
|
+
): NotificationInfos[] => getFromAudience(notifications, false, criticity, organisationId, null);
|
package/models/enums/index.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|