From 9ba0b8ccfa546a2fd76e0fc2ff68a748abe64848 Mon Sep 17 00:00:00 2001 From: ikram Date: Mon, 13 Jul 2020 15:28:31 -0400 Subject: Visualization of the VF Module Sequencing Issue-ID: VID-860 In this user story, we plan to allow the user to visually see the sequence numbers when a VF module is added from the left panel of the drawing board onto the right one. Note: The idea that the sequence change when a VF Module is dragged up and down is not part of the scope of this story - we will deliver that separately. This is only about the default sequencing that the drawing board renders when a new VF module is created into the 'instance' part of the drawing board from the 'model' part of the drawing board. Signed-off-by: ikram Change-Id: Iadd5cef1012f8ef5c670bbd2c46950680a9e6b0e --- .../drawing-board-tree/drawing-board-tree.html | 23 +++++++++++++++++----- .../models/vfModule/vfModule.model.info.ts | 4 ++-- .../src/app/shared/models/vfModuleTreeNode.ts | 1 + .../default.data.generator.service.ts | 2 ++ .../app/shared/storeUtil/utils/reducersHelper.ts | 14 +++++++++++++ .../storeUtil/utils/vfModule/vfModule.reducers.ts | 8 +++++++- 6 files changed, 44 insertions(+), 8 deletions(-) diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.html b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.html index 0ebee903c..59905bd75 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.html +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.html @@ -36,6 +36,19 @@
Failed
+
+
+
{{node?.data?.position}}
+
+ + +
+
Limit{{node?.data?.limitMembers}}
- - + +
{ + _.forOwn(vfModuleInstance, (module) => { + module.position = totalNumOfVfModules +1; + totalNumOfVfModules= totalNumOfVfModules+1; + }) + }); + + +} diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.ts index 294536de6..fa6bd9ecb 100644 --- a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.ts +++ b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.ts @@ -18,6 +18,7 @@ import {VfModuleMap} from "../../../models/vfModulesMap"; import {ServiceState} from "../main.reducer"; import {PauseStatus, ServiceInstanceActions} from "../../../models/serviceInstanceActions"; import {updateServiceValidationCounter} from "../reducersHelper"; +import {calculatePosition} from "../reducersHelper"; export function vfModuleReducer(state: ServiceState , action: Action) : ServiceState{ @@ -34,12 +35,15 @@ export function vfModuleReducer(state: ServiceState , action: Action) : ServiceS let vfModulesMap = newState.serviceInstance[serviceUuid].vnfs[vnfStoreKey].vfModules[vfModuleId] || new VfModuleMap(); let randomId = generateId(); vfInstance.action = ServiceInstanceActions.Create; - vfModulesMap[vfModuleId + randomId] = vfInstance; + let dynamicName = vfModuleId + randomId; + vfModulesMap[dynamicName] = vfInstance; updateUniqueNames(null, vfInstance.instanceName, newState.serviceInstance[serviceUuid]); updateUniqueNames(null, vfInstance.volumeGroupName, newState.serviceInstance[serviceUuid]); updateServiceValidationCounter(newState, false, vfInstance['isMissingData'], serviceUuid); newState.serviceInstance[serviceUuid].vnfs[vnfStoreKey].vfModules[vfModuleId] = vfModulesMap; + //update position of newly added VF module + calculatePosition(newState,serviceUuid, vnfStoreKey); return newState; } case VfModuleActions.UPDATE_VF_MODULE: { @@ -60,6 +64,8 @@ export function vfModuleReducer(state: ServiceState , action: Action) : ServiceS updateUniqueNames(vfModulesMap[updateVFModuleInstanceAction.dynamicModelName].volumeGroupName, vfInstance.volumeGroupName, newState.serviceInstance[serviceUuid]); vfModulesMap[updateVFModuleInstanceAction.dynamicModelName] = vfInstance; newState.serviceInstance[serviceUuid].vnfs[vnfId].vfModules[vfModuleId] = vfModulesMap; + //retain the position of newly added VF module -- change logic + calculatePosition(newState,serviceUuid, vnfStoreKey); return newState; } case VfModuleActions.REMOVE_VNF_MODULE_INSTANCE: { -- cgit 1.2.3-korg