From b75f35b0a1824aab32b4329fa62076b0f0307853 Mon Sep 17 00:00:00 2001 From: "Kotta, Shireesha (sk434m)" Date: Thu, 13 Jun 2019 14:41:15 -0400 Subject: Application Onboarding page changes Issue-ID: PORTAL-644 Application Onboarding page changes , DB scripts Change-Id: Id689e15f5abd56192420e6761440659531108ab4 Signed-off-by: Kotta, Shireesha (sk434m) --- .../services/applications/applications.service.js | 26 +++++++++++++++- .../client/app/services/users/users.service.js | 4 +-- .../client/app/views/role/role-controller.js | 2 ++ .../client/app/views/role/role-list-controller.js | 7 ++++- .../app/views/role/rolefunctionpopupController.js | 4 +-- .../users/new-user-dialogs/bulk-user.controller.js | 2 +- .../users/new-user-dialogs/new-user.controller.js | 29 +++++++++++++++-- .../users/new-user-dialogs/new-user.modal.html | 36 +++++++++++++++++----- 8 files changed, 93 insertions(+), 17 deletions(-) (limited to 'ecomp-portal-FE-common/client/app') diff --git a/ecomp-portal-FE-common/client/app/services/applications/applications.service.js b/ecomp-portal-FE-common/client/app/services/applications/applications.service.js index c595c71a..e2e7c5fe 100644 --- a/ecomp-portal-FE-common/client/app/services/applications/applications.service.js +++ b/ecomp-portal-FE-common/client/app/services/applications/applications.service.js @@ -154,7 +154,31 @@ return deferred.promise; } - + checkIfUserIsSuperAdmin() { + let deferred = this.$q.defer(); + var _this0 = this; + // this.$log.info('ApplicationsService::getPersUserApps'); + this.$http.get(this.conf.api.checkIfUserIsSuperAdmin, + { + cache: false, + headers: { + 'X-ECOMP-RequestID':this.uuid.generate() + } + }) + .then( res => { + // If response comes back as a redirected HTML page which IS NOT a success + // But don't declare an empty list to be an error. + if (res == null || res.data == null) { + deferred.reject("ApplicationsService::checkIfUserIsSuperAdmin Failed"); + } else { + deferred.resolve(res.data); + } + }) + .catch( status => { + deferred.reject(status); + }); + return deferred.promise; + } saveAppsSortTypeManual(appsSortManual){ let deferred = this.$q.defer(); if (appsSortManual== undefined diff --git a/ecomp-portal-FE-common/client/app/services/users/users.service.js b/ecomp-portal-FE-common/client/app/services/users/users.service.js index 9e062713..045c674b 100644 --- a/ecomp-portal-FE-common/client/app/services/users/users.service.js +++ b/ecomp-portal-FE-common/client/app/services/users/users.service.js @@ -131,7 +131,7 @@ return deferred.promise; } - getUserAppRoles(appid, orgUserId, extRequestValue){ + getUserAppRoles(appid, orgUserId, extRequestValue,isSystemUser){ let canceller = this.$q.defer(); let isActive = false; @@ -148,7 +148,7 @@ this.$http({ method: 'GET', url: this.conf.api.userAppRoles, - params: {user: orgUserId, app: appid, externalRequest: extRequestValue}, + params: {user: orgUserId, app: appid, externalRequest: extRequestValue,isSystemUser: isSystemUser}, cache: false, headers: { 'X-ECOMP-RequestID':this.uuid.generate() 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 f55d1e0e..7be5118a 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 @@ -114,6 +114,8 @@ app.controller('roleController', function ($scope, $http, confirmBoxService, ngD } if (exists) { confirmBoxService.showInformation( "Role already exists."); + } else if($scope.role.name.toLowerCase() == "admin"){ + confirmBoxService.showInformation( "Role '"+$scope.role.name+"' is not acceptable."); } else { var uuu = conf.api.saveRole + "?role_id="+$stateParams.roleId; 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 6f280313..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 @@ -219,11 +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); @@ -253,6 +255,7 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS }); },function(error){ $log.debug('Failed to editRole'); + $scope.showSpinner = false; }); } @@ -260,9 +263,11 @@ app.controller('roleListController', function ($scope,RoleService, applicationsS // add Role $scope.addRoleModalPopup = function(appId) { + $scope.showSpinner = true; if(appId){ 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); 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 bda90af9..5cfb6c5a 100644 --- a/ecomp-portal-FE-common/client/app/views/role/rolefunctionpopupController.js +++ b/ecomp-portal-FE-common/client/app/views/role/rolefunctionpopupController.js @@ -98,10 +98,10 @@ app.controller('rolefunctionpopupController',function($scope, confirmBoxService, confirmBoxService.showInformation('Instance can only contain alphanumeric characters, hyphens(-), dots(.), colons(:), forwardSlash(/) , asterisk(*) and underscores(_)').then(isConfirmed => {}); return; } - if(/[^a-zA-Z0-9\-\_ \.]/.test(availableRoleFunction.name)){ +/* if(/[^a-zA-Z0-9\-\_ \.]/.test(availableRoleFunction.name)){ confirmBoxService.showInformation('Name can only contain alphanumeric characters, spaces, hyphens(-), dots(.) and underscores(_)').then(isConfirmed => {}); return; - } + }*/ confirmBoxService.confirm( "You are about to Create the role function "+ availableRoleFunction.name+ ". Do you want to continue?") .then(function(confirmed) { diff --git a/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.controller.js b/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.controller.js index 718879a0..ae3907b2 100644 --- a/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.controller.js +++ b/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/bulk-user.controller.js @@ -377,7 +377,7 @@ if (prevRow == null || prevRow.orgUserId.toLowerCase() !== uploadRow.orgUserId.toLowerCase()) { if (debug) $log.debug('BulkUserModalCtrl::buildAppRoleChecks: create request for orgUserId ' + uploadRow.orgUserId); - let appPromise = usersService.getUserAppRoles(appId, uploadRow.orgUserId,true).promise().then( (userAppRolesResult) => { + let appPromise = usersService.getUserAppRoles(appId, uploadRow.orgUserId,true, false).promise().then( (userAppRolesResult) => { // Reply for unknown user has all defined roles with isApplied=false on each. if (typeof userAppRolesResult[0] !== "undefined") { if (debug) diff --git a/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/new-user.controller.js b/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/new-user.controller.js index 512c3a0c..3df58daa 100644 --- a/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/new-user.controller.js +++ b/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/new-user.controller.js @@ -43,6 +43,18 @@ class NewUserModalCtrl { constructor($scope, $log, usersService, applicationsService, confirmBoxService, items) { var extRequestValue = false; + var isSystemUser = false; + + $scope.ngRepeatDemo = [ + {id: 'userButton', value: 'true', labelvalue: 'user'}, + {id: 'systemUserButton', value: 'false', labelvalue: 'system'} + ] + + $scope.selectedvalueradioButtonGroup = { + type: 'true' + } + + let init = () => { //$log.info('NewUserModalCtrl::init'); this.isSaving = false; @@ -94,7 +106,7 @@ this.dialogState = 1; return; } - //$log.debug('NewUserModalCtrl::getUserAppsRoles: about to call getAdminAppsSimpler'); + $log.debug('NewUserModalCtrl::getUserAppsRoles: about to call getAdminAppsSimpler'); this.isGettingAdminApps = true; applicationsService.getAdminAppsSimpler().then((apps) => { //$log.debug('NewUserModalCtrl::getUserAppsRoles: beginning of then for getAdminAppsSimpler'); @@ -123,7 +135,11 @@ app.isErrorUpdating = false; app.isDoneUpdating = false; app.errorMessage = ""; - usersService.getUserAppRoles(app.id, this.selectedUser.orgUserId, extRequestValue).promise().then((userAppRolesResult) => { + if($scope.selectedvalueradioButtonGroup.type == 'false') + { + isSystemUser = true; + } + usersService.getUserAppRoles(app.id, this.selectedUser.orgUserId, extRequestValue,isSystemUser).promise().then((userAppRolesResult) => { //$log.debug('NewUserModalCtrl::getUserAppsRoles: got a result for app: ',app.id,': ',app.name,': ',userAppRolesResult); app.appRoles = userAppRolesResult; app.isLoading = false; @@ -179,11 +195,18 @@ } } + if($scope.selectedvalueradioButtonGroup.type == 'false') + { + isSystemUser = true; + }else{ + isSystemUser = false; + } var newUserAppRoles = { orgUserId: this.selectedUser.orgUserId, appId: app.id, appRoles: app.appRoles, - appName: app.name + appName: app.name, + isSystemUser : isSystemUser }; usersService.updateUserAppRoles(newUserAppRoles).promise() .then(res => { diff --git a/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/new-user.modal.html b/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/new-user.modal.html index a68cd55c..dc93006e 100644 --- a/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/new-user.modal.html +++ b/ecomp-portal-FE-common/client/app/views/users/new-user-dialogs/new-user.modal.html @@ -55,22 +55,44 @@

New User

- +
- -
+ + +
Enter system UserId
+
+ +
+
-
- +
-
+