@dative-gpi/foundation-core-services 1.0.193 → 1.0.194-dynamic-v-node
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export * from "./useActions";
|
|
2
|
+
export * from "./useAggregateValue";
|
|
2
3
|
export * from "./useAlerts";
|
|
3
4
|
export * from "./useArticles";
|
|
4
5
|
export * from "./useChartCategories";
|
|
@@ -30,7 +31,6 @@ export * from "./useManufacturers";
|
|
|
30
31
|
export * from "./useModels";
|
|
31
32
|
export * from "./useOrganisations";
|
|
32
33
|
export * from "./useOrganisationTypes";
|
|
33
|
-
export * from "./usePeriodAggregateValue";
|
|
34
34
|
export * from "./usePermissionCategories";
|
|
35
35
|
export * from "./usePlaylists";
|
|
36
36
|
export * from "./useRoleOrganisations";
|
|
@@ -6,14 +6,14 @@ import { getManyDatas } from "@dative-gpi/foundation-core-services/composables";
|
|
|
6
6
|
|
|
7
7
|
import { RootMode } from "@dative-gpi/foundation-shared-domain/enums";
|
|
8
8
|
|
|
9
|
-
import type { DataFiltersDTO, DataLeafDTO,
|
|
9
|
+
import type { DataFiltersDTO, DataLeafDTO, AggregateValueFilter } from "@dative-gpi/foundation-core-domain/models";
|
|
10
10
|
|
|
11
|
-
export const
|
|
11
|
+
export const useAggregateValue = () => {
|
|
12
12
|
const fetching = ref(false);
|
|
13
13
|
const error = ref<string | null>(null);
|
|
14
|
-
const
|
|
14
|
+
const value = ref<number | null>(null);
|
|
15
15
|
|
|
16
|
-
const fetch = async (filter:
|
|
16
|
+
const fetch = async (filter: AggregateValueFilter) => {
|
|
17
17
|
fetching.value = true;
|
|
18
18
|
|
|
19
19
|
const leaf = {
|
|
@@ -47,12 +47,12 @@ export const usePeriodAggregateValue = () => {
|
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
error.value = null;
|
|
50
|
-
|
|
50
|
+
value.value = null;
|
|
51
51
|
|
|
52
52
|
try {
|
|
53
53
|
const periodFilters: DataFiltersDTO = {
|
|
54
|
-
startDate: filter.
|
|
55
|
-
endDate: filter.
|
|
54
|
+
startDate: filter.start,
|
|
55
|
+
endDate: filter.end,
|
|
56
56
|
timeOffset: filter.timeOffset,
|
|
57
57
|
dateVariables: [],
|
|
58
58
|
mode: RootMode.Leaf,
|
|
@@ -61,9 +61,9 @@ export const usePeriodAggregateValue = () => {
|
|
|
61
61
|
|
|
62
62
|
const dataSerie = await getManyDatas(periodFilters);
|
|
63
63
|
|
|
64
|
-
const
|
|
64
|
+
const dataSerieValue = dataSerie?.[0]?.datas?.[0]?.values?.[0];
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
value.value = dataSerieValue == null ? null : Number(dataSerieValue);
|
|
67
67
|
|
|
68
68
|
} catch (exception: any) {
|
|
69
69
|
error.value = exception.response?.data ?? exception.message;
|
|
@@ -75,7 +75,7 @@ export const usePeriodAggregateValue = () => {
|
|
|
75
75
|
return {
|
|
76
76
|
fetching,
|
|
77
77
|
error,
|
|
78
|
-
|
|
78
|
+
value,
|
|
79
79
|
fetch,
|
|
80
80
|
};
|
|
81
81
|
};
|
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.0.
|
|
7
|
+
"version": "1.0.194-dynamic-v-node",
|
|
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.0.
|
|
16
|
+
"@dative-gpi/foundation-core-domain": "1.0.194-dynamic-v-node"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"@dative-gpi/bones-ui": "^1.0.0",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"vue": "^3.4.38",
|
|
22
22
|
"vue-router": "^4.3.0"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "bae28f289de25e748becbaf3e7d5f6c9bdc12934"
|
|
25
25
|
}
|