Skip to content

Commit

Permalink
jobs: Add a column with end time/duration
Browse files Browse the repository at this point in the history
fixes #813

If the job is completed or has failed, the column displays the end time
and the total duration of the task.
  • Loading branch information
tahini committed Dec 18, 2023
1 parent 4c8cc20 commit 2fe34d3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions locales/en/transit.json
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@
},
"jobs": {
"Date": "Date",
"EndTime": "End/Duration",
"Status": "Status",
"JobType": "Name",
"Data": "Parameters",
Expand Down
1 change: 1 addition & 0 deletions locales/fr/transit.json
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@
},
"jobs": {
"Date": "Date",
"EndTime": "Fin/Durée",
"Status": "Status",
"JobType": "Nom",
"Data": "Paramètres",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import Button from '../Button';
import ButtonList from '../ButtonList';
import ButtonCell, { ButtonCellWithConfirm } from '../ButtonCell';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { toXXhrYYminZZsec } from 'chaire-lib-common/lib/utils/DateTimeUtils';

interface ExecutableJobComponentProps {
jobType?: string;
Expand Down Expand Up @@ -135,6 +136,20 @@ const ExecutableJobComponent: React.FunctionComponent<ExecutableJobComponentProp
width: 100,
Cell: (props) => moment(props.value).format('YYYY-MM-DD hh:mm')
},
{
Header: props.t('transit:jobs:EndTime'),
accessor: 'updated_at',
width: 100,
Cell: (cellProps) =>
cellProps.row.original.status === 'completed' || cellProps.row.original.status === 'failed'
? `${moment(cellProps.value).format('YYYY-MM-DD hh:mm')} (${toXXhrYYminZZsec(
moment(cellProps.value).diff(moment(cellProps.row.original.created_at), 'seconds'),
props.t('main:hourAbbr'),
props.t('main:minuteAbbr'),
props.t('main:secondAbbr')
)})`
: null
},
{
Header: props.t('transit:jobs:Status'),
accessor: 'status',
Expand Down

0 comments on commit 2fe34d3

Please sign in to comment.