mirror of
https://github.com/ansible/awx.git
synced 2026-02-22 21:46:00 -03:30
added relaunch capability and end time of running job
This commit is contained in:
committed by
jaredevantabor
parent
3ade961e92
commit
bba253cdfc
@@ -85,7 +85,8 @@ export default ['jobResultsService', '$q', function(jobResultsService, $q){
|
||||
failures: 0,
|
||||
changed: 0
|
||||
};
|
||||
mungedEvent.changes = ['count'];
|
||||
mungedEvent.startTime = event.modified;
|
||||
mungedEvent.changes = ['count', 'startTime'];
|
||||
} else if (event.event_name === 'playbook_on_play_start') {
|
||||
getPreviousCount(mungedEvent.counter, "play")
|
||||
.then(count => {
|
||||
@@ -129,10 +130,12 @@ export default ['jobResultsService', '$q', function(jobResultsService, $q){
|
||||
mungedEvent.changes = ['count'];
|
||||
});
|
||||
} else if (event.event_name === 'playbook_on_stats') {
|
||||
console.log(event.modified);
|
||||
// get the data for populating the host status bar
|
||||
mungedEvent.count = jobResultsService
|
||||
.getCountsFromStatsEvent(event.event_data);
|
||||
mungedEvent.changes = ['count', 'countFinished'];
|
||||
mungedEvent.finishedTime = event.modified;
|
||||
mungedEvent.changes = ['count', 'countFinished', 'finishedTime'];
|
||||
} else {
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,10 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'count', '$scope', 'Pa
|
||||
jobResultsService.cancelJob($scope.job);
|
||||
};
|
||||
|
||||
$scope.relaunchJob = function() {
|
||||
jobResultsService.relaunchJob($scope);
|
||||
};
|
||||
|
||||
// get initial count from resolve
|
||||
$scope.count = count.val;
|
||||
$scope.hostCount = getTotalHostCount(count.val);
|
||||
@@ -93,6 +97,10 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'count', '$scope', 'Pa
|
||||
mungedEvent.changes.forEach(change => {
|
||||
// we've got a change we need to make to the UI!
|
||||
// update the necessary scope and make the change
|
||||
if (change === 'startTime' && !$scope.job.start) {
|
||||
$scope.job.start = mungedEvent.startTime;
|
||||
}
|
||||
|
||||
if (change === 'count' && !$scope.countFinished) {
|
||||
// for all events that affect the host count,
|
||||
// update the status bar as well as the host
|
||||
@@ -110,6 +118,10 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'count', '$scope', 'Pa
|
||||
$scope.taskCount = mungedEvent.taskCount;
|
||||
}
|
||||
|
||||
if (change === 'finishedTime' && !$scope.job.finished) {
|
||||
$scope.job.finished = mungedEvent.finishedTime;
|
||||
}
|
||||
|
||||
if (change === 'countFinished') {
|
||||
// the playbook_on_stats event actually lets
|
||||
// us know that we don't need to iteratively
|
||||
@@ -143,7 +155,7 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'count', '$scope', 'Pa
|
||||
};
|
||||
getEvents($scope.job.related.job_events);
|
||||
|
||||
// Processing of job_events messages from the websocket
|
||||
// Processing of job_events messages from the websocket
|
||||
$scope.$on(`ws-job_events-${$scope.job.id}`, function(e, data) {
|
||||
processEvent(data);
|
||||
});
|
||||
@@ -154,15 +166,4 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'count', '$scope', 'Pa
|
||||
$scope.job.status = data.status;
|
||||
}
|
||||
});
|
||||
|
||||
// The code below was used in the old job detail controller,
|
||||
// and is for processing the 'Job Summary' event that is delivered
|
||||
// for a completed job. Not sure if we have an equivalent function
|
||||
// at this point. TODO: write function to handle Job Summary
|
||||
// scope.$on('ws-jobs-summary', function() {
|
||||
// // the job host summary should now be available from the API
|
||||
// $log.debug('Trigging reload of job_host_summaries');
|
||||
// scope.$emit('InitialLoadComplete');
|
||||
// });
|
||||
|
||||
}];
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*************************************************/
|
||||
|
||||
|
||||
export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErrors', function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors) {
|
||||
export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErrors', 'InitiatePlaybookRun', function ($q, Prompt, $filter, Wait, Rest, $state, ProcessErrors, InitiatePlaybookRun) {
|
||||
var val = {
|
||||
// the playbook_on_stats event returns the count data in a weird format.
|
||||
// format to what we need!
|
||||
@@ -185,6 +185,10 @@ export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErr
|
||||
},
|
||||
actionText: 'CANCEL'
|
||||
});
|
||||
},
|
||||
relaunchJob: function(scope) {
|
||||
InitiatePlaybookRun({ scope: scope, id: scope.job.id,
|
||||
relaunch: true });
|
||||
}
|
||||
};
|
||||
return val;
|
||||
|
||||
Reference in New Issue
Block a user