Spaces:
Running
Running
File size: 1,083 Bytes
5f3e9f5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | import { ArrowRight } from 'lucide-react'
import { NavLink } from 'react-router-dom'
import Banner from './Banner'
interface Props {
reason: 'in_flight' | 'duplicate' | 'unknown'
message: string
}
/**
* Inline banner shown on a wizard when the backend rejects the run with
* 409. Renders a tailored, action-oriented message + a one-click link
* over to /processes so the user can find / cancel the conflicting run
* without copy-pasting an opaque error string.
*/
export default function BackendRejectedBanner({ reason, message }: Props) {
const tone = reason === 'duplicate' ? 'warning' : 'danger'
const title =
reason === 'in_flight'
? 'Another run is already in progress'
: reason === 'duplicate'
? 'Same payload submitted seconds ago'
: 'Backend refused the run'
return (
<Banner
tone={tone}
title={title}
actions={
<NavLink to="/processes" className="btn-secondary btn-sm shrink-0">
Open Processes <ArrowRight size={14} />
</NavLink>
}
>
{message}
</Banner>
)
}
|