mirror of
https://github.com/ansible/awx.git
synced 2026-05-23 00:37:37 -02: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,
|
failures: 0,
|
||||||
changed: 0
|
changed: 0
|
||||||
};
|
};
|
||||||
mungedEvent.changes = ['count'];
|
mungedEvent.startTime = event.modified;
|
||||||
|
mungedEvent.changes = ['count', 'startTime'];
|
||||||
} else if (event.event_name === 'playbook_on_play_start') {
|
} else if (event.event_name === 'playbook_on_play_start') {
|
||||||
getPreviousCount(mungedEvent.counter, "play")
|
getPreviousCount(mungedEvent.counter, "play")
|
||||||
.then(count => {
|
.then(count => {
|
||||||
@@ -129,10 +130,12 @@ export default ['jobResultsService', '$q', function(jobResultsService, $q){
|
|||||||
mungedEvent.changes = ['count'];
|
mungedEvent.changes = ['count'];
|
||||||
});
|
});
|
||||||
} else if (event.event_name === 'playbook_on_stats') {
|
} else if (event.event_name === 'playbook_on_stats') {
|
||||||
|
console.log(event.modified);
|
||||||
// get the data for populating the host status bar
|
// get the data for populating the host status bar
|
||||||
mungedEvent.count = jobResultsService
|
mungedEvent.count = jobResultsService
|
||||||
.getCountsFromStatsEvent(event.event_data);
|
.getCountsFromStatsEvent(event.event_data);
|
||||||
mungedEvent.changes = ['count', 'countFinished'];
|
mungedEvent.finishedTime = event.modified;
|
||||||
|
mungedEvent.changes = ['count', 'countFinished', 'finishedTime'];
|
||||||
} else {
|
} else {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,10 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'count', '$scope', 'Pa
|
|||||||
jobResultsService.cancelJob($scope.job);
|
jobResultsService.cancelJob($scope.job);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.relaunchJob = function() {
|
||||||
|
jobResultsService.relaunchJob($scope);
|
||||||
|
};
|
||||||
|
|
||||||
// get initial count from resolve
|
// get initial count from resolve
|
||||||
$scope.count = count.val;
|
$scope.count = count.val;
|
||||||
$scope.hostCount = getTotalHostCount(count.val);
|
$scope.hostCount = getTotalHostCount(count.val);
|
||||||
@@ -93,6 +97,10 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'count', '$scope', 'Pa
|
|||||||
mungedEvent.changes.forEach(change => {
|
mungedEvent.changes.forEach(change => {
|
||||||
// we've got a change we need to make to the UI!
|
// we've got a change we need to make to the UI!
|
||||||
// update the necessary scope and make the change
|
// update the necessary scope and make the change
|
||||||
|
if (change === 'startTime' && !$scope.job.start) {
|
||||||
|
$scope.job.start = mungedEvent.startTime;
|
||||||
|
}
|
||||||
|
|
||||||
if (change === 'count' && !$scope.countFinished) {
|
if (change === 'count' && !$scope.countFinished) {
|
||||||
// for all events that affect the host count,
|
// for all events that affect the host count,
|
||||||
// update the status bar as well as the host
|
// 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;
|
$scope.taskCount = mungedEvent.taskCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (change === 'finishedTime' && !$scope.job.finished) {
|
||||||
|
$scope.job.finished = mungedEvent.finishedTime;
|
||||||
|
}
|
||||||
|
|
||||||
if (change === 'countFinished') {
|
if (change === 'countFinished') {
|
||||||
// the playbook_on_stats event actually lets
|
// the playbook_on_stats event actually lets
|
||||||
// us know that we don't need to iteratively
|
// 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);
|
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) {
|
$scope.$on(`ws-job_events-${$scope.job.id}`, function(e, data) {
|
||||||
processEvent(data);
|
processEvent(data);
|
||||||
});
|
});
|
||||||
@@ -154,15 +166,4 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'count', '$scope', 'Pa
|
|||||||
$scope.job.status = data.status;
|
$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 = {
|
var val = {
|
||||||
// the playbook_on_stats event returns the count data in a weird format.
|
// the playbook_on_stats event returns the count data in a weird format.
|
||||||
// format to what we need!
|
// format to what we need!
|
||||||
@@ -185,6 +185,10 @@ export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErr
|
|||||||
},
|
},
|
||||||
actionText: 'CANCEL'
|
actionText: 'CANCEL'
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
relaunchJob: function(scope) {
|
||||||
|
InitiatePlaybookRun({ scope: scope, id: scope.job.id,
|
||||||
|
relaunch: true });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return val;
|
return val;
|
||||||
|
|||||||
Reference in New Issue
Block a user