feat(ST-cmovhvej7): add PBI_HAS_ACTIVE_TASKS alongside-dialoog in materialize handler
When materializeIdeaPlanAction returns code 409 with PBI_HAS_ACTIVE_TASKS:<code>, a confirm dialog offers the user a choice: create new PBI alongside the existing one or cancel. Alongside=true retries the action; cancel leaves the idea in PLAN_READY.
This commit is contained in:
parent
8211b4109d
commit
9ccc57f770
1 changed files with 13 additions and 4 deletions
|
|
@ -107,15 +107,24 @@ export function IdeaRowActions({ idea, isDemo, onArchive }: IdeaRowActionsProps)
|
|||
function handleMaterialize() {
|
||||
if (!confirm('Plan materialiseren? Dit maakt PBI + stories + taken aan.')) return
|
||||
startTransition(async () => {
|
||||
const r = await materializeIdeaPlanAction(idea.id)
|
||||
let r = await materializeIdeaPlanAction(idea.id)
|
||||
|
||||
if ('error' in r && r.code === 409 && r.error.startsWith('PBI_HAS_ACTIVE_TASKS:')) {
|
||||
const pbiCode = r.error.split(':')[1]
|
||||
const alongside = confirm(
|
||||
`De bestaande PBI (${pbiCode}) heeft uitgevoerde taken.\n` +
|
||||
`OK = nieuwe PBI naast bestaande aanmaken.\n` +
|
||||
`Annuleren = stoppen.`
|
||||
)
|
||||
if (!alongside) return
|
||||
r = await materializeIdeaPlanAction(idea.id, { allowAlongside: true })
|
||||
}
|
||||
|
||||
if ('error' in r) {
|
||||
toast.error(r.error)
|
||||
return
|
||||
}
|
||||
toast.success(`Gematerialiseerd als ${r.data?.pbi_code}`)
|
||||
// Navigeer naar de product-backlog. Anchor-scrolling per-PBI bestaat
|
||||
// (nog) niet in pbi-list, dus gewoon naar de overview-pagina; de nieuwe
|
||||
// PBI is de meest recente.
|
||||
if (idea.product_id) {
|
||||
router.push(`/products/${idea.product_id}`)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue