From 3e558222d300ff70ff490914cc2245cf2a59e72a Mon Sep 17 00:00:00 2001 From: Kruthi Bhat Date: Mon, 23 Nov 2020 23:31:56 +0530 Subject: Prevent upgrade for base vf module with add on Change-Id: Ie8139056ae560f734f2ae70d6a2ddb97f4c2dfaa Issue-ID: VID-925 Signed-off-by: krutbhat@att.com --- .../objectsToTree/shared.tree.service.ts | 35 +++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'vid-webpack-master/src/app/drawingBoard') 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 26776d05d..84703170f 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 @@ -254,7 +254,10 @@ export class SharedTreeService { isVfMoudleCouldBeUpgraded(node, serviceModelId): boolean{ return (FeatureFlagsService.getFlagState(Features.FLAG_FLASH_REPLACE_VF_MODULE, this._store) && - (this.isThereAnUpdatedLatestVersion(serviceModelId) || this.isVfModuleCustomizationIdNotExistsOnModel(node, serviceModelId))) + (this.isThereAnUpdatedLatestVersion(serviceModelId) || this.isVfModuleCustomizationIdNotExistsOnModel(node, serviceModelId)) && + (this.upgradeAllowedForBm(node,serviceModelId))) + + } isVfModuleCustomizationIdNotExistsOnModel(vfModuleNode, serviceModelId) { @@ -564,4 +567,34 @@ export class SharedTreeService { isAddPositionFlagTrue():boolean{ return FeatureFlagsService.getFlagState(Features.FLAG_2008_CREATE_VFMODULE_INSTANTIATION_ORDER_NUMBER, this._store); } + + upgradeAllowedForBm(node, serviceModelId):boolean { + + if(FeatureFlagsService.getFlagState(Features.FLAG_2012_UPGRADE_BASE_MODULE_FLAG, this._store)){ + let returnValue = false; + if(node.data.type == 'VFmodule') { + let serviceHierarchy = this._store.getState().service.serviceHierarchy[serviceModelId]; + let vnf = node.parent.data.modelName; + let baseModuleFlag= (serviceHierarchy.vnfs[vnf].vfModules[node.data.modelName].properties.baseModule) ? true: false; + + if(baseModuleFlag) { + if(node.parent.children.length >1) { + return returnValue; + } + else { + returnValue = true; + } + }else { + returnValue = true; + } + + } else { + returnValue= true + } + + return returnValue; + } else { + return true; + } + } } -- cgit 1.2.3-korg