aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree
diff options
context:
space:
mode:
authorikram <ikram@research.att.com>2020-08-07 15:49:11 -0400
committerKruthi Bhat <krutbhat@att.com>2020-08-10 19:21:30 +0000
commit32af6479c686d217204de3a86940ac1256da4b9f (patch)
tree98eb5135887c5bf5943099a783c9cd3d7dbbd8a4 /vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree
parent09a6562a16715a2b89be11c941486be783c72364 (diff)
Visualization of the VF Module Sequencing
Issue-ID: VID-860 More scenarios covered in VID-860 for vf-module sequencing. Signed-off-by: ikram <ikram@research.att.com> Change-Id: Ie138ba2616961fba7856eaaf5f17b5dc63a08e6e
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree')
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts43
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts4
2 files changed, 44 insertions, 3 deletions
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<remainingNodes;i++) {
+ let temp = nodeArray[removedNodeIndex];
+ nodeArray[removedNodeIndex] = nodeArray[removedNodeIndex + 1];
+ nodeArray[removedNodeIndex + 1] = temp;
+ removedNodeIndex= removedNodeIndex+1;
+ }
+ let removedNode = nodeArray[nodeArray.length - 1];
+ this._store.dispatch(removeVfModuleInstance(removedNode.data.modelName, serviceModelId, removedNode.parent.data.modelName, removedNode.parent.data.vnfStoreKey, removedNode.data.dynamicModelName));
+ nodeArray.pop();
+ nodeArray.forEach((item, index) => {
+ 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));
+ }
+ }
}
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
index 3b00e64c3..51fcf52a1 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
@@ -551,4 +551,8 @@ export class SharedTreeService {
!_.isNil(model.max) ? String(model.max) : Constants.ModelInfo.UNLIMITED_DEFAULT
);
}
+
+ isAddPositionFlagTrue():boolean{
+ return FeatureFlagsService.getFlagState(Features.FLAG_2008_CREATE_VFMODULE_INSTANTIATION_ORDER_NUMBER, this._store);
+ }
}