@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,179 @@
1
+ <template>
2
+ <FSDataTable
3
+ defaultMode="iterator"
4
+ :loading="fetchingDashboardOrganisationTypes"
5
+ :items="dashboardOrganisationTypes"
6
+ :itemTo="$props.itemTo"
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
+ <template
22
+ #item.main="{ item }"
23
+ >
24
+ <FSRow>
25
+ <FSIcon
26
+ v-if="item.id === organisationMainDashboardId"
27
+ >
28
+ mdi-account-group-outline
29
+ </FSIcon>
30
+ <FSIcon
31
+ v-if="item.id === userOrganisationMainDashboardId"
32
+ >
33
+ mdi-home
34
+ </FSIcon>
35
+ </FSRow>
36
+ </template>
37
+ <template
38
+ #item.icon="{ item }"
39
+ >
40
+ <FSIcon>
41
+ {{ item.icon }}
42
+ </FSIcon>
43
+ </template>
44
+ <template
45
+ #item.organisationTypeLabel="{ item }"
46
+ >
47
+ <FSText
48
+ v-if="item.organisationTypeId"
49
+ :label="item.organisationTypeLabel"
50
+ />
51
+ <FSChip
52
+ v-else
53
+ variant="standard"
54
+ :label="$tr('ui.common.all', 'All')"
55
+ />
56
+ </template>
57
+ <template
58
+ #item.tags="{ item }"
59
+ >
60
+ <FSTagGroup
61
+ variant="slide"
62
+ :editable="false"
63
+ :tags="item.tags"
64
+ />
65
+ </template>
66
+ <template
67
+ #item.tile="{ item, toggleSelect }"
68
+ >
69
+ <FSDashboardOrganisationTypeTileUI
70
+ :bottomColor="item.colors"
71
+ :to="$props.itemTo && $props.itemTo(item)"
72
+ :modelValue="isSelected(item.id)"
73
+ @update:modelValue="toggleSelect(item)"
74
+ v-bind="item"
75
+ />
76
+ </template>
77
+ </FSDataTable>
78
+ </template>
79
+
80
+ <script lang="ts">
81
+ import { computed, defineComponent, onMounted, type PropType, watch } from "vue";
82
+ import type { RouteLocation } from "vue-router";
83
+ import _ from "lodash";
84
+
85
+ import { useAppOrganisationId, useCurrentUserOrganisation, useDashboardOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
86
+ import type { DashboardOrganisationTypeFilters, DashboardOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
87
+ import { useOrganisation } from "@dative-gpi/foundation-shared-services/composables";
88
+
89
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
90
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
91
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
92
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
93
+ import FSChip from "@dative-gpi/foundation-shared-components/components/FSChip.vue";
94
+ import FSDashboardOrganisationTypeTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTypeTileUI.vue";
95
+
96
+ import FSDataTable from "../FSDataTable.vue";
97
+
98
+ export default defineComponent({
99
+ name: "FSBaseDashboardOrganisationTypesList",
100
+ components: {
101
+ FSDataTable,
102
+ FSTagGroup,
103
+ FSIcon,
104
+ FSRow,
105
+ FSText,
106
+ FSChip,
107
+ FSDashboardOrganisationTypeTileUI
108
+ },
109
+ props: {
110
+ tableCode: {
111
+ type: String as PropType<string | null>,
112
+ required: false,
113
+ default: null
114
+ },
115
+ dashboardOrganisationTypeFilters: {
116
+ type: Object as PropType<DashboardOrganisationTypeFilters>,
117
+ default: undefined,
118
+ required: false
119
+ },
120
+ itemTo: {
121
+ type: Function as PropType<(item: DashboardOrganisationTypeInfos) => Partial<RouteLocation>>,
122
+ required: false
123
+ },
124
+ modelValue: {
125
+ type: Array as PropType<string[]>,
126
+ required: false,
127
+ default: () => []
128
+ }
129
+ },
130
+ setup(props) {
131
+ const { getMany: getDashboardOrganisationTypes, fetching: fetchingDashboardOrganisationTypes, entities: dashboardOrganisationTypes } = useDashboardOrganisationTypes();
132
+ const { fetch: fetchUserOrganisation, entity: userOrganisation } = useCurrentUserOrganisation();
133
+ const { get: fetchOrganisation, entity: organisation } = useOrganisation();
134
+ const { organisationId } = useAppOrganisationId();
135
+
136
+ const userOrganisationMainDashboardId = computed((): string | null => {
137
+ if (userOrganisation.value) {
138
+ return userOrganisation.value.mainDashboardId;
139
+ }
140
+ return null;
141
+ });
142
+
143
+ const organisationMainDashboardId = computed((): string | null => {
144
+ if (organisation.value) {
145
+ return organisation.value.mainDashboardId;
146
+ }
147
+ return null;
148
+ });
149
+
150
+ const isSelected = (id: string): boolean => {
151
+ return props.modelValue.includes(id);
152
+ };
153
+
154
+ onMounted(() => {
155
+ fetchUserOrganisation();
156
+ });
157
+
158
+ watch(organisationId, () => {
159
+ if (organisationId.value) {
160
+ fetchOrganisation(organisationId.value);
161
+ }
162
+ }, { immediate: true });
163
+
164
+ watch(() => props.dashboardOrganisationTypeFilters, (next, previous) => {
165
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
166
+ getDashboardOrganisationTypes(props.dashboardOrganisationTypeFilters);
167
+ }
168
+ }, { immediate: true });
169
+
170
+ return {
171
+ fetchingDashboardOrganisationTypes,
172
+ userOrganisationMainDashboardId,
173
+ organisationMainDashboardId,
174
+ dashboardOrganisationTypes,
175
+ isSelected,
176
+ };
177
+ }
178
+ });
179
+ </script>
@@ -0,0 +1,235 @@
1
+ <template>
2
+ <FSDataTable
3
+ defaultMode="iterator"
4
+ :items="items"
5
+ :itemTo="$props.itemTo"
6
+ :loading="fetchingDashboardOrganisationTypes || fetchingDashboardOrganisations || fetchingDashboardShallows"
7
+ :tableCode="$props.tableCode"
8
+ :modelValue="selecteds"
9
+ @update:modelValue="onSelect"
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
+ <template
22
+ #item.icon="{ item }"
23
+ >
24
+ <FSIcon>
25
+ {{ item.icon }}
26
+ </FSIcon>
27
+ </template>
28
+ <template
29
+ #item.main="{ item }"
30
+ >
31
+ <FSIcon
32
+ v-if="item.id === mainOrganisationDashboardId"
33
+ >
34
+ mdi-account-group-outline
35
+ </FSIcon>
36
+ <FSIcon
37
+ v-if="item.id === mainUserDashboardId"
38
+ >
39
+ mdi-home
40
+ </FSIcon>
41
+ </template>
42
+ <template
43
+ #item.tags="{ item }"
44
+ >
45
+ <FSTagGroup
46
+ variant="slide"
47
+ :editable="false"
48
+ :tags="item.tags"
49
+ />
50
+ </template>
51
+ <template
52
+ #item.tile="{ item, toggleSelect }"
53
+ >
54
+ <FSDashboardOrganisationTypeTileUI
55
+ v-if="item.dashboardType == DashboardType.OrganisationType"
56
+ :bottomColor="item.colors"
57
+ :to="$props.itemTo && $props.itemTo(item)"
58
+ :modelValue="isSelected(item.id)"
59
+ @update:modelValue="toggleSelect(item)"
60
+ v-bind="item"
61
+ />
62
+ <FSDashboardOrganisationTileUI
63
+ v-if="item.dashboardType == DashboardType.Organisation"
64
+ :bottomColor="item.colors"
65
+ :to="$props.itemTo && $props.itemTo(item)"
66
+ :modelValue="isSelected(item.id)"
67
+ @update:modelValue="toggleSelect(item)"
68
+ v-bind="item"
69
+ />
70
+ <FSDashboardShallowTileUI
71
+ v-if="item.dashboardType == DashboardType.Shallow"
72
+ :bottomColor="item.colors"
73
+ :modelValue="isSelected(item.id)"
74
+ @update:modelValue="toggleSelect(item)"
75
+ :to="$props.itemTo && $props.itemTo(item)"
76
+ v-bind="item"
77
+ />
78
+ </template>
79
+ </FSDataTable>
80
+ </template>
81
+
82
+ <script lang="ts">
83
+ import _ from "lodash";
84
+ import type { RouteLocation } from "vue-router";
85
+ import { computed, defineComponent, onMounted, type PropType, ref, watch } from "vue";
86
+
87
+ import { useAppOrganisationId, useCurrentUserOrganisation, useDashboardOrganisations, useDashboardOrganisationTypes, useDashboardShallows } from "@dative-gpi/foundation-core-services/composables";
88
+ import type { DashboardOrganisationTypeFilters, DashboardOrganisationFilters, DashboardShallowFilters, DashboardInfos } from "@dative-gpi/foundation-core-domain/models";
89
+ import { useOrganisation } from "@dative-gpi/foundation-shared-services/composables";
90
+
91
+ import type { DashboardsListItem } from "@/core/foundation-core-components/utils";
92
+ import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
93
+
94
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
95
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
96
+ import FSDashboardShallowTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardShallowTileUI.vue";
97
+ import FSDashboardOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTileUI.vue";
98
+ import FSDashboardOrganisationTypeTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTypeTileUI.vue";
99
+
100
+ import FSDataTable from "../FSDataTable.vue";
101
+
102
+ export default defineComponent({
103
+ name: "FSBaseDashboardsList",
104
+ components: {
105
+ FSDataTable,
106
+ FSTagGroup,
107
+ FSIcon,
108
+ FSDashboardOrganisationTileUI,
109
+ FSDashboardOrganisationTypeTileUI,
110
+ FSDashboardShallowTileUI
111
+ },
112
+ props: {
113
+ tableCode: {
114
+ type: String as PropType<string | null>,
115
+ required: false,
116
+ default: null
117
+ },
118
+ dashboardOrganisationTypeFetchFilter: {
119
+ type: Object as PropType<DashboardOrganisationTypeFilters>,
120
+ default: undefined,
121
+ required: false
122
+ },
123
+ dashboardOrganisationsFilters: {
124
+ type: Object as PropType<DashboardOrganisationFilters>,
125
+ default: undefined,
126
+ required: false
127
+ },
128
+ dashboardShallowsFilters: {
129
+ type: Object as PropType<DashboardShallowFilters>,
130
+ default: undefined,
131
+ required: false
132
+ },
133
+ itemTo: {
134
+ type: Function as PropType<(item: DashboardInfos) => Partial<RouteLocation>>,
135
+ required: false
136
+ },
137
+ modelValue: {
138
+ type: Array as PropType<string[]>,
139
+ default: () => [],
140
+ required: false
141
+ }
142
+ },
143
+ emits: ["update", "update:modelValue", "update:type"],
144
+ setup(props, { emit }) {
145
+ const { entities: dashboardOrganisationTypes, fetching: fetchingDashboardOrganisationTypes, getMany: getManyDashboardOrganisationTypes } = useDashboardOrganisationTypes();
146
+ const { entities: dashboardOrganisations, fetching: fetchingDashboardOrganisations, getMany: getManyDashboardOrganisations } = useDashboardOrganisations();
147
+ const { entities: dashboardShallows, fetching: fetchingDashboardShallows, getMany: getManyDashboardShallows } = useDashboardShallows();
148
+ const { fetch: fetchUserOrganisation, entity: userOrganisation } = useCurrentUserOrganisation();
149
+ const { entity: organisation, get: getOrganisation } = useOrganisation();
150
+ const { organisationId } = useAppOrganisationId();
151
+
152
+ const selecteds = ref<string[]>(props.modelValue);
153
+
154
+ const items = computed((): DashboardsListItem[] => {
155
+ return _.sortBy([
156
+ ...dashboardOrganisationTypes.value.map(g => ({
157
+ ...g,
158
+ dashboardType: DashboardType.OrganisationType
159
+ })) as DashboardsListItem[],
160
+ ...dashboardOrganisations.value.map(d => ({
161
+ ...d,
162
+ dashboardType: DashboardType.Organisation
163
+ })) as DashboardsListItem[],
164
+ ...dashboardShallows.value.map(d => ({
165
+ ...d,
166
+ dashboardType: DashboardType.Shallow
167
+ })) as DashboardsListItem[]
168
+ ], d => d.label);
169
+ });
170
+
171
+ const mainUserDashboardId = computed(() => {
172
+ return userOrganisation.value?.mainDashboardId;
173
+ });
174
+
175
+ const mainOrganisationDashboardId = computed(() => {
176
+ return organisation.value?.mainDashboardId;
177
+ });
178
+
179
+ const onSelect = (values: string[]) => {
180
+ selecteds.value = values;
181
+ const selectedItems = items.value.filter(i => selecteds.value!.includes(i.id));
182
+ const newModelValue = selectedItems.map(i => i.id);
183
+ const newType = selectedItems.map(i => i.dashboardType);
184
+ emit("update:modelValue", newModelValue);
185
+ emit("update:type", newType);
186
+ emit("update", { modelValue: newModelValue, type: newType });
187
+ };
188
+
189
+ const isSelected = (id: string) => {
190
+ return selecteds.value?.includes(id);
191
+ };
192
+
193
+ onMounted(() => {
194
+ fetchUserOrganisation();
195
+ })
196
+
197
+ watch(() => organisationId.value, () => {
198
+ if (organisationId.value) {
199
+ getOrganisation(organisationId.value);
200
+ }
201
+ }, { immediate: true });
202
+
203
+ watch(() => props.dashboardOrganisationTypeFetchFilter, (next, previous) => {
204
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
205
+ getManyDashboardOrganisationTypes(props.dashboardOrganisationTypeFetchFilter);
206
+ }
207
+ }, { immediate: true });
208
+
209
+ watch(() => props.dashboardOrganisationsFilters, (next, previous) => {
210
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
211
+ getManyDashboardOrganisations(props.dashboardOrganisationsFilters);
212
+ }
213
+ }, { immediate: true });
214
+
215
+ watch(() => props.dashboardShallowsFilters, (next, previous) => {
216
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
217
+ getManyDashboardShallows(props.dashboardShallowsFilters);
218
+ }
219
+ }, { immediate: true });
220
+
221
+ return {
222
+ fetchingDashboardOrganisationTypes,
223
+ fetchingDashboardOrganisations,
224
+ fetchingDashboardShallows,
225
+ selecteds,
226
+ items,
227
+ mainUserDashboardId,
228
+ mainOrganisationDashboardId,
229
+ onSelect,
230
+ isSelected,
231
+ DashboardType
232
+ };
233
+ }
234
+ });
235
+ </script>
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <FSSimpleList
3
+ :items="dashboards"
4
+ :loading="fetching"
5
+ v-bind="$attrs"
6
+ />
7
+ </template>
8
+
9
+ <script lang="ts">
10
+ import { defineComponent, type PropType, watch, computed } from "vue";
11
+
12
+ import type { DashboardOrganisationFilters, DashboardOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
13
+ import { useDashboardOrganisations, useDashboardOrganisationTypes } 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: "FSSimpleDashboardsList",
19
+ components: {
20
+ FSSimpleList,
21
+ },
22
+ props: {
23
+ dashboardOrganisationFilters: {
24
+ type: Object as PropType<DashboardOrganisationFilters>,
25
+ required: false,
26
+ default: () => ({})
27
+ },
28
+ dashboardOrganisationTypeFilters: {
29
+ type: Object as PropType<DashboardOrganisationTypeFilters>,
30
+ required: false,
31
+ default: () => ({})
32
+ }
33
+ },
34
+ setup(props){
35
+ const { entities: dashboardOrganisations,
36
+ getMany: getManyDashboardOrganisations,
37
+ fetching: fetchingDashboardOrganisations } = useDashboardOrganisations();
38
+ const { entities: dashboardOrganisationTypes,
39
+ getMany: getManyDashboardOrganisationTypes,
40
+ fetching: fetchingDashboardOrganisationTypes } = useDashboardOrganisationTypes();
41
+
42
+ const fetching = computed(() => fetchingDashboardOrganisations.value
43
+ || fetchingDashboardOrganisationTypes.value);
44
+
45
+ const dashboards = computed(() => {
46
+ return [...dashboardOrganisations.value, ...dashboardOrganisationTypes.value];
47
+ });
48
+
49
+ const fetch = () => {
50
+ getManyDashboardOrganisations(props.dashboardOrganisationFilters);
51
+ getManyDashboardOrganisationTypes(props.dashboardOrganisationTypeFilters);
52
+ }
53
+
54
+ watch(() => [props.dashboardOrganisationFilters, props.dashboardOrganisationTypeFilters], fetch, { immediate: true });
55
+
56
+ return {
57
+ dashboards,
58
+ fetching
59
+ }
60
+ }
61
+ });
62
+ </script>
@@ -0,0 +1,155 @@
1
+ <template>
2
+ <FSCol>
3
+ <FSRow
4
+ align="bottom-center"
5
+ width="50%"
6
+ >
7
+ <FSSearchField
8
+ v-model="search"
9
+ />
10
+ <FSButtonCheckbox
11
+ :label="$tr('ui.common.data-correlated','Correlated only')"
12
+ :color="ColorEnum.Success"
13
+ prependIcon="mdi-link"
14
+ v-model="correlated"
15
+ />
16
+ </FSRow>
17
+ <FSFadeOut
18
+ maxHeight="150px"
19
+ maskHeight="0px"
20
+ >
21
+ <FSDataTable
22
+ defaultMode="iterator"
23
+ :loading="fetchingDataCategories"
24
+ :items="dataCategories"
25
+ :modelValue="$props.modelValue"
26
+ :showSearch="false"
27
+ :tableCode="$props.tableCode"
28
+ :search="search"
29
+ @update:modelValue="$emit('update:modelValue', $event)"
30
+ v-bind="$attrs"
31
+ >
32
+ <template
33
+ v-for="(_, name) in $slots"
34
+ v-slot:[name]="slotData"
35
+ >
36
+ <slot
37
+ :name="name"
38
+ v-bind="slotData"
39
+ />
40
+ </template>
41
+ <template
42
+ #item.tile="{ item }"
43
+ >
44
+ <FSClickable
45
+ padding="12px"
46
+ height="60px"
47
+ width="233px"
48
+ :color="isSelected(item.id) ? ColorEnum.Primary : ColorEnum.Dark"
49
+ @click="$emit('update:modelValue', [item.id])"
50
+ v-bind="$attrs"
51
+ >
52
+ <template
53
+ #default
54
+ >
55
+ <FSRow
56
+ align="center-center"
57
+ :wrap="false"
58
+ >
59
+ <FSSpan
60
+ :lineClamp="1"
61
+ >
62
+ {{ item.label }}
63
+ </FSSpan>
64
+ <v-spacer/>
65
+ <FSIcon
66
+ :color="item.correlated ? ColorEnum.Primary : ColorEnum.Light"
67
+ :icon="item.correlated ? 'mdi-link' : 'mdi-link-off'"
68
+ variant="dark"
69
+ />
70
+ </FSRow>
71
+ </template>
72
+ </FSClickable>
73
+ </template>
74
+ </FSDataTable>
75
+ </FSFadeOut>
76
+ </FSCol>
77
+ </template>
78
+
79
+ <script lang="ts">
80
+ import { defineComponent, type PropType, ref, watch } from "vue";
81
+ import _ from "lodash";
82
+
83
+ import {ColorEnum} from "@dative-gpi/foundation-shared-components/models";
84
+
85
+ import { useDataCategories } from "@dative-gpi/foundation-core-services/composables";
86
+ import type { DataCategoryFilters } from "@dative-gpi/foundation-core-domain/models";
87
+
88
+ import FSDataTable from "../FSDataTable.vue";
89
+ import FSCol from "@dative-gpi/foundation-shared-components/components/FSCol.vue";
90
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
91
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
92
+ import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
93
+ import FSFadeOut from "@dative-gpi/foundation-shared-components/components/FSFadeOut.vue";
94
+ import FSClickable from "@dative-gpi/foundation-shared-components/components/FSClickable.vue";
95
+ import FSSearchField from "@dative-gpi/foundation-shared-components/components/fields/FSSearchField.vue";
96
+ import FSButtonCheckbox from "@dative-gpi/foundation-shared-components/components/buttons/FSButtonCheckbox.vue";
97
+
98
+ export default defineComponent({
99
+ name: "FSBaseDataCategoriesList",
100
+ components: {
101
+ FSDataTable,
102
+ FSCol,
103
+ FSFadeOut,
104
+ FSClickable,
105
+ FSRow,
106
+ FSSpan,
107
+ FSSearchField,
108
+ FSButtonCheckbox,
109
+ FSIcon
110
+ },
111
+ props: {
112
+ tableCode: {
113
+ type: String as PropType<string | null>,
114
+ required: false,
115
+ default: null
116
+ },
117
+ dataCategoryFilters: {
118
+ type: Object as PropType<DataCategoryFilters>,
119
+ required: false,
120
+ default: null
121
+ },
122
+ modelValue: {
123
+ type: Array as PropType<string[]>,
124
+ default: () => [],
125
+ required: false
126
+ }
127
+ },
128
+ emits: ["update:modelValue"],
129
+ setup(props) {
130
+ const { getMany: fetchDataCategories, fetching: fetchingDataCategories, entities: dataCategories } = useDataCategories();
131
+
132
+ const search = ref<string | null | undefined >();
133
+ const correlated = ref<boolean>(false);
134
+
135
+ const isSelected = (id: string): boolean => {
136
+ return props.modelValue.includes(id);
137
+ };
138
+
139
+ watch(() => [props.dataCategoryFilters, search.value, correlated.value] , (next, previous) => {
140
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
141
+ fetchDataCategories({...props.dataCategoryFilters, search: search.value, correlated: correlated.value ? true : undefined});
142
+ }
143
+ }, { immediate: true });
144
+
145
+ return {
146
+ fetchingDataCategories,
147
+ dataCategories,
148
+ ColorEnum,
149
+ search,
150
+ correlated,
151
+ isSelected
152
+ };
153
+ }
154
+ });
155
+ </script>