@dative-gpi/foundation-core-domain 1.0.136-maps → 1.0.136-override-widgets
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/dashboardShallowWidgets/dashboardShallowWidgetDetails.ts +4 -0
- package/models/dashboardShallowWidgets/dashboardShallowWidgetInfos.ts +30 -0
- package/models/dashboardShallowWidgets/index.ts +2 -0
- package/models/dashboardShallows/dashboardShallowDetails.ts +25 -25
- package/models/index.ts +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
|
|
3
|
+
const clean = <T>(meta: T): T => {
|
|
4
|
+
const newMeta = _.cloneDeepWith(meta, (value) => {
|
|
5
|
+
if (typeof value === "string") {
|
|
6
|
+
try {
|
|
7
|
+
return JSON.parse(value as string);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return value
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
return newMeta;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class DashboardShallowWidgetInfos {
|
|
18
|
+
widgetId: string;
|
|
19
|
+
meta: { [key: string]: string };
|
|
20
|
+
|
|
21
|
+
constructor(params: DashboardShallowWidgetInfosDTO) {
|
|
22
|
+
this.widgetId = params.widgetId;
|
|
23
|
+
this.meta = clean(params.meta);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface DashboardShallowWidgetInfosDTO {
|
|
28
|
+
widgetId: string;
|
|
29
|
+
meta: { [key: string]: string };
|
|
30
|
+
}
|
|
@@ -1,42 +1,32 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
3
|
-
import type
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import type
|
|
8
|
-
import {
|
|
9
|
-
import type
|
|
10
|
-
import {
|
|
11
|
-
import type
|
|
12
|
-
import { DashboardVariableInfos } from "../dashboardVariables";
|
|
13
|
-
import type { DashboardShallowInfosDTO } from "./dashboardShallowInfos";
|
|
14
|
-
import { DashboardShallowInfos } from "./dashboardShallowInfos";
|
|
15
|
-
import type { DashboardTranslationDTO } from "../dashboards";
|
|
16
|
-
import { DashboardTranslation } from "../dashboards";
|
|
17
|
-
import type { WidgetInfosDTO } from "../widgets/widgetInfos";
|
|
18
|
-
import { WidgetInfos } from "../widgets/widgetInfos";
|
|
19
|
-
import type { PathCrumbDTO } from "../shared/pathCrumb";
|
|
20
|
-
import { PathCrumb } from "../shared/pathCrumb";
|
|
21
|
-
|
|
1
|
+
import { type CreateDashboardShallowEntityPresetDTO, DashboardShallowEntityPresetInfos, type DashboardShallowEntityPresetInfosDTO } from "../dashboardShallowEntityPresets";
|
|
2
|
+
import { type CreateDashboardShallowDatePresetDTO, DashboardShallowDatePresetInfos, type DashboardShallowDatePresetInfosDTO } from "../dashboardShallowDatePresets";
|
|
3
|
+
import { type CreateDashboardShallowVariableDTO, DashboardShallowVariableInfos, type DashboardShallowVariableInfosDTO } from "../dashboardShallowVariables";
|
|
4
|
+
import { type CreateDashboardShallowWidgetDTO, DashboardShallowWidgetInfos, type DashboardShallowWidgetInfosDTO } from "../dashboardShallowWidgets";
|
|
5
|
+
import { DashboardEntityPresetInfos, type DashboardEntityPresetInfosDTO } from "../dashboardEntityPresets";
|
|
6
|
+
import { DashboardDatePresetInfos, type DashboardDatePresetInfosDTO } from "../dashboardDatePresets";
|
|
7
|
+
import { DashboardVariableInfos, type DashboardVariableInfosDTO } from "../dashboardVariables";
|
|
8
|
+
import { DashboardShallowInfos, type DashboardShallowInfosDTO } from "./dashboardShallowInfos";
|
|
9
|
+
import { DashboardTranslation, type DashboardTranslationDTO } from "../dashboards";
|
|
10
|
+
import { WidgetInfos, type WidgetInfosDTO } from "../widgets/widgetInfos";
|
|
11
|
+
import { PathCrumb, type PathCrumbDTO } from "../shared/pathCrumb";
|
|
22
12
|
|
|
23
13
|
export class DashboardShallowDetails extends DashboardShallowInfos {
|
|
24
14
|
labelDefault: string;
|
|
25
15
|
translations: DashboardTranslation[];
|
|
26
16
|
path: PathCrumb[];
|
|
27
17
|
|
|
28
|
-
widgets: WidgetInfos[];
|
|
29
|
-
|
|
30
18
|
entityPresetCode: string | null;
|
|
31
19
|
datePresetCode: string | null;
|
|
32
20
|
variableCode: string | null;
|
|
33
21
|
defaultDatePresets: DashboardDatePresetInfos[];
|
|
34
22
|
defaultEntityPresets: DashboardEntityPresetInfos[];
|
|
35
23
|
defaultVariables: DashboardVariableInfos[];
|
|
24
|
+
defaultWidgets: WidgetInfos[];
|
|
36
25
|
|
|
37
26
|
overrideDatePresets: DashboardShallowDatePresetInfos[];
|
|
38
27
|
overrideEntityPresets: DashboardShallowEntityPresetInfos[];
|
|
39
28
|
overrideVariables: DashboardShallowVariableInfos[];
|
|
29
|
+
overrideWidgets: DashboardShallowWidgetInfos[];
|
|
40
30
|
|
|
41
31
|
get datePresets() : DashboardDatePresetInfos[] {
|
|
42
32
|
return this.defaultDatePresets.map(d => {
|
|
@@ -59,17 +49,24 @@ export class DashboardShallowDetails extends DashboardShallowInfos {
|
|
|
59
49
|
});
|
|
60
50
|
}
|
|
61
51
|
|
|
52
|
+
get widgets() {
|
|
53
|
+
return this.defaultWidgets.map(d => {
|
|
54
|
+
const override = this.overrideWidgets.find(od => od.widgetId === d.id);
|
|
55
|
+
return override ? new WidgetInfos({ ...d, ...override }) : d;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
62
59
|
constructor(params: DashboardShallowDetailsDTO) {
|
|
63
60
|
super(params);
|
|
64
61
|
|
|
65
62
|
this.labelDefault = params.labelDefault;
|
|
66
63
|
this.path = params.path.map(dto => new PathCrumb(dto)).sort((a, b) => b.index - a.index);
|
|
67
64
|
this.translations = params.translations.map(t => new DashboardTranslation(t));
|
|
68
|
-
this.widgets = params.widgets.map(dto => new WidgetInfos(dto));
|
|
69
65
|
|
|
70
66
|
this.overrideDatePresets = params.overrideDatePresets.map(dto => new DashboardShallowDatePresetInfos(dto));
|
|
71
67
|
this.overrideEntityPresets = params.overrideEntityPresets.map(dto => new DashboardShallowEntityPresetInfos(dto));
|
|
72
68
|
this.overrideVariables = params.overrideVariables.map(dto => new DashboardShallowVariableInfos(dto));
|
|
69
|
+
this.overrideWidgets = params.overrideWidgets.map(dto => new DashboardShallowWidgetInfos(dto));
|
|
73
70
|
|
|
74
71
|
this.entityPresetCode = params.entityPresetCode;
|
|
75
72
|
this.datePresetCode = params.datePresetCode;
|
|
@@ -77,6 +74,7 @@ export class DashboardShallowDetails extends DashboardShallowInfos {
|
|
|
77
74
|
this.defaultDatePresets = params.defaultDatePresets.map(dto => new DashboardDatePresetInfos(dto));
|
|
78
75
|
this.defaultEntityPresets = params.defaultEntityPresets.map(dto => new DashboardEntityPresetInfos(dto));
|
|
79
76
|
this.defaultVariables = params.defaultVariables.map(dto => new DashboardVariableInfos(dto));
|
|
77
|
+
this.defaultWidgets = params.defaultWidgets.map(dto => new WidgetInfos(dto));
|
|
80
78
|
}
|
|
81
79
|
}
|
|
82
80
|
|
|
@@ -86,6 +84,7 @@ export interface DashboardShallowDetailsDTO extends DashboardShallowInfosDTO {
|
|
|
86
84
|
overrideDatePresets: DashboardShallowDatePresetInfosDTO[];
|
|
87
85
|
overrideEntityPresets: DashboardShallowEntityPresetInfosDTO[];
|
|
88
86
|
overrideVariables: DashboardShallowVariableInfosDTO[];
|
|
87
|
+
overrideWidgets: DashboardShallowWidgetInfosDTO[];
|
|
89
88
|
translations: DashboardTranslationDTO[];
|
|
90
89
|
dashboardId: string;
|
|
91
90
|
scope: number;
|
|
@@ -95,7 +94,7 @@ export interface DashboardShallowDetailsDTO extends DashboardShallowInfosDTO {
|
|
|
95
94
|
defaultDatePresets: DashboardDatePresetInfosDTO[];
|
|
96
95
|
defaultEntityPresets: DashboardEntityPresetInfosDTO[];
|
|
97
96
|
defaultVariables: DashboardVariableInfosDTO[];
|
|
98
|
-
|
|
97
|
+
defaultWidgets: WidgetInfosDTO[];
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
export interface CreateDashboardShallowDTO {
|
|
@@ -114,6 +113,7 @@ export interface UpdateDashboardShallowDTO {
|
|
|
114
113
|
overrideDatePresets: CreateDashboardShallowDatePresetDTO[];
|
|
115
114
|
overrideEntityPresets: CreateDashboardShallowEntityPresetDTO[];
|
|
116
115
|
overrideVariables: CreateDashboardShallowVariableDTO[];
|
|
116
|
+
overrideWidgets: CreateDashboardShallowWidgetDTO[];
|
|
117
117
|
translations: DashboardTranslationDTO[];
|
|
118
118
|
}
|
|
119
119
|
|
package/models/index.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from "./dashboardShallowDatePresets"; // No service
|
|
|
19
19
|
export * from "./dashboardShallowEntityPresets"; // No service
|
|
20
20
|
export * from "./dashboardShallows";
|
|
21
21
|
export * from "./dashboardShallowVariables"; // No service
|
|
22
|
+
export * from "./dashboardShallowWidgets"; // No service
|
|
22
23
|
export * from "./dashboardVariables"; // No service
|
|
23
24
|
export * from "./dashboardVariableValues"; // No service
|
|
24
25
|
export * from "./dataCategories";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-core-domain",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "1.0.136-
|
|
4
|
+
"version": "1.0.136-override-widgets",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dative-gpi/foundation-shared-domain": "1.0.136-
|
|
14
|
-
"@dative-gpi/foundation-shared-services": "1.0.136-
|
|
13
|
+
"@dative-gpi/foundation-shared-domain": "1.0.136-override-widgets",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "1.0.136-override-widgets"
|
|
15
15
|
},
|
|
16
|
-
"gitHead": "
|
|
16
|
+
"gitHead": "c2765a250ad2c493b88f3801f13ddd71405e898a"
|
|
17
17
|
}
|