@dative-gpi/foundation-core-components 1.0.91 → 1.0.93

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.
@@ -57,6 +57,11 @@ export default defineComponent({
57
57
  required: false,
58
58
  default: 1000
59
59
  },
60
+ extraHeaders: {
61
+ type: Array as PropType<FSDataTableColumn[]>,
62
+ required: false,
63
+ default: () => []
64
+ },
60
65
  headersOptions: {
61
66
  type: Object as PropType<{ [key: string]: Partial<FSDataTableColumn> }>,
62
67
  required: false,
@@ -70,7 +75,7 @@ export default defineComponent({
70
75
  const { getTable, setTable } = useTables();
71
76
  const { debounce, cancel } = useDebounce();
72
77
 
73
- const computedTable = computed(() => computeTable(props.headersOptions, props.defaultMode));
78
+ const computedTable = computed(() => computeTable(props.headersOptions, props.defaultMode, props.extraHeaders));
74
79
 
75
80
  onUnmounted(() => {
76
81
  cancel();
@@ -3,6 +3,7 @@
3
3
  :items="chartOrganisationTypes"
4
4
  :itemTo="$props.itemTo"
5
5
  :loading="fetchingChartOrganisationTypes"
6
+ :headersOptions="headersOptions"
6
7
  :tableCode="$props.tableCode"
7
8
  :modelValue="$props.modelValue"
8
9
  @update:modelValue="$emit('update:modelValue', $event)"
@@ -50,6 +51,20 @@
50
51
  :tags="item.tags"
51
52
  />
52
53
  </template>
54
+ <template
55
+ #item.chartType="{ item }"
56
+ >
57
+ <FSRow
58
+ :wrap="false"
59
+ >
60
+ <FSIcon
61
+ :icon="chartIcon(item.chartType)"
62
+ />
63
+ <FSText>
64
+ {{ chartTypeLabel(item.chartType) }}
65
+ </FSText>
66
+ </FSRow>
67
+ </template>
53
68
  <template
54
69
  #item.modelsLabels="{ item }"
55
70
  >
@@ -74,21 +89,25 @@
74
89
  </template>
75
90
 
76
91
  <script lang="ts">
77
- import _ from "lodash";
78
- import { defineComponent, type PropType, watch } from "vue";
92
+ import { computed, defineComponent, type PropType, watch } from "vue";
79
93
  import type { RouteLocation } from "vue-router";
94
+ import _ from "lodash";
80
95
 
81
- import {ColorEnum} from "@dative-gpi/foundation-shared-components/models";
82
-
83
- import type { ChartOrganisationTypeFilters, ChartOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
96
+ import { ChartType } from "@dative-gpi/foundation-shared-domain/enums";
97
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
98
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
99
+ import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
84
100
 
101
+ import type { ChartModelLabel, ChartOrganisationTypeFilters, ChartOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
85
102
  import { useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
86
103
 
87
104
  import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
88
- import FSDataTable from "../FSDataTable.vue";
89
105
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
90
106
  import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
91
107
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
108
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
109
+
110
+ import FSDataTable from "../FSDataTable.vue";
92
111
 
93
112
  export default defineComponent({
94
113
  name: "FSBaseChartOrganisationTypesList",
@@ -97,7 +116,8 @@ export default defineComponent({
97
116
  FSDataTable,
98
117
  FSTagGroup,
99
118
  FSImage,
100
- FSIcon
119
+ FSIcon,
120
+ FSRow
101
121
  },
102
122
  props: {
103
123
  tableCode: {
@@ -122,9 +142,32 @@ export default defineComponent({
122
142
  },
123
143
  emits: ["update:modelValue"],
124
144
  setup(props) {
125
-
126
145
  const { entities: chartOrganisationTypes, fetching: fetchingChartOrganisationTypes, getMany: getManyChartOrganisationTypes } = useChartOrganisationTypes();
127
146
 
147
+ const headersOptions = computed(() => ({
148
+ modelsLabels: {
149
+ fixedFilters: chartOrganisationTypes.value.map(c => c.modelsLabels).reduce((acc, models) => {
150
+ for (const m of models) {
151
+ if (!acc.map((m) => m.id).includes(m.id)) {
152
+ acc.push(m);
153
+ }
154
+ }
155
+ return acc;
156
+ }, []).map((m) => ({
157
+ value: m.id,
158
+ text: m.label
159
+ })),
160
+ methodFilter: (value: string, items: ChartModelLabel[]) => items.some(ml => ml.id == value)
161
+ },
162
+ chartType: {
163
+ fixedFilters: getEnumEntries(ChartType).filter(f => f.value != ChartType.None).map(e => ({
164
+ value: e.value,
165
+ text: chartTypeLabel(e.value)
166
+ })),
167
+ methodFilter: (value: ChartType, item: ChartType) => value == item
168
+ }
169
+ }));
170
+
128
171
  const isSelected = (id: string): boolean => {
129
172
  return props.modelValue.includes(id);
130
173
  };
@@ -140,10 +183,13 @@ export default defineComponent({
140
183
  }, { immediate: true });
141
184
 
142
185
  return {
143
- ColorEnum,
144
186
  fetchingChartOrganisationTypes,
145
187
  chartOrganisationTypes,
146
- isSelected
188
+ headersOptions,
189
+ ColorEnum,
190
+ chartTypeLabel,
191
+ isSelected,
192
+ chartIcon
147
193
  };
148
194
  }
149
195
  });
@@ -3,6 +3,7 @@
3
3
  :items="chartOrganisations"
4
4
  :itemTo="$props.itemTo"
5
5
  :loading="fetchingChartOrganisations"
6
+ :headersOptions="headersOptions"
6
7
  :tableCode="$props.tableCode"
7
8
  :modelValue="$props.modelValue"
8
9
  @update:modelValue="$emit('update:modelValue', $event)"
@@ -70,33 +71,54 @@
70
71
  :to="$props.itemTo && $props.itemTo(item)"
71
72
  />
72
73
  </template>
74
+ <template
75
+ #item.chartType="{ item }"
76
+ >
77
+ <FSRow
78
+ :wrap="false"
79
+ >
80
+ <FSIcon
81
+ :icon="chartIcon(item.chartType)"
82
+ />
83
+ <FSText>
84
+ {{ chartTypeLabel(item.chartType) }}
85
+ </FSText>
86
+ </FSRow>
87
+ </template>
73
88
  </FSDataTable>
74
89
  </template>
75
90
 
76
91
  <script lang="ts">
77
- import { defineComponent, type PropType, watch } from "vue";
92
+ import { computed, defineComponent, type PropType, watch } from "vue";
78
93
  import type { RouteLocation } from "vue-router";
79
94
  import _ from "lodash";
80
95
 
96
+ import { ChartType } from "@dative-gpi/foundation-shared-domain/enums";
97
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
81
98
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
99
+ import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
82
100
 
83
- import { type ChartOrganisationFilters, type ChartOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
101
+ import type { ChartModelLabel, ChartOrganisationFilters, ChartOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
84
102
  import { useChartOrganisations } from "@dative-gpi/foundation-core-services/composables";
85
103
 
86
- import FSDataTable from "../FSDataTable.vue";
104
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
87
105
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
88
106
  import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
89
107
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
90
108
  import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
91
109
 
110
+ import FSDataTable from "../FSDataTable.vue";
111
+
112
+
92
113
  export default defineComponent({
93
114
  name: "FSBaseChartOrganisationsList",
94
115
  components: {
116
+ FSChartTileUI,
95
117
  FSDataTable,
96
- FSIcon,
97
- FSImage,
98
118
  FSTagGroup,
99
- FSChartTileUI
119
+ FSImage,
120
+ FSIcon,
121
+ FSRow,
100
122
  },
101
123
  props: {
102
124
  tableCode: {
@@ -121,9 +143,33 @@ export default defineComponent({
121
143
  },
122
144
  emits: ["update:modelValue"],
123
145
  setup(props) {
124
-
125
146
  const { entities: chartOrganisations, fetching: fetchingChartOrganisations, getMany: getManyChartOrganisations } = useChartOrganisations();
126
147
 
148
+ const headersOptions = computed(() => ({
149
+ modelsLabels: {
150
+ fixedFilters: chartOrganisations.value.map(c => c.modelsLabels).reduce((acc, models) => {
151
+ for (const m of models) {
152
+ if (!acc.map((m) => m.id).includes(m.id)) {
153
+ acc.push(m);
154
+ }
155
+ }
156
+ return acc;
157
+ }, []).map((m) => ({
158
+ value: m.id,
159
+ text: m.label
160
+ })),
161
+ methodFilter: (value: string, items: ChartModelLabel[]) => items.some(ml => ml.id == value)
162
+ },
163
+ chartType: {
164
+ fixedFilters: getEnumEntries(ChartType).filter(f => f.value != ChartType.None).map(e => ({
165
+ value: e.value,
166
+ text: chartTypeLabel(e.value)
167
+ })),
168
+ methodFilter: (value: ChartType, item: ChartType) => value == item
169
+ }
170
+ }));
171
+
172
+
127
173
  const isSelected = (id: string): boolean => {
128
174
  return props.modelValue.includes(id);
129
175
  };
@@ -139,10 +185,13 @@ export default defineComponent({
139
185
  }, { immediate: true });
140
186
 
141
187
  return {
142
- ColorEnum,
143
188
  fetchingChartOrganisations,
144
189
  chartOrganisations,
145
- isSelected
190
+ headersOptions,
191
+ ColorEnum,
192
+ chartTypeLabel,
193
+ isSelected,
194
+ chartIcon
146
195
  };
147
196
  }
148
197
  });
@@ -2,6 +2,7 @@
2
2
  <FSDataTable
3
3
  defaultMode="iterator"
4
4
  :loading="fetchingChartOrganisationTypes || fetchingChartOrganisations"
5
+ :headersOptions="headersOptions"
5
6
  :items="charts"
6
7
  :tableCode="$props.tableCode"
7
8
  :modelValue="$props.modelValue"
@@ -50,6 +51,20 @@
50
51
  :tags="item.tags"
51
52
  />
52
53
  </template>
54
+ <template
55
+ #item.chartType="{ item }"
56
+ >
57
+ <FSRow
58
+ :wrap="false"
59
+ >
60
+ <FSIcon
61
+ :icon="chartIcon(item.chartType)"
62
+ />
63
+ <FSText>
64
+ {{ chartTypeLabel(item.chartType) }}
65
+ </FSText>
66
+ </FSRow>
67
+ </template>
53
68
  <template
54
69
  #item.modelsLabels="{ item }"
55
70
  >
@@ -78,16 +93,20 @@
78
93
  import { defineComponent, type PropType, watch, computed } from "vue";
79
94
  import _ from "lodash";
80
95
 
96
+ import { ChartType } from "@dative-gpi/foundation-shared-domain/enums";
97
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
81
98
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
99
+ import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
82
100
 
83
- import type { ChartOrganisationFilters, ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
84
-
101
+ import type { ChartModelLabel, ChartOrganisationFilters, ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
85
102
  import { useChartOrganisations, useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
86
103
 
87
104
  import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
88
105
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
89
106
  import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
90
107
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
108
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
109
+
91
110
  import FSDataTable from "../FSDataTable.vue";
92
111
 
93
112
  export default defineComponent({
@@ -97,7 +116,8 @@ export default defineComponent({
97
116
  FSDataTable,
98
117
  FSTagGroup,
99
118
  FSImage,
100
- FSIcon
119
+ FSIcon,
120
+ FSRow
101
121
  },
102
122
  props: {
103
123
  tableCode: {
@@ -123,7 +143,6 @@ export default defineComponent({
123
143
  },
124
144
  emits: ["update:modelValue", "update:scope"],
125
145
  setup(props, { emit }) {
126
-
127
146
  const { entities: chartOrganisations, fetching: fetchingChartOrganisations, getMany: getManyChartOrganisations } = useChartOrganisations();
128
147
  const { entities: chartOrganisationTypes, fetching: fetchingChartOrganisationTypes, getMany: getManyChartOrganisationTypes } = useChartOrganisationTypes();
129
148
 
@@ -137,60 +156,77 @@ export default defineComponent({
137
156
  }
138
157
 
139
158
  const charts = computed(() => {
140
- return chartOrganisations.value.map(c => {
141
- return {
142
- id: c.id,
143
- imageId: c.imageId,
144
- chartId: c.chartId,
145
- chartCategoryId: c.chartCategoryId,
146
- chartCategoryLabel: c.chartCategoryLabel,
147
- scope: c.scope,
148
- label: c.label,
149
- title: c.title,
150
- code: c.code,
151
- icon: c.icon,
152
- tags: c.tags,
153
- multiple: c.multiple,
154
- chartType: c.chartType,
155
- modelsLabels: c.modelsLabels
156
- }
157
- })
158
- .concat(chartOrganisationTypes.value.map(c => {
159
- return {
160
- id: c.id,
161
- imageId: c.imageId,
162
- chartId: c.chartId,
163
- chartCategoryId: c.chartCategoryId,
164
- chartCategoryLabel: c.chartCategoryLabel,
165
- scope: c.scope,
166
- label: c.label,
167
- title: c.title,
168
- code: c.code,
169
- icon: c.icon,
170
- tags: c.tags,
171
- multiple: c.multiple,
172
- chartType: c.chartType,
173
- modelsLabels: c.modelsLabels
159
+ return chartOrganisations.value.map(c => ({
160
+ id: c.id,
161
+ imageId: c.imageId,
162
+ chartId: c.chartId,
163
+ chartCategoryId: c.chartCategoryId,
164
+ chartCategoryLabel: c.chartCategoryLabel,
165
+ scope: c.scope,
166
+ label: c.label,
167
+ title: c.title,
168
+ code: c.code,
169
+ icon: c.icon,
170
+ tags: c.tags,
171
+ multiple: c.multiple,
172
+ chartType: c.chartType,
173
+ modelsLabels: c.modelsLabels
174
+ })).concat(chartOrganisationTypes.value.map(c => ({
175
+ id: c.id,
176
+ imageId: c.imageId,
177
+ chartId: c.chartId,
178
+ chartCategoryId: c.chartCategoryId,
179
+ chartCategoryLabel: c.chartCategoryLabel,
180
+ scope: c.scope,
181
+ label: c.label,
182
+ title: c.title,
183
+ code: c.code,
184
+ icon: c.icon,
185
+ tags: c.tags,
186
+ multiple: c.multiple,
187
+ chartType: c.chartType,
188
+ modelsLabels: c.modelsLabels
189
+ })));
190
+ });
191
+
192
+ const headersOptions = computed(() => ({
193
+ modelsLabels: {
194
+ fixedFilters: chartOrganisationTypes.value.map(c => c.modelsLabels).reduce((acc, models) => {
195
+ for(const m of models){
196
+ if(!acc.map((m) => m.id).includes(m.id)){
197
+ acc.push(m);
198
+ }
174
199
  }
175
- }))
176
- })
200
+ return acc;
201
+ }, []).map((m) => ({
202
+ value: m.id,
203
+ text: m.label
204
+ })),
205
+ methodFilter: (value: string, items: ChartModelLabel[]) => items.some(ml => ml.id == value)
206
+ },
207
+ chartType: {
208
+ fixedFilters: getEnumEntries(ChartType).filter(f => f.value != ChartType.None).map(e => ({
209
+ value: e.value,
210
+ text: chartTypeLabel(e.value)
211
+ })),
212
+ methodFilter: (value: ChartType, item: ChartType) => value == item
213
+ }
214
+ }));
177
215
 
178
- const update = (value : string) =>
179
- {
216
+ const update = (value : string) => {
180
217
  const item = isSelected(value);
181
-
182
- if(item){
183
- onSelect(props.modelValue.filter(m => m != value))
218
+ if (item) {
219
+ onSelect(props.modelValue.filter(m => m != value));
184
220
  }
185
- else{
186
- onSelect([...props.modelValue, value])
221
+ else {
222
+ onSelect([...props.modelValue, value]);
187
223
  }
188
224
  }
189
225
 
190
226
  const onSelect = (values: string[] | null) => {
191
227
  if(!values){
192
- emit("update:modelValue", [])
193
- emit("update:scope", [])
228
+ emit("update:modelValue", []);
229
+ emit("update:scope", []);
194
230
  return;
195
231
  }
196
232
  const selectedItems = charts.value.filter(i => values.includes(i.id));
@@ -209,9 +245,12 @@ export default defineComponent({
209
245
  fetchingChartOrganisations,
210
246
  chartOrganisationTypes,
211
247
  chartOrganisations,
248
+ headersOptions,
212
249
  ColorEnum,
213
250
  charts,
251
+ chartTypeLabel,
214
252
  isSelected,
253
+ chartIcon,
215
254
  onSelect,
216
255
  update
217
256
  };
@@ -21,20 +21,24 @@
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
- :removing="removing"
34
- :id="comment.id"
35
- @edit="updateComment"
36
- @remove="removeComment(comment.id)"
37
- />
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>
38
42
  </FSCol>
39
43
  </template>
40
44
 
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <FSDataTable
3
+ :loading="fetchingConnectivityScenarios"
4
+ :modelValue="$props.modelValue"
5
+ :items="connectivityScenarios"
6
+ :tableCode="$props.tableCode"
7
+ @update:modelValue="$emit('update:modelValue', $event)"
8
+ v-bind="$attrs"
9
+ >
10
+ <template
11
+ v-for="(_, name) in $slots"
12
+ v-slot:[name]="slotData"
13
+ >
14
+ <slot
15
+ :name="name"
16
+ v-bind="slotData"
17
+ />
18
+ </template>
19
+
20
+ <template
21
+ #item.time="{ item }"
22
+ >
23
+ {{ getTimeBestString(item.time) }}
24
+ </template>
25
+
26
+ <template
27
+ #item.deviceOrganisationImageId="{ item }"
28
+ >
29
+ <FSImage
30
+ v-if="item.deviceOrganisationImageId"
31
+ width="34px"
32
+ height="34px"
33
+ :imageId="item.deviceOrganisationImageId"
34
+ />
35
+ </template>
36
+ <template
37
+ #item.deviceOrganisationConnectivity="{ item }"
38
+ >
39
+ <FSIcon
40
+ v-if="item.deviceOrganisationConnectivity"
41
+ :icon="item.deviceOrganisationConnectivity.icon"
42
+ :color="item.deviceOrganisationConnectivity.color"
43
+ />
44
+ </template>
45
+ <template
46
+ #item.warnDeviceManager="{ item }"
47
+ >
48
+ <FSIconCheck
49
+ :value="item.warnDeviceManager"
50
+ />
51
+ </template>
52
+ <template
53
+ #item.warnOnReconnection="{ item }"
54
+ >
55
+ <FSIconCheck
56
+ :value="item.warnOnReconnection"
57
+ />
58
+ </template>
59
+ </FSDataTable>
60
+ </template>
61
+
62
+ <script lang="ts">
63
+ import { defineComponent, type PropType, watch } from "vue";
64
+ import _ from "lodash";
65
+
66
+ import { ConnectivityStatus } from "@dative-gpi/foundation-shared-domain/enums";
67
+ import {ColorEnum } from "@dative-gpi/foundation-shared-components/models";
68
+ import { getTimeBestString } from "@dative-gpi/foundation-shared-components/utils"
69
+
70
+ import type { ConnectivityScenarioFilters } from "@dative-gpi/foundation-core-domain/models";
71
+ import { useConnectivityScenarios } from "@dative-gpi/foundation-core-services/composables";
72
+
73
+ import FSDataTable from "../FSDataTable.vue";
74
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
75
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
76
+ import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
77
+
78
+ export default defineComponent({
79
+ name: "FSBaseConnectivityScenariosList",
80
+ components: {
81
+ FSDataTable,
82
+ FSIconCheck,
83
+ FSImage,
84
+ FSIcon
85
+ },
86
+ props: {
87
+ tableCode: {
88
+ type: String as PropType<string | null>,
89
+ required: false,
90
+ default: null
91
+ },
92
+ modelValue: {
93
+ type: Array as PropType<string[]>,
94
+ default: () => [],
95
+ required: false
96
+ },
97
+ connectivityScenarioFilters: {
98
+ type: Object as PropType<ConnectivityScenarioFilters>,
99
+ required: false,
100
+ default: null
101
+ }
102
+ },
103
+ emits: ["update:modelValue"],
104
+ setup(props) {
105
+ const { entities: connectivityScenarios, fetching: fetchingConnectivityScenarios, getMany: getManyConnectivityScenarios } = useConnectivityScenarios();
106
+
107
+ const fetch = () =>{
108
+ getManyConnectivityScenarios(props.connectivityScenarioFilters);
109
+ }
110
+
111
+ watch(() => [props.connectivityScenarioFilters], (next, previous) => {
112
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
113
+ fetch();
114
+ }
115
+ }, { immediate: true });
116
+
117
+
118
+ return {
119
+ fetchingConnectivityScenarios,
120
+ connectivityScenarios,
121
+ ConnectivityStatus,
122
+ ColorEnum,
123
+ getTimeBestString
124
+ };
125
+ }
126
+ });
127
+ </script>
@@ -278,7 +278,14 @@ export default defineComponent({
278
278
  value: ConnectivityStatus.Connected,
279
279
  text: connectivityLabel(ConnectivityStatus.Connected)
280
280
  }],
281
- methodFilter: (value: ConnectivityStatus, item: DeviceConnectivityDetails) => !item.status && !value || item.status == value,
281
+ methodFilter: (value: ConnectivityStatus, item: DeviceConnectivityDetails) => {
282
+ switch(value) {
283
+ case ConnectivityStatus.None:
284
+ return !item.status;
285
+ default:
286
+ return item.status == value;
287
+ }
288
+ },
282
289
  sort: (a: DeviceConnectivityDetails, b: DeviceConnectivityDetails) => alphanumericSort(a?.status, b?.status)
283
290
  },
284
291
  connectivity: {
@@ -298,7 +305,14 @@ export default defineComponent({
298
305
  value: ConnectivityStatus.Connected,
299
306
  text: connectivityLabel(ConnectivityStatus.Connected)
300
307
  }],
301
- methodFilter: (value: ConnectivityStatus, item: DeviceConnectivityDetails) => !item.status && !value || item.status == value,
308
+ methodFilter: (value: ConnectivityStatus, item: DeviceConnectivityDetails) => {
309
+ switch(value) {
310
+ case ConnectivityStatus.None:
311
+ return !item.status;
312
+ default:
313
+ return item.status == value;
314
+ }
315
+ },
302
316
  sort: (a: DeviceConnectivityDetails, b: DeviceConnectivityDetails) => alphanumericSort(a?.status, b?.status)
303
317
  },
304
318
  worstAlert: {
@@ -316,9 +330,9 @@ export default defineComponent({
316
330
  }))): undefined,
317
331
  methodFilterRaw: (value: any, item: DeviceOrganisationInfos) => {
318
332
  if (cp.useOnlyAllowedValues) {
319
- return (!Object.keys(cp.allowedValues).includes(item.meta[cp.code])) && !value || item.meta[cp.code] === value;
333
+ return (!Object.keys(cp.allowedValues).includes(item.meta[cp.code])) && !value || item.meta[cp.code] == value
320
334
  }
321
- return !item.meta[cp.code] && !value || item.meta[cp.code] === value;
335
+ return item.meta[cp.code] == value
322
336
  },
323
337
  sort: (a: string, b: string) => alphanumericSort(a, b)
324
338
  }
@@ -26,6 +26,23 @@
26
26
  {{ item.icon }}
27
27
  </FSIcon>
28
28
  </template>
29
+
30
+ <template
31
+ #item.criticity="{ item }"
32
+ >
33
+ <FSRow
34
+ align="center-left"
35
+ >
36
+ <FSIcon
37
+ :color="AlertTools.criticityColor(item.criticity)"
38
+ >
39
+ {{ AlertTools.criticityIcon(item.criticity) }}
40
+ </FSIcon>
41
+ <FSSpan>
42
+ {{ AlertTools.criticityLabel(item.criticity) }}
43
+ </FSSpan>
44
+ </FSRow>
45
+ </template>
29
46
 
30
47
  <template
31
48
  #item.imageId="{ item }"
@@ -51,10 +68,14 @@
51
68
  </template>
52
69
 
53
70
  <script lang="ts">
54
- import { defineComponent, type PropType, watch } from "vue";
71
+ import { computed, defineComponent, type PropType, watch } from "vue";
55
72
  import type { RouteLocation } from "vue-router";
56
73
  import _ from "lodash";
57
74
 
75
+ import { Criticity } from "@dative-gpi/foundation-shared-domain/enums";
76
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
77
+ import { AlertTools } from "@dative-gpi/foundation-shared-components/tools";
78
+
58
79
  import type { ScenarioOrganisationTypeFilters, ScenarioOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
59
80
  import { useScenarioOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
60
81
 
@@ -62,14 +83,16 @@ import FSDataTable from "../FSDataTable.vue";
62
83
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
63
84
  import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
64
85
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
86
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
65
87
 
66
88
  export default defineComponent({
67
89
  name: "FSBaseScenarioOrganisationTypesList",
68
90
  components: {
69
91
  FSDataTable,
70
- FSIcon,
92
+ FSTagGroup,
71
93
  FSImage,
72
- FSTagGroup
94
+ FSIcon,
95
+ FSRow,
73
96
  },
74
97
  props: {
75
98
  tableCode: {
@@ -101,6 +124,16 @@ export default defineComponent({
101
124
  setup(props) {
102
125
  const { entities: scenarioOrganisationTypes, fetching: fetchingScenarioOrganisationTypes, getMany: getManyScenarioOrganisationTypes } = useScenarioOrganisationTypes();
103
126
 
127
+ const headersOptions = computed(() => ({
128
+ criticity: {
129
+ fixedFilters: getEnumEntries(Criticity).filter(f => f.value != Criticity.None).map(e => ({
130
+ value: e.value,
131
+ text: AlertTools.criticityLabel(e.value)
132
+ })),
133
+ methodFilter: (value: Criticity, item: Criticity) => value == item
134
+ }
135
+ }));
136
+
104
137
  const isSelected = (id: string): boolean => {
105
138
  return props.modelValue.includes(id);
106
139
  };
@@ -114,6 +147,8 @@ export default defineComponent({
114
147
  return {
115
148
  fetchingScenarioOrganisationTypes,
116
149
  scenarioOrganisationTypes,
150
+ headersOptions,
151
+ AlertTools,
117
152
  isSelected
118
153
  };
119
154
  }
@@ -6,6 +6,7 @@
6
6
  :showSelect="$props.editable"
7
7
  :tableCode="$props.tableCode"
8
8
  :modelValue="$props.modelValue"
9
+ :headersOptions="headersOptions"
9
10
  @update:modelValue="$emit('update:modelValue', $event)"
10
11
  v-bind="$attrs"
11
12
  >
@@ -27,6 +28,23 @@
27
28
  </FSIcon>
28
29
  </template>
29
30
 
31
+ <template
32
+ #item.criticity="{ item }"
33
+ >
34
+ <FSRow
35
+ align="center-left"
36
+ >
37
+ <FSIcon
38
+ :color="AlertTools.criticityColor(item.criticity)"
39
+ >
40
+ {{ AlertTools.criticityIcon(item.criticity) }}
41
+ </FSIcon>
42
+ <FSSpan>
43
+ {{ AlertTools.criticityLabel(item.criticity) }}
44
+ </FSSpan>
45
+ </FSRow>
46
+ </template>
47
+
30
48
  <template
31
49
  #item.tags="{ item }"
32
50
  >
@@ -40,23 +58,29 @@
40
58
  </template>
41
59
 
42
60
  <script lang="ts">
43
- import { defineComponent, type PropType, watch } from "vue";
61
+ import { computed, defineComponent, type PropType, watch } from "vue";
44
62
  import type { RouteLocation } from "vue-router";
45
63
  import _ from "lodash";
46
64
 
65
+ import { Criticity } from "@dative-gpi/foundation-shared-domain/enums";
66
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
67
+ import { AlertTools } from "@dative-gpi/foundation-shared-components/tools";
68
+
47
69
  import type { ScenarioOrganisationFilters, ScenarioOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
48
70
  import { useScenarioOrganisations } from "@dative-gpi/foundation-core-services/composables";
49
71
 
50
72
  import FSDataTable from "../FSDataTable.vue";
51
73
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
52
74
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
75
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
53
76
 
54
77
  export default defineComponent({
55
78
  name: "FSBaseScenarioOrganisationsList",
56
79
  components: {
57
80
  FSDataTable,
81
+ FSTagGroup,
58
82
  FSIcon,
59
- FSTagGroup
83
+ FSRow
60
84
  },
61
85
  props: {
62
86
  tableCode: {
@@ -88,6 +112,17 @@ export default defineComponent({
88
112
  setup(props) {
89
113
  const { entities: scenarioOrganisations, fetching: fetchingScenarioOrganisations, getMany: getManyScenarioOrganisations } = useScenarioOrganisations();
90
114
 
115
+
116
+ const headersOptions = computed(() => ({
117
+ criticity: {
118
+ fixedFilters: getEnumEntries(Criticity).filter(f => f.value != Criticity.None).map(e => ({
119
+ value: e.value,
120
+ text: AlertTools.criticityLabel(e.value)
121
+ })),
122
+ methodFilter: (value: Criticity, item: Criticity) => value == item
123
+ }
124
+ }));
125
+
91
126
  const isSelected = (id: string): boolean => {
92
127
  return props.modelValue.includes(id);
93
128
  };
@@ -101,6 +136,8 @@ export default defineComponent({
101
136
  return {
102
137
  fetchingScenarioOrganisations,
103
138
  scenarioOrganisations,
139
+ headersOptions,
140
+ AlertTools,
104
141
  isSelected
105
142
  };
106
143
  }
@@ -1,11 +1,12 @@
1
1
  <template>
2
2
  <FSDataTable
3
3
  :loading="fetchingScenarioOrganisationTypes || fetchingScenarioOrganisations"
4
- :headers="headers"
4
+ :headersOptions="headersOptions"
5
+ :extraHeaders="headerAssociation"
5
6
  :items="scenarios"
6
- :showSelect="$props.editable"
7
- :tableCode="$props.tableCode"
7
+ :itemTo="routerLink"
8
8
  :modelValue="$props.modelValue"
9
+ :tableCode="$props.tableCode"
9
10
  @update:modelValue="$emit('update:modelValue', $event)"
10
11
  v-bind="$attrs"
11
12
  >
@@ -27,6 +28,23 @@
27
28
  </FSIcon>
28
29
  </template>
29
30
 
31
+ <template
32
+ #item.criticity="{ item }"
33
+ >
34
+ <FSRow
35
+ align="center-left"
36
+ >
37
+ <FSIcon
38
+ :color="AlertTools.criticityColor(item.criticity)"
39
+ >
40
+ {{ AlertTools.criticityIcon(item.criticity) }}
41
+ </FSIcon>
42
+ <FSSpan>
43
+ {{ AlertTools.criticityLabel(item.criticity) }}
44
+ </FSSpan>
45
+ </FSRow>
46
+ </template>
47
+
30
48
  <template
31
49
  #item.tags="{ item }"
32
50
  >
@@ -45,22 +63,26 @@ import _ from "lodash";
45
63
 
46
64
  import { useTranslations } from "@dative-gpi/bones-ui";
47
65
 
66
+ import { Criticity, ApplicationScope } from "@dative-gpi/foundation-shared-domain/enums";
67
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
48
68
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
69
+ import { AlertTools } from "@dative-gpi/foundation-shared-components/tools"
49
70
 
50
71
  import type { ScenarioOrganisationFilters, ScenarioOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
51
-
52
- import { useScenarioOrganisations, useScenarioOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
72
+ import { useScenarioOrganisations, useScenarioOrganisationTypes, useRouteOrganisation } from "@dative-gpi/foundation-core-services/composables";
53
73
 
54
74
  import FSDataTable from "../FSDataTable.vue";
55
- import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
56
75
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
76
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
77
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
57
78
 
58
79
  export default defineComponent({
59
80
  name: "FSBaseScenariosList",
60
- components: {
81
+ components:{
61
82
  FSDataTable,
83
+ FSTagGroup,
62
84
  FSIcon,
63
- FSTagGroup
85
+ FSRow
64
86
  },
65
87
  props: {
66
88
  tableCode: {
@@ -68,6 +90,11 @@ export default defineComponent({
68
90
  required: false,
69
91
  default: null
70
92
  },
93
+ modelValue: {
94
+ type: Array as PropType<string[]>,
95
+ default: () => [],
96
+ required: false
97
+ },
71
98
  scenarioOrganisationFilters: {
72
99
  type: Object as PropType<ScenarioOrganisationFilters>,
73
100
  required: false,
@@ -78,79 +105,60 @@ export default defineComponent({
78
105
  required: false,
79
106
  default: null
80
107
  },
81
- editable: {
108
+ showAssociation: {
82
109
  type: Boolean,
83
110
  required: false,
84
111
  default: true
85
112
  },
86
- modelValue: {
87
- type: Array as PropType<string[]>,
88
- default: () => [],
89
- required: false
113
+ scope: {
114
+ type: Number as PropType<ApplicationScope>,
115
+ required: false,
116
+ default: ApplicationScope.None
90
117
  }
91
118
  },
92
119
  emits: ["update:modelValue"],
93
- setup(props, { emit }) {
120
+ setup(props) {
94
121
  const { $tr } = useTranslations();
95
122
  const { entities: scenarioOrganisations, fetching: fetchingScenarioOrganisations, getMany: getManyScenarioOrganisations } = useScenarioOrganisations();
96
123
  const { entities: scenarioOrganisationTypes, fetching: fetchingScenarioOrganisationTypes, getMany: getManyScenarioOrganisationTypes } = useScenarioOrganisationTypes();
97
124
 
98
- const isSelected = (value : string): boolean => {
99
- return props.modelValue.includes(value);
100
- };
125
+ const { $r } = useRouteOrganisation();
101
126
 
102
- const headers = computed(() => {
103
- return [
104
- {
105
- text: $tr("entity.scenario.icon", "Icon"),
106
- value: "icon",
127
+ const headerAssociation = computed(() => {
128
+ if(props.showAssociation){
129
+ return [{
130
+ columnId: "association",
131
+ text: $tr("ui.common.association", ""),
132
+ value: "association",
107
133
  sortable: false,
108
- },
109
- {
110
- text: $tr("entity.scenario.label", "Label"),
111
- value: "label",
112
- sortable: true
113
- },
114
- {
115
- text: $tr("entity.scenario.model-label", "Model label"),
116
- value: "modelLabel",
117
- sortable: true
118
- },
119
- {
120
- text: $tr("entity.scenario.data-category-label", "Data category label"),
121
- value: "dataCategoryLabel",
122
- sortable: true
123
- },
124
- {
125
- text: $tr("ui.common.action", ""),
126
- value: "action",
127
- sortable: false
128
- }
129
- ];
134
+ filterable: false,
135
+ index: -1,
136
+ hidden: false
137
+ }];
138
+ }
130
139
  });
131
140
 
141
+ const headersOptions = computed(() => ({
142
+ criticity: {
143
+ fixedFilters: getEnumEntries(Criticity).filter(f => f.value != Criticity.None).map(e => ({
144
+ value: e.value,
145
+ text: AlertTools.criticityLabel(e.value)
146
+ })),
147
+ methodFilter: (value: Criticity, item: Criticity) => value == item
148
+ }
149
+ }));
132
150
 
133
151
  const scenarios = computed(() => {
134
- return scenarioOrganisations.value.map(c => {
135
- return {
136
- id: `${c.id}_${c.scope}`,
137
- modelId: c.modelId,
138
- dataCategoryId : c.dataCategoryId,
139
- dataCategoryLabel: c.dataCategoryLabel,
140
- scenarioId: c.scenarioId,
141
- scope: c.scope,
142
- label: c.label,
143
- modelLabel: c.modelLabel,
144
- code: c.code,
145
- icon: c.icon,
146
- tags: c.tags,
147
- criticity: c.criticity,
148
- parameters: c.parameters
149
- }
150
- })
151
- .concat(scenarioOrganisationTypes.value.map(c => {
152
+ if(props.scope == ApplicationScope.Organisation){
153
+ return scenarioOrganisations.value
154
+ }
155
+ else if(props.scope == ApplicationScope.OrganisationType){
156
+ return scenarioOrganisationTypes.value
157
+ }
158
+ else{
159
+ return scenarioOrganisations.value.map(c => {
152
160
  return {
153
- id: `${c.id}_${c.scope}`,
161
+ id: c.id,
154
162
  modelId: c.modelId,
155
163
  dataCategoryId : c.dataCategoryId,
156
164
  dataCategoryLabel: c.dataCategoryLabel,
@@ -164,43 +172,69 @@ export default defineComponent({
164
172
  criticity: c.criticity,
165
173
  parameters: c.parameters
166
174
  }
167
- }))
168
- })
169
-
170
- const fetch = () =>{
171
- getManyScenarioOrganisations(props.scenarioOrganisationFilters);
172
- getManyScenarioOrganisationTypes(props.scenarioOrganisationTypeFilters)
173
- }
175
+ })
176
+ .concat(scenarioOrganisationTypes.value.map(c => {
177
+ return {
178
+ id: c.id,
179
+ modelId: c.modelId,
180
+ dataCategoryId : c.dataCategoryId,
181
+ dataCategoryLabel: c.dataCategoryLabel,
182
+ scenarioId: c.scenarioId,
183
+ scope: c.scope,
184
+ label: c.label,
185
+ modelLabel: c.modelLabel,
186
+ code: c.code,
187
+ icon: c.icon,
188
+ tags: c.tags,
189
+ criticity: c.criticity,
190
+ parameters: c.parameters
191
+ }
192
+ }));
193
+ }
194
+ });
174
195
 
175
- const update = (value : string) =>
176
- {
177
- const item = isSelected(value);
196
+ const routerLink = (item: any) => {
197
+ if(item.scope == ApplicationScope.OrganisationType){
198
+ return $r({ name: "scenario-organisation-type", params: { entityId: item.id } });
199
+ }
200
+ else
201
+ {
202
+ return $r({ name: "scenario-organisation", params: { entityId: item.id } });
203
+ }
204
+ };
178
205
 
179
- if(item){
180
- emit("update:modelValue", props.modelValue.filter(m => m != value))
206
+ const fetch = () =>{
207
+ if(props.scope == ApplicationScope.OrganisationType){
208
+ getManyScenarioOrganisationTypes(props.scenarioOrganisationTypeFilters)
209
+ }
210
+ else if(props.scope == ApplicationScope.Organisation){
211
+ getManyScenarioOrganisations(props.scenarioOrganisationFilters);
181
212
  }
182
213
  else{
183
- emit("update:modelValue", [...props.modelValue, value])
214
+ getManyScenarioOrganisations(props.scenarioOrganisationFilters);
215
+ getManyScenarioOrganisationTypes(props.scenarioOrganisationTypeFilters)
184
216
  }
185
217
  }
186
-
187
- watch(() => [props.scenarioOrganisationFilters,props.scenarioOrganisationTypeFilters], (next, previous) => {
218
+
219
+ watch(() => [props.scenarioOrganisationFilters,props.scenarioOrganisationTypeFilters, props.scope], (next, previous) => {
188
220
  if ((!next && !previous) || !_.isEqual(next, previous)) {
189
221
  fetch();
190
222
  }
191
223
  }, { immediate: true });
192
-
224
+
193
225
 
194
226
  return {
195
227
  fetchingScenarioOrganisationTypes,
196
228
  fetchingScenarioOrganisations,
197
229
  scenarioOrganisationTypes,
198
230
  scenarioOrganisations,
231
+ headerAssociation,
232
+ ApplicationScope,
233
+ headersOptions,
234
+ AlertTools,
199
235
  ColorEnum,
200
236
  scenarios,
201
- headers,
202
- isSelected,
203
- update
237
+ routerLink
204
238
  };
205
239
  }
206
240
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-core-components",
3
3
  "sideEffects": false,
4
- "version": "1.0.91",
4
+ "version": "1.0.93",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,11 +10,11 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-core-domain": "1.0.91",
14
- "@dative-gpi/foundation-core-services": "1.0.91",
15
- "@dative-gpi/foundation-shared-components": "1.0.91",
16
- "@dative-gpi/foundation-shared-domain": "1.0.91",
17
- "@dative-gpi/foundation-shared-services": "1.0.91"
13
+ "@dative-gpi/foundation-core-domain": "1.0.93",
14
+ "@dative-gpi/foundation-core-services": "1.0.93",
15
+ "@dative-gpi/foundation-shared-components": "1.0.93",
16
+ "@dative-gpi/foundation-shared-domain": "1.0.93",
17
+ "@dative-gpi/foundation-shared-services": "1.0.93"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@dative-gpi/bones-ui": "^1.0.0",
@@ -26,5 +26,5 @@
26
26
  "sass": "1.71.1",
27
27
  "sass-loader": "13.3.2"
28
28
  },
29
- "gitHead": "996da7085e717a1b1c0a9e58d6d3cc40b4aadb2b"
29
+ "gitHead": "f072cdd74cbe86d8843a4f3fce3791e865e70f18"
30
30
  }