@eclipse-slm/ui 1.5.0-snapshot.845 → 1.5.0-snapshot.854

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-slm/ui",
3
- "version": "1.5.0-snapshot.845",
3
+ "version": "1.5.0-snapshot.854",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -14,7 +14,8 @@ import {
14
14
  EventType, FirmwareUpdateJobEventNotification,
15
15
  Notification,
16
16
  NotificationCategory,
17
- NotificationSubCategory, EVENTCLASS, ResourceEventNotification, ResourceEventType
17
+ NotificationSubCategory, EVENTCLASS, ResourceEventNotification, ResourceEventType,
18
+ AasEventNotification, AasEventType, AasElementKind
18
19
  } from "@/api/notification-service/client";
19
20
  import NotificationTextGenerator from "@/utils/notificationTextGenerator";
20
21
  import i18n from '@/utils/i18n';
@@ -119,6 +120,19 @@ export const useNotificationStore = defineStore('notificationStore', {
119
120
  break;
120
121
  }
121
122
 
123
+ case EVENTCLASS.AasEvent: {
124
+ const aasEventNotification = eventNotification as unknown as AasEventNotification;
125
+ // A deleted resource shell usually means the resource is gone, refreshing it would fail
126
+ const shellDeleted = aasEventNotification.elementKind === AasElementKind.Shell
127
+ && aasEventNotification.eventType === AasEventType.Deleted;
128
+ if (!shellDeleted) {
129
+ const resourceDevicesStore = useResourceDevicesStore();
130
+ resourceDevicesStore.getResourceById(aasEventNotification.resourceId);
131
+ }
132
+ // $toast.info(NotificationTextGenerator.generateLocalizedText(eventNotification, i18n.global))
133
+ break;
134
+ }
135
+
122
136
  default: {
123
137
  console.debug("Unknown event notification type: ", eventNotification.type);
124
138
  break;
@@ -6,7 +6,8 @@ import {
6
6
  FirmwareUpdateJobEventNotification,
7
7
  DiscoveryJobEventNotification,
8
8
  CapabilityJobEventNotification,
9
- ServiceInstanceEventNotification, ServiceInstanceEventType
9
+ ServiceInstanceEventNotification, ServiceInstanceEventType,
10
+ AasEventNotification, AasEventType, AasElementKind
10
11
  } from "@/api/notification-service/client";
11
12
  import {useCapabilitiesStore} from "@/stores/capabilitiesStore";
12
13
  import {useResourceDevicesStore} from "@/stores/resourceDevicesStore";
@@ -71,6 +72,31 @@ class NotificationTextGenerator {
71
72
  }
72
73
  }
73
74
 
75
+ case EVENTCLASS.AasEvent: {
76
+ const aasEventNotification = eventNotification as unknown as AasEventNotification;
77
+ const resourceDevicesStore = useResourceDevicesStore();
78
+ const resource = resourceDevicesStore.resourceById(aasEventNotification.resourceId);
79
+ const resourceName = resource?.hostname ?? aasEventNotification.resourceId;
80
+ const submodelName = aasEventNotification.submodelIdShort ?? aasEventNotification.submodelId;
81
+ const action = aasEventNotification.eventType.toLowerCase();
82
+
83
+ switch (aasEventNotification.elementKind) {
84
+ case AasElementKind.Shell: {
85
+ return `AAS of resource '${resourceName}' ${action}`
86
+ }
87
+ case AasElementKind.Submodel: {
88
+ return `Submodel '${submodelName}' of resource '${resourceName}' ${action}`
89
+ }
90
+ case AasElementKind.SubmodelReference: {
91
+ if (aasEventNotification.eventType === AasEventType.Created) {
92
+ return `Submodel '${submodelName}' added to resource '${resourceName}'`
93
+ }
94
+ return `Submodel '${submodelName}' removed from resource '${resourceName}'`
95
+ }
96
+ }
97
+ break;
98
+ }
99
+
74
100
  default:
75
101
  return "Message not defined"
76
102
  }