1- import Chip from "@mui/material/Chip" ;
21import Stack from "@mui/material/Stack" ;
32import Table from "@mui/material/Table" ;
43import TableBody from "@mui/material/TableBody" ;
@@ -7,7 +6,8 @@ import TableContainer from "@mui/material/TableContainer";
76import TableHead from "@mui/material/TableHead" ;
87import TableRow from "@mui/material/TableRow" ;
98import Typography from "@mui/material/Typography" ;
10- import { formatStageError , jobStatusColor } from "./jobStatus" ;
9+ import { JobStatusChip } from "./JobStatusChip" ;
10+ import { formatStageError } from "./jobStatus" ;
1111
1212export interface DataManagerJobStage {
1313 id : string ;
@@ -16,6 +16,7 @@ export interface DataManagerJobStage {
1616 durationMs : number ;
1717 message : string | null ;
1818 error : unknown ;
19+ artifacts ?: unknown ;
1920}
2021
2122function durationLabel ( durationMs : number ) : string {
@@ -27,6 +28,24 @@ function durationLabel(durationMs: number): string {
2728 return `${ minutes } m ${ seconds } s` ;
2829}
2930
31+ function validationDetails ( stage : DataManagerJobStage ) : string | null {
32+ if ( stage . stage !== "validate" || ! stage . artifacts || typeof stage . artifacts !== "object" ) {
33+ return null ;
34+ }
35+ const invalid = ( stage . artifacts as { invalid ?: unknown } ) . invalid ;
36+ if ( ! Array . isArray ( invalid ) || invalid . length === 0 ) return null ;
37+
38+ const details = invalid . flatMap ( ( entry ) => {
39+ if ( ! entry || typeof entry !== "object" ) return [ ] ;
40+ const { id, reason } = entry as { id ?: unknown ; reason ?: unknown } ;
41+ if ( typeof id !== "string" ) return [ ] ;
42+ return [ `${ id } ${ typeof reason === "string" ? `: ${ reason } ` : "" } ` ] ;
43+ } ) ;
44+ if ( details . length === 0 ) return null ;
45+ const hidden = details . length - 5 ;
46+ return `Invalid archives — ${ details . slice ( 0 , 5 ) . join ( "; " ) } ${ hidden > 0 ? `; +${ hidden } more` : "" } ` ;
47+ }
48+
3049export function DataManagerJobStages ( {
3150 stages,
3251 emptyMessage = "No stages recorded" ,
@@ -56,6 +75,7 @@ export function DataManagerJobStages({
5675 < TableBody >
5776 { stages . map ( ( stage ) => {
5877 const error = formatStageError ( stage . error ) ;
78+ const artifactDetails = validationDetails ( stage ) ;
5979 return (
6080 < TableRow key = { stage . id } hover >
6181 < TableCell >
@@ -70,14 +90,17 @@ export function DataManagerJobStages({
7090 { error ?? stage . message }
7191 </ Typography >
7292 ) }
93+ { artifactDetails && (
94+ < Typography
95+ variant = "caption"
96+ sx = { { color : "warning.main" , display : "block" } }
97+ >
98+ { artifactDetails }
99+ </ Typography >
100+ ) }
73101 </ TableCell >
74102 < TableCell >
75- < Chip
76- size = "small"
77- label = { stage . status }
78- color = { jobStatusColor ( stage . status ) }
79- variant = "outlined"
80- />
103+ < JobStatusChip status = { stage . status } />
81104 </ TableCell >
82105 < TableCell align = "right" > { durationLabel ( stage . durationMs ) } </ TableCell >
83106 </ TableRow >
0 commit comments