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
39 changes: 36 additions & 3 deletions inc/Core/Admin/Pages/Jobs/assets/css/jobs-page.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,29 @@

/* Table Column Widths */
.datamachine-col-job-id {
width: 80px;
width: 70px;
}

.datamachine-col-pipeline,
.datamachine-col-flow {
width: 140px;
}

.datamachine-col-label {
/* Flexible — takes remaining space */
}

.datamachine-col-label-cell {
word-break: break-word;
}

.datamachine-col-status {
width: 100px;
width: 180px;
}

.datamachine-col-created,
.datamachine-col-completed {
width: 140px;
width: 130px;
}

/* Job Status Colors - now using shared classes from root.css:
Expand All @@ -102,6 +115,24 @@
* .datamachine-status--neutral
*/

/* Status detail (compound status reason) */
.datamachine-status-detail {
display: block;
font-size: 11px;
color: #646970;
margin-top: 2px;
line-height: 1.3;
word-break: break-word;
}

/* Pipeline/Flow cell styling */
.datamachine-col-pipeline,
.datamachine-col-flow {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}



/* Modal Styles */
Expand Down Expand Up @@ -273,6 +304,8 @@
gap: 15px;
}

.datamachine-col-label,
.datamachine-col-label-cell,
.datamachine-col-created,
.datamachine-col-completed {
display: none;
Expand Down
136 changes: 114 additions & 22 deletions inc/Core/Admin/Pages/Jobs/assets/react/components/JobsTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,31 @@ const formatStatus = ( status ) => {
if ( ! status ) {
return __( 'Unknown', 'data-machine' );
}
return (
// Show base status as the label, full detail on hover via title attr.
const formatted =
status.charAt( 0 ).toUpperCase() +
status.slice( 1 ).replace( /_/g, ' ' )
);
status.slice( 1 ).replace( /_/g, ' ' );
return formatted;
};

/**
* Extract the base status (before " - " detail separator).
*/
const getBaseStatus = ( status ) => {
if ( ! status ) {
return '';
}
return status.split( ' - ' )[ 0 ];
};

/**
* Get the detail portion of a compound status (after " - ").
*/
const getStatusDetail = ( status ) => {
if ( ! status || ! status.includes( ' - ' ) ) {
return null;
}
return status.split( ' - ' ).slice( 1 ).join( ' - ' );
};

/**
Expand Down Expand Up @@ -163,7 +184,7 @@ const ChildRows = ( { parentJobId } ) => {
if ( isLoading ) {
return (
<tr className="datamachine-child-row datamachine-child-row--loading">
<td colSpan="5">
<td colSpan="7">
<div className="datamachine-child-loading">
<Spinner />
<span>
Expand All @@ -175,11 +196,24 @@ const ChildRows = ( { parentJobId } ) => {
);
}

if ( isError || ! children || children.length === 0 ) {
if ( isError ) {
return (
<tr className="datamachine-child-row">
<td colSpan="7" className="datamachine-child-empty">
{ __( 'Failed to load child jobs.', 'data-machine' ) }
</td>
</tr>
);
}

if ( ! children || children.length === 0 ) {
return (
<tr className="datamachine-child-row">
<td colSpan="5" className="datamachine-child-empty">
{ __( 'No child jobs found.', 'data-machine' ) }
<td colSpan="7" className="datamachine-child-empty">
{ __(
'Child jobs were scheduled but have not been recorded yet.',
'data-machine'
) }
</td>
</tr>
);
Expand All @@ -194,14 +228,26 @@ const ChildRows = ( { parentJobId } ) => {
{ child.job_id }
</td>
<td>
{ child.display_label ||
child.label ||
__( 'Child job', 'data-machine' ) }
{ child.pipeline_name || '\u2014' }
</td>
<td>
<span className={ getStatusClass( child.status ) }>
{ formatStatus( child.status ) }
{ child.flow_name || '\u2014' }
</td>
<td className="datamachine-col-label-cell">
{ child.label || '\u2014' }
</td>
<td>
<span
className={ getStatusClass( child.status ) }
title={ getStatusDetail( child.status ) || undefined }
>
{ formatStatus( getBaseStatus( child.status ) || child.status ) }
</span>
{ getStatusDetail( child.status ) && (
<span className="datamachine-status-detail">
{ getStatusDetail( child.status ) }
</span>
) }
</td>
<td>{ child.created_at_display || '' }</td>
<td>{ child.completed_at_display || '' }</td>
Expand All @@ -212,6 +258,34 @@ const ChildRows = ( { parentJobId } ) => {
/**
* Single job row — handles expand/collapse for batch parents.
*/
/**
* Format pipeline display value.
* Shows name for DB pipelines, "Direct" for direct execution, em dash for null.
*/
const formatPipeline = ( job ) => {
if ( job.pipeline_name ) {
return job.pipeline_name;
}
if ( job.pipeline_id === 'direct' ) {
return __( 'Direct', 'data-machine' );
}
return '\u2014';
};

/**
* Format flow display value.
* Shows name for DB flows, "Direct" for direct execution, em dash for null.
*/
const formatFlow = ( job ) => {
if ( job.flow_name ) {
return job.flow_name;
}
if ( job.flow_id === 'direct' ) {
return __( 'Direct', 'data-machine' );
}
return '\u2014';
};

const JobRow = ( { job, isExpanded, onToggle } ) => {
const isBatch = hasChildren( job );

Expand All @@ -238,17 +312,27 @@ const JobRow = ( { job, isExpanded, onToggle } ) => {
</strong>
</td>
<td>
{ job.display_label ||
job.label ||
( job.pipeline_name && job.flow_name
? `${ job.pipeline_name } \u2192 ${ job.flow_name }`
: __( 'Unknown', 'data-machine' ) ) }
{ formatPipeline( job ) }
</td>
<td>
{ formatFlow( job ) }
</td>
<td className="datamachine-col-label-cell">
{ job.label || '\u2014' }
{ isBatch && <BatchBadge job={ job } /> }
</td>
<td>
<span className={ getStatusClass( job.status ) }>
{ formatStatus( job.status ) }
<span
className={ getStatusClass( job.status ) }
title={ getStatusDetail( job.status ) || undefined }
>
{ formatStatus( getBaseStatus( job.status ) || job.status ) }
</span>
{ getStatusDetail( job.status ) && (
<span className="datamachine-status-detail">
{ getStatusDetail( job.status ) }
</span>
) }
</td>
<td>{ job.created_at_display || '' }</td>
<td>{ job.completed_at_display || '' }</td>
Expand Down Expand Up @@ -307,15 +391,23 @@ const JobsTable = ( { jobs, isLoading, isError, error } ) => {
<th className="datamachine-col-job-id">
{ __( 'Job ID', 'data-machine' ) }
</th>
<th>{ __( 'Source', 'data-machine' ) }</th>
<th className="datamachine-col-pipeline">
{ __( 'Pipeline', 'data-machine' ) }
</th>
<th className="datamachine-col-flow">
{ __( 'Flow', 'data-machine' ) }
</th>
<th className="datamachine-col-label">
{ __( 'Label', 'data-machine' ) }
</th>
<th className="datamachine-col-status">
{ __( 'Status', 'data-machine' ) }
</th>
<th className="datamachine-col-created">
{ __( 'Created At', 'data-machine' ) }
{ __( 'Created', 'data-machine' ) }
</th>
<th className="datamachine-col-completed">
{ __( 'Completed At', 'data-machine' ) }
{ __( 'Completed', 'data-machine' ) }
</th>
</tr>
</thead>
Expand Down
Loading