feat: status dropdown on task detail page
This commit is contained in:
parent
9cbb3cec37
commit
6e872121eb
4 changed files with 102 additions and 0 deletions
22
web/api.py
22
web/api.py
|
|
@ -137,6 +137,28 @@ def create_task(body: TaskCreate):
|
|||
return t
|
||||
|
||||
|
||||
class TaskPatch(BaseModel):
|
||||
status: str
|
||||
|
||||
|
||||
VALID_STATUSES = {"pending", "in_progress", "review", "done", "blocked"}
|
||||
|
||||
|
||||
@app.patch("/api/tasks/{task_id}")
|
||||
def patch_task(task_id: str, body: TaskPatch):
|
||||
if body.status not in VALID_STATUSES:
|
||||
raise HTTPException(400, f"Invalid status '{body.status}'. Must be one of: {', '.join(VALID_STATUSES)}")
|
||||
conn = get_conn()
|
||||
t = models.get_task(conn, task_id)
|
||||
if not t:
|
||||
conn.close()
|
||||
raise HTTPException(404, f"Task '{task_id}' not found")
|
||||
models.update_task(conn, task_id, status=body.status)
|
||||
t = models.get_task(conn, task_id)
|
||||
conn.close()
|
||||
return t
|
||||
|
||||
|
||||
@app.get("/api/tasks/{task_id}/pipeline")
|
||||
def get_task_pipeline(task_id: str):
|
||||
"""Get agent_logs for a task (pipeline steps)."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue