@dative-gpi/foundation-core-services 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/composables/services/index.ts +2 -1
- package/composables/services/useAlerts.ts +2 -1
- package/composables/services/useConnectivityAlerts.ts +1 -1
- package/composables/services/useConnectivityScenarios.ts +15 -4
- package/composables/services/useCustomPropertyValues.ts +2 -1
- package/composables/services/useDataTables.ts +41 -19
- package/composables/services/useDeviceConnectivities.ts +1 -1
- package/composables/services/useDeviceExplorerElements.ts +98 -0
- package/composables/services/useDeviceOrganisations.ts +6 -1
- package/composables/services/useDeviceStatuses.ts +1 -1
- package/composables/services/useGroups.ts +2 -0
- package/composables/services/useLocations.ts +21 -2
- package/composables/services/useScenarioDeviceOrganisations.ts +15 -4
- package/composables/services/useServiceAccountRoleOrganisations.ts +13 -0
- package/config/literals/index.ts +1 -3
- package/config/urls/deviceExplorerElements.ts +3 -0
- package/config/urls/index.ts +2 -1
- package/config/urls/serviceAccountRoleOrganisations.ts +4 -0
- package/package.json +5 -5
- package/composables/services/useNotifications.ts +0 -48
- package/config/literals/hubs.ts +0 -16
- package/config/urls/notifications.ts +0 -6
|
@@ -18,6 +18,7 @@ export * from "./useDataCategories";
|
|
|
18
18
|
export * from "./useDataDefinitions";
|
|
19
19
|
export * from "./useDataTables";
|
|
20
20
|
export * from "./useDeviceConnectivities";
|
|
21
|
+
export * from "./useDeviceExplorerElements";
|
|
21
22
|
export * from "./useDeviceOrganisations";
|
|
22
23
|
export * from "./useDeviceStatuses";
|
|
23
24
|
export * from "./useFolders";
|
|
@@ -25,7 +26,6 @@ export * from "./useGroups";
|
|
|
25
26
|
export * from "./useLocations";
|
|
26
27
|
export * from "./useManufacturers";
|
|
27
28
|
export * from "./useModels";
|
|
28
|
-
export * from "./useNotifications";
|
|
29
29
|
export * from "./useOrganisations";
|
|
30
30
|
export * from "./useOrganisationTypes";
|
|
31
31
|
export * from "./usePermissionCategories";
|
|
@@ -36,6 +36,7 @@ export * from "./useScenarioOrganisations";
|
|
|
36
36
|
export * from "./useScenarioOrganisationTypes";
|
|
37
37
|
export * from "./useServiceAccountOrganisationAuthTokens";
|
|
38
38
|
export * from "./useServiceAccountOrganisations";
|
|
39
|
+
export * from "./useServiceAccountRoleOrganisations";
|
|
39
40
|
export * from "./useUserOrganisations";
|
|
40
41
|
export * from "./useUserOrganisationTables";
|
|
41
42
|
export * from "./useWidgetTemplates";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AlertDetails, type AlertDetailsDTO, type AlertFilters, AlertInfos, type AlertInfosDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
2
2
|
import { HubFactory } from "@dative-gpi/foundation-shared-services/tools/hubFactory";
|
|
3
3
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui/core";
|
|
4
|
+
import { HUBS } from "@dative-gpi/foundation-shared-services/config";
|
|
4
5
|
|
|
5
6
|
import { ALERTS_HUB_URL, ALERTS_URL, ALERT_URL } from "../../config/urls";
|
|
6
|
-
import { HUBS } from "../../config/literals";
|
|
7
7
|
|
|
8
8
|
const AlertServiceFactory = new ServiceFactory<AlertDetailsDTO, AlertDetails>("alert", AlertDetails).create(factory => factory.build(
|
|
9
9
|
factory.addGet(ALERT_URL),
|
|
@@ -16,6 +16,7 @@ const AlertServiceFactory = new ServiceFactory<AlertDetailsDTO, AlertDetails>("a
|
|
|
16
16
|
...ServiceFactory.addCustom("acknowledge", (axios, alertId: string) => axios.patch(ALERT_URL(alertId)), (dto: AlertDetailsDTO) => {
|
|
17
17
|
const result = new AlertDetails(dto);
|
|
18
18
|
notifyService.notify("update", result);
|
|
19
|
+
notifyService.notify("reset");
|
|
19
20
|
return result;
|
|
20
21
|
})
|
|
21
22
|
}))
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ConnectivityAlertDetails, type ConnectivityAlertDetailsDTO, type ConnectivityAlertFilters, ConnectivityAlertInfos, type ConnectivityAlertInfosDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
2
2
|
import { HubFactory } from "@dative-gpi/foundation-shared-services/tools/hubFactory";
|
|
3
3
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui/core";
|
|
4
|
+
import { HUBS } from "@dative-gpi/foundation-shared-services/config";
|
|
4
5
|
|
|
5
6
|
import { CONNECTIVITY_ALERTS_HUB_URL, CONNECTIVITY_ALERTS_URL, CONNECTIVITY_ALERT_URL } from "../../config/urls";
|
|
6
|
-
import { HUBS } from "../../config/literals";
|
|
7
7
|
|
|
8
8
|
const ConnectivityAlertServiceFactory = new ServiceFactory<ConnectivityAlertDetailsDTO, ConnectivityAlertDetails>("connectivityAlert", ConnectivityAlertDetails).create(factory => factory.build(
|
|
9
9
|
factory.addGet(CONNECTIVITY_ALERT_URL),
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import { ConnectivityScenarioDetails, type ConnectivityScenarioDetailsDTO, type ConnectivityScenarioFilters, ConnectivityScenarioInfos, type ConnectivityScenarioInfosDTO, type
|
|
1
|
+
import { ConnectivityScenarioDetails, type ConnectivityScenarioDetailsDTO, type ConnectivityScenarioFilters, ConnectivityScenarioInfos, type ConnectivityScenarioInfosDTO, type UpsertConnectivityScenarioDTO, type UpdateConnectivityScenarioDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
2
2
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui/core";
|
|
3
3
|
|
|
4
4
|
import { CONNECTIVITY_SCENARIOS_URL, CONNECTIVITY_SCENARIO_URL } from "../../config";
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
|
|
7
|
+
const ConnectivityScenarioServiceFactory = new ServiceFactory<ConnectivityScenarioDetailsDTO, ConnectivityScenarioDetails>("ConnectivityScenario", ConnectivityScenarioDetails).create(factory => factory.build(
|
|
8
|
+
factory.addGet(CONNECTIVITY_SCENARIO_URL),
|
|
9
|
+
factory.addGetMany<ConnectivityScenarioInfosDTO, ConnectivityScenarioInfos, ConnectivityScenarioFilters>(CONNECTIVITY_SCENARIOS_URL, ConnectivityScenarioInfos),
|
|
10
|
+
factory.addUpdate<UpdateConnectivityScenarioDTO>(CONNECTIVITY_SCENARIO_URL),
|
|
11
|
+
factory.addRemove(CONNECTIVITY_SCENARIO_URL),
|
|
12
|
+
factory.addNotify(notifyService => ({
|
|
13
|
+
...ServiceFactory.addCustom("upsert", (axios, payload: UpsertConnectivityScenarioDTO) => axios.post(CONNECTIVITY_SCENARIOS_URL(), payload), () => {
|
|
14
|
+
notifyService.notify("reset");
|
|
15
|
+
})
|
|
16
|
+
}))
|
|
17
|
+
));
|
|
18
|
+
|
|
8
19
|
|
|
9
20
|
export const useConnectivityScenario = ComposableFactory.get(ConnectivityScenarioServiceFactory);
|
|
10
21
|
export const useConnectivityScenarios = ComposableFactory.getMany(ConnectivityScenarioServiceFactory);
|
|
11
|
-
export const useCreateConnectivityScenario = ComposableFactory.create(ConnectivityScenarioServiceFactory);
|
|
12
22
|
export const useUpdateConnectivityScenario = ComposableFactory.update(ConnectivityScenarioServiceFactory);
|
|
13
23
|
export const useRemoveConnectivityScenario = ComposableFactory.remove(ConnectivityScenarioServiceFactory);
|
|
24
|
+
export const useUpsertConnectivityScenario = ComposableFactory.custom(ConnectivityScenarioServiceFactory.upsert);
|
|
14
25
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { CustomPropertyValueInfos, type CustomPropertyValueInfosDTO
|
|
1
|
+
import { CustomPropertyValueInfos, type CustomPropertyValueInfosDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
2
|
+
import { type PropertyEntity } from "@dative-gpi/foundation-shared-domain/enums";
|
|
2
3
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui/core";
|
|
3
4
|
|
|
4
5
|
import { CUSTOM_PROPERTY_VALUES_URL } from "../../config/urls";
|
|
@@ -1,35 +1,40 @@
|
|
|
1
1
|
import { ref, type Ref } from "vue";
|
|
2
|
+
import _ from "lodash";
|
|
2
3
|
|
|
3
4
|
import { type UpdateUserOrganisationTableDTO, type UserOrganisationTableDetails } from "@dative-gpi/foundation-core-domain/models";
|
|
4
|
-
import { type FSDataTable } from "@dative-gpi/foundation-shared-components/models";
|
|
5
|
+
import { type FSDataTable, type FSDataTableColumn } from "@dative-gpi/foundation-shared-components/models";
|
|
5
6
|
|
|
6
7
|
export const useDataTables = () => {
|
|
7
8
|
const initialized = ref(false);
|
|
8
9
|
|
|
9
|
-
const table = ref<FSDataTable>(
|
|
10
|
-
headers: [],
|
|
11
|
-
mode: "table",
|
|
12
|
-
sortBy: null,
|
|
13
|
-
rowsPerPage: 10,
|
|
14
|
-
filters: {},
|
|
15
|
-
page: 1
|
|
16
|
-
});
|
|
10
|
+
const table = ref<FSDataTable | null>(null);
|
|
17
11
|
|
|
18
|
-
const computeTable = (
|
|
12
|
+
const computeTable = (
|
|
13
|
+
headersOptions: { [key: string]: Partial<FSDataTableColumn> },
|
|
14
|
+
defaultMode: "table" | "iterator" = "table",
|
|
15
|
+
extraHeaders: FSDataTableColumn[] = []
|
|
16
|
+
) => ({
|
|
19
17
|
...table.value,
|
|
20
|
-
|
|
18
|
+
mode: table.value?.mode ?? defaultMode,
|
|
19
|
+
headers: _.sortBy(table.value?.headers.concat(extraHeaders.filter(e => !table.value?.headers.map(h => h.value).includes(e.value))), "index").map((header, i) => ({
|
|
21
20
|
...header,
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
index: i,
|
|
22
|
+
fixedFilters: (header.value && headersOptions[header.value] && headersOptions[header.value].fixedFilters) || null,
|
|
23
|
+
methodFilter: (header.value && headersOptions[header.value] && headersOptions[header.value].methodFilter) || null,
|
|
24
|
+
methodFilterRaw: (header.value && headersOptions[header.value] && headersOptions[header.value].methodFilterRaw) || null,
|
|
25
|
+
sort: (header.value && headersOptions[header.value] && headersOptions[header.value].sort) || null,
|
|
26
|
+
sortRaw: (header.value && headersOptions[header.value] && headersOptions[header.value].sortRaw) || null,
|
|
27
|
+
innerValue: (header.value && headersOptions[header.value] && headersOptions[header.value].innerValue) || null
|
|
24
28
|
}))
|
|
25
|
-
})
|
|
29
|
+
});
|
|
26
30
|
|
|
27
31
|
const updateTable = (
|
|
28
32
|
updateUserOrganisationTable: (id: string, payload: UpdateUserOrganisationTableDTO) => Promise<Ref<UserOrganisationTableDetails>>,
|
|
29
33
|
setTable: (tableCode: string, value: FSDataTable) => void,
|
|
30
|
-
tableCode: string
|
|
34
|
+
tableCode: string,
|
|
35
|
+
defaultMode: "table" | "iterator" = "table"
|
|
31
36
|
): void => {
|
|
32
|
-
if (table.value) {
|
|
37
|
+
if (tableCode && table.value) {
|
|
33
38
|
setTable(tableCode, table.value);
|
|
34
39
|
updateUserOrganisationTable(tableCode, {
|
|
35
40
|
columns: table.value.headers.map(column => ({
|
|
@@ -40,7 +45,7 @@ export const useDataTables = () => {
|
|
|
40
45
|
rowsPerPage: table.value.rowsPerPage,
|
|
41
46
|
sortByKey: table.value.sortBy?.key ?? null,
|
|
42
47
|
sortByOrder: table.value.sortBy?.order ?? null,
|
|
43
|
-
mode: table.value.mode
|
|
48
|
+
mode: table.value.mode ?? defaultMode
|
|
44
49
|
});
|
|
45
50
|
}
|
|
46
51
|
};
|
|
@@ -48,12 +53,16 @@ export const useDataTables = () => {
|
|
|
48
53
|
const onTableCodeChange = async (
|
|
49
54
|
getUserOrganisationTable: (id: string) => Promise<Ref<UserOrganisationTableDetails | null>>,
|
|
50
55
|
getTable: (tableCode: string) => FSDataTable | null,
|
|
51
|
-
tableCode: string
|
|
56
|
+
tableCode: string | null,
|
|
57
|
+
defaultMode: "table" | "iterator" = "table"
|
|
52
58
|
): Promise<void> => {
|
|
59
|
+
let done = false;
|
|
53
60
|
if (tableCode) {
|
|
54
61
|
const composableTable = getTable(tableCode);
|
|
62
|
+
|
|
55
63
|
if (composableTable) {
|
|
56
64
|
table.value = composableTable;
|
|
65
|
+
done = true;
|
|
57
66
|
}
|
|
58
67
|
else {
|
|
59
68
|
try {
|
|
@@ -65,11 +74,13 @@ export const useDataTables = () => {
|
|
|
65
74
|
key: userOrganisationTable.value.sortByKey,
|
|
66
75
|
order: userOrganisationTable.value.sortByOrder
|
|
67
76
|
},
|
|
68
|
-
mode: userOrganisationTable.value.mode,
|
|
77
|
+
mode: userOrganisationTable.value.mode ?? defaultMode,
|
|
69
78
|
rowsPerPage: userOrganisationTable.value.rowsPerPage,
|
|
79
|
+
showFilters: false,
|
|
70
80
|
filters: {},
|
|
71
81
|
page: 1
|
|
72
82
|
}
|
|
83
|
+
done = true;
|
|
73
84
|
}
|
|
74
85
|
}
|
|
75
86
|
catch {
|
|
@@ -77,6 +88,17 @@ export const useDataTables = () => {
|
|
|
77
88
|
}
|
|
78
89
|
}
|
|
79
90
|
}
|
|
91
|
+
if (!done) {
|
|
92
|
+
table.value = {
|
|
93
|
+
headers: [],
|
|
94
|
+
mode: null,
|
|
95
|
+
sortBy: null,
|
|
96
|
+
rowsPerPage: 10,
|
|
97
|
+
showFilters: false,
|
|
98
|
+
filters: {},
|
|
99
|
+
page: 1
|
|
100
|
+
};
|
|
101
|
+
}
|
|
80
102
|
initialized.value = true;
|
|
81
103
|
};
|
|
82
104
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DeviceConnectivityDetails, type DeviceConnectivityDetailsDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
2
2
|
import { HubFactory } from "@dative-gpi/foundation-shared-services/tools/hubFactory";
|
|
3
3
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui/core";
|
|
4
|
+
import { HUBS } from "@dative-gpi/foundation-shared-services/config";
|
|
4
5
|
|
|
5
6
|
import { DEVICE_CONNECTIVITIES_HUB_URL, DEVICE_CONNECTIVITY_URL } from "../../config/urls";
|
|
6
|
-
import { HUBS } from "../../config/literals";
|
|
7
7
|
|
|
8
8
|
const DeviceConnectivityServiceFactory = new ServiceFactory<DeviceConnectivityDetailsDTO, DeviceConnectivityDetails>("deviceConnectivity", DeviceConnectivityDetails).create(factory => factory.build(
|
|
9
9
|
factory.addGet(DEVICE_CONNECTIVITY_URL),
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
|
|
3
|
+
import { DeviceExplorerElementDetails, type DeviceExplorerElementDetailsDTO, type DeviceExplorerElementFilters, DeviceExplorerElementInfos, type DeviceExplorerElementInfosDTO, type DeviceOrganisationDetails, type GroupDetails } from "@dative-gpi/foundation-core-domain/models";
|
|
4
|
+
import { type AddOrUpdateCallback, type DeleteCallback, type NotifyEvent, onCollectionChanged } from "@dative-gpi/bones-ui";
|
|
5
|
+
import { fromDeviceOrganisation, fromGroup } from "@dative-gpi/foundation-shared-domain/tools";
|
|
6
|
+
import { ServiceFactory } from "@dative-gpi/bones-ui/core";
|
|
7
|
+
|
|
8
|
+
import { DEVICE_EXPLORER_ELEMENTS_URL } from "../../config/urls";
|
|
9
|
+
|
|
10
|
+
import { useTrackDeviceConnectivity, useWatchDeviceConnectivity } from "./useDeviceConnectivities";
|
|
11
|
+
import { useTrackDeviceStatuses, useWatchDeviceStatuses } from "./useDeviceStatuses";
|
|
12
|
+
import { useSubscribeToDeviceOrganisations } from "./useDeviceOrganisations";
|
|
13
|
+
import { useSubscribeToGroups } from "./useGroups";
|
|
14
|
+
|
|
15
|
+
const DeviceExplorerElementServiceFactory = new ServiceFactory<DeviceExplorerElementDetailsDTO, DeviceExplorerElementDetails>("deviceExplorerElement", DeviceExplorerElementDetails).create(factory => factory.build(
|
|
16
|
+
factory.addGetMany<DeviceExplorerElementInfosDTO, DeviceExplorerElementInfos, DeviceExplorerElementFilters>(DEVICE_EXPLORER_ELEMENTS_URL, DeviceExplorerElementInfos),
|
|
17
|
+
factory.addNotify()
|
|
18
|
+
));
|
|
19
|
+
|
|
20
|
+
export const useDeviceExplorerElements = () => {
|
|
21
|
+
const { watchMany: watchDevicesConnectivity } = useWatchDeviceConnectivity();
|
|
22
|
+
const { watchMany: watchDevicesStatuses } = useWatchDeviceStatuses();
|
|
23
|
+
|
|
24
|
+
const { track: trackDeviceConnectivity } = useTrackDeviceConnectivity();
|
|
25
|
+
const { track: trackDeviceStatuses } = useTrackDeviceStatuses();
|
|
26
|
+
|
|
27
|
+
const { subscribe: subscribeToDeviceOrganisations } = useSubscribeToDeviceOrganisations();
|
|
28
|
+
const { subscribe: subscribeToGroups } = useSubscribeToGroups();
|
|
29
|
+
|
|
30
|
+
const fetching = ref(false);
|
|
31
|
+
const entities = ref<DeviceExplorerElementInfos[]>([]);
|
|
32
|
+
const filters = ref<DeviceExplorerElementFilters>();
|
|
33
|
+
|
|
34
|
+
const getMany = async (filter?: DeviceExplorerElementFilters) => {
|
|
35
|
+
fetching.value = true;
|
|
36
|
+
filters.value = filter;
|
|
37
|
+
|
|
38
|
+
const filterMethod = (el: DeviceExplorerElementInfos): boolean => {
|
|
39
|
+
if (!filters.value) {
|
|
40
|
+
return true;
|
|
41
|
+
}
|
|
42
|
+
if (!filters.value.search) {
|
|
43
|
+
return (filters.value.root && !el.parentId) || (!!filters.value.parentId && filters.value.parentId == el.parentId);
|
|
44
|
+
}
|
|
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 DeviceExplorerElementServiceFactory.getMany(filters.value);
|
|
55
|
+
|
|
56
|
+
subscribeToDeviceOrganisations("all", (ev: NotifyEvent, el: DeviceOrganisationDetails | any) => {
|
|
57
|
+
switch(ev) {
|
|
58
|
+
case "add":
|
|
59
|
+
case "update":
|
|
60
|
+
(onCollectionChangedCustom as AddOrUpdateCallback<DeviceExplorerElementInfos>)(ev, fromDeviceOrganisation(el));
|
|
61
|
+
break;
|
|
62
|
+
case "delete":
|
|
63
|
+
(onCollectionChangedCustom as DeleteCallback)(ev, el);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
subscribeToGroups("all", (ev: NotifyEvent, el: GroupDetails | any) => {
|
|
69
|
+
switch(ev) {
|
|
70
|
+
case "add":
|
|
71
|
+
case "update":
|
|
72
|
+
(onCollectionChangedCustom as AddOrUpdateCallback<DeviceExplorerElementInfos>)(ev, fromGroup(el));
|
|
73
|
+
break;
|
|
74
|
+
case "delete":
|
|
75
|
+
(onCollectionChangedCustom as DeleteCallback)(ev, el);
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
watchDevicesStatuses();
|
|
81
|
+
watchDevicesConnectivity();
|
|
82
|
+
|
|
83
|
+
for (const deviceExplorerElement of entities.value) {
|
|
84
|
+
trackDeviceStatuses(deviceExplorerElement.status!, s => deviceExplorerElement.status = s);
|
|
85
|
+
trackDeviceConnectivity(deviceExplorerElement.connectivity!, c => deviceExplorerElement.connectivity = c);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
finally {
|
|
89
|
+
fetching.value = false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
fetching,
|
|
95
|
+
getMany,
|
|
96
|
+
entities
|
|
97
|
+
}
|
|
98
|
+
};
|
|
@@ -24,7 +24,8 @@ const DeviceOrganisationServiceFactory = new ServiceFactory<DeviceOrganisationDe
|
|
|
24
24
|
const result = new DeviceOrganisationDetails(dto);
|
|
25
25
|
notifyService.notify("update", result);
|
|
26
26
|
return result;
|
|
27
|
-
})
|
|
27
|
+
}),
|
|
28
|
+
notifyReset: () => notifyService.notify("reset")
|
|
28
29
|
}))
|
|
29
30
|
));
|
|
30
31
|
|
|
@@ -62,6 +63,10 @@ const trackDeviceOrganisations = () => {
|
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
|
|
66
|
+
export const useSubscribeToDeviceOrganisations = ComposableFactory.subscribe(DeviceOrganisationServiceFactory);
|
|
67
|
+
|
|
68
|
+
export const resetDeviceOrganisations = DeviceOrganisationServiceFactory.notifyReset;
|
|
69
|
+
|
|
65
70
|
export const useDeviceOrganisation = ComposableFactory.get(DeviceOrganisationServiceFactory, trackDeviceOrganisation);
|
|
66
71
|
export const useDeviceOrganisations = ComposableFactory.getMany(DeviceOrganisationServiceFactory, trackDeviceOrganisations);
|
|
67
72
|
export const useCreateDeviceOrganisation = ComposableFactory.create(DeviceOrganisationServiceFactory, trackDeviceOrganisation);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DeviceStatusDetails, type DeviceStatusDetailsDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
2
2
|
import { HubFactory } from "@dative-gpi/foundation-shared-services/tools/hubFactory";
|
|
3
3
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui/core";
|
|
4
|
+
import { HUBS } from "@dative-gpi/foundation-shared-services/config";
|
|
4
5
|
|
|
5
6
|
import { DEVICE_STATUSES_HUB_URL, DEVICE_STATUS_URL } from "../../config/urls";
|
|
6
|
-
import { HUBS } from "../../config/literals";
|
|
7
7
|
|
|
8
8
|
const DeviceStatusServiceFactory = new ServiceFactory<DeviceStatusDetailsDTO, DeviceStatusDetails>("deviceStatus", DeviceStatusDetails).create(factory => factory.build(
|
|
9
9
|
factory.addGet(DEVICE_STATUS_URL),
|
|
@@ -18,6 +18,8 @@ const GroupServiceFactory = new ServiceFactory<GroupDetailsDTO, GroupDetails>("g
|
|
|
18
18
|
}))
|
|
19
19
|
));
|
|
20
20
|
|
|
21
|
+
export const useSubscribeToGroups = ComposableFactory.subscribe(GroupServiceFactory);
|
|
22
|
+
|
|
21
23
|
export const useGroup = ComposableFactory.get(GroupServiceFactory);
|
|
22
24
|
export const useGroups = ComposableFactory.getMany(GroupServiceFactory);
|
|
23
25
|
export const useCreateGroup = ComposableFactory.create(GroupServiceFactory);
|
|
@@ -3,11 +3,30 @@ import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui/core";
|
|
|
3
3
|
|
|
4
4
|
import { LOCATIONS_URL, LOCATION_URL } from "../../config/urls";
|
|
5
5
|
|
|
6
|
+
import { resetDeviceOrganisations } from "./useDeviceOrganisations";
|
|
7
|
+
|
|
6
8
|
const LocationServiceFactory = new ServiceFactory<LocationDetailsDTO, LocationDetails>("location", LocationDetails)
|
|
7
9
|
.createComplete<LocationInfos, LocationInfosDTO, CreateLocationDTO, UpdateLocationDTO, LocationFilters>(LOCATIONS_URL, LOCATION_URL, LocationInfos);
|
|
8
10
|
|
|
11
|
+
const updateLocation = ComposableFactory.update(LocationServiceFactory);
|
|
12
|
+
|
|
9
13
|
export const useLocation = ComposableFactory.get(LocationServiceFactory);
|
|
10
14
|
export const useLocations = ComposableFactory.getMany(LocationServiceFactory);
|
|
11
15
|
export const useCreateLocation = ComposableFactory.create(LocationServiceFactory);
|
|
12
|
-
export const
|
|
13
|
-
|
|
16
|
+
export const useRemoveLocation = ComposableFactory.remove(LocationServiceFactory);
|
|
17
|
+
|
|
18
|
+
export const useUpdateLocation = () => {
|
|
19
|
+
const { update, updated, updating } = updateLocation();
|
|
20
|
+
|
|
21
|
+
const actualUpdate = async (...params: Parameters<typeof update>) => {
|
|
22
|
+
const result = await update(...params);
|
|
23
|
+
resetDeviceOrganisations();
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
update: actualUpdate,
|
|
29
|
+
updated,
|
|
30
|
+
updating
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,13 +1,24 @@
|
|
|
1
|
-
import { type CreateScenarioDeviceOrganisationDTO, ScenarioDeviceOrganisationDetails, type ScenarioDeviceOrganisationDetailsDTO, type ScenarioDeviceOrganisationFilters, ScenarioDeviceOrganisationInfos, type ScenarioDeviceOrganisationInfosDTO, type UpdateScenarioDeviceOrganisationDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
1
|
+
import { type CreateManyScenarioDeviceOrganisationDTO, type CreateScenarioDeviceOrganisationDTO, ScenarioDeviceOrganisationDetails, type ScenarioDeviceOrganisationDetailsDTO, type ScenarioDeviceOrganisationFilters, ScenarioDeviceOrganisationInfos, type ScenarioDeviceOrganisationInfosDTO, type UpdateScenarioDeviceOrganisationDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
2
2
|
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui/core";
|
|
3
3
|
|
|
4
4
|
import { SCENARIO_DEVICE_ORGANISATIONS_URL, SCENARIO_DEVICE_ORGANISATION_URL } from "../../config";
|
|
5
5
|
|
|
6
|
-
const ScenarioDeviceOrganisationServiceFactory = new ServiceFactory<ScenarioDeviceOrganisationDetailsDTO, ScenarioDeviceOrganisationDetails>("scenarioDeviceOrganisation", ScenarioDeviceOrganisationDetails)
|
|
7
|
-
.
|
|
6
|
+
const ScenarioDeviceOrganisationServiceFactory = new ServiceFactory<ScenarioDeviceOrganisationDetailsDTO, ScenarioDeviceOrganisationDetails>("scenarioDeviceOrganisation", ScenarioDeviceOrganisationDetails).create(factory => factory.build(
|
|
7
|
+
factory.addCreate<CreateScenarioDeviceOrganisationDTO>(SCENARIO_DEVICE_ORGANISATIONS_URL),
|
|
8
|
+
factory.addGet(SCENARIO_DEVICE_ORGANISATION_URL),
|
|
9
|
+
factory.addGetMany<ScenarioDeviceOrganisationInfosDTO, ScenarioDeviceOrganisationInfos, ScenarioDeviceOrganisationFilters>(SCENARIO_DEVICE_ORGANISATIONS_URL, ScenarioDeviceOrganisationInfos),
|
|
10
|
+
factory.addUpdate<UpdateScenarioDeviceOrganisationDTO>(SCENARIO_DEVICE_ORGANISATION_URL),
|
|
11
|
+
factory.addRemove(SCENARIO_DEVICE_ORGANISATION_URL),
|
|
12
|
+
factory.addNotify(notifyService => ({
|
|
13
|
+
...ServiceFactory.addCustom("createMany", (axios, payload: CreateManyScenarioDeviceOrganisationDTO) => axios.put(SCENARIO_DEVICE_ORGANISATIONS_URL(), payload), () => {
|
|
14
|
+
notifyService.notify("reset");
|
|
15
|
+
})
|
|
16
|
+
}))
|
|
17
|
+
));
|
|
8
18
|
|
|
9
19
|
export const useScenarioDeviceOrganisation = ComposableFactory.get(ScenarioDeviceOrganisationServiceFactory);
|
|
10
20
|
export const useScenarioDeviceOrganisations = ComposableFactory.getMany(ScenarioDeviceOrganisationServiceFactory);
|
|
11
21
|
export const useCreateScenarioDeviceOrganisation = ComposableFactory.create(ScenarioDeviceOrganisationServiceFactory);
|
|
12
22
|
export const useUpdateScenarioDeviceOrganisation = ComposableFactory.update(ScenarioDeviceOrganisationServiceFactory);
|
|
13
|
-
export const useRemoveScenarioDeviceOrganisation = ComposableFactory.remove(ScenarioDeviceOrganisationServiceFactory);
|
|
23
|
+
export const useRemoveScenarioDeviceOrganisation = ComposableFactory.remove(ScenarioDeviceOrganisationServiceFactory);
|
|
24
|
+
export const useCreateManyScenarioDeviceOrganisation = ComposableFactory.custom(ScenarioDeviceOrganisationServiceFactory.createMany);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type CreateServiceAccountRoleOrganisationDTO, ServiceAccountRoleOrganisationDetails, type ServiceAccountRoleOrganisationDetailsDTO, type ServiceAccountRoleOrganisationFilters, ServiceAccountRoleOrganisationInfos, type ServiceAccountRoleOrganisationInfosDTO, type UpdateServiceAccountRoleOrganisationDTO } from "@dative-gpi/foundation-core-domain/models";
|
|
2
|
+
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui/core";
|
|
3
|
+
|
|
4
|
+
import { SERVICE_ACCOUNT_ROLE_ORGANISATIONS_URL, SERVICE_ACCOUNT_ROLE_ORGANISATION_URL } from "../../config/urls";
|
|
5
|
+
|
|
6
|
+
const ServiceAccountRoleOrganisationServiceFactory = new ServiceFactory<ServiceAccountRoleOrganisationDetailsDTO, ServiceAccountRoleOrganisationDetails>("serviceAccountOrganisation", ServiceAccountRoleOrganisationDetails)
|
|
7
|
+
.createComplete<ServiceAccountRoleOrganisationInfos, ServiceAccountRoleOrganisationInfosDTO, CreateServiceAccountRoleOrganisationDTO, UpdateServiceAccountRoleOrganisationDTO, ServiceAccountRoleOrganisationFilters>(SERVICE_ACCOUNT_ROLE_ORGANISATIONS_URL, SERVICE_ACCOUNT_ROLE_ORGANISATION_URL, ServiceAccountRoleOrganisationInfos);
|
|
8
|
+
|
|
9
|
+
export const useServiceAccountRoleOrganisation = ComposableFactory.get(ServiceAccountRoleOrganisationServiceFactory);
|
|
10
|
+
export const useServiceAccountRoleOrganisations = ComposableFactory.getMany(ServiceAccountRoleOrganisationServiceFactory);
|
|
11
|
+
export const useCreateServiceAccountRoleOrganisation = ComposableFactory.create(ServiceAccountRoleOrganisationServiceFactory);
|
|
12
|
+
export const useUpdateServiceAccountRoleOrganisation = ComposableFactory.update(ServiceAccountRoleOrganisationServiceFactory);
|
|
13
|
+
export const useRemoveServiceAccountRoleOrganisation = ComposableFactory.remove(ServiceAccountRoleOrganisationServiceFactory);
|
package/config/literals/index.ts
CHANGED
package/config/urls/index.ts
CHANGED
|
@@ -17,13 +17,13 @@ export * from "./dataCategories";
|
|
|
17
17
|
export * from "./dataDefinitions";
|
|
18
18
|
export * from "./deviceConnectivities";
|
|
19
19
|
export * from "./deviceOrganisations";
|
|
20
|
+
export * from "./deviceExplorerElements";
|
|
20
21
|
export * from "./deviceStatuses";
|
|
21
22
|
export * from "./folders";
|
|
22
23
|
export * from "./groups";
|
|
23
24
|
export * from "./locations";
|
|
24
25
|
export * from "./manufacturers";
|
|
25
26
|
export * from "./models";
|
|
26
|
-
export * from "./notifications";
|
|
27
27
|
export * from "./organisations";
|
|
28
28
|
export * from "./organisationTypes";
|
|
29
29
|
export * from "./permissionCategories";
|
|
@@ -35,6 +35,7 @@ export * from "./scenarioOrganisations";
|
|
|
35
35
|
export * from "./scenarioOrganisationTypes";
|
|
36
36
|
export * from "./serviceAccountOrganisationAuthTokens";
|
|
37
37
|
export * from "./serviceAccountOrganisations";
|
|
38
|
+
export * from "./serviceAccountRoleOrganisations";
|
|
38
39
|
export * from "./userOrganisations";
|
|
39
40
|
export * from "./userOrganisationTables";
|
|
40
41
|
export * from "./widgetTemplates";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CORE_URL } from "./base";
|
|
2
|
+
|
|
3
|
+
export const SERVICE_ACCOUNT_ROLE_ORGANISATIONS_URL = () => `${CORE_URL()}/service-account-role-organisations`;
|
|
4
|
+
export const SERVICE_ACCOUNT_ROLE_ORGANISATION_URL = (serviceAccountRoleOrganisationId: string) => `${SERVICE_ACCOUNT_ROLE_ORGANISATIONS_URL()}/${encodeURIComponent(serviceAccountRoleOrganisationId)}`;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-core-services",
|
|
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"
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dative-gpi/foundation-core-domain": "1.0.
|
|
13
|
+
"@dative-gpi/foundation-core-domain": "1.0.28-remove-deprecated2"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
-
"@dative-gpi/bones-ui": "^0.0
|
|
16
|
+
"@dative-gpi/bones-ui": "^1.0.0",
|
|
17
17
|
"@microsoft/signalr": "^8.0.0",
|
|
18
|
-
"vue": "^3.4.
|
|
18
|
+
"vue": "^3.4.38",
|
|
19
19
|
"vue-router": "^4.3.0"
|
|
20
20
|
},
|
|
21
|
-
"gitHead": "
|
|
21
|
+
"gitHead": "65c182fd697939a07ad87c683a2f4c2fb765a7c7"
|
|
22
22
|
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { NotificationDetails, type NotificationDetailsDTO, NotificationInfos, type NotificationInfosDTO, type NotificationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
2
|
-
import { HubFactory } from "@dative-gpi/foundation-shared-services/tools/hubFactory";
|
|
3
|
-
import { ComposableFactory, ServiceFactory } from "@dative-gpi/bones-ui/core";
|
|
4
|
-
|
|
5
|
-
import { NOTIFICATIONS_HUB_URL, NOTIFICATIONS_URL, NOTIFICATION_URL } from "../../config";
|
|
6
|
-
import { HUBS } from "../../config/literals";
|
|
7
|
-
|
|
8
|
-
const NotificationServiceFactory = new ServiceFactory<NotificationDetailsDTO, NotificationDetails>("notifications", NotificationDetails).create(factory => factory.build(
|
|
9
|
-
factory.addGet(NOTIFICATION_URL),
|
|
10
|
-
factory.addGetMany<NotificationInfosDTO, NotificationInfos, NotificationFilters>(NOTIFICATIONS_URL, NotificationInfos),
|
|
11
|
-
factory.addNotify(notifyService => ({
|
|
12
|
-
notifyCreate: (notification: NotificationDetails) => notifyService.notify("add", notification),
|
|
13
|
-
...ServiceFactory.addCustom("acknowledge", (axios, notificationId: string) => axios.patch(NOTIFICATION_URL(notificationId)), (dto: NotificationDetailsDTO) => {
|
|
14
|
-
const result = new NotificationDetails(dto);
|
|
15
|
-
notifyService.notify("update", result);
|
|
16
|
-
return result;
|
|
17
|
-
})
|
|
18
|
-
}))
|
|
19
|
-
));
|
|
20
|
-
|
|
21
|
-
const useNotificationsHub = HubFactory.create(NOTIFICATIONS_HUB_URL,
|
|
22
|
-
(connection, { hasWatchers }) => {
|
|
23
|
-
connection.on(HUBS.CREATE_NOTIFICATION, (notificationId: string) => hasWatchers()
|
|
24
|
-
? NotificationServiceFactory.get(notificationId).then(NotificationServiceFactory.notifyCreate)
|
|
25
|
-
: null);
|
|
26
|
-
},
|
|
27
|
-
async (connection) => {
|
|
28
|
-
await connection.invoke(HUBS.SUBSCRIBE);
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const useWatchNotifications = HubFactory.createWatcher(useNotificationsHub);
|
|
33
|
-
|
|
34
|
-
export const useNotification = ComposableFactory.get(NotificationServiceFactory, () => {
|
|
35
|
-
const { watchOne } = useWatchNotifications();
|
|
36
|
-
return (notification) => {
|
|
37
|
-
watchOne(notification.value.id);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export const useNotifications = ComposableFactory.getMany(NotificationServiceFactory, () => {
|
|
42
|
-
const { watchMany } = useWatchNotifications();
|
|
43
|
-
return () => {
|
|
44
|
-
watchMany();
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export const useAcknowledgeNotification = ComposableFactory.custom(NotificationServiceFactory.acknowledge);
|
package/config/literals/hubs.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export const SUBSCRIBE = "Subscribe";
|
|
2
|
-
export const UNSUBSCRIBE = "Unsubscribe";
|
|
3
|
-
|
|
4
|
-
export const UPDATE_DEVICE_STATUS = "UpdateDeviceStatus";
|
|
5
|
-
|
|
6
|
-
export const UPDATE_DEVICE_CONNECTIVITY = "UpdateDeviceConnectivity";
|
|
7
|
-
|
|
8
|
-
export const CREATE_ALERT = "CreateAlert";
|
|
9
|
-
export const UPDATE_ALERT = "UpdateAlert";
|
|
10
|
-
export const REMOVE_ALERT = "RemoveAlert";
|
|
11
|
-
|
|
12
|
-
export const CREATE_CONNECTIVITY_ALERT = "CreateConnectivityAlert";
|
|
13
|
-
export const UPDATE_CONNECTIVITY_ALERT = "UpdateConnectivityAlert";
|
|
14
|
-
export const REMOVE_CONNECTIVITY_ALERT = "RemoveConnectivityAlert";
|
|
15
|
-
|
|
16
|
-
export const CREATE_NOTIFICATION = "CreateNotification";
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { CORE_URL, HUBS_URL } from "./base";
|
|
2
|
-
|
|
3
|
-
export const NOTIFICATIONS_URL = () => `${CORE_URL()}/notifications`;
|
|
4
|
-
export const NOTIFICATION_URL = (notificationId: string) => `${CORE_URL()}/notifications/${notificationId}`;
|
|
5
|
-
|
|
6
|
-
export const NOTIFICATIONS_HUB_URL = () => `${HUBS_URL()}/notifications`;
|