feat(kanban): drag-to-delete trash zone + bulk delete for task cards
Salvages #28125 by @Jpalmer95. Adds: - Drag-to-delete trash zone in the kanban dashboard - Bulk delete endpoint with cascading delete_task cleanup - Frontend updates (drag visual + drop handler) - Confirmation prompt before delete Resolved end-of-file test conflict by appending both halves.
This commit is contained in:
@@ -816,6 +816,34 @@ def test_list_tasks_order_by(kanban_home):
|
||||
except ValueError as e:
|
||||
assert "order_by must be one of" in str(e)
|
||||
|
||||
def test_delete_task_removes_task_and_cascades(kanban_home):
|
||||
with kb.connect() as conn:
|
||||
t = kb.create_task(conn, title="to-delete", assignee="alice")
|
||||
kb.add_comment(conn, t, "user", "comment")
|
||||
kb.add_comment(conn, t, "user", "another")
|
||||
assert kb.delete_task(conn, t)
|
||||
assert kb.get_task(conn, t) is None
|
||||
assert len(kb.list_comments(conn, t)) == 0
|
||||
assert len(kb.list_events(conn, t)) == 0
|
||||
assert len(kb.list_runs(conn, t)) == 0
|
||||
|
||||
|
||||
def test_delete_task_returns_false_for_missing_task(kanban_home):
|
||||
with kb.connect() as conn:
|
||||
assert not kb.delete_task(conn, "t_nonexistent")
|
||||
|
||||
|
||||
def test_delete_task_cascades_links(kanban_home):
|
||||
with kb.connect() as conn:
|
||||
p = kb.create_task(conn, title="parent")
|
||||
c = kb.create_task(conn, title="child", parents=[p])
|
||||
child = kb.get_task(conn, c)
|
||||
assert child is not None and child.status == "todo"
|
||||
kb.delete_task(conn, p)
|
||||
assert kb.get_task(conn, p) is None
|
||||
child_after = kb.get_task(conn, c)
|
||||
assert child_after is not None and child_after.status == "ready"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Comments / events / worker context
|
||||
|
||||
@@ -485,6 +485,33 @@ def test_patch_status_running_rejected(client):
|
||||
assert statuses.get(t["id"]) != "running"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# DELETE /tasks/:id
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
def test_delete_task(client):
|
||||
t = client.post("/api/plugins/kanban/tasks", json={"title": "to-delete"}).json()["task"]
|
||||
r = client.delete(f"/api/plugins/kanban/tasks/{t['id']}")
|
||||
assert r.status_code == 200
|
||||
assert r.json()["deleted"] is True
|
||||
assert r.json()["task_id"] == t["id"]
|
||||
|
||||
# Gone from board
|
||||
board = client.get("/api/plugins/kanban/board").json()
|
||||
all_ids = [tt["id"] for col in board["columns"] for tt in col["tasks"]]
|
||||
assert t["id"] not in all_ids
|
||||
|
||||
# Gone from detail
|
||||
r = client.get(f"/api/plugins/kanban/tasks/{t['id']}")
|
||||
assert r.status_code == 404
|
||||
|
||||
|
||||
def test_delete_task_not_found(client):
|
||||
r = client.delete("/api/plugins/kanban/tasks/t_nonexistent")
|
||||
assert r.status_code == 404
|
||||
assert "not found" in r.json()["detail"]
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Comments + Links
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user