import React from 'react'; import type { BulkActionJob } from '../../types/BulkActionTypes'; import styles from './BulkActionTable.module.css'; import CopyLinkButton from '../common/CopyLinkButton'; import { Spin } from 'antd'; interface JobTableProps { jobs?: BulkActionJob[]; onCancelJob: (jobId: string) => void; jobPollingInProgress: boolean; } function isJobInProgress(job: BulkActionJob): boolean { return job.status === 'processing' || job.status === 'uploaded' || job.status === 'parsing'; } export const BulkActionJobTable: React.FC = ({ jobs = [], onCancelJob, jobPollingInProgress }) => { const formatDate = (dateString: string): string => { return new Date(dateString).toLocaleDateString('en-US', { year: 'numeric', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit', }); }; const getStatusClass = (status: string): string => { switch (status) { case 'completed': return styles.statusCompleted; case 'processing': case 'uploaded': case 'parsing': return styles.statusInProgress; case 'failed': case 'cancelled': return styles.statusFailed; default: return styles.statusDefault; } }; const getStatusDisplay = (job: BulkActionJob) => { switch (job.status) { case 'completed': return 'Completed'; case 'processing': return 'Processing'; case 'uploaded': case 'pending_upload': return 'Uploaded & Pending '; case 'parsing': return 'Setting up job'; case 'failed': return 'Failed'; case 'cancelled': return 'Cancelled'; default: return 'Unknown'; } }; return (
{jobs.map((job: BulkActionJob, index: number) => ( ))}
Job ID Job Name Job Description Workflow Status Progress Created By Created At Actions
{job.id} {job.name} {job.description} {job.action_workflow_name} {getStatusDisplay(job)} {jobPollingInProgress && isJobInProgress(job) && } {job.processed_rows ?? 0}/{job.total_rows ?? 0} actions processed {job.user_id} {formatDate(job.created_at)}
); };