add 'cloud region' optional field to change management 07/95907/9
authorSara Weiss <sara.weiss@intl.att.com>
Wed, 18 Sep 2019 10:55:55 +0000 (13:55 +0300)
committerIttay Stern <ittay.stern@att.com>
Mon, 23 Sep 2019 14:43:46 +0000 (17:43 +0300)
Issue-ID: VID-596

Change-Id: Ieb89980f7e802fe2508950a0e1a23188145fd85e
Signed-off-by: Sara Weiss <sara.weiss@intl.att.com>
vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.controller.js
vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.css
vid-app-common/src/main/webapp/app/vid/scripts/modals/new-change-management/new-change-management.html
vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js

index f70d625..5c29fb4 100644 (file)
             return (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH));
         };
 
+        $scope.removeVendorFromCloudOwner = function(cloudOwner) {
+            return AaiService.removeVendorFromCloudOwner(cloudOwner)
+        };
+
         vm.isDisabledVNFmodelVersion = function (vnfTypePristine) {
             if ($scope.isNewFilterChangeManagmentEnabled()) {
                 return !vm.isSearchedVNF;
                 });
         };
 
+        function loadCloudRegions() {
+            AaiService.getLcpCloudRegionTenantList(
+                vm.changeManagement.subscriberId,
+                vm.changeManagement.serviceType["service-type"],
+                function (response) {
+                    $scope.cloudRegionList = _.uniqBy(response, 'cloudRegionOptionId');
+                });
+        }
+
         vm.serviceTypeChanged = function () {
-            if (!$scope.isNewFilterChangeManagmentEnabled()) {
+            if ($scope.isNewFilterChangeManagmentEnabled()) {
+                loadCloudRegions();
+            } else {
                 vm.searchVNFs();
             }
         };
 
             vm.vnfs = [];
             vm.vfModules = [];
-            let vnfRole = $scope.isNewFilterChangeManagmentEnabled() ? vm.changeManagement.vnfType : null;
+
+            let vnfRole = null;
             let cloudRegion = null;
 
+            if ($scope.isNewFilterChangeManagmentEnabled()) {
+                vnfRole = vm.changeManagement.vnfType ? vm.changeManagement.vnfType : null;
+                cloudRegion = vm.changeManagement.cloudRegion ? vm.changeManagement.cloudRegion.cloudRegionId : null;
+            }
+
 
             AaiService.getVnfsByCustomerIdAndServiceType(
                 vm.changeManagement.subscriberId,
                 vm.changeManagement.serviceType["service-type"],
                 vnfRole,
                 cloudRegion,
-        ).
-            then(function (response) {
+            ).then(function (response) {
                     vm.isSearchedVNF = true;
                     var vnfsData = response.data.results;
                     if (vnfsData) {
                             vm.vnfTypes.push(vnf.properties['nf-role'])
                         });
                     }
+                    if ($scope.isNewFilterChangeManagmentEnabled()) {
+                        vm.loadVNFVersions();
+                    }
                 }
             );
         };
index 40bb92b..a839ef5 100644 (file)
                 <div class="col nf-role-input">
                     <label class="control-label">NF Role</label>
                     <input class="form-control" ng-model="vm.changeManagement.vnfType"
-                           name="vnfType" id="vnfTypeInput"
+                           name="vnfType" id="vnfTypeInput" data-tests-id="vnfType"
                            data-ng-disabled="newChangeManagement.serviceType.$pristine">
                 </div>
 
+                <div class="col nf-role-input">
+                    <label class="control-label">Cloud Region</label>
+                    <select name="cloud-region" class="form-control" ng-model="vm.changeManagement.cloudRegion"
+                            name="vnfType" id="cloudRegion"
+                            data-ng-disabled="newChangeManagement.serviceType.$pristine">
+                        <option value="" disabled>select cloud Region</option>
+                        <option ng-repeat="option in cloudRegionList" value="{{option.cloudRegionOptionId}}"
+                                data-ng-if="option.isPermitted && !isFeatureFlagCloudOwner">{{option.cloudRegionId}}
+                        </option>
+                        <option ng-repeat="option in cloudRegionList" value="{{option.cloudRegionOptionId}}"
+                                data-ng-if="option.isPermitted && isFeatureFlagCloudOwner">
+                            {{option.cloudRegionId}} ({{removeVendorFromCloudOwner(option.cloudOwner).toUpperCase()}})
+                        </option>
+                    </select>
+                </div>
+
                 <div class="col">
-                    <button class="search-vnf" type="button" id="searchVNF" name="searchVNFs" class="btn btn-primary"
+                    <button class="btn btn-primary search-vnf" type="button" id="searchVNF" name="searchVNFs"
                             ng-click="vm.searchVNFs()"
-                            ng-disabled="newChangeManagement.subscriber.$pristine || newChangeManagement.serviceType.$pristine">
+                            ng-disabled="newChangeManagement.subscriber.$pristine || newChangeManagement.serviceType.$pristine"
+                            data-tests-id="searchVNFs">
                         Search VNFs
                     </button>
                 </div>
             </div>
-
         </div>
 
 
index 994a3e4..0e1beef 100755 (executable)
@@ -86,6 +86,23 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE
         }).join("&");
     }
 
+    function getConfigParams(vnfRole, cloudRegion) {
+        if (!featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH)) {
+            return null
+        }
+
+        let data = {
+            vnfRole: vnfRole,
+            cloudRegion: cloudRegion,
+        };
+
+        let config = {
+            params: data
+        };
+
+        return config;
+    }
+
     return {
         getSubscriberName: function (globalCustomerId,
                                      successCallbackFunction) {
@@ -630,24 +647,17 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE
         },
 
         getVnfsByCustomerIdAndServiceType: function (globalSubscriberId, serviceType, vnfRole, cloudRegion) {
-            var deferred = $q.defer();
+            let deferred = $q.defer();
 
             let url = globalSubscriberId + COMPONENT.FORWARD_SLASH + serviceType
 
-            if (featureFlags.isOn(COMPONENT.FEATURE_FLAGS.FLAG_FLASH_CLOUD_REGION_AND_NF_ROLE_OPTIONAL_SEARCH)){
-                if (vnfRole) {
-                    url + COMPONENT.FORWARD_SLASH + vnfRole
-                }
-                if (cloudRegion) {
-                    url + COMPONENT.FORWARD_SLASH + cloudRegion;
-                }
-            }
-
+            const path = COMPONENT.AAI_GET_VNF_BY_CUSTOMERID_AND_SERVICETYPE + url;
+            let config = getConfigParams(vnfRole, cloudRegion);
 
             if (UtilityService.hasContents(globalSubscriberId) &&
                 UtilityService.hasContents(serviceType)) {
 
-                $http.get(COMPONENT.AAI_GET_VNF_BY_CUSTOMERID_AND_SERVICETYPE + url)
+                $http.get(path, config)
                     .success(function (response) {
                         if (response) {
                             deferred.resolve({data: response});