@dative-gpi/foundation-core-components 1.0.69 → 1.0.71-groupings-2

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 +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/FSAutocompleteGrouping.vue +105 -0
  8. package/components/autocompletes/FSAutocompleteLocation.vue +6 -0
  9. package/components/autocompletes/FSAutocompleteManufacturer.vue +8 -0
  10. package/components/autocompletes/FSAutocompleteModel.vue +9 -1
  11. package/components/autocompletes/FSAutocompleteOrganisationType.vue +7 -1
  12. package/components/autocompletes/FSAutocompleteRole.vue +14 -6
  13. package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +7 -1
  14. package/components/autocompletes/FSAutocompleteUserOrganisation.vue +9 -1
  15. package/components/customProperties/FSMetaField.vue +35 -40
  16. package/components/customProperties/FSMetaFormContent.vue +4 -3
  17. package/components/customProperties/FSMetaHistory.vue +2 -2
  18. package/components/customProperties/helpers.ts +57 -165
  19. package/components/entities/FSBaseEntitiesList.vue +12 -2
  20. package/components/entities/FSDialogSelectEntities.vue +19 -2
  21. package/components/entities/FSEntityField.vue +68 -13
  22. package/components/entities/FSSelectEntitiesList.vue +40 -7
  23. package/components/explorers/FSBaseDevicesExplorer.vue +322 -0
  24. package/components/explorers/FSBaseFoldersExplorer.vue +99 -20
  25. package/components/fields/FSMagicConfigField.vue +171 -0
  26. package/components/fields/FSMagicField.vue +214 -0
  27. package/components/lists/FSDataTable.vue +22 -16
  28. package/components/lists/alerts/FSBaseAlertsList.vue +96 -106
  29. package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +4 -4
  30. package/components/lists/authTokens/FSBaseAuthTokensList.vue +6 -4
  31. package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +97 -34
  32. package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +98 -34
  33. package/components/lists/charts/FSBaseChartsList.vue +153 -64
  34. package/components/lists/comments/FSBaseCommentsList.vue +39 -23
  35. package/components/lists/connectivityScenarios/FSBaseConnectivityScenariosList.vue +128 -0
  36. package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +41 -8
  37. package/components/lists/dashboards/FSBaseDashboardsList.vue +76 -16
  38. package/components/lists/dashboards/FSSimpleDashboardsList.vue +33 -7
  39. package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +8 -6
  40. package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +8 -5
  41. package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +70 -44
  42. package/components/lists/folders/FSBaseFoldersList.vue +27 -15
  43. package/components/lists/groupings/FSBaseGroupingsList.vue +125 -0
  44. package/components/lists/groups/FSBaseGroupsList.vue +13 -9
  45. package/components/lists/locations/FSBaseLocationsList.vue +17 -13
  46. package/components/lists/models/FSBaseModelsList.vue +10 -5
  47. package/components/lists/playlists/FSSimplePlaylistsList.vue +44 -0
  48. package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +6 -5
  49. package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +6 -5
  50. package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +45 -8
  51. package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +45 -7
  52. package/components/lists/scenarios/FSBaseScenariosList.vue +121 -86
  53. package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +10 -7
  54. package/components/lists/serviceAccountRoleOrganisations/{FSBaseServiceAccountRoleOrganisations.vue → FSBaseServiceAccountRoleOrganisationsList.vue} +6 -5
  55. package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +10 -7
  56. package/components/lists/userOrganisations/FSChipUserOrganisationsList.vue +61 -0
  57. package/components/selects/FSPlotPerSelector.vue +94 -16
  58. package/components/tiles/FSChartTile.vue +71 -0
  59. package/components/tiles/FSDashboardOrganisationTile.vue +3 -3
  60. package/components/tiles/FSDashboardOrganisationTypeTile.vue +3 -3
  61. package/components/tiles/FSDashboardShallowTile.vue +3 -3
  62. package/components/tiles/FSDeviceOrganisationTile.vue +3 -3
  63. package/components/tiles/FSFolderTile.vue +7 -5
  64. package/components/tiles/FSGroupTile.vue +3 -3
  65. package/components/tiles/FSLocationTile.vue +5 -3
  66. package/components/tiles/FSModelTile.vue +64 -0
  67. package/components/tiles/FSServiceAccountOrganisationTile.vue +3 -3
  68. package/components/tiles/FSUserOrganisationTile.vue +3 -3
  69. package/components/treeviews/FSTreeViewGroup.vue +7 -1
  70. package/package.json +9 -9
  71. package/utils/dashboards.ts +4 -4
  72. package/utils/index.ts +0 -1
  73. package/utils/roles.ts +3 -3
  74. package/utils/users.ts +3 -3
  75. package/components/selects/FSAggregationSelector.vue +0 -51
  76. package/components/selects/FSAxisTypeSelector.vue +0 -48
  77. package/components/selects/FSDisplayAsSelector.vue +0 -52
  78. package/components/selects/FSFilterTypeSelector.vue +0 -53
  79. package/components/selects/FSHeatmapRuleSelector.vue +0 -52
  80. package/components/selects/FSOperationOnSelector.vue +0 -51
  81. package/components/selects/FSPlanningTypeSelector.vue +0 -51
  82. package/components/selects/FSSelectEntityType.vue +0 -59
  83. package/components/selects/FSSerieTypeSelector.vue +0 -51
  84. 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
  >
@@ -39,6 +43,7 @@
39
43
  height="32px"
40
44
  width="32px"
41
45
  :imageId="item.imageId"
46
+ :thumbnail="true"
42
47
  />
43
48
  </template>
44
49
  <template
@@ -46,27 +51,48 @@
46
51
  >
47
52
  <FSTagGroup
48
53
  variant="slide"
49
- :editable="false"
50
54
  :tags="item.tags"
55
+ :showRemove="false"
51
56
  />
52
57
  </template>
53
58
  <template
54
59
  #item.modelsLabels="{ item }"
55
60
  >
56
61
  <FSTagGroup
57
- :editable="false"
62
+ variant="slide"
58
63
  :tags="item.modelsLabels.map((d: any) => d.label)"
64
+ :showRemove="false"
59
65
  />
60
66
  </template>
61
67
  <template
62
- #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="{ index, item, toggleSelect }"
63
83
  >
64
84
  <FSChartTileUI
85
+ :key="index"
65
86
  :label="item.label"
87
+ :singleSelect="$props.singleSelect"
88
+ :selectable="$props.selectable"
66
89
  :categoryLabel="item.chartCategoryLabel"
67
90
  :icon="item.icon"
68
91
  :imageId="item.imageId"
69
92
  :type="item.chartType"
93
+ :scope="item.scope"
94
+ :modelValue="isSelected(item.id)"
95
+ @update:modelValue="toggleSelect(item)"
70
96
  :to="$props.itemTo && $props.itemTo(item)"
71
97
  />
72
98
  </template>
@@ -74,85 +100,123 @@
74
100
  </template>
75
101
 
76
102
  <script lang="ts">
77
- import { defineComponent, type PropType, watch } from "vue";
103
+ import { computed, defineComponent, type PropType, watch } from "vue";
78
104
  import type { RouteLocation } from "vue-router";
79
105
  import _ from "lodash";
80
106
 
107
+ import { ChartType } from "@dative-gpi/foundation-shared-domain/enums";
108
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
81
109
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
82
- import { PlotPer } from "@dative-gpi/foundation-shared-domain/enums";
110
+ import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
83
111
 
84
- import { type ChartOrganisationFilters, type ChartOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
112
+ import type { ChartModelLabel, ChartOrganisationFilters, ChartOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
85
113
  import { useChartOrganisations } from "@dative-gpi/foundation-core-services/composables";
86
114
 
87
- import FSDataTable from "../FSDataTable.vue";
115
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
116
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
88
117
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
89
118
  import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
90
119
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
91
120
  import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
92
121
 
122
+ import FSDataTable from "../FSDataTable.vue";
123
+
93
124
  export default defineComponent({
94
125
  name: "FSBaseChartOrganisationsList",
95
126
  components: {
127
+ FSChartTileUI,
96
128
  FSDataTable,
97
- FSIcon,
98
- FSImage,
99
129
  FSTagGroup,
100
- FSChartTileUI
130
+ FSImage,
131
+ FSIcon,
132
+ FSText,
133
+ FSRow,
101
134
  },
102
135
  props: {
103
- modelValue: {
104
- type: Array as PropType<string[]>,
105
- default: () => [],
106
- required: false
136
+ tableCode: {
137
+ type: String as PropType<string | null>,
138
+ required: false,
139
+ default: null
107
140
  },
108
141
  chartOrganisationFilters: {
109
142
  type: Object as PropType<ChartOrganisationFilters>,
110
143
  required: false,
111
144
  default: null
112
145
  },
113
- plotPer: {
114
- type: Number as PropType<PlotPer>,
115
- required: false,
116
- default: PlotPer.None
117
- },
118
- tableCode: {
119
- type: String,
120
- required: true
121
- },
122
146
  itemTo: {
123
147
  type: Function as PropType<(item: ChartOrganisationInfos) => Partial<RouteLocation>>,
124
148
  required: false
125
- }
149
+ },
150
+ modelValue: {
151
+ type: Array as PropType<string[]>,
152
+ default: () => [],
153
+ required: false
154
+ },
155
+ selectable: {
156
+ type: Boolean,
157
+ required: false,
158
+ default: true
159
+ },
160
+ singleSelect: {
161
+ type: Boolean,
162
+ required: false,
163
+ default: false
164
+ },
126
165
  },
127
166
  emits: ["update:modelValue"],
128
167
  setup(props) {
129
-
130
168
  const { entities: chartOrganisations, fetching: fetchingChartOrganisations, getMany: getManyChartOrganisations } = useChartOrganisations();
131
169
 
170
+ const headersOptions = computed(() => ({
171
+ modelsLabels: {
172
+ fixedFilters: chartOrganisations.value.map(c => c.modelsLabels).reduce((acc, models) => {
173
+ for (const m of models) {
174
+ if (!acc.map((m) => m.id).includes(m.id)) {
175
+ acc.push(m);
176
+ }
177
+ }
178
+ return acc;
179
+ }, []).map((m) => ({
180
+ value: m.id,
181
+ text: m.label
182
+ })).concat({
183
+ value: '',
184
+ text: '--'
185
+ }),
186
+ methodFilter: (value: string, items: ChartModelLabel[]) => (items.length == 0 && value == '') || (items.length > 0 && items.some(ml => ml.id == value))
187
+ },
188
+ chartType: {
189
+ fixedFilters: getEnumEntries(ChartType).map(e => ({
190
+ value: e.value,
191
+ text: chartTypeLabel(e.value)
192
+ })),
193
+ methodFilter: (value: ChartType, item: ChartType) => value == item
194
+ }
195
+ }));
196
+
197
+
132
198
  const isSelected = (id: string): boolean => {
133
199
  return props.modelValue.includes(id);
134
200
  };
135
201
 
136
202
  const fetch = () =>{
137
- if(props.plotPer === PlotPer.None) {
138
- getManyChartOrganisations(props.chartOrganisationFilters);
139
- } else {
140
- getManyChartOrganisations({...props.chartOrganisationFilters, plotPer: props.plotPer});
141
- }
203
+ getManyChartOrganisations(props.chartOrganisationFilters);
142
204
  }
143
205
 
144
- watch(() => [props.chartOrganisationFilters, props.plotPer], (next, previous) => {
206
+ watch(() => [props.chartOrganisationFilters], (next, previous) => {
145
207
  if ((!next && !previous) || !_.isEqual(next, previous)) {
146
208
  fetch();
147
209
  }
148
210
  }, { immediate: true });
149
-
150
211
 
151
212
  return {
152
- ColorEnum,
153
213
  fetchingChartOrganisations,
154
214
  chartOrganisations,
155
- isSelected
215
+ headersOptions,
216
+ ColorEnum,
217
+ chartTypeLabel,
218
+ isSelected,
219
+ chartIcon
156
220
  };
157
221
  }
158
222
  });
@@ -1,7 +1,11 @@
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
11
  @update:modelValue="onSelect"
@@ -38,6 +42,7 @@
38
42
  height="32px"
39
43
  width="32px"
40
44
  :imageId="item.imageId"
45
+ :thumbnail="true"
41
46
  />
42
47
  </template>
43
48
  <template
@@ -45,29 +50,55 @@
45
50
  >
46
51
  <FSTagGroup
47
52
  variant="slide"
48
- :editable="false"
53
+ :showRemove="false"
49
54
  :tags="item.tags"
50
55
  />
51
56
  </template>
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>
52
71
  <template
53
72
  #item.modelsLabels="{ item }"
54
73
  >
55
74
  <FSTagGroup
56
- :editable="false"
75
+ :showRemove="false"
57
76
  :tags="item.modelsLabels.map((d: any) => d.label)"
58
77
  />
59
78
  </template>
60
79
  <template
61
- #item.tile="{ item }"
80
+ #item.scope="{ item }"
81
+ >
82
+ <FSChip
83
+ :label="applicationScopeLabel(item.scope)"
84
+ :color="ColorEnum.Light"
85
+ />
86
+ </template>
87
+ <template
88
+ #item.tile="{ index, item }"
62
89
  >
63
90
  <FSChartTileUI
91
+ :key="index"
64
92
  :label="item.label"
65
93
  :categoryLabel="item.chartCategoryLabel"
66
94
  :icon="item.icon"
67
95
  :imageId="item.imageId"
68
96
  :type="item.chartType"
69
- :color="isSelected(item.id) ? ColorEnum.Primary : ColorEnum.Dark"
70
- @click="update(item.id)"
97
+ :scope="item.scope"
98
+ :singleSelect="$props.singleSelect"
99
+ :selectable="$props.selectable"
100
+ :modelValue="isSelected(item.id)"
101
+ @update:modelValue="update(item.id)"
71
102
  />
72
103
  </template>
73
104
  </FSDataTable>
@@ -77,16 +108,22 @@
77
108
  import { defineComponent, type PropType, watch, computed } from "vue";
78
109
  import _ from "lodash";
79
110
 
80
- import {ColorEnum } from "@dative-gpi/foundation-shared-components/models";
81
-
82
- import type { ChartOrganisationFilters, ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
111
+ import { chartTypeLabel, chartIcon, applicationScopeLabel } from "@dative-gpi/foundation-shared-components/tools";
112
+ import { ChartOrigin, ChartType } from "@dative-gpi/foundation-shared-domain/enums";
113
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
114
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
83
115
 
116
+ import type { ChartModelLabel, ChartOrganisationFilters, ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
84
117
  import { useChartOrganisations, useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
85
118
 
86
119
  import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
87
120
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
88
121
  import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
89
122
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
123
+ import FSChip from '@dative-gpi/foundation-shared-components/components/FSChip.vue';
124
+ import FSText from '@dative-gpi/foundation-shared-components/components/FSText.vue';
125
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
126
+
90
127
  import FSDataTable from "../FSDataTable.vue";
91
128
 
92
129
  export default defineComponent({
@@ -96,13 +133,16 @@ export default defineComponent({
96
133
  FSDataTable,
97
134
  FSTagGroup,
98
135
  FSImage,
99
- FSIcon
136
+ FSText,
137
+ FSChip,
138
+ FSIcon,
139
+ FSRow
100
140
  },
101
141
  props: {
102
- modelValue: {
103
- type: Array as PropType<string[]>,
104
- default: () => [],
105
- required: false
142
+ tableCode: {
143
+ type: String as PropType<string | null>,
144
+ required: false,
145
+ default: null
106
146
  },
107
147
  chartOrganisationFilters: {
108
148
  type: Object as PropType<ChartOrganisationFilters>,
@@ -114,14 +154,24 @@ export default defineComponent({
114
154
  required: false,
115
155
  default: null
116
156
  },
117
- tableCode: {
118
- type: String,
119
- required: true
157
+ modelValue: {
158
+ type: Array as PropType<string[]>,
159
+ default: () => [],
160
+ required: false
161
+ },
162
+ selectable: {
163
+ type: Boolean,
164
+ required: false,
165
+ default: true
166
+ },
167
+ singleSelect: {
168
+ type: Boolean,
169
+ required: false,
170
+ default: false
120
171
  }
121
172
  },
122
- emits: ["update:modelValue", "update:scope"],
173
+ emits: ["update", "update:modelValue", "update:scope"],
123
174
  setup(props, { emit }) {
124
-
125
175
  const { entities: chartOrganisations, fetching: fetchingChartOrganisations, getMany: getManyChartOrganisations } = useChartOrganisations();
126
176
  const { entities: chartOrganisationTypes, fetching: fetchingChartOrganisationTypes, getMany: getManyChartOrganisationTypes } = useChartOrganisationTypes();
127
177
 
@@ -135,65 +185,100 @@ export default defineComponent({
135
185
  }
136
186
 
137
187
  const charts = computed(() => {
138
- return chartOrganisations.value.map(c => {
139
- return {
140
- id: c.id,
141
- imageId: c.imageId,
142
- chartId: c.chartId,
143
- chartCategoryId: c.chartCategoryId,
144
- chartCategoryLabel: c.chartCategoryLabel,
145
- scope: c.scope,
146
- label: c.label,
147
- title: c.title,
148
- code: c.code,
149
- icon: c.icon,
150
- tags: c.tags,
151
- multiple: c.multiple,
152
- chartType: c.chartType,
153
- modelsLabels: c.modelsLabels
154
- }
155
- })
156
- .concat(chartOrganisationTypes.value.map(c => {
157
- return {
158
- id: c.id,
159
- imageId: c.imageId,
160
- chartId: c.chartId,
161
- chartCategoryId: c.chartCategoryId,
162
- chartCategoryLabel: c.chartCategoryLabel,
163
- scope: c.scope,
164
- label: c.label,
165
- title: c.title,
166
- code: c.code,
167
- icon: c.icon,
168
- tags: c.tags,
169
- multiple: c.multiple,
170
- chartType: c.chartType,
171
- modelsLabels: c.modelsLabels
188
+ return chartOrganisations.value.map(c => ({
189
+ id: c.id,
190
+ imageId: c.imageId,
191
+ chartId: c.chartId,
192
+ chartCategoryId: c.chartCategoryId,
193
+ chartCategoryLabel: c.chartCategoryLabel,
194
+ scope: c.scope,
195
+ label: c.label,
196
+ title: c.title,
197
+ code: c.code,
198
+ icon: c.icon,
199
+ tags: c.tags,
200
+ multiple: c.multiple,
201
+ chartType: c.chartType,
202
+ modelsLabels: c.modelsLabels
203
+ })).concat(chartOrganisationTypes.value.map(c => ({
204
+ id: c.id,
205
+ imageId: c.imageId,
206
+ chartId: c.chartId,
207
+ chartCategoryId: c.chartCategoryId,
208
+ chartCategoryLabel: c.chartCategoryLabel,
209
+ scope: c.scope,
210
+ label: c.label,
211
+ title: c.title,
212
+ code: c.code,
213
+ icon: c.icon,
214
+ tags: c.tags,
215
+ multiple: c.multiple,
216
+ chartType: c.chartType,
217
+ modelsLabels: c.modelsLabels
218
+ })));
219
+ });
220
+
221
+ const headersOptions = computed(() => ({
222
+ modelsLabels: {
223
+ fixedFilters: chartOrganisationTypes.value.map(c => c.modelsLabels).reduce((acc, models) => {
224
+ for(const m of models){
225
+ if(!acc.map((m) => m.id).includes(m.id)){
226
+ acc.push(m);
227
+ }
172
228
  }
173
- }))
174
- })
229
+ return acc;
230
+ }, []).map((m) => ({
231
+ value: m.id,
232
+ text: m.label
233
+ })).concat({
234
+ value: '',
235
+ text: '--'
236
+ }),
237
+ methodFilter: (value: string, items: ChartModelLabel[]) => (items.length == 0 && value == '') || (items.length > 0 && items.some(ml => ml.id == value))
238
+ },
239
+ chartType: {
240
+ fixedFilters: getEnumEntries(ChartType).map(e => ({
241
+ value: e.value,
242
+ text: chartTypeLabel(e.value)
243
+ })),
244
+ methodFilter: (value: ChartType, item: ChartType) => value == item
245
+ },
246
+ scope: {
247
+ fixedFilters: getEnumEntries(ChartOrigin).filter(e => e.value != ChartOrigin.None).map(e => ({
248
+ value: e.value,
249
+ text: applicationScopeLabel(e.value)
250
+ })),
251
+ methodFilter: (value: ChartOrigin, item: ChartOrigin) => value == item
252
+ }
175
253
 
176
- const update = (value : string) =>
177
- {
178
- const item = isSelected(value);
254
+ }));
179
255
 
180
- if(item){
181
- onSelect(props.modelValue.filter(m => m != value))
256
+ const update = (value : string) => {
257
+ const isAlreadySelected = isSelected(value);
258
+ if (isAlreadySelected) {
259
+ onSelect(props.modelValue.filter(m => m != value));
260
+ }
261
+ else if(props.singleSelect){
262
+ onSelect([value]);
182
263
  }
183
264
  else{
184
- onSelect([...props.modelValue, value])
265
+ onSelect([...props.modelValue, value]);
185
266
  }
186
267
  }
187
268
 
188
269
  const onSelect = (values: string[] | null) => {
189
270
  if(!values){
190
- emit("update:modelValue", [])
191
- emit("update:scope", [])
271
+ emit("update:modelValue", []);
272
+ emit("update:scope", []);
273
+ emit("update", { modelValue: [], scope: [] });
192
274
  return;
193
275
  }
194
276
  const selectedItems = charts.value.filter(i => values.includes(i.id));
195
- emit("update:modelValue", selectedItems.map(i => i.id));
196
- emit("update:scope", selectedItems.map(i => i.scope));
277
+ const newModelValue = selectedItems.map(i => i.id);
278
+ const newScope = selectedItems.map(i => i.scope);
279
+ emit("update:modelValue", newModelValue);
280
+ emit("update:scope", newScope);
281
+ emit("update", { modelValue: newModelValue, scope: newScope });
197
282
  };
198
283
 
199
284
  watch(() => [props.chartOrganisationFilters,props.chartOrganisationTypeFilters], (next, previous) => {
@@ -207,9 +292,13 @@ export default defineComponent({
207
292
  fetchingChartOrganisations,
208
293
  chartOrganisationTypes,
209
294
  chartOrganisations,
295
+ headersOptions,
210
296
  ColorEnum,
211
297
  charts,
298
+ applicationScopeLabel,
299
+ chartTypeLabel,
212
300
  isSelected,
301
+ chartIcon,
213
302
  onSelect,
214
303
  update
215
304
  };
@@ -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
  });