mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 18:51:06 -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:
@@ -119,10 +119,19 @@ function ListJobsController (
|
|||||||
for (let i = 0; i < vm.jobs.length; i++) {
|
for (let i = 0; i < vm.jobs.length; i++) {
|
||||||
if (vm.jobs[i].id === msg.unified_job_id) {
|
if (vm.jobs[i].id === msg.unified_job_id) {
|
||||||
// Update the job status.
|
// 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;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user