upgrade VFM is not enable when other VFM in the same VNF is already upgraded.
Issue-ID: VID-771
Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com>
Change-Id: Ia5eca719c50d47c77919a82c2306605da4d2a1c0
Signed-off-by: Yoav Schneiderman <yoav.schneiderman@intl.att.com>
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 d60bbd3..83691cf 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
@@ -208,7 +208,7 @@
****************************************************/
shouldShowUpgrade(node, serviceModelId): boolean {
if (FeatureFlagsService.getFlagState(Features.FLAG_FLASH_REPLACE_VF_MODULE, this._store) &&
- this.isThereAnUpdatedLatestVersion(serviceModelId)) {
+ (this.isThereAnUpdatedLatestVersion(serviceModelId)) || this.isDiffCustomizationUuid(node, serviceModelId)) {
return this.shouldShowButtonGeneric(node, VNFMethods.UPGRADE, serviceModelId);
}
else {
@@ -216,7 +216,25 @@
}
}
- private isThereAnUpdatedLatestVersion(serviceModelId) : boolean{
+
+ isDiffCustomizationUuid(node, serviceModelId) : boolean {
+ const vfModuleServiceHierarchy = this.getVfModuleHierarchyThroughParentModelName(node, serviceModelId);
+ if(_.isNil(vfModuleServiceHierarchy)){
+ return true;
+ }
+ return node.data && !_.isNil(vfModuleServiceHierarchy) && vfModuleServiceHierarchy.customizationUuid && (vfModuleServiceHierarchy.customizationUuid !== node.data.modelCustomizationId);
+ }
+
+ getVfModuleHierarchyThroughParentModelName(node, serviceModelId) {
+ if(node.parent && node.parent.data && node.data){
+ const vnfHierarchy = this._store.getState().service.serviceHierarchy[serviceModelId].vnfs[node.parent.data.modelName];
+ return vnfHierarchy ? vnfHierarchy.vfModules[node.data.modelName] : null;
+ }
+ return null;
+ }
+
+
+ isThereAnUpdatedLatestVersion(serviceModelId) : boolean{
let serviceInstance = this.getServiceInstance(serviceModelId);
return !_.isNil(serviceInstance.latestAvailableVersion) && (Number(serviceInstance.modelInfo.modelVersion) < serviceInstance.latestAvailableVersion);
}