From 453a7bdf940a5006513216f4cc1fcd89ef4bbd44 Mon Sep 17 00:00:00 2001 From: Alexey Sandler Date: Thu, 22 Aug 2019 15:16:48 +0300 Subject: Fix to vf-module-homing-data-action controller to retrieve the cloudRegionId Issue-ID: VID-378 Change-Id: I6042e72c9ebb8508b822df276da1b8549501042c Signed-off-by: Alexey Sandler Signed-off-by: Ittay Stern --- .../vf-module-homing-data-action.controller.js | 18 ++++++++++++------ .../vf-module-homing-data-action.html | 6 +++--- 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action') diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.controller.js b/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.controller.js index a7f7e9128..b6725b124 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.controller.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.controller.js @@ -30,7 +30,7 @@ var vfModuleActionModalController = function(COMPONENT, FIELD, $scope, $uibModal $scope.vfModuleName = vfModule.name; $scope.volumeGroups = vfModule.volumeGroups; $scope.lcpAndTenant = null; - $scope.regionSelection = {lcpRegion: null, legacyRegion: null, tenant: null}; + $scope.regionSelection = {optionId: null, legacyRegion: null, tenant: null}; $scope.lcpRegionList = null; $scope.isHomingData = false; $scope.megaRegion = ['AAIAIC25']; @@ -60,12 +60,12 @@ var vfModuleActionModalController = function(COMPONENT, FIELD, $scope, $uibModal .then(function (res) { if (res && res.data) { $scope.regionSelection = { - lcpRegion: (res.data[COMPONENT.CLOUD_REGION_ID]) ? res.data[COMPONENT.CLOUD_REGION_ID] : null, + optionId: (res.data[COMPONENT.CLOUD_REGION_ID]) ? res.data[COMPONENT.CLOUD_REGION_ID] : null, legacyRegion: null, tenant: (res.data[COMPONENT.TENANT_ID]) ? res.data[COMPONENT.TENANT_ID] : null }; - $scope.isHomingData = $scope.regionSelection.lcpRegion !== null && res.data.tenant !== null; - $scope.isHomingData = $scope.isHomingData && (($scope.megaRegion).indexOf($scope.regionSelection.lcpRegion) === -1); + $scope.isHomingData = $scope.regionSelection.optionId !== null && res.data.tenant !== null; + $scope.isHomingData = $scope.isHomingData && !$scope.selectedLcpRegionIsMegaRegion(); } if (!$scope.isHomingData) { @@ -75,11 +75,11 @@ var vfModuleActionModalController = function(COMPONENT, FIELD, $scope, $uibModal .catch(function (error) { getLcpCloudRegionTenantList(); }); - }; + } function getLcpRegionId() { if(_.isEmpty($scope.regionSelection.legacyRegion)) { - return $scope.regionSelection.lcpRegion + return DataService.getCloudOwnerAndLcpCloudRegionFromOptionId($scope.regionSelection.optionId).cloudRegionId; } return $scope.regionSelection.legacyRegion; } @@ -144,6 +144,12 @@ var vfModuleActionModalController = function(COMPONENT, FIELD, $scope, $uibModal return AaiService.removeVendorFromCloudOwner(cloudOwner) }; + $scope.selectedLcpRegionIsMegaRegion = function() { + let cloudRegionId = + DataService.getCloudOwnerAndLcpCloudRegionFromOptionId($scope.regionSelection.optionId).cloudRegionId; + return ($scope.megaRegion).indexOf(cloudRegionId) > -1 + }; + $scope.cancel = function() { $uibModalInstance.dismiss('cancel'); }; diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.html b/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.html index 3fbe07e83..944352403 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.html +++ b/vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.html @@ -55,7 +55,7 @@
@@ -81,7 +81,7 @@ data-tests-id="tenant" data-ng-model="regionSelection.tenant">
-- cgit 1.2.3-korg