@dative-gpi/foundation-core-domain 1.1.12 → 1.1.13

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.
@@ -0,0 +1,50 @@
1
+ import { DashboardExplorerElementInfos, type DashboardExplorerElementInfosDTO } from "./dashboardExplorerElementInfos";
2
+
3
+ export class DashboardExplorerElementDetails extends DashboardExplorerElementInfos {
4
+ // DashboardOrganisation & DashboardShallow
5
+ folderId: string | null;
6
+ folderLabel: string | null;
7
+ folderIcon: string | null;
8
+
9
+ // DashboardShallow
10
+ dashboardOrganisationTypeId: string | null;
11
+ dashboardOrganisationTypeLabel: string | null;
12
+
13
+ // DashboardOrganisationType
14
+ organisationTypeId: string | null;
15
+ organisationTypeLabel: string | null;
16
+
17
+ // Dashboard
18
+ dashboardId: string | null;
19
+
20
+
21
+ constructor(params: DashboardExplorerElementDetailsDTO) {
22
+ super(params);
23
+ this.folderId = params.folderId ?? null;
24
+ this.folderLabel = params.folderLabel ?? null;
25
+ this.folderIcon = params.folderIcon ?? null;
26
+ this.dashboardOrganisationTypeId = params.dashboardOrganisationTypeId ?? null;
27
+ this.dashboardOrganisationTypeLabel = params.dashboardOrganisationTypeLabel ?? null;
28
+ this.organisationTypeId = params.organisationTypeId ?? null;
29
+ this.organisationTypeLabel = params.organisationTypeLabel ?? null;
30
+ this.dashboardId = params.dashboardId ?? null;
31
+ }
32
+ }
33
+
34
+ export interface DashboardExplorerElementDetailsDTO extends DashboardExplorerElementInfosDTO {
35
+ // DashboardOrganisation & DashboardShallow
36
+ folderId?: string;
37
+ folderLabel?: string | null;
38
+ folderIcon?: string | null;
39
+
40
+ // DashboardShallow
41
+ dashboardOrganisationTypeId?: string | null;
42
+ dashboardOrganisationTypeLabel?: string | null;
43
+
44
+ // DashboardOrganisationType
45
+ organisationTypeId?: string | null;
46
+ organisationTypeLabel?: string | null;
47
+
48
+ // Dashboard
49
+ dashboardId?: string | null;
50
+ }
@@ -0,0 +1,110 @@
1
+ import type { ApplicationScope, DashboardExplorerElementType } from "@dative-gpi/foundation-shared-domain/enums";
2
+ import { DashboardExplorerElementType as DashboardExplorerElementTypeEnum } from "@dative-gpi/foundation-shared-domain/enums";
3
+
4
+ import { PathCrumb, type PathCrumbDTO } from "../shared/pathCrumb";
5
+ import type { DashboardOrganisationInfos } from "../dashboardOrganisations/dashboardOrganisationInfos";
6
+ import type { DashboardShallowInfos } from "../dashboardShallows/dashboardShallowInfos";
7
+ import type { DashboardOrganisationTypeInfos } from "../dashboardOrganisationTypes/dashboardOrganisationTypeInfos";
8
+ import type { FolderInfos } from "../folders/folderInfos";
9
+
10
+ export class DashboardExplorerElementInfos {
11
+ id: string;
12
+ imageId: string | null;
13
+ label: string;
14
+ code: string;
15
+ icon: string;
16
+ tags: string[];
17
+ colors: string[];
18
+ type: DashboardExplorerElementType;
19
+
20
+ // Folder
21
+ parentId: string | null;
22
+ parentLabel: string | null;
23
+ parentIcon: string | null;
24
+ recursiveFoldersIds: string[] | null;
25
+ recursiveDashboardOrganisationsIds: string[] | null;
26
+ recursiveDashboardShallowsIds: string[] | null;
27
+ path: PathCrumb[];
28
+ // Dashboard
29
+ scope: ApplicationScope | null;
30
+ locked: boolean | null;
31
+
32
+ constructor(params: DashboardExplorerElementInfosDTO) {
33
+ this.id = params.id;
34
+ this.imageId = params.imageId;
35
+ this.label = params.label;
36
+ this.code = params.code;
37
+ this.icon = params.icon;
38
+ this.tags = params.tags?.slice() ?? [];
39
+ this.colors = params.colors?.slice() ?? [];
40
+ this.type = params.type;
41
+
42
+ this.parentId = params.parentId ?? null;
43
+ this.parentLabel = params.parentLabel ?? null;
44
+ this.parentIcon = params.parentIcon ?? null;
45
+ this.recursiveFoldersIds = params.recursiveFoldersIds?.slice() ?? null;
46
+ this.recursiveDashboardOrganisationsIds = params.recursiveDashboardOrganisationsIds?.slice() ?? null;
47
+ this.recursiveDashboardShallowsIds = params.recursiveDashboardShallowsIds?.slice() ?? null;
48
+ this.path = params.path?.map(dto => new PathCrumb({ ...dto })).sort((a, b) => b.index - a.index) ?? [];
49
+
50
+ this.scope = params.scope ?? null;
51
+ this.locked = params.locked ?? null;
52
+ }
53
+
54
+ static fromDashboardOrganisation = (d: DashboardOrganisationInfos): DashboardExplorerElementInfos => new DashboardExplorerElementInfos({
55
+ ...d,
56
+ type: DashboardExplorerElementTypeEnum.DashboardOrganisation,
57
+ parentId: d.folderId,
58
+ parentLabel: d.folderLabel,
59
+ parentIcon: d.folderIcon
60
+ });
61
+
62
+ static fromDashboardShallow = (d: DashboardShallowInfos): DashboardExplorerElementInfos => new DashboardExplorerElementInfos({
63
+ ...d,
64
+ type: DashboardExplorerElementTypeEnum.DashboardShallow,
65
+ parentId: d.folderId,
66
+ parentLabel: d.folderLabel,
67
+ parentIcon: d.folderIcon
68
+ });
69
+
70
+ static fromDashboardOrganisationType = (d: DashboardOrganisationTypeInfos): DashboardExplorerElementInfos => new DashboardExplorerElementInfos({
71
+ ...d,
72
+ type: DashboardExplorerElementTypeEnum.DashboardOrganisationType
73
+ });
74
+
75
+ static fromFolder = (f: FolderInfos): DashboardExplorerElementInfos => new DashboardExplorerElementInfos({
76
+ ...f,
77
+ type: DashboardExplorerElementTypeEnum.Folder
78
+ });
79
+ }
80
+
81
+ export interface DashboardExplorerElementInfosDTO {
82
+ id: string;
83
+ imageId: string | null;
84
+ label: string;
85
+ code: string;
86
+ icon: string;
87
+ tags: string[];
88
+ colors: string[];
89
+ type: DashboardExplorerElementType;
90
+
91
+ parentId?: string | null;
92
+ parentLabel?: string | null;
93
+ parentIcon?: string | null;
94
+ recursiveFoldersIds?: string[] | null;
95
+ recursiveDashboardOrganisationsIds?: string[] | null;
96
+ recursiveDashboardShallowsIds?: string[] | null;
97
+ path?: PathCrumbDTO[];
98
+
99
+ scope?: ApplicationScope | null;
100
+ locked?: boolean | null;
101
+ }
102
+
103
+ export interface DashboardExplorerElementFilters {
104
+ dashboardExplorerElementsIds?: string[] | null;
105
+ ancestorId?: string | null;
106
+ parentId?: string | null;
107
+ root?: boolean | null;
108
+ search?: string | null;
109
+ types?: DashboardExplorerElementType[] | null;
110
+ }
@@ -0,0 +1,2 @@
1
+ export * from "./dashboardExplorerElementDetails";
2
+ export * from "./dashboardExplorerElementInfos";
@@ -75,36 +75,20 @@ export class DeviceExplorerElementInfos {
75
75
  this.worstAlert = params.worstAlert ? new DeviceOrganisationAlert(params.worstAlert) : null;
76
76
  }
77
77
 
78
- static fromDeviceOrganisation = (deviceOrganisation: DeviceOrganisationInfos): DeviceExplorerElementInfos => ({
78
+ static fromDeviceOrganisation = (deviceOrganisation: DeviceOrganisationInfos): DeviceExplorerElementInfos => new DeviceExplorerElementInfos({
79
79
  ...deviceOrganisation,
80
80
  type: DeviceExplorerElementType.DeviceOrganisation,
81
81
  parentId: deviceOrganisation.groupId,
82
- icon: null,
83
- groupsIds: null,
84
- deviceOrganisationsIds: null,
85
- modelsIds: null,
86
- recursiveGroupsIds: null,
87
- recursiveDeviceOrganisationsIds: null,
88
- recursiveModelsIds: null
89
- });
90
-
91
- static fromGroup = (group: GroupInfos): DeviceExplorerElementInfos => ({
92
- ...group,
93
- type: DeviceExplorerElementType.Group,
94
- manufacturerLabel: null,
95
- articleLabel: null,
96
- modelLabel: null,
97
- ownerLabel: null,
98
- managerName: null,
99
- unrestricted: null,
100
- online: null,
101
- meta: null,
102
- modelStatuses: null,
103
82
  status: null,
104
83
  connectivity: null,
105
84
  alerts: null,
106
85
  worstAlert: null
107
86
  });
87
+
88
+ static fromGroup = (group: GroupInfos): DeviceExplorerElementInfos => new DeviceExplorerElementInfos({
89
+ ...group,
90
+ type: DeviceExplorerElementType.Group
91
+ });
108
92
  }
109
93
 
110
94
  export interface DeviceExplorerElementInfosDTO {
package/models/index.ts CHANGED
@@ -13,6 +13,7 @@ export * from "./customProperties";
13
13
  export * from "./customPropertyValues";
14
14
  export * from "./dashboardDatePresets"; // No service
15
15
  export * from "./dashboardEntityPresets"; // No service
16
+ export * from "./dashboardExplorerElements";
16
17
  export * from "./dashboardOrganisations";
17
18
  export * from "./dashboardOrganisationTypes";
18
19
  export * from "./dashboards";
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "url": "https://github.com/Dative-GPI/foundation-shared-ui.git"
5
5
  },
6
6
  "sideEffects": false,
7
- "version": "1.1.12",
7
+ "version": "1.1.13",
8
8
  "description": "",
9
9
  "publishConfig": {
10
10
  "access": "public"
@@ -13,8 +13,8 @@
13
13
  "author": "",
14
14
  "license": "ISC",
15
15
  "dependencies": {
16
- "@dative-gpi/foundation-shared-domain": "1.1.12",
17
- "@dative-gpi/foundation-shared-services": "1.1.12"
16
+ "@dative-gpi/foundation-shared-domain": "1.1.13",
17
+ "@dative-gpi/foundation-shared-services": "1.1.13"
18
18
  },
19
- "gitHead": "9ad6a2732e79fef8289b5c606efaf027ea0cd5ba"
19
+ "gitHead": "808ff91c2715ee0c9201227529471b0a428861c1"
20
20
  }