summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/storeUtil/utils/reducersHelper.ts
diff options
context:
space:
mode:
authorikram <ikram@research.att.com>2020-07-13 15:28:31 -0400
committerikram <ikram@research.att.com>2020-07-13 15:28:31 -0400
commit9ba0b8ccfa546a2fd76e0fc2ff68a748abe64848 (patch)
treeacca2b9fe43cd198ebc3c60ea15df2cfa1aa0031 /vid-webpack-master/src/app/shared/storeUtil/utils/reducersHelper.ts
parenta205bcdfd37ce8afcabd093a461b14a40a065ba4 (diff)
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 <ikram@research.att.com> Change-Id: Iadd5cef1012f8ef5c670bbd2c46950680a9e6b0e
Diffstat (limited to 'vid-webpack-master/src/app/shared/storeUtil/utils/reducersHelper.ts')
-rw-r--r--vid-webpack-master/src/app/shared/storeUtil/utils/reducersHelper.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/reducersHelper.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/reducersHelper.ts
index c192ece48..cc2ed4fe3 100644
--- a/vid-webpack-master/src/app/shared/storeUtil/utils/reducersHelper.ts
+++ b/vid-webpack-master/src/app/shared/storeUtil/utils/reducersHelper.ts
@@ -28,3 +28,17 @@ function resetUpgradeStatus(newState: any, serviceUuid: string){
newState.serviceInstance[serviceUuid].upgradedVFMSonsCounter = 0;
newState.serviceInstance[serviceUuid].isUpgraded = false;
}
+
+export function calculatePosition(newState :any,serviceUuid: string, vnfStoreKey :string) {
+
+ let totalNumOfVfModules =(Object.keys(newState.serviceInstance[serviceUuid].vnfs[vnfStoreKey].vfModules).length);
+ totalNumOfVfModules = 0;
+ _.forOwn(newState.serviceInstance[serviceUuid].vnfs[vnfStoreKey].vfModules, (vfModuleInstance) => {
+ _.forOwn(vfModuleInstance, (module) => {
+ module.position = totalNumOfVfModules +1;
+ totalNumOfVfModules= totalNumOfVfModules+1;
+ })
+ });
+
+
+}