Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { useGetRunQuery } from 'services/run';

import {
getJobError,
getJobFinishedAt,
getJobListItemBackend,
getJobListItemInstance,
getJobListItemPrice,
Expand Down Expand Up @@ -59,6 +60,11 @@ export const JobDetails = () => {
<div>{getJobSubmittedAt(jobData)}</div>
</div>

<div>
<Box variant="awsui-key-label">{t('projects.run.finished_at')}</Box>
<div>{getJobFinishedAt(jobData)}</div>
</div>

<div>
<Box variant="awsui-key-label">{t('projects.run.status')}</Box>
<div>
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/pages/Runs/Details/Jobs/List/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ export const getJobSubmittedAt = (job: IJob) => {
: '';
};

export const getJobFinishedAt = (job: IJob) => {
const finished_at = job.job_submissions?.[job.job_submissions.length - 1].finished_at;
return finished_at ? format(new Date(finished_at), DATE_TIME_FORMAT) : '';
};

export const getJobStatus = (job: IJob) => {
return job.job_submissions?.[job.job_submissions.length - 1].status;
};
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/pages/Runs/Details/Jobs/List/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ROUTES } from 'routes';

import {
getJobError,
getJobFinishedAt,
getJobListItemBackend,
getJobListItemInstance,
getJobListItemPrice,
Expand Down Expand Up @@ -48,6 +49,11 @@ export const useColumnsDefinitions = ({
header: t('projects.run.submitted_at'),
cell: getJobSubmittedAt,
},
{
id: 'finished_at',
header: t('projects.run.finished_at'),
cell: getJobFinishedAt,
},
{
id: 'status',
header: t('projects.run.status'),
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/pages/Runs/Details/RunDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { finishedRunStatuses } from 'pages/Runs/constants';
import { runIsStopped } from 'pages/Runs/utils';

import {
getRunListFinishedAt,
getRunListItemBackend,
getRunListItemInstanceId,
getRunListItemPrice,
Expand Down Expand Up @@ -59,6 +60,8 @@ export const RunDetails = () => {
? runData.latest_job_submission?.termination_reason
: null;

const finishedAt = getRunListFinishedAt(runData);

return (
<>
<Container header={<Header variant="h2">{t('common.general')}</Header>}>
Expand Down Expand Up @@ -101,7 +104,7 @@ export const RunDetails = () => {

<div>
<Box variant="awsui-key-label">{t('projects.run.finished_at')}</Box>
<div>{runData.terminated_at ? format(new Date(runData.terminated_at), DATE_TIME_FORMAT) : '-'}</div>
<div>{finishedAt ? format(new Date(finishedAt), DATE_TIME_FORMAT) : '-'}</div>
</div>

<div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Runs/List/Preferences/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export const DEFAULT_PREFERENCES: CollectionPreferencesProps.Preferences = {
{ id: 'hub_user_name', visible: true },
{ id: 'price', visible: true },
{ id: 'submitted_at', visible: true },
{ id: 'finished_at', visible: true },
{ id: 'status', visible: true },
{ id: 'error', visible: true },
{ id: 'cost', visible: true },
// hidden by default
{ id: 'priority', visible: false },
{ id: 'finished_at', visible: false },
{ id: 'project', visible: false },
{ id: 'repo', visible: false },
{ id: 'instance', visible: false },
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/pages/Runs/List/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { groupBy as _groupBy } from 'lodash';

import { getBaseUrl } from 'App/helpers';

import { finishedJobs } from '../constants';
import { finishedJobs, finishedRunStatuses } from '../constants';
import { getJobStatus } from '../Details/Jobs/List/helpers';

export const getGroupedRunsByProjectAndRepoID = (runs: IRun[]) => {
Expand Down Expand Up @@ -98,3 +98,10 @@ export const getRunListItemSchedule = (run: IRun) => {

return run.run_spec.configuration.schedule.cron.join(', ');
};

export const getRunListFinishedAt = (run: IRun) => {
if (!run.latest_job_submission || !run.latest_job_submission.finished_at || !finishedRunStatuses.includes(run.status)) {
return null;
}
return run.latest_job_submission.finished_at;
};
6 changes: 5 additions & 1 deletion frontend/src/pages/Runs/List/hooks/useColumnsDefinitions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ROUTES } from 'routes';
import { finishedRunStatuses } from 'pages/Runs/constants';

import {
getRunListFinishedAt,
getRunListItemBackend,
getRunListItemInstance,
getRunListItemPrice,
Expand Down Expand Up @@ -68,7 +69,10 @@ export const useColumnsDefinitions = () => {
{
id: 'finished_at',
header: t('projects.run.finished_at'),
cell: (item: IRun) => (item.terminated_at ? format(new Date(item.terminated_at), DATE_TIME_FORMAT) : null),
cell: (item: IRun) => {
const finishedAt = getRunListFinishedAt(item);
return finishedAt ? format(new Date(finishedAt), DATE_TIME_FORMAT) : '-';
},
},
{
id: 'status',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/types/run.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ declare interface IJobSubmission {
submission_num: number;
status: TJobStatus;
submitted_at: number;
finished_at: string | null;
termination_reason?: string | null;
termination_reason_message?: string | null;
exit_status?: number | null;
Expand Down Expand Up @@ -283,7 +284,6 @@ declare interface IRun {
project_name: string;
user: string;
submitted_at: string;
terminated_at: string | null;
status: TJobStatus;
error?: string | null;
jobs: IJob[];
Expand Down