fix: Sprint-Planung einsehbar und Eingang ohne Voll-Reload.
Deploy Development / deploy (push) Successful in 52s
Test Suite / pytest-backend (push) Successful in 2m46s
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 12s
Deploy Development / deploy (push) Successful in 52s
Test Suite / pytest-backend (push) Successful in 2m46s
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 12s
Geplante Sprints in Plan anwaehlbar, lokales Update beim Commit, Sprint-Auswahl bleibt erhalten. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
c19b6296ed
commit
e221b5b09f
8 files changed
+269
-70
No files matched your search
@@ -83,6 +83,7 @@ import { useActors } from '../hooks/useActors.js'
|
||||
import { useSession } from './SessionContext.jsx'
|
||||
import { useOptionalProgramScope } from './ProgramScopeContext.jsx'
|
||||
import { collectProjectSubtreeIds } from '../utils/projectTree.js'
|
||||
import { filterActionsForWorkCycle } from '../utils/workCycleActions.js'
|
||||
|
||||
const InitiativeOperationsContext = createContext(null)
|
||||
|
||||
@@ -118,10 +119,11 @@ export function InitiativeOperationsProvider({ children, initiativeId: initiativ
|
||||
const [editingAction, setEditingAction] = useState(null)
|
||||
const [formBusy, setFormBusy] = useState(false)
|
||||
const [hideDone, setHideDone] = useState(true)
|
||||
const [selectedWorkCycleId, setSelectedWorkCycleId] = useState('')
|
||||
|
||||
const load = useCallback(async () => {
|
||||
const load = useCallback(async ({ silent = false } = {}) => {
|
||||
if (sessionLoading || !id) return
|
||||
setLoading(true)
|
||||
if (!silent) setLoading(true)
|
||||
setError(null)
|
||||
try {
|
||||
const [initData, actionData] = await Promise.all([
|
||||
@@ -203,18 +205,63 @@ export function InitiativeOperationsProvider({ children, initiativeId: initiativ
|
||||
|
||||
const sprintActions = useMemo(() => {
|
||||
if (!activeWorkCycle?.id) return []
|
||||
const cycleId = activeWorkCycle.id
|
||||
let list = hideDone
|
||||
? actions.filter((a) => a.status !== 'done' && a.status !== 'discarded')
|
||||
: actions
|
||||
list = list.filter((a) => a.work_cycle_id === cycleId)
|
||||
if (selectedProjectId) {
|
||||
return filterActionsForWorkCycle(actions, activeWorkCycle.id, { hideDone }).filter((a) => {
|
||||
if (!selectedProjectId) return true
|
||||
const subtreeIds = collectProjectSubtreeIds(projects, selectedProjectId)
|
||||
list = list.filter((a) => a.project_id && subtreeIds.has(a.project_id))
|
||||
}
|
||||
return list
|
||||
return a.project_id && subtreeIds.has(a.project_id)
|
||||
})
|
||||
}, [actions, hideDone, activeWorkCycle?.id, selectedProjectId, projects])
|
||||
|
||||
const selectedSprintActions = useMemo(() => {
|
||||
if (!selectedWorkCycleId) return []
|
||||
return filterActionsForWorkCycle(actions, selectedWorkCycleId, { hideDone }).filter((a) => {
|
||||
if (!selectedProjectId) return true
|
||||
const subtreeIds = collectProjectSubtreeIds(projects, selectedProjectId)
|
||||
return a.project_id && subtreeIds.has(a.project_id)
|
||||
})
|
||||
}, [actions, hideDone, selectedWorkCycleId, selectedProjectId, projects])
|
||||
|
||||
const selectedWorkCycle = useMemo(
|
||||
() => workCycles.find((c) => c.id === selectedWorkCycleId) || null,
|
||||
[workCycles, selectedWorkCycleId],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedWorkCycleId && workCycles.some((c) => c.id === selectedWorkCycleId)) {
|
||||
return
|
||||
}
|
||||
if (activeWorkCycle?.id) {
|
||||
setSelectedWorkCycleId(activeWorkCycle.id)
|
||||
return
|
||||
}
|
||||
const planned = workCycles.find((c) => c.status === 'planned')
|
||||
if (planned) setSelectedWorkCycleId(planned.id)
|
||||
else if (workCycles[0]?.id) setSelectedWorkCycleId(workCycles[0].id)
|
||||
else setSelectedWorkCycleId('')
|
||||
}, [workCycles, activeWorkCycle, selectedWorkCycleId])
|
||||
|
||||
function applyConvertResults(results) {
|
||||
const list = Array.isArray(results) ? results : [results]
|
||||
for (const result of list) {
|
||||
if (!result) continue
|
||||
const backlogItem = result.backlog_item
|
||||
const action = result.action
|
||||
if (backlogItem?.id) {
|
||||
setBacklogItems((prev) =>
|
||||
prev.map((item) => (item.id === backlogItem.id ? backlogItem : item)),
|
||||
)
|
||||
}
|
||||
if (action?.id) {
|
||||
setActions((prev) => {
|
||||
if (prev.some((a) => a.id === action.id)) {
|
||||
return prev.map((a) => (a.id === action.id ? action : a))
|
||||
}
|
||||
return [...prev, action]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const actionContextById = useMemo(
|
||||
() => Object.fromEntries((steeringSnapshot?.actions || []).map((a) => [a.id, a])),
|
||||
[steeringSnapshot]
|
||||
@@ -423,12 +470,16 @@ export function InitiativeOperationsProvider({ children, initiativeId: initiativ
|
||||
|
||||
async function handleConvertBacklog(itemId, options = {}) {
|
||||
setFormBusy(true)
|
||||
setError(null)
|
||||
try {
|
||||
await convertBacklogToAction(itemId, {
|
||||
const result = await convertBacklogToAction(itemId, {
|
||||
assign_active_sprint: options.work_cycle_id ? false : options.assign_active_sprint ?? true,
|
||||
work_cycle_id: options.work_cycle_id,
|
||||
})
|
||||
await load()
|
||||
applyConvertResults(result)
|
||||
if (options.work_cycle_id) {
|
||||
setSelectedWorkCycleId(options.work_cycle_id)
|
||||
}
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
@@ -439,14 +490,20 @@ export function InitiativeOperationsProvider({ children, initiativeId: initiativ
|
||||
async function handleBulkConvertBacklog(itemIds, options = {}) {
|
||||
if (!itemIds.length) return
|
||||
setFormBusy(true)
|
||||
setError(null)
|
||||
try {
|
||||
for (const itemId of itemIds) {
|
||||
await convertBacklogToAction(itemId, {
|
||||
assign_active_sprint: options.work_cycle_id ? false : options.assign_active_sprint ?? true,
|
||||
work_cycle_id: options.work_cycle_id,
|
||||
})
|
||||
const results = await Promise.all(
|
||||
itemIds.map((itemId) =>
|
||||
convertBacklogToAction(itemId, {
|
||||
assign_active_sprint: options.work_cycle_id ? false : options.assign_active_sprint ?? true,
|
||||
work_cycle_id: options.work_cycle_id,
|
||||
}),
|
||||
),
|
||||
)
|
||||
applyConvertResults(results)
|
||||
if (options.work_cycle_id) {
|
||||
setSelectedWorkCycleId(options.work_cycle_id)
|
||||
}
|
||||
await load()
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
@@ -457,8 +514,9 @@ export function InitiativeOperationsProvider({ children, initiativeId: initiativ
|
||||
async function handleCreateWorkCycle(body) {
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await createWorkCycle(id, body)
|
||||
await load()
|
||||
const created = await createWorkCycle(id, body)
|
||||
await load({ silent: true })
|
||||
if (created?.id) setSelectedWorkCycleId(created.id)
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
@@ -470,7 +528,8 @@ export function InitiativeOperationsProvider({ children, initiativeId: initiativ
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await activateWorkCycle(id, workCycleId)
|
||||
await load()
|
||||
await load({ silent: true })
|
||||
setSelectedWorkCycleId(workCycleId)
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
@@ -482,7 +541,7 @@ export function InitiativeOperationsProvider({ children, initiativeId: initiativ
|
||||
setFormBusy(true)
|
||||
try {
|
||||
await completeWorkCycle(id, workCycleId)
|
||||
await load()
|
||||
await load({ silent: true })
|
||||
} catch (err) {
|
||||
setError(err.message)
|
||||
} finally {
|
||||
@@ -817,6 +876,10 @@ export function InitiativeOperationsProvider({ children, initiativeId: initiativ
|
||||
recurringItems,
|
||||
workCycles,
|
||||
activeWorkCycle,
|
||||
selectedWorkCycleId,
|
||||
setSelectedWorkCycleId,
|
||||
selectedWorkCycle,
|
||||
selectedSprintActions,
|
||||
sprintActions,
|
||||
steeringSnapshot,
|
||||
steeringSnapshotLoading,
|
||||
|
||||
Reference in new issue
Block a user