From 6126ea252a460c22e89bc8ad5ab68ec62e45fbe5 Mon Sep 17 00:00:00 2001 From: Eylon Malin Date: Thu, 1 Aug 2019 19:32:05 +0300 Subject: handling cloud owner and lcp region in create port mirroring configuration Issue-ID: VID-482 Signed-off-by: Eylon Malin Change-Id: Id7aed0f44927b27b69287f513d24552cf2afc003 --- .../vid/scripts/controller/AddNetworkNodeController.js | 6 +++++- .../scripts/controller/ServiceProxyConfigController.js | 4 ++-- .../webapp/app/vid/scripts/services/creationService.js | 15 +++------------ .../main/webapp/app/vid/scripts/services/dataService.js | 8 ++++++++ .../app/vid/scripts/services/deleteResumeService.js | 13 ++----------- .../main/webapp/app/vid/scripts/services/msoService.js | 3 ++- .../webapp/app/vid/scripts/view-models/addNetworkNode.htm | 6 +++--- 7 files changed, 25 insertions(+), 30 deletions(-) (limited to 'vid-app-common/src/main/webapp/app') diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/AddNetworkNodeController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/AddNetworkNodeController.js index 386d23622..4b0f8bb0c 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/AddNetworkNodeController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/AddNetworkNodeController.js @@ -53,7 +53,11 @@ appDS2.controller("AddNetworkNodeController", ["COMPONENT", "FIELD", "PARAMETER" CreationService.getParameters(handleGetParametersResponse); $scope.setTenant = function(field) { - $scope.nodeTemplateFields.tenant.optionList = _.filter($scope.tenantList, {'cloudRegionId': field.value, 'isPermitted': true}); + var cloudOwnerAndLcpCloudRegion = DataService.getCloudOwnerAndLcpCloudRegionFromOptionId(field.value); + $scope.nodeTemplateFields.cloudRegionId = cloudOwnerAndLcpCloudRegion.cloudRegionId; + $scope.nodeTemplateFields.cloudOwner = cloudOwnerAndLcpCloudRegion.cloudOwner; + $scope.nodeTemplateFields.tenant.optionList = _.filter($scope.tenantList, + {'cloudRegionId': cloudOwnerAndLcpCloudRegion.cloudRegionId, 'isPermitted': true}); }; $scope.cancel = function() { diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js index f775bed45..8e3b5b890 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceProxyConfigController.js @@ -292,7 +292,7 @@ appDS2.controller( serviceType, serviceProxy.sourceModelUuid, serviceProxy.sourceModelInvariant, - configNodeTemplateFields.lcpRegion.value, + configNodeTemplateFields.cloudRegionId, configurationModel.properties.equip_vendor, configurationModel.properties.equip_model ) @@ -311,7 +311,7 @@ appDS2.controller( serviceType, serviceProxy.sourceModelUuid, serviceProxy.sourceModelInvariant, - configNodeTemplateFields.lcpRegion.value + configNodeTemplateFields.cloudRegionId ) .then(function (response) { var results = response.results || []; diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js index 1949f5aa2..1a296ca5d 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js @@ -779,13 +779,13 @@ var CreationService = function($log, AaiService, AsdcService, DataService,VIDCON var cloudOwner; var lcpRegionOptionId = getValueFromList(FIELD.ID.LCP_REGION, parameterList); - var cloudOwnerAndLcpCloudRegion = getCloudOwnerAndLcpCloudRegionFromOptionId(lcpRegionOptionId); + var cloudOwnerAndLcpCloudRegion = DataService.getCloudOwnerAndLcpCloudRegionFromOptionId(lcpRegionOptionId); if (cloudOwnerAndLcpCloudRegion.cloudRegionId === FIELD.KEY.LCP_REGION_TEXT) { lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT, parameterList); cloudOwner = undefined; } else { - var cloudOwnerAndLcpCloudRegion = getCloudOwnerAndLcpCloudRegionFromOptionId(lcpRegionOptionId); + var cloudOwnerAndLcpCloudRegion = DataService.getCloudOwnerAndLcpCloudRegionFromOptionId(lcpRegionOptionId); lcpRegion = cloudOwnerAndLcpCloudRegion.cloudRegionId; cloudOwner = cloudOwnerAndLcpCloudRegion.cloudOwner; } @@ -1155,15 +1155,6 @@ var CreationService = function($log, AaiService, AsdcService, DataService,VIDCON return parameter; }; - var getCloudOwnerAndLcpCloudRegionFromOptionId = function (cloudRegionOptionId) { - var cloudRegionTenantList = DataService.getCloudRegionTenantList(); - var cloudRegionTenant = _.find(cloudRegionTenantList, {"cloudRegionOptionId": cloudRegionOptionId}); - return { - cloudOwner: cloudRegionTenant.cloudOwner, - cloudRegionId: cloudRegionTenant.cloudRegionId - } - }; - var getTenantList = function(cloudRegionOptionId) { var cloudRegionTenantList = DataService.getCloudRegionTenantList(); var parameter = ""; @@ -1257,7 +1248,7 @@ var CreationService = function($log, AaiService, AsdcService, DataService,VIDCON .updateList([ FIELD.PARAMETER.TENANT_DISABLED ]); } - var cloudOwnerAndLcpCloudRegion = getCloudOwnerAndLcpCloudRegionFromOptionId(list[0].value); + var cloudOwnerAndLcpCloudRegion = DataService.getCloudOwnerAndLcpCloudRegionFromOptionId(list[0].value); if (cloudOwnerAndLcpCloudRegion.cloudRegionId === FIELD.KEY.LCP_REGION_TEXT) { parameterListControl .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_VISIBLE ]); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js index 26adcf43b..84413f890 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js @@ -37,6 +37,14 @@ var DataService = function($log, DataService) { setCloudRegionTenantList : function(cloudRegionTenantList) { _this.cloudRegionTenantList = cloudRegionTenantList; }, + getCloudOwnerAndLcpCloudRegionFromOptionId : function (cloudRegionOptionId) { + var cloudRegionTenantList = this.getCloudRegionTenantList(); + var cloudRegionTenant = _.find(cloudRegionTenantList, {"cloudRegionOptionId": cloudRegionOptionId}); + return { + cloudOwner: cloudRegionTenant.cloudOwner, + cloudRegionId: cloudRegionTenant.cloudRegionId + } + }, getGlobalCustomerId : function() { return _this.globalCustomerId; }, diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js index aac0ed468..559174ddf 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/deleteResumeService.js @@ -293,7 +293,7 @@ var DeleteResumeService = function($log, AaiService, AsdcService, DataService, var cloudOwner; var lcpRegionOptionId = getValueFromList(FIELD.ID.LCP_REGION, parameterList); - var cloudOwnerAndLcpCloudRegion = getCloudOwnerAndLcpCloudRegionFromOptionId(lcpRegionOptionId); + var cloudOwnerAndLcpCloudRegion = DataService.getCloudOwnerAndLcpCloudRegionFromOptionId(lcpRegionOptionId); if (cloudOwnerAndLcpCloudRegion.cloudRegionId === FIELD.KEY.LCP_REGION_TEXT) { lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT, parameterList); @@ -416,15 +416,6 @@ var DeleteResumeService = function($log, AaiService, AsdcService, DataService, return parameter; }; - var getCloudOwnerAndLcpCloudRegionFromOptionId = function (cloudRegionOptionId) { - var cloudRegionTenantList = DataService.getCloudRegionTenantList(); - var cloudRegionTenant = _.find(cloudRegionTenantList, {"cloudRegionOptionId": cloudRegionOptionId}); - return { - cloudOwner: cloudRegionTenant.cloudOwner, - cloudRegionId: cloudRegionTenant.cloudRegionId - } - }; - var getTenantList = function(cloudRegionOptionId) { var parameter = ""; var cloudRegionTenantList = DataService.getCloudRegionTenantList(); @@ -478,7 +469,7 @@ var DeleteResumeService = function($log, AaiService, AsdcService, DataService, .updateList([ FIELD.PARAMETER.TENANT_DISABLED ]); } - var cloudOwnerAndLcpCloudRegion = getCloudOwnerAndLcpCloudRegionFromOptionId(list[0].value); + var cloudOwnerAndLcpCloudRegion = DataService.getCloudOwnerAndLcpCloudRegionFromOptionId(list[0].value); if (cloudOwnerAndLcpCloudRegion.cloudRegionId === FIELD.KEY.LCP_REGION_TEXT) { parameterListControl .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_VISIBLE ]); diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js index d5baa1a21..3f902e86e 100755 --- a/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js +++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js @@ -341,7 +341,8 @@ var MsoService = function($http, $log, $q, PropertyService, AaiService, UtilityS "modelCustomizationName": requestParams.configurationModelInfo.modelCustomizationName }, "cloudConfiguration": { - "lcpCloudRegionId": requestParams.portMirroringConfigFields.lcpRegion.value + "lcpCloudRegionId": requestParams.portMirroringConfigFields.cloudRegionId, + "cloudOwner" : requestParams.portMirroringConfigFields.cloudOwner }, "requestInfo": { "instanceName": requestParams.portMirroringConfigFields.instanceName.value, diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/addNetworkNode.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/addNetworkNode.htm index 8b3369007..e1dad409c 100644 --- a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/addNetworkNode.htm +++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/addNetworkNode.htm @@ -40,12 +40,12 @@ limitations under the License. {{errorMsg}} -