@dative-gpi/foundation-core-components 1.0.137-maps4 → 1.0.137-reportV2

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.
@@ -9,9 +9,8 @@
9
9
  <script lang="ts">
10
10
  import { defineComponent, type PropType, watch, computed } from "vue";
11
11
 
12
- import type { DashboardOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
13
- import { useDashboardOrganisations } from "@dative-gpi/foundation-core-services/composables";
14
- import { useDashboardOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
12
+ import type { DashboardOrganisationFilters, DashboardOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
13
+ import { useDashboardOrganisations, useDashboardOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
15
14
 
16
15
  import FSSimpleList from "@dative-gpi/foundation-shared-components/components/lists/FSSimpleList.vue";
17
16
 
@@ -27,7 +26,7 @@ export default defineComponent({
27
26
  default: () => ({})
28
27
  },
29
28
  dashboardOrganisationTypeFilters: {
30
- type: Object as PropType<DashboardOrganisationFilters>,
29
+ type: Object as PropType<DashboardOrganisationTypeFilters>,
31
30
  required: false,
32
31
  default: () => ({})
33
32
  }
@@ -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
+ <FSChipUserOrganisationsList
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 { JobState } 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 FSChipUserOrganisationsList from "../userOrganisations/FSChipUserOrganisationsList.vue";
75
+
76
+ export default defineComponent({
77
+ name: "FSBaseReportExecutionsList",
78
+ components: {
79
+ FSChipUserOrganisationsList
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(JobState).map(e => ({
110
+ value: e.value,
111
+ text: getLabelByState(e.value)
112
+ })),
113
+ methodFilter: (value: JobState, item: JobState) => 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,135 @@
1
+ <template>
2
+ <FSDataTable
3
+ defaultMode="table"
4
+ :loading="fetchingReports"
5
+ :items="reports"
6
+ :showSelect="$props.editable"
7
+ :tableCode="tableCode"
8
+ :itemTo="$props.itemTo"
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.userIds="{ item }"
58
+ >
59
+ <FSChipUserOrganisationsList
60
+ :userOrganisationIds="item.userIds"
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 { useReports } from "@dative-gpi/foundation-core-services/composables";
75
+ import type { ReportFilters, ReportInfos } from "@dative-gpi/foundation-core-domain/models";
76
+
77
+ import FSChipUserOrganisationsList from "../userOrganisations/FSChipUserOrganisationsList.vue";
78
+
79
+
80
+ export default defineComponent({
81
+ name: "FSBaseReportsList",
82
+ components: {
83
+ FSChipUserOrganisationsList
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 { epochToLongTimeFormat } = useDateFormat();
119
+ const { getMany: fetchReports, fetching: fetchingReports, entities: reports } = useReports();
120
+
121
+
122
+ watch(() => props.reportsFilters, (next, previous) => {
123
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
124
+ fetchReports(props.reportsFilters);
125
+ }
126
+ }, { immediate: true });
127
+
128
+ return {
129
+ fetchingReports,
130
+ reports,
131
+ epochToLongTimeFormat
132
+ };
133
+ }
134
+ });
135
+ </script>
@@ -0,0 +1,81 @@
1
+ <template>
2
+ <FSRow
3
+ v-if="fetching && $props.userOrganisationIds && $props.userOrganisationIds.length > 0"
4
+ :wrap="wrapped"
5
+ >
6
+ <FSLoader
7
+ v-for="i in 4"
8
+ :key="i"
9
+ variant="chip"
10
+ height="12px"
11
+ />
12
+ </FSRow>
13
+ <FSRow
14
+ v-else
15
+ :wrap="wrapped"
16
+ >
17
+ <FSChip
18
+ v-for="(label, i) in actualUserOrganisationLabels"
19
+ :key="i"
20
+ :color="ColorEnum.Light"
21
+ :label="label"
22
+ />
23
+ </FSRow>
24
+ </template>
25
+
26
+ <script lang="ts">
27
+ import { computed, defineComponent, watch, type PropType } from "vue";
28
+
29
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
30
+ import { useUserOrganisations } from "@dative-gpi/foundation-core-services/composables";
31
+
32
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
33
+ import FSLoader from "@dative-gpi/foundation-shared-components/components/FSLoader.vue";
34
+ import FSChip from "@dative-gpi/foundation-shared-components/components/FSChip.vue";
35
+
36
+ export default defineComponent({
37
+ name: "FSChipUserOrganisationsList",
38
+ components: {
39
+ FSRow,
40
+ FSLoader,
41
+ FSChip
42
+ },
43
+ props: {
44
+ userOrganisationIds: {
45
+ type: Array as PropType<string[]>,
46
+ required: false
47
+ },
48
+ userOrganisationLabels: {
49
+ type: Array as PropType<string[]>,
50
+ required: false
51
+ },
52
+ wrapped: {
53
+ type: Boolean,
54
+ required: false,
55
+ default: true
56
+ }
57
+ },
58
+ setup(props) {
59
+ const {getMany: fetchUserOrganisations, fetching, entities: userOrganisations} = useUserOrganisations();
60
+
61
+ const actualUserOrganisationLabels = computed(() => {
62
+ return props.userOrganisationLabels || userOrganisations.value.map(u => u.name);
63
+ });
64
+
65
+ watch(() => props.userOrganisationIds, async () => {
66
+ if(props.userOrganisationIds && props.userOrganisationIds.length > 0){
67
+ fetchUserOrganisations({
68
+ userOrganisationsIds: props.userOrganisationIds
69
+ });
70
+ }
71
+ }, {immediate: true});
72
+
73
+ return {
74
+ actualUserOrganisationLabels,
75
+ userOrganisations,
76
+ ColorEnum,
77
+ fetching
78
+ };
79
+ }
80
+ });
81
+ </script>
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.137-maps4",
4
+ "version": "1.0.137-reportV2",
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.137-maps4",
14
- "@dative-gpi/foundation-core-services": "1.0.137-maps4",
15
- "@dative-gpi/foundation-shared-components": "1.0.137-maps4",
16
- "@dative-gpi/foundation-shared-domain": "1.0.137-maps4",
17
- "@dative-gpi/foundation-shared-services": "1.0.137-maps4"
13
+ "@dative-gpi/foundation-core-domain": "1.0.137-reportV2",
14
+ "@dative-gpi/foundation-core-services": "1.0.137-reportV2",
15
+ "@dative-gpi/foundation-shared-components": "1.0.137-reportV2",
16
+ "@dative-gpi/foundation-shared-domain": "1.0.137-reportV2",
17
+ "@dative-gpi/foundation-shared-services": "1.0.137-reportV2"
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": "2ff4d8aa1783b9f845daae1e8e6c9b9d23820b72"
29
+ "gitHead": "57f88a90528a7849e930dbc8eea7223a84c58c9f"
30
30
  }