@dative-gpi/foundation-core-components 0.0.229 → 0.1.68
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 +46 -53
- package/components/autocompletes/FSAutocompleteDashboard.vue +46 -53
- package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +24 -39
- package/components/autocompletes/FSAutocompleteDataCategory.vue +46 -38
- package/components/autocompletes/FSAutocompleteDataDefinition.vue +19 -39
- package/components/autocompletes/FSAutocompleteGroup.vue +17 -38
- package/components/autocompletes/FSAutocompleteLocation.vue +17 -38
- package/components/autocompletes/FSAutocompleteManufacturer.vue +57 -2
- package/components/autocompletes/FSAutocompleteModel.vue +58 -3
- package/components/autocompletes/FSAutocompleteOrganisationType.vue +17 -0
- package/components/autocompletes/FSAutocompleteRole.vue +46 -53
- package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +99 -0
- package/components/autocompletes/FSAutocompleteUserOrganisation.vue +24 -57
- package/components/customProperties/FSMetaField.vue +5 -6
- package/components/customProperties/FSMetaFormContent.vue +4 -5
- package/components/customProperties/FSMetaGrid.vue +3 -4
- package/components/customProperties/FSMetaHistory.vue +16 -15
- package/components/customProperties/FSMetaValue.vue +67 -36
- package/components/customProperties/helpers.ts +5 -4
- package/components/entities/FSBaseEntitiesList.vue +50 -0
- package/components/entities/FSDialogSelectEntities.vue +76 -0
- package/components/entities/FSEntityField.vue +149 -0
- package/components/entities/FSSelectEntitiesList.vue +192 -0
- package/components/entities/FSSimpleEntitiesList.vue +100 -0
- package/components/explorers/FSBaseFoldersExplorer.vue +258 -0
- package/components/lists/FSDataTable.vue +4 -8
- package/components/lists/alerts/FSBaseAlertsList.vue +357 -0
- package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +101 -0
- package/components/lists/authTokens/FSBaseAuthTokensList.vue +78 -0
- package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +159 -0
- package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +159 -0
- package/components/lists/charts/FSBaseChartsList.vue +218 -0
- package/components/lists/comments/FSBaseCommentsList.vue +127 -0
- package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +164 -0
- package/components/lists/dashboards/FSBaseDashboardsList.vue +222 -0
- package/components/lists/dashboards/FSSimpleDashboardsList.vue +63 -0
- package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +154 -0
- package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +128 -0
- package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +354 -0
- package/components/lists/deviceOrganisations/FSSimpleDeviceOrganisationsList.vue +44 -0
- package/components/lists/folders/FSBaseFoldersList.vue +116 -0
- package/components/lists/folders/FSSimpleFoldersList.vue +44 -0
- package/components/lists/groups/FSBaseGroupsList.vue +133 -0
- package/components/lists/groups/FSSimpleGroupsList.vue +44 -0
- package/components/lists/locations/FSBaseLocationsList.vue +115 -0
- package/components/lists/locations/FSSimpleLocationsList.vue +44 -0
- package/components/lists/models/FSBaseModelsList.vue +152 -0
- package/components/lists/models/FSSimpleModelsList.vue +44 -0
- package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +127 -0
- package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +127 -0
- package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +120 -0
- package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +107 -0
- package/components/lists/scenarios/FSBaseScenariosList.vue +206 -0
- package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +153 -0
- package/components/lists/serviceAccountRoleOrganisations/FSBaseServiceAccountRoleOrganisations.vue +127 -0
- package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +169 -0
- package/components/lists/userOrganisations/FSSimpleUserOrganisationsList.vue +45 -0
- package/components/selects/FSAggregationSelector.vue +5 -5
- package/components/selects/FSAxisTypeSelector.vue +1 -1
- package/components/selects/FSDisplayAsSelector.vue +5 -5
- package/components/selects/FSFilterTypeSelector.vue +2 -2
- package/components/selects/FSHeatmapRuleSelector.vue +5 -5
- package/components/selects/FSOperationOnSelector.vue +5 -5
- package/components/selects/FSPlanningTypeSelector.vue +6 -5
- package/components/selects/FSPlotPerSelector.vue +5 -5
- package/components/selects/{FSSelectSelectedEntities.vue → FSSelectEntityType.vue} +12 -12
- package/components/selects/FSSerieTypeSelector.vue +5 -5
- package/components/tiles/FSDeviceOrganisationTile.vue +9 -2
- package/components/tiles/FSLocationTile.vue +65 -0
- package/components/tiles/FSServiceAccountOrganisationTile.vue +68 -0
- package/components/tiles/FSUserOrganisationTile.vue +0 -2
- package/components/treeviews/FSTreeViewFolder.vue +15 -3
- package/components/treeviews/FSTreeViewGroup.vue +15 -3
- package/package.json +7 -7
- package/utils/charts.ts +2 -1
- package/utils/dashboards.ts +31 -4
- package/utils/index.ts +2 -1
- package/utils/permissions.ts +80 -0
- package/utils/roles.ts +2 -3
- package/utils/tables.ts +41 -0
- package/utils/users.ts +4 -1
- package/components/selects/FSDataCategorySelector.vue +0 -62
- package/components/selects/FSDataDefinitionSelector.vue +0 -66
- package/components/selects/FSModelSelector.vue +0 -56
|
@@ -1,54 +1,84 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
v-if="
|
|
4
|
-
/>
|
|
5
|
-
<FSText
|
|
6
|
-
v-else-if="$props.customProperty.useOnlyAllowedValues && $props.customProperty.allowedValues[meta[$props.customProperty.code]] != null"
|
|
7
|
-
:color="getColor($props.customProperty, meta[$props.customProperty.code])"
|
|
2
|
+
<template
|
|
3
|
+
v-if="$props.variant === 'standard'"
|
|
8
4
|
>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
<FSText
|
|
6
|
+
v-if="$props.customProperty.useOnlyAllowedValues"
|
|
7
|
+
:color="getColor($props.customProperty, meta[$props.customProperty.code])"
|
|
8
|
+
>
|
|
9
|
+
{{ value }}
|
|
10
|
+
</FSText>
|
|
11
|
+
<FSText
|
|
12
|
+
v-else-if="[PropertyDataType.Number, PropertyDataType.String, PropertyDataType.DateTime].includes($props.customProperty.dataType)"
|
|
13
|
+
:color="getColor($props.customProperty, meta[$props.customProperty.code])"
|
|
14
|
+
>
|
|
15
|
+
{{ value }}
|
|
16
|
+
</FSText>
|
|
17
|
+
<FSIcon
|
|
18
|
+
v-else-if="[PropertyDataType.Icon].includes($props.customProperty.dataType)"
|
|
19
|
+
:color="getColor($props.customProperty, meta[$props.customProperty.code])"
|
|
20
|
+
>
|
|
21
|
+
{{ value }}
|
|
22
|
+
</FSIcon>
|
|
23
|
+
<FSIconCheck
|
|
24
|
+
v-else-if="[PropertyDataType.Boolean].includes($props.customProperty.dataType) && value"
|
|
25
|
+
:color="getColor($props.customProperty, meta[$props.customProperty.code])"
|
|
26
|
+
:value="value.toLowerCase() === 'true'"
|
|
27
|
+
/>
|
|
28
|
+
</template>
|
|
29
|
+
<template
|
|
30
|
+
v-else-if="$props.variant === 'colorless'"
|
|
14
31
|
>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
<FSSpan
|
|
33
|
+
v-if="$props.customProperty.useOnlyAllowedValues"
|
|
34
|
+
>
|
|
35
|
+
{{ value }}
|
|
36
|
+
</FSSpan>
|
|
37
|
+
<FSSpan
|
|
38
|
+
v-else-if="[PropertyDataType.Number, PropertyDataType.String, PropertyDataType.DateTime].includes($props.customProperty.dataType)"
|
|
39
|
+
>
|
|
40
|
+
{{ value }}
|
|
41
|
+
</FSSpan>
|
|
42
|
+
<FSIcon
|
|
43
|
+
v-else-if="[PropertyDataType.Icon].includes($props.customProperty.dataType)"
|
|
44
|
+
>
|
|
45
|
+
{{ value }}
|
|
46
|
+
</FSIcon>
|
|
47
|
+
<FSIconCheck
|
|
48
|
+
v-else-if="[PropertyDataType.Boolean].includes($props.customProperty.dataType) && value"
|
|
49
|
+
:value="value.toLowerCase() === 'true'"
|
|
50
|
+
/>
|
|
51
|
+
</template>
|
|
28
52
|
</template>
|
|
29
53
|
|
|
30
54
|
<script lang="ts">
|
|
31
|
-
import type
|
|
32
|
-
import { computed, defineComponent } from "vue";
|
|
55
|
+
import { computed, defineComponent, type PropType } from "vue";
|
|
33
56
|
|
|
34
|
-
import {
|
|
57
|
+
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
58
|
+
import { PropertyDataType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
35
59
|
|
|
36
|
-
import type
|
|
37
|
-
import { PropertyDataType } from "../../../foundation-core-domain/models";
|
|
60
|
+
import { type CustomPropertyInfos } from "../../../foundation-core-domain/models";
|
|
38
61
|
import { getColor } from "./helpers";
|
|
39
62
|
|
|
40
63
|
import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
|
|
41
|
-
import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
|
|
42
64
|
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
65
|
+
import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
|
|
66
|
+
import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
|
|
43
67
|
|
|
44
68
|
export default defineComponent({
|
|
45
69
|
name: "FSMetaValue",
|
|
46
70
|
components: {
|
|
47
71
|
FSIconCheck,
|
|
48
|
-
|
|
49
|
-
|
|
72
|
+
FSIcon,
|
|
73
|
+
FSSpan,
|
|
74
|
+
FSText
|
|
50
75
|
},
|
|
51
76
|
props: {
|
|
77
|
+
variant: {
|
|
78
|
+
type: String as PropType<"standard" | "colorless">,
|
|
79
|
+
required: false,
|
|
80
|
+
default: "standard"
|
|
81
|
+
},
|
|
52
82
|
customProperty: {
|
|
53
83
|
type: Object as PropType<CustomPropertyInfos>,
|
|
54
84
|
required: true
|
|
@@ -59,18 +89,19 @@ export default defineComponent({
|
|
|
59
89
|
}
|
|
60
90
|
},
|
|
61
91
|
setup(props) {
|
|
62
|
-
const { epochToLongTimeFormat } =
|
|
92
|
+
const { epochToLongTimeFormat } = useDateFormat();
|
|
63
93
|
|
|
64
94
|
const value = computed((): string => {
|
|
65
95
|
if (props.customProperty.useOnlyAllowedValues) {
|
|
66
|
-
|
|
67
|
-
return props.customProperty.allowedValues[props.meta[props.customProperty.code]];
|
|
68
|
-
}
|
|
96
|
+
return props.customProperty.allowedValues[props.meta[props.customProperty.code]] ?? "";
|
|
69
97
|
}
|
|
70
98
|
switch (props.customProperty.dataType) {
|
|
71
99
|
case PropertyDataType.DateTime: {
|
|
72
100
|
return epochToLongTimeFormat(parseInt(props.meta[props.customProperty.code]));
|
|
73
101
|
}
|
|
102
|
+
case PropertyDataType.Boolean: {
|
|
103
|
+
return props.meta[props.customProperty.code];
|
|
104
|
+
}
|
|
74
105
|
default: {
|
|
75
106
|
return props.meta[props.customProperty.code];
|
|
76
107
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
|
|
2
|
-
import
|
|
3
|
-
import { FilterType, PropertyDataType } from "../../../foundation-core-domain/models";
|
|
2
|
+
import { FilterType, PropertyDataType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
import { type CustomPropertyInfos, } from "../../../foundation-core-domain/models";
|
|
5
|
+
|
|
6
|
+
const { getOffsetDifference } = useAppTimeZone();
|
|
6
7
|
|
|
7
8
|
export const getColor = (property: CustomPropertyInfos, value: string): string | undefined => {
|
|
8
9
|
if (property.colorful) {
|
|
@@ -187,5 +188,5 @@ const getEpoch = (expression: string): string => {
|
|
|
187
188
|
expression = expression.substring(match[0].length);
|
|
188
189
|
match = /(?:(?:([-+])(\d*))?(\w+))?(?:\/(\w))?/g.exec(expression);
|
|
189
190
|
}
|
|
190
|
-
return (date.getTime() +
|
|
191
|
+
return (date.getTime() + getOffsetDifference()).toString();
|
|
191
192
|
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="component"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
/>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { defineComponent, defineAsyncComponent, type PropType, computed } from "vue";
|
|
10
|
+
|
|
11
|
+
import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
12
|
+
|
|
13
|
+
export default defineComponent({
|
|
14
|
+
name: "FSBaseEntitiesList",
|
|
15
|
+
components: {
|
|
16
|
+
},
|
|
17
|
+
props: {
|
|
18
|
+
entityType: {
|
|
19
|
+
type: Number as PropType<EntityType>,
|
|
20
|
+
required: true
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
setup(props) {
|
|
24
|
+
const component = computed(() => {
|
|
25
|
+
switch(props.entityType) {
|
|
26
|
+
case EntityType.Device:
|
|
27
|
+
return defineAsyncComponent(() => import("../lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue"));
|
|
28
|
+
case EntityType.Dashboard:
|
|
29
|
+
return defineAsyncComponent(() => import("../lists/dashboards/FSBaseDashboardsList.vue"));
|
|
30
|
+
case EntityType.Folder:
|
|
31
|
+
return defineAsyncComponent(() => import("../lists/folders/FSBaseFoldersList.vue"));
|
|
32
|
+
case EntityType.User:
|
|
33
|
+
return defineAsyncComponent(() => import("../lists/userOrganisations/FSBaseUserOrganisationsList.vue"));
|
|
34
|
+
case EntityType.Group:
|
|
35
|
+
return defineAsyncComponent(() => import("../lists/groups/FSBaseGroupsList.vue"));
|
|
36
|
+
case EntityType.Location:
|
|
37
|
+
return defineAsyncComponent(() => import("../lists/locations/FSBaseLocationsList.vue"));
|
|
38
|
+
case EntityType.Model:
|
|
39
|
+
return defineAsyncComponent(() => import("../lists/models/FSBaseModelsList.vue"));
|
|
40
|
+
default:
|
|
41
|
+
return null;
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
component,
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
</script>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSDialogSubmit
|
|
3
|
+
:title="$tr('ui.common.select-entities', 'Select entities')"
|
|
4
|
+
width="1130px"
|
|
5
|
+
:model-value="$props.modelValue"
|
|
6
|
+
@update:modelValue="$emit('update:modelValue', $event)"
|
|
7
|
+
@click:submit-button="onSubmit"
|
|
8
|
+
>
|
|
9
|
+
<template
|
|
10
|
+
#body
|
|
11
|
+
>
|
|
12
|
+
<FSSelectEntitiesList
|
|
13
|
+
:entityType="$props.entityType"
|
|
14
|
+
:modelValue="actualSelecteds"
|
|
15
|
+
:filters="$props.filters"
|
|
16
|
+
@update:modelValue="actualSelecteds = $event"
|
|
17
|
+
/>
|
|
18
|
+
</template>
|
|
19
|
+
</FSDialogSubmit>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import { defineComponent, type PropType, ref, watch } from "vue";
|
|
24
|
+
|
|
25
|
+
import type { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
26
|
+
|
|
27
|
+
import FSDialogSubmit from "@dative-gpi/foundation-shared-components/components/FSDialogSubmit.vue";
|
|
28
|
+
import FSSelectEntitiesList from "./FSSelectEntitiesList.vue";
|
|
29
|
+
|
|
30
|
+
export default defineComponent({
|
|
31
|
+
name: "FSDialogSelectEntities",
|
|
32
|
+
components: {
|
|
33
|
+
FSSelectEntitiesList,
|
|
34
|
+
FSDialogSubmit,
|
|
35
|
+
},
|
|
36
|
+
emits: ["update:modelValue", "update:selecteds"],
|
|
37
|
+
props: {
|
|
38
|
+
entityType: {
|
|
39
|
+
type: Number as PropType<EntityType>,
|
|
40
|
+
required: true
|
|
41
|
+
},
|
|
42
|
+
selecteds: {
|
|
43
|
+
type: Array as PropType<string[]>,
|
|
44
|
+
required: false,
|
|
45
|
+
default: () => []
|
|
46
|
+
},
|
|
47
|
+
filters: {
|
|
48
|
+
type: Object,
|
|
49
|
+
required: false,
|
|
50
|
+
default: null
|
|
51
|
+
},
|
|
52
|
+
modelValue: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
required: false,
|
|
55
|
+
default: false
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
setup(props, { emit }){
|
|
59
|
+
const actualSelecteds = ref<string[]>([]);
|
|
60
|
+
|
|
61
|
+
const onSubmit = () => {
|
|
62
|
+
emit("update:selecteds", actualSelecteds.value);
|
|
63
|
+
emit("update:modelValue", false);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
watch(() => props.selecteds, (value) => {
|
|
67
|
+
actualSelecteds.value = value;
|
|
68
|
+
}, { immediate: true });
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
onSubmit,
|
|
72
|
+
actualSelecteds
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
</script>
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSEntityFieldUI
|
|
3
|
+
:description="$props.description"
|
|
4
|
+
:hideHeader="$props.hideHeader"
|
|
5
|
+
:required="$props.required"
|
|
6
|
+
:editable="$props.editable"
|
|
7
|
+
:label="$props.label"
|
|
8
|
+
:messages="$props.messages"
|
|
9
|
+
:entityType="$props.entityType"
|
|
10
|
+
:allowedEntityTypes="$props.allowedEntityTypes || []"
|
|
11
|
+
:itemsCount="($props.modelValue || []).length"
|
|
12
|
+
@update:entityType="$emit('update:entityType', $event); $emit('update:modelValue', [])"
|
|
13
|
+
:showEntities="$props.showEntities"
|
|
14
|
+
:showCount="$props.showCount"
|
|
15
|
+
@click:select="dialog = true"
|
|
16
|
+
>
|
|
17
|
+
<template
|
|
18
|
+
#items
|
|
19
|
+
>
|
|
20
|
+
<FSSimpleEntitiesList
|
|
21
|
+
:entity-type="$props.entityType"
|
|
22
|
+
:filters="listComponentFilters"
|
|
23
|
+
:showEdit="false"
|
|
24
|
+
@click:remove="onRemove"
|
|
25
|
+
/>
|
|
26
|
+
</template>
|
|
27
|
+
</FSEntityFieldUI>
|
|
28
|
+
<FSDialogSelectEntities
|
|
29
|
+
:entity-type="$props.entityType"
|
|
30
|
+
:filters="$props.filters"
|
|
31
|
+
v-model="dialog"
|
|
32
|
+
:selecteds="$props.modelValue || []"
|
|
33
|
+
@update:selecteds="$emit('update:modelValue', $event)"
|
|
34
|
+
/>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
<script lang="ts">
|
|
39
|
+
import { defineComponent, ref, type PropType, computed } from "vue";
|
|
40
|
+
|
|
41
|
+
import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
42
|
+
|
|
43
|
+
import type { DeviceOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
44
|
+
|
|
45
|
+
import FSEntityFieldUI from "@dative-gpi/foundation-shared-components/components/fields/FSEntityFieldUI.vue";
|
|
46
|
+
|
|
47
|
+
import FSSimpleEntitiesList from "./FSSimpleEntitiesList.vue";
|
|
48
|
+
import FSDialogSelectEntities from "./FSDialogSelectEntities.vue";
|
|
49
|
+
|
|
50
|
+
export default defineComponent({
|
|
51
|
+
name: "FSEntityField",
|
|
52
|
+
components: {
|
|
53
|
+
FSEntityFieldUI,
|
|
54
|
+
FSSimpleEntitiesList,
|
|
55
|
+
FSDialogSelectEntities
|
|
56
|
+
},
|
|
57
|
+
props: {
|
|
58
|
+
label: {
|
|
59
|
+
type: String as PropType<string | null>,
|
|
60
|
+
required: false,
|
|
61
|
+
default: null
|
|
62
|
+
},
|
|
63
|
+
description: {
|
|
64
|
+
type: String as PropType<string | null>,
|
|
65
|
+
required: false,
|
|
66
|
+
default: null
|
|
67
|
+
},
|
|
68
|
+
modelValue: {
|
|
69
|
+
type: Array as PropType<string[]>,
|
|
70
|
+
required: true,
|
|
71
|
+
default: () => []
|
|
72
|
+
},
|
|
73
|
+
hideHeader: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
required: false,
|
|
76
|
+
default: false
|
|
77
|
+
},
|
|
78
|
+
required: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
required: false,
|
|
81
|
+
default: false
|
|
82
|
+
},
|
|
83
|
+
filters: {
|
|
84
|
+
type: Object,
|
|
85
|
+
required: false,
|
|
86
|
+
default: () => null
|
|
87
|
+
},
|
|
88
|
+
rules: {
|
|
89
|
+
type: Array as PropType<any[]>,
|
|
90
|
+
required: false,
|
|
91
|
+
default: () => []
|
|
92
|
+
},
|
|
93
|
+
messages: {
|
|
94
|
+
type: Array as PropType<string[]>,
|
|
95
|
+
required: false,
|
|
96
|
+
default: null
|
|
97
|
+
},
|
|
98
|
+
editable: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
required: false,
|
|
101
|
+
default: true
|
|
102
|
+
},
|
|
103
|
+
entityType: {
|
|
104
|
+
type: Number as PropType<EntityType>,
|
|
105
|
+
required: true
|
|
106
|
+
},
|
|
107
|
+
allowedEntityTypes: {
|
|
108
|
+
type: Array as PropType<EntityType[]>,
|
|
109
|
+
required: false,
|
|
110
|
+
default: () => []
|
|
111
|
+
},
|
|
112
|
+
showEntities: {
|
|
113
|
+
type: Boolean,
|
|
114
|
+
required: false,
|
|
115
|
+
default: true
|
|
116
|
+
},
|
|
117
|
+
showCount: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
required: false,
|
|
120
|
+
default: true
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
emits: ["update:modelValue", "update:entityType"],
|
|
124
|
+
setup(props, { emit }) {
|
|
125
|
+
const dialog = ref(false);
|
|
126
|
+
|
|
127
|
+
const listComponentFilters = computed(() => {
|
|
128
|
+
switch(props.entityType) {
|
|
129
|
+
case EntityType.Device:
|
|
130
|
+
return {
|
|
131
|
+
deviceOrganisationsIds: props.modelValue
|
|
132
|
+
} satisfies DeviceOrganisationFilters;
|
|
133
|
+
default:
|
|
134
|
+
return {};
|
|
135
|
+
};
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const onRemove = (id: string) => {
|
|
139
|
+
emit("update:modelValue", props.modelValue.filter((i) => i !== id));
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return {
|
|
143
|
+
dialog,
|
|
144
|
+
listComponentFilters,
|
|
145
|
+
onRemove
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
</script>
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCol
|
|
3
|
+
gap="24px"
|
|
4
|
+
>
|
|
5
|
+
<FSCol>
|
|
6
|
+
<FSText
|
|
7
|
+
font="text-button"
|
|
8
|
+
>
|
|
9
|
+
{{ $tr("ui.common.selection-reminder", "Selection reminder") }}
|
|
10
|
+
</FSText>
|
|
11
|
+
<FSRow
|
|
12
|
+
align="center-left"
|
|
13
|
+
height="50px"
|
|
14
|
+
>
|
|
15
|
+
<FSSlideGroup
|
|
16
|
+
v-if="$props.modelValue && $props.modelValue.length > 0"
|
|
17
|
+
>
|
|
18
|
+
<FSSimpleEntitiesList
|
|
19
|
+
:entity-type="$props.entityType"
|
|
20
|
+
:filters="simpleListFilters"
|
|
21
|
+
:showEdit="false"
|
|
22
|
+
:showRemove="false"
|
|
23
|
+
direction="row"
|
|
24
|
+
/>
|
|
25
|
+
</FSSlideGroup>
|
|
26
|
+
<FSText
|
|
27
|
+
v-else
|
|
28
|
+
>
|
|
29
|
+
{{ $tr("ui.common.no-selection", "No selection") }}
|
|
30
|
+
</FSText>
|
|
31
|
+
</FSRow>
|
|
32
|
+
</FSCol>
|
|
33
|
+
|
|
34
|
+
<FSCol>
|
|
35
|
+
<FSText
|
|
36
|
+
font="text-button"
|
|
37
|
+
>
|
|
38
|
+
{{ $tr("ui.common.entities-list", "Entities list") }}
|
|
39
|
+
</FSText>
|
|
40
|
+
<FSBaseEntitiesList
|
|
41
|
+
:entity-type="$props.entityType"
|
|
42
|
+
:tableCode="tableCode"
|
|
43
|
+
:modelValue="$props.modelValue"
|
|
44
|
+
@update:modelValue="$emit('update:modelValue', $event)"
|
|
45
|
+
v-bind="baseTableAttrs"
|
|
46
|
+
/>
|
|
47
|
+
</FSCol>
|
|
48
|
+
</FSCol>
|
|
49
|
+
</template>
|
|
50
|
+
|
|
51
|
+
<script lang="ts">
|
|
52
|
+
import { defineComponent, type PropType, computed } from "vue";
|
|
53
|
+
|
|
54
|
+
import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
55
|
+
import type { DashboardOrganisationFilters, DashboardOrganisationTypeFilters, DeviceOrganisationFilters, FolderFilters, GroupFilters, LocationFilters, ModelFilters, UserOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
56
|
+
|
|
57
|
+
import { TABLES as T } from "../../utils";
|
|
58
|
+
|
|
59
|
+
import FSSlideGroup from "@dative-gpi/foundation-shared-components/components/FSSlideGroup.vue";
|
|
60
|
+
import FSCol from "@dative-gpi/foundation-shared-components/components/FSCol.vue";
|
|
61
|
+
import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
|
|
62
|
+
import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
import FSSimpleEntitiesList from "./FSSimpleEntitiesList.vue";
|
|
66
|
+
import FSBaseEntitiesList from "./FSBaseEntitiesList.vue";
|
|
67
|
+
|
|
68
|
+
export default defineComponent({
|
|
69
|
+
name: "FSSelectEntitiesList",
|
|
70
|
+
components: {
|
|
71
|
+
FSSimpleEntitiesList,
|
|
72
|
+
FSBaseEntitiesList,
|
|
73
|
+
FSSlideGroup,
|
|
74
|
+
FSCol,
|
|
75
|
+
FSRow,
|
|
76
|
+
FSText
|
|
77
|
+
},
|
|
78
|
+
emits: ["update:modelValue"],
|
|
79
|
+
props: {
|
|
80
|
+
entityType: {
|
|
81
|
+
type: Number as PropType<EntityType>,
|
|
82
|
+
required: true
|
|
83
|
+
},
|
|
84
|
+
modelValue: {
|
|
85
|
+
type: Array as PropType<string[]>,
|
|
86
|
+
required: false,
|
|
87
|
+
default: () => []
|
|
88
|
+
},
|
|
89
|
+
filters: {
|
|
90
|
+
type: Object,
|
|
91
|
+
required: false,
|
|
92
|
+
default: null
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
setup(props, { attrs }){
|
|
96
|
+
const simpleListFilters = computed(() => {
|
|
97
|
+
switch(props.entityType) {
|
|
98
|
+
case EntityType.Device:
|
|
99
|
+
return {
|
|
100
|
+
deviceOrganisationsIds: props.modelValue
|
|
101
|
+
} satisfies DeviceOrganisationFilters;
|
|
102
|
+
case EntityType.Dashboard:
|
|
103
|
+
return {
|
|
104
|
+
dashboardOrganisationsIds: props.modelValue,
|
|
105
|
+
dashboardOrganisationTypesIds: props.modelValue
|
|
106
|
+
} satisfies DashboardOrganisationFilters & DashboardOrganisationTypeFilters;
|
|
107
|
+
case EntityType.Group:
|
|
108
|
+
return {
|
|
109
|
+
groupsIds: props.modelValue
|
|
110
|
+
} satisfies GroupFilters;
|
|
111
|
+
case EntityType.Folder:
|
|
112
|
+
return {
|
|
113
|
+
foldersIds: props.modelValue
|
|
114
|
+
} satisfies FolderFilters;
|
|
115
|
+
case EntityType.Location:
|
|
116
|
+
return {
|
|
117
|
+
locationsIds: props.modelValue
|
|
118
|
+
} satisfies LocationFilters;
|
|
119
|
+
case EntityType.User:
|
|
120
|
+
return {
|
|
121
|
+
userOrganisationsIds: props.modelValue
|
|
122
|
+
} satisfies UserOrganisationFilters;
|
|
123
|
+
case EntityType.Model:
|
|
124
|
+
return {
|
|
125
|
+
modelsIds: props.modelValue
|
|
126
|
+
} satisfies ModelFilters;
|
|
127
|
+
default:
|
|
128
|
+
return undefined;
|
|
129
|
+
};
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
const tableCode = computed(() => {
|
|
133
|
+
switch(props.entityType) {
|
|
134
|
+
case EntityType.Device:
|
|
135
|
+
return T.DEVICES_SELECT;
|
|
136
|
+
default:
|
|
137
|
+
return null;
|
|
138
|
+
};
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
const baseTableAttrs = computed(() => {
|
|
142
|
+
switch(props.entityType) {
|
|
143
|
+
case EntityType.Device:
|
|
144
|
+
return {
|
|
145
|
+
deviceOrganisationFilters: props.filters,
|
|
146
|
+
...attrs
|
|
147
|
+
};
|
|
148
|
+
case EntityType.Dashboard:
|
|
149
|
+
return {
|
|
150
|
+
dashboardShallowsFilters: props.filters,
|
|
151
|
+
dashboardOrganisationsFilters: props.filters,
|
|
152
|
+
dashboardOrganisationTypeFetchFilter: props.filters,
|
|
153
|
+
...attrs
|
|
154
|
+
};
|
|
155
|
+
case EntityType.Group:
|
|
156
|
+
return {
|
|
157
|
+
groupsFilters: props.filters,
|
|
158
|
+
...attrs
|
|
159
|
+
};
|
|
160
|
+
case EntityType.Folder:
|
|
161
|
+
return {
|
|
162
|
+
foldersFilters: props.filters,
|
|
163
|
+
...attrs
|
|
164
|
+
};
|
|
165
|
+
case EntityType.Location:
|
|
166
|
+
return {
|
|
167
|
+
locationsFilters: props.filters,
|
|
168
|
+
...attrs
|
|
169
|
+
};
|
|
170
|
+
case EntityType.User:
|
|
171
|
+
return {
|
|
172
|
+
userOrganisationsFilters: props.filters,
|
|
173
|
+
...attrs
|
|
174
|
+
};
|
|
175
|
+
case EntityType.Model:
|
|
176
|
+
return {
|
|
177
|
+
modelsFilters: props.filters,
|
|
178
|
+
...attrs
|
|
179
|
+
};
|
|
180
|
+
default:
|
|
181
|
+
return null;
|
|
182
|
+
};
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
return {
|
|
186
|
+
simpleListFilters,
|
|
187
|
+
baseTableAttrs,
|
|
188
|
+
tableCode
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
</script>
|