aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/connectApp/src/handlers
diff options
context:
space:
mode:
authorHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-02-28 15:23:42 +0100
committerHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-02-28 15:24:28 +0100
commit7446f23b3abc30d7c53f2eaa951742371c071171 (patch)
treeb76a8d2e64c7aa850c09f8e69f01e7a262ab5cd5 /sdnr/wt/odlux/apps/connectApp/src/handlers
parent49b155ec687cdf58fb51fe8245a2f5f4582b68f0 (diff)
UX extensions
UX Maintenance client and further changes Change-Id: I7643661d17db5fc3d3f94b58cb42ed0be558c64f Issue-ID: SDNC-583 Signed-off-by: Herbert Eiselt <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/odlux/apps/connectApp/src/handlers')
-rw-r--r--sdnr/wt/odlux/apps/connectApp/src/handlers/connectAppRootHandler.tsx1
-rw-r--r--sdnr/wt/odlux/apps/connectApp/src/handlers/mountedNetworkElementsHandler.tsx27
2 files changed, 20 insertions, 8 deletions
diff --git a/sdnr/wt/odlux/apps/connectApp/src/handlers/connectAppRootHandler.tsx b/sdnr/wt/odlux/apps/connectApp/src/handlers/connectAppRootHandler.tsx
index 26d02c4e9..dd9e3e1df 100644
--- a/sdnr/wt/odlux/apps/connectApp/src/handlers/connectAppRootHandler.tsx
+++ b/sdnr/wt/odlux/apps/connectApp/src/handlers/connectAppRootHandler.tsx
@@ -4,7 +4,6 @@ import { IMountedNetworkElementsState, mountedNetworkElementsActionHandler } fro
import { IConnectionStatusLogState, connectionStatusLogActionHandler } from './connectionStatusLogHandler';
export interface IConnectAppStoreState {
-
requiredNetworkElements: IRequiredNetworkElementsState;
mountedNetworkElements: IMountedNetworkElementsState;
connectionStatusLog: IConnectionStatusLogState;
diff --git a/sdnr/wt/odlux/apps/connectApp/src/handlers/mountedNetworkElementsHandler.tsx b/sdnr/wt/odlux/apps/connectApp/src/handlers/mountedNetworkElementsHandler.tsx
index 70b4d8f2a..db86b99c2 100644
--- a/sdnr/wt/odlux/apps/connectApp/src/handlers/mountedNetworkElementsHandler.tsx
+++ b/sdnr/wt/odlux/apps/connectApp/src/handlers/mountedNetworkElementsHandler.tsx
@@ -1,7 +1,7 @@
import { IActionHandler } from '../../../../framework/src/flux/action';
import {
- AddMountedNetworkElement,
+ AddOrUpdateMountedNetworkElement,
AllMountedNetworkElementsLoadedAction,
LoadAllMountedNetworkElementsAction,
RemoveMountedNetworkElement,
@@ -28,7 +28,7 @@ export const mountedNetworkElementsActionHandler: IActionHandler<IMountedNetwork
...state,
busy: true
};
-
+
} else if (action instanceof AllMountedNetworkElementsLoadedAction) {
if (!action.error && action.mountedNetworkElements) {
state = {
@@ -42,11 +42,24 @@ export const mountedNetworkElementsActionHandler: IActionHandler<IMountedNetwork
busy: false
};
}
- } else if (action instanceof AddMountedNetworkElement) {
- action.mountedNetworkElement && (state = {
- ...state,
- elements: [...state.elements, action.mountedNetworkElement],
- });
+ } else if (action instanceof AddOrUpdateMountedNetworkElement) {
+ if (!action.mountedNetworkElement) return state; // should handle error here
+ const index = state.elements.findIndex(el => el.mountId === (action.mountedNetworkElement && action.mountedNetworkElement.mountId));
+ if (index > -1) {
+ state = {
+ ...state,
+ elements: [
+ ...state.elements.slice(0, index),
+ action.mountedNetworkElement,
+ ...state.elements.slice(index + 1)
+ ]
+ }
+ } else {
+ state = {
+ ...state,
+ elements: [...state.elements, action.mountedNetworkElement],
+ }
+ };
} else if (action instanceof RemoveMountedNetworkElement) {
state = {
...state,