On jobs table, sort idle jobs by last updated so recent active ones are at the top
This commit is contained in:
@@ -111,12 +111,18 @@ export default function JobsTable({ onlyActive = false }: JobsTableProps) {
|
|||||||
});
|
});
|
||||||
// sort the queued/running jobs by queue position
|
// sort the queued/running jobs by queue position
|
||||||
Object.keys(jd).forEach(key => {
|
Object.keys(jd).forEach(key => {
|
||||||
if (key === 'Idle') return;
|
if (key === 'Idle') {
|
||||||
jd[key].jobs.sort((a, b) => {
|
jd[key].jobs.sort((a, b) => {
|
||||||
if (a.queue_position === null) return 1;
|
// sort by updated_at, newest first
|
||||||
if (b.queue_position === null) return -1;
|
return new Date(b.updated_at).getTime() - new Date(a.updated_at).getTime();
|
||||||
return a.queue_position - b.queue_position;
|
});
|
||||||
});
|
} else {
|
||||||
|
jd[key].jobs.sort((a, b) => {
|
||||||
|
if (a.queue_position === null) return 1;
|
||||||
|
if (b.queue_position === null) return -1;
|
||||||
|
return a.queue_position - b.queue_position;
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
return jd;
|
return jd;
|
||||||
}, [jobs, queues, isGPUInfoLoaded]);
|
}, [jobs, queues, isGPUInfoLoaded]);
|
||||||
|
|||||||
Reference in New Issue
Block a user