X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ecomp-portal-FE-common%2Fclient%2Fapp%2Fviews%2Frole%2Frole-list-controller.js;h=b4813114885d05b98b7c6dea29e0152c2b72d2a2;hb=3f56b9fdb4d2ec891344d6c9048363e1cac587d2;hp=acfb25e0c13262e37ae171305c96185b0e098090;hpb=2edaa4d6a5f7066e0c718f85a7bf7b8dabd0c59b;p=portal.git diff --git a/ecomp-portal-FE-common/client/app/views/role/role-list-controller.js b/ecomp-portal-FE-common/client/app/views/role/role-list-controller.js index acfb25e0..b4813114 100644 --- a/ecomp-portal-FE-common/client/app/views/role/role-list-controller.js +++ b/ecomp-portal-FE-common/client/app/views/role/role-list-controller.js @@ -2,7 +2,7 @@ * ============LICENSE_START========================================== * ONAP Portal * =================================================================== - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * =================================================================== * * Unless otherwise specified, all software contained herein is licensed @@ -170,14 +170,16 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS $scope.syncRolesFromExternalAuthSystem = function(appId){ applicationsService.syncRolesEcompFromExtAuthSystem(appId).then(function(res){ - if(res.status == 200){ + if(res.data != null || res.data.status != null || res.data.status == 'OK'){ confirmBoxService.showInformation('Sync operation completed successfully!').then(isConfirmed => { $scope.getRolesForSelectedCentralizedApp(appId); }); } else{ - confirmBoxService.showInformation('Sync operation failed for '+app).then(isConfirmed => {}); + confirmBoxService.showInformation('Sync operation failed for '+app + res.data.message).then(isConfirmed => {}); } - }); + }).catch(err=> { + confirmBoxService.showInformation("Sync operation failed for: " + err); + }); }; @@ -217,9 +219,13 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS // edit Role $scope.editRoleModalPopup = function(appId, availableRole) { + $scope.showSpinner = true; + if(!availableRole.active) + return confirmBoxService.showInformation('Edit is diabled! Please toggle the role to activate it.').then(isConfirmed => {}); $scope.editRole = availableRole; if(appId != undefined && availableRole.id != undefined){ - RoleService.getRole(appId, availableRole.id).then(function(data){ + RoleService.getRole(appId, availableRole.id).then(function(data){ + $scope.showSpinner = false; var response = JSON.parse(data.data); var role = JSON.parse(response.role); var availableRoles = JSON.parse(response.availableRoles); @@ -249,6 +255,7 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS }); },function(error){ $log.debug('Failed to editRole'); + $scope.showSpinner = false; }); } @@ -256,9 +263,11 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS // add Role $scope.addRoleModalPopup = function(appId) { + $scope.showSpinner = true; if(appId){ - var roleId = 0; + var roleId = -1; RoleService.getRole(appId, roleId).then(function(data){ + $scope.showSpinner = false; var response = JSON.parse(data.data); var role = JSON.parse(response.role); var availableRoles = JSON.parse(response.availableRoles);