aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2020-02-04 14:13:24 +0200
committerIttay Stern <ittay.stern@att.com>2020-02-04 15:13:22 +0200
commitf84164f29eb0c314580f0c44de3d513d9e7b0e5a (patch)
tree62a1b50a2dece5def3a8ea18965fe46a8bf6e370 /vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
parentce9d4e748b56fab270f9a697e6705dc410650bd9 (diff)
upgrade VFM is not enabled when other VFM in the same VNF is already upgraded (fix)
Also fixes a bug in modelUniqueNameOrId when `instance` contains inner vfModule object. Issue-ID: VID-771 Change-Id: Ie7326780c968fe334dfe3888c518eeb5a8e1919f Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts')
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts59
1 files changed, 47 insertions, 12 deletions
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 964e1202f..9e7a0211e 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
@@ -53,8 +53,18 @@ export class SharedTreeService {
: (nodeInstance.modelInfo.modelCustomizationId || nodeInstance.modelInfo.modelInvariantId);
};
- modelUniqueNameOrId = (instance): string =>
- instance.originalName ? instance.originalName : this.modelUniqueId(instance);
+ modelUniqueNameOrId = (instance): string => {
+ if (_.isNil(instance)) {
+ return null;
+ }
+
+ const innerInstance = _.find(instance) || {};
+
+ return instance.originalName
+ || this.modelUniqueId(instance)
+ || innerInstance.originalName
+ || this.modelUniqueId(innerInstance);
+ };
/**
* Finds a model inside a full service model
@@ -207,7 +217,7 @@ export class SharedTreeService {
****************************************************/
shouldShowUpgrade(node, serviceModelId): boolean {
if (FeatureFlagsService.getFlagState(Features.FLAG_FLASH_REPLACE_VF_MODULE, this._store) &&
- (this.isThereAnUpdatedLatestVersion(serviceModelId)) || this.isDiffCustomizationUuid(node, serviceModelId)) {
+ (this.isThereAnUpdatedLatestVersion(serviceModelId)) || this.isVfmoduleAlmostPartOfModelOnlyCustomizationUuidDiffer(node, serviceModelId)) {
return this.shouldShowButtonGeneric(node, VNFMethods.UPGRADE, serviceModelId);
}
else {
@@ -216,18 +226,43 @@ export class SharedTreeService {
}
- isDiffCustomizationUuid(node, serviceModelId) : boolean {
- const vfModuleServiceHierarchy = this.getVfModuleHierarchyThroughParentModelName(node, serviceModelId);
- if(_.isNil(vfModuleServiceHierarchy)){
- return true;
+ isVfmoduleAlmostPartOfModelOnlyCustomizationUuidDiffer(vfModuleNode, serviceModelId) : boolean {
+ /*
+ for `true`, should all:
+ 1. parent vnf found by model-mane
+ 2. vfmodule found by invariant
+ 3. vfmodule diff by customization
+ */
+
+ if (_.isNil(vfModuleNode.data)) {
+ return false;
+ }
+
+ const vnfHierarchy = this.getParentVnfHierarchy(vfModuleNode, serviceModelId);
+ if (_.isNil(vnfHierarchy)) {
+ return false;
+ }
+
+ const vfModuleHierarchyByInvariantId = this.getVfModuleHFromVnfHierarchyByInvariantId(vfModuleNode, vnfHierarchy);
+ if(_.isNil(vfModuleHierarchyByInvariantId)){
+ return false;
+ }
+
+ return vfModuleHierarchyByInvariantId.customizationUuid
+ && (vfModuleHierarchyByInvariantId.customizationUuid !== vfModuleNode.data.modelCustomizationId);
+ }
+
+ getParentVnfHierarchy(vfModuleNode, serviceModelId) {
+ if (vfModuleNode.parent && vfModuleNode.parent.data) {
+ return this._store.getState().service.serviceHierarchy[serviceModelId].vnfs[vfModuleNode.parent.data.modelName];
+ } else {
+ return null;
}
- 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;
+ getVfModuleHFromVnfHierarchyByInvariantId(vfModuleNode, parentVnfHierarchy) {
+ if(vfModuleNode.data.modelInvariantId && parentVnfHierarchy && parentVnfHierarchy.vfModules){
+ return _.find(parentVnfHierarchy.vfModules, o => o.invariantUuid === vfModuleNode.data.modelInvariantId);
}
return null;
}