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=6f280313c940b0a164d1c643aeb7249cc0a21f2c;hb=a70761c096192e38800bf38d6c7f61f52bf72007;hp=46ff0d738fac860cad3959375c53845702e91c15;hpb=24608a9e1450c409dc3870440d29e91cc3a26bb9;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 46ff0d73..6f280313 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 @@ -44,6 +44,7 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS $scope.goToUrl = function(roleIdVal) { $state.go("root.role", {"roleId":roleIdVal}); } + $scope.toggleRole = function(appId, selected, availableRole) { var toggleType = null; if(selected) { @@ -122,8 +123,29 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS }); } }; + + $scope.openBulkUploadRolesAndFunctionsModal = function(appId) { + var modalInstance = $modal.open({ + templateUrl: 'app/views/role/bulk-upload-dialogs/bulk-upload-role-functions-modal.html', + controller: 'BulkRoleAndFunctionsModalCtrl as bulkRoleAndFunctions', + sizeClass: 'modal-medium', + resolve: { + message: function () { + var message = { + appid: appId + }; + return message; + } + } + }); + modalInstance.result.then(function (confirmed) { + if(confirmed == 'confirmed'){ + // update role list table + } + }); + }; - //getCentalizedApps + // getCentalizedApps $scope.getCentralizedApps = function(userId) { RoleService.getCentralizedApps(userId).then(res=> { if (res.length>0) { @@ -148,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); + }); }; @@ -193,8 +217,10 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS init(); - //edit Role + // edit Role $scope.editRoleModalPopup = function(appId, availableRole) { + 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){ @@ -215,7 +241,7 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS availableRoleFunctions: availableRoleFunctions, appId: $scope.apps.selectedCentralizedApp, role: role - }; + }; return message; } } @@ -232,10 +258,10 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS }; - //add Role + // add Role $scope.addRoleModalPopup = function(appId) { if(appId){ - var roleId = 0; + var roleId = -1; RoleService.getRole(appId, roleId).then(function(data){ var response = JSON.parse(data.data); var role = JSON.parse(response.role);