Files
scheduler/frontend/src/components/FailedBanner.jsx
T

50 lines
1.8 KiB
React
Raw Normal View History

2026-06-25 11:31:20 -04:00
export default function FailedBanner({ rerunTests, onDecision }) {
if (!rerunTests || rerunTests.length === 0) return null
2026-06-17 16:02:04 -04:00
2026-06-25 11:31:20 -04:00
const totalMinutes = rerunTests.reduce((sum, t) => sum + (t.estimated_minutes ?? 0), 0)
const hours = Math.floor(totalMinutes / 60)
const mins = totalMinutes % 60
2026-06-17 16:02:04 -04:00
const timeStr = hours > 0 ? `${hours}h ${mins}m` : `${mins}m`
2026-07-23 14:02:14 -04:00
// Group test IDs by device
const byDevice = rerunTests.reduce((acc, t) => {
const device = t.device ?? 'Unknown'
if (!acc[device]) acc[device] = []
acc[device].push(t.test_id)
return acc
}, {})
const deviceSummaries = Object.entries(byDevice)
.sort(([a], [b]) => a.localeCompare(b))
.map(([device, ids]) => `${device}: ${ids.join(', ')}`)
2026-06-17 16:02:04 -04:00
return (
2026-07-23 15:39:14 -04:00
<div className="flex items-start gap-4 px-6 py-3 bg-yellow-900/35 border-b border-yellow-700/55 text-yellow-100/85">
2026-06-17 16:02:04 -04:00
<svg
xmlns="http://www.w3.org/2000/svg"
2026-07-23 15:39:14 -04:00
className="w-5 h-5 mt-0.5 shrink-0 text-yellow-300/80"
2026-06-17 16:02:04 -04:00
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
strokeWidth={2}
>
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M12 9v4m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"
/>
</svg>
<div className="flex-1 min-w-0">
<p className="text-sm font-medium">
2026-06-25 11:31:20 -04:00
<span className="font-semibold">{rerunTests.length} test{rerunTests.length !== 1 ? 's' : ''}</span>
2026-07-23 14:02:14 -04:00
{' '}require a rerun not completed in last overnight window:
2026-06-17 16:02:04 -04:00
</p>
2026-07-23 14:02:14 -04:00
{deviceSummaries.map((summary) => (
2026-07-23 15:39:14 -04:00
<p key={summary} className="text-sm font-mono text-yellow-200/80 mt-0.5 truncate">
2026-07-23 14:02:14 -04:00
{summary}
</p>
))}
2026-06-17 16:02:04 -04:00
</div>
</div>
)
}