@dative-gpi/foundation-core-components 1.0.36 → 1.0.37-report-v1

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