diff options
author | Christopher Lott (cl778h) <clott@research.att.com> | 2017-08-23 18:27:19 -0400 |
---|---|---|
committer | Christopher Lott (cl778h) <clott@research.att.com> | 2017-08-23 21:12:56 -0400 |
commit | 978dbcf0a196acbafad72fe1e2478ec0e384f02f (patch) | |
tree | 17e1ceaa4a12a599320cbb317947e990bf1a5383 /ecomp-portal-FE-common/client/app/views/role | |
parent | bc7350dce5b7b1dcd1c472a3922b42c4ea99809d (diff) |
Deliver centralized role management feature
Repair multiple defects also.
Revise deployment to use docker-compose.
Remove all zip archives.
Issue: PORTAL-21, PORTAL-25, PORTAL-28, PORTAL-52, PORTAL-69,
PORTAL-74, PORTAL-76, PORTAL-80, PORTAL-82
Change-Id: Ie72fec7d35ba78beb162bba6ed27b2caee340c61
Signed-off-by: Christopher Lott (cl778h) <clott@research.att.com>
Diffstat (limited to 'ecomp-portal-FE-common/client/app/views/role')
12 files changed, 516 insertions, 374 deletions
diff --git a/ecomp-portal-FE-common/client/app/views/role/popup_modal_rolefunction.html b/ecomp-portal-FE-common/client/app/views/role/popup_modal_rolefunction.html index c5673da8..ad05f9d5 100644 --- a/ecomp-portal-FE-common/client/app/views/role/popup_modal_rolefunction.html +++ b/ecomp-portal-FE-common/client/app/views/role/popup_modal_rolefunction.html @@ -17,39 +17,85 @@ limitations under the License. ================================================================================ --> + <style> + .dialog-control { + position: relative; + bottom: -13px; + right: 0px; +} + </style> +<style> + .dialog-control { + position: relative; + bottom: -13px; + right: 0px; +} + </style> -<div class="new-admin-modal" style="height: 350px;"> - <form name="adminForm" novalidate> - <div class="title" ng-bind="label" style="color: #5a5a5a;font-size: 18px;border-bottom: #067ab4 3px solid;margin-left:0px"></div> +<!-- <link rel="stylesheet" href="role.css"> + --><div class="new-admin-modal"> + <div class="b2b-modal-header"> + - <div id="name-property-title" class="property required"> - <div id="name-property-label" class="property-label" style="margin-bottom: 5px; color: #5a5a5a; font-size: 14px; font-weight: bold; padding-top: 20px;"> - <sup><b style="color: Red;">*</b></sup>Name:</div> - <input id="name-property-input" type="text" class="input-field" style=" display: inline-block; width: 396px; height: 40px;"ng-model="editRoleFunction.name" maxlength="30" /> - <div id="name-property-required" ng-show="!editRoleFunction.name||editRoleFunction.name.length==0" style="color: #cf2a2a; font-size: 10px;"><small style="position: absolute;">Name is Required</small> - </div> - </div> - <br /> - <div id="code-property-title" class="property required"> - <div id="code-property-label" class="property-label" style=" margin-bottom: 5px; color: #5a5a5a; font-size: 14px; font-weight: bold; padding-top: 20px;"> - <sup><b style="color: Red;">*</b></sup>Code: + <div class="corner-button in"> + <button type="button" class="close" aria-label="Close" id="button-cancel-role" + ng-click="$dismiss('cancel')"></button> </div> - <input id="code-property-input" type="text" class="input-field" style=" display: inline-block; width: 396px; height: 40px;" - ng-model="editRoleFunction.code" ng-disabled="disableCd" - maxlength="30" /> - <div id="code-property-required" ng-show="!editRoleFunction.code||editRoleFunction.code.length==0" style="color: #cf2a2a; font-size: 10px;"><small style="position: absolute;">Code is Required</small> - </div> </div> - + <div class="b2b-modal-body"> + <form id="admin-details-form" name="adminForm" novalidate> + <div class="title" ng-bind="label" class="adminForm-title"></div> +<br> + <div > + <div class="item-label"> <span ID="required" style="color: Red;" + visible="false"> *</span>Name:</div> + <input id="name-property-input" + class="adminForm-name-property-input" ng-model="editRoleFunction.name" + type="text" maxlength="30" + /> - <div class="dialog-control"> + <div class="error-container" + ng-show="!editRoleFunction.name||editRoleFunction.name.length==0"> + <small id="microservices-details-input-url-required" + class="err-message">Name is Required</small> + </div> + </div> + <br> + <div > + <div class="item-label"> <span ID="required" style="color: Red;" + visible="false"> *</span>Code:</div> + <input id="code-property-input" + class="adminForm-code-property-input" ng-model="editRoleFunction.code" ng-disabled="disableCd" + type="text" maxlength="30" + /> + + <div class="error-container" + ng-show="!editRoleFunction.code||editRoleFunction.code.length==0"> + <small id="code-property-required" + class="err-message">Code is Required</small> + </div> + </div> + + </form> + </div> + + <div class="b2b-modal-footer"> + <div class="dialog-control"> - <button id="button-app-save" class="save-button" size="small" ng-disabled="(!editRoleFunction.name||editRoleFunction.name.length==0)||(!editRoleFunction.code||editRoleFunction.code.length==0 )" ng-click="!saveRoleFunction(editRoleFunction)";herf="javascript:void(0)">Save</button> +<button id="button-app-save" class="btn btn-alt btn-small" size="small" ng-disabled="(!editRoleFunction.name||editRoleFunction.name.length==0)||(!editRoleFunction.code||editRoleFunction.code.length==0 )" ng-click="!saveRoleFunction(editRoleFunction)";herf="javascript:void(0)">Save</button> - <div id="button-app-cancel" class="cancel-button" ng-click="closeThisDialog()" role="button" tabindex="0" herf="javascript:void(0)">Cancel</div> + <div id="button-app-cancel" class="btn btn-alt btn-small" ng-click="$dismiss('cancel')" role="button" tabindex="0" herf="javascript:void(0)">Cancel</div> </div> - </form> + + <!-- <div class="dialog-control"> + +<button id="button-app-save" class="btn btn-alt btn-small" size="small" ng-disabled="(!editRoleFunction.name||editRoleFunction.name.length==0)||(!editRoleFunction.code||editRoleFunction.code.length==0 )" ng-click="!saveRoleFunction(editRoleFunction)";herf="javascript:void(0)">Save</button> + +<div id="button-app-cancel" class="btn btn-alt btn-small" ng-click="closeThisDialog()" role="button" tabindex="0" herf="javascript:void(0)">Cancel</div> +</div> --> + </div> + </div> <script> @@ -57,3 +103,4 @@ $(document).ready(function(){ $(".ngdialog-close").attr('id','dialog-close'); }); </script> + diff --git a/ecomp-portal-FE-common/client/app/views/role/role-controller.js b/ecomp-portal-FE-common/client/app/views/role/role-controller.js index 2bd522a4..22b28e93 100644 --- a/ecomp-portal-FE-common/client/app/views/role/role-controller.js +++ b/ecomp-portal-FE-common/client/app/views/role/role-controller.js @@ -18,70 +18,80 @@ * ================================================================================ */ -app.controller('roleController', function ($scope, $http, confirmBoxService, ngDialog, RoleService, conf, $stateParams){ + +app.controller('roleController', function ($scope, $http, confirmBoxService, ngDialog, RoleService, conf, $stateParams,$modal,utilsService){ //$scope.role=${role}; $( "#dialogRoleFunction" ).hide(); $( "#dialogChildRole" ).hide(); - - //$scope.ociavailableRoleFunctions=${availableRoleFunctions}; + $scope.routeRoleId = $stateParams.roleId; + + // $scope.ociavailableRoleFunctions=${availableRoleFunctions}; $scope.fetchRoles = function() { - - RoleService.getRole($stateParams.roleId).then(function(data){ - - var j = data; - $scope.data = JSON.parse(j.data); - - $scope.role =JSON.parse($scope.data.role); - - $scope.ociavailableRoleFunctions =JSON.parse($scope.data.availableRoleFunctions); - $scope.availableRoleFunctions=[]; - - if($scope.ociavailableRoleFunctions) - $.each($scope.ociavailableRoleFunctions, function(i, a){ - var availableRoleFunction = a; - availableRoleFunction.selected = false; - $.each($scope.role.roleFunctions, function(j, b){ - if(a.code === b.code) { - availableRoleFunction.selected = true; - } - }); - $scope.availableRoleFunctions.push(availableRoleFunction); - }); - + $scope.isLoadingRoleFunctions = true; + utilsService.showLoadingLayer(); // show the loading layer + RoleService.getRole($stateParams.roleId).then(function(data){ + if(data==null || data ==''){ + var msg={ + content:'Something is wrong. Please contact the administrator for more information' + }; + confirmBoxService.reloadPageConfirm(msg); + }else{ + var j = data; + $scope.data = JSON.parse(j.data); + $scope.role =JSON.parse($scope.data.role); + $scope.routeRoleId = $stateParams.roleId; + $scope.ociavailableRoleFunctions =JSON.parse($scope.data.availableRoleFunctions); + $scope.isGlobalRoleChecked=($scope.role.name.indexOf('global_')==-1)?false:true; - $scope.ociavailableRoles=JSON.parse($scope.data.availableRoles); - $scope.availableRoles=[]; - - if($scope.ociavailableRoles) - $.each($scope.ociavailableRoles, function(i, a){ - var availableRole = a; - availableRole.selected = false; - if($scope.role.childRoles){ - $.each($scope.role.childRoles, function(j, b){ - if(a.id === b.id) { - availableRole.selected = true; - } - }); - }; - $scope.availableRoles.push(availableRole); - }); - - - },function(error){ - console.log("RoleService.getRole failed", error); - //reloadPageOnce(); - }); + $scope.availableRoleFunctions=[]; + + if($scope.ociavailableRoleFunctions) + $.each($scope.ociavailableRoleFunctions, function(i, a){ + var availableRoleFunction = a; + availableRoleFunction.selected = false; + $.each($scope.role.roleFunctions, function(j, b){ + if(a.code === b.code) { + availableRoleFunction.selected = true; + } + }); + $scope.availableRoleFunctions.push(availableRoleFunction); + }); + $scope.ociavailableRoles=JSON.parse($scope.data.availableRoles); + $scope.availableRoles=[]; + + if($scope.ociavailableRoles) + $.each($scope.ociavailableRoles, function(i, a){ + var availableRole = a; + availableRole.selected = false; + if($scope.role.childRoles){ + $.each($scope.role.childRoles, function(j, b){ + if(a.id === b.id) { + availableRole.selected = true; + } + }); + }; + $scope.availableRoles.push(availableRole); + }); + } + },function(error){ + console.log("RoleService.getRole failed", error); + }).finally(function(){ + utilsService.hideLoadingLayer(); + $scope.isLoadingRoleFunctions = false; + }); } $scope.fetchRoles(); + $scope.isGlobalRoleChecked; + $scope.saveRole = function() { var exists = false,x; for(x in $scope.availableRoles){ if($scope.availableRoles[x].name==$scope.role.name){ exists = true; - //$modalInstance.close({availableRoleFunctions:message.availableRoleFunctions}); + // $modalInstance.close({availableRoleFunctions:message.availableRoleFunctions}); } } if (exists) { @@ -89,17 +99,30 @@ app.controller('roleController', function ($scope, $http, confirmBoxService, ngD } else { var uuu = conf.api.saveRole + "?role_id="+$stateParams.roleId; + if($scope.isGlobalRoleChecked ){ + $scope.role.name = ($scope.role.name.indexOf('global_')==-1)?('global_'+$scope.role.name):($scope.role.name); + + }else{ + $scope.role.name=$scope.role.name.replace('global_',''); + } var postData = { role: $scope.role, childRoles: $scope.role.childRoles, roleFunctions : $scope.role.roleFunctions }; - $http.post(uuu, JSON.stringify(postData)).then(function(res) { - // console.log('roleController::saveRole: ' + JSON.stringify(res)); - if (res && res.data && res.data.role) + $http.post(uuu, JSON.stringify(postData,$stateParams.roleId)).then(function(res) { + // console.log('roleController::saveRole: ' + + // JSON.stringify(res)); + if (res && res.data && res.data.role){ confirmBoxService.showInformation("Update Successful."); - else + $scope.routeRoleId = res.role; + $scope.isSaveClicked=true; + $scope.role=''; + } + + else{ confirmBoxService.showInformation('Failed to create role: ' + res.data.error) + } }, function(res){ console.log('post failed', res.data); @@ -110,42 +133,42 @@ app.controller('roleController', function ($scope, $http, confirmBoxService, ngD }; $scope.addNewRoleFunctionModalPopup = function() { - var modalInstance = ngDialog.open({ - templateUrl: 'app/views/role/role_functions_popup.html', - controller: 'rolepopupController', - - resolve: { - roleId: function () { - return $stateParams.roleId; - }, - role: function () { - return $scope.role; + var modalInstance = $modal.open({ + templateUrl: 'app/views/role/role_functions_popup.html', + controller: 'rolepopupController', + sizeClass: 'modal-medium', + resolve: { + roleId: function () { + return $stateParams.roleId; }, - availableRoles: function () { - return $scope.ociavailableRoles; - }, - availableRoleFunctions: function () { - return $scope.ociavailableRoleFunctions; - }, - } - }); - modalInstance.closePromise.then(response => { - if($stateParams.roleId === '0'){ - return $scope.role; - }else{ - $scope.fetchRoles(); - } - // $scope.role=response.role; - }); + role: function () { + return $scope.role; + }, + availableRoles: function () { + return $scope.ociavailableRoles; + }, + availableRoleFunctions: function () { + return $scope.ociavailableRoleFunctions; + } + } + }); + + modalInstance.result.finally(function () { + if($stateParams.roleId === '0'){ + return $scope.role; + }else{ + $scope.fetchRoles(); + } + }); }; $scope.addNewChildRoleModalPopup = function() { - var modalInstance = ngDialog.open({ - templateUrl: 'app/views/role/role_childrole_popup.html', - controller: 'rolepopupController', - - resolve: { - roleId: function () { + var modalInstance = $modal.open({ + templateUrl: 'app/views/role/role_childrole_popup.html', + controller: 'rolepopupController', + sizeClass: 'modal-medium', + resolve: { + roleId: function () { return $stateParams.roleId; }, role: function () { @@ -156,16 +179,17 @@ app.controller('roleController', function ($scope, $http, confirmBoxService, ngD }, availableRoleFunctions: function () { return $scope.ociavailableRoleFunctions; - }, - } - }).closePromise.then(function(response){ - if($stateParams.roleId === '0'){ - return $scope.role; - }else{ - $scope.fetchRoles(); - } - //$scope.role=response.role; + } + } }); + + modalInstance.result.finally(function () { + if($stateParams.roleId === '0'){ + return $scope.role; + }else{ + $scope.fetchRoles(); + } + }); }; $scope.removeRoleFunction = function(roleFunction) { diff --git a/ecomp-portal-FE-common/client/app/views/role/role-function-list-controller.js b/ecomp-portal-FE-common/client/app/views/role/role-function-list-controller.js index e7195996..5e7c62cc 100644 --- a/ecomp-portal-FE-common/client/app/views/role/role-function-list-controller.js +++ b/ecomp-portal-FE-common/client/app/views/role/role-function-list-controller.js @@ -17,20 +17,21 @@ * limitations under the License. * ================================================================================ */ -app.controller('roleFunctionListController', function ($scope,RoleService,$http,$state,conf,confirmBoxService, ngDialog){ +app.controller('roleFunctionListController', function ($scope,RoleService,$http,$state,conf,confirmBoxService, ngDialog,$modal){ $( "#dialog" ).hide(); - + $scope.isLoadingRoleFunctions = true; RoleService.getRoleFunctionList().then(function(data){ var j = data; $scope.data = JSON.parse(j.data); $scope.availableRoleFunctions =JSON.parse($scope.data.availableRoleFunctions); - //$scope.resetMenu(); },function(error){ console.log("failed"); //reloadPageOnce(); + }) .finally(function(){ + $scope.isLoadingRoleFunctions = false; }); $scope.editRoleFunction = null; @@ -46,32 +47,35 @@ app.controller('roleFunctionListController', function ($scope,RoleService,$http, $scope.editRoleFunction = availableRoleFunction; $scope.availableRoleFunctionsTemp=$scope.availableRoleFunctions; //$scope.availableRoleFunctions={}; - var modalInstance = ngDialog.open({ - templateUrl: 'app/views/role/popup_modal_rolefunction.html', - controller: 'rolefunctionpopupController', - resolve: { - message: function () { - var message = { - availableRoleFunction: $scope.editRoleFunction, - availableRoleFunctions: $scope.availableRoleFunctionsTemp - }; - return message; - }, - isEditing: function () { - return true; - } - } - }); - modalInstance.closePromise.then(response =>{ - if(response.value!=null){ - if(response.value.result){ - $scope.availableRoleFunctions=response.value.availableRoleFunctions; - } - } - /*else - $scope.availableRoleFunctions=$scope.availableRoleFunctionsTemp; - */ - }); + + var modalInstance = $modal.open({ + templateUrl: 'app/views/role/popup_modal_rolefunction.html', + controller: 'rolefunctionpopupController', + sizeClass: 'modal-small', + resolve: { + message: function () { + var message = { + availableRoleFunction: $scope.editRoleFunction, + availableRoleFunctions: $scope.availableRoleFunctionsTemp + }; + return message; + }, + isEditing: function () { + return true; + } + } + }); + + modalInstance.result.then(function (response) { + if(response.value!=null){ + if(response.value.result){ + $scope.availableRoleFunctions=response.value.availableRoleFunctions; + } + } + else + $scope.availableRoleFunctions=$scope.availableRoleFunctionsTemp; + + }); }; $scope.addNewRoleFunctionModalPopup = function(availableRoleFunction) { @@ -79,34 +83,36 @@ app.controller('roleFunctionListController', function ($scope,RoleService,$http, $scope.editRoleFunction = null; $scope.availableRoleFunctionsTemp=$scope.availableRoleFunctions; //$scope.availableRoleFunctions={}; - var modalInstance = ngDialog.open({ - templateUrl: 'app/views/role/popup_modal_rolefunction.html', - controller: 'rolefunctionpopupController', - resolve: { - message: function () { - var message = { - availableRoleFunction: $scope.editRoleFunction, - availableRoleFunctions: $scope.availableRoleFunctionsTemp - }; - return message; - }, - isEditing: function () { - return false; - } - } - }); - modalInstance.closePromise.then(response => { - if(response.value!=null){ - if(response.value.result){ - $scope.availableRoleFunctions=response.value.availableRoleFunctions; - } - } - /* if(response.availableRoleFunctions != undefined) - $scope.availableRoleFunctions=response.availableRoleFunctions; - else - $scope.availableRoleFunctions=$scope.availableRoleFunctionsTemp; - */ - }); + var modalInstance = $modal.open({ + templateUrl: 'app/views/role/popup_modal_rolefunction.html', + controller: 'rolefunctionpopupController', + sizeClass: 'modal-small', + resolve: { + message: function () { + var message = { + availableRoleFunction: $scope.editRoleFunction, + availableRoleFunctions: $scope.availableRoleFunctionsTemp + }; + return message; + }, + isEditing: function () { + return false; + } + } + }); + + modalInstance.result.then(function (response) { + if(response.value!=null){ + if(response.value.result){ + $scope.availableRoleFunctions=response.value.availableRoleFunctions; + } + } + if(response.availableRoleFunctions != undefined) + $scope.availableRoleFunctions=response.availableRoleFunctions; + else + $scope.availableRoleFunctions=$scope.availableRoleFunctionsTemp; + + }); }; $scope.addNewRoleFunctionPopup = function() { @@ -134,27 +140,28 @@ app.controller('roleFunctionListController', function ($scope,RoleService,$http, $scope.removeRole = function(availableRoleFunction) { confirmBoxService.confirm("You are about to delete the role function "+availableRoleFunction.name+". Do you want to continue?").then( - function(confirmed){ - if(confirmed){ - $scope.availableRoleFunctionsTemp=$scope.availableRoleFunctions; - //$scope.availableRoleFunctions={}; - var uuu = conf.api.removeRoleFunction; - var postData={availableRoleFunction: availableRoleFunction}; - $http.post(uuu,postData).then(function(response) { - var data = response.data; - if(data.availableRoleFunctions == undefined) - confirmBoxService.showInformation("Error while deleting: "+ data); - else - $scope.availableRoleFunctions=data.availableRoleFunctions; - }, - function() { - $scope.availableRoleFunctions=$scope.availableRoleFunctionsTemp; - confirmBoxService.showInformation("Error while deleting: "+ data.responseText); - } - ); - } - }); - - }; + function(confirmed){ + if(confirmed){ + $scope.availableRoleFunctionsTemp=$scope.availableRoleFunctions; + //$scope.availableRoleFunctions={}; + var uuu = conf.api.removeRoleFunction; + var postData=availableRoleFunction; + $http.post(uuu,postData).then(function(response) { + var data = response.data; + if(data == undefined) + confirmBoxService.showInformation("Error while deleting: "+ data); + else + $scope.availableRoleFunctionsTemp.splice($scope.availableRoleFunctionsTemp.indexOf(availableRoleFunction), 1); + $scope.availableRoleFunctions=$scope.availableRoleFunctionsTemp; + }, + function() { + $scope.availableRoleFunctions=$scope.availableRoleFunctionsTemp; + confirmBoxService.showInformation("Error while deleting: "+ data.responseText); + } + ); + } + }); + + }; }); 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 2e1acf37..582706c5 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 @@ -17,7 +17,7 @@ * limitations under the License. * ================================================================================ */ -app.controller('roleListController', function ($scope,RoleService,confirmBoxService,conf,$state,$http){ +app.controller('roleListController', function ($scope,RoleService,confirmBoxService,conf,$state,$http,$log){ $scope.showSpinner = true; RoleService.getRoles().then(function(data){ @@ -26,20 +26,16 @@ app.controller('roleListController', function ($scope,RoleService,confirmBoxServ $scope.data = JSON.parse(j.data); $scope.availableRoles =JSON.parse($scope.data.availableRoles); $scope.showSpinner = false; - //$scope.resetMenu(); },function(error){ - console.log("failed"); - //reloadPageOnce(); + $log.debug('failed'); }); - $scope.goToUrl = function(roleIdVal) { + $scope.goToUrl = function(roleIdVal) { $state.go("root.role", {"roleId":roleIdVal}); - } - //console.log($scope.availableRoles); + } $scope.toggleRole = function(selected,availableRole) { - //alert('toggleRole: '+selected); var toggleType = null; if(selected) { toggleType = "activate"; @@ -48,57 +44,34 @@ app.controller('roleListController', function ($scope,RoleService,confirmBoxServ } confirmBoxService.confirm("You are about to "+toggleType+" the role "+availableRole.name+". Do you want to continue?").then( - function(confirmed){ + function(confirmed){ - if(confirmed) { - var uuu = conf.api.toggleRole; + if(confirmed) { + var uuu = conf.api.toggleRole; var postData={role:availableRole}; $http.post(uuu, postData).then(function(response) { var data = response.data; if (typeof data === 'object') { - console.log(data); + $log.debug('data:'+data); $scope.availableRoles=data.availableRoles; - console.log($scope.availableRoles); + $log.debug('role::availableRoles:'+$scope.availableRoles); } else { // } }, function(response) { - console.log(response.data); + debug.log('response:'+response); availableRole.active=!availableRole.active; confirmBoxService.showInformation("Error while saving."); }); - /* - $.ajax({ - type : 'POST', - url : uuu, - dataType: 'json', - contentType: 'application/json', - data: JSON.stringify(postData), - success : function(data){ - console.log(data); - $scope.$apply(function(){$scope.availableRoles=data.availableRoles;}); - console.log($scope.availableRoles); - }, - error : function(data){ - console.log(data); - availableRole.active=!availableRole.active; - confirmBoxService.showInformation("Error while saving."); - } - }); - */ } - else { - availableRole.active=!availableRole.active; - } - + + }) .catch(function(err) { + $log.error('roleListController::confirmBoxService.confirm error:', err); + availableRole.active=!availableRole.active; }); - //, - //function(){ - // availableRole.active=!availableRole.active; - //}) }; @@ -109,20 +82,7 @@ app.controller('roleListController', function ($scope,RoleService,confirmBoxServ function(confirmed){ var uuu = conf.api.removeRole; var postData={role:role}; - /* $.ajax({ - type : 'POST', - url : uuu, - dataType: 'json', - contentType: 'application/json', - data: JSON.stringify(postData), - success : function(data){ - $scope.$apply(function(){$scope.availableRoles=data.availableRoles;}); - }, - error : function(data){ - console.log(data); - confirmBoxService.showInformation("Error while deleting: "+ data.responseText); - } - }); */ + $http.post(uuu, postData).then(function(response) { @@ -134,7 +94,7 @@ app.controller('roleListController', function ($scope,RoleService,confirmBoxServ } }, function(response) { - console.log(response.data); + $log.debug('response:'+response.data); confirmBoxService.showInformation("Error while deleting: "+ data.responseText); }); diff --git a/ecomp-portal-FE-common/client/app/views/role/role.html b/ecomp-portal-FE-common/client/app/views/role/role.html index 2356058d..9febc978 100644 --- a/ecomp-portal-FE-common/client/app/views/role/role.html +++ b/ecomp-portal-FE-common/client/app/views/role/role.html @@ -17,6 +17,25 @@ limitations under the License. ================================================================================ --> + <style> + .checkbox .skin { + left: 112px; + top: -8px; +} +.checkbox input { + margin: 0px; + left: 105px; + height: 20px; + top: -4px; + } +.checkbox span { + display: inline-block; + margin-left: 1px; + margin-top: 0; + position: relative; + top: -3px; +} + </style> <div class="w-ecomp-admins-page-main"> <div class="admins-home-container" id="page-content"> <div id="title" class="w-ecomp-main-view-title"> @@ -26,10 +45,18 @@ <div> <br> <p class="p-info">Please edit the role details below: </p><br> + + <div class="property-label checkbox-label"> + <label for="checkbox-app-is-restricted" class="checkbox"> + <input type="checkbox" ng-model="isGlobalRoleChecked" id="checkbox-app-is-restricted" ng-checked="isGlobalRoleChecked" /> + <i id="checkbox-app-is-restricted" class="skin"></i> + <span>Global Roles: </span> + </label> + </div> <div id="role-text" > <label id="role-text-name-label" >*Name:</label> - <input id="input-name" class="input-field" maxlength="30" type="text" data-ng-model="role.name"> + <input id="input-name" class="input-field" maxlength="300" type="text" data-ng-model="role.name"> <br> <label id="role-text-priority-label">Priority:</label> <input id="input-priority" class="input-field" maxlength="30" type="text" data-ng-model="role.priority"> @@ -40,12 +67,14 @@ </div> <br> + <div ng-if="routeRoleId!=0"> <div id="page-title" class="pageTitle"> <label>Role Functions</label> <a id="add-new-role" ng-click="addNewRoleFunctionModalPopup();" ng-style="{'cursor':'pointer'}" class="icon-primary-accordion-plus" size="small"></a> </div> <div b2b-table table-data="role.roleFunctions" ng-hide="users.isLoadingTable" search-string="users.searchString" class="b2b-table-div"> + <span class="ecomp-spinner" ng-show="isLoadingRoleFunctions"></span> <table> <thead b2b-table-row type="header"> <tr > @@ -57,7 +86,7 @@ <tr > <td id="role-function-{{roleFunction.name}}" b2b-table-body id="rowheader_t1_{{$index}}" headers="col1" ng-bind="roleFunction.name"></td> <td b2b-table-body headers="rowheader_t1_{{$index}} col4"> - <div ng-click="removeRoleFunction(roleFunction);" ><a href="javascript:void(0)" class="icon-misc-trash"></a></div> + <div id="{{$index}}-remove-trash-button" ng-click="removeRoleFunction(roleFunction);" ><a href="javascript:void(0)" class="icon-misc-trash"></a></div> </td> </tr> </tbody> @@ -82,7 +111,7 @@ <tbody b2b-table-row type="body" row-repeat="role in role.childRoles"> <tr > <td id="role-function-{{role.name}}" b2b-table-body id="rowheader_t1_{{$index}}" headers="col1" ng-bind="role.name"></td> - <td b2b-table-body headers="rowheader_t1_{{$index}} col4"> + <td b2b-table-body headers="rowheader_t1_{{$index}} col4" id="{{$index}}-button-remove-role" > <div ng-click="removeChildRole(role);" ><a href="javascript:void(0)" class="icon-misc-trash"></a></div> </td> </tr> @@ -90,7 +119,7 @@ </table> </div> </div> - + </div> </div> </div> </div> diff --git a/ecomp-portal-FE-common/client/app/views/role/role.less b/ecomp-portal-FE-common/client/app/views/role/role.less index 71d240dc..b6e92c9e 100644 --- a/ecomp-portal-FE-common/client/app/views/role/role.less +++ b/ecomp-portal-FE-common/client/app/views/role/role.less @@ -47,4 +47,27 @@ .scroll-bar { border-radius: 0px !important; -}
\ No newline at end of file +} + +.admins-table-create-new-admin { + marin-bottom: 50px; +} + +.admins-table-space { + text-align: justify; + text-align-last: auto; +} + +.admins-table-tbody { + max-height: 980px; +} + +.admins-table-btn-txt { + font-size:20px; +} + +.admins-table-btn-create { + margin-bottom: 50px; +} + + diff --git a/ecomp-portal-FE-common/client/app/views/role/role_childrole_popup.html b/ecomp-portal-FE-common/client/app/views/role/role_childrole_popup.html index e96fb062..cf9502a1 100644 --- a/ecomp-portal-FE-common/client/app/views/role/role_childrole_popup.html +++ b/ecomp-portal-FE-common/client/app/views/role/role_childrole_popup.html @@ -19,7 +19,14 @@ --> <link rel="stylesheet" href="role.css"> <div class="application-details-modal"> - <div id="title" class="title">Select Role Functions</div> + <div class="b2b-modal-header ng-scope in"> + <h2 id="myModalLabel" modal-title="">Select Role Functions</h2> + <div class="corner-button in"> + <button type="button" class="close" aria-label="Close" id="div-childrole-cancel-button" + ng-click="$dismiss('cancel')"></button> + </div> + </div> +<div class="b2b-modal-body"> <div class="scrolling-table"> <div b2b-table table-data="availableRoles" class="b2b-table-div"> @@ -44,9 +51,13 @@ </table> </div> </div> - <div class="dialog-control"> - <button id="button-app-cancel" class="btn btn-alt btn-small" ng-click="closeThisDialog()">Close</button> - </div> +</div> + <div class="b2b-modal-footer ng-scope ng-isolate-scope in"> + <div class="cta-button-group in"> + <button class="btn btn-alt btn-small" type="button" id="div-childrole-close-button" + ng-click="$dismiss('cancel')">Close</button> + </div> + </div> </div> <script> $(document).ready(function(){ diff --git a/ecomp-portal-FE-common/client/app/views/role/role_function_list.html b/ecomp-portal-FE-common/client/app/views/role/role_function_list.html index 7c50a5ac..6abf6006 100644 --- a/ecomp-portal-FE-common/client/app/views/role/role_function_list.html +++ b/ecomp-portal-FE-common/client/app/views/role/role_function_list.html @@ -42,16 +42,17 @@ <div class="admins-table"> <!-- <a ng-click="addNewRoleFunctionModalPopup();" class="icon-add" size="small" ></a> --> - <div id="create-new-admin" align="left" style="marin-bottom: 50px;"> + <div id="create-new-admin" align="left" class="admins-table-create-new-admin"> <button id="button-admin-create" type="submit" ng-click="addNewRoleFunctionModalPopup();" class="btn btn-alt btn-small">Create</button> </div> - <div style="text-align: justify;text-align-last:auto;"> + <div class="admins-table-space"> <!-- Click on the edit icon to update a role function, the plus icon to add additional role functions, or the delete icon to remove them. --> </div> <div id="rolesTable" class="c-ecomp-abs-table default" title="Role Functions"> + <span class="ecomp-spinner" ng-show="isLoadingRoleFunctions"></span> <table b2b-table table-data="availableRoleFunctions" current-page="1"> <thead b2b-table-row type="header"> <tr> @@ -61,7 +62,7 @@ <th id="table-header-delete" b2b-table-header width="10%" sortable="false">Delete?</th> </tr> </thead> - <tbody b2b-table-row type="body" row-repeat="availableRoleFunction in availableRoleFunctions" style="max-height: 980px;" ><!-- background colors will alternate not properly with multiple tbody--> + <tbody b2b-table-row type="body" row-repeat="availableRoleFunction in availableRoleFunctions" class="admins-table-tbody" ><!-- background colors will alternate not properly with multiple tbody--> <tr> <td id="table-body-role-{{availableRoleFunction['name'].split(' ').join('-')}}" b2b-table-body width="70%" ng-bind="availableRoleFunction['name']"></td> <td id="table-body-role-{{availableRoleFunction['code']}}" b2b-table-body width="10%" ng-bind="availableRoleFunction['code']"></td> @@ -69,11 +70,11 @@ <!-- <a ng-click="editRoleFunctionPopup(availableRoleFunction);" > <img src="static/fusion/images/editicon.gif"> </a> --> - <div ng-click="editRoleFunctionModalPopup(availableRoleFunction);" style="font-size:20px;"><a id="role-{{availableRoleFunction['name'].split(' ').join('-')}}-edit" href="javascript:void(0)" class="icon-edit"></a></div> + <div ng-click="editRoleFunctionModalPopup(availableRoleFunction);" class="admins-table-btn-txt"><a id="role-{{availableRoleFunction['name'].split(' ').join('-')}}-edit" href="javascript:void(0)" class="icon-edit"></a></div> </td> <td b2b-table-body width="10%"> <!-- <a ng-click="removeRole(availableRoleFunction);" ><img src="static/fusion/images/deleteicon.gif"></a> --> - <div ng-click="removeRole(availableRoleFunction);" style="font-size:20px;"><a id="role-{{availableRoleFunction['name'].split(' ').join('-')}}-trash" href="javascript:void(0)" class="icon-misc-trash"></a></div> + <div ng-click="removeRole(availableRoleFunction);" class="admins-table-btn-txt"><a id="role-{{availableRoleFunction['name'].split(' ').join('-')}}-trash" href="javascript:void(0)" class="icon-misc-trash"></a></div> </td> </tr> </tbody> diff --git a/ecomp-portal-FE-common/client/app/views/role/role_functions_popup.html b/ecomp-portal-FE-common/client/app/views/role/role_functions_popup.html index 52c4cb3a..a405ba02 100644 --- a/ecomp-portal-FE-common/client/app/views/role/role_functions_popup.html +++ b/ecomp-portal-FE-common/client/app/views/role/role_functions_popup.html @@ -17,10 +17,21 @@ limitations under the License. ================================================================================ --> -<link rel="stylesheet" href="role.css"> + + + <link rel="stylesheet" href="role.css"> <div class="application-details-modal"> - <div id="title" class="title">Select Role Functions</div> -<div class="scrolling-table"> + <div class="b2b-modal-header"> + <h2 class="account-details-title" id="application-details-title">Select Role Functions</h2> + + <div class="corner-button in"> + <button type="button" class="close" aria-label="Close" id="div-notification-cancel--button" + ng-click="$dismiss('cancel')"></button> + </div> + </div> + + <div class="b2b-modal-body"> + <div class="scrolling-table"> <div b2b-table table-data="availableRoleFunctions" class="b2b-table-div"> <table> <thead b2b-table-row type="header"> @@ -43,13 +54,16 @@ </table> </div> </div> - <div class="dialog-control"> - <button id="button-app-cancel" class="btn btn-alt btn-small" ng-click="closeThisDialog()">Close</button> - </div> -</div> + </div> + + <br> + <div class="b2b-modal-footer"> + <div class="cta-button-group in"> + <button id="button-notification-cancel" class="btn btn-alt btn-small" ng-click="$dismiss('cancel')"role="button" tabindex="0">close</button> + </div> + </div> + + + -<script> -$(document).ready(function(){ - $(".ngdialog-close").attr('id','dialog-close'); -}); -</script> +</div>
\ No newline at end of file diff --git a/ecomp-portal-FE-common/client/app/views/role/role_list.html b/ecomp-portal-FE-common/client/app/views/role/role_list.html index 74de7c23..4248b46a 100644 --- a/ecomp-portal-FE-common/client/app/views/role/role_list.html +++ b/ecomp-portal-FE-common/client/app/views/role/role_list.html @@ -17,16 +17,25 @@ limitations under the License. ================================================================================ --> + <style> + .property-label{ + text-align: right; + } + </style> <div class="w-ecomp-admins-page-main"> <div class="admins-home-container" id="page-content"> <div id="title" class="w-ecomp-main-view-title"> <h1 class="heading-page" >Roles</h1> </div> <div class="admins-table"> - <div id="button-create-role" align="left" style="marin-bottom: 50px;" > - <button ng-click="goToUrl(0)" class = "btn btn-alt btn-small">Create</button> + <div id="button-create-role" align="left" class="admins-table-btn-create" > + <button id="button-create-role" ng-click="goToUrl(0)" class = "btn btn-alt btn-small">Create</button> </div> + <br> + <div class="property-label"> + <span ID="required" style="color: Red;font-size: 210%;" visible="false"> *</span>-----Indicates Global Roles </div> <div b2b-table table-data="availableRoles" search-string="searchString" class="b2b-table-div"> + <span class="ecomp-spinner" ng-show="showSpinner"></span> <table> <thead b2b-table-row type="header"> <tr> @@ -38,20 +47,28 @@ </thead> <tbody b2b-table-row type="body" row-repeat="rowData in availableRoles"> <tr> - <td b2b-table-body id="rowheader_t1_{{$index}}" headers="col1" ng-bind="rowData['name']"></td> + <!-- <td b2b-table-body id="rowheader_t1_{{$index}}" headers="col1" ng-bind="rowData['name']"></td> --> + <td b2b-table-body> + <span ng-if="rowData.name.indexOf('global_')!=-1" id="required" style="color: Red;font-size: 180%;" visible="false"> *</span> + <span>{{rowData.name}}</span> + </td> <td b2b-table-body ng-bind="rowData['priority']"></td> <td b2b-table-body headers="rowheader_t1_{{$index}} col3" > <div > <label class="btn-switch-label" tabindex="0" role="option"> - <input type="checkbox" b2b-switches ng-model="rowData.active" ng-click="toggleRole(rowData.active,rowData);"> + <input type="checkbox" id="{{$index}}-button-toggle-role" b2b-switches ng-model="rowData.active" ng-click="toggleRole(rowData.active,rowData);"> </label> </div> </td> - <td b2b-table-body class="icon-misc-pen" ng-click="goToUrl(rowData.id)"></td> + <td b2b-table-body id="{{$index}}-button-edit-role" class="icon-misc-pen" ng-click="goToUrl(rowData.id)"></td> </tr> </tbody> </table> + + </div> </div> </div> </div> + + diff --git a/ecomp-portal-FE-common/client/app/views/role/rolefunctionpopupController.js b/ecomp-portal-FE-common/client/app/views/role/rolefunctionpopupController.js index db5bb1b6..41241500 100644 --- a/ecomp-portal-FE-common/client/app/views/role/rolefunctionpopupController.js +++ b/ecomp-portal-FE-common/client/app/views/role/rolefunctionpopupController.js @@ -17,79 +17,85 @@ * limitations under the License. * ================================================================================ */ -app.controller('rolefunctionpopupController', function ($scope, confirmBoxService, message, $http,RoleService, conf, isEditing){ - if(message.availableRoleFunction==null) { - $scope.label='Add Role Function'; - var tempText = ""; - } - else{ - $scope.label='Edit Role Function' - $scope.disableCd=true; - var tempText = new String(message.availableRoleFunction.name); - $scope.editRoleFunction = angular.copy(message.availableRoleFunction); - } - - $scope.tempText = tempText; - $scope.isEditing = isEditing; - - $scope.saveRoleFunction = function(availableRoleFunction) { - var uuu = conf.api.saveRoleFunction; - var postData={availableRoleFunction: availableRoleFunction}; +app.controller('rolefunctionpopupController',function($scope, confirmBoxService, message, $http,RoleService, conf, isEditing) { + if (message.availableRoleFunction == null) { + $scope.label = 'Add Role Function'; + var tempText = ""; + } else { + $scope.label = 'Edit Role Function' + $scope.disableCd = true; + var tempText = new String(message.availableRoleFunction.name); + $scope.editRoleFunction = angular.copy(message.availableRoleFunction); + } - if(availableRoleFunction==null){ - confirmBoxService.showInformation("Please enter valid role function details."); - } - var exists = false,x; - for(x in message.availableRoleFunctions){ - console.log(message.availableRoleFunctions[x].name); - if(message.availableRoleFunctions[x].name==availableRoleFunction.name){ - confirmBoxService.showInformation("Role Function already exists."); - exists = true; - availableRoleFunction.name = $scope.tempText; - break; - } - if(!isEditing){ - if (message.availableRoleFunctions[x].code == availableRoleFunction.code) { - confirmBoxService.showInformation("Code already exists. Please create a role function with a different code to proceed."); - exists = true; - availableRoleFunction.name = $scope.tempText; - break; - } - } - } - - if(!exists && availableRoleFunction.name.trim() != '' && availableRoleFunction.code.trim() != ''){ - $http.post(uuu, JSON.stringify(postData)).then(function(res){ - console.log("data"); -// console.log(res.data); -// $scope.availableRoleFunctionsTemp = res.data.availableRoleFunctions; - RoleService.getRoleFunctionList().then(function(data){ - - var j = data; - $scope.data = JSON.parse(j.data); - $scope.availableRoleFunctions =JSON.parse($scope.data.availableRoleFunctions); - - //$scope.resetMenu(); - $scope.closeThisDialog({result: true, availableRoleFunctions: $scope.availableRoleFunctions }); - },function(error){ - console.log("failed"); - //reloadPageOnce(); - $scope.closeThisDialog(true); - }); - - - }); - - - - - } - }; - - - - $scope.close = function() { - this.closeThisDialog(true); - }; -} -); + $scope.tempText = tempText; + $scope.isEditing = isEditing; + + $scope.saveRoleFunction = function(availableRoleFunction) { + confirmBoxService.confirm( + "You are about to Create the role function "+ availableRoleFunction.name+ ". Do you want to continue?") + .then(function(confirmed) { + if (confirmed) { + + var uuu = conf.api.saveRoleFunction; + var postData = availableRoleFunction; + + if (availableRoleFunction == null) { + confirmBoxService.showInformation("Please enter valid role function details."); + } + var exists = false, x; + for (x in message.availableRoleFunctions) { + console.log(message.availableRoleFunctions[x].name); + if (message.availableRoleFunctions[x].name == availableRoleFunction.name) { + confirmBoxService.showInformation("Role Function already exists."); + exists = true; + availableRoleFunction.name = $scope.tempText; + break; + } + if (!isEditing) { + if (message.availableRoleFunctions[x].code == availableRoleFunction.code) { + confirmBoxService.showInformation("Code already exists. Please create a role function with a different code to proceed."); + exists = true; + availableRoleFunction.name = $scope.tempText; + break; + } + } + } + + if (!exists&& availableRoleFunction.name.trim() != ''&& availableRoleFunction.code.trim() != '') { + $http.post(uuu,JSON.stringify(postData)).then(function(res) { + $scope.availableRoleFunctionsTemp = res.data.availableRoleFunctions; + RoleService.getRoleFunctionList().then( + function(data) { + + var j = data; + $scope.data = JSON.parse(j.data); + $scope.availableRoleFunctions = JSON.parse($scope.data.availableRoleFunctions); + + // $scope.resetMenu(); + /*$scope.closeThisDialog({ + result : true, + availableRoleFunctions : $scope.availableRoleFunctions + });*/ + $scope.$dismiss({result : true,availableRoleFunctions : $scope.availableRoleFunctions}); + }, + function(error) { + console.log("failed"); + // reloadPageOnce(); + //$scope.closeThisDialog(true); + $scope.$dismiss('cancel'); + }); + + }); + + } + }; + + $scope.close = function() { + this.closeThisDialog(true); + }; + } + + ); + } + });
\ No newline at end of file diff --git a/ecomp-portal-FE-common/client/app/views/role/rolepopupmodelController.js b/ecomp-portal-FE-common/client/app/views/role/rolepopupmodelController.js index 1176e50a..67bf3b2e 100644 --- a/ecomp-portal-FE-common/client/app/views/role/rolepopupmodelController.js +++ b/ecomp-portal-FE-common/client/app/views/role/rolepopupmodelController.js @@ -88,9 +88,6 @@ app.controller('rolepopupController', function ($scope, role, roleId, confirmBo } - else { - availableRoleFunction.selected=!availableRoleFunction.selected; - } /* $.ajax({ type : 'POST', @@ -106,7 +103,11 @@ app.controller('rolepopupController', function ($scope, role, roleId, confirmBo } }); */ - }); + }).catch(function(err) { + availableRoleFunction.selected=!availableRoleFunction.selected; + $log.error('roleListController::confirmBoxService.confirm error:', err); + + }); } else { //add role function @@ -127,10 +128,7 @@ app.controller('rolepopupController', function ($scope, role, roleId, confirmBo function(data) { confirmBoxService.showInformation("Error while saving."); }); - } else { - availableRoleFunction.selected=!availableRoleFunction.selected; - } - /* + } /* $.ajax({ type : 'POST', url : uuu, @@ -150,7 +148,10 @@ app.controller('rolepopupController', function ($scope, role, roleId, confirmBo function(){ availableRoleFunction.selected=!availableRoleFunction.selected; })*/ - }); + }).catch(function(err) { + availableRoleFunction.selected=!availableRoleFunction.selected; + $log.error('roleListController::confirmBoxService.confirm error:', err); + }); } @@ -180,10 +181,11 @@ app.controller('rolepopupController', function ($scope, role, roleId, confirmBo function(data) { confirmBoxService.showInformation("Error while saving."); }); - } else { - availableRole.selected=false; } - }); + }).catch(function(err) { + availableRole.selected=!availableRole.selected; + $log.error('roleListController::confirmBoxService.confirm error:', err); + }); /* $.ajax({ type : 'POST', url : uuu, @@ -219,8 +221,6 @@ app.controller('rolepopupController', function ($scope, role, roleId, confirmBo function(data) { confirmBoxService.showInformation("Error while saving."); }); - } else { - availableRole.selected=false; } /* $.ajax({ type : 'POST', @@ -236,7 +236,10 @@ app.controller('rolepopupController', function ($scope, role, roleId, confirmBo } });*/ - }); + }).catch(function(err) { + availableRole.selected=!availableRole.selected; + $log.error('roleListController::confirmBoxService.confirm error:', err); + }); } |