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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/components/autocompletes/FSAutocompleteChart.vue +15 -8
  2. package/components/autocompletes/FSAutocompleteDashboard.vue +14 -6
  3. package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +7 -1
  4. package/components/autocompletes/FSAutocompleteDataCategory.vue +11 -5
  5. package/components/autocompletes/FSAutocompleteDataDefinition.vue +7 -1
  6. package/components/autocompletes/FSAutocompleteGroup.vue +7 -1
  7. package/components/autocompletes/FSAutocompleteLocation.vue +6 -0
  8. package/components/autocompletes/FSAutocompleteManufacturer.vue +8 -0
  9. package/components/autocompletes/FSAutocompleteModel.vue +9 -1
  10. package/components/autocompletes/FSAutocompleteOrganisationType.vue +7 -1
  11. package/components/autocompletes/FSAutocompleteRole.vue +14 -6
  12. package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +7 -1
  13. package/components/autocompletes/FSAutocompleteUserOrganisation.vue +9 -1
  14. package/components/customProperties/FSMetaField.vue +35 -40
  15. package/components/customProperties/FSMetaFormContent.vue +4 -3
  16. package/components/customProperties/FSMetaHistory.vue +2 -2
  17. package/components/customProperties/FSMetaValue.vue +63 -31
  18. package/components/customProperties/helpers.ts +57 -165
  19. package/components/entities/FSBaseEntitiesList.vue +14 -4
  20. package/components/entities/FSDialogSelectEntities.vue +28 -106
  21. package/components/entities/FSEntityField.vue +75 -14
  22. package/components/entities/FSSelectEntitiesList.vue +225 -0
  23. package/components/explorers/FSBaseDevicesExplorer.vue +312 -0
  24. package/components/explorers/FSBaseFoldersExplorer.vue +286 -0
  25. package/components/lists/FSDataTable.vue +23 -21
  26. package/components/lists/alerts/FSBaseAlertsList.vue +95 -97
  27. package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +4 -4
  28. package/components/lists/authTokens/FSBaseAuthTokensList.vue +6 -4
  29. package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +103 -38
  30. package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +104 -39
  31. package/components/lists/charts/FSBaseChartsList.vue +147 -66
  32. package/components/lists/comments/FSBaseCommentsList.vue +39 -23
  33. package/components/lists/connectivityScenarios/FSBaseConnectivityScenariosList.vue +128 -0
  34. package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +39 -7
  35. package/components/lists/dashboards/FSBaseDashboardsList.vue +44 -13
  36. package/components/lists/dashboards/FSSimpleDashboardsList.vue +33 -7
  37. package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +6 -5
  38. package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +6 -4
  39. package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +179 -61
  40. package/components/lists/folders/FSBaseFoldersList.vue +37 -146
  41. package/components/lists/groupings/FSBaseGroupingsList.vue +117 -0
  42. package/components/lists/groups/FSBaseGroupsList.vue +24 -7
  43. package/components/lists/locations/FSBaseLocationsList.vue +52 -13
  44. package/components/lists/models/FSBaseModelsList.vue +45 -15
  45. package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +17 -10
  46. package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +28 -21
  47. package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +56 -13
  48. package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +56 -12
  49. package/components/lists/scenarios/FSBaseScenariosList.vue +122 -81
  50. package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +31 -18
  51. package/components/lists/serviceAccountRoleOrganisations/FSBaseServiceAccountRoleOrganisationsList.vue +128 -0
  52. package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +30 -19
  53. package/components/lists/userOrganisations/FSChipUserOrganisationsList.vue +61 -0
  54. package/components/tiles/FSChartTile.vue +71 -0
  55. package/components/tiles/FSDashboardOrganisationTile.vue +3 -3
  56. package/components/tiles/FSDashboardOrganisationTypeTile.vue +3 -3
  57. package/components/tiles/FSDashboardShallowTile.vue +3 -3
  58. package/components/tiles/FSDeviceOrganisationTile.vue +12 -5
  59. package/components/tiles/FSFolderTile.vue +3 -3
  60. package/components/tiles/FSGroupTile.vue +3 -3
  61. package/components/tiles/FSLocationTile.vue +5 -3
  62. package/components/tiles/FSModelTile.vue +64 -0
  63. package/components/tiles/FSServiceAccountOrganisationTile.vue +3 -3
  64. package/components/tiles/FSUserOrganisationTile.vue +3 -3
  65. package/components/treeviews/FSTreeViewFolder.vue +15 -3
  66. package/components/treeviews/FSTreeViewGroup.vue +22 -4
  67. package/package.json +9 -9
  68. package/utils/dashboards.ts +3 -3
  69. package/utils/index.ts +0 -1
  70. package/utils/roles.ts +3 -3
  71. package/utils/users.ts +3 -3
  72. package/components/selects/FSAggregationSelector.vue +0 -51
  73. package/components/selects/FSAxisTypeSelector.vue +0 -48
  74. package/components/selects/FSDisplayAsSelector.vue +0 -52
  75. package/components/selects/FSFilterTypeSelector.vue +0 -53
  76. package/components/selects/FSHeatmapRuleSelector.vue +0 -52
  77. package/components/selects/FSOperationOnSelector.vue +0 -51
  78. package/components/selects/FSPlanningTypeSelector.vue +0 -51
  79. package/components/selects/FSPlotPerSelector.vue +0 -51
  80. package/components/selects/FSSelectEntityType.vue +0 -59
  81. package/components/selects/FSSerieTypeSelector.vue +0 -51
  82. package/utils/charts.ts +0 -137
@@ -1,10 +1,14 @@
1
1
  <template>
2
2
  <FSDataTable
3
+ defaultMode="iterator"
3
4
  :items="chartOrganisations"
4
5
  :itemTo="$props.itemTo"
5
6
  :loading="fetchingChartOrganisations"
7
+ :headersOptions="headersOptions"
6
8
  :tableCode="$props.tableCode"
7
9
  :modelValue="$props.modelValue"
10
+ :singleSelect="$props.singleSelect"
11
+ :selectable="$props.selectable"
8
12
  @update:modelValue="$emit('update:modelValue', $event)"
9
13
  v-bind="$attrs"
10
14
  >
@@ -17,7 +21,13 @@
17
21
  v-bind="slotData"
18
22
  />
19
23
  </template>
20
-
24
+ <template
25
+ #header.imageId-title
26
+ >
27
+ <FSIcon>
28
+ mdi-panorama-variant-outline
29
+ </FSIcon>
30
+ </template>
21
31
  <template
22
32
  #item.icon="{ item }"
23
33
  >
@@ -25,7 +35,6 @@
25
35
  {{ item.icon }}
26
36
  </FSIcon>
27
37
  </template>
28
-
29
38
  <template
30
39
  #item.imageId="{ item }"
31
40
  >
@@ -34,37 +43,55 @@
34
43
  height="32px"
35
44
  width="32px"
36
45
  :imageId="item.imageId"
46
+ :thumbnail="true"
37
47
  />
38
48
  </template>
39
-
40
49
  <template
41
50
  #item.tags="{ item }"
42
51
  >
43
52
  <FSTagGroup
44
53
  variant="slide"
45
- :editable="false"
46
54
  :tags="item.tags"
55
+ :showRemove="false"
47
56
  />
48
57
  </template>
49
-
50
58
  <template
51
59
  #item.modelsLabels="{ item }"
52
60
  >
53
61
  <FSTagGroup
54
- :editable="false"
62
+ variant="slide"
55
63
  :tags="item.modelsLabels.map((d: any) => d.label)"
64
+ :showRemove="false"
56
65
  />
57
66
  </template>
58
-
59
67
  <template
60
- #item.tile="{ item }"
68
+ #item.chartType="{ item }"
69
+ >
70
+ <FSRow
71
+ :wrap="false"
72
+ >
73
+ <FSIcon
74
+ :icon="chartIcon(item.chartType)"
75
+ />
76
+ <FSText>
77
+ {{ chartTypeLabel(item.chartType) }}
78
+ </FSText>
79
+ </FSRow>
80
+ </template>
81
+ <template
82
+ #item.tile="{ item, toggleSelect }"
61
83
  >
62
84
  <FSChartTileUI
63
85
  :label="item.label"
86
+ :singleSelect="$props.singleSelect"
87
+ :selectable="$props.selectable"
64
88
  :categoryLabel="item.chartCategoryLabel"
65
89
  :icon="item.icon"
66
90
  :imageId="item.imageId"
67
91
  :type="item.chartType"
92
+ :scope="item.scope"
93
+ :modelValue="isSelected(item.id)"
94
+ @update:modelValue="toggleSelect(item)"
68
95
  :to="$props.itemTo && $props.itemTo(item)"
69
96
  />
70
97
  </template>
@@ -72,85 +99,123 @@
72
99
  </template>
73
100
 
74
101
  <script lang="ts">
75
- import { defineComponent, type PropType, watch } from "vue";
102
+ import { computed, defineComponent, type PropType, watch } from "vue";
76
103
  import type { RouteLocation } from "vue-router";
77
104
  import _ from "lodash";
78
105
 
106
+ import { ChartType } from "@dative-gpi/foundation-shared-domain/enums";
107
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
79
108
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
80
- import { PlotPer } from "@dative-gpi/foundation-shared-domain/enums";
109
+ import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
81
110
 
82
- import { type ChartOrganisationFilters, type ChartOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
111
+ import type { ChartModelLabel, ChartOrganisationFilters, ChartOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
83
112
  import { useChartOrganisations } from "@dative-gpi/foundation-core-services/composables";
84
113
 
85
- import FSDataTable from "../FSDataTable.vue";
114
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
115
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
86
116
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
87
117
  import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
88
118
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
89
119
  import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
90
120
 
121
+ import FSDataTable from "../FSDataTable.vue";
122
+
91
123
  export default defineComponent({
92
124
  name: "FSBaseChartOrganisationsList",
93
125
  components: {
126
+ FSChartTileUI,
94
127
  FSDataTable,
95
- FSIcon,
96
- FSImage,
97
128
  FSTagGroup,
98
- FSChartTileUI
129
+ FSImage,
130
+ FSIcon,
131
+ FSText,
132
+ FSRow,
99
133
  },
100
134
  props: {
101
- modelValue: {
102
- type: Array as PropType<string[]>,
103
- default: () => [],
104
- required: false
135
+ tableCode: {
136
+ type: String as PropType<string | null>,
137
+ required: false,
138
+ default: null
105
139
  },
106
140
  chartOrganisationFilters: {
107
141
  type: Object as PropType<ChartOrganisationFilters>,
108
142
  required: false,
109
143
  default: null
110
144
  },
111
- plotPer: {
112
- type: Number as PropType<PlotPer>,
113
- required: false,
114
- default: PlotPer.None
115
- },
116
- tableCode: {
117
- type: String,
118
- required: true
119
- },
120
145
  itemTo: {
121
146
  type: Function as PropType<(item: ChartOrganisationInfos) => Partial<RouteLocation>>,
122
147
  required: false
123
- }
148
+ },
149
+ modelValue: {
150
+ type: Array as PropType<string[]>,
151
+ default: () => [],
152
+ required: false
153
+ },
154
+ selectable: {
155
+ type: Boolean,
156
+ required: false,
157
+ default: true
158
+ },
159
+ singleSelect: {
160
+ type: Boolean,
161
+ required: false,
162
+ default: false
163
+ },
124
164
  },
125
165
  emits: ["update:modelValue"],
126
166
  setup(props) {
127
-
128
167
  const { entities: chartOrganisations, fetching: fetchingChartOrganisations, getMany: getManyChartOrganisations } = useChartOrganisations();
129
168
 
169
+ const headersOptions = computed(() => ({
170
+ modelsLabels: {
171
+ fixedFilters: chartOrganisations.value.map(c => c.modelsLabels).reduce((acc, models) => {
172
+ for (const m of models) {
173
+ if (!acc.map((m) => m.id).includes(m.id)) {
174
+ acc.push(m);
175
+ }
176
+ }
177
+ return acc;
178
+ }, []).map((m) => ({
179
+ value: m.id,
180
+ text: m.label
181
+ })).concat({
182
+ value: '',
183
+ text: '--'
184
+ }),
185
+ methodFilter: (value: string, items: ChartModelLabel[]) => (items.length == 0 && value == '') || (items.length > 0 && items.some(ml => ml.id == value))
186
+ },
187
+ chartType: {
188
+ fixedFilters: getEnumEntries(ChartType).map(e => ({
189
+ value: e.value,
190
+ text: chartTypeLabel(e.value)
191
+ })),
192
+ methodFilter: (value: ChartType, item: ChartType) => value == item
193
+ }
194
+ }));
195
+
196
+
130
197
  const isSelected = (id: string): boolean => {
131
198
  return props.modelValue.includes(id);
132
199
  };
133
200
 
134
201
  const fetch = () =>{
135
- if(props.plotPer === PlotPer.None) {
136
- getManyChartOrganisations(props.chartOrganisationFilters);
137
- } else {
138
- getManyChartOrganisations({...props.chartOrganisationFilters, plotPer: props.plotPer});
139
- }
202
+ getManyChartOrganisations(props.chartOrganisationFilters);
140
203
  }
141
204
 
142
- watch(() => [props.chartOrganisationFilters, props.plotPer], (next, previous) => {
205
+ watch(() => [props.chartOrganisationFilters], (next, previous) => {
143
206
  if ((!next && !previous) || !_.isEqual(next, previous)) {
144
207
  fetch();
145
208
  }
146
209
  }, { immediate: true });
147
-
148
210
 
149
211
  return {
150
- ColorEnum,
151
212
  fetchingChartOrganisations,
152
213
  chartOrganisations,
153
- isSelected
214
+ headersOptions,
215
+ ColorEnum,
216
+ chartTypeLabel,
217
+ isSelected,
218
+ chartIcon
154
219
  };
155
220
  }
156
221
  });
@@ -1,10 +1,14 @@
1
1
  <template>
2
2
  <FSDataTable
3
+ defaultMode="iterator"
3
4
  :loading="fetchingChartOrganisationTypes || fetchingChartOrganisations"
5
+ :headersOptions="headersOptions"
4
6
  :items="charts"
7
+ :selectable="$props.selectable"
8
+ :singleSelect="$props.singleSelect"
5
9
  :tableCode="$props.tableCode"
6
10
  :modelValue="$props.modelValue"
7
- @update:modelValue="$emit('update:modelValue', $event)"
11
+ @update:modelValue="onSelect"
8
12
  v-bind="$attrs"
9
13
  >
10
14
  <template
@@ -16,7 +20,13 @@
16
20
  v-bind="slotData"
17
21
  />
18
22
  </template>
19
-
23
+ <template
24
+ #header.imageId-title
25
+ >
26
+ <FSIcon>
27
+ mdi-panorama-variant-outline
28
+ </FSIcon>
29
+ </template>
20
30
  <template
21
31
  #item.icon="{ item }"
22
32
  >
@@ -24,7 +34,6 @@
24
34
  {{ item.icon }}
25
35
  </FSIcon>
26
36
  </template>
27
-
28
37
  <template
29
38
  #item.imageId="{ item }"
30
39
  >
@@ -33,28 +42,40 @@
33
42
  height="32px"
34
43
  width="32px"
35
44
  :imageId="item.imageId"
45
+ :thumbnail="true"
36
46
  />
37
47
  </template>
38
-
39
48
  <template
40
49
  #item.tags="{ item }"
41
50
  >
42
51
  <FSTagGroup
43
52
  variant="slide"
44
- :editable="false"
53
+ :showRemove="false"
45
54
  :tags="item.tags"
46
55
  />
47
56
  </template>
48
-
57
+ <template
58
+ #item.chartType="{ item }"
59
+ >
60
+ <FSRow
61
+ :wrap="false"
62
+ >
63
+ <FSIcon
64
+ :icon="chartIcon(item.chartType)"
65
+ />
66
+ <FSText>
67
+ {{ chartTypeLabel(item.chartType) }}
68
+ </FSText>
69
+ </FSRow>
70
+ </template>
49
71
  <template
50
72
  #item.modelsLabels="{ item }"
51
73
  >
52
74
  <FSTagGroup
53
- :editable="false"
75
+ :showRemove="false"
54
76
  :tags="item.modelsLabels.map((d: any) => d.label)"
55
77
  />
56
78
  </template>
57
-
58
79
  <template
59
80
  #item.tile="{ item }"
60
81
  >
@@ -64,8 +85,11 @@
64
85
  :icon="item.icon"
65
86
  :imageId="item.imageId"
66
87
  :type="item.chartType"
67
- :color="isSelected(item.id) ? ColorEnum.Primary : ColorEnum.Dark"
68
- @click="update(item.id)"
88
+ :scope="item.scope"
89
+ :singleSelect="$props.singleSelect"
90
+ :selectable="$props.selectable"
91
+ :modelValue="isSelected(item.id)"
92
+ @update:modelValue="update(item.id)"
69
93
  />
70
94
  </template>
71
95
  </FSDataTable>
@@ -75,16 +99,20 @@
75
99
  import { defineComponent, type PropType, watch, computed } from "vue";
76
100
  import _ from "lodash";
77
101
 
78
- import {ColorEnum } from "@dative-gpi/foundation-shared-components/models";
79
-
80
- import type { ChartOrganisationFilters, ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
102
+ import { ChartType } from "@dative-gpi/foundation-shared-domain/enums";
103
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
104
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
105
+ import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
81
106
 
107
+ import type { ChartModelLabel, ChartOrganisationFilters, ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
82
108
  import { useChartOrganisations, useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
83
109
 
84
110
  import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
85
111
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
86
112
  import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
87
113
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
114
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
115
+
88
116
  import FSDataTable from "../FSDataTable.vue";
89
117
 
90
118
  export default defineComponent({
@@ -94,13 +122,14 @@ export default defineComponent({
94
122
  FSDataTable,
95
123
  FSTagGroup,
96
124
  FSImage,
97
- FSIcon
125
+ FSIcon,
126
+ FSRow
98
127
  },
99
128
  props: {
100
- modelValue: {
101
- type: Array as PropType<string[]>,
102
- default: () => [],
103
- required: false
129
+ tableCode: {
130
+ type: String as PropType<string | null>,
131
+ required: false,
132
+ default: null
104
133
  },
105
134
  chartOrganisationFilters: {
106
135
  type: Object as PropType<ChartOrganisationFilters>,
@@ -112,14 +141,24 @@ export default defineComponent({
112
141
  required: false,
113
142
  default: null
114
143
  },
115
- tableCode: {
116
- type: String,
117
- required: true
144
+ modelValue: {
145
+ type: Array as PropType<string[]>,
146
+ default: () => [],
147
+ required: false
148
+ },
149
+ selectable: {
150
+ type: Boolean,
151
+ required: false,
152
+ default: true
153
+ },
154
+ singleSelect: {
155
+ type: Boolean,
156
+ required: false,
157
+ default: false
118
158
  }
119
159
  },
120
- emits: ["update:modelValue"],
160
+ emits: ["update", "update:modelValue", "update:scope"],
121
161
  setup(props, { emit }) {
122
-
123
162
  const { entities: chartOrganisations, fetching: fetchingChartOrganisations, getMany: getManyChartOrganisations } = useChartOrganisations();
124
163
  const { entities: chartOrganisationTypes, fetching: fetchingChartOrganisationTypes, getMany: getManyChartOrganisationTypes } = useChartOrganisationTypes();
125
164
 
@@ -133,55 +172,93 @@ export default defineComponent({
133
172
  }
134
173
 
135
174
  const charts = computed(() => {
136
- return chartOrganisations.value.map(c => {
137
- return {
138
- id: `${c.id}_${c.scope}`,
139
- imageId: c.imageId,
140
- chartId: c.chartId,
141
- chartCategoryId: c.chartCategoryId,
142
- chartCategoryLabel: c.chartCategoryLabel,
143
- scope: c.scope,
144
- label: c.label,
145
- title: c.title,
146
- code: c.code,
147
- icon: c.icon,
148
- tags: c.tags,
149
- multiple: c.multiple,
150
- chartType: c.chartType,
151
- modelsLabels: c.modelsLabels
152
- }
153
- })
154
- .concat(chartOrganisationTypes.value.map(c => {
155
- return {
156
- id: `${c.id}_${c.scope}`,
157
- imageId: c.imageId,
158
- chartId: c.chartId,
159
- chartCategoryId: c.chartCategoryId,
160
- chartCategoryLabel: c.chartCategoryLabel,
161
- scope: c.scope,
162
- label: c.label,
163
- title: c.title,
164
- code: c.code,
165
- icon: c.icon,
166
- tags: c.tags,
167
- multiple: c.multiple,
168
- chartType: c.chartType,
169
- modelsLabels: c.modelsLabels
170
- }
171
- }))
172
- })
175
+ return chartOrganisations.value.map(c => ({
176
+ id: c.id,
177
+ imageId: c.imageId,
178
+ chartId: c.chartId,
179
+ chartCategoryId: c.chartCategoryId,
180
+ chartCategoryLabel: c.chartCategoryLabel,
181
+ scope: c.scope,
182
+ label: c.label,
183
+ title: c.title,
184
+ code: c.code,
185
+ icon: c.icon,
186
+ tags: c.tags,
187
+ multiple: c.multiple,
188
+ chartType: c.chartType,
189
+ modelsLabels: c.modelsLabels
190
+ })).concat(chartOrganisationTypes.value.map(c => ({
191
+ id: c.id,
192
+ imageId: c.imageId,
193
+ chartId: c.chartId,
194
+ chartCategoryId: c.chartCategoryId,
195
+ chartCategoryLabel: c.chartCategoryLabel,
196
+ scope: c.scope,
197
+ label: c.label,
198
+ title: c.title,
199
+ code: c.code,
200
+ icon: c.icon,
201
+ tags: c.tags,
202
+ multiple: c.multiple,
203
+ chartType: c.chartType,
204
+ modelsLabels: c.modelsLabels
205
+ })));
206
+ });
173
207
 
174
- const update = (value : string) =>
175
- {
176
- const item = isSelected(value);
208
+ const headersOptions = computed(() => ({
209
+ modelsLabels: {
210
+ fixedFilters: chartOrganisationTypes.value.map(c => c.modelsLabels).reduce((acc, models) => {
211
+ for(const m of models){
212
+ if(!acc.map((m) => m.id).includes(m.id)){
213
+ acc.push(m);
214
+ }
215
+ }
216
+ return acc;
217
+ }, []).map((m) => ({
218
+ value: m.id,
219
+ text: m.label
220
+ })).concat({
221
+ value: '',
222
+ text: '--'
223
+ }),
224
+ methodFilter: (value: string, items: ChartModelLabel[]) => (items.length == 0 && value == '') || (items.length > 0 && items.some(ml => ml.id == value))
225
+ },
226
+ chartType: {
227
+ fixedFilters: getEnumEntries(ChartType).map(e => ({
228
+ value: e.value,
229
+ text: chartTypeLabel(e.value)
230
+ })),
231
+ methodFilter: (value: ChartType, item: ChartType) => value == item
232
+ }
233
+ }));
177
234
 
178
- if(item){
179
- emit("update:modelValue", props.modelValue.filter(m => m != value))
235
+ const update = (value : string) => {
236
+ const isAlreadySelected = isSelected(value);
237
+ if (isAlreadySelected) {
238
+ onSelect(props.modelValue.filter(m => m != value));
239
+ }
240
+ else if(props.singleSelect){
241
+ onSelect([value]);
180
242
  }
181
243
  else{
182
- emit("update:modelValue", [...props.modelValue, value])
244
+ onSelect([...props.modelValue, value]);
183
245
  }
184
246
  }
247
+
248
+ const onSelect = (values: string[] | null) => {
249
+ if(!values){
250
+ emit("update:modelValue", []);
251
+ emit("update:scope", []);
252
+ emit("update", { modelValue: [], scope: [] });
253
+ return;
254
+ }
255
+ const selectedItems = charts.value.filter(i => values.includes(i.id));
256
+ const newModelValue = selectedItems.map(i => i.id);
257
+ const newScope = selectedItems.map(i => i.scope);
258
+ emit("update:modelValue", newModelValue);
259
+ emit("update:scope", newScope);
260
+ emit("update", { modelValue: newModelValue, scope: newScope });
261
+ };
185
262
 
186
263
  watch(() => [props.chartOrganisationFilters,props.chartOrganisationTypeFilters], (next, previous) => {
187
264
  if ((!next && !previous) || !_.isEqual(next, previous)) {
@@ -194,9 +271,13 @@ export default defineComponent({
194
271
  fetchingChartOrganisations,
195
272
  chartOrganisationTypes,
196
273
  chartOrganisations,
274
+ headersOptions,
197
275
  ColorEnum,
198
276
  charts,
277
+ chartTypeLabel,
199
278
  isSelected,
279
+ chartIcon,
280
+ onSelect,
200
281
  update
201
282
  };
202
283
  }
@@ -21,25 +21,30 @@
21
21
  :userImageId="currentUser?.imageId"
22
22
  />
23
23
  </FSRow>
24
- <FSCommentTileUI
25
- v-for="comment in orderedComments"
26
- :key="comment.id"
27
- :timestamp="epochToLongTimeFormat(comment.timestamp)"
28
- :userName="comment.userName"
29
- :userImageId="comment.userImageId"
30
- :canEditRemove="currentUser?.id === comment.userId"
31
- :comment="comment.comment"
32
- :edited="comment.edited"
33
- :id="comment.id"
34
- @edit="updateComment"
35
- @remove="removeComment(comment.id)"
36
- />
24
+ <FSCol
25
+ gap="12px"
26
+ >
27
+ <FSCommentTileUI
28
+ v-for="comment in orderedComments"
29
+ :key="comment.id"
30
+ :timestamp="epochToLongTimeFormat(comment.timestamp)"
31
+ :userName="comment.userName"
32
+ :userImageId="comment.userImageId"
33
+ :canEditRemove="currentUser?.id === comment.userId"
34
+ :comment="comment.comment"
35
+ :edited="comment.edited"
36
+ :removing="removing"
37
+ :id="comment.id"
38
+ @edit="updateComment"
39
+ @remove="removeComment(comment.id)"
40
+ />
41
+ </FSCol>
37
42
  </FSCol>
38
43
  </template>
39
44
 
40
45
  <script lang="ts">
41
46
  import type { PropType} from "vue";
42
- import { computed, defineComponent, onMounted, watch } from "vue";
47
+ import { computed, defineComponent, onMounted, ref, watch } from "vue";
43
48
  import _ from "lodash";
44
49
 
45
50
  import { useDateFormat, useCurrentUser } from "@dative-gpi/foundation-shared-services/composables";
@@ -73,13 +78,15 @@ export default defineComponent({
73
78
  }
74
79
  },
75
80
  setup(props) {
76
- const {fetch : fetchCurrentUser, entity: currentUser} = useCurrentUser();
81
+ const { fetch : fetchCurrentUser, entity: currentUser } = useCurrentUser();
77
82
  const { create: createComment, creating : creatingComment } = useCreateComment();
78
83
  const { getMany: fetchComments, entities: comments } = useComments();
79
- const {update } = useUpdateComment();
80
- const {remove } = useRemoveComment();
84
+ const { update } = useUpdateComment();
85
+ const { remove, removing } = useRemoveComment();
81
86
  const { epochToLongTimeFormat } = useDateFormat();
82
87
 
88
+ const error = ref<string | null>(null);
89
+
83
90
  const orderedComments = computed(() => {
84
91
  return _.orderBy(comments.value, ['timestamp'], ['desc']);
85
92
  });
@@ -101,8 +108,14 @@ export default defineComponent({
101
108
  update(payload.commentId, {comment : payload.comment})
102
109
  }
103
110
 
104
- const removeComment = (commentId : string) => {
105
- remove(commentId)
111
+ const removeComment = async (commentId : string) => {
112
+ try {
113
+ error.value = null;
114
+ await remove(commentId);
115
+ }
116
+ catch (exception: any) {
117
+ error.value = exception.response.data;
118
+ }
106
119
  }
107
120
 
108
121
  watch(() => props.commentFilters, (next, previous) => {
@@ -112,15 +125,18 @@ export default defineComponent({
112
125
  }, { immediate: true });
113
126
 
114
127
  return {
115
- comments,
116
- ColorEnum,
117
128
  creatingComment,
118
- currentUser,
119
129
  orderedComments,
130
+ currentUser,
131
+ ColorEnum,
132
+ comments,
133
+ removing,
134
+ error,
135
+ epochToLongTimeFormat,
120
136
  createNewComment,
121
137
  updateComment,
122
138
  removeComment,
123
- epochToLongTimeFormat
139
+
124
140
  };
125
141
  }
126
142
  });