mirror of
https://github.com/ansible/awx.git
synced 2026-03-24 04:15:02 -02:30
error handling in Job Detail page
a JS error can get thrown if the user navigates to the job detail page as a job is ending
This commit is contained in:
@@ -202,41 +202,44 @@ function JobDetailController ($location, $rootScope, $scope, $compile, $routePar
|
|||||||
scope.removeLoadHostSummaries();
|
scope.removeLoadHostSummaries();
|
||||||
}
|
}
|
||||||
scope.removeHostSummaries = scope.$on('LoadHostSummaries', function() {
|
scope.removeHostSummaries = scope.$on('LoadHostSummaries', function() {
|
||||||
var url = scope.job.related.job_host_summaries + '?';
|
if(scope.job.related.job_host_summaries){
|
||||||
url += '&page_size=' + scope.hostSummariesMaxRows + '&order=host_name';
|
var url = scope.job.related.job_host_summaries + '?';
|
||||||
|
url += '&page_size=' + scope.hostSummariesMaxRows + '&order=host_name';
|
||||||
|
|
||||||
Rest.setUrl(url);
|
Rest.setUrl(url);
|
||||||
Rest.get()
|
Rest.get()
|
||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
scope.next_host_summaries = data.next;
|
scope.next_host_summaries = data.next;
|
||||||
if (data.results.length > 0) {
|
if (data.results.length > 0) {
|
||||||
// only dump what's in memory when job_host_summaries is available.
|
// only dump what's in memory when job_host_summaries is available.
|
||||||
scope.jobData.hostSummaries = {};
|
scope.jobData.hostSummaries = {};
|
||||||
}
|
|
||||||
data.results.forEach(function(event) {
|
|
||||||
var name;
|
|
||||||
if (event.host_name) {
|
|
||||||
name = event.host_name;
|
|
||||||
}
|
}
|
||||||
else {
|
data.results.forEach(function(event) {
|
||||||
name = "<deleted host>";
|
var name;
|
||||||
}
|
if (event.host_name) {
|
||||||
scope.jobData.hostSummaries[name] = {
|
name = event.host_name;
|
||||||
id: event.host,
|
}
|
||||||
name: name,
|
else {
|
||||||
ok: event.ok,
|
name = "<deleted host>";
|
||||||
changed: event.changed,
|
}
|
||||||
unreachable: event.dark,
|
scope.jobData.hostSummaries[name] = {
|
||||||
failed: event.failures,
|
id: event.host,
|
||||||
status: (event.failed) ? 'failed' : 'successful'
|
name: name,
|
||||||
};
|
ok: event.ok,
|
||||||
|
changed: event.changed,
|
||||||
|
unreachable: event.dark,
|
||||||
|
failed: event.failures,
|
||||||
|
status: (event.failed) ? 'failed' : 'successful'
|
||||||
|
};
|
||||||
|
});
|
||||||
|
scope.$emit('InitialLoadComplete');
|
||||||
|
})
|
||||||
|
.error(function(data, status) {
|
||||||
|
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
||||||
|
msg: 'Call to ' + url + '. GET returned: ' + status });
|
||||||
});
|
});
|
||||||
scope.$emit('InitialLoadComplete');
|
}
|
||||||
})
|
|
||||||
.error(function(data, status) {
|
|
||||||
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
|
|
||||||
msg: 'Call to ' + url + '. GET returned: ' + status });
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (scope.removeLoadHosts) {
|
if (scope.removeLoadHosts) {
|
||||||
|
|||||||
Reference in New Issue
Block a user