AP2.2e: Unplan, Bug/Issue-Referenz und Sprint-Lebenszyklus.
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 2m52s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 13s
Deploy Development / deploy (push) Successful in 44s
Test Suite / pytest-backend (push) Successful in 2m52s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 13s
Ermöglicht APs zurück in den Eingang zu schieben, Bugs/Issues mit Feature-Bezug zu planen und den Scrum-Sprint-Ablauf in der UI. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
e221b5b09f
commit
e65838118c
21 files changed
+794
-14
No files matched your search
@@ -22,6 +22,10 @@ export function deleteAction(id) {
|
||||
return apiFetch(`/api/actions/${id}`, { method: 'DELETE' })
|
||||
}
|
||||
|
||||
export function unplanActionToBacklog(id) {
|
||||
return apiFetch(`/api/actions/${id}/unplan-to-backlog`, { method: 'POST' })
|
||||
}
|
||||
|
||||
export function listMyOpenActions() {
|
||||
return apiFetch('/api/actions/me/open')
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { Link } from 'react-router-dom'
|
||||
import { ACTION_STATUSES, ACTION_STATUS_LABELS } from '../constants/status.js'
|
||||
import { ACTION_STATUSES, ACTION_STATUS_LABELS, ACTION_KIND_LABELS } from '../constants/status.js'
|
||||
import { StatusBadge } from './StatusBadge.jsx'
|
||||
import { PriorityBadge } from './PriorityBadge.jsx'
|
||||
import { ActionForm } from './ActionForm.jsx'
|
||||
import { gateTitleById } from './GateSelect.jsx'
|
||||
import { actionTitleById } from '../utils/actionReferences.js'
|
||||
|
||||
function formatDue(iso) {
|
||||
if (!iso) return null
|
||||
@@ -43,6 +44,7 @@ export function ActionHubCard({
|
||||
onSubmitEdit,
|
||||
onQuickStatus,
|
||||
onCreateBlocker,
|
||||
onUnplanToBacklog,
|
||||
canManage,
|
||||
canManageBlocker,
|
||||
formBusy,
|
||||
@@ -56,10 +58,15 @@ export function ActionHubCard({
|
||||
roadmapItems = [],
|
||||
workCycles = [],
|
||||
activeWorkCycle = null,
|
||||
allActions = [],
|
||||
detailMode = false,
|
||||
}) {
|
||||
const due = formatDue(action.due_at)
|
||||
const isBlocked = action.status === 'blocked' || context?.has_open_blocker
|
||||
const canUnplan =
|
||||
typeof onUnplanToBacklog === 'function' &&
|
||||
action.work_cycle_id &&
|
||||
['open', 'ready'].includes(action.status)
|
||||
|
||||
if (editing) {
|
||||
return (
|
||||
@@ -94,6 +101,11 @@ export function ActionHubCard({
|
||||
<div className="action-hub-card-badges">
|
||||
<StatusBadge status={action.status} />
|
||||
<PriorityBadge priority={action.priority} />
|
||||
{action.action_kind && action.action_kind !== 'delivery' && (
|
||||
<span className="badge badge--kind muted">
|
||||
{ACTION_KIND_LABELS[action.action_kind] || action.action_kind}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
{action.description && (
|
||||
@@ -103,6 +115,11 @@ export function ActionHubCard({
|
||||
{action.roadmap_item_id && (
|
||||
<span>Gate: {gateTitleById(roadmapItems, action.roadmap_item_id) || '…'}</span>
|
||||
)}
|
||||
{action.parent_action_id && (
|
||||
<span>
|
||||
Feature: {actionTitleById(allActions, action.parent_action_id) || '…'}
|
||||
</span>
|
||||
)}
|
||||
{action.assigned_actor_ids?.length > 0 && (
|
||||
<span>{action.assigned_actor_ids.length} zugewiesen</span>
|
||||
)}
|
||||
@@ -174,6 +191,16 @@ export function ActionHubCard({
|
||||
Blocker melden
|
||||
</button>
|
||||
)}
|
||||
{canUnplan && (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary btn-sm"
|
||||
onClick={() => onUnplanToBacklog(action)}
|
||||
disabled={formBusy}
|
||||
>
|
||||
Zurück in Eingang
|
||||
</button>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-ghost btn-sm"
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
import {
|
||||
BACKLOG_STATUSES,
|
||||
BACKLOG_STATUS_LABELS,
|
||||
BACKLOG_ITEM_KINDS,
|
||||
BACKLOG_ITEM_KIND_LABELS,
|
||||
PRIORITIES,
|
||||
PRIORITY_LABELS,
|
||||
} from '../constants/status.js'
|
||||
import { GateSelect } from './GateSelect.jsx'
|
||||
import { FeatureParentSelect } from './FeatureParentSelect.jsx'
|
||||
|
||||
export function BacklogItemForm({
|
||||
initial = {},
|
||||
roadmapItems = [],
|
||||
featureActions = [],
|
||||
onSubmit,
|
||||
onCancel,
|
||||
busy = false,
|
||||
@@ -19,17 +23,23 @@ export function BacklogItemForm({
|
||||
e.preventDefault()
|
||||
const form = e.target
|
||||
const gateValue = form.roadmap_item_id?.value ?? ''
|
||||
const parentValue = form.parent_action_id?.value ?? ''
|
||||
await onSubmit({
|
||||
title: form.title.value.trim(),
|
||||
description: form.description.value,
|
||||
status: form.status?.value,
|
||||
priority: form.priority.value,
|
||||
item_kind: form.item_kind?.value || 'story',
|
||||
roadmap_item_id: gateValue || undefined,
|
||||
clear_roadmap_item: gateValue === '',
|
||||
parent_action_id: parentValue || undefined,
|
||||
clear_parent_action: parentValue === '',
|
||||
})
|
||||
}
|
||||
|
||||
const statusLocked = initial.status === 'converted'
|
||||
const showFeatureRef =
|
||||
(initial.item_kind || 'story') !== 'story' || featureActions.length > 0
|
||||
|
||||
return (
|
||||
<form className="form workspace-form backlog-item-form" onSubmit={handleSubmit}>
|
||||
@@ -53,6 +63,20 @@ export function BacklogItemForm({
|
||||
/>
|
||||
</label>
|
||||
<div className="form-row form-row--2">
|
||||
<label>
|
||||
Typ
|
||||
<select
|
||||
name="item_kind"
|
||||
defaultValue={initial.item_kind || 'story'}
|
||||
disabled={statusLocked}
|
||||
>
|
||||
{BACKLOG_ITEM_KINDS.map((kind) => (
|
||||
<option key={kind} value={kind}>
|
||||
{BACKLOG_ITEM_KIND_LABELS[kind]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
{allowStatus && (
|
||||
<label>
|
||||
Status
|
||||
@@ -69,6 +93,8 @@ export function BacklogItemForm({
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
</div>
|
||||
<div className="form-row form-row--2">
|
||||
<label>
|
||||
Priorität
|
||||
<select name="priority" defaultValue={initial.priority || 'normal'} disabled={statusLocked}>
|
||||
@@ -87,6 +113,13 @@ export function BacklogItemForm({
|
||||
disabled={statusLocked}
|
||||
/>
|
||||
)}
|
||||
{showFeatureRef && (
|
||||
<FeatureParentSelect
|
||||
featureActions={featureActions}
|
||||
defaultValue={initial.parent_action_id || ''}
|
||||
disabled={statusLocked}
|
||||
/>
|
||||
)}
|
||||
<div className="form-actions">
|
||||
<button type="submit" className="btn btn-primary" disabled={busy || statusLocked}>
|
||||
{busy ? 'Speichern …' : submitLabel}
|
||||
|
||||
@@ -8,6 +8,8 @@ import { ReorderControls } from './ReorderControls.jsx'
|
||||
import { gateTitleById } from './GateSelect.jsx'
|
||||
import { computeDropPatches, computeMovePatches, sortByOrder } from '../utils/reorder.js'
|
||||
import { useMinWidth } from '../hooks/useMinWidth.js'
|
||||
import { BACKLOG_ITEM_KIND_LABELS } from '../constants/status.js'
|
||||
import { actionTitleById } from '../utils/actionReferences.js'
|
||||
|
||||
const PLANNING_STATUSES = new Set(['planned', 'active', 'at_risk'])
|
||||
/** Backend erlaubt Convert für diese Status — UI war nur bei „Freigegeben“ sichtbar. */
|
||||
@@ -19,6 +21,7 @@ export function BacklogSection({
|
||||
roadmapItems = [],
|
||||
workCycles = [],
|
||||
activeWorkCycle = null,
|
||||
featureActions = [],
|
||||
initiativeId = '',
|
||||
sprintPlanningEnabled = false,
|
||||
canManage,
|
||||
@@ -89,6 +92,8 @@ export function BacklogSection({
|
||||
description: payload.description,
|
||||
priority: payload.priority,
|
||||
roadmap_item_id: payload.roadmap_item_id,
|
||||
item_kind: payload.item_kind,
|
||||
parent_action_id: payload.parent_action_id,
|
||||
status: payload.status || 'new',
|
||||
})
|
||||
closeModal()
|
||||
@@ -103,6 +108,9 @@ export function BacklogSection({
|
||||
priority: payload.priority,
|
||||
roadmap_item_id: payload.roadmap_item_id,
|
||||
clear_roadmap_item: payload.clear_roadmap_item,
|
||||
item_kind: payload.item_kind,
|
||||
parent_action_id: payload.parent_action_id,
|
||||
clear_parent_action: payload.clear_parent_action,
|
||||
})
|
||||
if (ok !== false) closeModal()
|
||||
}
|
||||
@@ -302,9 +310,19 @@ export function BacklogSection({
|
||||
disabled={!canManage}
|
||||
>
|
||||
<strong>{item.title}</strong>
|
||||
{item.item_kind && item.item_kind !== 'story' && (
|
||||
<span className="badge badge--kind muted">
|
||||
{BACKLOG_ITEM_KIND_LABELS[item.item_kind] || item.item_kind}
|
||||
</span>
|
||||
)}
|
||||
{item.description && (
|
||||
<p className="list-item-desc">{item.description}</p>
|
||||
)}
|
||||
{item.parent_action_id && (
|
||||
<p className="list-item-sub muted">
|
||||
Feature: {actionTitleById(featureActions, item.parent_action_id) || '…'}
|
||||
</p>
|
||||
)}
|
||||
{item.roadmap_item_id && (
|
||||
<p className="list-item-sub muted">
|
||||
Gate:{' '}
|
||||
@@ -374,6 +392,7 @@ export function BacklogSection({
|
||||
{modalMode?.kind === 'create' && (
|
||||
<BacklogItemForm
|
||||
roadmapItems={roadmapItems}
|
||||
featureActions={featureActions}
|
||||
onSubmit={handleCreateSubmit}
|
||||
onCancel={closeModal}
|
||||
busy={busy}
|
||||
@@ -384,6 +403,7 @@ export function BacklogSection({
|
||||
<BacklogItemForm
|
||||
initial={modalMode.item}
|
||||
roadmapItems={roadmapItems}
|
||||
featureActions={featureActions}
|
||||
onSubmit={handleEditSubmit}
|
||||
onCancel={closeModal}
|
||||
busy={busy}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
export function FeatureParentSelect({
|
||||
featureActions = [],
|
||||
defaultValue = '',
|
||||
disabled = false,
|
||||
label = 'Bezug zu Feature (Arbeitspaket)',
|
||||
}) {
|
||||
return (
|
||||
<label>
|
||||
{label}
|
||||
<select name="parent_action_id" defaultValue={defaultValue} disabled={disabled}>
|
||||
<option value="">— kein Bezug —</option>
|
||||
{featureActions.map((action) => (
|
||||
<option key={action.id} value={action.id}>
|
||||
{action.title}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
{featureActions.length === 0 && (
|
||||
<span className="muted form-hint">
|
||||
Lege zuerst ein Feature-Arbeitspaket an (Story/Lieferung), um Bugs/Issues zu verknüpfen.
|
||||
</span>
|
||||
)}
|
||||
</label>
|
||||
)
|
||||
}
|
||||
@@ -21,6 +21,7 @@ export function InitiativeActionsHub({
|
||||
onUpdateAction,
|
||||
onQuickStatus,
|
||||
onCreateBlockerForAction,
|
||||
onUnplanToBacklog,
|
||||
canManage,
|
||||
canManageBlocker,
|
||||
formBusy,
|
||||
@@ -96,6 +97,7 @@ export function InitiativeActionsHub({
|
||||
onSubmitEdit={(payload) => onUpdateAction(action.id, payload)}
|
||||
onQuickStatus={(status) => onQuickStatus(action, status)}
|
||||
onCreateBlocker={() => onCreateBlockerForAction(action.id)}
|
||||
onUnplanToBacklog={onUnplanToBacklog}
|
||||
canManage={canManage}
|
||||
canManageBlocker={canManageBlocker}
|
||||
formBusy={formBusy}
|
||||
@@ -109,6 +111,7 @@ export function InitiativeActionsHub({
|
||||
roadmapItems={roadmapItems}
|
||||
workCycles={workCycles}
|
||||
activeWorkCycle={activeWorkCycle}
|
||||
allActions={actions}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -2,6 +2,18 @@ import { useState } from 'react'
|
||||
import { StatusBadge } from './StatusBadge.jsx'
|
||||
import { EmptyState } from './EmptyState.jsx'
|
||||
|
||||
const SPRINT_LIFECYCLE = [
|
||||
{ key: 'planned', label: 'Planung' },
|
||||
{ key: 'active', label: 'Ausführung' },
|
||||
{ key: 'reached', label: 'Abgeschlossen' },
|
||||
]
|
||||
|
||||
function lifecycleStepIndex(status) {
|
||||
if (status === 'reached') return 2
|
||||
if (status === 'active' || status === 'at_risk') return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
export function WorkCyclesPanel({
|
||||
workCycles = [],
|
||||
activeWorkCycle = null,
|
||||
@@ -31,6 +43,18 @@ export function WorkCyclesPanel({
|
||||
setGoal('')
|
||||
}
|
||||
|
||||
async function handleComplete(cycle) {
|
||||
const openCount = actionCountByCycleId[cycle.id] || 0
|
||||
if (openCount > 0) {
|
||||
const ok = window.confirm(
|
||||
`Sprint „${cycle.title}" hat noch ${openCount} offene Arbeitspaket${openCount === 1 ? '' : 'e'}. ` +
|
||||
'Trotzdem abschließen? Offene APs bleiben dem Sprint zugeordnet und können in den Eingang zurückgeschoben werden.',
|
||||
)
|
||||
if (!ok) return
|
||||
}
|
||||
await onComplete(cycle.id)
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="card work-cycles-panel">
|
||||
<div className="section-header">
|
||||
@@ -39,6 +63,7 @@ export function WorkCyclesPanel({
|
||||
<p className="section-lead muted">
|
||||
Sprint anklicken, um den geplanten Sprint-Backlog zu sehen — aktiv oder geplant.
|
||||
Committete Arbeitspakete aus dem Eingang erscheinen beim gewählten Sprint.
|
||||
Lebenszyklus: Planung → Ausführung → Abschluss (Scrum).
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -95,6 +120,7 @@ export function WorkCyclesPanel({
|
||||
{workCycles.map((cycle) => {
|
||||
const isSelected = selectedSprintId === cycle.id
|
||||
const apCount = actionCountByCycleId[cycle.id] || 0
|
||||
const step = lifecycleStepIndex(cycle.status)
|
||||
return (
|
||||
<li
|
||||
key={cycle.id}
|
||||
@@ -113,6 +139,25 @@ export function WorkCyclesPanel({
|
||||
<span className="muted work-cycle-row__count">
|
||||
{apCount} AP{apCount === 1 ? '' : 's'}
|
||||
</span>
|
||||
<div className="work-cycle-lifecycle muted" aria-label="Sprint-Lebenszyklus">
|
||||
{SPRINT_LIFECYCLE.map((phase, index) => (
|
||||
<span
|
||||
key={phase.key}
|
||||
className={
|
||||
'work-cycle-lifecycle__step' +
|
||||
(index === step ? ' work-cycle-lifecycle__step--current' : '') +
|
||||
(index < step ? ' work-cycle-lifecycle__step--done' : '')
|
||||
}
|
||||
>
|
||||
{phase.label}
|
||||
{index < SPRINT_LIFECYCLE.length - 1 && (
|
||||
<span className="work-cycle-lifecycle__sep" aria-hidden="true">
|
||||
→
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
{cycle.goal_description && (
|
||||
<p className="muted item-meta">{cycle.goal_description}</p>
|
||||
)}
|
||||
@@ -123,7 +168,7 @@ export function WorkCyclesPanel({
|
||||
type="button"
|
||||
className="btn btn-secondary btn-sm"
|
||||
disabled={busy}
|
||||
onClick={() => onComplete(cycle.id)}
|
||||
onClick={() => handleComplete(cycle)}
|
||||
>
|
||||
Abschließen
|
||||
</button>
|
||||
|
||||
@@ -61,6 +61,22 @@ export const BACKLOG_STATUS_LABELS = {
|
||||
converted: 'Umgewandelt',
|
||||
}
|
||||
|
||||
export const BACKLOG_ITEM_KINDS = ['story', 'bug', 'issue']
|
||||
export const BACKLOG_ITEM_KIND_LABELS = {
|
||||
story: 'Story',
|
||||
bug: 'Bug',
|
||||
issue: 'Issue',
|
||||
}
|
||||
|
||||
export const ACTION_KINDS = ['delivery', 'planning', 'review', 'bug', 'issue']
|
||||
export const ACTION_KIND_LABELS = {
|
||||
delivery: 'Lieferung',
|
||||
planning: 'Planung',
|
||||
review: 'Review',
|
||||
bug: 'Bugfix',
|
||||
issue: 'Issue',
|
||||
}
|
||||
|
||||
export const MILESTONE_STATUS_LABELS = {
|
||||
planned: 'Geplant',
|
||||
active: 'Aktiv',
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
createInitiativeAction,
|
||||
updateInitiative,
|
||||
} from '../api/initiatives.js'
|
||||
import { updateAction, setActionAssignments } from '../api/actions.js'
|
||||
import { updateAction, setActionAssignments, unplanActionToBacklog } from '../api/actions.js'
|
||||
import { saveInitiativeDynamicFields, splitInitiativeFormPayload } from '../api/entityFields.js'
|
||||
import {
|
||||
listInitiativeBlockers,
|
||||
@@ -84,6 +84,7 @@ import { useSession } from './SessionContext.jsx'
|
||||
import { useOptionalProgramScope } from './ProgramScopeContext.jsx'
|
||||
import { collectProjectSubtreeIds } from '../utils/projectTree.js'
|
||||
import { filterActionsForWorkCycle } from '../utils/workCycleActions.js'
|
||||
import { listFeatureParentActions } from '../utils/actionReferences.js'
|
||||
|
||||
const InitiativeOperationsContext = createContext(null)
|
||||
|
||||
@@ -262,6 +263,29 @@ export function InitiativeOperationsProvider({ children, initiativeId: initiativ
|
||||
}
|
||||
}
|
||||
|
||||
function applyUnplanResult(result) {
|
||||
if (!result) return
|
||||
const backlogItem = result.backlog_item
|
||||
const action = result.action
|
||||
if (backlogItem?.id) {
|
||||
setBacklogItems((prev) => {
|
||||
const exists = prev.some((item) => item.id === backlogItem.id)
|
||||
if (exists) {
|
||||
return prev.map((item) => (item.id === backlogItem.id ? backlogItem : item))
|
||||
}
|
||||
return [...prev, backlogItem]
|
||||
})
|
||||
}
|
||||
if (action?.id) {
|
||||
setActions((prev) => prev.map((a) => (a.id === action.id ? action : a)))
|
||||
}
|
||||
}
|
||||
|
||||
const featureParentActions = useMemo(
|
||||
() => listFeatureParentActions(actions),
|
||||
[actions],
|
||||
)
|
||||
|
||||
const actionContextById = useMemo(
|
||||
() => Object.fromEntries((steeringSnapshot?.actions || []).map((a) => [a.id, a])),
|
||||
[steeringSnapshot]
|
||||
@@ -511,6 +535,20 @@ export function InitiativeOperationsProvider({ children, initiativeId: initiativ
|
||||
}
|
||||
}
|
||||
|
||||
async function handleUnplanAction(action) {
|
||||
if (!action?.id) return
|
||||
setFormBusy(true)
|
||||
setError(null)
|
||||
try {
|
||||
const result = await unplanActionToBacklog(action.id)
|
||||
applyUnplanResult(result)
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
setFormBusy(false)
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCreateWorkCycle(body) {
|
||||
setFormBusy(true)
|
||||
try {
|
||||
@@ -861,6 +899,7 @@ export function InitiativeOperationsProvider({ children, initiativeId: initiativ
|
||||
initiativeId: id,
|
||||
initiative,
|
||||
actions,
|
||||
featureParentActions,
|
||||
visibleActions,
|
||||
blockers,
|
||||
unlinkedBlockers,
|
||||
@@ -919,6 +958,7 @@ export function InitiativeOperationsProvider({ children, initiativeId: initiativ
|
||||
handleBacklogStatus,
|
||||
handleConvertBacklog,
|
||||
handleBulkConvertBacklog,
|
||||
handleUnplanAction,
|
||||
handleCreateWorkCycle,
|
||||
handleActivateWorkCycle,
|
||||
handleCompleteWorkCycle,
|
||||
|
||||
@@ -8,6 +8,7 @@ export function InitiativeInboxPage() {
|
||||
initiativeId,
|
||||
backlogItems,
|
||||
roadmapItems,
|
||||
featureParentActions,
|
||||
workCycles,
|
||||
activeWorkCycle,
|
||||
capabilities,
|
||||
@@ -39,6 +40,7 @@ export function InitiativeInboxPage() {
|
||||
items={backlogItems}
|
||||
initiativeId={initiativeId}
|
||||
roadmapItems={roadmapItems}
|
||||
featureActions={featureParentActions}
|
||||
workCycles={workCycles}
|
||||
activeWorkCycle={activeWorkCycle}
|
||||
sprintPlanningEnabled={isProductArchetype}
|
||||
|
||||
@@ -43,6 +43,7 @@ function PlanSprintInner() {
|
||||
handleUpdateAction,
|
||||
handleQuickStatus,
|
||||
handleCreateBlockerForAction,
|
||||
handleUnplanAction,
|
||||
} = ops
|
||||
|
||||
const actionCountByCycleId = useMemo(
|
||||
@@ -103,6 +104,7 @@ function PlanSprintInner() {
|
||||
onUpdateAction={handleUpdateAction}
|
||||
onQuickStatus={handleQuickStatus}
|
||||
onCreateBlockerForAction={handleCreateBlockerForAction}
|
||||
onUnplanToBacklog={handleUnplanAction}
|
||||
canManage={capabilities.has('kairo.action.manage')}
|
||||
canManageBlocker={capabilities.has('kairo.blocker.manage')}
|
||||
formBusy={formBusy}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* Feature-Arbeitspakete, auf die Bugs/Issues referenzieren können.
|
||||
* @param {Array<{ id: string, title: string, action_kind?: string, parent_action_id?: string, status?: string }>} actions
|
||||
*/
|
||||
export function listFeatureParentActions(actions) {
|
||||
return (actions || []).filter(
|
||||
(action) =>
|
||||
action.status !== 'discarded' &&
|
||||
action.status !== 'done' &&
|
||||
!['bug', 'issue'].includes(action.action_kind) &&
|
||||
!action.parent_action_id,
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array<{ id: string, title: string }>} actions
|
||||
* @param {string | null | undefined} actionId
|
||||
*/
|
||||
export function actionTitleById(actions, actionId) {
|
||||
if (!actionId) return ''
|
||||
const match = (actions || []).find((action) => action.id === actionId)
|
||||
return match?.title || ''
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { listFeatureParentActions, actionTitleById } from './actionReferences.js'
|
||||
|
||||
describe('actionReferences', () => {
|
||||
const actions = [
|
||||
{ id: 'f1', title: 'Login', action_kind: 'delivery', status: 'open' },
|
||||
{ id: 'b1', title: 'Bug', action_kind: 'bug', status: 'open', parent_action_id: 'f1' },
|
||||
{ id: 'd1', title: 'Done', action_kind: 'delivery', status: 'done' },
|
||||
]
|
||||
|
||||
it('listFeatureParentActions excludes bugs and done', () => {
|
||||
const features = listFeatureParentActions(actions)
|
||||
expect(features.map((a) => a.id)).toEqual(['f1'])
|
||||
})
|
||||
|
||||
it('actionTitleById resolves title', () => {
|
||||
expect(actionTitleById(actions, 'f1')).toBe('Login')
|
||||
expect(actionTitleById(actions, 'missing')).toBe('')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user