diff options
author | Aijana Schumann <aijana.schumann@highstreet-technologies.com> | 2021-05-19 11:21:26 +0200 |
---|---|---|
committer | Aijana Schumann <aijana.schumann@highstreet-technologies.com> | 2021-05-19 11:21:26 +0200 |
commit | 6a7fab9a12eebe7fd902c9e04f516fa9c1ae5820 (patch) | |
tree | 065888e5dd135318b99d5ca91a95f0f8284deb5e /sdnr | |
parent | caaf7cf0edd7c605c9d57c0470806d2a13ebe773 (diff) |
FaultApp bugfixes
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
Diffstat (limited to 'sdnr')
5 files changed, 44 insertions, 30 deletions
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<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"], + })); } })); 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<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' && 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 |