@dative-gpi/foundation-core-components 1.0.57 → 1.0.58-groupings

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 (82) hide show
  1. package/components/autocompletes/FSAutocompleteChart.vue +15 -8
  2. package/components/autocompletes/FSAutocompleteDashboard.vue +14 -6
  3. package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +7 -1
  4. package/components/autocompletes/FSAutocompleteDataCategory.vue +11 -5
  5. package/components/autocompletes/FSAutocompleteDataDefinition.vue +7 -1
  6. package/components/autocompletes/FSAutocompleteGroup.vue +7 -1
  7. package/components/autocompletes/FSAutocompleteLocation.vue +6 -0
  8. package/components/autocompletes/FSAutocompleteManufacturer.vue +8 -0
  9. package/components/autocompletes/FSAutocompleteModel.vue +9 -1
  10. package/components/autocompletes/FSAutocompleteOrganisationType.vue +7 -1
  11. package/components/autocompletes/FSAutocompleteRole.vue +14 -6
  12. package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +7 -1
  13. package/components/autocompletes/FSAutocompleteUserOrganisation.vue +9 -1
  14. package/components/customProperties/FSMetaField.vue +35 -40
  15. package/components/customProperties/FSMetaFormContent.vue +4 -3
  16. package/components/customProperties/FSMetaHistory.vue +2 -2
  17. package/components/customProperties/FSMetaValue.vue +63 -31
  18. package/components/customProperties/helpers.ts +57 -165
  19. package/components/entities/FSBaseEntitiesList.vue +14 -4
  20. package/components/entities/FSDialogSelectEntities.vue +28 -106
  21. package/components/entities/FSEntityField.vue +75 -14
  22. package/components/entities/FSSelectEntitiesList.vue +225 -0
  23. package/components/explorers/FSBaseDevicesExplorer.vue +312 -0
  24. package/components/explorers/FSBaseFoldersExplorer.vue +286 -0
  25. package/components/lists/FSDataTable.vue +23 -21
  26. package/components/lists/alerts/FSBaseAlertsList.vue +95 -97
  27. package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +4 -4
  28. package/components/lists/authTokens/FSBaseAuthTokensList.vue +6 -4
  29. package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +103 -38
  30. package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +104 -39
  31. package/components/lists/charts/FSBaseChartsList.vue +147 -66
  32. package/components/lists/comments/FSBaseCommentsList.vue +39 -23
  33. package/components/lists/connectivityScenarios/FSBaseConnectivityScenariosList.vue +128 -0
  34. package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +39 -7
  35. package/components/lists/dashboards/FSBaseDashboardsList.vue +44 -13
  36. package/components/lists/dashboards/FSSimpleDashboardsList.vue +33 -7
  37. package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +6 -5
  38. package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +6 -4
  39. package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +179 -61
  40. package/components/lists/folders/FSBaseFoldersList.vue +37 -146
  41. package/components/lists/groupings/FSBaseGroupingsList.vue +117 -0
  42. package/components/lists/groups/FSBaseGroupsList.vue +24 -7
  43. package/components/lists/locations/FSBaseLocationsList.vue +52 -13
  44. package/components/lists/models/FSBaseModelsList.vue +45 -15
  45. package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +17 -10
  46. package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +28 -21
  47. package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +56 -13
  48. package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +56 -12
  49. package/components/lists/scenarios/FSBaseScenariosList.vue +122 -81
  50. package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +31 -18
  51. package/components/lists/serviceAccountRoleOrganisations/FSBaseServiceAccountRoleOrganisationsList.vue +128 -0
  52. package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +30 -19
  53. package/components/lists/userOrganisations/FSChipUserOrganisationsList.vue +61 -0
  54. package/components/tiles/FSChartTile.vue +71 -0
  55. package/components/tiles/FSDashboardOrganisationTile.vue +3 -3
  56. package/components/tiles/FSDashboardOrganisationTypeTile.vue +3 -3
  57. package/components/tiles/FSDashboardShallowTile.vue +3 -3
  58. package/components/tiles/FSDeviceOrganisationTile.vue +12 -5
  59. package/components/tiles/FSFolderTile.vue +3 -3
  60. package/components/tiles/FSGroupTile.vue +3 -3
  61. package/components/tiles/FSLocationTile.vue +5 -3
  62. package/components/tiles/FSModelTile.vue +64 -0
  63. package/components/tiles/FSServiceAccountOrganisationTile.vue +3 -3
  64. package/components/tiles/FSUserOrganisationTile.vue +3 -3
  65. package/components/treeviews/FSTreeViewFolder.vue +15 -3
  66. package/components/treeviews/FSTreeViewGroup.vue +22 -4
  67. package/package.json +9 -9
  68. package/utils/dashboards.ts +3 -3
  69. package/utils/index.ts +0 -1
  70. package/utils/roles.ts +3 -3
  71. package/utils/users.ts +3 -3
  72. package/components/selects/FSAggregationSelector.vue +0 -51
  73. package/components/selects/FSAxisTypeSelector.vue +0 -48
  74. package/components/selects/FSDisplayAsSelector.vue +0 -52
  75. package/components/selects/FSFilterTypeSelector.vue +0 -53
  76. package/components/selects/FSHeatmapRuleSelector.vue +0 -52
  77. package/components/selects/FSOperationOnSelector.vue +0 -51
  78. package/components/selects/FSPlanningTypeSelector.vue +0 -51
  79. package/components/selects/FSPlotPerSelector.vue +0 -51
  80. package/components/selects/FSSelectEntityType.vue +0 -59
  81. package/components/selects/FSSerieTypeSelector.vue +0 -51
  82. package/utils/charts.ts +0 -137
@@ -1,10 +1,13 @@
1
1
  <template>
2
2
  <FSDataTable
3
- :items="deviceOrganisations"
4
- :customSorts="customSorts"
5
- :itemTo="$props.itemTo"
3
+ defaultMode="iterator"
6
4
  :loading="fetchingDeviceOrganisations"
5
+ :singleSelect="$props.singleSelect"
6
+ :headersOptions="headersOptions"
7
+ :selectable="$props.selectable"
7
8
  :tableCode="$props.tableCode"
9
+ :items="deviceOrganisations"
10
+ :itemTo="$props.itemTo"
8
11
  :modelValue="$props.modelValue"
9
12
  @update:modelValue="$emit('update:modelValue', $event)"
10
13
  v-bind="$attrs"
@@ -19,10 +22,10 @@
19
22
  />
20
23
  </template>
21
24
  <template
22
- #header.connectable-title
25
+ #header.imageId-title
23
26
  >
24
27
  <FSIcon>
25
- mdi-wifi
28
+ mdi-panorama-variant-outline
26
29
  </FSIcon>
27
30
  </template>
28
31
  <template
@@ -40,18 +43,9 @@
40
43
  height="32px"
41
44
  width="32px"
42
45
  :imageId="item.imageId"
46
+ :thumbnail="true"
43
47
  />
44
48
  </template>
45
- <template
46
- #item.connectable="{ item }"
47
- >
48
- <FSCol>
49
- <FSConnectivity
50
- v-if="item.connectivity.status != ConnectivityStatus.None"
51
- :deviceConnectivity="item.connectivity"
52
- />
53
- </FSCol>
54
- </template>
55
49
  <template
56
50
  #item.connectivity="{ item }"
57
51
  >
@@ -74,7 +68,7 @@
74
68
  >
75
69
  <FSTagGroup
76
70
  variant="slide"
77
- :editable="false"
71
+ :showRemove="false"
78
72
  :tags="item.tags"
79
73
  />
80
74
  </template>
@@ -82,16 +76,26 @@
82
76
  #item.worstAlert="{ item }"
83
77
  >
84
78
  <FSWorstAlert
79
+ v-if="item.worstAlert"
80
+ :deviceWorstAlert="item.worstAlert"
85
81
  :deviceAlerts="item.alerts"
86
- :deviceAlert="item.worstAlert"
82
+ :alertTo="$props.alertTo"
83
+ />
84
+ <div
85
+ v-else
87
86
  />
88
87
  </template>
89
88
  <template
90
89
  #item.alerts="{ item }"
91
90
  >
92
91
  <FSWorstAlert
93
- :deviceAlerts="item.alerts.length"
94
- :deviceAlert="item.worstAlert"
92
+ v-if="item.worstAlert"
93
+ :deviceWorstAlert="item.worstAlert"
94
+ :deviceAlerts="item.alerts"
95
+ :alertTo="$props.alertTo"
96
+ />
97
+ <div
98
+ v-else
95
99
  />
96
100
  </template>
97
101
  <template
@@ -121,67 +125,81 @@
121
125
  :meta="item.meta"
122
126
  />
123
127
  </template>
124
-
128
+ <template
129
+ v-for="(property, index) in customProperties"
130
+ #[`filter.meta.${property.code}`]="{ filter }"
131
+ :key="index"
132
+ >
133
+ <FSMetaValue
134
+ v-if="filter.text !== '—'"
135
+ variant="colorless"
136
+ :customProperty="property"
137
+ :meta="{ [property.code]: filter.text }"
138
+ />
139
+ </template>
125
140
  <template
126
141
  #item.tile="{ item, toggleSelect }"
127
142
  >
128
143
  <FSDeviceOrganisationTileUI
129
- v-bind="item"
130
- :modelValue="isSelected(item.id)"
131
- :singleSelect="singleSelect"
132
- :deviceStatuses="item.status.statuses"
144
+ :to="$props.itemTo && $props.itemTo(item)"
145
+ :selectable="$props.selectable"
133
146
  :deviceConnectivity="item.connectivity"
147
+ :deviceStatuses="item.status.statuses"
134
148
  :deviceWorstAlert="item.worstAlert"
149
+ :singleSelect="$props.singleSelect"
135
150
  :deviceAlerts="item.alerts"
136
- :to="$props.itemTo && $props.itemTo(item)"
151
+ :alertTo="$props.alertTo"
152
+ :modelValue="isSelected(item.id)"
137
153
  @update:modelValue="toggleSelect(item)"
154
+ v-bind="item"
138
155
  />
139
156
  </template>
140
157
  </FSDataTable>
141
158
  </template>
142
159
 
143
160
  <script lang="ts">
144
- import type { PropType} from "vue";
145
- import type { RouteLocation } from "vue-router";
146
- import { computed, defineComponent, onMounted, watch } from "vue";
161
+ import { computed, defineComponent, onMounted, type PropType, watch } from "vue";
162
+ import { type RouteLocation } from "vue-router";
147
163
  import _ from "lodash";
164
+
165
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
148
166
 
149
- import { alphanumericSort } from "@dative-gpi/foundation-shared-components/utils";
150
- import { ConnectivityStatus, PropertyEntity } from "@dative-gpi/foundation-shared-domain/enums";
167
+ import { ConnectivityStatus, Criticity, PropertyEntity } from "@dative-gpi/foundation-shared-domain/enums";
168
+ import { alphanumericSort, connectivityLabel } from "@dative-gpi/foundation-shared-components/utils";
169
+ import { AlertTools } from "@dative-gpi/foundation-shared-components/tools";
151
170
 
171
+ import type { DeviceConnectivityDetails, DeviceOrganisationAlert, DeviceOrganisationFilters, DeviceOrganisationInfos, DeviceStatusDetails} from "@dative-gpi/foundation-core-domain/models";
152
172
  import { useCustomProperties, useDeviceOrganisations } from "@dative-gpi/foundation-core-services/composables";
153
- import type { DeviceConnectivityDetails, DeviceOrganisationFilters, DeviceOrganisationInfos} from "@dative-gpi/foundation-core-domain/models";
154
173
 
155
- import FSDataTable from "../FSDataTable.vue";
156
174
  import FSMetaValue from "../../customProperties/FSMetaValue.vue";
175
+ import FSDataTable from "../FSDataTable.vue";
157
176
 
158
- import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
159
- import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
160
- import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
161
- import FSWorstAlert from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSWorstAlert.vue";
162
- import FSConnectivity from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSConnectivity.vue";
163
- import FSStatusesCarousel from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSStatusesCarousel.vue";
164
177
  import FSDeviceOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDeviceOrganisationTileUI.vue";
178
+ import FSStatusesCarousel from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSStatusesCarousel.vue";
179
+ import FSConnectivity from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSConnectivity.vue";
180
+ import FSWorstAlert from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSWorstAlert.vue";
181
+ import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
182
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
183
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
165
184
 
166
-
167
185
  export default defineComponent({
168
186
  name: "FSBaseDeviceOrganisationsList",
169
187
  components: {
170
- FSConnectivity,
171
- FSDataTable,
172
188
  FSDeviceOrganisationTileUI,
189
+ FSStatusesCarousel,
190
+ FSConnectivity,
191
+ FSWorstAlert,
192
+ FSDataTable,
173
193
  FSIconCheck,
174
- FSImage,
175
194
  FSMetaValue,
176
- FSStatusesCarousel,
177
195
  FSTagGroup,
178
- FSWorstAlert
196
+ FSImage
179
197
  },
180
198
  props: {
181
- modelValue: {
182
- type: Array as PropType<string[]>,
183
- default: () => [],
184
- required: false
199
+ tableCode: {
200
+ type: String as PropType<string | null>,
201
+ required: false,
202
+ default: null
185
203
  },
186
204
  deviceOrganisationFilters: {
187
205
  type: Object as PropType<DeviceOrganisationFilters>,
@@ -197,20 +215,32 @@ export default defineComponent({
197
215
  type: Function as PropType<(item: DeviceOrganisationInfos) => Partial<RouteLocation>>,
198
216
  required: false
199
217
  },
218
+ alertTo: {
219
+ type: Function,
220
+ required: false,
221
+ default: null
222
+ },
223
+ selectable: {
224
+ type: Boolean,
225
+ required: false,
226
+ default: true
227
+ },
200
228
  singleSelect: {
201
229
  type: Boolean,
202
230
  required: false,
203
231
  default: false
204
232
  },
205
- tableCode: {
206
- type: String,
207
- required: true
233
+ modelValue: {
234
+ type: Array as PropType<string[]>,
235
+ default: () => [],
236
+ required: false
208
237
  }
209
238
  },
210
239
  emits: ["update:modelValue"],
211
240
  setup(props) {
212
241
  const { fetching: fecthingCustomProperties, entities: customProperties, getMany: getManyCustomProperties } = useCustomProperties();
213
242
  const { entities, fetching: fetchingDeviceOrganisations, getMany: getManyDeviceOrganisations } = useDeviceOrganisations();
243
+ const { $tr } = useTranslationsProvider();
214
244
 
215
245
  const deviceOrganisations = computed((): DeviceOrganisationInfos[] => {
216
246
  if (props.connectedOnly) {
@@ -218,17 +248,105 @@ export default defineComponent({
218
248
  }
219
249
  return entities.value;
220
250
  });
221
-
222
- const customSorts = computed(() => {
223
- return {
224
- connectable: (a:DeviceConnectivityDetails, b:DeviceConnectivityDetails) => {
225
- return alphanumericSort(a?.status, b?.status);
251
+
252
+ const headersOptions = computed(() => ({
253
+ status: {
254
+ fixedFilters: [{
255
+ value: true,
256
+ text: $tr("ui.device-organisation.has-statuses", "Has statuses")
257
+ }, {
258
+ value: false,
259
+ text: $tr("ui.device-organisation.has-no-statuses", "Has no statuses")
260
+ }],
261
+ methodFilter: (value: boolean, item: DeviceStatusDetails) => {
262
+ return value ? item.statuses.length > 0 : item.statuses.length === 0;
226
263
  },
227
- connectivity: (a:DeviceConnectivityDetails, b:DeviceConnectivityDetails) => {
228
- return alphanumericSort(a?.status, b?.status);
264
+ sort: (a: DeviceStatusDetails, b: DeviceStatusDetails) => a.statuses.length - b.statuses.length
265
+ },
266
+ connectivity: {
267
+ fixedFilters: [{
268
+ value: ConnectivityStatus.None,
269
+ text: "—"
270
+ }, {
271
+ value: ConnectivityStatus.Offline,
272
+ text: connectivityLabel(ConnectivityStatus.Offline)
273
+ }, {
274
+ value: ConnectivityStatus.AlmostOffline,
275
+ text: connectivityLabel(ConnectivityStatus.AlmostOffline)
276
+ }, {
277
+ value: ConnectivityStatus.PartiallyConnected,
278
+ text: connectivityLabel(ConnectivityStatus.PartiallyConnected)
279
+ }, {
280
+ value: ConnectivityStatus.Connected,
281
+ text: connectivityLabel(ConnectivityStatus.Connected)
282
+ }],
283
+ methodFilter: (value: ConnectivityStatus, item: DeviceConnectivityDetails) => {
284
+ switch(value) {
285
+ case ConnectivityStatus.None:
286
+ return !item.status;
287
+ default:
288
+ return item.status == value;
289
+ }
290
+ },
291
+ sort: (a: DeviceConnectivityDetails, b: DeviceConnectivityDetails) => alphanumericSort(a?.status, b?.status)
292
+ },
293
+ alerts: {
294
+ fixedFilters: [{
295
+ value: true,
296
+ text: $tr("ui.device-organisation.has-alerts", "Has alerts")
297
+ }, {
298
+ value: false,
299
+ text: $tr("ui.device-organisation.has-no-alerts", "Has no alerts")
300
+ }],
301
+ methodFilter: (value: boolean, item: DeviceOrganisationAlert[]) => {
302
+ return value ? item.length > 0 : item.length === 0;
303
+ },
304
+ sort: (a: DeviceOrganisationAlert[], b: DeviceOrganisationAlert[]) => a.length - b.length
305
+ },
306
+ worstAlert: {
307
+ fixedFilters: [{
308
+ value: Criticity.None,
309
+ text: "—"
310
+ }, {
311
+ value: Criticity.Information,
312
+ text: AlertTools.criticityLabel(Criticity.Information)
313
+ }, {
314
+ value: Criticity.Warning,
315
+ text: AlertTools.criticityLabel(Criticity.Warning)
316
+ }, {
317
+ value: Criticity.Error,
318
+ text: AlertTools.criticityLabel(Criticity.Error)
319
+ }],
320
+ methodFilter: (value: Criticity, item: DeviceOrganisationAlert | null) => {
321
+ switch(value) {
322
+ case Criticity.None:
323
+ return !item;
324
+ default:
325
+ return item != null && item.criticity === value;
326
+ }
327
+ },
328
+ sort: (a: DeviceOrganisationAlert, b: DeviceOrganisationAlert) => alphanumericSort(a?.criticity, b?.criticity)
329
+ },
330
+ ...customProperties.value.reduce((acc, cp) => ({
331
+ ...acc,
332
+ [`meta.${cp.code}`]: {
333
+ fixedFilters: cp.useOnlyAllowedValues ? [{
334
+ value: (null as string | null),
335
+ text: "—"
336
+ }].concat(Object.keys(cp.allowedValues).map(av => ({
337
+ value: av,
338
+ text: av
339
+ }))): undefined,
340
+ methodFilterRaw: (value: any, item: DeviceOrganisationInfos) => {
341
+ if (cp.useOnlyAllowedValues) {
342
+ return (!Object.keys(cp.allowedValues).includes(item.meta[cp.code])) && !value || item.meta[cp.code] == value
343
+ }
344
+ return item.meta[cp.code] == value
345
+ },
346
+ sort: (a: string, b: string) => alphanumericSort(a, b)
229
347
  }
230
- }
231
- });
348
+ }), {})
349
+ }));
232
350
 
233
351
  const isSelected = (id: string): boolean => {
234
352
  return props.modelValue.includes(id);
@@ -252,7 +370,7 @@ export default defineComponent({
252
370
  deviceOrganisations,
253
371
  ConnectivityStatus,
254
372
  customProperties,
255
- customSorts,
373
+ headersOptions,
256
374
  isSelected
257
375
  };
258
376
  }
@@ -1,11 +1,12 @@
1
1
  <template>
2
2
  <FSDataTable
3
- :items="items"
4
- :item-to="$props.itemTo"
5
- :loading="fetchingFolders || fetchingDashboardOrganisations || fetchingDashboardShallows"
3
+ defaultMode="iterator"
4
+ :items="folders"
5
+ :itemTo="$props.itemTo"
6
+ :loading="fetchingFolders"
6
7
  :tableCode="$props.tableCode"
7
- :modelValue="selecteds"
8
- @update:modelValue="onSelect"
8
+ :modelValue="$props.modelValue"
9
+ @update:modelValue="$emit('update:modelValue', $event)"
9
10
  v-bind="$attrs"
10
11
  >
11
12
  <template
@@ -18,21 +19,6 @@
18
19
  />
19
20
  </template>
20
21
 
21
- <template
22
- #item.main="{ item }"
23
- >
24
- <FSIcon
25
- v-if="item.id === mainOrganisationDashboardId"
26
- >
27
- mdi-account-group-outline
28
- </FSIcon>
29
- <FSIcon
30
- v-if="item.id === mainUserDashboardId"
31
- >
32
- mdi-home
33
- </FSIcon>
34
- </template>
35
-
36
22
  <template
37
23
  #item.icon="{ item }"
38
24
  >
@@ -40,192 +26,97 @@
40
26
  {{ item.icon }}
41
27
  </FSIcon>
42
28
  </template>
29
+ <template
30
+ #item.tags="{ item }"
31
+ >
32
+ <FSTagGroup
33
+ variant="slide"
34
+ :showRemove="false"
35
+ :tags="item.tags"
36
+ />
37
+ </template>
43
38
 
44
39
  <template
45
40
  #item.tile="{ item, toggleSelect }"
46
41
  >
47
42
  <FSFolderTileUI
48
- v-if="item.type == FoldersListType.Folder"
49
- :bottomColor="item.colors"
50
- v-bind="item"
51
- :modelValue="isSelected(item.id)"
52
- @update:modelValue="toggleSelect(item)"
53
- :to="$props.itemTo && $props.itemTo(item)"
54
- />
55
- <FSDashboardOrganisationTileUI
56
- v-if="item.type == FoldersListType.Dashboard && item.dashboardType == DashboardType.Organisation"
57
43
  :bottomColor="item.colors"
58
- :modelValue="isSelected(item.id)"
59
- @update:modelValue="toggleSelect(item)"
60
- :to="$props.itemTo && $props.itemTo(item)"
61
44
  v-bind="item"
62
- />
63
- <FSDashboardShallowTileUI
64
- v-if="item.type == FoldersListType.Dashboard && item.dashboardType == DashboardType.Shallow"
65
- :bottomColor="item.colors"
66
45
  :modelValue="isSelected(item.id)"
67
46
  @update:modelValue="toggleSelect(item)"
68
47
  :to="$props.itemTo && $props.itemTo(item)"
69
- v-bind="item"
70
48
  />
71
49
  </template>
72
50
  </FSDataTable>
73
51
  </template>
74
52
 
75
53
  <script lang="ts">
76
- import type { PropType} from "vue";
77
- import type { RouteLocation } from "vue-router";
78
- import { computed, defineComponent, onMounted, ref, watch } from "vue";
79
54
  import _ from "lodash";
55
+ import type { RouteLocation } from "vue-router";
56
+ import { defineComponent, type PropType, watch } from "vue";
80
57
 
81
- import { useOrganisation } from "@dative-gpi/foundation-shared-services/composables";
82
- import { useDashboardOrganisations, useFolders, useDashboardShallows, useAppOrganisationId, useCurrentUserOrganisation } from "@dative-gpi/foundation-core-services/composables";
58
+ import { useFolders } from "@dative-gpi/foundation-core-services/composables";
83
59
 
84
60
  import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
85
- import { FoldersListType, type FoldersListItem } from "@dative-gpi/foundation-core-components/utils";
86
- import type { FolderFilters, DashboardOrganisationFilters, DashboardShallowFilters, DashboardInfos } from "@dative-gpi/foundation-core-domain/models";
61
+ import { FoldersListType } from "@dative-gpi/foundation-core-components/utils";
62
+ import type { FolderFilters, DashboardInfos } from "@dative-gpi/foundation-core-domain/models";
87
63
 
88
- import FSDataTable from "../FSDataTable.vue";
89
64
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
65
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
90
66
  import FSFolderTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSFolderTileUI.vue";
91
- import FSDashboardOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTileUI.vue";
92
- import FSDashboardShallowTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardShallowTileUI.vue";
93
67
 
68
+ import FSDataTable from "../FSDataTable.vue";
94
69
 
95
70
  export default defineComponent({
96
71
  name: "FSBaseFoldersList",
97
72
  components: {
98
- FSDataTable,
99
- FSIcon,
100
73
  FSFolderTileUI,
101
- FSDashboardOrganisationTileUI,
102
- FSDashboardShallowTileUI
74
+ FSDataTable,
75
+ FSTagGroup,
76
+ FSIcon
103
77
  },
104
78
  props: {
79
+ tableCode: {
80
+ type: String as PropType<string | null>,
81
+ required: false,
82
+ default: null
83
+ },
105
84
  foldersFilters: {
106
85
  type: Object as PropType<FolderFilters>,
107
86
  default: undefined,
108
87
  required: false
109
88
  },
110
- dashboardOrganisationsFilters: {
111
- type: Object as PropType<DashboardOrganisationFilters>,
112
- default: undefined,
113
- required: false
114
- },
115
- dashboardShallowsFilters: {
116
- type: Object as PropType<DashboardShallowFilters>,
117
- default: undefined,
89
+ itemTo: {
90
+ type: Function as PropType<(item: DashboardInfos) => Partial<RouteLocation>>,
118
91
  required: false
119
92
  },
120
93
  modelValue: {
121
94
  type: Array as PropType<string[]>,
122
95
  required: false,
123
96
  default: () => []
124
- },
125
- itemTo: {
126
- type: Function as PropType<(item: DashboardInfos) => Partial<RouteLocation>>,
127
- required: false
128
- },
129
- tableCode: {
130
- type: String,
131
- required: true
132
97
  }
133
98
  },
134
- emits: ["update:modelValue", "update:type", "update:dashboard-type"],
99
+ emits: ["update:modelValue"],
135
100
  setup(props, { emit }) {
136
-
137
- const { fetch: fetchUserOrganisation, entity: userOrganisation } = useCurrentUserOrganisation();
138
- const { entity: organisation, get: getOrganisation } = useOrganisation();
139
- const { organisationId } = useAppOrganisationId();
140
-
141
- const { entities: dashboardOrganisations, fetching: fetchingDashboardOrganisations, getMany: getManyDashboardOrganisations } = useDashboardOrganisations();
142
- const { entities: dashboardShallows, fetching: fetchingDashboardShallows, getMany: getManyDashboardShallows } = useDashboardShallows();
143
101
  const { entities: folders, fetching: fetchingFolders, getMany: getManyFolders } = useFolders();
144
102
 
145
- const selecteds = ref<string[]>([]);
146
-
147
- const mainUserDashboardId = computed(() => {
148
- return userOrganisation.value?.mainDashboardId;
149
- });
150
-
151
- const mainOrganisationDashboardId = computed(() => {
152
- return organisation.value?.mainDashboardId;
153
- });
154
-
155
- const items = computed((): FoldersListItem[] => {
156
- return [
157
- ...folders.value.map(g => ({
158
- ...g,
159
- type: FoldersListType.Folder,
160
- dashboardType: DashboardType.None
161
- })) as FoldersListItem[],
162
- ..._.sortBy([
163
- ...dashboardOrganisations.value.map(d => ({
164
- ...d,
165
- type: FoldersListType.Dashboard,
166
- dashboardType: DashboardType.Organisation
167
- })) as FoldersListItem[],
168
- ...dashboardShallows.value.map(d => ({
169
- ...d,
170
- type: FoldersListType.Dashboard,
171
- dashboardType: DashboardType.Shallow
172
- })) as FoldersListItem[]
173
- ], d => d.label)
174
- ]
175
- })
176
-
177
103
  const onSelect = (values: string[]) => {
178
- selecteds.value = values;
179
- const selectedItems = items.value.filter(i => selecteds.value!.includes(i.id));
180
- emit("update:dashboard-type", selectedItems.map(i => i.dashboardType));
181
- emit("update:modelValue", selectedItems.map(i => i.id));
182
- emit("update:type", selectedItems.map(i => i.type));
104
+ emit("update:modelValue", values);
183
105
  };
184
106
 
185
107
  const isSelected = (id: string) => {
186
- return selecteds.value?.includes(id);
108
+ return props.modelValue?.includes(id);
187
109
  };
188
-
189
- onMounted(() => {
190
- fetchUserOrganisation();
191
- })
192
-
193
- watch(() => organisationId.value, () => {
194
- if (organisationId.value) {
195
- getOrganisation(organisationId.value);
196
- }
197
- }, { immediate: true });
198
-
110
+
199
111
  watch(() => props.foldersFilters, (next, previous) => {
200
112
  if ((!next && !previous) || !_.isEqual(next, previous)) {
201
113
  getManyFolders(props.foldersFilters, f => f.parentId == props.foldersFilters?.parentId);
202
114
  }
203
115
  }, { immediate: true });
204
116
 
205
- watch(() => props.dashboardOrganisationsFilters, (next, previous) => {
206
- if ((!next && !previous) || !_.isEqual(next, previous)) {
207
- getManyDashboardOrganisations(props.dashboardOrganisationsFilters, f => f.folderId == props.foldersFilters?.parentId);
208
- }
209
- }, { immediate: true });
210
-
211
- watch(() => props.dashboardShallowsFilters, (next, previous) => {
212
- if ((!next && !previous) || !_.isEqual(next, previous)) {
213
- getManyDashboardShallows(props.dashboardShallowsFilters, f => f.folderId == props.foldersFilters?.parentId);
214
- }
215
- }, { immediate: true });
216
-
217
- watch(() => props.modelValue, (next) => {
218
- selecteds.value = next;
219
- }, { immediate: true });
220
-
221
117
  return {
222
- fetchingDashboardOrganisations,
223
- fetchingDashboardShallows,
224
118
  fetchingFolders,
225
- mainOrganisationDashboardId,
226
- mainUserDashboardId,
227
- selecteds,
228
- items,
119
+ folders,
229
120
  onSelect,
230
121
  isSelected,
231
122
  FoldersListType,