@dative-gpi/foundation-core-components 1.0.92 → 1.0.94

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.
@@ -57,6 +57,11 @@ export default defineComponent({
57
57
  required: false,
58
58
  default: 1000
59
59
  },
60
+ extraHeaders: {
61
+ type: Array as PropType<FSDataTableColumn[]>,
62
+ required: false,
63
+ default: () => []
64
+ },
60
65
  headersOptions: {
61
66
  type: Object as PropType<{ [key: string]: Partial<FSDataTableColumn> }>,
62
67
  required: false,
@@ -70,7 +75,7 @@ export default defineComponent({
70
75
  const { getTable, setTable } = useTables();
71
76
  const { debounce, cancel } = useDebounce();
72
77
 
73
- const computedTable = computed(() => computeTable(props.headersOptions, props.defaultMode));
78
+ const computedTable = computed(() => computeTable(props.headersOptions, props.defaultMode, props.extraHeaders));
74
79
 
75
80
  onUnmounted(() => {
76
81
  cancel();
@@ -93,15 +93,19 @@ import { computed, defineComponent, type PropType, watch } from "vue";
93
93
  import type { RouteLocation } from "vue-router";
94
94
  import _ from "lodash";
95
95
 
96
+ import { ChartType } from "@dative-gpi/foundation-shared-domain/enums";
97
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
98
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
99
+ import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
100
+
96
101
  import type { ChartModelLabel, ChartOrganisationTypeFilters, ChartOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
97
102
  import { useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
98
- import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
99
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
100
103
 
101
104
  import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
102
105
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
103
106
  import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
104
107
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
108
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
105
109
 
106
110
  import FSDataTable from "../FSDataTable.vue";
107
111
 
@@ -112,7 +116,8 @@ export default defineComponent({
112
116
  FSDataTable,
113
117
  FSTagGroup,
114
118
  FSImage,
115
- FSIcon
119
+ FSIcon,
120
+ FSRow
116
121
  },
117
122
  props: {
118
123
  tableCode: {
@@ -153,7 +158,15 @@ export default defineComponent({
153
158
  text: m.label
154
159
  })),
155
160
  methodFilter: (value: string, items: ChartModelLabel[]) => items.some(ml => ml.id == value)
156
- }}));
161
+ },
162
+ chartType: {
163
+ fixedFilters: getEnumEntries(ChartType).filter(f => f.value != ChartType.None).map(e => ({
164
+ value: e.value,
165
+ text: chartTypeLabel(e.value)
166
+ })),
167
+ methodFilter: (value: ChartType, item: ChartType) => value == item
168
+ }
169
+ }));
157
170
 
158
171
  const isSelected = (id: string): boolean => {
159
172
  return props.modelValue.includes(id);
@@ -93,11 +93,15 @@ import { computed, defineComponent, type PropType, watch } from "vue";
93
93
  import type { RouteLocation } from "vue-router";
94
94
  import _ from "lodash";
95
95
 
96
- import type { ChartModelLabel, ChartOrganisationFilters, ChartOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
96
+ import { ChartType } from "@dative-gpi/foundation-shared-domain/enums";
97
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
98
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
97
99
  import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
100
+
101
+ import type { ChartModelLabel, ChartOrganisationFilters, ChartOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
98
102
  import { useChartOrganisations } from "@dative-gpi/foundation-core-services/composables";
99
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
100
103
 
104
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
101
105
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
102
106
  import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
103
107
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
@@ -105,14 +109,16 @@ import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/t
105
109
 
106
110
  import FSDataTable from "../FSDataTable.vue";
107
111
 
112
+
108
113
  export default defineComponent({
109
114
  name: "FSBaseChartOrganisationsList",
110
115
  components: {
116
+ FSChartTileUI,
111
117
  FSDataTable,
112
- FSIcon,
113
- FSImage,
114
118
  FSTagGroup,
115
- FSChartTileUI
119
+ FSImage,
120
+ FSIcon,
121
+ FSRow,
116
122
  },
117
123
  props: {
118
124
  tableCode: {
@@ -153,7 +159,15 @@ export default defineComponent({
153
159
  text: m.label
154
160
  })),
155
161
  methodFilter: (value: string, items: ChartModelLabel[]) => items.some(ml => ml.id == value)
156
- }}));
162
+ },
163
+ chartType: {
164
+ fixedFilters: getEnumEntries(ChartType).filter(f => f.value != ChartType.None).map(e => ({
165
+ value: e.value,
166
+ text: chartTypeLabel(e.value)
167
+ })),
168
+ methodFilter: (value: ChartType, item: ChartType) => value == item
169
+ }
170
+ }));
157
171
 
158
172
 
159
173
  const isSelected = (id: string): boolean => {
@@ -93,15 +93,19 @@
93
93
  import { defineComponent, type PropType, watch, computed } from "vue";
94
94
  import _ from "lodash";
95
95
 
96
+ import { ChartType } from "@dative-gpi/foundation-shared-domain/enums";
97
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
98
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
99
+ import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
100
+
96
101
  import type { ChartModelLabel, ChartOrganisationFilters, ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
97
102
  import { useChartOrganisations, useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
98
- import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
99
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
100
103
 
101
104
  import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
102
105
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
103
106
  import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
104
107
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
108
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
105
109
 
106
110
  import FSDataTable from "../FSDataTable.vue";
107
111
 
@@ -112,7 +116,8 @@ export default defineComponent({
112
116
  FSDataTable,
113
117
  FSTagGroup,
114
118
  FSImage,
115
- FSIcon
119
+ FSIcon,
120
+ FSRow
116
121
  },
117
122
  props: {
118
123
  tableCode: {
@@ -198,7 +203,15 @@ export default defineComponent({
198
203
  text: m.label
199
204
  })),
200
205
  methodFilter: (value: string, items: ChartModelLabel[]) => items.some(ml => ml.id == value)
201
- }}));
206
+ },
207
+ chartType: {
208
+ fixedFilters: getEnumEntries(ChartType).filter(f => f.value != ChartType.None).map(e => ({
209
+ value: e.value,
210
+ text: chartTypeLabel(e.value)
211
+ })),
212
+ methodFilter: (value: ChartType, item: ChartType) => value == item
213
+ }
214
+ }));
202
215
 
203
216
  const update = (value : string) => {
204
217
  const item = isSelected(value);
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <FSDataTable
3
+ :loading="fetchingConnectivityScenarios"
4
+ :modelValue="$props.modelValue"
5
+ :items="connectivityScenarios"
6
+ :tableCode="$props.tableCode"
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
+
20
+ <template
21
+ #item.time="{ item }"
22
+ >
23
+ {{ getTimeBestString(item.time) }}
24
+ </template>
25
+
26
+ <template
27
+ #item.deviceOrganisationImageId="{ item }"
28
+ >
29
+ <FSImage
30
+ v-if="item.deviceOrganisationImageId"
31
+ width="34px"
32
+ height="34px"
33
+ :imageId="item.deviceOrganisationImageId"
34
+ />
35
+ </template>
36
+ <template
37
+ #item.deviceOrganisationConnectivity="{ item }"
38
+ >
39
+ <FSIcon
40
+ v-if="item.deviceOrganisationConnectivity"
41
+ :icon="item.deviceOrganisationConnectivity.icon"
42
+ :color="item.deviceOrganisationConnectivity.color"
43
+ />
44
+ </template>
45
+ <template
46
+ #item.warnDeviceManager="{ item }"
47
+ >
48
+ <FSIconCheck
49
+ :value="item.warnDeviceManager"
50
+ />
51
+ </template>
52
+ <template
53
+ #item.warnOnReconnection="{ item }"
54
+ >
55
+ <FSIconCheck
56
+ :value="item.warnOnReconnection"
57
+ />
58
+ </template>
59
+ </FSDataTable>
60
+ </template>
61
+
62
+ <script lang="ts">
63
+ import { defineComponent, type PropType, watch } from "vue";
64
+ import _ from "lodash";
65
+
66
+ import { ConnectivityStatus } from "@dative-gpi/foundation-shared-domain/enums";
67
+ import {ColorEnum } from "@dative-gpi/foundation-shared-components/models";
68
+ import { getTimeBestString } from "@dative-gpi/foundation-shared-components/utils"
69
+
70
+ import type { ConnectivityScenarioFilters } from "@dative-gpi/foundation-core-domain/models";
71
+ import { useConnectivityScenarios } from "@dative-gpi/foundation-core-services/composables";
72
+
73
+ import FSDataTable from "../FSDataTable.vue";
74
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
75
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
76
+ import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
77
+
78
+ export default defineComponent({
79
+ name: "FSBaseConnectivityScenariosList",
80
+ components: {
81
+ FSDataTable,
82
+ FSIconCheck,
83
+ FSImage,
84
+ FSIcon
85
+ },
86
+ props: {
87
+ tableCode: {
88
+ type: String as PropType<string | null>,
89
+ required: false,
90
+ default: null
91
+ },
92
+ modelValue: {
93
+ type: Array as PropType<string[]>,
94
+ default: () => [],
95
+ required: false
96
+ },
97
+ connectivityScenarioFilters: {
98
+ type: Object as PropType<ConnectivityScenarioFilters>,
99
+ required: false,
100
+ default: null
101
+ }
102
+ },
103
+ emits: ["update:modelValue"],
104
+ setup(props) {
105
+ const { entities: connectivityScenarios, fetching: fetchingConnectivityScenarios, getMany: getManyConnectivityScenarios } = useConnectivityScenarios();
106
+
107
+ const fetch = () =>{
108
+ getManyConnectivityScenarios(props.connectivityScenarioFilters);
109
+ }
110
+
111
+ watch(() => [props.connectivityScenarioFilters], (next, previous) => {
112
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
113
+ fetch();
114
+ }
115
+ }, { immediate: true });
116
+
117
+
118
+ return {
119
+ fetchingConnectivityScenarios,
120
+ connectivityScenarios,
121
+ ConnectivityStatus,
122
+ ColorEnum,
123
+ getTimeBestString
124
+ };
125
+ }
126
+ });
127
+ </script>
@@ -26,6 +26,23 @@
26
26
  {{ item.icon }}
27
27
  </FSIcon>
28
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>
29
46
 
30
47
  <template
31
48
  #item.imageId="{ item }"
@@ -51,10 +68,14 @@
51
68
  </template>
52
69
 
53
70
  <script lang="ts">
54
- import { defineComponent, type PropType, watch } from "vue";
71
+ import { computed, defineComponent, type PropType, watch } from "vue";
55
72
  import type { RouteLocation } from "vue-router";
56
73
  import _ from "lodash";
57
74
 
75
+ import { Criticity } from "@dative-gpi/foundation-shared-domain/enums";
76
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
77
+ import { AlertTools } from "@dative-gpi/foundation-shared-components/tools";
78
+
58
79
  import type { ScenarioOrganisationTypeFilters, ScenarioOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
59
80
  import { useScenarioOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
60
81
 
@@ -62,14 +83,16 @@ import FSDataTable from "../FSDataTable.vue";
62
83
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
63
84
  import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
64
85
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
86
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
65
87
 
66
88
  export default defineComponent({
67
89
  name: "FSBaseScenarioOrganisationTypesList",
68
90
  components: {
69
91
  FSDataTable,
70
- FSIcon,
92
+ FSTagGroup,
71
93
  FSImage,
72
- FSTagGroup
94
+ FSIcon,
95
+ FSRow,
73
96
  },
74
97
  props: {
75
98
  tableCode: {
@@ -101,6 +124,16 @@ export default defineComponent({
101
124
  setup(props) {
102
125
  const { entities: scenarioOrganisationTypes, fetching: fetchingScenarioOrganisationTypes, getMany: getManyScenarioOrganisationTypes } = useScenarioOrganisationTypes();
103
126
 
127
+ const headersOptions = computed(() => ({
128
+ criticity: {
129
+ fixedFilters: getEnumEntries(Criticity).filter(f => f.value != Criticity.None).map(e => ({
130
+ value: e.value,
131
+ text: AlertTools.criticityLabel(e.value)
132
+ })),
133
+ methodFilter: (value: Criticity, item: Criticity) => value == item
134
+ }
135
+ }));
136
+
104
137
  const isSelected = (id: string): boolean => {
105
138
  return props.modelValue.includes(id);
106
139
  };
@@ -114,6 +147,8 @@ export default defineComponent({
114
147
  return {
115
148
  fetchingScenarioOrganisationTypes,
116
149
  scenarioOrganisationTypes,
150
+ headersOptions,
151
+ AlertTools,
117
152
  isSelected
118
153
  };
119
154
  }
@@ -6,6 +6,7 @@
6
6
  :showSelect="$props.editable"
7
7
  :tableCode="$props.tableCode"
8
8
  :modelValue="$props.modelValue"
9
+ :headersOptions="headersOptions"
9
10
  @update:modelValue="$emit('update:modelValue', $event)"
10
11
  v-bind="$attrs"
11
12
  >
@@ -27,6 +28,23 @@
27
28
  </FSIcon>
28
29
  </template>
29
30
 
31
+ <template
32
+ #item.criticity="{ item }"
33
+ >
34
+ <FSRow
35
+ align="center-left"
36
+ >
37
+ <FSIcon
38
+ :color="AlertTools.criticityColor(item.criticity)"
39
+ >
40
+ {{ AlertTools.criticityIcon(item.criticity) }}
41
+ </FSIcon>
42
+ <FSSpan>
43
+ {{ AlertTools.criticityLabel(item.criticity) }}
44
+ </FSSpan>
45
+ </FSRow>
46
+ </template>
47
+
30
48
  <template
31
49
  #item.tags="{ item }"
32
50
  >
@@ -40,23 +58,29 @@
40
58
  </template>
41
59
 
42
60
  <script lang="ts">
43
- import { defineComponent, type PropType, watch } from "vue";
61
+ import { computed, defineComponent, type PropType, watch } from "vue";
44
62
  import type { RouteLocation } from "vue-router";
45
63
  import _ from "lodash";
46
64
 
65
+ import { Criticity } from "@dative-gpi/foundation-shared-domain/enums";
66
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
67
+ import { AlertTools } from "@dative-gpi/foundation-shared-components/tools";
68
+
47
69
  import type { ScenarioOrganisationFilters, ScenarioOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
48
70
  import { useScenarioOrganisations } from "@dative-gpi/foundation-core-services/composables";
49
71
 
50
72
  import FSDataTable from "../FSDataTable.vue";
51
73
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
52
74
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
75
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
53
76
 
54
77
  export default defineComponent({
55
78
  name: "FSBaseScenarioOrganisationsList",
56
79
  components: {
57
80
  FSDataTable,
81
+ FSTagGroup,
58
82
  FSIcon,
59
- FSTagGroup
83
+ FSRow
60
84
  },
61
85
  props: {
62
86
  tableCode: {
@@ -88,6 +112,17 @@ export default defineComponent({
88
112
  setup(props) {
89
113
  const { entities: scenarioOrganisations, fetching: fetchingScenarioOrganisations, getMany: getManyScenarioOrganisations } = useScenarioOrganisations();
90
114
 
115
+
116
+ const headersOptions = computed(() => ({
117
+ criticity: {
118
+ fixedFilters: getEnumEntries(Criticity).filter(f => f.value != Criticity.None).map(e => ({
119
+ value: e.value,
120
+ text: AlertTools.criticityLabel(e.value)
121
+ })),
122
+ methodFilter: (value: Criticity, item: Criticity) => value == item
123
+ }
124
+ }));
125
+
91
126
  const isSelected = (id: string): boolean => {
92
127
  return props.modelValue.includes(id);
93
128
  };
@@ -101,6 +136,8 @@ export default defineComponent({
101
136
  return {
102
137
  fetchingScenarioOrganisations,
103
138
  scenarioOrganisations,
139
+ headersOptions,
140
+ AlertTools,
104
141
  isSelected
105
142
  };
106
143
  }
@@ -1,11 +1,12 @@
1
1
  <template>
2
2
  <FSDataTable
3
3
  :loading="fetchingScenarioOrganisationTypes || fetchingScenarioOrganisations"
4
- :headers="headers"
4
+ :headersOptions="headersOptions"
5
+ :extraHeaders="headerAssociation"
5
6
  :items="scenarios"
6
- :showSelect="$props.editable"
7
- :tableCode="$props.tableCode"
7
+ :itemTo="routerLink"
8
8
  :modelValue="$props.modelValue"
9
+ :tableCode="$props.tableCode"
9
10
  @update:modelValue="$emit('update:modelValue', $event)"
10
11
  v-bind="$attrs"
11
12
  >
@@ -27,6 +28,23 @@
27
28
  </FSIcon>
28
29
  </template>
29
30
 
31
+ <template
32
+ #item.criticity="{ item }"
33
+ >
34
+ <FSRow
35
+ align="center-left"
36
+ >
37
+ <FSIcon
38
+ :color="AlertTools.criticityColor(item.criticity)"
39
+ >
40
+ {{ AlertTools.criticityIcon(item.criticity) }}
41
+ </FSIcon>
42
+ <FSSpan>
43
+ {{ AlertTools.criticityLabel(item.criticity) }}
44
+ </FSSpan>
45
+ </FSRow>
46
+ </template>
47
+
30
48
  <template
31
49
  #item.tags="{ item }"
32
50
  >
@@ -45,22 +63,26 @@ import _ from "lodash";
45
63
 
46
64
  import { useTranslations } from "@dative-gpi/bones-ui";
47
65
 
66
+ import { Criticity, ApplicationScope } from "@dative-gpi/foundation-shared-domain/enums";
67
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
48
68
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
69
+ import { AlertTools } from "@dative-gpi/foundation-shared-components/tools"
49
70
 
50
71
  import type { ScenarioOrganisationFilters, ScenarioOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
51
-
52
- import { useScenarioOrganisations, useScenarioOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
72
+ import { useScenarioOrganisations, useScenarioOrganisationTypes, useRouteOrganisation } from "@dative-gpi/foundation-core-services/composables";
53
73
 
54
74
  import FSDataTable from "../FSDataTable.vue";
55
- import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
56
75
  import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
76
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
77
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
57
78
 
58
79
  export default defineComponent({
59
80
  name: "FSBaseScenariosList",
60
- components: {
81
+ components:{
61
82
  FSDataTable,
83
+ FSTagGroup,
62
84
  FSIcon,
63
- FSTagGroup
85
+ FSRow
64
86
  },
65
87
  props: {
66
88
  tableCode: {
@@ -68,6 +90,11 @@ export default defineComponent({
68
90
  required: false,
69
91
  default: null
70
92
  },
93
+ modelValue: {
94
+ type: Array as PropType<string[]>,
95
+ default: () => [],
96
+ required: false
97
+ },
71
98
  scenarioOrganisationFilters: {
72
99
  type: Object as PropType<ScenarioOrganisationFilters>,
73
100
  required: false,
@@ -78,79 +105,60 @@ export default defineComponent({
78
105
  required: false,
79
106
  default: null
80
107
  },
81
- editable: {
108
+ showAssociation: {
82
109
  type: Boolean,
83
110
  required: false,
84
111
  default: true
85
112
  },
86
- modelValue: {
87
- type: Array as PropType<string[]>,
88
- default: () => [],
89
- required: false
113
+ scope: {
114
+ type: Number as PropType<ApplicationScope>,
115
+ required: false,
116
+ default: ApplicationScope.None
90
117
  }
91
118
  },
92
119
  emits: ["update:modelValue"],
93
- setup(props, { emit }) {
120
+ setup(props) {
94
121
  const { $tr } = useTranslations();
95
122
  const { entities: scenarioOrganisations, fetching: fetchingScenarioOrganisations, getMany: getManyScenarioOrganisations } = useScenarioOrganisations();
96
123
  const { entities: scenarioOrganisationTypes, fetching: fetchingScenarioOrganisationTypes, getMany: getManyScenarioOrganisationTypes } = useScenarioOrganisationTypes();
97
124
 
98
- const isSelected = (value : string): boolean => {
99
- return props.modelValue.includes(value);
100
- };
125
+ const { $r } = useRouteOrganisation();
101
126
 
102
- const headers = computed(() => {
103
- return [
104
- {
105
- text: $tr("entity.scenario.icon", "Icon"),
106
- value: "icon",
127
+ const headerAssociation = computed(() => {
128
+ if(props.showAssociation){
129
+ return [{
130
+ columnId: "association",
131
+ text: $tr("ui.common.association", ""),
132
+ value: "association",
107
133
  sortable: false,
108
- },
109
- {
110
- text: $tr("entity.scenario.label", "Label"),
111
- value: "label",
112
- sortable: true
113
- },
114
- {
115
- text: $tr("entity.scenario.model-label", "Model label"),
116
- value: "modelLabel",
117
- sortable: true
118
- },
119
- {
120
- text: $tr("entity.scenario.data-category-label", "Data category label"),
121
- value: "dataCategoryLabel",
122
- sortable: true
123
- },
124
- {
125
- text: $tr("ui.common.action", ""),
126
- value: "action",
127
- sortable: false
128
- }
129
- ];
134
+ filterable: false,
135
+ index: -1,
136
+ hidden: false
137
+ }];
138
+ }
130
139
  });
131
140
 
141
+ const headersOptions = computed(() => ({
142
+ criticity: {
143
+ fixedFilters: getEnumEntries(Criticity).filter(f => f.value != Criticity.None).map(e => ({
144
+ value: e.value,
145
+ text: AlertTools.criticityLabel(e.value)
146
+ })),
147
+ methodFilter: (value: Criticity, item: Criticity) => value == item
148
+ }
149
+ }));
132
150
 
133
151
  const scenarios = computed(() => {
134
- return scenarioOrganisations.value.map(c => {
135
- return {
136
- id: `${c.id}_${c.scope}`,
137
- modelId: c.modelId,
138
- dataCategoryId : c.dataCategoryId,
139
- dataCategoryLabel: c.dataCategoryLabel,
140
- scenarioId: c.scenarioId,
141
- scope: c.scope,
142
- label: c.label,
143
- modelLabel: c.modelLabel,
144
- code: c.code,
145
- icon: c.icon,
146
- tags: c.tags,
147
- criticity: c.criticity,
148
- parameters: c.parameters
149
- }
150
- })
151
- .concat(scenarioOrganisationTypes.value.map(c => {
152
+ if(props.scope == ApplicationScope.Organisation){
153
+ return scenarioOrganisations.value
154
+ }
155
+ else if(props.scope == ApplicationScope.OrganisationType){
156
+ return scenarioOrganisationTypes.value
157
+ }
158
+ else{
159
+ return scenarioOrganisations.value.map(c => {
152
160
  return {
153
- id: `${c.id}_${c.scope}`,
161
+ id: c.id,
154
162
  modelId: c.modelId,
155
163
  dataCategoryId : c.dataCategoryId,
156
164
  dataCategoryLabel: c.dataCategoryLabel,
@@ -164,43 +172,69 @@ export default defineComponent({
164
172
  criticity: c.criticity,
165
173
  parameters: c.parameters
166
174
  }
167
- }))
168
- })
169
-
170
- const fetch = () =>{
171
- getManyScenarioOrganisations(props.scenarioOrganisationFilters);
172
- getManyScenarioOrganisationTypes(props.scenarioOrganisationTypeFilters)
173
- }
175
+ })
176
+ .concat(scenarioOrganisationTypes.value.map(c => {
177
+ return {
178
+ id: c.id,
179
+ modelId: c.modelId,
180
+ dataCategoryId : c.dataCategoryId,
181
+ dataCategoryLabel: c.dataCategoryLabel,
182
+ scenarioId: c.scenarioId,
183
+ scope: c.scope,
184
+ label: c.label,
185
+ modelLabel: c.modelLabel,
186
+ code: c.code,
187
+ icon: c.icon,
188
+ tags: c.tags,
189
+ criticity: c.criticity,
190
+ parameters: c.parameters
191
+ }
192
+ }));
193
+ }
194
+ });
174
195
 
175
- const update = (value : string) =>
176
- {
177
- const item = isSelected(value);
196
+ const routerLink = (item: any) => {
197
+ if(item.scope == ApplicationScope.OrganisationType){
198
+ return $r({ name: "scenario-organisation-type", params: { entityId: item.id } });
199
+ }
200
+ else
201
+ {
202
+ return $r({ name: "scenario-organisation", params: { entityId: item.id } });
203
+ }
204
+ };
178
205
 
179
- if(item){
180
- emit("update:modelValue", props.modelValue.filter(m => m != value))
206
+ const fetch = () =>{
207
+ if(props.scope == ApplicationScope.OrganisationType){
208
+ getManyScenarioOrganisationTypes(props.scenarioOrganisationTypeFilters)
209
+ }
210
+ else if(props.scope == ApplicationScope.Organisation){
211
+ getManyScenarioOrganisations(props.scenarioOrganisationFilters);
181
212
  }
182
213
  else{
183
- emit("update:modelValue", [...props.modelValue, value])
214
+ getManyScenarioOrganisations(props.scenarioOrganisationFilters);
215
+ getManyScenarioOrganisationTypes(props.scenarioOrganisationTypeFilters)
184
216
  }
185
217
  }
186
-
187
- watch(() => [props.scenarioOrganisationFilters,props.scenarioOrganisationTypeFilters], (next, previous) => {
218
+
219
+ watch(() => [props.scenarioOrganisationFilters,props.scenarioOrganisationTypeFilters, props.scope], (next, previous) => {
188
220
  if ((!next && !previous) || !_.isEqual(next, previous)) {
189
221
  fetch();
190
222
  }
191
223
  }, { immediate: true });
192
-
224
+
193
225
 
194
226
  return {
195
227
  fetchingScenarioOrganisationTypes,
196
228
  fetchingScenarioOrganisations,
197
229
  scenarioOrganisationTypes,
198
230
  scenarioOrganisations,
231
+ headerAssociation,
232
+ ApplicationScope,
233
+ headersOptions,
234
+ AlertTools,
199
235
  ColorEnum,
200
236
  scenarios,
201
- headers,
202
- isSelected,
203
- update
237
+ routerLink
204
238
  };
205
239
  }
206
240
  });
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.92",
4
+ "version": "1.0.94",
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.92",
14
- "@dative-gpi/foundation-core-services": "1.0.92",
15
- "@dative-gpi/foundation-shared-components": "1.0.92",
16
- "@dative-gpi/foundation-shared-domain": "1.0.92",
17
- "@dative-gpi/foundation-shared-services": "1.0.92"
13
+ "@dative-gpi/foundation-core-domain": "1.0.94",
14
+ "@dative-gpi/foundation-core-services": "1.0.94",
15
+ "@dative-gpi/foundation-shared-components": "1.0.94",
16
+ "@dative-gpi/foundation-shared-domain": "1.0.94",
17
+ "@dative-gpi/foundation-shared-services": "1.0.94"
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": "5b512a8eaedd84fb5f24896d01891a9a6c838ec5"
29
+ "gitHead": "be58c8299c1fc3d18c29089e157f248527da9234"
30
30
  }