From ec36cb3c0f031d1e3d150d9b456e5184d3a1e604 Mon Sep 17 00:00:00 2001 From: Sara Weiss Date: Thu, 19 Sep 2019 13:30:42 +0300 Subject: change management new filter tests Issue-ID: VID-596 Change-Id: I591da151bb27a46c217edec552e7c9c670a96aaa Signed-off-by: Sara Weiss --- .../new-change-management.controller.js | 31 +++++++++++++++++----- .../new-change-management.css | 2 +- .../new-change-management.html | 13 +++++---- 3 files changed, 31 insertions(+), 15 deletions(-) (limited to 'vid-app-common/src/main') diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js index 5c29fb4ae..20e964c53 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js @@ -69,7 +69,7 @@ return (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH)); }; - $scope.removeVendorFromCloudOwner = function(cloudOwner) { + $scope.removeVendorFromCloudOwner = function (cloudOwner) { return AaiService.removeVendorFromCloudOwner(cloudOwner) }; @@ -541,11 +541,26 @@ }); }; + function isCompatibleVNFRole(vnf) { + + return vnf.properties['nf-role'] === vm.changeManagement['vnfType'] || !vm.changeManagement['vnfType']; + + } + + function isValidVnf(vnf) { + + let result = isCompatibleVNFRole(vnf) && vnf.properties["model-invariant-id"] + && vnf.properties["model-version-id"]; + + return result; + } + function loadCloudRegions() { AaiService.getLcpCloudRegionTenantList( vm.changeManagement.subscriberId, vm.changeManagement.serviceType["service-type"], function (response) { + $scope.isFeatureFlagCloudOwner = featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST); $scope.cloudRegionList = _.uniqBy(response, 'cloudRegionOptionId'); }); } @@ -562,6 +577,9 @@ vm.vnfTypes = []; vm.vnfTypesTemp = []; vm.serviceInstances = []; + vm.fromVNFVersions=[]; + vm.vnfNames =[]; + vm.changeManagement.vnfNames =[]; var instances = vm.changeManagement.serviceType["service-instances"]["service-instance"]; // var promiseArrOfGetVnfs = preparePromiseArrOfGetVnfs(instances); @@ -574,10 +592,9 @@ if ($scope.isNewFilterChangeManagmentEnabled()) { vnfRole = vm.changeManagement.vnfType ? vm.changeManagement.vnfType : null; - cloudRegion = vm.changeManagement.cloudRegion ? vm.changeManagement.cloudRegion.cloudRegionId : null; + cloudRegion = vm.changeManagement.cloudRegion ? vm.changeManagement.cloudRegion : null; } - AaiService.getVnfsByCustomerIdAndServiceType( vm.changeManagement.subscriberId, vm.changeManagement.serviceType["service-type"], @@ -635,9 +652,7 @@ vm.serviceInstancesToGetVersions = []; var versions = []; _.forEach(vm.vnfs, function (vnf) { - if (vnf.properties['nf-role'] === vm.changeManagement['vnfType'] - && vnf.properties["model-invariant-id"] - && vnf.properties["model-version-id"]) { + if (isValidVnf(vnf)) { vm.serviceInstancesToGetVersions.push({ "model-invariant-id": vnf.properties["model-invariant-id"], "model-version-id": vnf.properties["model-version-id"] @@ -708,13 +723,15 @@ }; vm.loadVNFNames = function () { + vm.changeManagement.vnfNames =[]; vm.vnfNames = []; + const vnfs = vm.changeManagement.fromVNFVersion ? vm.vnfs : []; _.forEach(vnfs, function (vnf) { var selectedVersionNumber = getVersionNameForId(vm.changeManagement.fromVNFVersion); - if (vnf.properties['nf-role'] === vm.changeManagement.vnfType && + if (isCompatibleVNFRole(vnf) && selectedVersionNumber === getVersionNameForId(vnf.properties["model-version-id"])) { var vServer = {}; diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css index 031ffb4d4..dda983409 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css @@ -137,7 +137,7 @@ position: relative; } -.nf-role-input { +.new-filter-field { width: 39% } diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html index a839ef547..3f2489dbb 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html @@ -70,23 +70,22 @@
-
+
-
+
-