@dative-gpi/foundation-core-components 1.0.45 → 1.0.46
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
|
@@ -56,12 +56,13 @@
|
|
|
56
56
|
<script lang="ts">
|
|
57
57
|
import { computed, defineComponent, type PropType } from "vue";
|
|
58
58
|
|
|
59
|
-
import { type ChartOrganisationFilters,
|
|
59
|
+
import { type ChartOrganisationFilters, type ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
60
60
|
import { useChartOrganisations, useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
|
|
61
61
|
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
62
62
|
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
|
|
63
63
|
|
|
64
64
|
import { chartOriginColor, chartOriginLabel } from "../../utils";
|
|
65
|
+
import { ChartOrigin } from "@dative-gpi/foundation-shared-domain/enums";
|
|
65
66
|
|
|
66
67
|
import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
|
|
67
68
|
import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
|
|
@@ -60,8 +60,8 @@ import { type DashboardOrganisationFilters, type DashboardOrganisationTypeFilter
|
|
|
60
60
|
import { useDashboardOrganisations, useDashboardOrganisationTypes, useDashboardShallows } from "@dative-gpi/foundation-core-services/composables";
|
|
61
61
|
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
62
62
|
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
|
|
63
|
-
import { DashboardType } from "@dative-gpi/foundation-shared-domain/models";
|
|
64
63
|
|
|
64
|
+
import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
65
65
|
import { dashboardTypeColor, dashboardTypeLabel } from "../../utils";
|
|
66
66
|
|
|
67
67
|
import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
|
|
@@ -56,10 +56,11 @@
|
|
|
56
56
|
<script lang="ts">
|
|
57
57
|
import { computed, defineComponent, type PropType } from "vue";
|
|
58
58
|
|
|
59
|
-
import { type RoleOrganisationFilters, type RoleOrganisationTypeFilters
|
|
59
|
+
import { type RoleOrganisationFilters, type RoleOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
60
60
|
import { useRoleOrganisations, useRoleOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
|
|
61
61
|
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
62
62
|
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
|
|
63
|
+
import { RoleType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
63
64
|
|
|
64
65
|
import { roleTypeColor, roleTypeLabel } from "../../utils";
|
|
65
66
|
|
|
@@ -93,7 +93,8 @@ import { computed, defineComponent, type PropType } from "vue";
|
|
|
93
93
|
|
|
94
94
|
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
95
95
|
|
|
96
|
-
import { type CustomPropertyInfos
|
|
96
|
+
import { type CustomPropertyInfos } from "../../../foundation-core-domain/models";
|
|
97
|
+
import { PropertyDataType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
97
98
|
|
|
98
99
|
import FSDateTimeField from "@dative-gpi/foundation-shared-components/components/fields/FSDateTimeField.vue";
|
|
99
100
|
import FSNumberField from "@dative-gpi/foundation-shared-components/components/fields/FSNumberField.vue";
|
|
@@ -32,7 +32,8 @@ import { computed, defineComponent, type PropType } from "vue";
|
|
|
32
32
|
|
|
33
33
|
import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
|
|
34
34
|
|
|
35
|
-
import {
|
|
35
|
+
import { PropertyDataType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
36
|
+
import { type CustomPropertyInfos } from "../../../foundation-core-domain/models";
|
|
36
37
|
import { getColor } from "./helpers";
|
|
37
38
|
|
|
38
39
|
import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composables";
|
|
2
|
+
import { FilterType, PropertyDataType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
2
3
|
|
|
3
|
-
import { type CustomPropertyInfos,
|
|
4
|
+
import { type CustomPropertyInfos, } from "../../../foundation-core-domain/models";
|
|
4
5
|
|
|
5
6
|
const { getOffsetDifference } = useAppTimeZone();
|
|
6
7
|
|
|
@@ -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,171 @@
|
|
|
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
|
+
<FSCol
|
|
13
|
+
gap="24px"
|
|
14
|
+
>
|
|
15
|
+
<FSCol>
|
|
16
|
+
<FSText
|
|
17
|
+
font="text-button"
|
|
18
|
+
>
|
|
19
|
+
{{ $tr("ui.common.selection-reminder", "Selection reminder") }}
|
|
20
|
+
</FSText>
|
|
21
|
+
<FSRow
|
|
22
|
+
align="center-left"
|
|
23
|
+
height="50px"
|
|
24
|
+
>
|
|
25
|
+
<FSSlideGroup
|
|
26
|
+
v-if="actualSelecteds.length > 0"
|
|
27
|
+
>
|
|
28
|
+
<FSSimpleEntitiesList
|
|
29
|
+
:entity-type="$props.entityType"
|
|
30
|
+
:filters="simpleListFilters"
|
|
31
|
+
:showEdit="false"
|
|
32
|
+
:showRemove="false"
|
|
33
|
+
direction="row"
|
|
34
|
+
/>
|
|
35
|
+
</FSSlideGroup>
|
|
36
|
+
<FSText
|
|
37
|
+
v-else
|
|
38
|
+
>
|
|
39
|
+
{{ $tr("ui.common.no-selection", "No selection") }}
|
|
40
|
+
</FSText>
|
|
41
|
+
</FSRow>
|
|
42
|
+
</FSCol>
|
|
43
|
+
|
|
44
|
+
<FSCol>
|
|
45
|
+
<FSText
|
|
46
|
+
font="text-button"
|
|
47
|
+
>
|
|
48
|
+
{{ $tr("ui.common.entities-list", "Entities list") }}
|
|
49
|
+
</FSText>
|
|
50
|
+
<FSBaseEntitiesList
|
|
51
|
+
:entity-type="$props.entityType"
|
|
52
|
+
:tableCode="tableCode"
|
|
53
|
+
v-model="actualSelecteds"
|
|
54
|
+
v-bind="baseTableAttrs"
|
|
55
|
+
/>
|
|
56
|
+
</FSCol>
|
|
57
|
+
</FSCol>
|
|
58
|
+
</template>
|
|
59
|
+
</FSDialogSubmit>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<script lang="ts">
|
|
63
|
+
import { defineComponent, type PropType, computed, ref, watch } from "vue";
|
|
64
|
+
|
|
65
|
+
import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
66
|
+
import type { DashboardOrganisationFilters, DashboardOrganisationTypeFilters, DeviceOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
67
|
+
|
|
68
|
+
import { TABLES as T } from "../../utils";
|
|
69
|
+
|
|
70
|
+
import FSSlideGroup from "@dative-gpi/foundation-shared-components/components/FSSlideGroup.vue";
|
|
71
|
+
import FSDialogSubmit from "@dative-gpi/foundation-shared-components/components/FSDialogSubmit.vue";
|
|
72
|
+
import FSCol from "@dative-gpi/foundation-shared-components/components/FSCol.vue";
|
|
73
|
+
import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
|
|
74
|
+
import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
import FSSimpleEntitiesList from "./FSSimpleEntitiesList.vue";
|
|
78
|
+
import FSBaseEntitiesList from "./FSBaseEntitiesList.vue";
|
|
79
|
+
|
|
80
|
+
export default defineComponent({
|
|
81
|
+
name: "FSDialogSelectEntities",
|
|
82
|
+
components: {
|
|
83
|
+
FSSimpleEntitiesList,
|
|
84
|
+
FSBaseEntitiesList,
|
|
85
|
+
FSSlideGroup,
|
|
86
|
+
FSDialogSubmit,
|
|
87
|
+
FSCol,
|
|
88
|
+
FSRow,
|
|
89
|
+
FSText
|
|
90
|
+
},
|
|
91
|
+
emits: ["update:modelValue", "update:selecteds"],
|
|
92
|
+
props: {
|
|
93
|
+
entityType: {
|
|
94
|
+
type: Number as PropType<EntityType>,
|
|
95
|
+
required: true
|
|
96
|
+
},
|
|
97
|
+
selecteds: {
|
|
98
|
+
type: Array as PropType<string[]>,
|
|
99
|
+
required: false,
|
|
100
|
+
default: () => []
|
|
101
|
+
},
|
|
102
|
+
filters: {
|
|
103
|
+
type: Object,
|
|
104
|
+
required: false,
|
|
105
|
+
default: null
|
|
106
|
+
},
|
|
107
|
+
modelValue: {
|
|
108
|
+
type: Boolean,
|
|
109
|
+
required: false,
|
|
110
|
+
default: false
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
setup(props, { attrs, emit }){
|
|
114
|
+
const actualSelecteds = ref<string[]>([]);
|
|
115
|
+
|
|
116
|
+
const simpleListFilters = computed(() => {
|
|
117
|
+
switch(props.entityType) {
|
|
118
|
+
case EntityType.Device:
|
|
119
|
+
return {
|
|
120
|
+
deviceOrganisationsIds: actualSelecteds.value
|
|
121
|
+
} satisfies DeviceOrganisationFilters;
|
|
122
|
+
case EntityType.Dashboard:
|
|
123
|
+
return {
|
|
124
|
+
dashboardOrganisationIds: actualSelecteds.value,
|
|
125
|
+
dashboardOrganisationTypeIds: actualSelecteds.value
|
|
126
|
+
} satisfies DashboardOrganisationFilters & DashboardOrganisationTypeFilters;
|
|
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
|
+
default:
|
|
149
|
+
return null;
|
|
150
|
+
};
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
const onSubmit = () => {
|
|
154
|
+
emit("update:selecteds", actualSelecteds.value);
|
|
155
|
+
emit("update:modelValue", false);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
watch(() => props.selecteds, (value) => {
|
|
159
|
+
actualSelecteds.value = value;
|
|
160
|
+
}, { immediate: true });
|
|
161
|
+
|
|
162
|
+
return {
|
|
163
|
+
onSubmit,
|
|
164
|
+
actualSelecteds,
|
|
165
|
+
simpleListFilters,
|
|
166
|
+
baseTableAttrs,
|
|
167
|
+
tableCode
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
</script>
|
|
@@ -0,0 +1,143 @@
|
|
|
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
|
+
@click:select="dialog = true"
|
|
15
|
+
>
|
|
16
|
+
<template
|
|
17
|
+
#items
|
|
18
|
+
>
|
|
19
|
+
<FSSimpleEntitiesList
|
|
20
|
+
:entity-type="$props.entityType"
|
|
21
|
+
:filters="listComponentFilters"
|
|
22
|
+
:showEdit="false"
|
|
23
|
+
@click:remove="onRemove"
|
|
24
|
+
/>
|
|
25
|
+
</template>
|
|
26
|
+
</FSEntityFieldUI>
|
|
27
|
+
<FSDialogSelectEntities
|
|
28
|
+
:entity-type="$props.entityType"
|
|
29
|
+
:filters="$props.filters"
|
|
30
|
+
v-model="dialog"
|
|
31
|
+
:selecteds="$props.modelValue || []"
|
|
32
|
+
@update:selecteds="$emit('update:modelValue', $event)"
|
|
33
|
+
/>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
<script lang="ts">
|
|
38
|
+
import { defineComponent, ref, type PropType, computed } from "vue";
|
|
39
|
+
|
|
40
|
+
import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
41
|
+
|
|
42
|
+
import type { DeviceOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
43
|
+
|
|
44
|
+
import FSEntityFieldUI from "@dative-gpi/foundation-shared-components/components/fields/FSEntityFieldUI.vue";
|
|
45
|
+
|
|
46
|
+
import FSSimpleEntitiesList from "./FSSimpleEntitiesList.vue";
|
|
47
|
+
import FSDialogSelectEntities from "./FSDialogSelectEntities.vue";
|
|
48
|
+
|
|
49
|
+
export default defineComponent({
|
|
50
|
+
name: "FSEntityField",
|
|
51
|
+
components: {
|
|
52
|
+
FSEntityFieldUI,
|
|
53
|
+
FSSimpleEntitiesList,
|
|
54
|
+
FSDialogSelectEntities
|
|
55
|
+
},
|
|
56
|
+
props: {
|
|
57
|
+
label: {
|
|
58
|
+
type: String as PropType<string | null>,
|
|
59
|
+
required: false,
|
|
60
|
+
default: null
|
|
61
|
+
},
|
|
62
|
+
description: {
|
|
63
|
+
type: String as PropType<string | null>,
|
|
64
|
+
required: false,
|
|
65
|
+
default: null
|
|
66
|
+
},
|
|
67
|
+
modelValue: {
|
|
68
|
+
type: Array as PropType<string[]>,
|
|
69
|
+
required: true,
|
|
70
|
+
default: () => []
|
|
71
|
+
},
|
|
72
|
+
hideHeader: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
required: false,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
required: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
required: false,
|
|
80
|
+
default: false
|
|
81
|
+
},
|
|
82
|
+
filters: {
|
|
83
|
+
type: Object,
|
|
84
|
+
required: false,
|
|
85
|
+
default: () => null
|
|
86
|
+
},
|
|
87
|
+
rules: {
|
|
88
|
+
type: Array as PropType<any[]>,
|
|
89
|
+
required: false,
|
|
90
|
+
default: () => []
|
|
91
|
+
},
|
|
92
|
+
messages: {
|
|
93
|
+
type: Array as PropType<string[]>,
|
|
94
|
+
required: false,
|
|
95
|
+
default: null
|
|
96
|
+
},
|
|
97
|
+
editable: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
required: false,
|
|
100
|
+
default: true
|
|
101
|
+
},
|
|
102
|
+
entityType: {
|
|
103
|
+
type: Number as PropType<EntityType>,
|
|
104
|
+
required: true
|
|
105
|
+
},
|
|
106
|
+
allowedEntityTypes: {
|
|
107
|
+
type: Array as PropType<EntityType[]>,
|
|
108
|
+
required: false,
|
|
109
|
+
default: () => []
|
|
110
|
+
},
|
|
111
|
+
showEntities: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
required: false,
|
|
114
|
+
default: true
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
emits: ["update:modelValue", "update:entityType"],
|
|
118
|
+
setup(props, { emit }) {
|
|
119
|
+
const dialog = ref(false);
|
|
120
|
+
|
|
121
|
+
const listComponentFilters = computed(() => {
|
|
122
|
+
switch(props.entityType) {
|
|
123
|
+
case EntityType.Device:
|
|
124
|
+
return {
|
|
125
|
+
deviceOrganisationsIds: props.modelValue
|
|
126
|
+
} satisfies DeviceOrganisationFilters;
|
|
127
|
+
default:
|
|
128
|
+
return {};
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
const onRemove = (id: string) => {
|
|
133
|
+
emit("update:modelValue", props.modelValue.filter((i) => i !== id));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
dialog,
|
|
138
|
+
listComponentFilters,
|
|
139
|
+
onRemove
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
</script>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<component
|
|
3
|
+
:is="component"
|
|
4
|
+
v-bind="componentProps"
|
|
5
|
+
/>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { defineComponent, defineAsyncComponent, type PropType, computed } from "vue";
|
|
11
|
+
|
|
12
|
+
import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
13
|
+
|
|
14
|
+
export default defineComponent({
|
|
15
|
+
name: "FSSimpleEntitiesList",
|
|
16
|
+
components: {
|
|
17
|
+
},
|
|
18
|
+
props: {
|
|
19
|
+
entityType: {
|
|
20
|
+
type: Number as PropType<EntityType>,
|
|
21
|
+
required: true
|
|
22
|
+
},
|
|
23
|
+
filters: {
|
|
24
|
+
type: Object,
|
|
25
|
+
required: false,
|
|
26
|
+
default: null
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
setup(props, { attrs }) {
|
|
30
|
+
const component = computed(() => {
|
|
31
|
+
switch(props.entityType) {
|
|
32
|
+
case EntityType.Device:
|
|
33
|
+
return defineAsyncComponent(() => import("../lists/deviceOrganisations/FSSimpleDeviceOrganisationsList.vue"));
|
|
34
|
+
case EntityType.Dashboard:
|
|
35
|
+
return defineAsyncComponent(() => import("../lists/dashboards/FSSimpleDashboardsList.vue"));
|
|
36
|
+
case EntityType.Folder:
|
|
37
|
+
return defineAsyncComponent(() => import("../lists/folders/FSSimpleFoldersList.vue"));
|
|
38
|
+
case EntityType.User:
|
|
39
|
+
return defineAsyncComponent(() => import("../lists/userOrganisations/FSSimpleUserOrganisationsList.vue"));
|
|
40
|
+
case EntityType.Group:
|
|
41
|
+
return defineAsyncComponent(() => import("../lists/groups/FSSimpleGroupsList.vue"));
|
|
42
|
+
case EntityType.Location:
|
|
43
|
+
return defineAsyncComponent(() => import("../lists/locations/FSSimpleLocationsList.vue"));
|
|
44
|
+
case EntityType.Model:
|
|
45
|
+
return defineAsyncComponent(() => import("../lists/models/FSSimpleModelsList.vue"));
|
|
46
|
+
default:
|
|
47
|
+
return null;
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const componentProps = computed(() => {
|
|
52
|
+
switch(props.entityType) {
|
|
53
|
+
case EntityType.Device:
|
|
54
|
+
return {
|
|
55
|
+
...attrs,
|
|
56
|
+
deviceOrganisationFilters : props.filters
|
|
57
|
+
};
|
|
58
|
+
case EntityType.Dashboard:
|
|
59
|
+
return {
|
|
60
|
+
...attrs,
|
|
61
|
+
dashboardOrganisationFilters : props.filters,
|
|
62
|
+
dashboardOrganisationTypeFilters : props.filters
|
|
63
|
+
};
|
|
64
|
+
case EntityType.Folder:
|
|
65
|
+
return {
|
|
66
|
+
...attrs,
|
|
67
|
+
folderFilters : props.filters
|
|
68
|
+
};
|
|
69
|
+
case EntityType.User:
|
|
70
|
+
return {
|
|
71
|
+
...attrs,
|
|
72
|
+
userFilters : props.filters
|
|
73
|
+
};
|
|
74
|
+
case EntityType.Group:
|
|
75
|
+
return {
|
|
76
|
+
...attrs,
|
|
77
|
+
groupFilters : props.filters
|
|
78
|
+
};
|
|
79
|
+
case EntityType.Location:
|
|
80
|
+
return {
|
|
81
|
+
...attrs,
|
|
82
|
+
locationFilters : props.filters
|
|
83
|
+
};
|
|
84
|
+
case EntityType.Model:
|
|
85
|
+
return {
|
|
86
|
+
...attrs,
|
|
87
|
+
modelFilters : props.filters
|
|
88
|
+
};
|
|
89
|
+
default:
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
component,
|
|
96
|
+
componentProps
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
</script>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSDataTable
|
|
3
|
+
:items="authTokens"
|
|
4
|
+
:tableCode="$props.tableCode"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
>
|
|
7
|
+
<template
|
|
8
|
+
v-for="(_, name) in $slots"
|
|
9
|
+
v-slot:[name]="slotData"
|
|
10
|
+
>
|
|
11
|
+
<slot
|
|
12
|
+
:name="name"
|
|
13
|
+
v-bind="slotData"
|
|
14
|
+
/>
|
|
15
|
+
</template>
|
|
16
|
+
<template
|
|
17
|
+
#item.creationDate="{item}"
|
|
18
|
+
>
|
|
19
|
+
<FSText>
|
|
20
|
+
{{ epochToLongTimeFormat(item.creationDate) }}
|
|
21
|
+
</FSText>
|
|
22
|
+
</template>
|
|
23
|
+
<template
|
|
24
|
+
#item.dateMax="{item}"
|
|
25
|
+
>
|
|
26
|
+
<FSText>
|
|
27
|
+
{{ epochToLongTimeFormat(item.dateMax) }}
|
|
28
|
+
</FSText>
|
|
29
|
+
</template>
|
|
30
|
+
</FSDataTable>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script lang="ts">
|
|
34
|
+
import { defineComponent, type PropType, watch } from "vue";
|
|
35
|
+
import _ from "lodash";
|
|
36
|
+
|
|
37
|
+
import { useDateFormat, useAuthTokens } from "@dative-gpi/foundation-shared-services/composables";
|
|
38
|
+
import { type AuthTokenFilters } from "@dative-gpi/foundation-shared-domain/models";
|
|
39
|
+
|
|
40
|
+
import FSDataTable from "../FSDataTable.vue";
|
|
41
|
+
import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
|
|
42
|
+
|
|
43
|
+
export default defineComponent({
|
|
44
|
+
name: "FSBaseAuthTokensList",
|
|
45
|
+
components: {
|
|
46
|
+
FSDataTable,
|
|
47
|
+
FSText
|
|
48
|
+
},
|
|
49
|
+
props: {
|
|
50
|
+
authTokensFilters: {
|
|
51
|
+
type: Object as PropType<AuthTokenFilters | null>,
|
|
52
|
+
required: false,
|
|
53
|
+
default: null
|
|
54
|
+
},
|
|
55
|
+
tableCode: {
|
|
56
|
+
type: String,
|
|
57
|
+
required: true
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
setup(props) {
|
|
61
|
+
const { getMany: fetchAuthTokens, entities: authTokens } = useAuthTokens();
|
|
62
|
+
const { epochToLongTimeFormat } = useDateFormat();
|
|
63
|
+
|
|
64
|
+
watch(() => props.authTokensFilters, (next, previous) => {
|
|
65
|
+
if ((!next && !previous) || !_.isEqual(next, previous)) {
|
|
66
|
+
fetchAuthTokens(props.authTokensFilters ?? undefined);
|
|
67
|
+
}
|
|
68
|
+
}, { immediate: true });
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
authTokens,
|
|
72
|
+
epochToLongTimeFormat
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
</script>
|