fix: login → /workspaces, workspace tree filtered, sidebar CRUD
FlowDeck CI / test (push) Failing after 4s
FlowDeck CI / docker (push) Has been skipped

- Login redirect (all modes) now goes to /workspaces
- Workspace tree API filters by active workspace_id (no leak)
- Workspace name in sidebar from cookie (active_ws_name)
- Sidebar workspace section: 📄 new page + 📁 new folder buttons
- deleteWorkspacePage() in sidebar with confirmation
- _load_workspace_pages() helper with workspace_id filter
- CSS for sidebar-item-delete button (× on hover)
This commit is contained in:
2026-07-10 19:26:03 -04:00
parent ae0b964859
commit 1ae4aa4ab4
4 changed files with 59 additions and 9 deletions
+11 -5
View File
@@ -482,10 +482,13 @@ async def local_workspace_page(request: Request):
if not user:
return RedirectResponse("/auth/login?provider=local", status_code=302)
ws = _get_active_workspace(request)
ws_id = ws["id"] if ws else None
with get_conn() as conn:
rows = conn.execute(
"SELECT id, title FROM pages WHERE parent_id IS NULL ORDER BY created_at DESC"
).fetchall()
"SELECT id, title FROM pages WHERE parent_id IS NULL AND workspace_id=? ORDER BY created_at DESC",
(ws_id,),
).fetchall() if ws_id else []
items = [{"id": r["id"], "name": r["title"] or "Untitled", "type": "page"} for r in rows]
ctx = {**sidebar, "user": user, "workspace_name": sidebar.get("active_ws_name", "My Workspace"), "items": items}
@@ -495,11 +498,14 @@ async def local_workspace_page(request: Request):
@router.get("/api/local-workspace/tree")
async def local_workspace_tree(request: Request):
"""Return the file/folder tree."""
"""Return the file/folder tree filtered by active workspace."""
ws = _get_active_workspace(request)
ws_id = ws["id"] if ws else None
with get_conn() as conn:
roots = conn.execute(
"SELECT id, title FROM pages WHERE parent_id IS NULL ORDER BY created_at DESC"
).fetchall()
"SELECT id, title FROM pages WHERE parent_id IS NULL AND workspace_id=? ORDER BY created_at DESC",
(ws_id,),
).fetchall() if ws_id else []
tree = []
for r in roots:
with get_conn() as conn: