aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common
diff options
context:
space:
mode:
authorAlexey Sandler <alexey.sandler@intl.att.com>2019-08-27 09:08:53 +0300
committerAlexey Sandler <alexey.sandler@intl.att.com>2019-08-27 09:10:20 +0300
commit230d95f0e16cd685f315f6dbc8204438b10e0c3c (patch)
treed3ea3cdc647af77fbd062e6dff17bac88b42a9cb /vid-app-common
parentcf543614765d41f49c8934e6d2b4a776b6bdff32 (diff)
get cloudOptionId from getHomingData
Issue-ID: VID-378 Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com> Change-Id: Ifa5cb0a827161f62b104bf18605531a2ebb29494
Diffstat (limited to 'vid-app-common')
-rw-r--r--vid-app-common/src/main/webapp/app/vid/scripts/modals/vf-module-homing-data-action/vf-module-homing-data-action.controller.js20
-rwxr-xr-xvid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js18
2 files changed, 26 insertions, 12 deletions
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 b6725b124..ecc6042b6 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
@@ -59,13 +59,10 @@ var vfModuleActionModalController = function(COMPONENT, FIELD, $scope, $uibModal
AaiService.getHomingData(DataService.getVnfInstanceId(), DataService.getVfModuleInstanceId())
.then(function (res) {
if (res && res.data) {
- $scope.regionSelection = {
- 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.optionId !== null && res.data.tenant !== null;
- $scope.isHomingData = $scope.isHomingData && !$scope.selectedLcpRegionIsMegaRegion();
+ $scope.regionSelection.optionId = (res.data.cloudRegionOptionId);
+ $scope.regionSelection.tenant = (res.data[COMPONENT.TENANT_ID]) ? res.data[COMPONENT.TENANT_ID] : null;
+ $scope.isHomingData = $scope.regionSelection.optionId !== null && $scope.regionSelection.tenant !== null;
+ $scope.isHomingData = $scope.isHomingData && (($scope.megaRegion).indexOf(res.data[COMPONENT.CLOUD_REGION_ID]) === -1);
}
if (!$scope.isHomingData) {
@@ -145,9 +142,12 @@ var vfModuleActionModalController = function(COMPONENT, FIELD, $scope, $uibModal
};
$scope.selectedLcpRegionIsMegaRegion = function() {
- let cloudRegionId =
- DataService.getCloudOwnerAndLcpCloudRegionFromOptionId($scope.regionSelection.optionId).cloudRegionId;
- return ($scope.megaRegion).indexOf(cloudRegionId) > -1
+ if ($scope.regionSelection.optionId) {
+ let cloudRegionId = DataService.getCloudOwnerAndLcpCloudRegionFromOptionId($scope.regionSelection.optionId).cloudRegionId;
+ return ($scope.megaRegion).indexOf(cloudRegionId) > -1
+ } else {
+ return false;
+ }
};
$scope.cancel = function() {
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js
index e940183af..0d0fa6d0a 100755
--- a/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js
@@ -430,6 +430,7 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE
},
getLcpCloudRegionTenantList : function(globalCustomerId, serviceType,
successCallbackFunction) {
+ let self = this;
$log
.debug("AaiService:getLcpCloudRegionTenantList: globalCustomerId: "
+ globalCustomerId);
@@ -447,12 +448,12 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE
for (var i = 0; i < aaiLcpCloudRegionTenants.length; i++) {
var cloudOwner = aaiLcpCloudRegionTenants[i][COMPONENT.CLOUD_OWNER];
var cloudRegionId = aaiLcpCloudRegionTenants[i][COMPONENT.CLOUD_REGION_ID];
- var cloudRegionOptionId = 'option-' + cloudOwner + '-' + cloudRegionId;
+ var cloudRegionOptionId = self.cloudRegionOptionId(cloudOwner, cloudRegionId);
lcpCloudRegionTenants.push({
"cloudOwner": cloudOwner,
"cloudRegionId": cloudRegionId,
- "cloudRegionOptionId": cloudRegionOptionId.toLowerCase(),
+ "cloudRegionOptionId": cloudRegionOptionId,
"tenantName": aaiLcpCloudRegionTenants[i][COMPONENT.TENANT_NAME],
"tenantId": aaiLcpCloudRegionTenants[i][COMPONENT.TENANT_ID],
"isPermitted": aaiLcpCloudRegionTenants[i][COMPONENT.IS_PERMITTED]});
@@ -760,7 +761,12 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE
});
},
+ cloudRegionOptionId: function (cloudOwner, cloudRegionId) {
+ return ('option-' + cloudOwner + '-' + cloudRegionId).toLowerCase();
+ },
+
getHomingData: function(vnfInstanceId, vfModuleId) {
+ let self = this;
var url = COMPONENT.AAI_GET_HOMING_DATA.replace('@vnfInstanceId', vnfInstanceId)
.replace('@vfModuleId', vfModuleId);
@@ -768,6 +774,14 @@ var AaiService = function ($http, $log, PropertyService, UtilityService, COMPONE
$http.get(url)
.success(function (response) {
+ var cloudOwner = response[COMPONENT.CLOUD_OWNER];
+ var cloudRegionId = response[COMPONENT.CLOUD_REGION_ID];
+ if (cloudOwner && cloudRegionId) {
+ response["cloudRegionOptionId"] = self.cloudRegionOptionId(cloudOwner, cloudRegionId);
+ } else {
+ response["cloudRegionOptionId"] = null;
+ }
+
deferred.resolve({data: response});
}).error(function (data, status, headers, config) {
deferred.reject({message: data, status: status});