From 32af6479c686d217204de3a86940ac1256da4b9f Mon Sep 17 00:00:00 2001 From: ikram Date: Fri, 7 Aug 2020 15:49:11 -0400 Subject: Visualization of the VF Module Sequencing Issue-ID: VID-860 More scenarios covered in VID-860 for vf-module sequencing. Signed-off-by: ikram Change-Id: Ie138ba2616961fba7856eaaf5f17b5dc63a08e6e --- .../models/vfModule/vfModule.model.info.ts | 43 ++++++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models') diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts index 33ec0804f..80b2a4b52 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts @@ -348,7 +348,9 @@ export class VFModuleModelInfo implements ILevelNodeInfo { enable: (node) => this._sharedTreeService.shouldShowAuditInfo(node) }, remove: { - method: (node, serviceModelId) => this._store.dispatch(removeVfModuleInstance(node.data.modelName, serviceModelId, node.parent.data.modelName, node.parent.data.vnfStoreKey, node.data.dynamicModelName)), + method: (node, serviceModelId) => { + this.removeVFM(serviceModelId,node); + }, visible: (node) => this._sharedTreeService.shouldShowRemoveAndEdit(node), enable: (node) => this._sharedTreeService.shouldShowRemoveAndEdit(node), }, @@ -431,8 +433,8 @@ export class VFModuleModelInfo implements ILevelNodeInfo { } } - updatePosition(that, node, instanceId, parentStoreKey): void { - this._store.dispatch(updateVFModulePosition(node, instanceId, parentStoreKey)); + updatePosition(that, node,instanceId, parentStoreKey): void { + that.store.dispatch(updateVFModulePosition(node.modelName,node.dynamicModelName, node.position,instanceId, parentStoreKey)); } @@ -452,4 +454,39 @@ export class VFModuleModelInfo implements ILevelNodeInfo { const result = [modelInformation, instanceInfo]; return _.uniq(_.flatten(result)); } + + private removeVFM(serviceModelId, node) { + if (FeatureFlagsService.getFlagState(Features.FLAG_2008_CREATE_VFMODULE_INSTANTIATION_ORDER_NUMBER, this._store)) { + let nodeArray = node.parent.children; + let totalNumOfNodes = nodeArray.length; + let removedNodeIndex = node.index; + let remainingNodes = totalNumOfNodes - (removedNodeIndex+1); + if(!_.isNull(remainingNodes)) { + if(remainingNodes !== 0 && remainingNodes >0) { + for(let i= 0;i { + if (item.position !== index + 1) { + item.position = index + 1; + this._store.dispatch(updateVFModulePosition(item.data.modelName,item.data.dynamicModelName, item.position,serviceModelId, item.parent.data.vnfStoreKey)); + } + }); + + + }else{ + this._store.dispatch(removeVfModuleInstance(node.data.modelName, serviceModelId, node.parent.data.modelName, node.parent.data.vnfStoreKey, node.data.dynamicModelName)); + + } + } + } else { + this._store.dispatch(removeVfModuleInstance(node.data.modelName, serviceModelId, node.parent.data.modelName, node.parent.data.vnfStoreKey, node.data.dynamicModelName)); + } + } } -- cgit 1.2.3-korg