@dative-gpi/foundation-core-components 1.0.66 → 1.0.67-map-edit

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