From 6a7fab9a12eebe7fd902c9e04f516fa9c1ae5820 Mon Sep 17 00:00:00 2001 From: Aijana Schumann Date: Wed, 19 May 2021 11:21:26 +0200 Subject: FaultApp bugfixes Fix alarm notifications not displayed, too many data-provider requests Issue-ID: CCSDK-3310 Signed-off-by: Aijana Schumann Change-Id: I5f5433c8aed9d7c00d33cea5d3ee7ea7c01d0d03 --- .../faultApp/src/handlers/faultAppRootHandler.ts | 2 +- sdnr/wt/odlux/apps/faultApp/src/models/fault.ts | 27 +++++++++++++++++----- sdnr/wt/odlux/apps/faultApp/src/pluginFault.tsx | 26 ++++++++++----------- .../apps/faultApp/src/views/faultApplication.tsx | 7 +++--- sdnr/wt/odlux/apps/faultApp/webpack.config.js | 12 +++++----- 5 files changed, 44 insertions(+), 30 deletions(-) (limited to 'sdnr/wt/odlux') diff --git a/sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts b/sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts index 5b51a100c..46f92fbef 100644 --- a/sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts +++ b/sdnr/wt/odlux/apps/faultApp/src/handlers/faultAppRootHandler.ts @@ -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 { diff --git a/sdnr/wt/odlux/apps/faultApp/src/models/fault.ts b/sdnr/wt/odlux/apps/faultApp/src/models/fault.ts index e4e43f19c..2ba8da01d 100644 --- a/sdnr/wt/odlux/apps/faultApp/src/models/fault.ts +++ b/sdnr/wt/odlux/apps/faultApp/src/models/fault.ts @@ -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; } /** diff --git a/sdnr/wt/odlux/apps/faultApp/src/pluginFault.tsx b/sdnr/wt/odlux/apps/faultApp/src/pluginFault.tsx index 2056976d9..bf96fe38d 100644 --- a/sdnr/wt/odlux/apps/faultApp/src/pluginFault.tsx +++ b/sdnr/wt/odlux/apps/faultApp/src/pluginFault.tsx @@ -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("ProblemNotification", (fault => { + subscribe("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"], + })); } })); diff --git a/sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx b/sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx index d313a2048..6075066fd 100644 --- a/sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx +++ b/sdnr/wt/odlux/apps/faultApp/src/views/faultApplication.tsx @@ -174,7 +174,7 @@ class FaultApplicationComponent extends React.Component - - + ]} /> } {activePanelId === 'AlarmLog' && diff --git a/sdnr/wt/odlux/apps/faultApp/webpack.config.js b/sdnr/wt/odlux/apps/faultApp/webpack.config.js index 8131c9835..da092d0dc 100644 --- a/sdnr/wt/odlux/apps/faultApp/webpack.config.js +++ b/sdnr/wt/odlux/apps/faultApp/webpack.config.js @@ -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 -- cgit 1.2.3-korg