@dative-gpi/foundation-core-components 0.0.230 → 0.1.68

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 +46 -53
  2. package/components/autocompletes/FSAutocompleteDashboard.vue +46 -53
  3. package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +24 -39
  4. package/components/autocompletes/FSAutocompleteDataCategory.vue +46 -38
  5. package/components/autocompletes/FSAutocompleteDataDefinition.vue +19 -39
  6. package/components/autocompletes/FSAutocompleteGroup.vue +17 -38
  7. package/components/autocompletes/FSAutocompleteLocation.vue +17 -38
  8. package/components/autocompletes/FSAutocompleteManufacturer.vue +57 -2
  9. package/components/autocompletes/FSAutocompleteModel.vue +58 -3
  10. package/components/autocompletes/FSAutocompleteOrganisationType.vue +17 -0
  11. package/components/autocompletes/FSAutocompleteRole.vue +46 -53
  12. package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +99 -0
  13. package/components/autocompletes/FSAutocompleteUserOrganisation.vue +24 -57
  14. package/components/customProperties/FSMetaField.vue +5 -6
  15. package/components/customProperties/FSMetaFormContent.vue +4 -5
  16. package/components/customProperties/FSMetaGrid.vue +3 -4
  17. package/components/customProperties/FSMetaHistory.vue +16 -15
  18. package/components/customProperties/FSMetaValue.vue +67 -36
  19. package/components/customProperties/helpers.ts +5 -4
  20. package/components/entities/FSBaseEntitiesList.vue +50 -0
  21. package/components/entities/FSDialogSelectEntities.vue +76 -0
  22. package/components/entities/FSEntityField.vue +149 -0
  23. package/components/entities/FSSelectEntitiesList.vue +192 -0
  24. package/components/entities/FSSimpleEntitiesList.vue +100 -0
  25. package/components/explorers/FSBaseFoldersExplorer.vue +258 -0
  26. package/components/lists/FSDataTable.vue +4 -8
  27. package/components/lists/alerts/FSBaseAlertsList.vue +357 -0
  28. package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +101 -0
  29. package/components/lists/authTokens/FSBaseAuthTokensList.vue +78 -0
  30. package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +159 -0
  31. package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +159 -0
  32. package/components/lists/charts/FSBaseChartsList.vue +218 -0
  33. package/components/lists/comments/FSBaseCommentsList.vue +127 -0
  34. package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +164 -0
  35. package/components/lists/dashboards/FSBaseDashboardsList.vue +222 -0
  36. package/components/lists/dashboards/FSSimpleDashboardsList.vue +63 -0
  37. package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +154 -0
  38. package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +128 -0
  39. package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +354 -0
  40. package/components/lists/deviceOrganisations/FSSimpleDeviceOrganisationsList.vue +44 -0
  41. package/components/lists/folders/FSBaseFoldersList.vue +116 -0
  42. package/components/lists/folders/FSSimpleFoldersList.vue +44 -0
  43. package/components/lists/groups/FSBaseGroupsList.vue +133 -0
  44. package/components/lists/groups/FSSimpleGroupsList.vue +44 -0
  45. package/components/lists/locations/FSBaseLocationsList.vue +115 -0
  46. package/components/lists/locations/FSSimpleLocationsList.vue +44 -0
  47. package/components/lists/models/FSBaseModelsList.vue +152 -0
  48. package/components/lists/models/FSSimpleModelsList.vue +44 -0
  49. package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +127 -0
  50. package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +127 -0
  51. package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +120 -0
  52. package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +107 -0
  53. package/components/lists/scenarios/FSBaseScenariosList.vue +206 -0
  54. package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +153 -0
  55. package/components/lists/serviceAccountRoleOrganisations/FSBaseServiceAccountRoleOrganisations.vue +127 -0
  56. package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +169 -0
  57. package/components/lists/userOrganisations/FSSimpleUserOrganisationsList.vue +45 -0
  58. package/components/selects/FSAggregationSelector.vue +5 -5
  59. package/components/selects/FSAxisTypeSelector.vue +1 -1
  60. package/components/selects/FSDisplayAsSelector.vue +5 -5
  61. package/components/selects/FSFilterTypeSelector.vue +2 -2
  62. package/components/selects/FSHeatmapRuleSelector.vue +5 -5
  63. package/components/selects/FSOperationOnSelector.vue +5 -5
  64. package/components/selects/FSPlanningTypeSelector.vue +6 -5
  65. package/components/selects/FSPlotPerSelector.vue +5 -5
  66. package/components/selects/{FSSelectSelectedEntities.vue → FSSelectEntityType.vue} +12 -12
  67. package/components/selects/FSSerieTypeSelector.vue +5 -5
  68. package/components/tiles/FSDeviceOrganisationTile.vue +9 -2
  69. package/components/tiles/FSLocationTile.vue +65 -0
  70. package/components/tiles/FSServiceAccountOrganisationTile.vue +68 -0
  71. package/components/tiles/FSUserOrganisationTile.vue +0 -2
  72. package/components/treeviews/FSTreeViewFolder.vue +15 -3
  73. package/components/treeviews/FSTreeViewGroup.vue +15 -3
  74. package/package.json +7 -7
  75. package/utils/charts.ts +2 -1
  76. package/utils/dashboards.ts +31 -4
  77. package/utils/index.ts +2 -1
  78. package/utils/permissions.ts +80 -0
  79. package/utils/roles.ts +2 -3
  80. package/utils/tables.ts +41 -0
  81. package/utils/users.ts +4 -1
  82. package/components/selects/FSDataCategorySelector.vue +0 -62
  83. package/components/selects/FSDataDefinitionSelector.vue +0 -66
  84. package/components/selects/FSModelSelector.vue +0 -56
@@ -0,0 +1,120 @@
1
+ <template>
2
+ <FSDataTable
3
+ :items="scenarioOrganisationTypes"
4
+ :itemTo="$props.itemTo"
5
+ :loading="fetchingScenarioOrganisationTypes"
6
+ :showSelect="$props.editable"
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
+
30
+ <template
31
+ #item.imageId="{ item }"
32
+ >
33
+ <FSImage
34
+ v-if="item.imageId"
35
+ height="32px"
36
+ width="32px"
37
+ :imageId="item.imageId"
38
+ />
39
+ </template>
40
+
41
+ <template
42
+ #item.tags="{ item }"
43
+ >
44
+ <FSTagGroup
45
+ variant="slide"
46
+ :editable="false"
47
+ :tags="item.tags"
48
+ />
49
+ </template>
50
+ </FSDataTable>
51
+ </template>
52
+
53
+ <script lang="ts">
54
+ import { defineComponent, type PropType, watch } from "vue";
55
+ import type { RouteLocation } from "vue-router";
56
+ import _ from "lodash";
57
+
58
+ import type { ScenarioOrganisationTypeFilters, ScenarioOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
59
+ import { useScenarioOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
60
+
61
+ import FSDataTable from "../FSDataTable.vue";
62
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
63
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
64
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
65
+
66
+ export default defineComponent({
67
+ name: "FSBaseScenarioOrganisationTypesList",
68
+ components: {
69
+ FSDataTable,
70
+ FSIcon,
71
+ FSImage,
72
+ FSTagGroup
73
+ },
74
+ props: {
75
+ tableCode: {
76
+ type: String,
77
+ required: true
78
+ },
79
+ scenarioOrganisationTypeFilters: {
80
+ type: Object as PropType<ScenarioOrganisationTypeFilters>,
81
+ required: false,
82
+ default: null
83
+ },
84
+ itemTo: {
85
+ type: Function as PropType<(item: ScenarioOrganisationTypeInfos) => Partial<RouteLocation>>,
86
+ required: false
87
+ },
88
+ editable: {
89
+ type: Boolean,
90
+ required: false,
91
+ default: true
92
+ },
93
+ modelValue: {
94
+ type: Array as PropType<string[]>,
95
+ default: () => [],
96
+ required: false
97
+ }
98
+ },
99
+ emits: ["update:modelValue"],
100
+ setup(props) {
101
+ const { entities: scenarioOrganisationTypes, fetching: fetchingScenarioOrganisationTypes, getMany: getManyScenarioOrganisationTypes } = useScenarioOrganisationTypes();
102
+
103
+ const isSelected = (id: string): boolean => {
104
+ return props.modelValue.includes(id);
105
+ };
106
+
107
+ watch(() => props.scenarioOrganisationTypeFilters, (next, previous) => {
108
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
109
+ getManyScenarioOrganisationTypes(props.scenarioOrganisationTypeFilters);
110
+ }
111
+ }, { immediate: true });
112
+
113
+ return {
114
+ fetchingScenarioOrganisationTypes,
115
+ scenarioOrganisationTypes,
116
+ isSelected
117
+ };
118
+ }
119
+ });
120
+ </script>
@@ -0,0 +1,107 @@
1
+ <template>
2
+ <FSDataTable
3
+ :items="scenarioOrganisations"
4
+ :itemTo="$props.itemTo"
5
+ :loading="fetchingScenarioOrganisations"
6
+ :showSelect="$props.editable"
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
+
30
+ <template
31
+ #item.tags="{ item }"
32
+ >
33
+ <FSTagGroup
34
+ variant="slide"
35
+ :editable="false"
36
+ :tags="item.tags"
37
+ />
38
+ </template>
39
+ </FSDataTable>
40
+ </template>
41
+
42
+ <script lang="ts">
43
+ import { defineComponent, type PropType, watch } from "vue";
44
+ import type { RouteLocation } from "vue-router";
45
+ import _ from "lodash";
46
+
47
+ import type { ScenarioOrganisationFilters, ScenarioOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
48
+ import { useScenarioOrganisations } from "@dative-gpi/foundation-core-services/composables";
49
+
50
+ import FSDataTable from "../FSDataTable.vue";
51
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
52
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
53
+
54
+ export default defineComponent({
55
+ name: "FSBaseScenarioOrganisationsList",
56
+ components: {
57
+ FSDataTable,
58
+ FSIcon,
59
+ FSTagGroup
60
+ },
61
+ props: {
62
+ tableCode: {
63
+ type: String,
64
+ required: true
65
+ },
66
+ scenarioOrganisationFilters: {
67
+ type: Object as PropType<ScenarioOrganisationFilters>,
68
+ required: false,
69
+ default: null
70
+ },
71
+ itemTo: {
72
+ type: Function as PropType<(item: ScenarioOrganisationInfos) => Partial<RouteLocation>>,
73
+ required: false
74
+ },
75
+ editable: {
76
+ type: Boolean,
77
+ required: false,
78
+ default: true
79
+ },
80
+ modelValue: {
81
+ type: Array as PropType<string[]>,
82
+ default: () => [],
83
+ required: false
84
+ }
85
+ },
86
+ emits: ["update:modelValue"],
87
+ setup(props) {
88
+ const { entities: scenarioOrganisations, fetching: fetchingScenarioOrganisations, getMany: getManyScenarioOrganisations } = useScenarioOrganisations();
89
+
90
+ const isSelected = (id: string): boolean => {
91
+ return props.modelValue.includes(id);
92
+ };
93
+
94
+ watch(() => props.scenarioOrganisationFilters, (next, previous) => {
95
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
96
+ getManyScenarioOrganisations(props.scenarioOrganisationFilters);
97
+ }
98
+ }, { immediate: true });
99
+
100
+ return {
101
+ fetchingScenarioOrganisations,
102
+ scenarioOrganisations,
103
+ isSelected
104
+ };
105
+ }
106
+ });
107
+ </script>
@@ -0,0 +1,206 @@
1
+ <template>
2
+ <FSDataTable
3
+ :loading="fetchingScenarioOrganisationTypes || fetchingScenarioOrganisations"
4
+ :headers="headers"
5
+ :items="scenarios"
6
+ :showSelect="$props.editable"
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
+
30
+ <template
31
+ #item.tags="{ item }"
32
+ >
33
+ <FSTagGroup
34
+ variant="slide"
35
+ :editable="false"
36
+ :tags="item.tags"
37
+ />
38
+ </template>
39
+ </FSDataTable>
40
+ </template>
41
+
42
+ <script lang="ts">
43
+ import { defineComponent, type PropType, watch, computed } from "vue";
44
+ import _ from "lodash";
45
+
46
+ import { useTranslations } from "@dative-gpi/bones-ui";
47
+
48
+ import {ColorEnum } from "@dative-gpi/foundation-shared-components/models";
49
+
50
+ import type { ScenarioOrganisationFilters, ScenarioOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
51
+
52
+ import { useScenarioOrganisations, useScenarioOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
53
+
54
+ import FSDataTable from "../FSDataTable.vue";
55
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
56
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
57
+
58
+ export default defineComponent({
59
+ name: "FSBaseScenariosList",
60
+ components: {
61
+ FSDataTable,
62
+ FSIcon,
63
+ FSTagGroup
64
+ },
65
+ props: {
66
+ tableCode: {
67
+ type: String,
68
+ required: true
69
+ },
70
+ scenarioOrganisationFilters: {
71
+ type: Object as PropType<ScenarioOrganisationFilters>,
72
+ required: false,
73
+ default: null
74
+ },
75
+ scenarioOrganisationTypeFilters: {
76
+ type: Object as PropType<ScenarioOrganisationTypeFilters>,
77
+ required: false,
78
+ default: null
79
+ },
80
+ editable: {
81
+ type: Boolean,
82
+ required: false,
83
+ default: true
84
+ },
85
+ modelValue: {
86
+ type: Array as PropType<string[]>,
87
+ default: () => [],
88
+ required: false
89
+ }
90
+ },
91
+ emits: ["update:modelValue"],
92
+ setup(props, { emit }) {
93
+ const { $tr } = useTranslations();
94
+ const { entities: scenarioOrganisations, fetching: fetchingScenarioOrganisations, getMany: getManyScenarioOrganisations } = useScenarioOrganisations();
95
+ const { entities: scenarioOrganisationTypes, fetching: fetchingScenarioOrganisationTypes, getMany: getManyScenarioOrganisationTypes } = useScenarioOrganisationTypes();
96
+
97
+ const isSelected = (value : string): boolean => {
98
+ return props.modelValue.includes(value);
99
+ };
100
+
101
+ const headers = computed(() => {
102
+ return [
103
+ {
104
+ text: $tr("entity.scenario.icon", "Icon"),
105
+ value: "icon",
106
+ sortable: false,
107
+ },
108
+ {
109
+ text: $tr("entity.scenario.label", "Label"),
110
+ value: "label",
111
+ sortable: true
112
+ },
113
+ {
114
+ text: $tr("entity.scenario.modelLabel", "Model label"),
115
+ value: "modelLabel",
116
+ sortable: true
117
+ },
118
+ {
119
+ text: $tr("entity.scenario.dataCategoryLabel", "Data category label"),
120
+ value: "dataCategoryLabel",
121
+ sortable: true
122
+ },
123
+ {
124
+ text: $tr("ui.common.action", ""),
125
+ value: "action",
126
+ sortable: false
127
+ }
128
+ ];
129
+ });
130
+
131
+
132
+ const scenarios = computed(() => {
133
+ return scenarioOrganisations.value.map(c => {
134
+ return {
135
+ id: `${c.id}_${c.scope}`,
136
+ modelId: c.modelId,
137
+ dataCategoryId : c.dataCategoryId,
138
+ dataCategoryLabel: c.dataCategoryLabel,
139
+ scenarioId: c.scenarioId,
140
+ scope: c.scope,
141
+ label: c.label,
142
+ modelLabel: c.modelLabel,
143
+ code: c.code,
144
+ icon: c.icon,
145
+ tags: c.tags,
146
+ criticity: c.criticity,
147
+ parameters: c.parameters
148
+ }
149
+ })
150
+ .concat(scenarioOrganisationTypes.value.map(c => {
151
+ return {
152
+ id: `${c.id}_${c.scope}`,
153
+ modelId: c.modelId,
154
+ dataCategoryId : c.dataCategoryId,
155
+ dataCategoryLabel: c.dataCategoryLabel,
156
+ scenarioId: c.scenarioId,
157
+ scope: c.scope,
158
+ label: c.label,
159
+ modelLabel: c.modelLabel,
160
+ code: c.code,
161
+ icon: c.icon,
162
+ tags: c.tags,
163
+ criticity: c.criticity,
164
+ parameters: c.parameters
165
+ }
166
+ }))
167
+ })
168
+
169
+ const fetch = () =>{
170
+ getManyScenarioOrganisations(props.scenarioOrganisationFilters);
171
+ getManyScenarioOrganisationTypes(props.scenarioOrganisationTypeFilters)
172
+ }
173
+
174
+ const update = (value : string) =>
175
+ {
176
+ const item = isSelected(value);
177
+
178
+ if(item){
179
+ emit("update:modelValue", props.modelValue.filter(m => m != value))
180
+ }
181
+ else{
182
+ emit("update:modelValue", [...props.modelValue, value])
183
+ }
184
+ }
185
+
186
+ watch(() => [props.scenarioOrganisationFilters,props.scenarioOrganisationTypeFilters], (next, previous) => {
187
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
188
+ fetch();
189
+ }
190
+ }, { immediate: true });
191
+
192
+
193
+ return {
194
+ fetchingScenarioOrganisationTypes,
195
+ fetchingScenarioOrganisations,
196
+ scenarioOrganisationTypes,
197
+ scenarioOrganisations,
198
+ ColorEnum,
199
+ scenarios,
200
+ headers,
201
+ isSelected,
202
+ update
203
+ };
204
+ }
205
+ });
206
+ </script>
@@ -0,0 +1,153 @@
1
+ <template>
2
+ <FSDataTable
3
+ :items="serviceAccountOrganisations"
4
+ :itemTo="$props.itemTo"
5
+ :loading="fetchingServiceAccountOrganisations"
6
+ :showSelect="$props.editable"
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
+ #header.imageId-title
23
+ >
24
+ <FSIcon>
25
+ mdi-panorama-variant-outline
26
+ </FSIcon>
27
+ </template>
28
+ <template
29
+ #item.imageId="{ item }"
30
+ >
31
+ <FSImage
32
+ v-if="item.imageId"
33
+ height="32px"
34
+ width="32px"
35
+ :imageId="item.imageId"
36
+ />
37
+ </template>
38
+ <template
39
+ #item.tags="{ item }"
40
+ >
41
+ <FSTagGroup
42
+ variant="slide"
43
+ :editable="false"
44
+ :tags="item.tags"
45
+ />
46
+ </template>
47
+ <template
48
+ #item.validity="{ item }"
49
+ >
50
+ <FSSpan
51
+ font="text-overline"
52
+ >
53
+ {{ userValidityLabel(item.validity) }}
54
+ </FSSpan>
55
+ </template>
56
+ <template
57
+ #item.userType="{ item }"
58
+ >
59
+ <FSSpan
60
+ font="text-overline"
61
+ >
62
+ {{ userTypeLabel(item.userType) }}
63
+ </FSSpan>
64
+ </template>
65
+ <template
66
+ #item.tile="{ item, toggleSelect }"
67
+ >
68
+ <FSServiceAccountOrganisationTileUI
69
+ :to="$props.itemTo && $props.itemTo(item)"
70
+ :editable="$props.editable"
71
+ :modelValue="isSelected(item.id)"
72
+ @update:modelValue="toggleSelect(item)"
73
+ v-bind="item"
74
+ />
75
+ </template>
76
+ </FSDataTable>
77
+ </template>
78
+
79
+ <script lang="ts">
80
+ import type { PropType} from "vue";
81
+ import { defineComponent, watch } from "vue";
82
+ import type { RouteLocation } from "vue-router";
83
+ import _ from "lodash";
84
+
85
+ import type { ServiceAccountOrganisationFilters, ServiceAccountOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
86
+ import { userTypeLabel, userValidityLabel } from "@dative-gpi/foundation-core-components/utils";
87
+ import { useServiceAccountOrganisations } from "@dative-gpi/foundation-core-services/composables";
88
+
89
+ import FSDataTable from "../FSDataTable.vue";
90
+
91
+ import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
92
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
93
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
94
+ import FSServiceAccountOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSServiceAccountOrganisationTileUI.vue";
95
+
96
+ export default defineComponent({
97
+ name: "FSBaseServiceAccountOrganisationsList",
98
+ components: {
99
+ FSDataTable,
100
+ FSImage,
101
+ FSTagGroup,
102
+ FSSpan,
103
+ FSServiceAccountOrganisationTileUI
104
+ },
105
+ props: {
106
+ tableCode: {
107
+ type: String,
108
+ required: true
109
+ },
110
+ serviceAccountOrganisationsFilters: {
111
+ type: Object as PropType<ServiceAccountOrganisationFilters | null>,
112
+ required: false,
113
+ default: null
114
+ },
115
+ itemTo: {
116
+ type: Function as PropType<(item: ServiceAccountOrganisationInfos) => Partial<RouteLocation>>,
117
+ required: false
118
+ },
119
+ editable: {
120
+ type: Boolean,
121
+ required: false,
122
+ default: true
123
+ },
124
+ modelValue: {
125
+ type: Array as PropType<string[]>,
126
+ required: false,
127
+ default: () => []
128
+ }
129
+ },
130
+ emits: ["update:modelValue"],
131
+ setup(props) {
132
+ const { getMany: getManyServiceAccountOrganisations, entities: serviceAccountOrganisations, fetching: fetchingServiceAccountOrganisations } = useServiceAccountOrganisations();
133
+
134
+ const isSelected = (id: string): boolean => {
135
+ return props.modelValue.includes(id);
136
+ };
137
+
138
+ watch(() => props.serviceAccountOrganisationsFilters, (next, previous) => {
139
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
140
+ getManyServiceAccountOrganisations(props.serviceAccountOrganisationsFilters ?? undefined);
141
+ }
142
+ }, { immediate: true });
143
+
144
+ return {
145
+ fetchingServiceAccountOrganisations,
146
+ serviceAccountOrganisations,
147
+ userValidityLabel,
148
+ userTypeLabel,
149
+ isSelected
150
+ };
151
+ }
152
+ });
153
+ </script>
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <FSDataTable
3
+ :loading="fetchingServiceAccountRoleOrganisations"
4
+ :items="serviceAccountRoleOrganisations"
5
+ :showSelect="$props.editable"
6
+ :tableCode="$props.tableCode"
7
+ :itemTo="$props.itemTo"
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.icon="{ item }"
23
+ >
24
+ <FSIcon>
25
+ {{ item.icon }}
26
+ </FSIcon>
27
+ </template>
28
+ <template
29
+ #item.userType="{ item }"
30
+ >
31
+ <FSRow
32
+ align="center-left"
33
+ >
34
+ <FSIcon>
35
+ {{ userTypeIcon(item.userType) }}
36
+ </FSIcon>
37
+ <FSText>
38
+ {{ userTypeLabel(item.userType) }}
39
+ </FSText>
40
+ </FSRow>
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
+ </FSDataTable>
52
+ </template>
53
+
54
+ <script lang="ts">
55
+ import { defineComponent, type PropType, watch } from "vue";
56
+ import { type RouteLocation } from "vue-router";
57
+ import _ from "lodash";
58
+
59
+ import { type ServiceAccountRoleOrganisationFilters, type ServiceAccountRoleOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
60
+ import { useServiceAccountRoleOrganisations } from "@dative-gpi/foundation-core-services/composables";
61
+ import { userTypeIcon, userTypeLabel } from "@dative-gpi/foundation-core-components/utils";
62
+
63
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
64
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
65
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
66
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
67
+
68
+ import FSDataTable from "../FSDataTable.vue";
69
+
70
+ export default defineComponent({
71
+ name: "FSBaseServiceAccountRoleOrganisationsList",
72
+ components: {
73
+ FSDataTable,
74
+ FSTagGroup,
75
+ FSIcon,
76
+ FSText,
77
+ FSRow
78
+ },
79
+ props: {
80
+ tableCode: {
81
+ type: String,
82
+ required: true
83
+ },
84
+ serviceAccountRoleOrganisationsFilters: {
85
+ type: Object as PropType<ServiceAccountRoleOrganisationFilters | null>,
86
+ required: false,
87
+ default: null
88
+ },
89
+ itemTo: {
90
+ type: Function as PropType<(item: ServiceAccountRoleOrganisationInfos) => Partial<RouteLocation>>,
91
+ required: false
92
+ },
93
+ editable: {
94
+ type: Boolean,
95
+ required: false,
96
+ default: true
97
+ },
98
+ modelValue: {
99
+ type: Array as PropType<string[]>,
100
+ required: false,
101
+ default: () => []
102
+ }
103
+ },
104
+ emits: ["update:modelValue"],
105
+ setup(props) {
106
+ const { getMany: getManyServiceAccountRoleOrganisations, fetching: fetchingServiceAccountRoleOrganisations, entities: serviceAccountRoleOrganisations } = useServiceAccountRoleOrganisations();
107
+
108
+ const isSelected = (id: string): boolean => {
109
+ return props.modelValue.includes(id);
110
+ };
111
+
112
+ watch(() => props.serviceAccountRoleOrganisationsFilters, (next, previous) => {
113
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
114
+ getManyServiceAccountRoleOrganisations(props.serviceAccountRoleOrganisationsFilters ?? undefined);
115
+ }
116
+ }, { immediate: true });
117
+
118
+ return {
119
+ fetchingServiceAccountRoleOrganisations,
120
+ serviceAccountRoleOrganisations,
121
+ userTypeLabel,
122
+ userTypeIcon,
123
+ isSelected
124
+ };
125
+ }
126
+ });
127
+ </script>