mirror of
https://github.com/ansible/awx.git
synced 2026-01-22 23:18:03 -03:30
Jobs page
Fix for https://trello.com/c/tWDz8Jd7/320-js-failure-when-attempting-to-delete-a-queued-job. Plus cleaned up the prompting around job delete. Job delete and cancel should behave the same except for the request method sent to the API. Also, removed 'On' from date titles to help keep the tiles from breaking as the viewport shrinks.
This commit is contained in:
parent
5bc8255d8f
commit
5a5398664a
@ -524,8 +524,9 @@ angular.module('Tower', [
|
||||
if ($rootScope.current_user === undefined || $rootScope.current_user === null) {
|
||||
Authorization.restoreUserInfo(); //user must have hit browser refresh
|
||||
}
|
||||
if (!/^\/(login|logout)/.test(next.$$route.originalPath)) {
|
||||
if (next && next.$$route && (!/^\/(login|logout)/.test(next.$$route.originalPath))) {
|
||||
// if not headed to /login or /logout, then check the license
|
||||
console.log(next);
|
||||
CheckLicense.test();
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,7 +31,11 @@ function JobsListController ($rootScope, $log, $scope, $compile, $routeParams, C
|
||||
job_socket.init();
|
||||
job_socket.on("status_changed", function(data) {
|
||||
if (api_complete) {
|
||||
console.log('here');
|
||||
console.log(data);
|
||||
processEvent(data);
|
||||
} else {
|
||||
console.log('api not completed!');
|
||||
}
|
||||
});
|
||||
schedule_socket = Socket({
|
||||
@ -45,7 +49,6 @@ function JobsListController ($rootScope, $log, $scope, $compile, $routeParams, C
|
||||
}
|
||||
});
|
||||
}
|
||||
openSockets();
|
||||
|
||||
$rootScope.checkSocketConnectionInterval = setInterval(function() {
|
||||
if (job_socket.checkStatus() === 'error' || checkCount > 2) {
|
||||
@ -65,6 +68,7 @@ function JobsListController ($rootScope, $log, $scope, $compile, $routeParams, C
|
||||
}, 3000);
|
||||
|
||||
function processEvent(event) {
|
||||
console.log(event);
|
||||
switch(event.status) {
|
||||
case 'running':
|
||||
running_scope.search('running_job');
|
||||
@ -81,7 +85,7 @@ function JobsListController ($rootScope, $log, $scope, $compile, $routeParams, C
|
||||
case 'canceled':
|
||||
completed_scope.search('completed_job');
|
||||
running_scope.search('running_job');
|
||||
break;
|
||||
queued_scope.search('queued_job');
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,6 +98,7 @@ function JobsListController ($rootScope, $log, $scope, $compile, $routeParams, C
|
||||
listCount++;
|
||||
if (listCount === 4) {
|
||||
api_complete = true;
|
||||
openSockets();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -466,6 +466,7 @@ function(Find, GetBasePath, Rest, Wait, ProcessErrors, Prompt, Alert){
|
||||
}
|
||||
})
|
||||
.error(function() {
|
||||
Wait('stop');
|
||||
$('#prompt-modal').modal('hide');
|
||||
// Ignore the error. The job most likely already finished.
|
||||
// ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url +
|
||||
@ -479,13 +480,15 @@ function(Find, GetBasePath, Rest, Wait, ProcessErrors, Prompt, Alert){
|
||||
scope.$emit(callback, action_label);
|
||||
}
|
||||
else {
|
||||
scope.refreshJobs();
|
||||
scope.search(scope.iterator);
|
||||
}
|
||||
})
|
||||
.error(function (data, status) {
|
||||
Wait('stop');
|
||||
$('#prompt-modal').modal('hide');
|
||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url +
|
||||
' failed. DELETE returned status: ' + status });
|
||||
// Ignore the error. The job most likely already finished.
|
||||
//ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url +
|
||||
// ' failed. DELETE returned status: ' + status });
|
||||
});
|
||||
}
|
||||
};
|
||||
@ -494,8 +497,8 @@ function(Find, GetBasePath, Rest, Wait, ProcessErrors, Prompt, Alert){
|
||||
scope.removeCancelNotAllowed();
|
||||
}
|
||||
scope.removeCancelNotAllowed = scope.$on('CancelNotAllowed', function() {
|
||||
Alert('Job Completed', 'The job completed. Click the <i class="fa fa-refresh fa-lg"></i> button to view ' +
|
||||
'the latest status.', 'alert-info');
|
||||
Wait('stop');
|
||||
Alert('Job Completed', 'The request to cancel the job could not be submitted. The job already completed.', 'alert-info');
|
||||
});
|
||||
|
||||
if (scope.removeCancelJob) {
|
||||
|
||||
@ -46,7 +46,7 @@ angular.module('CompletedJobsDefinition', [])
|
||||
]
|
||||
},
|
||||
finished: {
|
||||
label: 'Finished On',
|
||||
label: 'Finished',
|
||||
noLink: true,
|
||||
searchable: false,
|
||||
filter: "date:'MM/dd HH:mm:ss'",
|
||||
|
||||
@ -46,7 +46,7 @@ angular.module('JobsListDefinition', [])
|
||||
nosort: true
|
||||
},
|
||||
started: {
|
||||
label: 'Started On',
|
||||
label: 'Started',
|
||||
noLink: true,
|
||||
searchable: false,
|
||||
filter: "date:'MM/dd HH:mm:ss'",
|
||||
|
||||
@ -43,7 +43,7 @@ angular.module('QueuedJobsDefinition', [])
|
||||
nosort: true
|
||||
},
|
||||
created: {
|
||||
label: 'Created On',
|
||||
label: 'Created',
|
||||
noLink: true,
|
||||
searchable: false,
|
||||
filter: "date:'MM/dd HH:mm:ss'",
|
||||
|
||||
@ -43,7 +43,7 @@ angular.module('RunningJobsDefinition', [])
|
||||
nosort: true
|
||||
},
|
||||
started: {
|
||||
label: 'Started On',
|
||||
label: 'Started',
|
||||
noLink: true,
|
||||
searchable: false,
|
||||
filter: "date:'MM/dd HH:mm:ss'",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user