diff --git a/awx/ui/client/lib/components/approvalsDrawer/approvalsDrawer.directive.js b/awx/ui/client/lib/components/approvalsDrawer/approvalsDrawer.directive.js index b215f95620..47443c524e 100644 --- a/awx/ui/client/lib/components/approvalsDrawer/approvalsDrawer.directive.js +++ b/awx/ui/client/lib/components/approvalsDrawer/approvalsDrawer.directive.js @@ -18,7 +18,6 @@ function AtApprovalsDrawerController (strings, Rest, GetBasePath, $rootScope) { }; vm.emptyListReason = vm.strings.get('approvals.NONE'); - // This will probably need to be expanded vm.toolbarSortOptions = [ toolbarSortDefault, { label: `${vm.strings.get('sort.CREATED_DESCENDING')}`, value: '-created' } diff --git a/awx/ui/client/src/login/authenticationServices/authentication.service.js b/awx/ui/client/src/login/authenticationServices/authentication.service.js index 241f531aef..e57ffa18f6 100644 --- a/awx/ui/client/src/login/authenticationServices/authentication.service.js +++ b/awx/ui/client/src/login/authenticationServices/authentication.service.js @@ -112,6 +112,7 @@ export default $rootScope.login_username = null; $rootScope.login_password = null; $rootScope.userLoggedOut = true; + $rootScope.pendingApprovalCount = 0; if ($rootScope.sessionTimer) { $rootScope.sessionTimer.clearTimers(); } diff --git a/awx/ui/client/src/login/authenticationServices/timer.factory.js b/awx/ui/client/src/login/authenticationServices/timer.factory.js index 6f36a1ce5d..a5678b51e4 100644 --- a/awx/ui/client/src/login/authenticationServices/timer.factory.js +++ b/awx/ui/client/src/login/authenticationServices/timer.factory.js @@ -32,7 +32,7 @@ export default timeout: null, getSessionTime: function () { - if(Store('sessionTime')){ + if(Store('sessionTime') && Store('sessionTime')[$rootScope.current_user.id]){ return Store('sessionTime')[$rootScope.current_user.id].time; } else { diff --git a/awx/ui/client/src/login/loginModal/loginModal.controller.js b/awx/ui/client/src/login/loginModal/loginModal.controller.js index f47f3a70a8..6ce18559f6 100644 --- a/awx/ui/client/src/login/loginModal/loginModal.controller.js +++ b/awx/ui/client/src/login/loginModal/loginModal.controller.js @@ -132,6 +132,18 @@ export default ['$log', '$cookies', '$rootScope', 'ProcessErrors', $rootScope.user_is_system_auditor = data.results[0].is_system_auditor; scope.$emit('AuthorizationGetLicense'); }); + + Rest.setUrl(`${GetBasePath('workflow_approvals')}?status=pending&page_size=1`); + Rest.get() + .then(({data}) => { + $rootScope.pendingApprovalCount = data.count; + }) + .catch(({data, status}) => { + ProcessErrors({}, data, status, null, { + hdr: i18n._('Error!'), + msg: i18n._('Failed to get workflow jobs pending approval. GET returned status: ') + status + }); + }); }) .catch(({data, status}) => { Authorization.logout().then( () => { @@ -139,18 +151,6 @@ export default ['$log', '$cookies', '$rootScope', 'ProcessErrors', Alert('Error', 'Failed to access user information. GET returned status: ' + status, 'alert-danger', loginAgain); }); }); - - Rest.setUrl(`${GetBasePath('workflow_approvals')}?status=pending&page_size=1`); - Rest.get() - .then(({data}) => { - $rootScope.pendingApprovalCount = data.count; - }) - .catch(({data, status}) => { - ProcessErrors({}, data, status, null, { - hdr: i18n._('Error!'), - msg: i18n._('Failed to get workflow jobs pending approval. GET returned status: ') + status - }); - }); }); // Call the API to get an auth token