summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/connectedNetworkElementsActions.ts
diff options
context:
space:
mode:
authorHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-06-07 17:55:16 +0200
committerHerbert Eiselt <herbert.eiselt@highstreet-technologies.com>2019-06-07 17:58:18 +0200
commit47fc603b864b52a70157515f29ec741dd9192f3a (patch)
tree12e8cb752efc4b2c92e35325780ac4242b5d791d /sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/connectedNetworkElementsActions.ts
parentd93e6a996e60fb6abce9a870cef6b2d57bfa70fd (diff)
SDNR align ODLUX
Add missing chart view to UX Performance app Issue-ID: SDNC-790 Signed-off-by: Herbert Eiselt <herbert.eiselt@highstreet-technologies.com> Change-Id: I6f5af1e01d2246927b8d05f826f629c7dd5f59a5 Signed-off-by: Herbert Eiselt <herbert.eiselt@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/connectedNetworkElementsActions.ts')
-rw-r--r--sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/connectedNetworkElementsActions.ts39
1 files changed, 24 insertions, 15 deletions
diff --git a/sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/connectedNetworkElementsActions.ts b/sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/connectedNetworkElementsActions.ts
index 0906584b7..8f7e99c40 100644
--- a/sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/connectedNetworkElementsActions.ts
+++ b/sdnr/wt/odlux/apps/performanceHistoryApp/src/actions/connectedNetworkElementsActions.ts
@@ -1,8 +1,8 @@
import { Action } from '../../../../framework/src/flux/action';
import { Dispatch } from '../../../../framework/src/flux/store';
+import { IApplicationStoreState } from '../../../../framework/src/store/applicationStore';
-import { ConnectedNetworkElements } from '../models/connectedNetworkElements';
-import { PerformanceHistoryService } from '../services/performanceHistoryService';
+import { ConnectedNetworkElementIds } from '../models/connectedNetworkElements';
/**
* Represents the base action.
@@ -10,32 +10,41 @@ import { PerformanceHistoryService } from '../services/performanceHistoryService
export class BaseAction extends Action { }
/**
- * Represents an action causing the store to load all connected network elements.
+ * Represents an action causing the store to load all connected network element Ids.
*/
export class LoadAllConnectedNetworkElementsAction extends BaseAction { }
/**
- * Represents an action causing the store to update all connected network elements.
+ * Represents an action causing the store to update all connected network element Ids.
*/
-export class AllConnectedNetworkElementsLoadedAction extends BaseAction {
+export class AllConnectedNetworkElementsLoadedAction extends BaseAction {
/**
* Initialize this instance.
*
- * @param connectedNetworkElements The network elements which are returned from the restconf.
+ * @param connectedNetworkElements The connected network element Ids which are loaded from the state of connectApp.
*/
- constructor(public connectedNetworkElements: ConnectedNetworkElements[] | null, public error?: string) {
+ constructor(public connectedNetworkElementIds: ConnectedNetworkElementIds[] | null, public error?: string) {
super();
}
}
/**
- * Represents an asynchronous thunk action to load all connected network elements from the restconf.
+ * Represents an asynchronous thunk action to load all connected network element Ids.
*/
-export const loadAllConnectedNetworkElementsAsync = (dispatch: Dispatch) => {
- dispatch(new LoadAllConnectedNetworkElementsAction());
- PerformanceHistoryService.getConnectedNetworkElementsList().then(networkElements => {
- networkElements && dispatch(new AllConnectedNetworkElementsLoadedAction(networkElements));
- }).catch(error => {
- dispatch(new AllConnectedNetworkElementsLoadedAction(null, error));
- });
+export const loadAllConnectedNetworkElementsAsync = (dispatch: Dispatch, getState: () => IApplicationStoreState) => {
+ dispatch(new LoadAllConnectedNetworkElementsAction());
+ const connectedNetworkElementsIds = getState().connect.mountedNetworkElements;
+ let mountIdList: ConnectedNetworkElementIds[] = [];
+ connectedNetworkElementsIds.elements.forEach(element => {
+ const connectedNetworkElement = {
+ mountId: element.mountId
+ }
+ mountIdList.push(connectedNetworkElement);
+ });
+ mountIdList.sort((a, b) => {
+ if (a.mountId < b.mountId) return -1;
+ if (a.mountId > b.mountId) return 1;
+ return 0;
+ });
+ dispatch(new AllConnectedNetworkElementsLoadedAction(mountIdList));
}; \ No newline at end of file