@dative-gpi/foundation-core-components 1.0.157 → 1.0.158-devices-latency-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/autocompletes/FSAutocompleteGrouping.vue +105 -0
- package/components/explorers/FSBaseDevicesExplorer.vue +13 -3
- package/components/explorers/FSBaseFoldersExplorer.vue +52 -4
- package/components/fields/FSMagicConfigField.vue +171 -0
- package/components/fields/FSMagicField.vue +197 -0
- package/components/lists/alerts/FSBaseAlertsList.vue +33 -2
- package/components/lists/charts/FSBaseChartsList.vue +23 -2
- package/components/lists/dashboards/FSBaseDashboardsList.vue +28 -2
- package/components/lists/groupings/FSBaseGroupingsList.vue +125 -0
- package/components/selects/FSPlotPerSelector.vue +129 -0
- package/components/tiles/FSFolderTile.vue +4 -2
- package/package.json +7 -7
- package/utils/dashboards.ts +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSAutocompleteField
|
|
3
|
+
:label="$props.label ?? $tr('ui.common.grouping', 'Grouping')"
|
|
4
|
+
:toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
5
|
+
:multiple="$props.multiple"
|
|
6
|
+
:placeholder="placeholder"
|
|
7
|
+
:loading="loading"
|
|
8
|
+
:items="groupings"
|
|
9
|
+
:modelValue="$props.modelValue"
|
|
10
|
+
@update:modelValue="onUpdate"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
>
|
|
13
|
+
<template
|
|
14
|
+
#item-prepend="{ item }"
|
|
15
|
+
>
|
|
16
|
+
<FSIcon
|
|
17
|
+
v-if="item.icon"
|
|
18
|
+
>
|
|
19
|
+
{{ item.icon }}
|
|
20
|
+
</FSIcon>
|
|
21
|
+
</template>
|
|
22
|
+
</FSAutocompleteField>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import { computed, defineComponent, type PropType } from "vue";
|
|
27
|
+
|
|
28
|
+
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
29
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
|
|
30
|
+
import { type GroupingFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
31
|
+
import { useGroupings } from "@dative-gpi/foundation-core-services/composables";
|
|
32
|
+
|
|
33
|
+
import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
|
|
34
|
+
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
35
|
+
|
|
36
|
+
export default defineComponent({
|
|
37
|
+
name: "FSAutocompleteGrouping",
|
|
38
|
+
components: {
|
|
39
|
+
FSAutocompleteField,
|
|
40
|
+
FSIcon
|
|
41
|
+
},
|
|
42
|
+
props: {
|
|
43
|
+
groupingFilters: {
|
|
44
|
+
type: Object as PropType<GroupingFilters>,
|
|
45
|
+
required: false,
|
|
46
|
+
default: null
|
|
47
|
+
},
|
|
48
|
+
modelValue: {
|
|
49
|
+
type: [Array, String] as PropType<string[] | string | null>,
|
|
50
|
+
required: false,
|
|
51
|
+
default: null
|
|
52
|
+
},
|
|
53
|
+
multiple: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
required: false,
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
58
|
+
toggleSetDisabled: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
required: false,
|
|
61
|
+
default: false
|
|
62
|
+
},
|
|
63
|
+
label: {
|
|
64
|
+
type: String as PropType<string | null>,
|
|
65
|
+
required: false,
|
|
66
|
+
default: null
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
emits: ["update:modelValue"],
|
|
70
|
+
setup(props, { emit }) {
|
|
71
|
+
const { getMany: getManyGroupings, fetching: fetchingGroupings, entities: groupings } = useGroupings();
|
|
72
|
+
const { $tr } = useTranslationsProvider();
|
|
73
|
+
|
|
74
|
+
const loading = computed((): boolean => {
|
|
75
|
+
return init.value && fetchingGroupings.value;
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
const placeholder = computed((): string | null => {
|
|
79
|
+
if (props.multiple && props.modelValue) {
|
|
80
|
+
return $tr("ui.autocomplete-grouping.placeholder", "{0} grouping(s) selected", props.modelValue.length);
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const fetch = (search: string | null) => {
|
|
86
|
+
return getManyGroupings({ ...props.groupingFilters, search: search ?? undefined });
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const { toggleSet, init, onUpdate } = useAutocomplete(
|
|
90
|
+
groupings,
|
|
91
|
+
[() => props.groupingFilters],
|
|
92
|
+
emit,
|
|
93
|
+
fetch
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
placeholder,
|
|
98
|
+
groupings,
|
|
99
|
+
toggleSet,
|
|
100
|
+
loading,
|
|
101
|
+
onUpdate
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
</script>
|
|
@@ -129,28 +129,38 @@
|
|
|
129
129
|
</template>
|
|
130
130
|
|
|
131
131
|
<template
|
|
132
|
-
#item.tile="{ item, toggleSelect }"
|
|
132
|
+
#item.tile="{ index, item, toggleSelect }"
|
|
133
133
|
>
|
|
134
134
|
<FSGroupTileUI
|
|
135
135
|
v-if="item.type === DeviceExplorerElementType.Group"
|
|
136
|
+
:key="index"
|
|
136
137
|
:to="$props.itemTo && $props.itemTo(item)"
|
|
138
|
+
:imageId="item.imageId"
|
|
139
|
+
:icon="item.icon"
|
|
140
|
+
:label="item.label"
|
|
141
|
+
:code="item.code"
|
|
142
|
+
:recursiveGroupsIds="item.recursiveGroupsIds"
|
|
143
|
+
:recursiveDeviceOrganisationsIds="item.recursiveDeviceOrganisationsIds"
|
|
137
144
|
:modelValue="isSelected(item.id)"
|
|
138
145
|
:selectable="$props.selectable"
|
|
139
146
|
@update:modelValue="toggleSelect(item)"
|
|
140
|
-
v-bind="item"
|
|
141
147
|
/>
|
|
142
148
|
<FSDeviceOrganisationTileUI
|
|
143
149
|
v-if="item.type === DeviceExplorerElementType.DeviceOrganisation"
|
|
150
|
+
:key="index"
|
|
144
151
|
:to="$props.itemTo && $props.itemTo(item)"
|
|
145
152
|
:deviceConnectivity="item.connectivity"
|
|
146
153
|
:deviceStatuses="item.status.statuses"
|
|
147
154
|
:deviceWorstAlert="item.worstAlert"
|
|
148
155
|
:deviceAlerts="item.alerts"
|
|
156
|
+
:imageId="item.imageId"
|
|
157
|
+
:label="item.label"
|
|
158
|
+
:code="item.code"
|
|
159
|
+
:modelStatuses="item.modelStatuses"
|
|
149
160
|
:alertTo="$props.alertTo"
|
|
150
161
|
:modelValue="isSelected(item.id)"
|
|
151
162
|
:selectable="$props.selectable"
|
|
152
163
|
@update:modelValue="toggleSelect(item)"
|
|
153
|
-
v-bind="item"
|
|
154
164
|
/>
|
|
155
165
|
</template>
|
|
156
166
|
</FSDataTable>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
:item-to="$props.itemTo"
|
|
6
6
|
:loading="fetchingFolders || fetchingDashboardOrganisations || fetchingDashboardShallows"
|
|
7
7
|
:tableCode="$props.tableCode"
|
|
8
|
+
:headersOptions="headersOptions"
|
|
8
9
|
:modelValue="selecteds"
|
|
9
10
|
:selectable="$props.selectable"
|
|
10
11
|
@update:modelValue="onSelect"
|
|
@@ -74,6 +75,20 @@
|
|
|
74
75
|
:tags="item.tags"
|
|
75
76
|
/>
|
|
76
77
|
</template>
|
|
78
|
+
<template
|
|
79
|
+
#item.dashboardType="{ item }"
|
|
80
|
+
>
|
|
81
|
+
<FSChip
|
|
82
|
+
v-if="item.type === FoldersListType.Dashboard"
|
|
83
|
+
:color="ColorEnum.Light"
|
|
84
|
+
:label="dashboardTypeLabel(item.dashboardType)"
|
|
85
|
+
/>
|
|
86
|
+
<FSChip
|
|
87
|
+
v-else-if="item.type === FoldersListType.Folder"
|
|
88
|
+
:color="ColorEnum.Light"
|
|
89
|
+
:label="$tr('ui.common.folder', 'Folder')"
|
|
90
|
+
/>
|
|
91
|
+
</template>
|
|
77
92
|
<template
|
|
78
93
|
#item.tile="{ item, toggleSelect }"
|
|
79
94
|
>
|
|
@@ -117,10 +132,11 @@ import { useOrganisation } from "@dative-gpi/foundation-shared-services/composab
|
|
|
117
132
|
import { useDashboardOrganisations, useFolders, useDashboardShallows, useAppOrganisationId, useCurrentUserOrganisation } from "@dative-gpi/foundation-core-services/composables";
|
|
118
133
|
|
|
119
134
|
import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
120
|
-
import { FoldersListType, type FoldersListItem } from "@dative-gpi/foundation-core-components/utils";
|
|
135
|
+
import { dashboardTypeLabel, FoldersListType, type FoldersListItem } from "@dative-gpi/foundation-core-components/utils";
|
|
121
136
|
import type { FolderFilters, DashboardOrganisationFilters, DashboardShallowFilters, DashboardInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
122
137
|
|
|
123
138
|
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
139
|
+
import FSChip from '@dative-gpi/foundation-shared-components/components/FSChip.vue';
|
|
124
140
|
import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
|
|
125
141
|
import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
|
|
126
142
|
import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
|
|
@@ -129,6 +145,8 @@ import FSDashboardShallowTileUI from "@dative-gpi/foundation-shared-components/c
|
|
|
129
145
|
import FSDashboardOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTileUI.vue";
|
|
130
146
|
|
|
131
147
|
import FSDataTable from "../lists/FSDataTable.vue";
|
|
148
|
+
import { ColorEnum } from '@dative-gpi/foundation-shared-components/models';
|
|
149
|
+
import { useTranslations } from '@dative-gpi/bones-ui';
|
|
132
150
|
|
|
133
151
|
export default defineComponent({
|
|
134
152
|
name: "FSBaseFoldersExplorer",
|
|
@@ -140,6 +158,7 @@ export default defineComponent({
|
|
|
140
158
|
FSIconCheck,
|
|
141
159
|
FSTagGroup,
|
|
142
160
|
FSImage,
|
|
161
|
+
FSChip,
|
|
143
162
|
FSIcon
|
|
144
163
|
},
|
|
145
164
|
props: {
|
|
@@ -179,7 +198,7 @@ export default defineComponent({
|
|
|
179
198
|
},
|
|
180
199
|
emits: ["update", "update:modelValue", "update:type", "update:dashboard-type"],
|
|
181
200
|
setup(props, { emit }) {
|
|
182
|
-
|
|
201
|
+
const { $tr } = useTranslations();
|
|
183
202
|
const { fetch: fetchUserOrganisation, entity: userOrganisation } = useCurrentUserOrganisation();
|
|
184
203
|
const { entity: organisation, get: getOrganisation } = useOrganisation();
|
|
185
204
|
const { organisationId } = useAppOrganisationId();
|
|
@@ -218,7 +237,33 @@ export default defineComponent({
|
|
|
218
237
|
})) as FoldersListItem[]
|
|
219
238
|
], d => d.label)
|
|
220
239
|
]
|
|
221
|
-
})
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
const headersOptions = computed(() => ({
|
|
243
|
+
dashboardType: {
|
|
244
|
+
fixedFilters: [
|
|
245
|
+
{
|
|
246
|
+
value: DashboardType.Organisation,
|
|
247
|
+
text: dashboardTypeLabel(DashboardType.Organisation)
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
value: DashboardType.Shallow,
|
|
251
|
+
text: dashboardTypeLabel(DashboardType.Shallow)
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
value: 10,
|
|
255
|
+
text: $tr("ui.common.folder", "Folder")
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
methodFilter: (value: number, dashboardType: DashboardType) => {
|
|
259
|
+
if(dashboardType !== DashboardType.None) {
|
|
260
|
+
return value === dashboardType;
|
|
261
|
+
} else {
|
|
262
|
+
return value === 10;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}));
|
|
222
267
|
|
|
223
268
|
const onSelect = (values: string[]) => {
|
|
224
269
|
selecteds.value = values;
|
|
@@ -274,12 +319,15 @@ export default defineComponent({
|
|
|
274
319
|
fetchingFolders,
|
|
275
320
|
mainOrganisationDashboardId,
|
|
276
321
|
mainUserDashboardId,
|
|
322
|
+
headersOptions,
|
|
323
|
+
ColorEnum,
|
|
277
324
|
selecteds,
|
|
278
325
|
items,
|
|
279
326
|
onSelect,
|
|
280
327
|
isSelected,
|
|
281
328
|
FoldersListType,
|
|
282
|
-
DashboardType
|
|
329
|
+
DashboardType,
|
|
330
|
+
dashboardTypeLabel
|
|
283
331
|
};
|
|
284
332
|
}
|
|
285
333
|
});
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSRow
|
|
3
|
+
class="fs-magic-config-field"
|
|
4
|
+
>
|
|
5
|
+
<component
|
|
6
|
+
v-if="$props.type"
|
|
7
|
+
class="fs-magic-config-field-value"
|
|
8
|
+
:is="get($props.type)"
|
|
9
|
+
:label="$tr('ui.common.value', 'Value')"
|
|
10
|
+
:disabled="$props.disabled"
|
|
11
|
+
:required="true"
|
|
12
|
+
:rules="rules"
|
|
13
|
+
:modelValue="valueToInput"
|
|
14
|
+
@update:modelValue="inputToValue"
|
|
15
|
+
/>
|
|
16
|
+
<FSRow
|
|
17
|
+
gap="24px"
|
|
18
|
+
>
|
|
19
|
+
<FSTranslateField
|
|
20
|
+
:label="$tr('entity.common.label', 'Label')"
|
|
21
|
+
:disabled="$props.disabled"
|
|
22
|
+
:modelValue="$props.labelDefault"
|
|
23
|
+
:translations="$props.translations"
|
|
24
|
+
@update:modelValue="$emit('update:labelDefault', $event)"
|
|
25
|
+
@update:translations="$emit('update:translations', $event)"
|
|
26
|
+
/>
|
|
27
|
+
<FSRow
|
|
28
|
+
class="fs-magic-config-field-actions"
|
|
29
|
+
width="hug"
|
|
30
|
+
:wrap="false"
|
|
31
|
+
>
|
|
32
|
+
<FSButtonRemoveIcon
|
|
33
|
+
@click="$emit('click:remove')"
|
|
34
|
+
/>
|
|
35
|
+
<FSButtonAddIcon
|
|
36
|
+
@click="$emit('click:add')"
|
|
37
|
+
/>
|
|
38
|
+
</FSRow>
|
|
39
|
+
</FSRow>
|
|
40
|
+
</FSRow>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script lang="ts">
|
|
44
|
+
import { computed, defineComponent, type PropType } from "vue";
|
|
45
|
+
|
|
46
|
+
import { DateRules, IconRules, NumberRules, TextRules, TimeRules, TimeStepRules, AutocompleteRules } from "@dative-gpi/foundation-shared-components/models";
|
|
47
|
+
import { useMagicFieldProvider } from "@dative-gpi/foundation-core-services/composables";
|
|
48
|
+
import { MagicFieldType } from "@dative-gpi/foundation-core-domain/models/magicFields";
|
|
49
|
+
|
|
50
|
+
import FSButtonRemoveIcon from "@dative-gpi/foundation-shared-components/components/buttons/FSButtonRemoveIcon.vue";
|
|
51
|
+
import FSButtonAddIcon from "@dative-gpi/foundation-shared-components/components/buttons/FSButtonAddIcon.vue";
|
|
52
|
+
import FSTranslateField from "@dative-gpi/foundation-shared-components/components/fields/FSTranslateField.vue";
|
|
53
|
+
import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
|
|
54
|
+
|
|
55
|
+
export default defineComponent({
|
|
56
|
+
name: "FSMagicConfigField",
|
|
57
|
+
components: {
|
|
58
|
+
FSButtonRemoveIcon,
|
|
59
|
+
FSTranslateField,
|
|
60
|
+
FSButtonAddIcon,
|
|
61
|
+
FSRow
|
|
62
|
+
},
|
|
63
|
+
props: {
|
|
64
|
+
type: {
|
|
65
|
+
type: Number as PropType<MagicFieldType>,
|
|
66
|
+
required: false,
|
|
67
|
+
default: MagicFieldType.TextField
|
|
68
|
+
},
|
|
69
|
+
labelDefault: {
|
|
70
|
+
type: String as PropType<string | null>,
|
|
71
|
+
required: false,
|
|
72
|
+
default: null
|
|
73
|
+
},
|
|
74
|
+
modelValue: {
|
|
75
|
+
type: String as PropType<string | null>,
|
|
76
|
+
required: false,
|
|
77
|
+
default: null
|
|
78
|
+
},
|
|
79
|
+
translations: {
|
|
80
|
+
type: Array as PropType<{ languageCode: string; label: string }[]>,
|
|
81
|
+
required: false,
|
|
82
|
+
default: () => []
|
|
83
|
+
},
|
|
84
|
+
disabled: {
|
|
85
|
+
type: Boolean,
|
|
86
|
+
required: false,
|
|
87
|
+
default: false
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
emits: ["click:remove", "click:add", "update:modelValue", "update:labelDefault", "update:translations"],
|
|
91
|
+
setup(props, { emit }) {
|
|
92
|
+
const { get } = useMagicFieldProvider();
|
|
93
|
+
|
|
94
|
+
const rules = computed((): Function[] => {
|
|
95
|
+
switch (props.type) {
|
|
96
|
+
case MagicFieldType.NumberField:
|
|
97
|
+
return [NumberRules.required()];
|
|
98
|
+
case MagicFieldType.TextField:
|
|
99
|
+
return [TextRules.required()];
|
|
100
|
+
case MagicFieldType.DateTimeField:
|
|
101
|
+
return [DateRules.required()];
|
|
102
|
+
case MagicFieldType.IconField:
|
|
103
|
+
return [IconRules.required()];
|
|
104
|
+
case MagicFieldType.TimeField:
|
|
105
|
+
return [TimeRules.required()];
|
|
106
|
+
case MagicFieldType.TimeStepField:
|
|
107
|
+
return [TimeStepRules.required()];
|
|
108
|
+
case MagicFieldType.PlotPerField:
|
|
109
|
+
return [AutocompleteRules.required()];
|
|
110
|
+
}
|
|
111
|
+
return [];
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
const valueToInput = computed((): any => {
|
|
115
|
+
if (!props.modelValue) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
switch (props.type) {
|
|
120
|
+
case MagicFieldType.NumberField:
|
|
121
|
+
case MagicFieldType.DateTimeField:
|
|
122
|
+
case MagicFieldType.TimeField:
|
|
123
|
+
if (isNaN(parseFloat(props.modelValue))) {
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
return parseFloat(props.modelValue);
|
|
127
|
+
case MagicFieldType.Switch:
|
|
128
|
+
return props.modelValue === "true";
|
|
129
|
+
case MagicFieldType.TimeStepField:
|
|
130
|
+
return JSON.parse(props.modelValue);
|
|
131
|
+
case MagicFieldType.PlotPerField:
|
|
132
|
+
return parseInt(props.modelValue);
|
|
133
|
+
default:
|
|
134
|
+
return props.modelValue;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const inputToValue = (value: any) => {
|
|
139
|
+
if (!value) {
|
|
140
|
+
emit("update:modelValue", null);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
switch (props.type) {
|
|
144
|
+
case MagicFieldType.NumberField:
|
|
145
|
+
case MagicFieldType.Switch:
|
|
146
|
+
case MagicFieldType.DateTimeField:
|
|
147
|
+
case MagicFieldType.TimeField:
|
|
148
|
+
emit("update:modelValue", value.toString());
|
|
149
|
+
break;
|
|
150
|
+
case MagicFieldType.TimeStepField:
|
|
151
|
+
emit("update:modelValue", JSON.stringify(value));
|
|
152
|
+
break;
|
|
153
|
+
case MagicFieldType.PlotPerField:
|
|
154
|
+
emit("update:modelValue", value.toString());
|
|
155
|
+
break;
|
|
156
|
+
default:
|
|
157
|
+
emit("update:modelValue", value);
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
MagicFieldType,
|
|
164
|
+
valueToInput,
|
|
165
|
+
rules,
|
|
166
|
+
inputToValue,
|
|
167
|
+
get
|
|
168
|
+
};
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
</script>
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
v-if="!$props.useOnlyAllowedValues"
|
|
4
|
+
:is="get($props.type)"
|
|
5
|
+
:modelValue="valueToInput"
|
|
6
|
+
@update:modelValue="inputToValue"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
/>
|
|
9
|
+
<FSSelectField
|
|
10
|
+
v-else
|
|
11
|
+
itemValue="value"
|
|
12
|
+
:items="items"
|
|
13
|
+
:modelValue="$props.modelValue"
|
|
14
|
+
@update:modelValue="$emit('update:modelValue', $event)"
|
|
15
|
+
v-bind="$attrs"
|
|
16
|
+
>
|
|
17
|
+
<template
|
|
18
|
+
v-if="$props.type === MagicFieldType.IconField"
|
|
19
|
+
#selection="{ item }"
|
|
20
|
+
>
|
|
21
|
+
<FSRow
|
|
22
|
+
align="center-center"
|
|
23
|
+
:wrap="false"
|
|
24
|
+
>
|
|
25
|
+
<FSIcon
|
|
26
|
+
v-if="item.raw.value"
|
|
27
|
+
>
|
|
28
|
+
{{ item.raw.value }}
|
|
29
|
+
</FSIcon>
|
|
30
|
+
<FSSpan
|
|
31
|
+
v-if="item.raw.value !== item.raw.label"
|
|
32
|
+
>
|
|
33
|
+
{{ item.raw.label }}
|
|
34
|
+
</FSSpan>
|
|
35
|
+
</FSRow>
|
|
36
|
+
</template>
|
|
37
|
+
<template
|
|
38
|
+
v-if="$props.type === MagicFieldType.IconField"
|
|
39
|
+
#item-label="{ item }"
|
|
40
|
+
>
|
|
41
|
+
<FSRow
|
|
42
|
+
align="center-center"
|
|
43
|
+
:wrap="false"
|
|
44
|
+
>
|
|
45
|
+
<FSIcon
|
|
46
|
+
v-if="item.raw.value"
|
|
47
|
+
>
|
|
48
|
+
{{ item.raw.value }}
|
|
49
|
+
</FSIcon>
|
|
50
|
+
<FSSpan
|
|
51
|
+
v-if="item.raw.value !== item.raw.label"
|
|
52
|
+
>
|
|
53
|
+
{{ item.raw.label }}
|
|
54
|
+
</FSSpan>
|
|
55
|
+
</FSRow>
|
|
56
|
+
</template>
|
|
57
|
+
</FSSelectField>
|
|
58
|
+
</template>
|
|
59
|
+
|
|
60
|
+
<script lang="ts">
|
|
61
|
+
import { computed, defineComponent, type PropType } from "vue";
|
|
62
|
+
|
|
63
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
64
|
+
|
|
65
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
66
|
+
|
|
67
|
+
import { useMagicFieldProvider } from "@dative-gpi/foundation-core-services/composables";
|
|
68
|
+
import { MagicFieldType } from "@dative-gpi/foundation-core-domain/models";
|
|
69
|
+
import { getTimeBestString, timeStepToString } from "@dative-gpi/foundation-shared-components/utils";
|
|
70
|
+
|
|
71
|
+
import FSSelectField from "@dative-gpi/foundation-shared-components/components/fields/FSSelectField.vue";
|
|
72
|
+
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
73
|
+
import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
|
|
74
|
+
import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
|
|
75
|
+
|
|
76
|
+
export default defineComponent({
|
|
77
|
+
name: "FSMagicField",
|
|
78
|
+
components: {
|
|
79
|
+
FSSelectField,
|
|
80
|
+
FSIcon,
|
|
81
|
+
FSSpan,
|
|
82
|
+
FSRow
|
|
83
|
+
},
|
|
84
|
+
props: {
|
|
85
|
+
type: {
|
|
86
|
+
type: Number as PropType<MagicFieldType>,
|
|
87
|
+
required: false,
|
|
88
|
+
default: MagicFieldType.TextField
|
|
89
|
+
},
|
|
90
|
+
modelValue: {
|
|
91
|
+
type: String as PropType<string | null>,
|
|
92
|
+
required: false,
|
|
93
|
+
default: null
|
|
94
|
+
},
|
|
95
|
+
allowedValues: {
|
|
96
|
+
type: Array as PropType<{ value: string; label: string }[]>,
|
|
97
|
+
required: false,
|
|
98
|
+
default: () => []
|
|
99
|
+
},
|
|
100
|
+
useOnlyAllowedValues: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
required: false,
|
|
103
|
+
default: false
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
emits: ["update:modelValue"],
|
|
107
|
+
setup(props, { emit }) {
|
|
108
|
+
const { epochToShortTimeFormat } = useDateFormat();
|
|
109
|
+
const { $tr } = useTranslationsProvider();
|
|
110
|
+
const { get } = useMagicFieldProvider();
|
|
111
|
+
|
|
112
|
+
const items = computed(() => props.allowedValues.map((av) => ({
|
|
113
|
+
value: av.value,
|
|
114
|
+
label: av.label || asString(av.value),
|
|
115
|
+
})));
|
|
116
|
+
|
|
117
|
+
const valueToInput = computed((): any => {
|
|
118
|
+
if (props.modelValue == null) {
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
switch (props.type) {
|
|
123
|
+
case MagicFieldType.NumberField:
|
|
124
|
+
case MagicFieldType.DateTimeField:
|
|
125
|
+
case MagicFieldType.TimeField:
|
|
126
|
+
if (isNaN(parseFloat(props.modelValue))) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
return parseFloat(props.modelValue);
|
|
130
|
+
case MagicFieldType.Switch:
|
|
131
|
+
return props.modelValue === "true";
|
|
132
|
+
case MagicFieldType.TimeStepField:
|
|
133
|
+
case MagicFieldType.PlotPerField:
|
|
134
|
+
return JSON.parse(props.modelValue);
|
|
135
|
+
default:
|
|
136
|
+
return props.modelValue;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
const asString = (value: string): string | null => {
|
|
141
|
+
if (value == null) {
|
|
142
|
+
return "";
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
switch (props.type) {
|
|
146
|
+
case MagicFieldType.NumberField:
|
|
147
|
+
return value.toString();
|
|
148
|
+
case MagicFieldType.Switch:
|
|
149
|
+
if (value) {
|
|
150
|
+
return $tr("magic-field.true", "True");
|
|
151
|
+
}
|
|
152
|
+
return $tr("magic-field.false", "False");
|
|
153
|
+
case MagicFieldType.DateTimeField:
|
|
154
|
+
return epochToShortTimeFormat(parseFloat(value));
|
|
155
|
+
case MagicFieldType.TimeField:
|
|
156
|
+
return getTimeBestString(parseFloat(value));
|
|
157
|
+
case MagicFieldType.TimeStepField:
|
|
158
|
+
return timeStepToString(JSON.parse(value));
|
|
159
|
+
case MagicFieldType.PlotPerField:
|
|
160
|
+
return JSON.parse(value).plotPer;
|
|
161
|
+
default:
|
|
162
|
+
return value;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const inputToValue = (value: any) => {
|
|
167
|
+
if (value == null) {
|
|
168
|
+
emit("update:modelValue", null);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
switch (props.type) {
|
|
172
|
+
case MagicFieldType.NumberField:
|
|
173
|
+
case MagicFieldType.Switch:
|
|
174
|
+
case MagicFieldType.DateTimeField:
|
|
175
|
+
case MagicFieldType.TimeField:
|
|
176
|
+
emit("update:modelValue", value.toString());
|
|
177
|
+
break;
|
|
178
|
+
case MagicFieldType.TimeStepField:
|
|
179
|
+
case MagicFieldType.PlotPerField:
|
|
180
|
+
emit("update:modelValue", JSON.stringify(value));
|
|
181
|
+
break;
|
|
182
|
+
default:
|
|
183
|
+
emit("update:modelValue", value);
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
return {
|
|
189
|
+
MagicFieldType,
|
|
190
|
+
valueToInput,
|
|
191
|
+
items,
|
|
192
|
+
inputToValue,
|
|
193
|
+
get
|
|
194
|
+
};
|
|
195
|
+
},
|
|
196
|
+
});
|
|
197
|
+
</script>
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
:itemTo="$props.itemTo"
|
|
6
6
|
:items="alertsOrdered"
|
|
7
7
|
:loading="fetchingAlerts"
|
|
8
|
+
:headersOptions="headersOptions"
|
|
8
9
|
:tableCode="$props.tableCode"
|
|
9
10
|
:modelValue="$props.modelValue"
|
|
10
11
|
:selectable="$props.selectable"
|
|
@@ -194,11 +195,14 @@ import type { RouteLocation } from "vue-router";
|
|
|
194
195
|
import { computed, defineComponent, watch } from "vue";
|
|
195
196
|
import _ from "lodash";
|
|
196
197
|
|
|
198
|
+
import { useTranslations } from "@dative-gpi/bones-ui";
|
|
199
|
+
|
|
197
200
|
import type { AlertFilters, AlertInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
198
201
|
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
202
|
+
import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
|
|
199
203
|
import { useAlerts } from "@dative-gpi/foundation-core-services/composables";
|
|
200
204
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
201
|
-
import
|
|
205
|
+
import { Criticity } from "@dative-gpi/foundation-shared-domain/enums";
|
|
202
206
|
import { AlertStatus } from "@dative-gpi/foundation-shared-domain/enums";
|
|
203
207
|
|
|
204
208
|
import { AlertTools } from "@dative-gpi/foundation-shared-components/tools";
|
|
@@ -212,6 +216,7 @@ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage
|
|
|
212
216
|
import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
|
|
213
217
|
import FSAlertTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSAlertTileUI.vue";
|
|
214
218
|
|
|
219
|
+
|
|
215
220
|
export default defineComponent({
|
|
216
221
|
name: "FSBaseAlertsList",
|
|
217
222
|
components: {
|
|
@@ -265,6 +270,7 @@ export default defineComponent({
|
|
|
265
270
|
},
|
|
266
271
|
emits: ["update:modelValue"],
|
|
267
272
|
setup(props) {
|
|
273
|
+
const { $tr } = useTranslations();
|
|
268
274
|
const { getMany: getManyAlerts, entities: alerts, fetching : fetchingAlerts } = useAlerts();
|
|
269
275
|
const { epochToShortTimeFormat } = useDateFormat();
|
|
270
276
|
|
|
@@ -289,12 +295,36 @@ export default defineComponent({
|
|
|
289
295
|
});
|
|
290
296
|
});
|
|
291
297
|
|
|
298
|
+
const headersOptions = computed(() => ({
|
|
299
|
+
currentStatus: {
|
|
300
|
+
fixedFilters: getEnumEntries(AlertStatus).map(e => ({
|
|
301
|
+
value: e.value,
|
|
302
|
+
text: AlertTools.statusLabel(e.value)
|
|
303
|
+
})),
|
|
304
|
+
methodFilter: (value: AlertStatus, item: AlertStatus) => value == item
|
|
305
|
+
},
|
|
306
|
+
criticity: {
|
|
307
|
+
fixedFilters: getEnumEntries(Criticity).map(e => ({
|
|
308
|
+
value: e.value,
|
|
309
|
+
text: AlertTools.criticityLabel(e.value)
|
|
310
|
+
})),
|
|
311
|
+
methodFilter: (value: Criticity, item: Criticity) => value == item
|
|
312
|
+
},
|
|
313
|
+
acknowledged: {
|
|
314
|
+
fixedFilters: [
|
|
315
|
+
{ value: true, text: $tr('entity.alert.acknowledged', 'Acknowledged') },
|
|
316
|
+
{ value: false, text: $tr('ui.alert.not-acknowledged', 'Not acknowledged') }
|
|
317
|
+
],
|
|
318
|
+
methodFilter: (value: boolean, item: boolean) => value === item
|
|
319
|
+
},
|
|
320
|
+
}));
|
|
321
|
+
|
|
292
322
|
watch([() => props.alertFilters, () => props.notAcknowledged, () => props.hidePending], (next, previous) => {
|
|
293
323
|
if (!_.isEqual(next, previous)) {
|
|
294
324
|
getManyAlerts({
|
|
295
325
|
...props.alertFilters,
|
|
296
326
|
acknowledged: props.notAcknowledged ? false : undefined,
|
|
297
|
-
statuses: props.hidePending ? [AlertStatus.Unresolved, AlertStatus.Triggered, AlertStatus.Resolved, AlertStatus.
|
|
327
|
+
statuses: props.hidePending ? [AlertStatus.Unresolved, AlertStatus.Triggered, AlertStatus.Resolved, AlertStatus.Abandoned] : undefined
|
|
298
328
|
});
|
|
299
329
|
}
|
|
300
330
|
}, { immediate: true });
|
|
@@ -302,6 +332,7 @@ export default defineComponent({
|
|
|
302
332
|
|
|
303
333
|
return {
|
|
304
334
|
fetchingAlerts,
|
|
335
|
+
headersOptions,
|
|
305
336
|
alertsOrdered,
|
|
306
337
|
AlertTools,
|
|
307
338
|
ColorEnum,
|
|
@@ -76,6 +76,14 @@
|
|
|
76
76
|
:tags="item.modelsLabels.map((d: any) => d.label)"
|
|
77
77
|
/>
|
|
78
78
|
</template>
|
|
79
|
+
<template
|
|
80
|
+
#item.scope="{ item }"
|
|
81
|
+
>
|
|
82
|
+
<FSChip
|
|
83
|
+
:label="applicationScopeLabel(item.scope)"
|
|
84
|
+
:color="ColorEnum.Light"
|
|
85
|
+
/>
|
|
86
|
+
</template>
|
|
79
87
|
<template
|
|
80
88
|
#item.tile="{ item }"
|
|
81
89
|
>
|
|
@@ -99,10 +107,10 @@
|
|
|
99
107
|
import { defineComponent, type PropType, watch, computed } from "vue";
|
|
100
108
|
import _ from "lodash";
|
|
101
109
|
|
|
102
|
-
import {
|
|
110
|
+
import { chartTypeLabel, chartIcon, applicationScopeLabel } from "@dative-gpi/foundation-shared-components/tools";
|
|
111
|
+
import { ChartOrigin, ChartType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
103
112
|
import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
|
|
104
113
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
105
|
-
import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
|
|
106
114
|
|
|
107
115
|
import type { ChartModelLabel, ChartOrganisationFilters, ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
108
116
|
import { useChartOrganisations, useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
|
|
@@ -111,6 +119,8 @@ import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/t
|
|
|
111
119
|
import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
|
|
112
120
|
import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
|
|
113
121
|
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
122
|
+
import FSChip from '@dative-gpi/foundation-shared-components/components/FSChip.vue';
|
|
123
|
+
import FSText from '@dative-gpi/foundation-shared-components/components/FSText.vue';
|
|
114
124
|
import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
|
|
115
125
|
|
|
116
126
|
import FSDataTable from "../FSDataTable.vue";
|
|
@@ -122,6 +132,8 @@ export default defineComponent({
|
|
|
122
132
|
FSDataTable,
|
|
123
133
|
FSTagGroup,
|
|
124
134
|
FSImage,
|
|
135
|
+
FSText,
|
|
136
|
+
FSChip,
|
|
125
137
|
FSIcon,
|
|
126
138
|
FSRow
|
|
127
139
|
},
|
|
@@ -229,7 +241,15 @@ export default defineComponent({
|
|
|
229
241
|
text: chartTypeLabel(e.value)
|
|
230
242
|
})),
|
|
231
243
|
methodFilter: (value: ChartType, item: ChartType) => value == item
|
|
244
|
+
},
|
|
245
|
+
scope: {
|
|
246
|
+
fixedFilters: getEnumEntries(ChartOrigin).filter(e => e.value != ChartOrigin.None).map(e => ({
|
|
247
|
+
value: e.value,
|
|
248
|
+
text: applicationScopeLabel(e.value)
|
|
249
|
+
})),
|
|
250
|
+
methodFilter: (value: ChartOrigin, item: ChartOrigin) => value == item
|
|
232
251
|
}
|
|
252
|
+
|
|
233
253
|
}));
|
|
234
254
|
|
|
235
255
|
const update = (value : string) => {
|
|
@@ -274,6 +294,7 @@ export default defineComponent({
|
|
|
274
294
|
headersOptions,
|
|
275
295
|
ColorEnum,
|
|
276
296
|
charts,
|
|
297
|
+
applicationScopeLabel,
|
|
277
298
|
chartTypeLabel,
|
|
278
299
|
isSelected,
|
|
279
300
|
chartIcon,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
defaultMode="iterator"
|
|
4
4
|
:items="items"
|
|
5
5
|
:itemTo="$props.itemTo"
|
|
6
|
+
:headersOptions="headersOptions"
|
|
6
7
|
:loading="fetchingDashboardOrganisationTypes || fetchingDashboardOrganisations || fetchingDashboardShallows"
|
|
7
8
|
:tableCode="$props.tableCode"
|
|
8
9
|
:selectable="$props.selectable"
|
|
@@ -27,6 +28,14 @@
|
|
|
27
28
|
{{ item.icon }}
|
|
28
29
|
</FSIcon>
|
|
29
30
|
</template>
|
|
31
|
+
<template
|
|
32
|
+
#item.dashboardType="{ item }"
|
|
33
|
+
>
|
|
34
|
+
<FSChip
|
|
35
|
+
:color="ColorEnum.Light"
|
|
36
|
+
:label="dashboardTypeLabel(item.dashboardType)"
|
|
37
|
+
/>
|
|
38
|
+
</template>
|
|
30
39
|
<template
|
|
31
40
|
#item.main="{ item }"
|
|
32
41
|
>
|
|
@@ -96,8 +105,10 @@ import { useAppOrganisationId, useCurrentUserOrganisation, useDashboardOrganisat
|
|
|
96
105
|
import type { DashboardOrganisationTypeFilters, DashboardOrganisationFilters, DashboardShallowFilters, DashboardInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
97
106
|
import { useOrganisation } from "@dative-gpi/foundation-shared-services/composables";
|
|
98
107
|
|
|
99
|
-
import type
|
|
108
|
+
import { dashboardTypeLabel, type DashboardsListItem } from "@dative-gpi/foundation-core-components/utils";
|
|
109
|
+
import { ColorEnum } from '@dative-gpi/foundation-shared-components/models';
|
|
100
110
|
import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
111
|
+
import { getEnumEntries } from '@dative-gpi/foundation-shared-domain';
|
|
101
112
|
|
|
102
113
|
import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
|
|
103
114
|
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
@@ -106,12 +117,14 @@ import FSDashboardOrganisationTileUI from "@dative-gpi/foundation-shared-compone
|
|
|
106
117
|
import FSDashboardOrganisationTypeTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTypeTileUI.vue";
|
|
107
118
|
|
|
108
119
|
import FSDataTable from "../FSDataTable.vue";
|
|
120
|
+
import FSChip from '@dative-gpi/foundation-shared-components/components/FSChip.vue';
|
|
109
121
|
|
|
110
122
|
export default defineComponent({
|
|
111
123
|
name: "FSBaseDashboardsList",
|
|
112
124
|
components: {
|
|
113
125
|
FSDataTable,
|
|
114
126
|
FSTagGroup,
|
|
127
|
+
FSChip,
|
|
115
128
|
FSIcon,
|
|
116
129
|
FSDashboardOrganisationTileUI,
|
|
117
130
|
FSDashboardOrganisationTypeTileUI,
|
|
@@ -186,6 +199,16 @@ export default defineComponent({
|
|
|
186
199
|
], d => d.label);
|
|
187
200
|
});
|
|
188
201
|
|
|
202
|
+
const headersOptions = computed(() => ({
|
|
203
|
+
dashboardType: {
|
|
204
|
+
fixedFilters: getEnumEntries(DashboardType).filter(e => e.value != DashboardType.None).map(e => ({
|
|
205
|
+
value: e.value,
|
|
206
|
+
text: dashboardTypeLabel(e.value)
|
|
207
|
+
})),
|
|
208
|
+
methodFilter: (value: DashboardType, item: DashboardType) => value == item
|
|
209
|
+
}
|
|
210
|
+
}));
|
|
211
|
+
|
|
189
212
|
const mainUserDashboardId = computed(() => {
|
|
190
213
|
return userOrganisation.value?.mainDashboardId;
|
|
191
214
|
});
|
|
@@ -240,13 +263,16 @@ export default defineComponent({
|
|
|
240
263
|
fetchingDashboardOrganisationTypes,
|
|
241
264
|
fetchingDashboardOrganisations,
|
|
242
265
|
fetchingDashboardShallows,
|
|
266
|
+
headersOptions,
|
|
243
267
|
selecteds,
|
|
268
|
+
ColorEnum,
|
|
244
269
|
items,
|
|
245
270
|
mainUserDashboardId,
|
|
246
271
|
mainOrganisationDashboardId,
|
|
247
272
|
onSelect,
|
|
248
273
|
isSelected,
|
|
249
|
-
DashboardType
|
|
274
|
+
DashboardType,
|
|
275
|
+
dashboardTypeLabel
|
|
250
276
|
};
|
|
251
277
|
}
|
|
252
278
|
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSDataTable
|
|
3
|
+
defaultMode="iterator"
|
|
4
|
+
:loading="fetchingGroupings"
|
|
5
|
+
:items="groupings"
|
|
6
|
+
:itemTo="$props.itemTo"
|
|
7
|
+
:selectable="$props.selectable"
|
|
8
|
+
:showSearch="$props.showSearch"
|
|
9
|
+
:singleSelect="$props.singleSelect"
|
|
10
|
+
:disableTable="$props.disableTable"
|
|
11
|
+
:modelValue="$props.modelValue"
|
|
12
|
+
@update:modelValue="$emit('update:modelValue', $event)"
|
|
13
|
+
v-bind="$attrs"
|
|
14
|
+
>
|
|
15
|
+
<template
|
|
16
|
+
v-for="(_, name) in $slots"
|
|
17
|
+
v-slot:[name]="slotData"
|
|
18
|
+
>
|
|
19
|
+
<slot
|
|
20
|
+
:name="name"
|
|
21
|
+
v-bind="slotData"
|
|
22
|
+
/>
|
|
23
|
+
</template>
|
|
24
|
+
<template
|
|
25
|
+
#item.icon="{ item }"
|
|
26
|
+
>
|
|
27
|
+
<FSIcon>
|
|
28
|
+
{{ item.icon }}
|
|
29
|
+
</FSIcon>
|
|
30
|
+
</template>
|
|
31
|
+
<template
|
|
32
|
+
#item.tile="{ item, toggleSelect }"
|
|
33
|
+
>
|
|
34
|
+
<FSGroupingTileUI
|
|
35
|
+
:selectable="$props.selectable"
|
|
36
|
+
:modelValue="isSelected(item.id)"
|
|
37
|
+
:singleSelect="$props.singleSelect"
|
|
38
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
39
|
+
@update:modelValue="toggleSelect(item)"
|
|
40
|
+
v-bind="item"
|
|
41
|
+
/>
|
|
42
|
+
</template>
|
|
43
|
+
</FSDataTable>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script lang="ts">
|
|
47
|
+
import { defineComponent, watch } from "vue";
|
|
48
|
+
import { type RouteLocation } from "vue-router";
|
|
49
|
+
import type { PropType} from "vue";
|
|
50
|
+
import _ from "lodash";
|
|
51
|
+
|
|
52
|
+
import type { GroupingFilters, GroupingInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
53
|
+
import { useGroupings } from "@dative-gpi/foundation-core-services/composables";
|
|
54
|
+
|
|
55
|
+
import FSDataTable from "../FSDataTable.vue";
|
|
56
|
+
|
|
57
|
+
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
58
|
+
import FSGroupingTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSGroupingTileUI.vue";
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
export default defineComponent({
|
|
62
|
+
name: "FSBaseGroupingsList",
|
|
63
|
+
components: {
|
|
64
|
+
FSDataTable,
|
|
65
|
+
FSIcon,
|
|
66
|
+
FSGroupingTileUI
|
|
67
|
+
},
|
|
68
|
+
props: {
|
|
69
|
+
itemTo: {
|
|
70
|
+
type: Function as PropType<(item: GroupingInfos) => Partial<RouteLocation>>,
|
|
71
|
+
required: false
|
|
72
|
+
},
|
|
73
|
+
groupingsFilters: {
|
|
74
|
+
type: Object as PropType<GroupingFilters>,
|
|
75
|
+
required: false,
|
|
76
|
+
default: null
|
|
77
|
+
},
|
|
78
|
+
selectable: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
required: false,
|
|
81
|
+
default: false
|
|
82
|
+
},
|
|
83
|
+
singleSelect: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
required: false,
|
|
86
|
+
default: false
|
|
87
|
+
},
|
|
88
|
+
modelValue: {
|
|
89
|
+
type: Array as PropType<string[]>,
|
|
90
|
+
required: false,
|
|
91
|
+
default: () => []
|
|
92
|
+
},
|
|
93
|
+
showSearch: {
|
|
94
|
+
type: Boolean,
|
|
95
|
+
required: false,
|
|
96
|
+
default: false
|
|
97
|
+
},
|
|
98
|
+
disableTable: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
required: false,
|
|
101
|
+
default: true
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
emits: ["update:modelValue"],
|
|
105
|
+
setup(props) {
|
|
106
|
+
const { getMany: fetchGroupings, fetching: fetchingGroupings, entities: groupings } = useGroupings();
|
|
107
|
+
|
|
108
|
+
const isSelected = (id: string) => {
|
|
109
|
+
return props.modelValue.includes(id);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
watch(() => props.groupingsFilters, (next, previous) => {
|
|
113
|
+
if ((!next && !previous) || !_.isEqual(next, previous)) {
|
|
114
|
+
fetchGroupings(props.groupingsFilters);
|
|
115
|
+
}
|
|
116
|
+
}, { immediate: true });
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
fetchingGroupings,
|
|
120
|
+
groupings,
|
|
121
|
+
isSelected
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
</script>
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSRow
|
|
3
|
+
v-bind="$attrs"
|
|
4
|
+
>
|
|
5
|
+
<FSAutocompleteField
|
|
6
|
+
v-if="$props.showSelector"
|
|
7
|
+
:hideHeader="$props.hideHeader"
|
|
8
|
+
:clearable="$props.clearable"
|
|
9
|
+
:label="label ?? $tr('ui.common.plot-per','Plot per')"
|
|
10
|
+
:items="plotPerItems"
|
|
11
|
+
v-bind="$props.plotPerSelectorProps"
|
|
12
|
+
v-model="actualPlotPer"
|
|
13
|
+
/>
|
|
14
|
+
<FSAutocompleteGrouping
|
|
15
|
+
v-if="actualPlotPer === PlotPer.Grouping && showGroupingAutocomplete"
|
|
16
|
+
:hideHeader="$props.hideHeader"
|
|
17
|
+
:clearable="$props.clearable"
|
|
18
|
+
:toggleSetDisabled="true"
|
|
19
|
+
v-bind="$props.groupingAutocompleteProps"
|
|
20
|
+
v-model="actualGroupingId"
|
|
21
|
+
/>
|
|
22
|
+
</FSRow>
|
|
23
|
+
</template>
|
|
24
|
+
|
|
25
|
+
<script lang="ts">
|
|
26
|
+
import { computed, defineComponent, ref, watch, type PropType } from "vue";
|
|
27
|
+
|
|
28
|
+
import { PlotPer } from "@dative-gpi/foundation-shared-domain/enums";
|
|
29
|
+
|
|
30
|
+
import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
|
|
31
|
+
import { plotPerLabel } from "@dative-gpi/foundation-shared-components/tools";
|
|
32
|
+
|
|
33
|
+
import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
|
|
34
|
+
import FSAutocompleteGrouping from "@dative-gpi/foundation-core-components/components/autocompletes/FSAutocompleteGrouping.vue";
|
|
35
|
+
|
|
36
|
+
export default defineComponent({
|
|
37
|
+
components: {
|
|
38
|
+
FSAutocompleteField,
|
|
39
|
+
FSAutocompleteGrouping
|
|
40
|
+
},
|
|
41
|
+
props: {
|
|
42
|
+
modelValue: {
|
|
43
|
+
type: Object as PropType<{ plotPer: PlotPer, groupingId: string | null }>,
|
|
44
|
+
required: false,
|
|
45
|
+
default: () => ({ plotPer: PlotPer.None, groupingId: null })
|
|
46
|
+
},
|
|
47
|
+
allowedPlotPers: {
|
|
48
|
+
type: Array as PropType<PlotPer[]>,
|
|
49
|
+
required: false,
|
|
50
|
+
default: null
|
|
51
|
+
},
|
|
52
|
+
plotPerSelectorProps: {
|
|
53
|
+
type: Object as PropType<Record<string, any>>,
|
|
54
|
+
required: false,
|
|
55
|
+
default: () => ({})
|
|
56
|
+
},
|
|
57
|
+
groupingAutocompleteProps: {
|
|
58
|
+
type: Object as PropType<Record<string, any>>,
|
|
59
|
+
required: false,
|
|
60
|
+
default: () => ({})
|
|
61
|
+
},
|
|
62
|
+
label: {
|
|
63
|
+
type: String,
|
|
64
|
+
required: false
|
|
65
|
+
},
|
|
66
|
+
hideHeader: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
required: false,
|
|
69
|
+
default: false
|
|
70
|
+
},
|
|
71
|
+
clearable: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
required: false,
|
|
74
|
+
default: false
|
|
75
|
+
},
|
|
76
|
+
showSelector: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
required: false,
|
|
79
|
+
default: true
|
|
80
|
+
},
|
|
81
|
+
showGroupingAutocomplete: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
required: false,
|
|
84
|
+
default: true
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
emits: ['update:modelValue'],
|
|
88
|
+
setup(props, { emit }) {
|
|
89
|
+
const actualPlotPer = ref(PlotPer.None);
|
|
90
|
+
const actualGroupingId = ref<string | null>(null)
|
|
91
|
+
|
|
92
|
+
const plotPerItems = computed(()=>{
|
|
93
|
+
if (props.allowedPlotPers != null) {
|
|
94
|
+
return props.allowedPlotPers.map((f)=>{
|
|
95
|
+
return {
|
|
96
|
+
id: f,
|
|
97
|
+
label: plotPerLabel(f)
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
return getEnumEntries(PlotPer).filter(f=>f.value != PlotPer.None).map((f)=>{
|
|
102
|
+
return {
|
|
103
|
+
id: f.value,
|
|
104
|
+
label: plotPerLabel(f.value)
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
watch(() => props.modelValue, (newVal) => {
|
|
110
|
+
actualPlotPer.value = newVal?.plotPer ?? plotPerItems.value[0].id;
|
|
111
|
+
actualGroupingId.value = newVal?.groupingId ?? null;
|
|
112
|
+
}, { immediate: true });
|
|
113
|
+
|
|
114
|
+
watch([actualPlotPer, actualGroupingId], () => {
|
|
115
|
+
emit('update:modelValue', {
|
|
116
|
+
plotPer: actualPlotPer.value,
|
|
117
|
+
groupingId: actualGroupingId.value
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
actualGroupingId,
|
|
123
|
+
actualPlotPer,
|
|
124
|
+
plotPerItems,
|
|
125
|
+
PlotPer
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
</script>
|
|
@@ -7,11 +7,13 @@
|
|
|
7
7
|
/>
|
|
8
8
|
<FSFolderTileUI
|
|
9
9
|
v-else-if="entity"
|
|
10
|
-
:label="entity.label"
|
|
11
10
|
:code="entity.code"
|
|
12
|
-
:bottomColor="entity.colors"
|
|
13
11
|
:icon="entity.icon"
|
|
12
|
+
:label="entity.label"
|
|
14
13
|
:imageId="entity.imageId"
|
|
14
|
+
:bottomColor="entity.colors"
|
|
15
|
+
:recursiveFoldersIds="entity.recursiveFoldersIds"
|
|
16
|
+
:recursiveDashboardsIds="entity.recursiveDashboardsIds"
|
|
15
17
|
:selectable="$props.selectable"
|
|
16
18
|
:modelValue="$props.modelValue"
|
|
17
19
|
@update:modelValue="(value) => $emit('update:modelValue', value)"
|
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.
|
|
4
|
+
"version": "1.0.158-devices-latency-2",
|
|
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.
|
|
14
|
-
"@dative-gpi/foundation-core-services": "1.0.
|
|
15
|
-
"@dative-gpi/foundation-shared-components": "1.0.
|
|
16
|
-
"@dative-gpi/foundation-shared-domain": "1.0.
|
|
17
|
-
"@dative-gpi/foundation-shared-services": "1.0.
|
|
13
|
+
"@dative-gpi/foundation-core-domain": "1.0.158-devices-latency-2",
|
|
14
|
+
"@dative-gpi/foundation-core-services": "1.0.158-devices-latency-2",
|
|
15
|
+
"@dative-gpi/foundation-shared-components": "1.0.158-devices-latency-2",
|
|
16
|
+
"@dative-gpi/foundation-shared-domain": "1.0.158-devices-latency-2",
|
|
17
|
+
"@dative-gpi/foundation-shared-services": "1.0.158-devices-latency-2"
|
|
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": "
|
|
29
|
+
"gitHead": "63914dedbe1ac988443cf07e471e2fa6120392f2"
|
|
30
30
|
}
|
package/utils/dashboards.ts
CHANGED
|
@@ -8,7 +8,7 @@ const { $tr } = useTranslationsProvider();
|
|
|
8
8
|
export const dashboardTypeLabel = (type: DashboardType): string => {
|
|
9
9
|
switch (type) {
|
|
10
10
|
case DashboardType.None: return $tr("ui.common.none", "None");
|
|
11
|
-
case DashboardType.Organisation:
|
|
11
|
+
case DashboardType.Organisation: return $tr('ui.dashboard-type.shallow', 'Shallow copy');
|
|
12
12
|
case DashboardType.Shallow: return $tr("ui.common.custom", "Custom");
|
|
13
13
|
case DashboardType.OrganisationType: return $tr("ui.common.shared", "Shared");
|
|
14
14
|
}
|