@dative-gpi/foundation-core-components 1.0.45 → 1.0.47
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 +2 -1
- package/components/autocompletes/FSAutocompleteDashboard.vue +1 -1
- package/components/autocompletes/FSAutocompleteRole.vue +2 -1
- package/components/customProperties/FSMetaField.vue +2 -1
- package/components/customProperties/FSMetaValue.vue +2 -1
- package/components/customProperties/helpers.ts +2 -1
- package/components/entities/FSBaseEntitiesList.vue +50 -0
- package/components/entities/FSDialogSelectEntities.vue +171 -0
- package/components/entities/FSEntityField.vue +143 -0
- package/components/entities/FSSimpleEntitiesList.vue +100 -0
- package/components/lists/authTokens/FSBaseAuthTokensList.vue +76 -0
- package/components/lists/dashboards/FSBaseDashboardsList.vue +222 -0
- package/components/lists/dashboards/FSSimpleDashboardsList.vue +63 -0
- package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +260 -0
- package/components/lists/deviceOrganisations/FSSimpleDeviceOrganisationsList.vue +44 -0
- package/components/lists/folders/FSBaseFoldersList.vue +241 -0
- package/components/lists/folders/FSSimpleFoldersList.vue +44 -0
- package/components/lists/groups/FSBaseGroupsList.vue +119 -0
- package/components/lists/groups/FSSimpleGroupsList.vue +44 -0
- package/components/lists/locations/FSBaseLocationsList.vue +79 -0
- package/components/lists/locations/FSSimpleLocationsList.vue +44 -0
- package/components/lists/models/FSSimpleModelsList.vue +44 -0
- package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +158 -0
- package/components/lists/userOrganisations/FSSimpleUserOrganisationsList.vue +45 -0
- package/components/selects/FSAggregationSelector.vue +1 -1
- package/components/selects/FSAxisTypeSelector.vue +1 -1
- package/components/selects/FSDisplayAsSelector.vue +1 -1
- package/components/selects/FSFilterTypeSelector.vue +1 -1
- package/components/selects/FSHeatmapRuleSelector.vue +1 -1
- package/components/selects/FSOperationOnSelector.vue +1 -1
- package/components/selects/FSPlanningTypeSelector.vue +1 -1
- package/components/selects/FSPlotPerSelector.vue +1 -1
- package/components/selects/{FSSelectSelectedEntities.vue → FSSelectEntityType.vue} +12 -12
- package/components/selects/FSSerieTypeSelector.vue +1 -1
- package/package.json +7 -7
- package/utils/charts.ts +2 -1
- package/utils/dashboards.ts +30 -2
- package/utils/index.ts +2 -1
- package/utils/permissions.ts +80 -0
- package/utils/roles.ts +1 -1
- package/utils/tables.ts +41 -0
- package/utils/users.ts +1 -1
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSLoadDataTable
|
|
3
|
+
v-if="fetchingDashboardOrganisationTypes || fetchingDashboardOrganisations || fetchingDashboardShallows"
|
|
4
|
+
/>
|
|
5
|
+
<FSDataTable
|
|
6
|
+
v-else
|
|
7
|
+
:items="items"
|
|
8
|
+
:itemTo="$props.itemTo"
|
|
9
|
+
:tableCode="$props.tableCode"
|
|
10
|
+
:modelValue="selecteds"
|
|
11
|
+
@update:modelValue="onSelect"
|
|
12
|
+
v-bind="$attrs"
|
|
13
|
+
>
|
|
14
|
+
<template
|
|
15
|
+
v-for="(_, name) in $slots"
|
|
16
|
+
v-slot:[name]="slotData"
|
|
17
|
+
>
|
|
18
|
+
<slot
|
|
19
|
+
:name="name"
|
|
20
|
+
v-bind="slotData"
|
|
21
|
+
/>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<template
|
|
25
|
+
#item.icon="{ item }"
|
|
26
|
+
>
|
|
27
|
+
<FSIcon>
|
|
28
|
+
{{ item.icon }}
|
|
29
|
+
</FSIcon>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<template
|
|
33
|
+
#item.main="{ item }"
|
|
34
|
+
>
|
|
35
|
+
<FSIcon
|
|
36
|
+
v-if="item.id === mainOrganisationDashboardId"
|
|
37
|
+
>
|
|
38
|
+
mdi-account-group-outline
|
|
39
|
+
</FSIcon>
|
|
40
|
+
<FSIcon
|
|
41
|
+
v-if="item.id === mainUserDashboardId"
|
|
42
|
+
>
|
|
43
|
+
mdi-home
|
|
44
|
+
</FSIcon>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<template
|
|
48
|
+
#item.tile="{ item, toggleSelect }"
|
|
49
|
+
>
|
|
50
|
+
<FSDashboardOrganisationTypeTileUI
|
|
51
|
+
v-if="item.dashboardType == DashboardType.OrganisationType"
|
|
52
|
+
:bottomColor="item.colors"
|
|
53
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
54
|
+
:modelValue="isSelected(item.id)"
|
|
55
|
+
@update:modelValue="toggleSelect(item)"
|
|
56
|
+
v-bind="item"
|
|
57
|
+
/>
|
|
58
|
+
<FSDashboardOrganisationTileUI
|
|
59
|
+
v-if="item.dashboardType == DashboardType.Organisation"
|
|
60
|
+
:bottomColor="item.colors"
|
|
61
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
62
|
+
:modelValue="isSelected(item.id)"
|
|
63
|
+
@update:modelValue="toggleSelect(item)"
|
|
64
|
+
v-bind="item"
|
|
65
|
+
/>
|
|
66
|
+
<FSDashboardShallowTileUI
|
|
67
|
+
v-if="item.dashboardType == DashboardType.Shallow"
|
|
68
|
+
:bottomColor="item.colors"
|
|
69
|
+
:modelValue="isSelected(item.id)"
|
|
70
|
+
@update:modelValue="toggleSelect(item)"
|
|
71
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
72
|
+
v-bind="item"
|
|
73
|
+
/>
|
|
74
|
+
</template>
|
|
75
|
+
</FSDataTable>
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<script lang="ts">
|
|
79
|
+
import _ from "lodash";
|
|
80
|
+
import type { PropType} from "vue";
|
|
81
|
+
import type { RouteLocation } from "vue-router";
|
|
82
|
+
import { computed, defineComponent, onMounted, ref, watch } from "vue";
|
|
83
|
+
|
|
84
|
+
import { useAppOrganisationId, useCurrentUserOrganisation, useDashboardOrganisations, useDashboardOrganisationTypes, useDashboardShallows } from "@dative-gpi/foundation-core-services/composables";
|
|
85
|
+
import type { DashboardOrganisationTypeFilters, DashboardOrganisationFilters, DashboardShallowFilters, DashboardInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
86
|
+
import { useOrganisation } from "@dative-gpi/foundation-shared-services/composables";
|
|
87
|
+
|
|
88
|
+
import type { DashboardsListItem } from "@/core/foundation-core-components/utils";
|
|
89
|
+
import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
90
|
+
|
|
91
|
+
import FSDataTable from "../FSDataTable.vue";
|
|
92
|
+
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
93
|
+
import FSLoadDataTable from "@dative-gpi/foundation-shared-components/components/lists/FSLoadDataTable.vue";
|
|
94
|
+
import FSDashboardShallowTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardShallowTileUI.vue";
|
|
95
|
+
import FSDashboardOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTileUI.vue";
|
|
96
|
+
import FSDashboardOrganisationTypeTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTypeTileUI.vue";
|
|
97
|
+
|
|
98
|
+
export default defineComponent({
|
|
99
|
+
name: "FSBaseDashboardsList",
|
|
100
|
+
components: {
|
|
101
|
+
FSDataTable,
|
|
102
|
+
FSLoadDataTable,
|
|
103
|
+
FSIcon,
|
|
104
|
+
FSDashboardOrganisationTileUI,
|
|
105
|
+
FSDashboardOrganisationTypeTileUI,
|
|
106
|
+
FSDashboardShallowTileUI
|
|
107
|
+
},
|
|
108
|
+
props: {
|
|
109
|
+
dashboardOrganisationTypeFetchFilter: {
|
|
110
|
+
type: Object as PropType<DashboardOrganisationTypeFilters>,
|
|
111
|
+
default: undefined,
|
|
112
|
+
required: false
|
|
113
|
+
},
|
|
114
|
+
dashboardOrganisationsFilters: {
|
|
115
|
+
type: Object as PropType<DashboardOrganisationFilters>,
|
|
116
|
+
default: undefined,
|
|
117
|
+
required: false
|
|
118
|
+
},
|
|
119
|
+
dashboardShallowsFilters: {
|
|
120
|
+
type: Object as PropType<DashboardShallowFilters>,
|
|
121
|
+
default: undefined,
|
|
122
|
+
required: false
|
|
123
|
+
},
|
|
124
|
+
itemTo: {
|
|
125
|
+
type: Function as PropType<(item: DashboardInfos) => Partial<RouteLocation>>,
|
|
126
|
+
required: false
|
|
127
|
+
},
|
|
128
|
+
tableCode: {
|
|
129
|
+
type: String,
|
|
130
|
+
required: true
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
emits: ["update:modelValue", "update:type"],
|
|
134
|
+
setup(props, { emit }) {
|
|
135
|
+
const { entities: dashboardOrganisationTypes, fetching: fetchingDashboardOrganisationTypes, getMany: getManyDashboardOrganisationTypes } = useDashboardOrganisationTypes();
|
|
136
|
+
const { entities: dashboardOrganisations, fetching: fetchingDashboardOrganisations, getMany: getManyDashboardOrganisations } = useDashboardOrganisations();
|
|
137
|
+
const { entities: dashboardShallows, fetching: fetchingDashboardShallows, getMany: getManyDashboardShallows } = useDashboardShallows();
|
|
138
|
+
const { fetch: fetchUserOrganisation, entity: userOrganisation } = useCurrentUserOrganisation();
|
|
139
|
+
const { entity: organisation, get: getOrganisation } = useOrganisation();
|
|
140
|
+
const { organisationId } = useAppOrganisationId();
|
|
141
|
+
|
|
142
|
+
const selecteds = ref<string[]>([]);
|
|
143
|
+
|
|
144
|
+
const items = computed((): DashboardsListItem[] => {
|
|
145
|
+
return _.sortBy([
|
|
146
|
+
...dashboardOrganisationTypes.value.map(g => ({
|
|
147
|
+
...g,
|
|
148
|
+
dashboardType: DashboardType.OrganisationType
|
|
149
|
+
})) as DashboardsListItem[],
|
|
150
|
+
...dashboardOrganisations.value.map(d => ({
|
|
151
|
+
...d,
|
|
152
|
+
dashboardType: DashboardType.Organisation
|
|
153
|
+
})) as DashboardsListItem[],
|
|
154
|
+
...dashboardShallows.value.map(d => ({
|
|
155
|
+
...d,
|
|
156
|
+
dashboardType: DashboardType.Shallow
|
|
157
|
+
})) as DashboardsListItem[]
|
|
158
|
+
], d => d.label);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
const mainUserDashboardId = computed(() => {
|
|
162
|
+
return userOrganisation.value?.mainDashboardId;
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
const mainOrganisationDashboardId = computed(() => {
|
|
166
|
+
return organisation.value?.mainDashboardId;
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const onSelect = (values: string[]) => {
|
|
170
|
+
selecteds.value = values;
|
|
171
|
+
const selectedItems = items.value.filter(i => selecteds.value!.includes(i.id));
|
|
172
|
+
emit("update:modelValue", selectedItems.map(i => i.id));
|
|
173
|
+
emit("update:type", selectedItems.map(i => i.dashboardType));
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const isSelected = (id: string) => {
|
|
177
|
+
return selecteds.value?.includes(id);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
onMounted(() => {
|
|
181
|
+
fetchUserOrganisation();
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
watch(() => organisationId.value, () => {
|
|
185
|
+
if (organisationId.value) {
|
|
186
|
+
getOrganisation(organisationId.value);
|
|
187
|
+
}
|
|
188
|
+
}, { immediate: true });
|
|
189
|
+
|
|
190
|
+
watch(() => props.dashboardOrganisationTypeFetchFilter, (next, previous) => {
|
|
191
|
+
if ((!next && !previous) || !_.isEqual(next, previous)) {
|
|
192
|
+
getManyDashboardOrganisationTypes(props.dashboardOrganisationTypeFetchFilter);
|
|
193
|
+
}
|
|
194
|
+
}, { immediate: true });
|
|
195
|
+
|
|
196
|
+
watch(() => props.dashboardOrganisationsFilters, (next, previous) => {
|
|
197
|
+
if ((!next && !previous) || !_.isEqual(next, previous)) {
|
|
198
|
+
getManyDashboardOrganisations(props.dashboardOrganisationsFilters);
|
|
199
|
+
}
|
|
200
|
+
}, { immediate: true });
|
|
201
|
+
|
|
202
|
+
watch(() => props.dashboardShallowsFilters, (next, previous) => {
|
|
203
|
+
if ((!next && !previous) || !_.isEqual(next, previous)) {
|
|
204
|
+
getManyDashboardShallows(props.dashboardShallowsFilters);
|
|
205
|
+
}
|
|
206
|
+
}, { immediate: true });
|
|
207
|
+
|
|
208
|
+
return {
|
|
209
|
+
fetchingDashboardOrganisationTypes,
|
|
210
|
+
fetchingDashboardOrganisations,
|
|
211
|
+
fetchingDashboardShallows,
|
|
212
|
+
selecteds,
|
|
213
|
+
items,
|
|
214
|
+
mainUserDashboardId,
|
|
215
|
+
mainOrganisationDashboardId,
|
|
216
|
+
onSelect,
|
|
217
|
+
isSelected,
|
|
218
|
+
DashboardType
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
</script>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSSimpleList
|
|
3
|
+
:items="dashboards"
|
|
4
|
+
:loading="fetching"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
/>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { defineComponent, type PropType, watch, computed } from "vue";
|
|
11
|
+
|
|
12
|
+
import type { DashboardOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
13
|
+
import { useDashboardOrganisations } from "@dative-gpi/foundation-core-services/composables";
|
|
14
|
+
import { useDashboardOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
|
|
15
|
+
|
|
16
|
+
import FSSimpleList from "@dative-gpi/foundation-shared-components/components/lists/FSSimpleList.vue";
|
|
17
|
+
|
|
18
|
+
export default defineComponent({
|
|
19
|
+
name: "FSSimpleDashboardsList",
|
|
20
|
+
components: {
|
|
21
|
+
FSSimpleList,
|
|
22
|
+
},
|
|
23
|
+
props: {
|
|
24
|
+
dashboardOrganisationFilters: {
|
|
25
|
+
type: Object as PropType<DashboardOrganisationFilters>,
|
|
26
|
+
required: false,
|
|
27
|
+
default: () => ({})
|
|
28
|
+
},
|
|
29
|
+
dashboardOrganisationTypeFilters: {
|
|
30
|
+
type: Object as PropType<DashboardOrganisationFilters>,
|
|
31
|
+
required: false,
|
|
32
|
+
default: () => ({})
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
setup(props){
|
|
36
|
+
const { entities: dashboardOrganisations,
|
|
37
|
+
getMany: getManyDashboardOrganisations,
|
|
38
|
+
fetching: fetchingDashboardOrganisations } = useDashboardOrganisations();
|
|
39
|
+
const { entities: dashboardOrganisationTypes,
|
|
40
|
+
getMany: getManyDashboardOrganisationTypes,
|
|
41
|
+
fetching: fetchingDashboardOrganisationTypes } = useDashboardOrganisationTypes();
|
|
42
|
+
|
|
43
|
+
const fetching = computed(() => fetchingDashboardOrganisations.value
|
|
44
|
+
|| fetchingDashboardOrganisationTypes.value);
|
|
45
|
+
|
|
46
|
+
const dashboards = computed(() => {
|
|
47
|
+
return [...dashboardOrganisations.value, ...dashboardOrganisationTypes.value];
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const fetch = () => {
|
|
51
|
+
getManyDashboardOrganisations(props.dashboardOrganisationFilters);
|
|
52
|
+
getManyDashboardOrganisationTypes(props.dashboardOrganisationTypeFilters);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
watch(() => [props.dashboardOrganisationFilters, props.dashboardOrganisationTypeFilters], fetch, { immediate: true });
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
dashboards,
|
|
59
|
+
fetching
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
</script>
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSDataTable
|
|
3
|
+
:items="deviceOrganisations"
|
|
4
|
+
:customSorts="customSorts"
|
|
5
|
+
:itemTo="$props.itemTo"
|
|
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
|
+
<template
|
|
21
|
+
#header.connectable-title
|
|
22
|
+
>
|
|
23
|
+
<FSIcon>
|
|
24
|
+
mdi-wifi
|
|
25
|
+
</FSIcon>
|
|
26
|
+
</template>
|
|
27
|
+
<template
|
|
28
|
+
#header.connectivity-title
|
|
29
|
+
>
|
|
30
|
+
<FSIcon>
|
|
31
|
+
mdi-wifi
|
|
32
|
+
</FSIcon>
|
|
33
|
+
</template>
|
|
34
|
+
<template
|
|
35
|
+
#item.imageId="{ item }"
|
|
36
|
+
>
|
|
37
|
+
<FSImage
|
|
38
|
+
v-if="item.imageId"
|
|
39
|
+
height="32px"
|
|
40
|
+
width="32px"
|
|
41
|
+
:imageId="item.imageId"
|
|
42
|
+
/>
|
|
43
|
+
</template>
|
|
44
|
+
<template
|
|
45
|
+
#item.connectable="{ item }"
|
|
46
|
+
>
|
|
47
|
+
<FSCol>
|
|
48
|
+
<FSConnectivity
|
|
49
|
+
v-if="item.connectivity.status != ConnectivityStatus.None"
|
|
50
|
+
:deviceConnectivity="item.connectivity"
|
|
51
|
+
/>
|
|
52
|
+
</FSCol>
|
|
53
|
+
</template>
|
|
54
|
+
<template
|
|
55
|
+
#item.connectivity="{ item }"
|
|
56
|
+
>
|
|
57
|
+
<FSCol>
|
|
58
|
+
<FSConnectivity
|
|
59
|
+
v-if="item.connectivity.status != ConnectivityStatus.None"
|
|
60
|
+
:deviceConnectivity="item.connectivity"
|
|
61
|
+
/>
|
|
62
|
+
</FSCol>
|
|
63
|
+
</template>
|
|
64
|
+
<template
|
|
65
|
+
#item.unrestricted="{ item }"
|
|
66
|
+
>
|
|
67
|
+
<FSIconCheck
|
|
68
|
+
:value="item.unrestricted"
|
|
69
|
+
/>
|
|
70
|
+
</template>
|
|
71
|
+
<template
|
|
72
|
+
#item.tags="{ item }"
|
|
73
|
+
>
|
|
74
|
+
<FSTagGroup
|
|
75
|
+
variant="slide"
|
|
76
|
+
:editable="false"
|
|
77
|
+
:tags="item.tags"
|
|
78
|
+
/>
|
|
79
|
+
</template>
|
|
80
|
+
<template
|
|
81
|
+
#item.worstAlert="{ item }"
|
|
82
|
+
>
|
|
83
|
+
<FSWorstAlert
|
|
84
|
+
:deviceAlerts="item.alerts"
|
|
85
|
+
:deviceAlert="item.worstAlert"
|
|
86
|
+
/>
|
|
87
|
+
</template>
|
|
88
|
+
<template
|
|
89
|
+
#item.alerts="{ item }"
|
|
90
|
+
>
|
|
91
|
+
<FSWorstAlert
|
|
92
|
+
:deviceAlerts="item.alerts.length"
|
|
93
|
+
:deviceAlert="item.worstAlert"
|
|
94
|
+
/>
|
|
95
|
+
</template>
|
|
96
|
+
<template
|
|
97
|
+
#item.status="{ item }"
|
|
98
|
+
>
|
|
99
|
+
<FSStatusesCarousel
|
|
100
|
+
:modelStatuses="item.modelStatuses"
|
|
101
|
+
:deviceStatuses="item.status.statuses"
|
|
102
|
+
/>
|
|
103
|
+
</template>
|
|
104
|
+
<template
|
|
105
|
+
#item.actions="{ item }"
|
|
106
|
+
>
|
|
107
|
+
<slot
|
|
108
|
+
name="actions"
|
|
109
|
+
v-bind="{ item }"
|
|
110
|
+
>
|
|
111
|
+
</slot>
|
|
112
|
+
</template>
|
|
113
|
+
<template
|
|
114
|
+
v-for="(property, index) in customProperties"
|
|
115
|
+
#[`item.meta.${property.code}`]="{ item }"
|
|
116
|
+
:key="index"
|
|
117
|
+
>
|
|
118
|
+
<FSMetaValue
|
|
119
|
+
:customProperty="property"
|
|
120
|
+
:meta="item.meta"
|
|
121
|
+
/>
|
|
122
|
+
</template>
|
|
123
|
+
|
|
124
|
+
<template
|
|
125
|
+
#item.tile="{ item, toggleSelect }"
|
|
126
|
+
>
|
|
127
|
+
<FSDeviceOrganisationTileUI
|
|
128
|
+
v-bind="item"
|
|
129
|
+
:modelValue="isSelected(item.id)"
|
|
130
|
+
:singleSelect="singleSelect"
|
|
131
|
+
:deviceStatuses="item.status.statuses"
|
|
132
|
+
:deviceConnectivity="item.connectivity"
|
|
133
|
+
:deviceWorstAlert="item.worstAlert"
|
|
134
|
+
:deviceAlerts="item.alerts"
|
|
135
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
136
|
+
@update:modelValue="toggleSelect(item)"
|
|
137
|
+
/>
|
|
138
|
+
</template>
|
|
139
|
+
</FSDataTable>
|
|
140
|
+
</template>
|
|
141
|
+
|
|
142
|
+
<script lang="ts">
|
|
143
|
+
import type { PropType} from "vue";
|
|
144
|
+
import type { RouteLocation } from "vue-router";
|
|
145
|
+
import { computed, defineComponent, onMounted, watch } from "vue";
|
|
146
|
+
import _ from "lodash";
|
|
147
|
+
|
|
148
|
+
import { alphanumericSort } from "@dative-gpi/foundation-shared-components/utils";
|
|
149
|
+
import { ConnectivityStatus, PropertyEntity } from "@dative-gpi/foundation-shared-domain/enums";
|
|
150
|
+
|
|
151
|
+
import { useCustomProperties, useDeviceOrganisations } from "@dative-gpi/foundation-core-services/composables";
|
|
152
|
+
import type { DeviceConnectivityDetails, DeviceOrganisationFilters, DeviceOrganisationInfos} from "@dative-gpi/foundation-core-domain/models";
|
|
153
|
+
|
|
154
|
+
import FSDataTable from "../FSDataTable.vue";
|
|
155
|
+
import FSMetaValue from "../../customProperties/FSMetaValue.vue";
|
|
156
|
+
|
|
157
|
+
import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
|
|
158
|
+
import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
|
|
159
|
+
import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
|
|
160
|
+
import FSWorstAlert from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSWorstAlert.vue";
|
|
161
|
+
import FSConnectivity from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSConnectivity.vue";
|
|
162
|
+
import FSStatusesCarousel from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSStatusesCarousel.vue";
|
|
163
|
+
import FSDeviceOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDeviceOrganisationTileUI.vue";
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
export default defineComponent({
|
|
167
|
+
name: "FSBaseDeviceOrganisationsList",
|
|
168
|
+
components: {
|
|
169
|
+
FSConnectivity,
|
|
170
|
+
FSDataTable,
|
|
171
|
+
FSDeviceOrganisationTileUI,
|
|
172
|
+
FSIconCheck,
|
|
173
|
+
FSImage,
|
|
174
|
+
FSMetaValue,
|
|
175
|
+
FSStatusesCarousel,
|
|
176
|
+
FSTagGroup,
|
|
177
|
+
FSWorstAlert
|
|
178
|
+
},
|
|
179
|
+
props: {
|
|
180
|
+
modelValue: {
|
|
181
|
+
type: Array as PropType<string[]>,
|
|
182
|
+
default: () => [],
|
|
183
|
+
required: false
|
|
184
|
+
},
|
|
185
|
+
deviceOrganisationFilters: {
|
|
186
|
+
type: Object as PropType<DeviceOrganisationFilters>,
|
|
187
|
+
required: false,
|
|
188
|
+
default: null
|
|
189
|
+
},
|
|
190
|
+
connectedOnly: {
|
|
191
|
+
type: Boolean,
|
|
192
|
+
required: false,
|
|
193
|
+
default: false
|
|
194
|
+
},
|
|
195
|
+
itemTo: {
|
|
196
|
+
type: Function as PropType<(item: DeviceOrganisationInfos) => Partial<RouteLocation>>,
|
|
197
|
+
required: false
|
|
198
|
+
},
|
|
199
|
+
singleSelect: {
|
|
200
|
+
type: Boolean,
|
|
201
|
+
required: false,
|
|
202
|
+
default: false
|
|
203
|
+
},
|
|
204
|
+
tableCode: {
|
|
205
|
+
type: String,
|
|
206
|
+
required: true
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
emits: ["update:modelValue"],
|
|
210
|
+
setup(props) {
|
|
211
|
+
const { fetching: fecthingCustomProperties, entities: customProperties, getMany: getManyCustomProperties } = useCustomProperties();
|
|
212
|
+
const { entities, fetching: fetchingDeviceOrganisations, getMany: getManyDeviceOrganisations } = useDeviceOrganisations();
|
|
213
|
+
|
|
214
|
+
const deviceOrganisations = computed((): DeviceOrganisationInfos[] => {
|
|
215
|
+
if (props.connectedOnly) {
|
|
216
|
+
return entities.value.filter(d => d.connectivity != null && d.connectivity.status != ConnectivityStatus.None);
|
|
217
|
+
}
|
|
218
|
+
return entities.value;
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
const customSorts = computed(() => {
|
|
222
|
+
return {
|
|
223
|
+
connectable: (a:DeviceConnectivityDetails, b:DeviceConnectivityDetails) => {
|
|
224
|
+
return alphanumericSort(a?.status, b?.status);
|
|
225
|
+
},
|
|
226
|
+
connectivity: (a:DeviceConnectivityDetails, b:DeviceConnectivityDetails) => {
|
|
227
|
+
return alphanumericSort(a?.status, b?.status);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
const isSelected = (id: string): boolean => {
|
|
233
|
+
return props.modelValue.includes(id);
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
onMounted((): void => {
|
|
237
|
+
getManyCustomProperties({
|
|
238
|
+
entities: [PropertyEntity.Device, PropertyEntity.DeviceOrganisation]
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
watch(() => props.deviceOrganisationFilters, (next, previous) => {
|
|
243
|
+
if ((!next && !previous) || !_.isEqual(next, previous)) {
|
|
244
|
+
getManyDeviceOrganisations(props.deviceOrganisationFilters);
|
|
245
|
+
}
|
|
246
|
+
}, { immediate: true });
|
|
247
|
+
|
|
248
|
+
return {
|
|
249
|
+
fetchingDeviceOrganisations,
|
|
250
|
+
fecthingCustomProperties,
|
|
251
|
+
deviceOrganisations,
|
|
252
|
+
ConnectivityStatus,
|
|
253
|
+
customProperties,
|
|
254
|
+
customSorts,
|
|
255
|
+
isSelected
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
</script>
|
|
260
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSSimpleList
|
|
3
|
+
:items="deviceOrganisations"
|
|
4
|
+
:loading="fetching"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
/>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { defineComponent, type PropType, watch } from "vue";
|
|
11
|
+
|
|
12
|
+
import type { DeviceOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
13
|
+
import { useDeviceOrganisations } from "@dative-gpi/foundation-core-services/composables";
|
|
14
|
+
|
|
15
|
+
import FSSimpleList from "@dative-gpi/foundation-shared-components/components/lists/FSSimpleList.vue";
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: "FSSimpleDeviceOrganisationsList",
|
|
19
|
+
components: {
|
|
20
|
+
FSSimpleList,
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
deviceOrganisationFilters: {
|
|
24
|
+
type: Object as PropType<DeviceOrganisationFilters>,
|
|
25
|
+
required: false,
|
|
26
|
+
default: () => ({})
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
setup(props){
|
|
30
|
+
const { entities: deviceOrganisations, getMany, fetching } = useDeviceOrganisations();
|
|
31
|
+
|
|
32
|
+
const fetch = () => {
|
|
33
|
+
getMany(props.deviceOrganisationFilters);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
watch(() => props.deviceOrganisationFilters, fetch, { immediate: true });
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
deviceOrganisations,
|
|
40
|
+
fetching
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
</script>
|