@dative-gpi/foundation-core-components 1.0.35 → 1.0.37-report-v1

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.
Files changed (84) hide show
  1. package/components/autocompletes/FSAutocompleteChart.vue +18 -8
  2. package/components/autocompletes/FSAutocompleteDashboard.vue +16 -6
  3. package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +7 -1
  4. package/components/autocompletes/FSAutocompleteDataCategory.vue +11 -5
  5. package/components/autocompletes/FSAutocompleteDataDefinition.vue +7 -1
  6. package/components/autocompletes/FSAutocompleteGroup.vue +7 -1
  7. package/components/autocompletes/FSAutocompleteLocation.vue +6 -0
  8. package/components/autocompletes/FSAutocompleteManufacturer.vue +8 -0
  9. package/components/autocompletes/FSAutocompleteModel.vue +9 -1
  10. package/components/autocompletes/FSAutocompleteOrganisationType.vue +7 -1
  11. package/components/autocompletes/FSAutocompleteRole.vue +17 -6
  12. package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +7 -1
  13. package/components/autocompletes/FSAutocompleteUserOrganisation.vue +9 -1
  14. package/components/chips/FSChipGroupUserOrganisation.vue +61 -0
  15. package/components/chips/FSChipGroupUserOrganisationUI.vue +38 -0
  16. package/components/customProperties/FSMetaField.vue +31 -35
  17. package/components/customProperties/FSMetaHistory.vue +4 -4
  18. package/components/customProperties/FSMetaValue.vue +66 -33
  19. package/components/customProperties/helpers.ts +2 -1
  20. package/components/entities/FSBaseEntitiesList.vue +50 -0
  21. package/components/entities/FSDialogSelectEntities.vue +83 -0
  22. package/components/entities/FSEntityField.vue +203 -0
  23. package/components/entities/FSSelectEntitiesList.vue +209 -0
  24. package/components/entities/FSSimpleEntitiesList.vue +100 -0
  25. package/components/explorers/FSBaseDevicesExplorer.vue +310 -0
  26. package/components/explorers/FSBaseFoldersExplorer.vue +277 -0
  27. package/components/lists/FSDataTable.vue +23 -21
  28. package/components/lists/alerts/FSBaseAlertsList.vue +338 -0
  29. package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +101 -0
  30. package/components/lists/authTokens/FSBaseAuthTokensList.vue +79 -0
  31. package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +205 -0
  32. package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +206 -0
  33. package/components/lists/charts/FSBaseChartsList.vue +268 -0
  34. package/components/lists/comments/FSBaseCommentsList.vue +143 -0
  35. package/components/lists/connectivityScenarios/FSBaseConnectivityScenariosList.vue +128 -0
  36. package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +179 -0
  37. package/components/lists/dashboards/FSBaseDashboardsList.vue +235 -0
  38. package/components/lists/dashboards/FSSimpleDashboardsList.vue +62 -0
  39. package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +155 -0
  40. package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +130 -0
  41. package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +378 -0
  42. package/components/lists/deviceOrganisations/FSSimpleDeviceOrganisationsList.vue +44 -0
  43. package/components/lists/folders/FSBaseFoldersList.vue +127 -0
  44. package/components/lists/folders/FSSimpleFoldersList.vue +44 -0
  45. package/components/lists/groups/FSBaseGroupsList.vue +136 -0
  46. package/components/lists/groups/FSSimpleGroupsList.vue +44 -0
  47. package/components/lists/locations/FSBaseLocationsList.vue +118 -0
  48. package/components/lists/locations/FSSimpleLocationsList.vue +44 -0
  49. package/components/lists/models/FSBaseModelsList.vue +155 -0
  50. package/components/lists/models/FSSimpleModelsList.vue +44 -0
  51. package/components/lists/reports/FSBaseReportExecutionsList.vue +137 -0
  52. package/components/lists/reports/FSBaseReportsList.vue +140 -0
  53. package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +128 -0
  54. package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +128 -0
  55. package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +157 -0
  56. package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +145 -0
  57. package/components/lists/scenarios/FSBaseScenariosList.vue +241 -0
  58. package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +155 -0
  59. package/components/lists/serviceAccountRoleOrganisations/FSBaseServiceAccountRoleOrganisationsList.vue +128 -0
  60. package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +171 -0
  61. package/components/lists/userOrganisations/FSSimpleUserOrganisationsList.vue +45 -0
  62. package/components/tiles/FSChartTile.vue +70 -0
  63. package/components/tiles/FSDeviceOrganisationTile.vue +9 -2
  64. package/components/tiles/FSLocationTile.vue +66 -0
  65. package/components/treeviews/FSTreeViewFolder.vue +15 -3
  66. package/components/treeviews/FSTreeViewGroup.vue +22 -4
  67. package/package.json +9 -9
  68. package/utils/dashboards.ts +33 -5
  69. package/utils/index.ts +2 -2
  70. package/utils/permissions.ts +80 -0
  71. package/utils/roles.ts +4 -4
  72. package/utils/tables.ts +41 -0
  73. package/utils/users.ts +7 -4
  74. package/components/selects/FSAggregationSelector.vue +0 -51
  75. package/components/selects/FSAxisTypeSelector.vue +0 -48
  76. package/components/selects/FSDisplayAsSelector.vue +0 -52
  77. package/components/selects/FSFilterTypeSelector.vue +0 -53
  78. package/components/selects/FSHeatmapRuleSelector.vue +0 -52
  79. package/components/selects/FSOperationOnSelector.vue +0 -51
  80. package/components/selects/FSPlanningTypeSelector.vue +0 -51
  81. package/components/selects/FSPlotPerSelector.vue +0 -51
  82. package/components/selects/FSSelectSelectedEntities.vue +0 -59
  83. package/components/selects/FSSerieTypeSelector.vue +0 -51
  84. package/utils/charts.ts +0 -136
@@ -0,0 +1,137 @@
1
+ <template>
2
+ <FSDataTable
3
+ defaultMode="table"
4
+ :loading="fetchingReportExecutions"
5
+ :headersOptions="headersOptions"
6
+ :items="reportExecutions"
7
+ :tableCode="tableCode"
8
+ :groupBy="groupByExecutionDate"
9
+ :modelValue="$props.modelValue"
10
+ @update:modelValue="$emit('update:modelValue', $event)"
11
+ v-bind="$attrs"
12
+ >
13
+ <template
14
+ v-for="(_, name) in $slots"
15
+ v-slot:[name]="slotData"
16
+ >
17
+ <slot
18
+ :name="name"
19
+ v-bind="slotData"
20
+ />
21
+ </template>
22
+ <template
23
+ #item.state="{ item }"
24
+ >
25
+ <FSRow
26
+ align="center-left"
27
+ :wrap="false"
28
+ >
29
+ <FSIcon
30
+ :color="getColorByState(item.state)"
31
+ >
32
+ {{ getIconByState(item.state) }}
33
+ </FSIcon>
34
+ <FSText
35
+ font="text-overline"
36
+ :color="getColorByState(item.state)"
37
+ >
38
+ {{ getLabelByState(item.state) }}
39
+ </FSText>
40
+ </FSRow>
41
+ </template>
42
+ <template
43
+ #item.executedAt="{ item }"
44
+ >
45
+ <FSSpan
46
+ font="text-overline"
47
+ >
48
+ {{ epochToShortTimeOnlyFormat(item.executedAt) }}
49
+ </FSSpan>
50
+ </template>
51
+ <template
52
+ #item.users="{ item }"
53
+ >
54
+ <FSChipGroupUserOrganisationUI
55
+ :userOrganisationLabels="item.users"
56
+ :wrapped="false"
57
+ />
58
+ </template>
59
+ </FSDataTable>
60
+ </template>
61
+
62
+ <script lang="ts">
63
+ import { defineComponent, type PropType, computed, watch } from "vue";
64
+ import _ from "lodash";
65
+
66
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
67
+ import { JobHangfireState } from "@dative-gpi/foundation-shared-domain/enums";
68
+ import { getLabelByState, getColorByState, getIconByState } from "@dative-gpi/foundation-shared-components/tools";
69
+ import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
70
+
71
+ import type { ReportExecutionFilters } from "@dative-gpi/foundation-core-domain/models";
72
+ import { useReportExecutions } from "@dative-gpi/foundation-core-services/composables";
73
+
74
+ import FSChipGroupUserOrganisationUI from "../../chips/FSChipGroupUserOrganisationUI.vue";
75
+
76
+ export default defineComponent({
77
+ name: "FSBaseReportExecutionsList",
78
+ components: {
79
+ FSChipGroupUserOrganisationUI
80
+ },
81
+ props: {
82
+ tableCode: {
83
+ type: String as PropType<string | null>,
84
+ required: false,
85
+ default: null
86
+ },
87
+ reportExecutionsFilters: {
88
+ type: Object as PropType<ReportExecutionFilters>,
89
+ required: false,
90
+ default: null
91
+ },
92
+ modelValue: {
93
+ type: Array as PropType<string[]>,
94
+ required: false
95
+ }
96
+ },
97
+ emits: ["update:modelValue"],
98
+ setup(props) {
99
+ const { epochToLongTimeFormat, epochToLongDateFormat, epochToShortTimeOnlyFormat } = useDateFormat();
100
+ const { getMany: fetchReportExecutions, fetching: fetchingReportExecutions, entities: reportExecutions } = useReportExecutions();
101
+
102
+ const groupByExecutionDate = {
103
+ key: "executedAtGroup",
104
+ order: "desc"
105
+ };
106
+
107
+ const headersOptions = computed(() => ({
108
+ state: {
109
+ fixedFilters: getEnumEntries(JobHangfireState).map(e => ({
110
+ value: e.value,
111
+ text: getLabelByState(e.value)
112
+ })),
113
+ methodFilter: (value: JobHangfireState, item: JobHangfireState) => value == item
114
+ }
115
+ }));
116
+
117
+ watch(() => props.reportExecutionsFilters, (next, previous) => {
118
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
119
+ fetchReportExecutions(props.reportExecutionsFilters);
120
+ }
121
+ }, { immediate: true });
122
+
123
+ return {
124
+ fetchingReportExecutions,
125
+ groupByExecutionDate,
126
+ reportExecutions,
127
+ headersOptions,
128
+ getColorByState,
129
+ getIconByState,
130
+ getLabelByState,
131
+ epochToLongTimeFormat,
132
+ epochToLongDateFormat,
133
+ epochToShortTimeOnlyFormat
134
+ };
135
+ }
136
+ });
137
+ </script>
@@ -0,0 +1,140 @@
1
+ <template>
2
+ <FSDataTable
3
+ defaultMode="table"
4
+ :loading="fetchingReports"
5
+ :items="reports"
6
+ :showSelect="$props.editable"
7
+ :tableCode="tableCode"
8
+ :itemTo="routerLink"
9
+ :modelValue="$props.modelValue"
10
+ @update:modelValue="$emit('update:modelValue', $event)"
11
+ v-bind="$attrs"
12
+ >
13
+ <template
14
+ v-for="(_, name) in $slots"
15
+ v-slot:[name]="slotData"
16
+ >
17
+ <slot
18
+ :name="name"
19
+ v-bind="slotData"
20
+ />
21
+ </template>
22
+ <template
23
+ #item.icon="{ item }"
24
+ >
25
+ <FSIcon >
26
+ {{ item.icon }}
27
+ </FSIcon>
28
+ </template>
29
+ <template
30
+ #item.lastExecution="{ item }"
31
+ >
32
+ <FSSpan
33
+ font="text-overline"
34
+ >
35
+ {{ epochToLongTimeFormat(item.lastExecution) }}
36
+ </FSSpan>
37
+ </template>
38
+ <template
39
+ #item.nextExecution="{ item }"
40
+ >
41
+ <FSSpan
42
+ font="text-overline"
43
+ >
44
+ {{ epochToLongTimeFormat(item.nextExecution) }}
45
+ </FSSpan>
46
+ </template>
47
+ <template
48
+ #item.createdAt="{ item }"
49
+ >
50
+ <FSSpan
51
+ font="text-overline"
52
+ >
53
+ {{ epochToLongTimeFormat(item.createdAt) }}
54
+ </FSSpan>
55
+ </template>
56
+ <template
57
+ #item.users="{ item }"
58
+ >
59
+ <FSChipGroupUserOrganisation
60
+ :userOrganisationIds="item.users"
61
+ :wrapped="false"
62
+ />
63
+ </template>
64
+ </FSDataTable>
65
+ </template>
66
+
67
+ <script lang="ts">
68
+ import _ from "lodash";
69
+ import type { RouteLocation } from "vue-router";
70
+ import { defineComponent, type PropType, watch } from "vue";
71
+
72
+ import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
73
+
74
+ import { useRouteOrganisation, useReports } from "@dative-gpi/foundation-core-services/composables";
75
+ import type { ReportFilters, ReportInfos } from "@dative-gpi/foundation-core-domain/models";
76
+
77
+ import FSChipGroupUserOrganisation from "../../chips/FSChipGroupUserOrganisation.vue";
78
+
79
+
80
+ export default defineComponent({
81
+ name: "FSBaseReportsList",
82
+ components: {
83
+ FSChipGroupUserOrganisation
84
+ },
85
+ props: {
86
+ tableCode: {
87
+ type: String as PropType<string | null>,
88
+ required: false,
89
+ default: null
90
+ },
91
+ reportsFilters: {
92
+ type: Object as PropType<ReportFilters>,
93
+ required: false,
94
+ default: null
95
+ },
96
+ editable: {
97
+ type: Boolean,
98
+ required: false,
99
+ default: true
100
+ },
101
+ itemTo: {
102
+ type: Function as PropType<(item: ReportInfos) => Partial<RouteLocation>>,
103
+ required: false
104
+ },
105
+ singleSelect: {
106
+ type: Boolean,
107
+ required: false,
108
+ default: false
109
+ },
110
+ modelValue: {
111
+ type: Array as PropType<string[]>,
112
+ default: () => [],
113
+ required: false
114
+ }
115
+ },
116
+ emits: ["update:modelValue"],
117
+ setup(props) {
118
+ const { $r } = useRouteOrganisation();
119
+ const { epochToLongTimeFormat } = useDateFormat();
120
+ const { getMany: fetchReports, fetching: fetchingReports, entities: reports } = useReports();
121
+
122
+ const routerLink = (item: ReportInfos ) => {
123
+ return $r({ name: "report", params: { entityId: item.id } });
124
+ };
125
+
126
+ watch(() => props.reportsFilters, (next, previous) => {
127
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
128
+ fetchReports(props.reportsFilters);
129
+ }
130
+ }, { immediate: true });
131
+
132
+ return {
133
+ fetchingReports,
134
+ reports,
135
+ routerLink,
136
+ epochToLongTimeFormat
137
+ };
138
+ }
139
+ });
140
+ </script>
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <FSDataTable
3
+ :items="roleOrganisationTypes"
4
+ :itemTo="$props.itemTo"
5
+ :loading="fetchingRoleOrganisations"
6
+ :showSelect="$props.editable"
7
+ :tableCode="$props.tableCode"
8
+ :modelValue="$props.modelValue"
9
+ @update:modelValue="$emit('update:modelValue', $event)"
10
+ v-bind="$attrs"
11
+ >
12
+ <template
13
+ v-for="(_, name) in $slots"
14
+ v-slot:[name]="slotData"
15
+ >
16
+ <slot
17
+ :name="name"
18
+ v-bind="slotData"
19
+ />
20
+ </template>
21
+ <template
22
+ #item.icon="{ item }"
23
+ >
24
+ <FSIcon>
25
+ {{ item.icon }}
26
+ </FSIcon>
27
+ </template>
28
+ <template
29
+ #item.userType="{ item }"
30
+ >
31
+ <FSRow
32
+ align="center-left"
33
+ >
34
+ <FSIcon>
35
+ {{ userTypeIcon(item.userType) }}
36
+ </FSIcon>
37
+ <FSText>
38
+ {{ userTypeLabel(item.userType) }}
39
+ </FSText>
40
+ </FSRow>
41
+ </template>
42
+ <template
43
+ #item.tags="{ item }"
44
+ >
45
+ <FSTagGroup
46
+ variant="slide"
47
+ :editable="false"
48
+ :tags="item.tags"
49
+ />
50
+ </template>
51
+ </FSDataTable>
52
+ </template>
53
+
54
+ <script lang="ts">
55
+ import type { PropType} from "vue";
56
+ import { defineComponent, watch } from "vue";
57
+ import type { RouteLocation } from "vue-router";
58
+ import _ from "lodash";
59
+
60
+ import type { RoleOrganisationTypeFilters, RoleOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
61
+ import { userTypeIcon, userTypeLabel } from "@dative-gpi/foundation-core-components/utils";
62
+ import { useRoleOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
63
+
64
+ import FSDataTable from "../FSDataTable.vue";
65
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
66
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
67
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
68
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
69
+
70
+ export default defineComponent({
71
+ name: "FSBaseRoleOrganisationTypesList",
72
+ components: {
73
+ FSRow,
74
+ FSIcon,
75
+ FSText,
76
+ FSTagGroup,
77
+ FSDataTable,
78
+ },
79
+ props: {
80
+ tableCode: {
81
+ type: String as PropType<string | null>,
82
+ required: false,
83
+ default: null
84
+ },
85
+ roleOrganisationTypesFilters: {
86
+ type: Object as PropType<RoleOrganisationTypeFilters | null>,
87
+ required: false,
88
+ default: null
89
+ },
90
+ itemTo: {
91
+ type: Function as PropType<(item: RoleOrganisationTypeInfos) => Partial<RouteLocation>>,
92
+ required: false
93
+ },
94
+ editable: {
95
+ type: Boolean,
96
+ required: false,
97
+ default: true
98
+ },
99
+ modelValue: {
100
+ type: Array as PropType<string[]>,
101
+ required: false,
102
+ default: () => []
103
+ }
104
+ },
105
+ emits: ["update:modelValue"],
106
+ setup(props) {
107
+ const { getMany: getManyRoleOrganisationTypes, entities: roleOrganisationTypes, fetching: fetchingRoleOrganisations } = useRoleOrganisationTypes();
108
+
109
+ const isSelected = (id: string): boolean => {
110
+ return props.modelValue.includes(id);
111
+ };
112
+
113
+ watch(() => props.roleOrganisationTypesFilters, (next, previous) => {
114
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
115
+ getManyRoleOrganisationTypes(props.roleOrganisationTypesFilters ?? undefined);
116
+ }
117
+ }, { immediate: true });
118
+
119
+ return {
120
+ fetchingRoleOrganisations,
121
+ roleOrganisationTypes,
122
+ userTypeLabel,
123
+ userTypeIcon,
124
+ isSelected
125
+ };
126
+ }
127
+ });
128
+ </script>
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <FSDataTable
3
+ :loading="fetchingRoleOrganisations"
4
+ :showSelect="$props.editable"
5
+ :tableCode="$props.tableCode"
6
+ :items="roleOrganisations"
7
+ :itemTo="$props.itemTo"
8
+ :modelValue="$props.modelValue"
9
+ @update:modelValue="$emit('update:modelValue', $event)"
10
+ v-bind="$attrs"
11
+ >
12
+ <template
13
+ v-for="(_, name) in $slots"
14
+ v-slot:[name]="slotData"
15
+ >
16
+ <slot
17
+ :name="name"
18
+ v-bind="slotData"
19
+ />
20
+ </template>
21
+ <template
22
+ #item.icon="{ item }"
23
+ >
24
+ <FSIcon>
25
+ {{ item.icon }}
26
+ </FSIcon>
27
+ </template>
28
+ <template
29
+ #item.userType="{ item }"
30
+ >
31
+ <FSRow
32
+ align="center-left"
33
+ >
34
+ <FSIcon>
35
+ {{ userTypeIcon(item.userType) }}
36
+ </FSIcon>
37
+ <FSText>
38
+ {{ userTypeLabel(item.userType) }}
39
+ </FSText>
40
+ </FSRow>
41
+ </template>
42
+ <template
43
+ #item.tags="{ item }"
44
+ >
45
+ <FSTagGroup
46
+ variant="slide"
47
+ :editable="false"
48
+ :tags="item.tags"
49
+ />
50
+ </template>
51
+ </FSDataTable>
52
+ </template>
53
+
54
+ <script lang="ts">
55
+ import { defineComponent, type PropType, watch } from "vue";
56
+ import { type RouteLocation } from "vue-router";
57
+ import _ from "lodash";
58
+
59
+ import { type RoleOrganisationFilters, type RoleOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
60
+ import { userTypeIcon, userTypeLabel } from "@dative-gpi/foundation-core-components/utils";
61
+ import { useRoleOrganisations } from "@dative-gpi/foundation-core-services/composables";
62
+
63
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
64
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
65
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
66
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
67
+
68
+ import FSDataTable from "../FSDataTable.vue";
69
+
70
+ export default defineComponent({
71
+ name: "FSBaseRoleOrganisationsList",
72
+ components: {
73
+ FSDataTable,
74
+ FSTagGroup,
75
+ FSIcon,
76
+ FSText,
77
+ FSRow
78
+ },
79
+ props: {
80
+ tableCode: {
81
+ type: String as PropType<string | null>,
82
+ required: false,
83
+ default: null
84
+ },
85
+ roleOrganisationsFilters: {
86
+ type: Object as PropType<RoleOrganisationFilters | null>,
87
+ required: false,
88
+ default: null
89
+ },
90
+ itemTo: {
91
+ type: Function as PropType<(item: RoleOrganisationInfos) => Partial<RouteLocation>>,
92
+ required: false
93
+ },
94
+ editable: {
95
+ type: Boolean,
96
+ required: false,
97
+ default: true
98
+ },
99
+ modelValue: {
100
+ type: Array as PropType<string[]>,
101
+ required: false,
102
+ default: () => []
103
+ }
104
+ },
105
+ emits: ["update:modelValue"],
106
+ setup(props) {
107
+ const { getMany: getManyRoleOrganisations, entities: roleOrganisations, fetching: fetchingRoleOrganisations } = useRoleOrganisations();
108
+
109
+ const isSelected = (id: string): boolean => {
110
+ return props.modelValue.includes(id);
111
+ };
112
+
113
+ watch(() => props.roleOrganisationsFilters, (next, previous) => {
114
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
115
+ getManyRoleOrganisations(props.roleOrganisationsFilters ?? undefined);
116
+ }
117
+ }, { immediate: true });
118
+
119
+ return {
120
+ fetchingRoleOrganisations,
121
+ roleOrganisations,
122
+ userTypeLabel,
123
+ userTypeIcon,
124
+ isSelected
125
+ };
126
+ }
127
+ });
128
+ </script>
@@ -0,0 +1,157 @@
1
+ <template>
2
+ <FSDataTable
3
+ :items="scenarioOrganisationTypes"
4
+ :itemTo="$props.itemTo"
5
+ :loading="fetchingScenarioOrganisationTypes"
6
+ :showSelect="$props.editable"
7
+ :tableCode="$props.tableCode"
8
+ :modelValue="$props.modelValue"
9
+ @update:modelValue="$emit('update:modelValue', $event)"
10
+ v-bind="$attrs"
11
+ >
12
+ <template
13
+ v-for="(_, name) in $slots"
14
+ v-slot:[name]="slotData"
15
+ >
16
+ <slot
17
+ :name="name"
18
+ v-bind="slotData"
19
+ />
20
+ </template>
21
+
22
+ <template
23
+ #item.icon="{ item }"
24
+ >
25
+ <FSIcon>
26
+ {{ item.icon }}
27
+ </FSIcon>
28
+ </template>
29
+
30
+ <template
31
+ #item.criticity="{ item }"
32
+ >
33
+ <FSRow
34
+ align="center-left"
35
+ >
36
+ <FSIcon
37
+ :color="AlertTools.criticityColor(item.criticity)"
38
+ >
39
+ {{ AlertTools.criticityIcon(item.criticity) }}
40
+ </FSIcon>
41
+ <FSSpan>
42
+ {{ AlertTools.criticityLabel(item.criticity) }}
43
+ </FSSpan>
44
+ </FSRow>
45
+ </template>
46
+
47
+ <template
48
+ #item.imageId="{ item }"
49
+ >
50
+ <FSImage
51
+ v-if="item.imageId"
52
+ height="32px"
53
+ width="32px"
54
+ :imageId="item.imageId"
55
+ :thumbnail="true"
56
+ />
57
+ </template>
58
+
59
+ <template
60
+ #item.tags="{ item }"
61
+ >
62
+ <FSTagGroup
63
+ variant="slide"
64
+ :editable="false"
65
+ :tags="item.tags"
66
+ />
67
+ </template>
68
+ </FSDataTable>
69
+ </template>
70
+
71
+ <script lang="ts">
72
+ import { computed, defineComponent, type PropType, watch } from "vue";
73
+ import type { RouteLocation } from "vue-router";
74
+ import _ from "lodash";
75
+
76
+ import { Criticity } from "@dative-gpi/foundation-shared-domain/enums";
77
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
78
+ import { AlertTools } from "@dative-gpi/foundation-shared-components/tools";
79
+
80
+ import type { ScenarioOrganisationTypeFilters, ScenarioOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
81
+ import { useScenarioOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
82
+
83
+ import FSDataTable from "../FSDataTable.vue";
84
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
85
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
86
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
87
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
88
+
89
+ export default defineComponent({
90
+ name: "FSBaseScenarioOrganisationTypesList",
91
+ components: {
92
+ FSDataTable,
93
+ FSTagGroup,
94
+ FSImage,
95
+ FSIcon,
96
+ FSRow,
97
+ },
98
+ props: {
99
+ tableCode: {
100
+ type: String as PropType<string | null>,
101
+ required: false,
102
+ default: null
103
+ },
104
+ scenarioOrganisationTypeFilters: {
105
+ type: Object as PropType<ScenarioOrganisationTypeFilters>,
106
+ required: false,
107
+ default: null
108
+ },
109
+ itemTo: {
110
+ type: Function as PropType<(item: ScenarioOrganisationTypeInfos) => Partial<RouteLocation>>,
111
+ required: false
112
+ },
113
+ editable: {
114
+ type: Boolean,
115
+ required: false,
116
+ default: true
117
+ },
118
+ modelValue: {
119
+ type: Array as PropType<string[]>,
120
+ default: () => [],
121
+ required: false
122
+ }
123
+ },
124
+ emits: ["update:modelValue"],
125
+ setup(props) {
126
+ const { entities: scenarioOrganisationTypes, fetching: fetchingScenarioOrganisationTypes, getMany: getManyScenarioOrganisationTypes } = useScenarioOrganisationTypes();
127
+
128
+ const headersOptions = computed(() => ({
129
+ criticity: {
130
+ fixedFilters: getEnumEntries(Criticity).map(e => ({
131
+ value: e.value,
132
+ text: AlertTools.criticityLabel(e.value)
133
+ })),
134
+ methodFilter: (value: Criticity, item: Criticity) => value == item
135
+ }
136
+ }));
137
+
138
+ const isSelected = (id: string): boolean => {
139
+ return props.modelValue.includes(id);
140
+ };
141
+
142
+ watch(() => props.scenarioOrganisationTypeFilters, (next, previous) => {
143
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
144
+ getManyScenarioOrganisationTypes(props.scenarioOrganisationTypeFilters);
145
+ }
146
+ }, { immediate: true });
147
+
148
+ return {
149
+ fetchingScenarioOrganisationTypes,
150
+ scenarioOrganisationTypes,
151
+ headersOptions,
152
+ AlertTools,
153
+ isSelected
154
+ };
155
+ }
156
+ });
157
+ </script>