@dative-gpi/foundation-core-services 1.1.11 → 1.1.12-dashboards-explorer-02
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/composables/services/index.ts +1 -0
- package/composables/services/useAggregateValue.ts +2 -2
- package/composables/services/useDashboardExplorerElements.ts +114 -0
- package/composables/services/useDashboardOrganisationTypes.ts +1 -0
- package/composables/services/useDashboardOrganisations.ts +1 -0
- package/composables/services/useDashboardShallows.ts +1 -0
- package/composables/services/useFolders.ts +1 -0
- package/config/urls/dashboardExplorerElements.ts +3 -0
- package/config/urls/index.ts +1 -0
- package/package.json +3 -3
|
@@ -14,6 +14,7 @@ export * from "./useCustomPropertyValues";
|
|
|
14
14
|
export * from "./useDashboardOrganisations";
|
|
15
15
|
export * from "./useDashboardOrganisationTypes";
|
|
16
16
|
export * from "./useDashboards";
|
|
17
|
+
export * from "./useDashboardExplorerElements";
|
|
17
18
|
export * from "./useDashboardShallows";
|
|
18
19
|
export * from "./useDataCategories";
|
|
19
20
|
export * from "./useDataDefinitions";
|
|
@@ -4,7 +4,7 @@ import { uuidv4 } from "@dative-gpi/bones-ui";
|
|
|
4
4
|
|
|
5
5
|
import { getManyDatas } from "@dative-gpi/foundation-core-services/composables";
|
|
6
6
|
|
|
7
|
-
import { RootMode } from "@dative-gpi/foundation-shared-domain/enums";
|
|
7
|
+
import { PlotPer, RootMode } from "@dative-gpi/foundation-shared-domain/enums";
|
|
8
8
|
|
|
9
9
|
import type { DataFiltersDTO, DataLeafDTO, AggregateValueFilter } from "@dative-gpi/foundation-core-domain/models";
|
|
10
10
|
|
|
@@ -21,7 +21,7 @@ export const useAggregateValue = () => {
|
|
|
21
21
|
entitiesIds: filter.entitiesIds,
|
|
22
22
|
entityType: filter.entityType,
|
|
23
23
|
labelTemplate: "",
|
|
24
|
-
aggregateByEntity:
|
|
24
|
+
aggregateByEntity: PlotPer.SinglePlot,
|
|
25
25
|
aggregationTimeStep: undefined,
|
|
26
26
|
duration: 0,
|
|
27
27
|
durationTimeStep: undefined,
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
|
|
3
|
+
import { DashboardExplorerElementDetails, type DashboardExplorerElementDetailsDTO, type DashboardExplorerElementFilters, DashboardExplorerElementInfos, type DashboardExplorerElementInfosDTO, type DashboardOrganisationDetails, type DashboardOrganisationTypeDetails, type DashboardShallowDetails, type FolderDetails } from "@dative-gpi/foundation-core-domain/models";
|
|
4
|
+
import { type AddOrUpdateCallback, type DeleteCallback, type NotifyEvent, onCollectionChanged } from "@dative-gpi/bones-ui";
|
|
5
|
+
import { ServiceFactory } from "@dative-gpi/bones-ui/core";
|
|
6
|
+
|
|
7
|
+
import { DASHBOARD_EXPLORER_ELEMENTS_URL } from "../../config/urls";
|
|
8
|
+
|
|
9
|
+
import { useSubscribeToDashboardOrganisations } from "./useDashboardOrganisations";
|
|
10
|
+
import { useSubscribeToDashboardShallows } from "./useDashboardShallows";
|
|
11
|
+
import { useSubscribeToDashboardOrganisationTypes } from "./useDashboardOrganisationTypes";
|
|
12
|
+
import { useSubscribeToFolders } from "./useFolders";
|
|
13
|
+
|
|
14
|
+
const DashboardExplorerElementServiceFactory = new ServiceFactory<DashboardExplorerElementDetailsDTO, DashboardExplorerElementDetails>("dashboardExplorerElement", DashboardExplorerElementDetails).create(factory => factory.build(
|
|
15
|
+
factory.addGetMany<DashboardExplorerElementInfosDTO, DashboardExplorerElementInfos, DashboardExplorerElementFilters>(DASHBOARD_EXPLORER_ELEMENTS_URL, DashboardExplorerElementInfos),
|
|
16
|
+
factory.addNotify()
|
|
17
|
+
));
|
|
18
|
+
|
|
19
|
+
export const useDashboardExplorerElements = () => {
|
|
20
|
+
const { subscribe: subscribeToDashboardOrganisations } = useSubscribeToDashboardOrganisations();
|
|
21
|
+
const { subscribe: subscribeToDashboardShallows } = useSubscribeToDashboardShallows();
|
|
22
|
+
const { subscribe: subscribeToDashboardOrganisationTypes } = useSubscribeToDashboardOrganisationTypes();
|
|
23
|
+
const { subscribe: subscribeToFolders } = useSubscribeToFolders();
|
|
24
|
+
|
|
25
|
+
const fetching = ref(false);
|
|
26
|
+
const entities = ref<DashboardExplorerElementInfos[]>([]);
|
|
27
|
+
const filters = ref<DashboardExplorerElementFilters>();
|
|
28
|
+
|
|
29
|
+
const getMany = async (filter?: DashboardExplorerElementFilters) => {
|
|
30
|
+
fetching.value = true;
|
|
31
|
+
filters.value = filter;
|
|
32
|
+
|
|
33
|
+
const filterMethod = (el: DashboardExplorerElementInfos): boolean => {
|
|
34
|
+
if (!filters.value) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
if (filters.value.types && !filters.value.types.includes(el.type)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (filters.value.dashboardExplorerElementsIds) {
|
|
41
|
+
return filters.value.dashboardExplorerElementsIds.includes(el.id);
|
|
42
|
+
}
|
|
43
|
+
if (!filters.value.search) {
|
|
44
|
+
return (!!filters.value.root && !el.parentId) || (!!filters.value.parentId && filters.value.parentId === el.parentId);
|
|
45
|
+
}
|
|
46
|
+
const fullText = `${el.label} ${el.code} ${el.tags.join(" ")}`;
|
|
47
|
+
return (!filters.value.parentId || el.path.some(p => p.id === filters.value!.parentId)) &&
|
|
48
|
+
fullText.toLowerCase().includes(filters.value.search!.toLowerCase());
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const onCollectionChangedCustom = onCollectionChanged(entities, filterMethod);
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
entities.value = await DashboardExplorerElementServiceFactory.getMany(filters.value);
|
|
55
|
+
|
|
56
|
+
subscribeToDashboardOrganisations("all", (ev: NotifyEvent, el: DashboardOrganisationDetails | any) => {
|
|
57
|
+
switch (ev) {
|
|
58
|
+
case "add":
|
|
59
|
+
case "update":
|
|
60
|
+
(onCollectionChangedCustom as AddOrUpdateCallback<DashboardExplorerElementInfos>)(ev, DashboardExplorerElementInfos.fromDashboardOrganisation(el));
|
|
61
|
+
break;
|
|
62
|
+
case "delete":
|
|
63
|
+
(onCollectionChangedCustom as DeleteCallback)(ev, el);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
subscribeToDashboardShallows("all", (ev: NotifyEvent, el: DashboardShallowDetails | any) => {
|
|
69
|
+
switch (ev) {
|
|
70
|
+
case "add":
|
|
71
|
+
case "update":
|
|
72
|
+
(onCollectionChangedCustom as AddOrUpdateCallback<DashboardExplorerElementInfos>)(ev, DashboardExplorerElementInfos.fromDashboardShallow(el));
|
|
73
|
+
break;
|
|
74
|
+
case "delete":
|
|
75
|
+
(onCollectionChangedCustom as DeleteCallback)(ev, el);
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
subscribeToDashboardOrganisationTypes("all", (ev: NotifyEvent, el: DashboardOrganisationTypeDetails | any) => {
|
|
81
|
+
switch (ev) {
|
|
82
|
+
case "add":
|
|
83
|
+
case "update":
|
|
84
|
+
(onCollectionChangedCustom as AddOrUpdateCallback<DashboardExplorerElementInfos>)(ev, DashboardExplorerElementInfos.fromDashboardOrganisationType(el));
|
|
85
|
+
break;
|
|
86
|
+
case "delete":
|
|
87
|
+
(onCollectionChangedCustom as DeleteCallback)(ev, el);
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
subscribeToFolders("all", (ev: NotifyEvent, el: FolderDetails | any) => {
|
|
93
|
+
switch (ev) {
|
|
94
|
+
case "add":
|
|
95
|
+
case "update":
|
|
96
|
+
(onCollectionChangedCustom as AddOrUpdateCallback<DashboardExplorerElementInfos>)(ev, DashboardExplorerElementInfos.fromFolder(el));
|
|
97
|
+
break;
|
|
98
|
+
case "delete":
|
|
99
|
+
(onCollectionChangedCustom as DeleteCallback)(ev, el);
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
fetching.value = false;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
return {
|
|
110
|
+
fetching,
|
|
111
|
+
getMany,
|
|
112
|
+
entities
|
|
113
|
+
};
|
|
114
|
+
};
|
|
@@ -29,6 +29,7 @@ const DashboardOrganisationTypeServiceFactory = new ServiceFactory<DashboardOrga
|
|
|
29
29
|
|
|
30
30
|
export const useDashboardOrganisationType = ComposableFactory.get(DashboardOrganisationTypeServiceFactory);
|
|
31
31
|
export const useDashboardOrganisationTypes = ComposableFactory.getMany(DashboardOrganisationTypeServiceFactory);
|
|
32
|
+
export const useSubscribeToDashboardOrganisationTypes = ComposableFactory.subscribe(DashboardOrganisationTypeServiceFactory);
|
|
32
33
|
export const useUpdateDashboardOrganisationType = ComposableFactory.update(DashboardOrganisationTypeServiceFactory);
|
|
33
34
|
export const useRemoveDashboardOrganisationType = ComposableFactory.remove(DashboardOrganisationTypeServiceFactory);
|
|
34
35
|
export const usePublishDashboardOrganisationType = ComposableFactory.custom(DashboardOrganisationTypeServiceFactory.publish);
|
|
@@ -28,6 +28,7 @@ const DashboardOrganisationServiceFactoryIncomplete = new ServiceFactory("dashbo
|
|
|
28
28
|
|
|
29
29
|
export const useDashboardOrganisation = ComposableFactory.get(DashboardOrganisationServiceFactory);
|
|
30
30
|
export const useDashboardOrganisations = ComposableFactory.getMany(DashboardOrganisationServiceFactory);
|
|
31
|
+
export const useSubscribeToDashboardOrganisations = ComposableFactory.subscribe(DashboardOrganisationServiceFactory);
|
|
31
32
|
export const useCreateDashboardOrganisation = ComposableFactory.create(DashboardOrganisationServiceFactory);
|
|
32
33
|
export const useUpdateDashboardOrganisation = ComposableFactory.update(DashboardOrganisationServiceFactory);
|
|
33
34
|
export const useRemoveDashboardOrganisation = ComposableFactory.remove(DashboardOrganisationServiceFactory);
|
|
@@ -23,6 +23,7 @@ const DashboardShallowServiceFactoryIncomplete = new ServiceFactory("dashboardSh
|
|
|
23
23
|
|
|
24
24
|
export const useDashboardShallow = ComposableFactory.get(DashboardShallowServiceFactory);
|
|
25
25
|
export const useDashboardShallows = ComposableFactory.getMany(DashboardShallowServiceFactory);
|
|
26
|
+
export const useSubscribeToDashboardShallows = ComposableFactory.subscribe(DashboardShallowServiceFactory);
|
|
26
27
|
export const useCreateDashboardShallow = ComposableFactory.create(DashboardShallowServiceFactory);
|
|
27
28
|
export const useUpdateDashboardShallow = ComposableFactory.update(DashboardShallowServiceFactory);
|
|
28
29
|
export const useRemoveDashboardShallow = ComposableFactory.remove(DashboardShallowServiceFactory);
|
|
@@ -14,6 +14,7 @@ const FolderServiceFactory = new ServiceFactory<FolderDetailsDTO, FolderDetails>
|
|
|
14
14
|
|
|
15
15
|
export const useFolder = ComposableFactory.get(FolderServiceFactory);
|
|
16
16
|
export const useFolders = ComposableFactory.getMany(FolderServiceFactory);
|
|
17
|
+
export const useSubscribeToFolders = ComposableFactory.subscribe(FolderServiceFactory);
|
|
17
18
|
export const useCreateFolder = ComposableFactory.create(FolderServiceFactory);
|
|
18
19
|
export const useUpdateFolder = ComposableFactory.update(FolderServiceFactory);
|
|
19
20
|
export const useRemoveFolder = ComposableFactory.remove(FolderServiceFactory);
|
package/config/urls/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ export * from "./customPropertyValues";
|
|
|
13
13
|
export * from "./dashboardOrganisations";
|
|
14
14
|
export * from "./dashboardOrganisationTypes";
|
|
15
15
|
export * from "./dashboards";
|
|
16
|
+
export * from "./dashboardExplorerElements";
|
|
16
17
|
export * from "./data";
|
|
17
18
|
export * from "./dataCategories";
|
|
18
19
|
export * from "./dataDefinitions";
|
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.
|
|
7
|
+
"version": "1.1.12-dashboards-explorer-02",
|
|
8
8
|
"description": "",
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"author": "",
|
|
14
14
|
"license": "ISC",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@dative-gpi/foundation-core-domain": "1.1.
|
|
16
|
+
"@dative-gpi/foundation-core-domain": "1.1.12-dashboards-explorer-02"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"@dative-gpi/bones-ui": "^1.0.0",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"vue": "3.5.26",
|
|
22
22
|
"vue-router": "^4.3.0"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "b640cf1d28ef05d441524e0d1734a86a570f7495"
|
|
25
25
|
}
|