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

54 lines
2.1 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-06-25 11:31:20 -04:00
const testIds = rerunTests.map(t => t.test_id).join(', ')
2026-06-17 16:02:04 -04:00
return (
<div className="flex items-start gap-4 px-6 py-3 bg-red-900/70 border-b border-red-700 text-red-100">
<svg
xmlns="http://www.w3.org/2000/svg"
className="w-5 h-5 mt-0.5 shrink-0 text-red-300"
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>
{' '}require a rerun not completed in last overnight window:{' '}
<span className="font-mono text-red-200">{testIds}</span>
2026-06-17 16:02:04 -04:00
</p>
<p className="text-sm text-red-300 mt-0.5">
Estimated rerun time: <span className="font-semibold text-red-100">{timeStr}</span>
2026-06-25 11:31:20 -04:00
{' '} Schedule rerun during daytime today?
2026-06-17 16:02:04 -04:00
</p>
</div>
<div className="flex gap-2 shrink-0">
<button
onClick={() => onDecision(true)}
className="px-3 py-1 text-sm font-medium bg-red-700 hover:bg-red-600 text-white rounded-md border border-red-500 transition-colors"
>
Yes
</button>
<button
onClick={() => onDecision(false)}
className="px-3 py-1 text-sm font-medium bg-gray-700 hover:bg-gray-600 text-gray-100 rounded-md border border-gray-500 transition-colors"
>
No
</button>
</div>
</div>
)
}