@dative-gpi/foundation-core-components 1.1.23 → 1.1.24-unit-formatter

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.
Files changed (39) hide show
  1. package/components/autocompletes/FSAutocompleteDataCategory.vue +2 -11
  2. package/components/entities/FSBaseEntitiesList.vue +0 -4
  3. package/components/entities/FSEntityField.vue +5 -11
  4. package/components/entities/FSSelectEntitiesList.vue +8 -35
  5. package/components/entities/FSSimpleEntitiesList.vue +2 -15
  6. package/components/entities/FSTileEntitiesList.vue +3 -1
  7. package/components/explorers/FSBaseFoldersExplorer.vue +337 -0
  8. package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +6 -7
  9. package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +6 -7
  10. package/components/lists/charts/FSBaseChartsList.vue +14 -7
  11. package/components/lists/dashboards/FSBaseDashboardsList.vue +224 -40
  12. package/components/lists/dashboards/FSSimpleDashboardsList.vue +53 -27
  13. package/components/lists/dashboards/FSTileDashboardsList.vue +62 -30
  14. package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +8 -10
  15. package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +7 -10
  16. package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +1 -66
  17. package/components/lists/folders/FSBaseFoldersList.vue +5 -1
  18. package/components/lists/groupings/FSBaseGroupingsList.vue +17 -5
  19. package/components/lists/groups/FSSimpleGroupsList.vue +0 -1
  20. package/components/lists/locations/FSBaseLocationsList.vue +3 -3
  21. package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +1 -21
  22. package/components/lists/userOrganisations/{FSUserOrganisationsChipGroup.vue → FSChipUserOrganisationsList.vue} +2 -2
  23. package/components/tiles/FSLocationTile.vue +1 -2
  24. package/package.json +8 -8
  25. package/utils/dashboards.ts +30 -12
  26. package/utils/tables.ts +7 -13
  27. package/utils/users.ts +1 -1
  28. package/components/explorers/FSBaseDashboardsExplorer.vue +0 -312
  29. package/components/explorers/FSDashboardExplorerElementTypeChip.vue +0 -37
  30. package/components/lists/groupings/FSSimpleGroupingsList.vue +0 -44
  31. package/components/lists/groupings/FSTileGroupingsList.vue +0 -79
  32. package/components/lists/playlists/FSTilePlaylistsList.vue +0 -93
  33. package/components/lists/subgroupings/FSBaseSubgroupingsList.vue +0 -197
  34. package/components/lists/subgroupings/FSSimpleSubgroupingsList.vue +0 -45
  35. package/components/lists/subgroupings/FSSubgroupingsChipGroup.vue +0 -61
  36. package/components/lists/subgroupings/FSTileSubgroupingsList.vue +0 -81
  37. package/components/tiles/FSGroupingTile.vue +0 -67
  38. package/components/tiles/FSPlaylistTile.vue +0 -78
  39. package/components/tiles/FSSubgroupingTile.vue +0 -69
@@ -68,6 +68,14 @@
68
68
  </FSText>
69
69
  </FSRow>
70
70
  </template>
71
+ <template
72
+ #item.modelsLabels="{ item }"
73
+ >
74
+ <FSTagGroup
75
+ :showRemove="false"
76
+ :tags="item.modelsLabels.map((d: any) => d.label)"
77
+ />
78
+ </template>
71
79
  <template
72
80
  #item.scope="{ item }"
73
81
  >
@@ -105,8 +113,7 @@ import { ChartOrigin, ChartType } from "@dative-gpi/foundation-shared-domain/enu
105
113
  import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
106
114
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
107
115
 
108
- import type { ModelInfos } from "@dative-gpi/foundation-core-domain/models";
109
- import type { ChartOrganisationFilters, ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
116
+ import type { ChartModelLabel, ChartOrganisationFilters, ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
110
117
  import { useChartOrganisations, useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
111
118
 
112
119
  import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
@@ -192,7 +199,7 @@ export default defineComponent({
192
199
  tags: c.tags,
193
200
  multiple: c.multiple,
194
201
  chartType: c.chartType,
195
- models: c.models
202
+ modelsLabels: c.modelsLabels
196
203
  })).concat(chartOrganisationTypes.value.map(c => ({
197
204
  id: c.id,
198
205
  imageId: c.imageId,
@@ -207,13 +214,13 @@ export default defineComponent({
207
214
  tags: c.tags,
208
215
  multiple: c.multiple,
209
216
  chartType: c.chartType,
210
- models: c.models
217
+ modelsLabels: c.modelsLabels
211
218
  })));
212
219
  });
213
220
 
214
221
  const headersOptions = computed(() => ({
215
- models: {
216
- fixedFilters: chartOrganisationTypes.value.map(c => c.models).reduce((acc, models) => {
222
+ modelsLabels: {
223
+ fixedFilters: chartOrganisationTypes.value.map(c => c.modelsLabels).reduce((acc, models) => {
217
224
  for(const m of models){
218
225
  if(!acc.map((m) => m.id).includes(m.id)){
219
226
  acc.push(m);
@@ -227,7 +234,7 @@ export default defineComponent({
227
234
  value: '',
228
235
  text: '--'
229
236
  }),
230
- methodFilter: (value: string, items: ModelInfos[]) => (items.length == 0 && value == '') || (items.length > 0 && items.some(ml => ml.id == value))
237
+ methodFilter: (value: string, items: ChartModelLabel[]) => (items.length == 0 && value == '') || (items.length > 0 && items.some(ml => ml.id == value))
231
238
  },
232
239
  chartType: {
233
240
  fixedFilters: getEnumEntries(ChartType).map(e => ({
@@ -1,14 +1,15 @@
1
1
  <template>
2
- <FSBaseDashboardsExplorer
3
- :tableCode="$props.tableCode"
4
- :allowedTypes="$props.allowedTypes"
5
- :dashboardExplorerElementsFilters="$props.dashboardExplorerElementsFilters"
2
+ <FSDataTable
3
+ defaultMode="iterator"
4
+ :items="items"
6
5
  :itemTo="$props.itemTo"
6
+ :headersOptions="headersOptions"
7
+ :loading="fetchingDashboardOrganisationTypes || fetchingDashboardOrganisations || fetchingDashboardShallows"
8
+ :tableCode="$props.tableCode"
7
9
  :selectable="$props.selectable"
8
10
  :singleSelect="$props.singleSelect"
9
- :modelValue="$props.modelValue"
10
- @update:modelValue="$emit('update:modelValue', $event)"
11
- @update:types="onUpdateTypes"
11
+ :modelValue="selecteds"
12
+ @update:modelValue="onSelect"
12
13
  v-bind="$attrs"
13
14
  >
14
15
  <template
@@ -20,22 +21,117 @@
20
21
  v-bind="slotData"
21
22
  />
22
23
  </template>
23
- </FSBaseDashboardsExplorer>
24
+ <template
25
+ #item.icon="{ item }"
26
+ >
27
+ <FSIcon>
28
+ {{ item.icon }}
29
+ </FSIcon>
30
+ </template>
31
+ <template
32
+ #item.dashboardType="{ item }"
33
+ >
34
+ <FSChip
35
+ :color="ColorEnum.Light"
36
+ :label="dashboardTypeLabel(item.dashboardType)"
37
+ />
38
+ </template>
39
+ <template
40
+ #item.main="{ item }"
41
+ >
42
+ <FSIcon
43
+ v-if="item.id === mainOrganisationDashboardId"
44
+ >
45
+ mdi-account-group-outline
46
+ </FSIcon>
47
+ <FSIcon
48
+ v-if="item.id === mainUserDashboardId"
49
+ >
50
+ mdi-home
51
+ </FSIcon>
52
+ </template>
53
+ <template
54
+ #item.tags="{ item }"
55
+ >
56
+ <FSTagGroup
57
+ variant="slide"
58
+ :showRemove="false"
59
+ :tags="item.tags"
60
+ />
61
+ </template>
62
+ <template
63
+ #item.tile="{ index, item, toggleSelect }"
64
+ >
65
+ <FSDashboardOrganisationTypeTileUI
66
+ v-if="item.dashboardType == DashboardType.OrganisationType"
67
+ :key="index"
68
+ :bottomColor="item.colors"
69
+ :selectable="$props.selectable"
70
+ :singleSelect="$props.singleSelect"
71
+ :to="$props.itemTo && $props.itemTo(item)"
72
+ :modelValue="isSelected(item.id)"
73
+ @update:modelValue="toggleSelect(item)"
74
+ v-bind="item"
75
+ />
76
+ <FSDashboardOrganisationTileUI
77
+ v-if="item.dashboardType == DashboardType.Organisation"
78
+ :key="index"
79
+ :bottomColor="item.colors"
80
+ :selectable="$props.selectable"
81
+ :singleSelect="$props.singleSelect"
82
+ :to="$props.itemTo && $props.itemTo(item)"
83
+ :modelValue="isSelected(item.id)"
84
+ @update:modelValue="toggleSelect(item)"
85
+ v-bind="item"
86
+ />
87
+ <FSDashboardShallowTileUI
88
+ v-if="item.dashboardType == DashboardType.Shallow"
89
+ :key="index"
90
+ :bottomColor="item.colors"
91
+ :selectable="$props.selectable"
92
+ :singleSelect="$props.singleSelect"
93
+ :modelValue="isSelected(item.id)"
94
+ @update:modelValue="toggleSelect(item)"
95
+ :to="$props.itemTo && $props.itemTo(item)"
96
+ v-bind="item"
97
+ />
98
+ </template>
99
+ </FSDataTable>
24
100
  </template>
25
101
 
26
102
  <script lang="ts">
27
- import { defineComponent, type PropType } from "vue";
103
+ import _ from "lodash";
28
104
  import type { RouteLocation } from "vue-router";
105
+ import { computed, defineComponent, onMounted, type PropType, ref, watch } from "vue";
106
+
107
+ import { useAppOrganisationId, useCurrentUserOrganisation, useDashboardOrganisations, useDashboardOrganisationTypes, useDashboardShallows } from "@dative-gpi/foundation-core-services/composables";
108
+ import type { DashboardOrganisationTypeFilters, DashboardOrganisationFilters, DashboardShallowFilters, DashboardInfos } from "@dative-gpi/foundation-core-domain/models";
109
+ import { useOrganisation } from "@dative-gpi/foundation-shared-services/composables";
29
110
 
30
- import { DashboardExplorerElementType, DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
31
- import type { DashboardExplorerElementFilters, DashboardExplorerElementInfos } from "@dative-gpi/foundation-core-domain/models";
111
+ import { dashboardTypeLabel, type DashboardsListItem } from "@dative-gpi/foundation-core-components/utils";
112
+ import { ColorEnum } from '@dative-gpi/foundation-shared-components/models';
113
+ import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
114
+ import { getEnumEntries } from '@dative-gpi/foundation-shared-domain';
32
115
 
33
- import FSBaseDashboardsExplorer from "../../explorers/FSBaseDashboardsExplorer.vue";
116
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
117
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
118
+ import FSDashboardShallowTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardShallowTileUI.vue";
119
+ import FSDashboardOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTileUI.vue";
120
+ import FSDashboardOrganisationTypeTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTypeTileUI.vue";
121
+
122
+ import FSDataTable from "../FSDataTable.vue";
123
+ import FSChip from '@dative-gpi/foundation-shared-components/components/FSChip.vue';
34
124
 
35
125
  export default defineComponent({
36
126
  name: "FSBaseDashboardsList",
37
127
  components: {
38
- FSBaseDashboardsExplorer
128
+ FSDataTable,
129
+ FSTagGroup,
130
+ FSChip,
131
+ FSIcon,
132
+ FSDashboardOrganisationTileUI,
133
+ FSDashboardOrganisationTypeTileUI,
134
+ FSDashboardShallowTileUI
39
135
  },
40
136
  props: {
41
137
  tableCode: {
@@ -43,17 +139,23 @@ export default defineComponent({
43
139
  required: false,
44
140
  default: null
45
141
  },
46
- allowedTypes: {
47
- type: Array as PropType<DashboardExplorerElementType[]>,
48
- required: false,
49
- default: () => [
50
- DashboardExplorerElementType.DashboardOrganisation,
51
- DashboardExplorerElementType.DashboardShallow,
52
- DashboardExplorerElementType.DashboardOrganisationType
53
- ]
142
+ dashboardOrganisationTypeFetchFilter: {
143
+ type: Object as PropType<DashboardOrganisationTypeFilters>,
144
+ default: undefined,
145
+ required: false
146
+ },
147
+ dashboardOrganisationsFilters: {
148
+ type: Object as PropType<DashboardOrganisationFilters>,
149
+ default: undefined,
150
+ required: false
151
+ },
152
+ dashboardShallowsFilters: {
153
+ type: Object as PropType<DashboardShallowFilters>,
154
+ default: undefined,
155
+ required: false
54
156
  },
55
157
  itemTo: {
56
- type: Function as PropType<(item: DashboardExplorerElementInfos) => Partial<RouteLocation>>,
158
+ type: Function as PropType<(item: DashboardInfos) => Partial<RouteLocation>>,
57
159
  required: false
58
160
  },
59
161
  modelValue: {
@@ -71,27 +173,109 @@ export default defineComponent({
71
173
  required: false,
72
174
  default: false
73
175
  },
74
- dashboardExplorerElementsFilters: {
75
- type: Object as PropType<DashboardExplorerElementFilters>,
76
- required: false,
77
- default: () => ({})
78
- },
79
176
  },
80
- emits: ["update:modelValue", "update:types"],
81
- setup(_, { emit }) {
82
- const onUpdateTypes = (types: (DashboardExplorerElementType | undefined)[]): void => {
83
- emit("update:types", types.map(t => {
84
- switch (t) {
85
- case DashboardExplorerElementType.DashboardOrganisation: return DashboardType.Organisation;
86
- case DashboardExplorerElementType.DashboardShallow: return DashboardType.Shallow;
87
- case DashboardExplorerElementType.DashboardOrganisationType: return DashboardType.OrganisationType;
88
- default: return DashboardType.None;
89
- }
90
- }));
177
+ emits: ["update", "update:modelValue", "update:type"],
178
+ setup(props, { emit }) {
179
+ const { entities: dashboardOrganisationTypes, fetching: fetchingDashboardOrganisationTypes, getMany: getManyDashboardOrganisationTypes } = useDashboardOrganisationTypes();
180
+ const { entities: dashboardOrganisations, fetching: fetchingDashboardOrganisations, getMany: getManyDashboardOrganisations } = useDashboardOrganisations();
181
+ const { entities: dashboardShallows, fetching: fetchingDashboardShallows, getMany: getManyDashboardShallows } = useDashboardShallows();
182
+ const { fetch: fetchUserOrganisation, entity: userOrganisation } = useCurrentUserOrganisation();
183
+ const { entity: organisation, get: getOrganisation } = useOrganisation();
184
+ const { organisationId } = useAppOrganisationId();
185
+
186
+ const selecteds = ref<string[]>(props.modelValue);
187
+
188
+ const items = computed((): DashboardsListItem[] => {
189
+ return _.sortBy([
190
+ ...dashboardOrganisationTypes.value.map(g => ({
191
+ ...g,
192
+ dashboardType: DashboardType.OrganisationType
193
+ })) as DashboardsListItem[],
194
+ ...dashboardOrganisations.value.map(d => ({
195
+ ...d,
196
+ dashboardType: DashboardType.Organisation
197
+ })) as DashboardsListItem[],
198
+ ...dashboardShallows.value.map(d => ({
199
+ ...d,
200
+ dashboardType: DashboardType.Shallow
201
+ })) as DashboardsListItem[]
202
+ ], d => d.label);
203
+ });
204
+
205
+ const headersOptions = computed(() => ({
206
+ dashboardType: {
207
+ fixedFilters: getEnumEntries(DashboardType).filter(e => e.value != DashboardType.None).map(e => ({
208
+ value: e.value,
209
+ text: dashboardTypeLabel(e.value)
210
+ })),
211
+ methodFilter: (value: DashboardType, item: DashboardType) => value == item
212
+ }
213
+ }));
214
+
215
+ const mainUserDashboardId = computed(() => {
216
+ return userOrganisation.value?.mainDashboardId;
217
+ });
218
+
219
+ const mainOrganisationDashboardId = computed(() => {
220
+ return organisation.value?.mainDashboardId;
221
+ });
222
+
223
+ const onSelect = (values: string[]) => {
224
+ selecteds.value = values;
225
+ const selectedItems = items.value.filter(i => selecteds.value!.includes(i.id));
226
+ const newModelValue = selectedItems.map(i => i.id);
227
+ const newType = selectedItems.map(i => i.dashboardType);
228
+ emit("update:modelValue", newModelValue);
229
+ emit("update:type", newType);
230
+ emit("update", { modelValue: newModelValue, type: newType });
231
+ };
232
+
233
+ const isSelected = (id: string) => {
234
+ return selecteds.value?.includes(id);
91
235
  };
92
236
 
93
- return {
94
- onUpdateTypes
237
+ onMounted(() => {
238
+ fetchUserOrganisation();
239
+ })
240
+
241
+ watch(() => organisationId.value, () => {
242
+ if (organisationId.value) {
243
+ getOrganisation(organisationId.value);
244
+ }
245
+ }, { immediate: true });
246
+
247
+ watch(() => props.dashboardOrganisationTypeFetchFilter, (next, previous) => {
248
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
249
+ getManyDashboardOrganisationTypes(props.dashboardOrganisationTypeFetchFilter);
250
+ }
251
+ }, { immediate: true });
252
+
253
+ watch(() => props.dashboardOrganisationsFilters, (next, previous) => {
254
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
255
+ getManyDashboardOrganisations(props.dashboardOrganisationsFilters);
256
+ }
257
+ }, { immediate: true });
258
+
259
+ watch(() => props.dashboardShallowsFilters, (next, previous) => {
260
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
261
+ getManyDashboardShallows(props.dashboardShallowsFilters);
262
+ }
263
+ }, { immediate: true });
264
+
265
+ return {
266
+ fetchingDashboardOrganisationTypes,
267
+ fetchingDashboardOrganisations,
268
+ fetchingDashboardShallows,
269
+ headersOptions,
270
+ selecteds,
271
+ ColorEnum,
272
+ items,
273
+ mainUserDashboardId,
274
+ mainOrganisationDashboardId,
275
+ onSelect,
276
+ isSelected,
277
+ DashboardType,
278
+ dashboardTypeLabel
95
279
  };
96
280
  }
97
281
  });
@@ -7,11 +7,14 @@
7
7
  </template>
8
8
 
9
9
  <script lang="ts">
10
- import { defineComponent, type PropType, computed, watch } from "vue";
10
+ import { defineComponent, type PropType, watch, computed } from "vue";
11
+ import _ from "lodash";
11
12
 
12
- import { DashboardExplorerElementType } from "@dative-gpi/foundation-shared-domain/enums";
13
- import { useDashboardExplorerElements } from "@dative-gpi/foundation-core-services/composables";
14
- import type { DashboardExplorerElementFilters, DashboardExplorerElementInfos } from "@dative-gpi/foundation-core-domain/models";
13
+ import type { DashboardOrganisationFilters, DashboardOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
14
+ import { useDashboardOrganisations, useDashboardOrganisationTypes, useDashboardShallows } from "@dative-gpi/foundation-core-services/composables";
15
+
16
+ import { DashboardType } from '@dative-gpi/foundation-shared-domain/enums';
17
+ import type { DashboardsListItem } from '@dative-gpi/foundation-core-components/utils';
15
18
 
16
19
  import FSSimpleList from "@dative-gpi/foundation-shared-components/components/lists/FSSimpleList.vue";
17
20
 
@@ -21,43 +24,66 @@ export default defineComponent({
21
24
  FSSimpleList,
22
25
  },
23
26
  props: {
24
- allowedTypes: {
25
- type: Array as PropType<DashboardExplorerElementType[]>,
27
+ dashboardOrganisationFilters: {
28
+ type: Object as PropType<DashboardOrganisationFilters>,
29
+ required: false,
30
+ default: () => ({})
31
+ },
32
+ dashboardOrganisationTypeFilters: {
33
+ type: Object as PropType<DashboardOrganisationTypeFilters>,
26
34
  required: false,
27
- default: () => [
28
- DashboardExplorerElementType.DashboardOrganisation,
29
- DashboardExplorerElementType.DashboardShallow,
30
- DashboardExplorerElementType.DashboardOrganisationType
31
- ]
35
+ default: () => ({})
32
36
  },
33
- dashboardExplorerElementsFilters: {
34
- type: Object as PropType<DashboardExplorerElementFilters>,
37
+ dashboardShallowFilters: {
38
+ type: Object as PropType<DashboardShallowFilters>,
35
39
  required: false,
36
- default: () => ({})
40
+ default: () => ({})
37
41
  }
38
42
  },
39
- setup(props) {
40
- const { entities, fetching, getMany } = useDashboardExplorerElements();
43
+ setup(props){
44
+ const { entities: dashboardOrganisations,
45
+ getMany: getManyDashboardOrganisations,
46
+ fetching: fetchingDashboardOrganisations } = useDashboardOrganisations();
47
+ const { entities: dashboardOrganisationTypes,
48
+ getMany: getManyDashboardOrganisationTypes,
49
+ fetching: fetchingDashboardOrganisationTypes } = useDashboardOrganisationTypes();
50
+ const { entities: dashboardShallows,
51
+ getMany: getManyDashboardShallows,
52
+ fetching: fetchingDashboardShallows } = useDashboardShallows();
41
53
 
42
- const dashboards = computed((): DashboardExplorerElementInfos[] => {
43
- return entities.value
44
- .filter(e => props.allowedTypes.includes(e.type))
45
- .sort((a, b) => a.label.localeCompare(b.label));
54
+ const fetching = computed(() => fetchingDashboardOrganisations.value
55
+ || fetchingDashboardOrganisationTypes.value
56
+ || fetchingDashboardShallows.value);
57
+
58
+ const dashboards = computed((): DashboardsListItem[] => {
59
+ return _.sortBy([
60
+ ...dashboardOrganisationTypes.value.map(g => ({
61
+ ...g,
62
+ dashboardType: DashboardType.OrganisationType
63
+ })) satisfies DashboardsListItem[],
64
+ ...dashboardOrganisations.value.map(d => ({
65
+ ...d,
66
+ dashboardType: DashboardType.Organisation
67
+ })) as DashboardsListItem[],
68
+ ...dashboardShallows.value.map(d => ({
69
+ ...d,
70
+ dashboardType: DashboardType.Shallow
71
+ })) as DashboardsListItem[]
72
+ ], d => d.label);
46
73
  });
47
74
 
48
75
  const fetch = () => {
49
- getMany({
50
- types: props.allowedTypes,
51
- ...props.dashboardExplorerElementsFilters
52
- });
53
- };
76
+ getManyDashboardOrganisations(props.dashboardOrganisationFilters);
77
+ getManyDashboardOrganisationTypes(props.dashboardOrganisationTypeFilters);
78
+ getManyDashboardShallows(props.dashboardShallowFilters);
79
+ }
54
80
 
55
- watch(() => props.dashboardExplorerElementsFilters, fetch, { immediate: true });
81
+ watch(() => [props.dashboardOrganisationFilters, props.dashboardOrganisationTypeFilters], fetch, { immediate: true });
56
82
 
57
83
  return {
58
84
  dashboards,
59
85
  fetching
60
- };
86
+ }
61
87
  }
62
88
  });
63
89
  </script>
@@ -11,7 +11,7 @@
11
11
  #item.tile="{ item, toggleSelect, direction }"
12
12
  >
13
13
  <FSDashboardOrganisationTileUI
14
- v-if="item.type === DashboardExplorerElementType.DashboardOrganisation"
14
+ v-if="item.dashboardType === DashboardType.Organisation"
15
15
  :code="item.code"
16
16
  :icon="item.icon"
17
17
  :label="item.label"
@@ -23,7 +23,7 @@
23
23
  @update:modelValue="toggleSelect(item)"
24
24
  />
25
25
  <FSDashboardOrganisationTypeTileUI
26
- v-else-if="item.type === DashboardExplorerElementType.DashboardOrganisationType"
26
+ v-else-if="item.dashboardType === DashboardType.OrganisationType"
27
27
  :code="item.code"
28
28
  :icon="item.icon"
29
29
  :label="item.label"
@@ -35,7 +35,7 @@
35
35
  @update:modelValue="toggleSelect(item)"
36
36
  />
37
37
  <FSDashboardShallowTileUI
38
- v-else-if="item.type === DashboardExplorerElementType.DashboardShallow"
38
+ v-else-if="item.dashboardType === DashboardType.Shallow"
39
39
  :code="item.code"
40
40
  :icon="item.icon"
41
41
  :label="item.label"
@@ -51,17 +51,23 @@
51
51
  </template>
52
52
 
53
53
  <script lang="ts">
54
- import { defineComponent, type PropType, computed, watch } from "vue";
54
+ import { defineComponent, type PropType, watch, computed } from "vue";
55
+ import _ from "lodash";
55
56
 
56
- import { DashboardExplorerElementType, ListDirections } from "@dative-gpi/foundation-shared-domain/enums";
57
- import { useDashboardExplorerElements } from "@dative-gpi/foundation-core-services/composables";
58
- import type { DashboardExplorerElementFilters, DashboardExplorerElementInfos } from "@dative-gpi/foundation-core-domain/models";
57
+ import type { DashboardOrganisationFilters, DashboardOrganisationTypeFilters, DashboardShallowFilters } from "@dative-gpi/foundation-core-domain/models";
58
+ import { useDashboardOrganisations, useDashboardOrganisationTypes, useDashboardShallows } from "@dative-gpi/foundation-core-services/composables";
59
+
60
+ import { DashboardType } from '@dative-gpi/foundation-shared-domain/enums';
61
+ import type { DashboardsListItem } from '@dative-gpi/foundation-core-components/utils';
59
62
 
60
63
  import FSDashboardOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTileUI.vue";
61
64
  import FSDashboardOrganisationTypeTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTypeTileUI.vue";
62
65
  import FSDashboardShallowTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardShallowTileUI.vue";
63
66
  import FSTileList from "@dative-gpi/foundation-shared-components/components/lists/FSTileList.vue";
64
67
 
68
+ import { ListDirections } from "@dative-gpi/foundation-shared-domain/enums";
69
+
70
+
65
71
  export default defineComponent({
66
72
  name: "FSTileDashboardsList",
67
73
  components: {
@@ -71,14 +77,20 @@ export default defineComponent({
71
77
  FSDashboardShallowTileUI
72
78
  },
73
79
  props: {
74
- allowedTypes: {
75
- type: Array as PropType<DashboardExplorerElementType[]>,
80
+ dashboardOrganisationFilters: {
81
+ type: Object as PropType<DashboardOrganisationFilters>,
76
82
  required: false,
77
- default: () => [
78
- DashboardExplorerElementType.DashboardOrganisation,
79
- DashboardExplorerElementType.DashboardShallow,
80
- DashboardExplorerElementType.DashboardOrganisationType
81
- ]
83
+ default: () => ({})
84
+ },
85
+ dashboardOrganisationTypeFilters: {
86
+ type: Object as PropType<DashboardOrganisationTypeFilters>,
87
+ required: false,
88
+ default: () => ({})
89
+ },
90
+ dashboardShallowFilters: {
91
+ type: Object as PropType<DashboardShallowFilters>,
92
+ required: false,
93
+ default: () => ({})
82
94
  },
83
95
  modelValue: {
84
96
  type: Array as PropType<string[]>,
@@ -89,36 +101,56 @@ export default defineComponent({
89
101
  type: Boolean,
90
102
  required: false,
91
103
  default: false
92
- },
93
- dashboardExplorerElementsFilters: {
94
- type: Object as PropType<DashboardExplorerElementFilters>,
95
- required: false,
96
- default: () => ({})
97
104
  }
98
105
  },
99
106
  emits: ["update:modelValue"],
100
107
  setup(props) {
101
- const { entities, fetching, getMany } = useDashboardExplorerElements();
108
+ const { entities: dashboardOrganisations,
109
+ getMany: getManyDashboardOrganisations,
110
+ fetching: fetchingDashboardOrganisations } = useDashboardOrganisations();
111
+ const { entities: dashboardOrganisationTypes,
112
+ getMany: getManyDashboardOrganisationTypes,
113
+ fetching: fetchingDashboardOrganisationTypes } = useDashboardOrganisationTypes();
114
+ const { entities: dashboardShallows,
115
+ getMany: getManyDashboardShallows,
116
+ fetching: fetchingDashboardShallows } = useDashboardShallows();
102
117
 
103
- const dashboards = computed((): DashboardExplorerElementInfos[] => {
104
- return entities.value
105
- .filter(e => props.allowedTypes.includes(e.type))
106
- .sort((a, b) => a.label.localeCompare(b.label));
118
+ const fetching = computed(() => fetchingDashboardOrganisations.value
119
+ || fetchingDashboardOrganisationTypes.value
120
+ || fetchingDashboardShallows.value);
121
+
122
+ const dashboards = computed((): DashboardsListItem[] => {
123
+ return _.sortBy([
124
+ ...dashboardOrganisationTypes.value.map(g => ({
125
+ ...g,
126
+ dashboardType: DashboardType.OrganisationType
127
+ })) satisfies DashboardsListItem[],
128
+ ...dashboardOrganisations.value.map(d => ({
129
+ ...d,
130
+ dashboardType: DashboardType.Organisation
131
+ })) as DashboardsListItem[],
132
+ ...dashboardShallows.value.map(d => ({
133
+ ...d,
134
+ dashboardType: DashboardType.Shallow
135
+ })) as DashboardsListItem[]
136
+ ], d => d.label);
107
137
  });
108
138
 
109
139
  const fetch = () => {
110
- getMany({
111
- types: props.allowedTypes,
112
- ...props.dashboardExplorerElementsFilters
113
- });
140
+ getManyDashboardOrganisations(props.dashboardOrganisationFilters);
141
+ getManyDashboardOrganisationTypes(props.dashboardOrganisationTypeFilters);
142
+ getManyDashboardShallows(props.dashboardShallowFilters);
114
143
  };
115
144
 
116
- watch(() => props.dashboardExplorerElementsFilters, fetch, { immediate: true });
145
+ watch(
146
+ [() => props.dashboardOrganisationFilters, () => props.dashboardOrganisationTypeFilters, () => props.dashboardShallowFilters],
147
+ fetch,
148
+ { immediate: true });
117
149
 
118
150
  return {
119
151
  dashboards,
120
152
  fetching,
121
- DashboardExplorerElementType,
153
+ DashboardType,
122
154
  ListDirections
123
155
  };
124
156
  }