@dative-gpi/foundation-core-components 1.0.27 → 1.0.28-remove-deprecated2
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/autocompletes/FSAutocompleteChart.vue +60 -58
- package/components/autocompletes/FSAutocompleteDashboard.vue +59 -56
- package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +30 -39
- package/components/autocompletes/FSAutocompleteDataCategory.vue +52 -38
- package/components/autocompletes/FSAutocompleteDataDefinition.vue +25 -39
- package/components/autocompletes/FSAutocompleteGroup.vue +23 -38
- package/components/autocompletes/FSAutocompleteLocation.vue +23 -38
- package/components/autocompletes/FSAutocompleteManufacturer.vue +65 -2
- package/components/autocompletes/FSAutocompleteModel.vue +66 -3
- package/components/autocompletes/FSAutocompleteOrganisationType.vue +23 -0
- package/components/autocompletes/FSAutocompleteRole.vue +59 -56
- package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +105 -0
- package/components/autocompletes/FSAutocompleteUserOrganisation.vue +32 -57
- package/components/customProperties/FSMetaField.vue +31 -35
- package/components/customProperties/FSMetaHistory.vue +4 -4
- package/components/customProperties/FSMetaValue.vue +66 -33
- package/components/customProperties/helpers.ts +2 -1
- package/components/entities/FSBaseEntitiesList.vue +50 -0
- package/components/entities/FSDialogSelectEntities.vue +83 -0
- package/components/entities/FSEntityField.vue +203 -0
- package/components/entities/FSSelectEntitiesList.vue +209 -0
- package/components/entities/FSSimpleEntitiesList.vue +100 -0
- package/components/explorers/FSBaseDevicesExplorer.vue +310 -0
- package/components/explorers/FSBaseFoldersExplorer.vue +265 -0
- package/components/lists/FSDataTable.vue +23 -21
- package/components/lists/alerts/FSBaseAlertsList.vue +337 -0
- package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +101 -0
- package/components/lists/authTokens/FSBaseAuthTokensList.vue +79 -0
- package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +204 -0
- package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +205 -0
- package/components/lists/charts/FSBaseChartsList.vue +268 -0
- package/components/lists/comments/FSBaseCommentsList.vue +143 -0
- package/components/lists/connectivityScenarios/FSBaseConnectivityScenariosList.vue +128 -0
- package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +168 -0
- package/components/lists/dashboards/FSBaseDashboardsList.vue +227 -0
- package/components/lists/dashboards/FSSimpleDashboardsList.vue +63 -0
- package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +154 -0
- package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +129 -0
- package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +327 -0
- package/components/lists/deviceOrganisations/FSSimpleDeviceOrganisationsList.vue +44 -0
- package/components/lists/folders/FSBaseFoldersList.vue +127 -0
- package/components/lists/folders/FSSimpleFoldersList.vue +44 -0
- package/components/lists/groups/FSBaseGroupsList.vue +136 -0
- package/components/lists/groups/FSSimpleGroupsList.vue +44 -0
- package/components/lists/locations/FSBaseLocationsList.vue +118 -0
- package/components/lists/locations/FSSimpleLocationsList.vue +44 -0
- package/components/lists/models/FSBaseModelsList.vue +155 -0
- package/components/lists/models/FSSimpleModelsList.vue +44 -0
- package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +128 -0
- package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +128 -0
- package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +157 -0
- package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +145 -0
- package/components/lists/scenarios/FSBaseScenariosList.vue +241 -0
- package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +156 -0
- package/components/lists/serviceAccountRoleOrganisations/FSBaseServiceAccountRoleOrganisationsList.vue +128 -0
- package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +172 -0
- package/components/lists/userOrganisations/FSSimpleUserOrganisationsList.vue +45 -0
- package/components/tiles/FSDeviceOrganisationTile.vue +9 -2
- package/components/tiles/FSLocationTile.vue +66 -0
- package/components/treeviews/FSTreeViewFolder.vue +15 -3
- package/components/treeviews/FSTreeViewGroup.vue +22 -4
- package/package.json +9 -9
- package/utils/dashboards.ts +33 -5
- package/utils/index.ts +2 -2
- package/utils/permissions.ts +80 -0
- package/utils/roles.ts +4 -4
- package/utils/tables.ts +41 -0
- package/utils/users.ts +7 -4
- package/components/selects/FSAggregationSelector.vue +0 -51
- package/components/selects/FSAxisTypeSelector.vue +0 -48
- package/components/selects/FSDataCategorySelector.vue +0 -62
- package/components/selects/FSDataDefinitionSelector.vue +0 -66
- package/components/selects/FSDisplayAsSelector.vue +0 -52
- package/components/selects/FSFilterTypeSelector.vue +0 -53
- package/components/selects/FSHeatmapRuleSelector.vue +0 -52
- package/components/selects/FSModelSelector.vue +0 -56
- package/components/selects/FSOperationOnSelector.vue +0 -51
- package/components/selects/FSPlanningTypeSelector.vue +0 -51
- package/components/selects/FSPlotPerSelector.vue +0 -51
- package/components/selects/FSSelectSelectedEntities.vue +0 -59
- package/components/selects/FSSerieTypeSelector.vue +0 -51
- package/utils/charts.ts +0 -136
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSDataTable
|
|
3
|
+
:items="items"
|
|
4
|
+
:item-to="$props.itemTo"
|
|
5
|
+
:loading="fetchingFolders || fetchingDashboardOrganisations || fetchingDashboardShallows"
|
|
6
|
+
:tableCode="$props.tableCode"
|
|
7
|
+
:modelValue="selecteds"
|
|
8
|
+
@update:modelValue="onSelect"
|
|
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
|
+
<template
|
|
21
|
+
#header.imageId-title
|
|
22
|
+
>
|
|
23
|
+
<FSIcon>
|
|
24
|
+
mdi-panorama-variant-outline
|
|
25
|
+
</FSIcon>
|
|
26
|
+
</template>
|
|
27
|
+
<template
|
|
28
|
+
#item.imageId="{ item }"
|
|
29
|
+
>
|
|
30
|
+
<FSImage
|
|
31
|
+
v-if="item.imageId"
|
|
32
|
+
height="32px"
|
|
33
|
+
width="32px"
|
|
34
|
+
:imageId="item.imageId"
|
|
35
|
+
:thumbnail="true"
|
|
36
|
+
/>
|
|
37
|
+
</template>
|
|
38
|
+
<template
|
|
39
|
+
#item.icon="{ item }"
|
|
40
|
+
>
|
|
41
|
+
<FSIcon>
|
|
42
|
+
{{ item.icon }}
|
|
43
|
+
</FSIcon>
|
|
44
|
+
</template>
|
|
45
|
+
<template
|
|
46
|
+
#item.main="{ item }"
|
|
47
|
+
>
|
|
48
|
+
<FSIcon
|
|
49
|
+
v-if="item.id === mainOrganisationDashboardId"
|
|
50
|
+
>
|
|
51
|
+
mdi-account-group-outline
|
|
52
|
+
</FSIcon>
|
|
53
|
+
<FSIcon
|
|
54
|
+
v-if="item.id === mainUserDashboardId"
|
|
55
|
+
>
|
|
56
|
+
mdi-home
|
|
57
|
+
</FSIcon>
|
|
58
|
+
</template>
|
|
59
|
+
<template
|
|
60
|
+
#item.locked="{ item }"
|
|
61
|
+
>
|
|
62
|
+
<FSIconCheck
|
|
63
|
+
:value="item.locked"
|
|
64
|
+
/>
|
|
65
|
+
</template>
|
|
66
|
+
<template
|
|
67
|
+
#item.tile="{ item, toggleSelect }"
|
|
68
|
+
>
|
|
69
|
+
<FSFolderTileUI
|
|
70
|
+
v-if="item.type == FoldersListType.Folder"
|
|
71
|
+
:bottomColor="item.colors"
|
|
72
|
+
v-bind="item"
|
|
73
|
+
:modelValue="isSelected(item.id)"
|
|
74
|
+
@update:modelValue="toggleSelect(item)"
|
|
75
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
76
|
+
/>
|
|
77
|
+
<FSDashboardOrganisationTileUI
|
|
78
|
+
v-if="item.type == FoldersListType.Dashboard && item.dashboardType == DashboardType.Organisation"
|
|
79
|
+
:bottomColor="item.colors"
|
|
80
|
+
:modelValue="isSelected(item.id)"
|
|
81
|
+
@update:modelValue="toggleSelect(item)"
|
|
82
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
83
|
+
v-bind="item"
|
|
84
|
+
/>
|
|
85
|
+
<FSDashboardShallowTileUI
|
|
86
|
+
v-if="item.type == FoldersListType.Dashboard && item.dashboardType == DashboardType.Shallow"
|
|
87
|
+
:bottomColor="item.colors"
|
|
88
|
+
:modelValue="isSelected(item.id)"
|
|
89
|
+
@update:modelValue="toggleSelect(item)"
|
|
90
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
91
|
+
v-bind="item"
|
|
92
|
+
/>
|
|
93
|
+
</template>
|
|
94
|
+
</FSDataTable>
|
|
95
|
+
</template>
|
|
96
|
+
|
|
97
|
+
<script lang="ts">
|
|
98
|
+
import _ from "lodash";
|
|
99
|
+
import type { RouteLocation } from "vue-router";
|
|
100
|
+
import { computed, defineComponent, onMounted, type PropType, ref, watch } from "vue";
|
|
101
|
+
|
|
102
|
+
import { useOrganisation } from "@dative-gpi/foundation-shared-services/composables";
|
|
103
|
+
import { useDashboardOrganisations, useFolders, useDashboardShallows, useAppOrganisationId, useCurrentUserOrganisation } from "@dative-gpi/foundation-core-services/composables";
|
|
104
|
+
|
|
105
|
+
import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
106
|
+
import { FoldersListType, type FoldersListItem } from "@dative-gpi/foundation-core-components/utils";
|
|
107
|
+
import type { FolderFilters, DashboardOrganisationFilters, DashboardShallowFilters, DashboardInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
108
|
+
|
|
109
|
+
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
110
|
+
import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
|
|
111
|
+
import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
|
|
112
|
+
import FSFolderTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSFolderTileUI.vue";
|
|
113
|
+
import FSDashboardShallowTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardShallowTileUI.vue";
|
|
114
|
+
import FSDashboardOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTileUI.vue";
|
|
115
|
+
|
|
116
|
+
import FSDataTable from "../lists/FSDataTable.vue";
|
|
117
|
+
|
|
118
|
+
export default defineComponent({
|
|
119
|
+
name: "FSBaseFoldersExplorer",
|
|
120
|
+
components: {
|
|
121
|
+
FSDataTable,
|
|
122
|
+
FSIcon,
|
|
123
|
+
FSFolderTileUI,
|
|
124
|
+
FSDashboardOrganisationTileUI,
|
|
125
|
+
FSDashboardShallowTileUI,
|
|
126
|
+
FSIconCheck,
|
|
127
|
+
FSImage
|
|
128
|
+
},
|
|
129
|
+
props: {
|
|
130
|
+
foldersFilters: {
|
|
131
|
+
type: Object as PropType<FolderFilters>,
|
|
132
|
+
default: undefined,
|
|
133
|
+
required: false
|
|
134
|
+
},
|
|
135
|
+
dashboardOrganisationsFilters: {
|
|
136
|
+
type: Object as PropType<DashboardOrganisationFilters>,
|
|
137
|
+
default: undefined,
|
|
138
|
+
required: false
|
|
139
|
+
},
|
|
140
|
+
dashboardShallowsFilters: {
|
|
141
|
+
type: Object as PropType<DashboardShallowFilters>,
|
|
142
|
+
default: undefined,
|
|
143
|
+
required: false
|
|
144
|
+
},
|
|
145
|
+
modelValue: {
|
|
146
|
+
type: Array as PropType<string[]>,
|
|
147
|
+
required: false,
|
|
148
|
+
default: () => []
|
|
149
|
+
},
|
|
150
|
+
itemTo: {
|
|
151
|
+
type: Function as PropType<(item: DashboardInfos) => Partial<RouteLocation>>,
|
|
152
|
+
required: false
|
|
153
|
+
},
|
|
154
|
+
tableCode: {
|
|
155
|
+
type: String,
|
|
156
|
+
required: true
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
emits: ["update", "update:modelValue", "update:type", "update:dashboard-type"],
|
|
160
|
+
setup(props, { emit }) {
|
|
161
|
+
|
|
162
|
+
const { fetch: fetchUserOrganisation, entity: userOrganisation } = useCurrentUserOrganisation();
|
|
163
|
+
const { entity: organisation, get: getOrganisation } = useOrganisation();
|
|
164
|
+
const { organisationId } = useAppOrganisationId();
|
|
165
|
+
|
|
166
|
+
const { entities: dashboardOrganisations, fetching: fetchingDashboardOrganisations, getMany: getManyDashboardOrganisations } = useDashboardOrganisations();
|
|
167
|
+
const { entities: dashboardShallows, fetching: fetchingDashboardShallows, getMany: getManyDashboardShallows } = useDashboardShallows();
|
|
168
|
+
const { entities: folders, fetching: fetchingFolders, getMany: getManyFolders } = useFolders();
|
|
169
|
+
|
|
170
|
+
const selecteds = ref<string[]>([]);
|
|
171
|
+
|
|
172
|
+
const mainUserDashboardId = computed(() => {
|
|
173
|
+
return userOrganisation.value?.mainDashboardId;
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
const mainOrganisationDashboardId = computed(() => {
|
|
177
|
+
return organisation.value?.mainDashboardId;
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const items = computed((): FoldersListItem[] => {
|
|
181
|
+
return [
|
|
182
|
+
...folders.value.map(g => ({
|
|
183
|
+
...g,
|
|
184
|
+
type: FoldersListType.Folder,
|
|
185
|
+
dashboardType: DashboardType.None
|
|
186
|
+
})) as FoldersListItem[],
|
|
187
|
+
..._.sortBy([
|
|
188
|
+
...dashboardOrganisations.value.map(d => ({
|
|
189
|
+
...d,
|
|
190
|
+
type: FoldersListType.Dashboard,
|
|
191
|
+
dashboardType: DashboardType.Organisation
|
|
192
|
+
})) as FoldersListItem[],
|
|
193
|
+
...dashboardShallows.value.map(d => ({
|
|
194
|
+
...d,
|
|
195
|
+
type: FoldersListType.Dashboard,
|
|
196
|
+
dashboardType: DashboardType.Shallow
|
|
197
|
+
})) as FoldersListItem[]
|
|
198
|
+
], d => d.label)
|
|
199
|
+
]
|
|
200
|
+
})
|
|
201
|
+
|
|
202
|
+
const onSelect = (values: string[]) => {
|
|
203
|
+
selecteds.value = values;
|
|
204
|
+
const selectedItems = items.value.filter(i => selecteds.value!.includes(i.id));
|
|
205
|
+
const newDashboardType = selectedItems.map(i => i.dashboardType);
|
|
206
|
+
const newModelValue = selectedItems.map(i => i.id);
|
|
207
|
+
const newType = selectedItems.map(i => i.type);
|
|
208
|
+
emit("update:dashboard-type", newDashboardType);
|
|
209
|
+
emit("update:modelValue", newModelValue);
|
|
210
|
+
emit("update:type", newType);
|
|
211
|
+
emit("update", { dashboardType: newDashboardType, modelValue: newModelValue, type: newType });
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const isSelected = (id: string) => {
|
|
215
|
+
return selecteds.value?.includes(id);
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
onMounted(() => {
|
|
219
|
+
fetchUserOrganisation();
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
watch(() => organisationId.value, () => {
|
|
223
|
+
if (organisationId.value) {
|
|
224
|
+
getOrganisation(organisationId.value);
|
|
225
|
+
}
|
|
226
|
+
}, { immediate: true });
|
|
227
|
+
|
|
228
|
+
watch(() => props.foldersFilters, (next, previous) => {
|
|
229
|
+
if ((!next && !previous) || !_.isEqual(next, previous)) {
|
|
230
|
+
getManyFolders(props.foldersFilters, f => f.parentId == props.foldersFilters?.parentId);
|
|
231
|
+
}
|
|
232
|
+
}, { immediate: true });
|
|
233
|
+
|
|
234
|
+
watch(() => props.dashboardOrganisationsFilters, (next, previous) => {
|
|
235
|
+
if ((!next && !previous) || !_.isEqual(next, previous)) {
|
|
236
|
+
getManyDashboardOrganisations(props.dashboardOrganisationsFilters, f => f.folderId == props.foldersFilters?.parentId);
|
|
237
|
+
}
|
|
238
|
+
}, { immediate: true });
|
|
239
|
+
|
|
240
|
+
watch(() => props.dashboardShallowsFilters, (next, previous) => {
|
|
241
|
+
if ((!next && !previous) || !_.isEqual(next, previous)) {
|
|
242
|
+
getManyDashboardShallows(props.dashboardShallowsFilters, f => f.folderId == props.foldersFilters?.parentId);
|
|
243
|
+
}
|
|
244
|
+
}, { immediate: true });
|
|
245
|
+
|
|
246
|
+
watch(() => props.modelValue, (next) => {
|
|
247
|
+
selecteds.value = next;
|
|
248
|
+
}, { immediate: true });
|
|
249
|
+
|
|
250
|
+
return {
|
|
251
|
+
fetchingDashboardOrganisations,
|
|
252
|
+
fetchingDashboardShallows,
|
|
253
|
+
fetchingFolders,
|
|
254
|
+
mainOrganisationDashboardId,
|
|
255
|
+
mainUserDashboardId,
|
|
256
|
+
selecteds,
|
|
257
|
+
items,
|
|
258
|
+
onSelect,
|
|
259
|
+
isSelected,
|
|
260
|
+
FoldersListType,
|
|
261
|
+
DashboardType
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
</script>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSLoadDataTable
|
|
3
|
-
v-if="!initialized || gettingUserOrganisationTable"
|
|
3
|
+
v-if="($props.tableCode && !initialized) || gettingUserOrganisationTable || !table"
|
|
4
4
|
/>
|
|
5
5
|
<FSDataTableUI
|
|
6
6
|
v-else
|
|
7
7
|
@update:rowsPerPage="table.rowsPerPage = $event"
|
|
8
|
+
@update:showFilters="table.showFilters = $event"
|
|
8
9
|
@update:filters="table.filters = $event"
|
|
9
10
|
@update:headers="table.headers = $event"
|
|
10
11
|
@update:sortBy="table.sortBy = $event"
|
|
@@ -29,6 +30,7 @@ import { computed, defineComponent, onUnmounted, type PropType, watch } from "vu
|
|
|
29
30
|
|
|
30
31
|
import { useUserOrganisationTable, useUpdateUserOrganisationTable, useDataTables } from "@dative-gpi/foundation-core-services/composables";
|
|
31
32
|
import { useDebounce, useTables } from "@dative-gpi/foundation-shared-components/composables";
|
|
33
|
+
import { type FSDataTableColumn } from "@dative-gpi/foundation-shared-components/models";
|
|
32
34
|
|
|
33
35
|
import FSLoadDataTable from "@dative-gpi/foundation-shared-components/components/lists/FSLoadDataTable.vue";
|
|
34
36
|
import FSDataTableUI from "@dative-gpi/foundation-shared-components/components/lists/FSDataTableUI.vue";
|
|
@@ -40,22 +42,28 @@ export default defineComponent({
|
|
|
40
42
|
FSDataTableUI
|
|
41
43
|
},
|
|
42
44
|
props: {
|
|
45
|
+
defaultMode: {
|
|
46
|
+
type: String as PropType<"table" | "iterator">,
|
|
47
|
+
required: false,
|
|
48
|
+
default: "table"
|
|
49
|
+
},
|
|
43
50
|
tableCode: {
|
|
44
|
-
type: String
|
|
45
|
-
required:
|
|
51
|
+
type: String as PropType<string | null>,
|
|
52
|
+
required: false,
|
|
53
|
+
default: null
|
|
46
54
|
},
|
|
47
55
|
debounceTime: {
|
|
48
56
|
type: Number,
|
|
49
57
|
required: false,
|
|
50
58
|
default: 1000
|
|
51
59
|
},
|
|
52
|
-
|
|
53
|
-
type:
|
|
60
|
+
extraHeaders: {
|
|
61
|
+
type: Array as PropType<FSDataTableColumn[]>,
|
|
54
62
|
required: false,
|
|
55
|
-
default: () =>
|
|
63
|
+
default: () => []
|
|
56
64
|
},
|
|
57
|
-
|
|
58
|
-
type: Object as PropType<{ [key: string]:
|
|
65
|
+
headersOptions: {
|
|
66
|
+
type: Object as PropType<{ [key: string]: Partial<FSDataTableColumn> }>,
|
|
59
67
|
required: false,
|
|
60
68
|
default: () => ({})
|
|
61
69
|
}
|
|
@@ -67,7 +75,7 @@ export default defineComponent({
|
|
|
67
75
|
const { getTable, setTable } = useTables();
|
|
68
76
|
const { debounce, cancel } = useDebounce();
|
|
69
77
|
|
|
70
|
-
const computedTable = computed(() => computeTable(props.
|
|
78
|
+
const computedTable = computed(() => computeTable(props.headersOptions, props.defaultMode, props.extraHeaders));
|
|
71
79
|
|
|
72
80
|
onUnmounted(() => {
|
|
73
81
|
cancel();
|
|
@@ -75,23 +83,17 @@ export default defineComponent({
|
|
|
75
83
|
});
|
|
76
84
|
|
|
77
85
|
const update = () => {
|
|
78
|
-
|
|
79
|
-
updateUserOrganisationTable,
|
|
80
|
-
|
|
81
|
-
props.tableCode
|
|
82
|
-
);
|
|
86
|
+
if (props.tableCode) {
|
|
87
|
+
updateTable(updateUserOrganisationTable, setTable, props.tableCode, props.defaultMode);
|
|
88
|
+
}
|
|
83
89
|
}
|
|
84
90
|
|
|
85
91
|
watch(() => props.tableCode, async (): Promise<void> => {
|
|
86
|
-
onTableCodeChange(
|
|
87
|
-
getUserOrganisationTable,
|
|
88
|
-
getTable,
|
|
89
|
-
props.tableCode
|
|
90
|
-
);
|
|
92
|
+
onTableCodeChange(getUserOrganisationTable, getTable, props.tableCode, props.defaultMode);
|
|
91
93
|
}, { immediate: true });
|
|
92
94
|
|
|
93
|
-
watch(() => table.value, () => {
|
|
94
|
-
if (table.value && initialized.value) {
|
|
95
|
+
watch(() => (table.value ? { ...table.value } : null), (_, former) => {
|
|
96
|
+
if (table.value && former && initialized.value) {
|
|
95
97
|
debounce(update, props.debounceTime);
|
|
96
98
|
}
|
|
97
99
|
}, { deep: true });
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSDataTable
|
|
3
|
+
rowGap="6px"
|
|
4
|
+
:rowColor="criticityColor"
|
|
5
|
+
:itemTo="$props.itemTo"
|
|
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
|
+
v-for="(_, name) in $slots"
|
|
15
|
+
v-slot:[name]="slotData"
|
|
16
|
+
>
|
|
17
|
+
<slot
|
|
18
|
+
:name="name"
|
|
19
|
+
v-bind="slotData"
|
|
20
|
+
/>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<template
|
|
24
|
+
#item.criticity="{ item }"
|
|
25
|
+
>
|
|
26
|
+
<FSRow
|
|
27
|
+
align="center-left"
|
|
28
|
+
gap="2px"
|
|
29
|
+
>
|
|
30
|
+
<FSIcon
|
|
31
|
+
:color="AlertTools.criticityColor(item.criticity)"
|
|
32
|
+
>
|
|
33
|
+
{{ AlertTools.criticityIcon(item.criticity) }}
|
|
34
|
+
</FSIcon>
|
|
35
|
+
<FSSpan>
|
|
36
|
+
{{ AlertTools.criticityLabel(item.criticity) }}
|
|
37
|
+
</FSSpan>
|
|
38
|
+
</FSRow>
|
|
39
|
+
</template>
|
|
40
|
+
<template
|
|
41
|
+
#item.icon="{ item }"
|
|
42
|
+
>
|
|
43
|
+
<FSIcon>
|
|
44
|
+
{{ item.icon }}
|
|
45
|
+
</FSIcon>
|
|
46
|
+
</template>
|
|
47
|
+
<template
|
|
48
|
+
#item.tags="{ item }"
|
|
49
|
+
>
|
|
50
|
+
<FSTagGroup
|
|
51
|
+
variant="slide"
|
|
52
|
+
:editable="false"
|
|
53
|
+
:tags="item.tags"
|
|
54
|
+
/>
|
|
55
|
+
</template>
|
|
56
|
+
<template
|
|
57
|
+
#item.groupByValues="{ item }"
|
|
58
|
+
>
|
|
59
|
+
<FSTagGroup
|
|
60
|
+
variant="slide"
|
|
61
|
+
:tags="item.groupByValues.map((gbv: any) => `${gbv.label}: ${gbv.value}`)"
|
|
62
|
+
:editable="false"
|
|
63
|
+
/>
|
|
64
|
+
</template>
|
|
65
|
+
<template
|
|
66
|
+
#item.deviceOrganisationImageId="{ item }"
|
|
67
|
+
>
|
|
68
|
+
<FSImage
|
|
69
|
+
v-if="item.deviceOrganisationImageId != null"
|
|
70
|
+
width="32px"
|
|
71
|
+
height="32px"
|
|
72
|
+
:imageId="item.deviceOrganisationImageId"
|
|
73
|
+
:thumbnail="true"
|
|
74
|
+
/>
|
|
75
|
+
</template>
|
|
76
|
+
<template
|
|
77
|
+
#item.acknowledged="{ item }"
|
|
78
|
+
>
|
|
79
|
+
<FSSpan
|
|
80
|
+
v-if="item.acknowledged"
|
|
81
|
+
font="text-overline"
|
|
82
|
+
>
|
|
83
|
+
{{ $tr('entity.alert.acknowledged', 'Acknowledged') }}
|
|
84
|
+
</FSSpan>
|
|
85
|
+
<FSButtonAcknowledgeAlert
|
|
86
|
+
v-else-if="!item.acknowledged && $props.allowAcknowledge"
|
|
87
|
+
:alertId="item.id"
|
|
88
|
+
/>
|
|
89
|
+
<FSSpan
|
|
90
|
+
v-else
|
|
91
|
+
font="text-overline"
|
|
92
|
+
>
|
|
93
|
+
{{ $tr('ui.alert.not-acknowledged', 'Not acknowledged') }}
|
|
94
|
+
</FSSpan>
|
|
95
|
+
</template>
|
|
96
|
+
<template
|
|
97
|
+
#item.acknowledgingUserImageId="{ item }"
|
|
98
|
+
>
|
|
99
|
+
<FSImage
|
|
100
|
+
v-if="item.acknowledged && item.acknowledgingUserImageId != null"
|
|
101
|
+
width="32px"
|
|
102
|
+
height="32px"
|
|
103
|
+
:imageId="item.acknowledgingUserImageId"
|
|
104
|
+
:thumbnail="true"
|
|
105
|
+
/>
|
|
106
|
+
</template>
|
|
107
|
+
<template
|
|
108
|
+
#item.acknowledgingTimestamp="{ item }"
|
|
109
|
+
>
|
|
110
|
+
<FSSpan
|
|
111
|
+
font="text-overline"
|
|
112
|
+
>
|
|
113
|
+
{{ epochToShortTimeFormat(item.acknowledgingTimestamp) }}
|
|
114
|
+
</FSSpan>
|
|
115
|
+
</template>
|
|
116
|
+
<template
|
|
117
|
+
#item.history="{ item }"
|
|
118
|
+
>
|
|
119
|
+
<FSTagGroup
|
|
120
|
+
variant="slide"
|
|
121
|
+
:tags="item.history.map((h: any) => AlertTools.statusLabel(h.status))"
|
|
122
|
+
:editable="false"
|
|
123
|
+
/>
|
|
124
|
+
</template>
|
|
125
|
+
<template
|
|
126
|
+
#item.initialState="{ item }"
|
|
127
|
+
>
|
|
128
|
+
<FSSpan
|
|
129
|
+
font="text-overline"
|
|
130
|
+
>
|
|
131
|
+
{{ AlertTools.statusLabel(item.initialState.status) }}
|
|
132
|
+
</FSSpan>
|
|
133
|
+
</template>
|
|
134
|
+
<template
|
|
135
|
+
#item.triggerSourceTimestamp="{ item }"
|
|
136
|
+
>
|
|
137
|
+
<FSSpan
|
|
138
|
+
font="text-overline"
|
|
139
|
+
>
|
|
140
|
+
{{ epochToShortTimeFormat(item.triggerSourceTimestamp) }}
|
|
141
|
+
</FSSpan>
|
|
142
|
+
</template>
|
|
143
|
+
<template
|
|
144
|
+
#item.triggerEnqueuedTimestamp="{ item }"
|
|
145
|
+
>
|
|
146
|
+
<FSSpan
|
|
147
|
+
font="text-overline"
|
|
148
|
+
>
|
|
149
|
+
{{ epochToShortTimeFormat(item.triggerEnqueuedTimestamp) }}
|
|
150
|
+
</FSSpan>
|
|
151
|
+
</template>
|
|
152
|
+
<template
|
|
153
|
+
#item.triggerProcessedTimestamp="{ item }"
|
|
154
|
+
>
|
|
155
|
+
<FSSpan
|
|
156
|
+
font="text-overline"
|
|
157
|
+
>
|
|
158
|
+
{{ epochToShortTimeFormat(item.triggerProcessedTimestamp) }}
|
|
159
|
+
</FSSpan>
|
|
160
|
+
</template>
|
|
161
|
+
<template
|
|
162
|
+
#item.lastState="{ item }"
|
|
163
|
+
>
|
|
164
|
+
<FSSpan
|
|
165
|
+
font="text-overline"
|
|
166
|
+
>
|
|
167
|
+
{{ AlertTools.statusLabel(item.lastState.status) }}
|
|
168
|
+
</FSSpan>
|
|
169
|
+
</template>
|
|
170
|
+
<template
|
|
171
|
+
#item.currentSourceTimestamp="{ item }"
|
|
172
|
+
>
|
|
173
|
+
<FSSpan
|
|
174
|
+
font="text-overline"
|
|
175
|
+
>
|
|
176
|
+
{{ epochToShortTimeFormat(item.currentSourceTimestamp) }}
|
|
177
|
+
</FSSpan>
|
|
178
|
+
</template>
|
|
179
|
+
<template
|
|
180
|
+
#item.currentEnqueuedTimestamp="{ item }"
|
|
181
|
+
>
|
|
182
|
+
<FSSpan
|
|
183
|
+
font="text-overline"
|
|
184
|
+
>
|
|
185
|
+
{{ epochToShortTimeFormat(item.currentEnqueuedTimestamp) }}
|
|
186
|
+
</FSSpan>
|
|
187
|
+
</template>
|
|
188
|
+
<template
|
|
189
|
+
#item.currentProcessedTimestamp="{ item }"
|
|
190
|
+
>
|
|
191
|
+
<FSSpan
|
|
192
|
+
font="text-overline"
|
|
193
|
+
>
|
|
194
|
+
{{ epochToShortTimeFormat(item.currentProcessedTimestamp) }}
|
|
195
|
+
</FSSpan>
|
|
196
|
+
</template>
|
|
197
|
+
<template
|
|
198
|
+
#item.tile="{ item }"
|
|
199
|
+
>
|
|
200
|
+
<FSAlertTileUI
|
|
201
|
+
variant="standard"
|
|
202
|
+
:label="item.label"
|
|
203
|
+
:deviceOrganisationLabel="item.deviceOrganisationLabel"
|
|
204
|
+
:icon="item.icon"
|
|
205
|
+
:triggerProcessedTimestamp="item.triggerProcessedTimestamp"
|
|
206
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
207
|
+
:color="alertColorByCriticity(item.criticity)"
|
|
208
|
+
/>
|
|
209
|
+
</template>
|
|
210
|
+
</FSDataTable>
|
|
211
|
+
</template>
|
|
212
|
+
|
|
213
|
+
<script lang="ts">
|
|
214
|
+
import type { PropType} from "vue";
|
|
215
|
+
import type { RouteLocation } from "vue-router";
|
|
216
|
+
import { computed, defineComponent, watch } from "vue";
|
|
217
|
+
import _ from "lodash";
|
|
218
|
+
|
|
219
|
+
import type { AlertFilters, AlertInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
220
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
221
|
+
import { useAlerts } from "@dative-gpi/foundation-core-services/composables";
|
|
222
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
223
|
+
import type { Criticity } from "@dative-gpi/foundation-shared-domain/enums";
|
|
224
|
+
import { AlertStatus } from "@dative-gpi/foundation-shared-domain/enums";
|
|
225
|
+
|
|
226
|
+
import { AlertTools } from "@dative-gpi/foundation-shared-components/tools";
|
|
227
|
+
|
|
228
|
+
import FSDataTable from "../FSDataTable.vue";
|
|
229
|
+
import FSButtonAcknowledgeAlert from "./FSButtonAcknowledgeAlert.vue";
|
|
230
|
+
import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
|
|
231
|
+
import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
|
|
232
|
+
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
233
|
+
import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
|
|
234
|
+
import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
|
|
235
|
+
import FSAlertTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSAlertTileUI.vue";
|
|
236
|
+
|
|
237
|
+
export default defineComponent({
|
|
238
|
+
name: "FSBaseAlertsList",
|
|
239
|
+
components: {
|
|
240
|
+
FSButtonAcknowledgeAlert,
|
|
241
|
+
FSAlertTileUI,
|
|
242
|
+
FSDataTable,
|
|
243
|
+
FSTagGroup,
|
|
244
|
+
FSImage,
|
|
245
|
+
FSIcon,
|
|
246
|
+
FSSpan,
|
|
247
|
+
FSRow
|
|
248
|
+
},
|
|
249
|
+
props: {
|
|
250
|
+
tableCode: {
|
|
251
|
+
type: String as PropType<string | null>,
|
|
252
|
+
required: false,
|
|
253
|
+
default: null
|
|
254
|
+
},
|
|
255
|
+
alertFilters: {
|
|
256
|
+
type: Object as PropType<AlertFilters>,
|
|
257
|
+
required: false,
|
|
258
|
+
default: null
|
|
259
|
+
},
|
|
260
|
+
notAcknowledged:{
|
|
261
|
+
type: Boolean,
|
|
262
|
+
required: false,
|
|
263
|
+
},
|
|
264
|
+
hidePending:{
|
|
265
|
+
type: Boolean,
|
|
266
|
+
required: false,
|
|
267
|
+
},
|
|
268
|
+
modelValue: {
|
|
269
|
+
type: Array as PropType<string[]>,
|
|
270
|
+
required: false,
|
|
271
|
+
default: () => []
|
|
272
|
+
},
|
|
273
|
+
allowAcknowledge: {
|
|
274
|
+
type: Boolean,
|
|
275
|
+
required: false,
|
|
276
|
+
default: false
|
|
277
|
+
},
|
|
278
|
+
itemTo: {
|
|
279
|
+
type: Function as PropType<(item: AlertInfos) => Partial<RouteLocation>>,
|
|
280
|
+
required: false
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
emits: ["update:modelValue"],
|
|
284
|
+
setup(props) {
|
|
285
|
+
const { getMany: getManyAlerts, entities: alerts, fetching : fetchingAlerts } = useAlerts();
|
|
286
|
+
const { epochToShortTimeFormat } = useDateFormat();
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
const criticityColor = (row: any) => {
|
|
290
|
+
return AlertTools.criticityColor(row.criticity);
|
|
291
|
+
};
|
|
292
|
+
|
|
293
|
+
const alertColorByCriticity = (criticity: Criticity | number) => {
|
|
294
|
+
return AlertTools.criticityColor(criticity);
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
const alertsOrdered = computed(() => {
|
|
298
|
+
const als = [...alerts.value]
|
|
299
|
+
return als.sort((a: AlertInfos, b: AlertInfos) => {
|
|
300
|
+
return (a.acknowledged === b.acknowledged) ?
|
|
301
|
+
+b.currentSourceTimestamp! - +a.currentSourceTimestamp! : a.acknowledged ? 1 : -1
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
watch(() => [props.alertFilters, props.notAcknowledged, props.hidePending], (next, previous) => {
|
|
306
|
+
if (!_.isEqual(next, previous)) {
|
|
307
|
+
if(props.notAcknowledged){
|
|
308
|
+
getManyAlerts({
|
|
309
|
+
...props.alertFilters,
|
|
310
|
+
acknowledged: false,
|
|
311
|
+
statuses: [AlertStatus.Unresolved, AlertStatus.Triggered],
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
else{
|
|
315
|
+
getManyAlerts({
|
|
316
|
+
...props.alertFilters,
|
|
317
|
+
statuses: props.hidePending ?
|
|
318
|
+
[AlertStatus.Unresolved, AlertStatus.Resolved, AlertStatus.Triggered] : props.alertFilters?.statuses
|
|
319
|
+
}); // TODO, gérer les conditions pour que les alertes s'affichent ici notamment lorsqu'elles sont acquittées
|
|
320
|
+
// la FilterFactory gère pas ces conditions correctement
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}, { immediate: true });
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
return {
|
|
327
|
+
fetchingAlerts,
|
|
328
|
+
alertsOrdered,
|
|
329
|
+
AlertTools,
|
|
330
|
+
ColorEnum,
|
|
331
|
+
epochToShortTimeFormat,
|
|
332
|
+
alertColorByCriticity,
|
|
333
|
+
criticityColor
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
</script>
|