FaultApp bugfixes 11/121411/1
authorAijana Schumann <aijana.schumann@highstreet-technologies.com>
Wed, 19 May 2021 09:21:26 +0000 (11:21 +0200)
committerAijana Schumann <aijana.schumann@highstreet-technologies.com>
Wed, 19 May 2021 09:21:26 +0000 (11:21 +0200)
Fix alarm notifications not displayed, too many data-provider requests

Issue-ID: CCSDK-3310
Signed-off-by: Aijana Schumann <aijana.schumann@highstreet-technologies.com>
Change-Id: I5f5433c8aed9d7c00d33cea5d3ee7ea7c01d0d03

sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts
sdnr/wt/odlux/apps/faultApp/src/models/fault.ts
sdnr/wt/odlux/apps/faultApp/src/pluginFault.tsx
sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx
sdnr/wt/odlux/apps/faultApp/webpack.config.js

index 5b51a10..46f92fb 100644 (file)
@@ -29,7 +29,7 @@ import { IAlarmLogEntriesState, alarmLogEntriesActionHandler } from './alarmLogE
 import { SetPanelAction } from '../actions/panelChangeActions';
 import { IFaultStatus, faultStatusHandler } from './faultStatusHandler';
 import { stuckAlarmHandler } from './clearStuckAlarmsHandler';
-import { PanelId } from 'models/panelId';
+import { PanelId } from '../models/panelId';
 import { SetPartialUpdatesAction } from '../actions/partialUpdatesAction';
 
 export interface IFaultAppStoreState {
index e4e43f1..2ba8da0 100644 (file)
@@ -22,21 +22,36 @@ export type Fault = {
   timestamp: string;
   objectId: string;
   problem: string;
-  severity: null | 'Warning' | 'Minor' | 'Major' | 'Critical';
+  severity: null | 'Warning' | 'Minor' | 'Major' | 'Critical' | 'NonAlarmed';
   type: string;
-  sourceType: string;
+  sourceType?: string;
 }
 
 export type FaultAlarmNotification = {
   id: string;
+  timeStamp: string;
   nodeName: string;
   counter: number;
-  timeStamp: string;
   objectId: string;
   problem: string;
-  severity: null | 'Warning' | 'Minor' | 'Major' | 'Critical';
-  type: string;
-  sourceType: string;
+  severity: string;
+}
+
+export type FaultAlarmNotificationWS = {
+  "node-id": string;
+  "data": {
+    "counter": number;
+    "time-stamp": string;
+    "object-id-ref": string;
+    "problem": string;
+    "severity": null | 'Warning' | 'Minor' | 'Major' | 'Critical' | 'NonAlarmed';
+  };
+  "type": {
+    "namespace": string;
+    "revision": string;
+    "type": string;
+  };
+  "event-time": string;
 }
 
 /**
index 2056976..bf96fe3 100644 (file)
@@ -31,7 +31,7 @@ import { IApplicationStoreState } from "../../../framework/src/store/application
 import { faultAppRootHandler } from './handlers/faultAppRootHandler';
 import { FaultApplication } from "./views/faultApplication";
 
-import { FaultAlarmNotification } from "./models/fault";
+import { FaultAlarmNotificationWS } from "./models/fault";
 import { PanelId } from "./models/panelId";
 
 import { SetPanelAction } from "./actions/panelChangeActions";
@@ -40,7 +40,6 @@ import { AddFaultNotificationAction } from "./actions/notificationActions";
 import { createCurrentProblemsProperties, createCurrentProblemsActions, currentProblemsReloadAction } from "./handlers/currentProblemsHandler";
 import { FaultStatus } from "./components/faultStatus";
 import { refreshFaultStatusAsyncAction } from "./actions/statusActions";
-import { alarmLogEntriesReloadAction } from "./handlers/alarmLogEntriesHandler";
 
 let currentMountId: string | undefined = undefined;
 
@@ -93,20 +92,21 @@ export function register() {
     menuEntry: "Fault"
   });
 
+  let counter = 0;
   // subscribe to the websocket notifications
-  subscribe<FaultAlarmNotification & IFormatedMessage>("ProblemNotification", (fault => {
+  subscribe<FaultAlarmNotificationWS & IFormatedMessage>("problem-notification", (fault => {
     const store = applicationApi && applicationApi.applicationStore;
     if (fault && store) {
-      store.dispatch(new AddFaultNotificationAction(fault));
-
-      // reload fault data if the view is displayed
-      if (store.state.fault.listenForPartialUpdates) {
-        if (store.state.fault.currentOpenPanel === "AlarmLog") {
-          store.dispatch(alarmLogEntriesReloadAction);
-        } else if (store.state.fault.currentOpenPanel === "CurrentProblem") {
-          store.dispatch(currentProblemsReloadAction);
-        }
-      }
+
+      store.dispatch(new AddFaultNotificationAction({
+        id: String(counter++),
+        nodeName: fault["node-id"],
+        counter: +fault.data.counter,
+        objectId: fault.data["object-id-ref"],
+        problem: fault.data.problem,
+        severity: fault.data.severity || '',
+        timeStamp: fault.data["time-stamp"],
+      }));
     }
   }));
 
index d313a20..6075066 100644 (file)
@@ -174,7 +174,7 @@ class FaultApplicationComponent extends React.Component<FaultApplicationComponen
         {
           activePanelId === 'CurrentProblem' &&
           <>
-            <FaultTable stickyHeader tableId="current-problems-table" idProperty={'id'} customActionButtons={customActions} columns={[
+            <FaultTable stickyHeader tableId="current-problems-table" idProperty="id" customActionButtons={customActions} columns={[
               { property: "icon", title: "", type: ColumnType.custom, customControl: this.renderIcon },
               { property: "timestamp", type: ColumnType.text, title: "Timestamp" },
               { property: "nodeId", title: "Node Name", type: ColumnType.text },
@@ -191,7 +191,7 @@ class FaultApplicationComponent extends React.Component<FaultApplicationComponen
         }
         {activePanelId === 'AlarmNotifications' &&
 
-          <FaultAlarmNotificationTable tableId="alarm-notifications-table" stickyHeader rows={this.props.faultNotifications.faults} asynchronus columns={[
+          <FaultAlarmNotificationTable tableId="alarm-notifications-table" idProperty="id" stickyHeader rows={this.props.faultNotifications.faults} asynchronus columns={[
             { property: "icon", title: "", type: ColumnType.custom, customControl: this.renderIcon },
             { property: "timeStamp", title: "Timestamp" },
             { property: "nodeName", title: "Node Name" },
@@ -199,8 +199,7 @@ class FaultApplicationComponent extends React.Component<FaultApplicationComponen
             { property: "objectId", title: "Object Id" },
             { property: "problem", title: "Alarm Type" },
             { property: "severity", title: "Severity", width: "140px" },
-          ]} idProperty={'id'} />
-
+          ]} />
         }
 
         {activePanelId === 'AlarmLog' &&
index 8131c98..da092d0 100644 (file)
@@ -125,27 +125,27 @@ module.exports = (env) => {
       },
        proxy: {
         "/oauth2/": {
-          target: "http://10.20.6.29:48181",
+          target: "http://sdnr:8181",
           secure: false
         },
         "/database/": {
-          target: "http://10.20.6.29:48181",
+          target: "http://sdnr:8181",
           secure: false
         },
         "/restconf/": {
-          target: "http://10.20.6.29:48181",
+          target: "http://sdnr:8181",
           secure: false
         },
         "/rests/": {
-          target: "http://10.20.6.29:48181",
+          target: "http://sdnr:8181",
           secure: false
         },
         "/help/": {
-          target: "http://10.20.6.29:48181",
+          target: "http://sdnr:8181",
           secure: false
         },
         "/websocket": {
-          target: "http://10.20.6.29:48181",
+          target: "http://sdnr:8181",
           ws: true,
           changeOrigin: true,
           secure: false