@dative-gpi/foundation-core-components 1.0.133 → 1.0.134

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.
@@ -160,11 +160,14 @@
160
160
  import { computed, defineComponent, onMounted, type PropType, watch } from "vue";
161
161
  import { type RouteLocation } from "vue-router";
162
162
  import _ from "lodash";
163
+
164
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
163
165
 
166
+ import { ConnectivityStatus, Criticity, PropertyEntity } from "@dative-gpi/foundation-shared-domain/enums";
164
167
  import { alphanumericSort, connectivityLabel } from "@dative-gpi/foundation-shared-components/utils";
165
- import { ConnectivityStatus, PropertyEntity } from "@dative-gpi/foundation-shared-domain/enums";
168
+ import { AlertTools } from "@dative-gpi/foundation-shared-components/tools";
166
169
 
167
- import type { DeviceConnectivityDetails, DeviceOrganisationAlert, DeviceOrganisationFilters, DeviceOrganisationInfos} from "@dative-gpi/foundation-core-domain/models";
170
+ import type { DeviceConnectivityDetails, DeviceOrganisationAlert, DeviceOrganisationFilters, DeviceOrganisationInfos, DeviceStatusDetails} from "@dative-gpi/foundation-core-domain/models";
168
171
  import { useCustomProperties, useDeviceOrganisations } from "@dative-gpi/foundation-core-services/composables";
169
172
 
170
173
  import FSMetaValue from "../../customProperties/FSMetaValue.vue";
@@ -236,6 +239,7 @@ export default defineComponent({
236
239
  setup(props) {
237
240
  const { fetching: fecthingCustomProperties, entities: customProperties, getMany: getManyCustomProperties } = useCustomProperties();
238
241
  const { entities, fetching: fetchingDeviceOrganisations, getMany: getManyDeviceOrganisations } = useDeviceOrganisations();
242
+ const { $tr } = useTranslationsProvider();
239
243
 
240
244
  const deviceOrganisations = computed((): DeviceOrganisationInfos[] => {
241
245
  if (props.connectedOnly) {
@@ -245,6 +249,19 @@ export default defineComponent({
245
249
  });
246
250
 
247
251
  const headersOptions = computed(() => ({
252
+ status: {
253
+ fixedFilters: [{
254
+ value: true,
255
+ text: $tr("ui.device-organisation.has-statuses", "Has statuses")
256
+ }, {
257
+ value: false,
258
+ text: $tr("ui.device-organisation.has-no-statuses", "Has no statuses")
259
+ }],
260
+ methodFilter: (value: boolean, item: DeviceStatusDetails) => {
261
+ return value ? item.statuses.length > 0 : item.statuses.length === 0;
262
+ },
263
+ sort: (a: DeviceStatusDetails, b: DeviceStatusDetails) => a.statuses.length - b.statuses.length
264
+ },
248
265
  connectivity: {
249
266
  fixedFilters: [{
250
267
  value: ConnectivityStatus.None,
@@ -272,7 +289,41 @@ export default defineComponent({
272
289
  },
273
290
  sort: (a: DeviceConnectivityDetails, b: DeviceConnectivityDetails) => alphanumericSort(a?.status, b?.status)
274
291
  },
292
+ alerts: {
293
+ fixedFilters: [{
294
+ value: true,
295
+ text: $tr("ui.device-organisation.has-alerts", "Has alerts")
296
+ }, {
297
+ value: false,
298
+ text: $tr("ui.device-organisation.has-no-alerts", "Has no alerts")
299
+ }],
300
+ methodFilter: (value: boolean, item: DeviceOrganisationAlert[]) => {
301
+ return value ? item.length > 0 : item.length === 0;
302
+ },
303
+ sort: (a: DeviceOrganisationAlert[], b: DeviceOrganisationAlert[]) => a.length - b.length
304
+ },
275
305
  worstAlert: {
306
+ fixedFilters: [{
307
+ value: Criticity.None,
308
+ text: "—"
309
+ }, {
310
+ value: Criticity.Information,
311
+ text: AlertTools.criticityLabel(Criticity.Information)
312
+ }, {
313
+ value: Criticity.Warning,
314
+ text: AlertTools.criticityLabel(Criticity.Warning)
315
+ }, {
316
+ value: Criticity.Error,
317
+ text: AlertTools.criticityLabel(Criticity.Error)
318
+ }],
319
+ methodFilter: (value: Criticity, item: DeviceOrganisationAlert | null) => {
320
+ switch(value) {
321
+ case Criticity.None:
322
+ return !item;
323
+ default:
324
+ return item != null && item.criticity === value;
325
+ }
326
+ },
276
327
  sort: (a: DeviceOrganisationAlert, b: DeviceOrganisationAlert) => alphanumericSort(a?.criticity, b?.criticity)
277
328
  },
278
329
  ...customProperties.value.reduce((acc, cp) => ({
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.133",
4
+ "version": "1.0.134",
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.133",
14
- "@dative-gpi/foundation-core-services": "1.0.133",
15
- "@dative-gpi/foundation-shared-components": "1.0.133",
16
- "@dative-gpi/foundation-shared-domain": "1.0.133",
17
- "@dative-gpi/foundation-shared-services": "1.0.133"
13
+ "@dative-gpi/foundation-core-domain": "1.0.134",
14
+ "@dative-gpi/foundation-core-services": "1.0.134",
15
+ "@dative-gpi/foundation-shared-components": "1.0.134",
16
+ "@dative-gpi/foundation-shared-domain": "1.0.134",
17
+ "@dative-gpi/foundation-shared-services": "1.0.134"
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": "f775f6313a8d710351d32b2f913923bc07d727d6"
29
+ "gitHead": "a8b8d2c285134ca72edf1bb0d3e224815f04c131"
30
30
  }