mirror of
https://github.com/ansible/awx.git
synced 2026-01-17 20:51:21 -03:30
Job detail page refactor
Cleaning up end of job processing to make sure we only reload things 1x at the end. Now drawing graph each time DOM is updated.
This commit is contained in:
parent
44da2f5cf8
commit
0f435eb42c
@ -80,10 +80,10 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
||||
if (parseInt(data.unified_job_id, 10) === parseInt(job_id,10)) {
|
||||
if (data.status === 'failed' || data.status === 'canceled' ||
|
||||
data.status === 'error' || data.status === 'successful') {
|
||||
$log.debug('Job completed!');
|
||||
$log.debug(scope.jobData);
|
||||
window.clearInterval($rootScope.jobDetailInterval);
|
||||
UpdateDOM({ scope: scope });
|
||||
if ($rootScope.jobDetailInterval) {
|
||||
window.clearInterval($rootScope.jobDetailInterval);
|
||||
}
|
||||
$scope.$emit('LoadJob');
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -96,7 +96,6 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
||||
var url;
|
||||
Wait('stop');
|
||||
if (JobIsFinished(scope)) {
|
||||
UpdateDOM({ scope: scope });
|
||||
url = scope.job.related.job_events + '?event=playbook_on_stats';
|
||||
Rest.setUrl(url);
|
||||
Rest.get()
|
||||
@ -106,7 +105,7 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
||||
scope: scope,
|
||||
data: data.results[0].event_data
|
||||
});
|
||||
DrawGraph({ scope: scope, resize: true });
|
||||
UpdateDOM({ scope: scope });
|
||||
}
|
||||
})
|
||||
.error(function(data, status) {
|
||||
@ -114,13 +113,10 @@ function JobDetailController ($rootScope, $scope, $compile, $routeParams, $log,
|
||||
msg: 'Call to ' + url + '. GET returned: ' + status });
|
||||
});
|
||||
|
||||
$log.debug('Job completed!');
|
||||
$log.debug(scope.jobData);
|
||||
}
|
||||
else {
|
||||
if (scope.host_summary.total > 0) {
|
||||
// Draw the graph based on summary values in memory
|
||||
DrawGraph({ scope: scope, resize: true });
|
||||
}
|
||||
api_complete = true; //trigger events to start processing
|
||||
|
||||
$rootScope.jobDetailInterval = setInterval(function() {
|
||||
|
||||
@ -189,7 +189,8 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
||||
});
|
||||
break;
|
||||
|
||||
case 'playbook_on_stats':
|
||||
// We will respond to the job status change event. No need to do this 2x.
|
||||
/*case 'playbook_on_stats':
|
||||
scope.job_status.finished = event.modified;
|
||||
scope.job_status.elapsed = GetElapsed({
|
||||
start: scope.job_status.started,
|
||||
@ -199,7 +200,7 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
||||
scope.job_status.status_class = "";
|
||||
//LoadHostSummary({ scope: scope, data: event.event_data });
|
||||
//DrawGraph({ scope: scope, resize: true });
|
||||
break;
|
||||
break;*/
|
||||
}
|
||||
};
|
||||
}])
|
||||
@ -999,13 +1000,17 @@ function($rootScope, $log, UpdatePlayStatus, UpdateHostStatus, AddHostResult, Ge
|
||||
};
|
||||
}])
|
||||
|
||||
.factory('UpdateDOM', ['DrawPlays', 'DrawTasks', 'DrawHostResults', function(DrawPlays, DrawTasks, DrawHostResults) {
|
||||
.factory('UpdateDOM', ['DrawPlays', 'DrawTasks', 'DrawHostResults', 'DrawGraph', function(DrawPlays, DrawTasks, DrawHostResults, DrawGraph) {
|
||||
return function(params) {
|
||||
var scope = params.scope;
|
||||
|
||||
DrawPlays({ scope: scope });
|
||||
DrawTasks({ scope: scope });
|
||||
DrawHostResults({ scope: scope });
|
||||
|
||||
if (scope.host_summary.total > 0) {
|
||||
DrawGraph({ scope: scope, resize: true });
|
||||
}
|
||||
};
|
||||
}])
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user