File tree Expand file tree Collapse file tree 8 files changed +36
-5
lines changed
Expand file tree Collapse file tree 8 files changed +36
-5
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { useGetRunQuery } from 'services/run';
99
1010import {
1111 getJobError ,
12+ getJobFinishedAt ,
1213 getJobListItemBackend ,
1314 getJobListItemInstance ,
1415 getJobListItemPrice ,
@@ -59,6 +60,11 @@ export const JobDetails = () => {
5960 < div > { getJobSubmittedAt ( jobData ) } </ div >
6061 </ div >
6162
63+ < div >
64+ < Box variant = "awsui-key-label" > { t ( 'projects.run.finished_at' ) } </ Box >
65+ < div > { getJobFinishedAt ( jobData ) } </ div >
66+ </ div >
67+
6268 < div >
6369 < Box variant = "awsui-key-label" > { t ( 'projects.run.status' ) } </ Box >
6470 < div >
Original file line number Diff line number Diff line change @@ -39,6 +39,11 @@ export const getJobSubmittedAt = (job: IJob) => {
3939 : '' ;
4040} ;
4141
42+ export const getJobFinishedAt = ( job : IJob ) => {
43+ const finished_at = job . job_submissions ?. [ job . job_submissions . length - 1 ] . finished_at ;
44+ return finished_at ? format ( new Date ( finished_at ) , DATE_TIME_FORMAT ) : '' ;
45+ } ;
46+
4247export const getJobStatus = ( job : IJob ) => {
4348 return job . job_submissions ?. [ job . job_submissions . length - 1 ] . status ;
4449} ;
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { ROUTES } from 'routes';
88
99import {
1010 getJobError ,
11+ getJobFinishedAt ,
1112 getJobListItemBackend ,
1213 getJobListItemInstance ,
1314 getJobListItemPrice ,
@@ -48,6 +49,11 @@ export const useColumnsDefinitions = ({
4849 header : t ( 'projects.run.submitted_at' ) ,
4950 cell : getJobSubmittedAt ,
5051 } ,
52+ {
53+ id : 'finished_at' ,
54+ header : t ( 'projects.run.finished_at' ) ,
55+ cell : getJobFinishedAt ,
56+ } ,
5157 {
5258 id : 'status' ,
5359 header : t ( 'projects.run.status' ) ,
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import { finishedRunStatuses } from 'pages/Runs/constants';
1515import { runIsStopped } from 'pages/Runs/utils' ;
1616
1717import {
18+ getRunListFinishedAt ,
1819 getRunListItemBackend ,
1920 getRunListItemInstanceId ,
2021 getRunListItemPrice ,
@@ -59,6 +60,8 @@ export const RunDetails = () => {
5960 ? runData . latest_job_submission ?. termination_reason
6061 : null ;
6162
63+ const finishedAt = getRunListFinishedAt ( runData ) ;
64+
6265 return (
6366 < >
6467 < Container header = { < Header variant = "h2" > { t ( 'common.general' ) } </ Header > } >
@@ -101,7 +104,7 @@ export const RunDetails = () => {
101104
102105 < div >
103106 < Box variant = "awsui-key-label" > { t ( 'projects.run.finished_at' ) } </ Box >
104- < div > { runData . terminated_at ? format ( new Date ( runData . terminated_at ) , DATE_TIME_FORMAT ) : '-' } </ div >
107+ < div > { finishedAt ? format ( new Date ( finishedAt ) , DATE_TIME_FORMAT ) : '-' } </ div >
105108 </ div >
106109
107110 < div >
Original file line number Diff line number Diff line change @@ -9,12 +9,12 @@ export const DEFAULT_PREFERENCES: CollectionPreferencesProps.Preferences = {
99 { id : 'hub_user_name' , visible : true } ,
1010 { id : 'price' , visible : true } ,
1111 { id : 'submitted_at' , visible : true } ,
12+ { id : 'finished_at' , visible : true } ,
1213 { id : 'status' , visible : true } ,
1314 { id : 'error' , visible : true } ,
1415 { id : 'cost' , visible : true } ,
1516 // hidden by default
1617 { id : 'priority' , visible : false } ,
17- { id : 'finished_at' , visible : false } ,
1818 { id : 'project' , visible : false } ,
1919 { id : 'repo' , visible : false } ,
2020 { id : 'instance' , visible : false } ,
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { groupBy as _groupBy } from 'lodash';
22
33import { getBaseUrl } from 'App/helpers' ;
44
5- import { finishedJobs } from '../constants' ;
5+ import { finishedJobs , finishedRunStatuses } from '../constants' ;
66import { getJobStatus } from '../Details/Jobs/List/helpers' ;
77
88export const getGroupedRunsByProjectAndRepoID = ( runs : IRun [ ] ) => {
@@ -98,3 +98,10 @@ export const getRunListItemSchedule = (run: IRun) => {
9898
9999 return run . run_spec . configuration . schedule . cron . join ( ', ' ) ;
100100} ;
101+
102+ export const getRunListFinishedAt = ( run : IRun ) => {
103+ if ( ! run . latest_job_submission || ! run . latest_job_submission . finished_at || ! finishedRunStatuses . includes ( run . status ) ) {
104+ return null ;
105+ }
106+ return run . latest_job_submission . finished_at ;
107+ } ;
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import { ROUTES } from 'routes';
1818import { finishedRunStatuses } from 'pages/Runs/constants' ;
1919
2020import {
21+ getRunListFinishedAt ,
2122 getRunListItemBackend ,
2223 getRunListItemInstance ,
2324 getRunListItemPrice ,
@@ -68,7 +69,10 @@ export const useColumnsDefinitions = () => {
6869 {
6970 id : 'finished_at' ,
7071 header : t ( 'projects.run.finished_at' ) ,
71- cell : ( item : IRun ) => ( item . terminated_at ? format ( new Date ( item . terminated_at ) , DATE_TIME_FORMAT ) : null ) ,
72+ cell : ( item : IRun ) => {
73+ const finishedAt = getRunListFinishedAt ( item ) ;
74+ return finishedAt ? format ( new Date ( finishedAt ) , DATE_TIME_FORMAT ) : '-' ;
75+ } ,
7276 } ,
7377 {
7478 id : 'status' ,
Original file line number Diff line number Diff line change @@ -228,6 +228,7 @@ declare interface IJobSubmission {
228228 submission_num : number ;
229229 status : TJobStatus ;
230230 submitted_at : number ;
231+ finished_at : string | null ;
231232 termination_reason ?: string | null ;
232233 termination_reason_message ?: string | null ;
233234 exit_status ?: number | null ;
@@ -283,7 +284,6 @@ declare interface IRun {
283284 project_name : string ;
284285 user : string ;
285286 submitted_at : string ;
286- terminated_at : string | null ;
287287 status : TJobStatus ;
288288 error ?: string | null ;
289289 jobs : IJob [ ] ;
You can’t perform that action at this time.
0 commit comments