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) {
};
$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() {
},
getLcpCloudRegionTenantList : function(globalCustomerId, serviceType,
successCallbackFunction) {
+ let self = this;
$log
.debug("AaiService:getLcpCloudRegionTenantList: globalCustomerId: "
+ globalCustomerId);
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]});
});
},
+ 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);
$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});