@dative-gpi/foundation-core-components 1.0.54 → 1.0.56

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.
@@ -2,7 +2,7 @@
2
2
  <FSDataTable
3
3
  rowGap="6px"
4
4
  :rowColor="criticityColor"
5
- :itemTo="routerLink"
5
+ :itemTo="$props.itemTo"
6
6
  :items="alertsOrdered"
7
7
  :loading="fetchingAlerts"
8
8
  :tableCode="$props.tableCode"
@@ -10,6 +10,15 @@
10
10
  @update:modelValue="$emit('update:modelValue', $event)"
11
11
  v-bind="$attrs"
12
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>
13
22
  <template
14
23
  #toolbar
15
24
  >
@@ -208,11 +217,10 @@
208
217
 
209
218
  <script lang="ts">
210
219
  import type { PropType} from "vue";
220
+ import type { RouteLocation } from "vue-router";
211
221
  import { computed, defineComponent, ref, watch } from "vue";
212
222
  import _ from "lodash";
213
223
 
214
- import { useRouter } from "vue-router";
215
-
216
224
  import type { AlertFilters, AlertInfos } from "@dative-gpi/foundation-core-domain/models";
217
225
  import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
218
226
  import { useAlerts } from "@dative-gpi/foundation-core-services/composables";
@@ -271,13 +279,16 @@ export default defineComponent({
271
279
  tableCode: {
272
280
  type: String,
273
281
  required: true
282
+ },
283
+ itemTo: {
284
+ type: Function as PropType<(item: AlertInfos) => Partial<RouteLocation>>,
285
+ required: false
274
286
  }
275
287
  },
276
288
  emits: ["update:modelValue"],
277
289
  setup(props) {
278
290
  const { getMany: getManyAlerts, entities: alerts, fetching : fetchingAlerts } = useAlerts();
279
291
  const { epochToShortTimeFormat } = useDateFormat();
280
- const router = useRouter();
281
292
 
282
293
  const innerNotTreatedOnly = ref<boolean | undefined>(props.notAcknowledged);
283
294
  const innerHidePending = ref<boolean | undefined>(props.hidePending);
@@ -289,10 +300,6 @@ export default defineComponent({
289
300
  return AlertTools.criticityColor(row.criticity);
290
301
  };
291
302
 
292
- const routerLink = (item: any) => {
293
- router.push({ name: "alert", params: { entityId: item.id } });
294
- };
295
-
296
303
  const alertsOrdered = computed(() => {
297
304
  const als = [...alerts.value]
298
305
  return als.sort((a: AlertInfos, b: AlertInfos) => {
@@ -334,8 +341,7 @@ export default defineComponent({
334
341
  endDate,
335
342
  innerHidePending,
336
343
  epochToShortTimeFormat,
337
- criticityColor,
338
- routerLink
344
+ criticityColor
339
345
  };
340
346
  }
341
347
  });
@@ -0,0 +1,164 @@
1
+ <template>
2
+ <FSDataTable
3
+ :items="dashboardOrganisationTypes"
4
+ :itemTo="$props.itemTo"
5
+ :tableCode="$props.tableCode"
6
+ :modelValue="$props.modelValue"
7
+ @update:modelValue="$emit('update:modelValue', $event)"
8
+ v-bind="$attrs"
9
+ >
10
+ <template
11
+ v-for="(_, name) in $slots"
12
+ v-slot:[name]="slotData"
13
+ >
14
+ <slot
15
+ :name="name"
16
+ v-bind="slotData"
17
+ />
18
+ </template>
19
+ <template
20
+ #item.main="{ item }"
21
+ >
22
+ <FSRow>
23
+ <FSIcon
24
+ v-if="item.id === organisationMainDashboardId"
25
+ >
26
+ mdi-account-group-outline
27
+ </FSIcon>
28
+ <FSIcon
29
+ v-if="item.id === userOrganisationMainDashboardId"
30
+ >
31
+ mdi-home
32
+ </FSIcon>
33
+ </FSRow>
34
+ </template>
35
+ <template
36
+ #item.icon="{ item }"
37
+ >
38
+ <FSIcon>
39
+ {{ item.icon }}
40
+ </FSIcon>
41
+ </template>
42
+ <template
43
+ #item.organisationTypeLabel="{ item }"
44
+ >
45
+ <FSText
46
+ v-if="item.organisationTypeId"
47
+ :label="item.organisationTypeLabel"
48
+ />
49
+ <FSChip
50
+ v-else
51
+ variant="standard"
52
+ :label="$tr('ui.common.all', 'All')"
53
+ />
54
+ </template>
55
+ <template
56
+ #item.tile="{ item, toggleSelect }"
57
+ >
58
+ <FSDashboardOrganisationTypeTileUI
59
+ :bottomColor="item.colors"
60
+ :to="$props.itemTo && $props.itemTo(item)"
61
+ :modelValue="isSelected(item.id)"
62
+ @update:modelValue="toggleSelect(item)"
63
+ v-bind="item"
64
+ />
65
+ </template>
66
+ </FSDataTable>
67
+ </template>
68
+
69
+ <script lang="ts">
70
+ import type { PropType} from "vue";
71
+ import type { RouteLocation } from "vue-router";
72
+ import { computed, defineComponent, onMounted, watch } from "vue";
73
+ import _ from "lodash";
74
+
75
+ import { useAppOrganisationId, useCurrentUserOrganisation, useDashboardOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
76
+ import type { DashboardOrganisationTypeFilters, DashboardOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
77
+ import { useOrganisation } from "@dative-gpi/foundation-shared-services/composables";
78
+
79
+ import FSDataTable from "../FSDataTable.vue";
80
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
81
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
82
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
83
+ import FSChip from "@dative-gpi/foundation-shared-components/components/FSChip.vue";
84
+ import FSDashboardOrganisationTypeTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTypeTileUI.vue";
85
+
86
+ export default defineComponent({
87
+ name: "FSBaseDashboardOrganisationTypesList",
88
+ components: {
89
+ FSDataTable,
90
+ FSIcon,
91
+ FSRow,
92
+ FSText,
93
+ FSChip,
94
+ FSDashboardOrganisationTypeTileUI
95
+ },
96
+ props: {
97
+ dashboardOrganisationTypeFilters: {
98
+ type: Object as PropType<DashboardOrganisationTypeFilters>,
99
+ default: undefined,
100
+ required: false
101
+ },
102
+ itemTo: {
103
+ type: Function as PropType<(item: DashboardOrganisationTypeInfos) => Partial<RouteLocation>>,
104
+ required: false
105
+ },
106
+ modelValue: {
107
+ type: Array as PropType<string[]>,
108
+ required: false,
109
+ default: () => []
110
+ },
111
+ tableCode: {
112
+ type: String,
113
+ required: true
114
+ },
115
+ },
116
+ setup(props) {
117
+ const { getMany: getDashboardOrganisationTypes, entities: dashboardOrganisationTypes } = useDashboardOrganisationTypes();
118
+ const { fetch: fetchUserOrganisation, entity: userOrganisation } = useCurrentUserOrganisation();
119
+ const { get: fetchOrganisation, entity: organisation } = useOrganisation();
120
+ const { organisationId } = useAppOrganisationId();
121
+
122
+ const userOrganisationMainDashboardId = computed((): string | null => {
123
+ if (userOrganisation.value) {
124
+ return userOrganisation.value.mainDashboardId;
125
+ }
126
+ return null;
127
+ });
128
+
129
+ const organisationMainDashboardId = computed((): string | null => {
130
+ if (organisation.value) {
131
+ return organisation.value.mainDashboardId;
132
+ }
133
+ return null;
134
+ });
135
+
136
+ const isSelected = (id: string): boolean => {
137
+ return props.modelValue.includes(id);
138
+ };
139
+
140
+ onMounted(() => {
141
+ fetchUserOrganisation();
142
+ });
143
+
144
+ watch(organisationId, () => {
145
+ if (organisationId.value) {
146
+ fetchOrganisation(organisationId.value);
147
+ }
148
+ }, { immediate: true });
149
+
150
+ watch(() => props.dashboardOrganisationTypeFilters, (next, previous) => {
151
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
152
+ getDashboardOrganisationTypes(props.dashboardOrganisationTypeFilters);
153
+ }
154
+ }, { immediate: true });
155
+
156
+ return {
157
+ userOrganisationMainDashboardId,
158
+ organisationMainDashboardId,
159
+ dashboardOrganisationTypes,
160
+ isSelected,
161
+ };
162
+ }
163
+ });
164
+ </script>
@@ -123,7 +123,12 @@ export default defineComponent({
123
123
  tableCode: {
124
124
  type: String,
125
125
  required: true
126
- }
126
+ },
127
+ modelValue: {
128
+ type: Array as PropType<string[]>,
129
+ default: () => [],
130
+ required: false
131
+ },
127
132
  },
128
133
  emits: ["update:modelValue", "update:type"],
129
134
  setup(props, { emit }) {
@@ -134,7 +139,7 @@ export default defineComponent({
134
139
  const { entity: organisation, get: getOrganisation } = useOrganisation();
135
140
  const { organisationId } = useAppOrganisationId();
136
141
 
137
- const selecteds = ref<string[]>([]);
142
+ const selecteds = ref<string[]>(props.modelValue);
138
143
 
139
144
  const items = computed((): DashboardsListItem[] => {
140
145
  return _.sortBy([
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.54",
4
+ "version": "1.0.56",
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.54",
14
- "@dative-gpi/foundation-core-services": "1.0.54",
15
- "@dative-gpi/foundation-shared-components": "1.0.54",
16
- "@dative-gpi/foundation-shared-domain": "1.0.54",
17
- "@dative-gpi/foundation-shared-services": "1.0.54"
13
+ "@dative-gpi/foundation-core-domain": "1.0.56",
14
+ "@dative-gpi/foundation-core-services": "1.0.56",
15
+ "@dative-gpi/foundation-shared-components": "1.0.56",
16
+ "@dative-gpi/foundation-shared-domain": "1.0.56",
17
+ "@dative-gpi/foundation-shared-services": "1.0.56"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@dative-gpi/bones-ui": "^0.0.75",
@@ -26,5 +26,5 @@
26
26
  "sass": "1.71.1",
27
27
  "sass-loader": "13.3.2"
28
28
  },
29
- "gitHead": "332546e736d95d481dc97c06af935200d8344b2c"
29
+ "gitHead": "c77d95e9a7724fa4a39d94b0b2bd0fa9d4fbdefc"
30
30
  }