@dative-gpi/foundation-core-components 1.0.50 → 1.0.52
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.
- package/components/lists/alerts/FSBaseAlertsList.vue +342 -0
- package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +101 -0
- package/components/lists/authTokens/FSBaseAuthTokensList.vue +3 -1
- package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +156 -0
- package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +157 -0
- package/components/lists/charts/FSBaseChartsList.vue +204 -0
- package/components/lists/comments/FSBaseCommentsList.vue +127 -0
- package/components/lists/dashboards/FSBaseDashboardsList.vue +1 -6
- package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +154 -0
- package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +128 -0
- package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +1 -0
- package/components/lists/folders/FSBaseFoldersList.vue +1 -6
- package/components/lists/models/FSBaseModelsList.vue +126 -0
- package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +121 -0
- package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +121 -0
- package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +114 -0
- package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +101 -0
- package/components/lists/scenarios/FSBaseScenariosList.vue +200 -0
- package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +142 -0
- package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +3 -1
- package/package.json +7 -7
- package/utils/users.ts +3 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSDataTable
|
|
3
|
+
rowGap="6px"
|
|
4
|
+
:rowColor="criticityColor"
|
|
5
|
+
:itemTo="routerLink"
|
|
6
|
+
:items="alertsOrdered"
|
|
7
|
+
:loading="fetchingAlerts"
|
|
8
|
+
:tableCode="$props.tableCode"
|
|
9
|
+
:modelValue="$props.modelValue"
|
|
10
|
+
@update:modelValue="$emit('update:modelValue', $event)"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
>
|
|
13
|
+
<template
|
|
14
|
+
#toolbar
|
|
15
|
+
>
|
|
16
|
+
<FSButtonCheckbox
|
|
17
|
+
:label="$tr('page.alerts.not-acknowledged-only', 'Not acknowledged only')"
|
|
18
|
+
:color="ColorEnum.Warning"
|
|
19
|
+
v-model="innerNotTreatedOnly"
|
|
20
|
+
/>
|
|
21
|
+
<FSButtonCheckbox
|
|
22
|
+
:label="$tr('page.alerts.hide-pending', 'Hide pending')"
|
|
23
|
+
:color="ColorEnum.Light"
|
|
24
|
+
variant="full"
|
|
25
|
+
v-model="innerHidePending"
|
|
26
|
+
/>
|
|
27
|
+
<FSTermField
|
|
28
|
+
variant="default"
|
|
29
|
+
:editable="!innerNotTreatedOnly"
|
|
30
|
+
v-model:startDate="startDate"
|
|
31
|
+
v-model:endDate="endDate"
|
|
32
|
+
/>
|
|
33
|
+
</template>
|
|
34
|
+
<template
|
|
35
|
+
#item.criticity="{ item }"
|
|
36
|
+
>
|
|
37
|
+
<FSRow
|
|
38
|
+
align="center-left"
|
|
39
|
+
gap="2px"
|
|
40
|
+
>
|
|
41
|
+
<FSIcon
|
|
42
|
+
:color="AlertTools.criticityColor(item.criticity)"
|
|
43
|
+
>
|
|
44
|
+
{{ AlertTools.criticityIcon(item.criticity) }}
|
|
45
|
+
</FSIcon>
|
|
46
|
+
<FSSpan>
|
|
47
|
+
{{ AlertTools.criticityLabel(item.criticity) }}
|
|
48
|
+
</FSSpan>
|
|
49
|
+
</FSRow>
|
|
50
|
+
</template>
|
|
51
|
+
<template
|
|
52
|
+
#item.icon="{ item }"
|
|
53
|
+
>
|
|
54
|
+
<FSIcon>
|
|
55
|
+
{{ item.icon }}
|
|
56
|
+
</FSIcon>
|
|
57
|
+
</template>
|
|
58
|
+
<template
|
|
59
|
+
#item.tags="{ item }"
|
|
60
|
+
>
|
|
61
|
+
<FSTagGroup
|
|
62
|
+
variant="slide"
|
|
63
|
+
:editable="false"
|
|
64
|
+
:tags="item.tags"
|
|
65
|
+
/>
|
|
66
|
+
</template>
|
|
67
|
+
<template
|
|
68
|
+
#item.groupByValues="{ item }"
|
|
69
|
+
>
|
|
70
|
+
<FSTagGroup
|
|
71
|
+
variant="slide"
|
|
72
|
+
:tags="item.groupByValues.map((gbv: any) => `${gbv.label}: ${gbv.value}`)"
|
|
73
|
+
:editable="false"
|
|
74
|
+
/>
|
|
75
|
+
</template>
|
|
76
|
+
<template
|
|
77
|
+
#item.deviceOrganisationImageId="{ item }"
|
|
78
|
+
>
|
|
79
|
+
<FSImage
|
|
80
|
+
v-if="item.deviceOrganisationImageId != null"
|
|
81
|
+
width="32px"
|
|
82
|
+
height="32px"
|
|
83
|
+
:imageId="item.deviceOrganisationImageId"
|
|
84
|
+
/>
|
|
85
|
+
</template>
|
|
86
|
+
<template
|
|
87
|
+
#item.acknowledged="{ item }"
|
|
88
|
+
>
|
|
89
|
+
<FSSpan
|
|
90
|
+
v-if="item.acknowledged"
|
|
91
|
+
font="text-overline"
|
|
92
|
+
>
|
|
93
|
+
{{ $tr('entity.alert.acknowledged', 'Acknowledged') }}
|
|
94
|
+
</FSSpan>
|
|
95
|
+
<FSButtonAcknowledgeAlert
|
|
96
|
+
v-else-if="!item.acknowledged && $props.allowAcknowledge"
|
|
97
|
+
:alertId="item.id"
|
|
98
|
+
/>
|
|
99
|
+
<FSSpan
|
|
100
|
+
v-else
|
|
101
|
+
font="text-overline"
|
|
102
|
+
>
|
|
103
|
+
{{ $tr('entity.alert.not-acknowledged', 'Not acknowledged') }}
|
|
104
|
+
</FSSpan>
|
|
105
|
+
</template>
|
|
106
|
+
<template
|
|
107
|
+
#item.acknowledgingUserImageId="{ item }"
|
|
108
|
+
>
|
|
109
|
+
<FSImage
|
|
110
|
+
v-if="item.acknowledged && item.acknowledgingUserImageId != null"
|
|
111
|
+
width="32px"
|
|
112
|
+
height="32px"
|
|
113
|
+
:imageId="item.acknowledgingUserImageId"
|
|
114
|
+
/>
|
|
115
|
+
</template>
|
|
116
|
+
<template
|
|
117
|
+
#item.acknowledgingTimestamp="{ item }"
|
|
118
|
+
>
|
|
119
|
+
<FSSpan
|
|
120
|
+
font="text-overline"
|
|
121
|
+
>
|
|
122
|
+
{{ epochToShortTimeFormat(item.acknowledgingTimestamp) }}
|
|
123
|
+
</FSSpan>
|
|
124
|
+
</template>
|
|
125
|
+
<template
|
|
126
|
+
#item.history="{ item }"
|
|
127
|
+
>
|
|
128
|
+
<FSTagGroup
|
|
129
|
+
variant="slide"
|
|
130
|
+
:tags="item.history.map((h: any) => AlertTools.statusLabel(h.status))"
|
|
131
|
+
:editable="false"
|
|
132
|
+
/>
|
|
133
|
+
</template>
|
|
134
|
+
<template
|
|
135
|
+
#item.initialState="{ item }"
|
|
136
|
+
>
|
|
137
|
+
<FSSpan
|
|
138
|
+
font="text-overline"
|
|
139
|
+
>
|
|
140
|
+
{{ AlertTools.statusLabel(item.initialState.status) }}
|
|
141
|
+
</FSSpan>
|
|
142
|
+
</template>
|
|
143
|
+
<template
|
|
144
|
+
#item.triggerSourceTimestamp="{ item }"
|
|
145
|
+
>
|
|
146
|
+
<FSSpan
|
|
147
|
+
font="text-overline"
|
|
148
|
+
>
|
|
149
|
+
{{ epochToShortTimeFormat(item.triggerSourceTimestamp) }}
|
|
150
|
+
</FSSpan>
|
|
151
|
+
</template>
|
|
152
|
+
<template
|
|
153
|
+
#item.triggerEnqueuedTimestamp="{ item }"
|
|
154
|
+
>
|
|
155
|
+
<FSSpan
|
|
156
|
+
font="text-overline"
|
|
157
|
+
>
|
|
158
|
+
{{ epochToShortTimeFormat(item.triggerEnqueuedTimestamp) }}
|
|
159
|
+
</FSSpan>
|
|
160
|
+
</template>
|
|
161
|
+
<template
|
|
162
|
+
#item.triggerProcessedTimestamp="{ item }"
|
|
163
|
+
>
|
|
164
|
+
<FSSpan
|
|
165
|
+
font="text-overline"
|
|
166
|
+
>
|
|
167
|
+
{{ epochToShortTimeFormat(item.triggerProcessedTimestamp) }}
|
|
168
|
+
</FSSpan>
|
|
169
|
+
</template>
|
|
170
|
+
<template
|
|
171
|
+
#item.lastState="{ item }"
|
|
172
|
+
>
|
|
173
|
+
<FSSpan
|
|
174
|
+
font="text-overline"
|
|
175
|
+
>
|
|
176
|
+
{{ AlertTools.statusLabel(item.lastState.status) }}
|
|
177
|
+
</FSSpan>
|
|
178
|
+
</template>
|
|
179
|
+
<template
|
|
180
|
+
#item.currentSourceTimestamp="{ item }"
|
|
181
|
+
>
|
|
182
|
+
<FSSpan
|
|
183
|
+
font="text-overline"
|
|
184
|
+
>
|
|
185
|
+
{{ epochToShortTimeFormat(item.currentSourceTimestamp) }}
|
|
186
|
+
</FSSpan>
|
|
187
|
+
</template>
|
|
188
|
+
<template
|
|
189
|
+
#item.currentEnqueuedTimestamp="{ item }"
|
|
190
|
+
>
|
|
191
|
+
<FSSpan
|
|
192
|
+
font="text-overline"
|
|
193
|
+
>
|
|
194
|
+
{{ epochToShortTimeFormat(item.currentEnqueuedTimestamp) }}
|
|
195
|
+
</FSSpan>
|
|
196
|
+
</template>
|
|
197
|
+
<template
|
|
198
|
+
#item.currentProcessedTimestamp="{ item }"
|
|
199
|
+
>
|
|
200
|
+
<FSSpan
|
|
201
|
+
font="text-overline"
|
|
202
|
+
>
|
|
203
|
+
{{ epochToShortTimeFormat(item.currentProcessedTimestamp) }}
|
|
204
|
+
</FSSpan>
|
|
205
|
+
</template>
|
|
206
|
+
</FSDataTable>
|
|
207
|
+
</template>
|
|
208
|
+
|
|
209
|
+
<script lang="ts">
|
|
210
|
+
import type { PropType} from "vue";
|
|
211
|
+
import { computed, defineComponent, ref, watch } from "vue";
|
|
212
|
+
import _ from "lodash";
|
|
213
|
+
|
|
214
|
+
import { useRouter } from "vue-router";
|
|
215
|
+
|
|
216
|
+
import type { AlertFilters, AlertInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
217
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
218
|
+
import { useAlerts } from "@dative-gpi/foundation-core-services/composables";
|
|
219
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
220
|
+
import { AlertStatus } from "@dative-gpi/foundation-shared-domain/enums";
|
|
221
|
+
|
|
222
|
+
import { AlertTools } from "@dative-gpi/foundation-shared-components/tools";
|
|
223
|
+
|
|
224
|
+
import FSDataTable from "../FSDataTable.vue";
|
|
225
|
+
import FSButtonAcknowledgeAlert from "./FSButtonAcknowledgeAlert.vue";
|
|
226
|
+
import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
|
|
227
|
+
import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
|
|
228
|
+
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
229
|
+
import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
|
|
230
|
+
import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
|
|
231
|
+
import FSTermField from "@dative-gpi/foundation-shared-components/components/fields/FSTermField.vue";
|
|
232
|
+
import FSButtonCheckbox from "@dative-gpi/foundation-shared-components/components/buttons/FSButtonCheckbox.vue";
|
|
233
|
+
|
|
234
|
+
export default defineComponent({
|
|
235
|
+
name: "FSBaseAlertsList",
|
|
236
|
+
components: {
|
|
237
|
+
FSButtonAcknowledgeAlert,
|
|
238
|
+
FSButtonCheckbox,
|
|
239
|
+
FSDataTable,
|
|
240
|
+
FSIcon,
|
|
241
|
+
FSImage,
|
|
242
|
+
FSRow,
|
|
243
|
+
FSSpan,
|
|
244
|
+
FSTagGroup,
|
|
245
|
+
FSTermField,
|
|
246
|
+
},
|
|
247
|
+
props: {
|
|
248
|
+
alertFilters: {
|
|
249
|
+
type: Object as PropType<AlertFilters>,
|
|
250
|
+
required: false,
|
|
251
|
+
default: null
|
|
252
|
+
},
|
|
253
|
+
notAcknowledged:{
|
|
254
|
+
type: Boolean,
|
|
255
|
+
required: false,
|
|
256
|
+
},
|
|
257
|
+
hidePending:{
|
|
258
|
+
type: Boolean,
|
|
259
|
+
required: false,
|
|
260
|
+
},
|
|
261
|
+
modelValue: {
|
|
262
|
+
type: Array as PropType<string[]>,
|
|
263
|
+
required: false,
|
|
264
|
+
default: () => []
|
|
265
|
+
},
|
|
266
|
+
allowAcknowledge: {
|
|
267
|
+
type: Boolean,
|
|
268
|
+
required: false,
|
|
269
|
+
default: false
|
|
270
|
+
},
|
|
271
|
+
tableCode: {
|
|
272
|
+
type: String,
|
|
273
|
+
required: true
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
emits: ["update:modelValue"],
|
|
277
|
+
setup(props) {
|
|
278
|
+
const { getMany: getManyAlerts, entities: alerts, fetching : fetchingAlerts } = useAlerts();
|
|
279
|
+
const { epochToShortTimeFormat } = useDateFormat();
|
|
280
|
+
const router = useRouter();
|
|
281
|
+
|
|
282
|
+
const innerNotTreatedOnly = ref<boolean | undefined>(props.notAcknowledged);
|
|
283
|
+
const innerHidePending = ref<boolean | undefined>(props.hidePending);
|
|
284
|
+
const startDate = ref<string>("now - 1w");
|
|
285
|
+
const endDate = ref<string>("now");
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
const criticityColor = (row: any) => {
|
|
289
|
+
return AlertTools.criticityColor(row.criticity);
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
const routerLink = (item: any) => {
|
|
293
|
+
router.push({ name: "alert", params: { entityId: item.id } });
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
const alertsOrdered = computed(() => {
|
|
297
|
+
const als = [...alerts.value]
|
|
298
|
+
return als.sort((a: AlertInfos, b: AlertInfos) => {
|
|
299
|
+
return (a.acknowledged === b.acknowledged) ?
|
|
300
|
+
+b.currentSourceTimestamp! - +a.currentSourceTimestamp! : a.acknowledged ? 1 : -1
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
watch(() => [props.alertFilters, innerNotTreatedOnly.value,startDate.value, endDate.value,innerHidePending.value], (next, previous) => {
|
|
305
|
+
if (!_.isEqual(next, previous)) {
|
|
306
|
+
if(innerNotTreatedOnly.value){
|
|
307
|
+
getManyAlerts({
|
|
308
|
+
...props.alertFilters,
|
|
309
|
+
acknowledged: false,
|
|
310
|
+
statuses: [AlertStatus.Unresolved, AlertStatus.Triggered],
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
else{
|
|
314
|
+
getManyAlerts({
|
|
315
|
+
...props.alertFilters,
|
|
316
|
+
statuses: innerHidePending.value ?
|
|
317
|
+
[AlertStatus.Unresolved, AlertStatus.Resolved, AlertStatus.Triggered] : undefined,
|
|
318
|
+
startDate: startDate.value,
|
|
319
|
+
endDate: endDate.value
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
}
|
|
324
|
+
}, { immediate: true });
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
return {
|
|
328
|
+
innerNotTreatedOnly,
|
|
329
|
+
AlertTools,
|
|
330
|
+
ColorEnum,
|
|
331
|
+
alertsOrdered,
|
|
332
|
+
fetchingAlerts,
|
|
333
|
+
startDate,
|
|
334
|
+
endDate,
|
|
335
|
+
innerHidePending,
|
|
336
|
+
epochToShortTimeFormat,
|
|
337
|
+
criticityColor,
|
|
338
|
+
routerLink
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
</script>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
prependIcon="mdi-checkbox-blank-outline"
|
|
4
|
+
:label="$tr('page.alert.acknowledge', 'Acknowledge')"
|
|
5
|
+
@click="dialog = true"
|
|
6
|
+
/>
|
|
7
|
+
<FSDialogSubmit
|
|
8
|
+
:title="$tr('page.alert.acknowledge', 'Acknowledge')"
|
|
9
|
+
:load="acknowledgingAlert"
|
|
10
|
+
@click:submitButton="onAcknowledge"
|
|
11
|
+
v-model="dialog"
|
|
12
|
+
>
|
|
13
|
+
<template
|
|
14
|
+
#body
|
|
15
|
+
>
|
|
16
|
+
<FSCol
|
|
17
|
+
gap="16px"
|
|
18
|
+
>
|
|
19
|
+
<FSRow>
|
|
20
|
+
<FSIcon
|
|
21
|
+
:color="ColorEnum.Warning"
|
|
22
|
+
>
|
|
23
|
+
mdi-alert-outline
|
|
24
|
+
</FSIcon>
|
|
25
|
+
<FSRow
|
|
26
|
+
gap="2px"
|
|
27
|
+
>
|
|
28
|
+
<FSSpan>
|
|
29
|
+
{{ $tr("page.alert.acknowledge-warning", "Do you want to acknowledge this alert?") }}
|
|
30
|
+
</FSSpan>
|
|
31
|
+
</FSRow>
|
|
32
|
+
</FSRow>
|
|
33
|
+
<FSSpan>
|
|
34
|
+
{{ $tr("page.alert.acknowledge-final-warning", "This action is definitive") }}
|
|
35
|
+
</FSSpan>
|
|
36
|
+
<FSErrorToast
|
|
37
|
+
v-if="error"
|
|
38
|
+
:errorCode="error"
|
|
39
|
+
/>
|
|
40
|
+
</FSCol>
|
|
41
|
+
</template>
|
|
42
|
+
</FSDialogSubmit>
|
|
43
|
+
</template>
|
|
44
|
+
|
|
45
|
+
<script lang="ts">
|
|
46
|
+
import { defineComponent, ref } from "vue";
|
|
47
|
+
|
|
48
|
+
import { useAcknowledgeAlert } from "@dative-gpi/foundation-core-services/composables";
|
|
49
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
50
|
+
import FSCol from "@dative-gpi/foundation-shared-components/components/FSCol.vue";
|
|
51
|
+
import FSDialogSubmit from "@dative-gpi/foundation-shared-components/components/FSDialogSubmit.vue";
|
|
52
|
+
import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
|
|
53
|
+
import FSErrorToast from "@dative-gpi/foundation-shared-components/components/FSErrorToast.vue";
|
|
54
|
+
import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
|
|
55
|
+
import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
|
|
56
|
+
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
57
|
+
|
|
58
|
+
export default defineComponent({
|
|
59
|
+
name: "FSButtonAcknowledgeAlert",
|
|
60
|
+
components: {
|
|
61
|
+
FSButton,
|
|
62
|
+
FSCol,
|
|
63
|
+
FSDialogSubmit,
|
|
64
|
+
FSErrorToast,
|
|
65
|
+
FSIcon,
|
|
66
|
+
FSRow,
|
|
67
|
+
FSSpan,
|
|
68
|
+
},
|
|
69
|
+
props: {
|
|
70
|
+
alertId: {
|
|
71
|
+
type: String,
|
|
72
|
+
required: true
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
setup(props) {
|
|
76
|
+
const { fetch: acknowledgeAlert, fetching: acknowledgingAlert } = useAcknowledgeAlert();
|
|
77
|
+
|
|
78
|
+
const error = ref<string | null>(null);
|
|
79
|
+
const dialog = ref(false);
|
|
80
|
+
|
|
81
|
+
const onAcknowledge = async (): Promise<void> => {
|
|
82
|
+
try {
|
|
83
|
+
error.value = null;
|
|
84
|
+
await acknowledgeAlert(props.alertId);
|
|
85
|
+
dialog.value = false;
|
|
86
|
+
}
|
|
87
|
+
catch (exception: any) {
|
|
88
|
+
error.value = exception.response.data;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
acknowledgingAlert,
|
|
94
|
+
ColorEnum,
|
|
95
|
+
dialog,
|
|
96
|
+
error,
|
|
97
|
+
onAcknowledge
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
</script>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSDataTable
|
|
3
3
|
:items="authTokens"
|
|
4
|
+
:loading="fetchingAuthTokens"
|
|
4
5
|
:tableCode="$props.tableCode"
|
|
5
6
|
v-bind="$attrs"
|
|
6
7
|
>
|
|
@@ -58,7 +59,7 @@ export default defineComponent({
|
|
|
58
59
|
}
|
|
59
60
|
},
|
|
60
61
|
setup(props) {
|
|
61
|
-
const { getMany: fetchAuthTokens, entities: authTokens } = useAuthTokens();
|
|
62
|
+
const { getMany: fetchAuthTokens, entities: authTokens, fetching: fetchingAuthTokens } = useAuthTokens();
|
|
62
63
|
const { epochToLongTimeFormat } = useDateFormat();
|
|
63
64
|
|
|
64
65
|
watch(() => props.authTokensFilters, (next, previous) => {
|
|
@@ -69,6 +70,7 @@ export default defineComponent({
|
|
|
69
70
|
|
|
70
71
|
return {
|
|
71
72
|
authTokens,
|
|
73
|
+
fetchingAuthTokens,
|
|
72
74
|
epochToLongTimeFormat
|
|
73
75
|
};
|
|
74
76
|
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSDataTable
|
|
3
|
+
:items="chartOrganisationTypes"
|
|
4
|
+
:itemTo="$props.itemTo"
|
|
5
|
+
:loading="fetchingChartOrganisationTypes"
|
|
6
|
+
:tableCode="$props.tableCode"
|
|
7
|
+
:modelValue="$props.modelValue"
|
|
8
|
+
@update:modelValue="$emit('update:modelValue', $event)"
|
|
9
|
+
v-bind="$attrs"
|
|
10
|
+
>
|
|
11
|
+
<template
|
|
12
|
+
v-for="(_, name) in $slots"
|
|
13
|
+
v-slot:[name]="slotData"
|
|
14
|
+
>
|
|
15
|
+
<slot
|
|
16
|
+
:name="name"
|
|
17
|
+
v-bind="slotData"
|
|
18
|
+
/>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<template
|
|
22
|
+
#item.icon="{ item }"
|
|
23
|
+
>
|
|
24
|
+
<FSIcon>
|
|
25
|
+
{{ item.icon }}
|
|
26
|
+
</FSIcon>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<template
|
|
30
|
+
#item.imageId="{ item }"
|
|
31
|
+
>
|
|
32
|
+
<FSImage
|
|
33
|
+
v-if="item.imageId"
|
|
34
|
+
height="32px"
|
|
35
|
+
width="32px"
|
|
36
|
+
:imageId="item.imageId"
|
|
37
|
+
/>
|
|
38
|
+
</template>
|
|
39
|
+
|
|
40
|
+
<template
|
|
41
|
+
#item.tags="{ item }"
|
|
42
|
+
>
|
|
43
|
+
<FSTagGroup
|
|
44
|
+
variant="slide"
|
|
45
|
+
:editable="false"
|
|
46
|
+
:tags="item.tags"
|
|
47
|
+
/>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<template
|
|
51
|
+
#item.modelsLabels="{ item }"
|
|
52
|
+
>
|
|
53
|
+
<FSTagGroup
|
|
54
|
+
:editable="false"
|
|
55
|
+
:tags="item.modelsLabels.map((d: any) => d.label)"
|
|
56
|
+
/>
|
|
57
|
+
</template>
|
|
58
|
+
<template
|
|
59
|
+
#item.tile="{item}"
|
|
60
|
+
>
|
|
61
|
+
<FSChartTileUI
|
|
62
|
+
:label="item.label"
|
|
63
|
+
:category-label="item.chartCategoryLabel"
|
|
64
|
+
:icon="item.icon"
|
|
65
|
+
:imageId="item.imageId"
|
|
66
|
+
:type="item.chartType"
|
|
67
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
68
|
+
/>
|
|
69
|
+
</template>
|
|
70
|
+
</FSDataTable>
|
|
71
|
+
</template>
|
|
72
|
+
|
|
73
|
+
<script lang="ts">
|
|
74
|
+
import _ from "lodash";
|
|
75
|
+
import { defineComponent, type PropType, watch } from "vue";
|
|
76
|
+
import type { RouteLocation } from "vue-router";
|
|
77
|
+
|
|
78
|
+
import {ColorEnum} from "@dative-gpi/foundation-shared-components/models";
|
|
79
|
+
|
|
80
|
+
import type { ChartOrganisationFilters, ChartOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
81
|
+
import { PlotPer } from "@dative-gpi/foundation-shared-domain/enums";
|
|
82
|
+
|
|
83
|
+
import { useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
|
|
84
|
+
|
|
85
|
+
import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
|
|
86
|
+
import FSDataTable from "../FSDataTable.vue";
|
|
87
|
+
import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
|
|
88
|
+
import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
|
|
89
|
+
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
90
|
+
|
|
91
|
+
export default defineComponent({
|
|
92
|
+
name: "FSBaseChartOrganisationTypesList",
|
|
93
|
+
components: {
|
|
94
|
+
FSChartTileUI,
|
|
95
|
+
FSDataTable,
|
|
96
|
+
FSTagGroup,
|
|
97
|
+
FSImage,
|
|
98
|
+
FSIcon
|
|
99
|
+
},
|
|
100
|
+
props: {
|
|
101
|
+
modelValue: {
|
|
102
|
+
type: Array as PropType<string[]>,
|
|
103
|
+
default: () => [],
|
|
104
|
+
required: false
|
|
105
|
+
},
|
|
106
|
+
chartOrganisationFilters: {
|
|
107
|
+
type: Object as PropType<ChartOrganisationFilters>,
|
|
108
|
+
required: false,
|
|
109
|
+
default: null
|
|
110
|
+
},
|
|
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
|
+
itemTo: {
|
|
121
|
+
type: Function as PropType<(item: ChartOrganisationTypeInfos) => Partial<RouteLocation>>,
|
|
122
|
+
required: false
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
emits: ["update:modelValue"],
|
|
126
|
+
setup(props) {
|
|
127
|
+
|
|
128
|
+
const { entities: chartOrganisationTypes, fetching: fetchingChartOrganisationTypes, getMany: getManyChartOrganisationTypes } = useChartOrganisationTypes();
|
|
129
|
+
|
|
130
|
+
const isSelected = (id: string): boolean => {
|
|
131
|
+
return props.modelValue.includes(id);
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const fetch = () =>{
|
|
135
|
+
if(props.plotPer === PlotPer.None) {
|
|
136
|
+
getManyChartOrganisationTypes(props.chartOrganisationFilters);
|
|
137
|
+
} else {
|
|
138
|
+
getManyChartOrganisationTypes({ ...props.chartOrganisationFilters, plotPer: props.plotPer });
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
watch(() => [props.chartOrganisationFilters, props.plotPer], (next, previous) => {
|
|
143
|
+
if ((!next && !previous) || !_.isEqual(next, previous)) {
|
|
144
|
+
fetch();
|
|
145
|
+
}
|
|
146
|
+
}, { immediate: true });
|
|
147
|
+
|
|
148
|
+
return {
|
|
149
|
+
ColorEnum,
|
|
150
|
+
fetchingChartOrganisationTypes,
|
|
151
|
+
chartOrganisationTypes,
|
|
152
|
+
isSelected
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
</script>
|