Skip to content

Commit

Permalink
Merge pull request #2566 from headlamp-k8s/sort-duration-fix
Browse files Browse the repository at this point in the history
frontend: Job: Add sort function for job durations
  • Loading branch information
sniok authored Nov 22, 2024
2 parents fe20e5d + 7da4469 commit 8ff79cf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions frontend/src/components/job/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,13 @@ export function JobsListRenderer(props: JobsListRendererProps) {
id: 'duration',
label: t('translation|Duration'),
getValue: job => {
const startTime = job.status?.startTime;
const completionTime = job.status?.completionTime;
if (!!startTime && !!completionTime) {
const duration = new Date(completionTime).getTime() - new Date(startTime).getTime();
const duration = job.getDuration();
if (duration > 0) {
return formatDuration(duration, { format: 'mini' });
}
return '-';
},
sort: (job1, job2) => job1.getDuration() - job2.getDuration(),
gridTemplate: 0.6,
},
{
Expand Down

0 comments on commit 8ff79cf

Please sign in to comment.