// Dashboard View Component const DashboardView = ({ queueData, onViewChange, onViewJob }) => { const { jobs = [], started, pending_count = 0 } = queueData || {}; const running = jobs.filter(j => j.status === 'running').length; const pending = pending_count || jobs.filter(j => j.status === 'queued').length; const completed = jobs.filter(j => j.status === 'completed').length; const errors = jobs.filter(j => j.status === 'error').length; const stats = [ { label: 'In Coda', value: pending, icon: '⏳', color: 'text-slate-600', bg: 'bg-slate-50' }, { label: 'In Esecuzione', value: running, icon: '⚡', color: 'text-blue-600', bg: 'bg-blue-50' }, { label: 'Completati', value: completed, icon: '✓', color: 'text-emerald-600', bg: 'bg-emerald-50' }, { label: 'Errori', value: errors, icon: '✕', color: 'text-red-600', bg: 'bg-red-50' }, ]; const runningJobs = jobs.filter(j => j.status === 'running'); const recentJobs = jobs.filter(j => j.status === 'completed' || j.status === 'error').slice(0, 5); // Use shared status configuration const getStatusConfig = (status) => { const config = getJobStatusConfig(status); // Transform to match expected format (split color class into separate properties) const [bg, textColor] = config.color.split(' '); return { icon: config.icon, color: textColor, bg: bg, label: config.label, }; }; return (
{/* Stats */}
{stats.map(stat => (
{stat.icon}
{stat.value}
{stat.label}
))}
{/* Running Jobs */}

Lavori in Esecuzione

{runningJobs.length === 0 ? (

Nessun lavoro in esecuzione

) : (
{runningJobs.map(job => (
onViewJob(job)} >
{job.personal_data?.first_name} {job.personal_data?.last_name}
{job.message}
{job.additional_data?.crif_mode ? 'CRIF' : 'Email'}
))}
)}
{/* Recent Activity */}

📋 Attività Recente

{recentJobs.length === 0 ? (

Nessuna attività recente

) : (
{recentJobs.map(job => { const statusCfg = getStatusConfig(job.status); return (
onViewJob(job)} >
{job.status === 'running' ? : {statusCfg.icon}}
{job.personal_data?.first_name} {job.personal_data?.last_name}
{job.message || statusCfg.label}
{statusCfg.label} #{job.id?.slice(-6)}
); })}
)}
{/* Quick Actions */}

⚡ Azioni Rapide

); }; window.DashboardView = DashboardView;