mirror of
https://github.com/ansible/awx.git
synced 2026-05-09 02:17:37 -02:30
Fix loading pending approval count on login
This commit is contained in:
@@ -18,7 +18,6 @@ function AtApprovalsDrawerController (strings, Rest, GetBasePath, $rootScope) {
|
|||||||
};
|
};
|
||||||
vm.emptyListReason = vm.strings.get('approvals.NONE');
|
vm.emptyListReason = vm.strings.get('approvals.NONE');
|
||||||
|
|
||||||
// This will probably need to be expanded
|
|
||||||
vm.toolbarSortOptions = [
|
vm.toolbarSortOptions = [
|
||||||
toolbarSortDefault,
|
toolbarSortDefault,
|
||||||
{ label: `${vm.strings.get('sort.CREATED_DESCENDING')}`, value: '-created' }
|
{ label: `${vm.strings.get('sort.CREATED_DESCENDING')}`, value: '-created' }
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ export default
|
|||||||
$rootScope.login_username = null;
|
$rootScope.login_username = null;
|
||||||
$rootScope.login_password = null;
|
$rootScope.login_password = null;
|
||||||
$rootScope.userLoggedOut = true;
|
$rootScope.userLoggedOut = true;
|
||||||
|
$rootScope.pendingApprovalCount = 0;
|
||||||
if ($rootScope.sessionTimer) {
|
if ($rootScope.sessionTimer) {
|
||||||
$rootScope.sessionTimer.clearTimers();
|
$rootScope.sessionTimer.clearTimers();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default
|
|||||||
timeout: null,
|
timeout: null,
|
||||||
|
|
||||||
getSessionTime: function () {
|
getSessionTime: function () {
|
||||||
if(Store('sessionTime')){
|
if(Store('sessionTime') && Store('sessionTime')[$rootScope.current_user.id]){
|
||||||
return Store('sessionTime')[$rootScope.current_user.id].time;
|
return Store('sessionTime')[$rootScope.current_user.id].time;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -132,6 +132,18 @@ export default ['$log', '$cookies', '$rootScope', 'ProcessErrors',
|
|||||||
$rootScope.user_is_system_auditor = data.results[0].is_system_auditor;
|
$rootScope.user_is_system_auditor = data.results[0].is_system_auditor;
|
||||||
scope.$emit('AuthorizationGetLicense');
|
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}) => {
|
.catch(({data, status}) => {
|
||||||
Authorization.logout().then( () => {
|
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);
|
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
|
// Call the API to get an auth token
|
||||||
|
|||||||
Reference in New Issue
Block a user