From 21e4a946cd24b8a03ea577352f0271ebf7669ffa Mon Sep 17 00:00:00 2001 From: Michael DÜrre Date: Thu, 8 Apr 2021 07:27:18 +0200 Subject: update odlux for notification change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit update due new notification protocol Issue-ID: CCSDK-3253 Signed-off-by: Michael DÜrre Change-Id: Iad65459fdc18603cd1ddbd97bb2211308744bd8b --- .../wt/odlux/apps/connectApp/src/pluginConnect.tsx | 29 +++++++++++----------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx') diff --git a/sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx b/sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx index f711c440c..93bed1aad 100644 --- a/sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx +++ b/sdnr/wt/odlux/apps/connectApp/src/pluginConnect.tsx @@ -20,19 +20,12 @@ import { faPlug } from '@fortawesome/free-solid-svg-icons'; import applicationManager from '../../../framework/src/services/applicationManager'; import { subscribe, IFormatedMessage } from '../../../framework/src/services/notificationService'; +import { AddSnackbarNotification } from '../../../framework/src/actions/snackbarActions'; import connectAppRootHandler from './handlers/connectAppRootHandler'; import ConnectApplication from './views/connectView'; -import { AddSnackbarNotification } from '../../../framework/src/actions/snackbarActions'; -import { updateCurrentViewAsyncAction } from './actions/commonNetworkElementsActions'; - -type ObjectNotification = { - counter: string; - nodeName: string; - objectId: string; - timeStamp: string; -} +import { findWebUrisForGuiCutThroughAsyncAction, updateCurrentViewAsyncAction } from './actions/commonNetworkElementsActions'; export function register() { const applicationApi = applicationManager.registerApplication({ @@ -44,13 +37,19 @@ export function register() { }); // subscribe to the websocket notifications - subscribe(["ObjectCreationNotification", "ObjectDeletionNotification", "AttributeValueChangedNotification"], (msg => { + subscribe(["object-creation-notification", "object-deletion-notification", "attribute-value-changed-notification"], (msg => { const store = applicationApi.applicationStore; - if (msg && msg.notifType === "ObjectCreationNotification" && store) { - store.dispatch(new AddSnackbarNotification({ message: `Adding network element [${msg.objectId}]`, options: { variant: 'info' } })); - } else if (msg && (msg.notifType === "ObjectDeletionNotification" || msg.notifType === "AttributeValueChangedNotification") && store) { - store.dispatch(new AddSnackbarNotification({ message: `Updating network element [${msg.objectId}]`, options: { variant: 'info' } })); + if (msg && msg.type.type === "object-creation-notification" && store) { + store.dispatch(new AddSnackbarNotification({ message: `Adding network element [${msg['node-id']}]`, options: { variant: 'info' } })); + } else if (msg && (msg.type.type === "object-deletion-notification" || msg.type.type === "attribute-value-changed-notification") && store) { + store.dispatch(new AddSnackbarNotification({ message: `Updating network element [${msg['node-id']}]`, options: { variant: 'info' } })); + } + if (store) { + store.dispatch(updateCurrentViewAsyncAction() as any).then(() => { + if (msg['node-id']) { + store.dispatch(findWebUrisForGuiCutThroughAsyncAction([msg['node-id']])); + } + }); } - store && store.dispatch(updateCurrentViewAsyncAction()); })); } \ No newline at end of file -- cgit 1.2.3-korg