mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 20:30:46 -03:30
Consume finished timestamp from websocket message and update the relevant job row. Also adds logic to attempt to re-order the list when the sort order is -finished since we have enough information client-side to do that.
This commit is contained in:
parent
3234f246db
commit
db43341f96
@ -119,10 +119,19 @@ function ListJobsController (
|
||||
for (let i = 0; i < vm.jobs.length; i++) {
|
||||
if (vm.jobs[i].id === msg.unified_job_id) {
|
||||
// Update the job status.
|
||||
// If/when we get more info in the message we can
|
||||
// update those fields here as well.
|
||||
vm.jobs[i].status = msg.status;
|
||||
i = vm.jobs.length;
|
||||
if (msg.finished) {
|
||||
vm.jobs[i].finished = msg.finished;
|
||||
const orderByValue = _.get($state.params, 'job_search.order_by');
|
||||
if (orderByValue === '-finished') {
|
||||
// Attempt to sort the rows in the list by their finish
|
||||
// timestamp in descending order
|
||||
vm.jobs.sort((a, b) =>
|
||||
(!b.finished) - (!a.finished)
|
||||
|| new Date(b.finished) - new Date(a.finished));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user