Home page: can't pick or create a workspace when creating a new board #79
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_whiteboard#79
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Bug
The boards home page (
/web/home.html) doesn't expose any way to organize boards into workspaces from the user-facing flow:workspace.createis reachable only from the admin dashboard at/index.html-- a normal user landing on the home page can't create a workspace at all.workspace_id. There is no per-board workspace picker -- if the user has "All Workspaces" selected, the board is created without any workspace; if they have a workspace selected, every new board they make goes there with no chance to choose otherwise.Net effect: a user clicking "New Board" cannot intentionally pick which workspace the board goes in, and cannot create a workspace from the page they're on.
Reproduction
/web/home) as a user with no admin access to the dashboard.Affected file
crates/hero_whiteboard_ui/templates/web/home.htmlloadWorkspaces(53-72)onWorkspaceChange(74-80)createNewBoard(141-152)No server / SDK / openrpc / DB changes are needed --
workspace.create,workspace.list, andboard.create(with optionalworkspace_id) already exist in the JSON-RPC surface (seestatic/openrpc.jsonandstatic/js/dashboard.js:305for the existing admin call).Expected behavior
Fix sketch
Replace the silent
createNewBoardflow with a small modal (matching the existing rename modal at lines 25-44) that asks for:workspace.createfirst and thenboard.createwith the resultingworkspace_id.Also add the same "+ New workspace..." sentinel option to the top-of-page filter dropdown so users can create a workspace without first clicking "New Board". Selecting it prompts for a name, calls
workspace.create, refreshes the list, and selects the new workspace.The existing filter dropdown's behavior (filter the visible board list) should be preserved. Optionally pre-select the currently filtered workspace as the default in the new-board modal so users who are already scoped to a workspace get the expected default.
Acceptance criteria
workspace.createand the board is created with its id.workspace.create, refreshes the list, selects the new workspace, and reloads boards. Cancelling reverts the dropdown to the previous selection so it doesn't get stuck on the sentinel.crates/hero_whiteboard_ui/templates/web/home.html(no server / SDK / openrpc edits).Implementation Spec for Issue #79
Objective
Let users pick or create a workspace for a new board directly from the home page, and let them create a workspace from the page-level dropdown without having to use the admin dashboard.
Requirements
(no workspace)and+ New workspace....+ New workspace...reveals an inline name input. On submit,workspace.createis called first, thenboard.createwith the resultingworkspace_id.+ New workspace...sentinel option that prompts for a name, callsworkspace.create, refreshes the dropdown, and selects the new workspace. Cancelling reverts the dropdown to the previous selection.Files to Modify
crates/hero_whiteboard_ui/templates/web/home.html— workspace dropdown markup,loadWorkspaces,onWorkspaceChange,createNewBoard, plus a new modal and helper functions.Implementation Plan
Step 1: Add
+ New workspace...to the filter dropdownFiles:
crates/hero_whiteboard_ui/templates/web/home.htmlloadWorkspaces(lines 53-72), after appending existing workspace options, append a sentinel<option value="__new__">+ New workspace...</option>.onWorkspaceChange(lines 74-80), if the selected value is__new__, immediately revert the visible selection tocurrentWorkspaceId(so cancel doesn't strand the dropdown), thenprompt(...)for a name, callrpcCall('workspace.create', { name }), await it, then callloadWorkspaces(), setcurrentWorkspaceIdto the new id, persist to localStorage, and callloadBoards(). On error,alertthe message.Dependencies: none.
Step 2: Add a New-Board modal with workspace picker + inline workspace creation
Files:
crates/hero_whiteboard_ui/templates/web/home.htmlNew Board.Nameinput (defaultUntitled Board, focused on open).Workspace<select id="new-board-ws-select">populated with(no workspace)+ every existing workspace ++ New workspace....<div id="new-board-new-ws">containing aNew workspace nameinput. Visible only when the picker value is__new__.createNewBoard(lines 141-152) withopenNewBoardModal()that pre-fills the name field withUntitled Board, populates the workspace select (reusing the workspace list cached fromloadWorkspaces), pre-selectscurrentWorkspaceIdif any, hides the new-workspace input, and shows the modal.closeNewBoardModal()and a select-change handler that toggles the new-workspace name input visibility.submitNewBoard():Untitled Boardif empty).__new__, read the new-workspace name (trim). If empty,alertand bail.__new__,await rpcCall('workspace.create', { name })and use its id. Otherwise, parse the value if non-empty, leave undefined if(no workspace).params = { name }, setparams.workspace_id = wsIdonly when defined.await rpcCall('board.create', params), thenwindow.location.href = WB_BASE + '/board/' + board.id(matches existing flow).alertthe message and keep the modal open. The existing fallback (/board/local-...on RPC failure) is intentionally not reused here because failing to create a workspace shouldn't drop the user into a local board.loadWorkspacesin a module-scope variable (var workspacesCache = []) so the new-board modal can populate without an extra RPC each time.onclick="openNewBoardModal()"on the existingNew Boardbutton (line 14-16) instead ofcreateNewBoard().Dependencies: Step 1 (Step 2 reuses the
workspacesCachepopulated byloadWorkspaces; Step 1's edits toloadWorkspacesare a good place to also populate the cache).Acceptance Criteria
New Boardopens a modal with a board-name input and a workspace picker.(no workspace)and+ New workspace....+ New workspace...reveals an inline name input. On Create,workspace.createis called first, thenboard.createwith the new workspace's id.All Workspaces, the modal defaults to(no workspace).+ New workspace...sentinel option that prompts for a name and creates a workspace viaworkspace.create. Cancelling reverts the dropdown.All Workspaces.crates/hero_whiteboard_ui/templates/web/home.html.Notes
workspace.createis already instatic/openrpc.json:69and used bystatic/js/dashboard.js:305. No server changes are required.board.createalready accepts an optionalworkspace_id(static/openrpc.json:195).var(--wb-...)CSS variables, match button classes).rpcCallhelper fromstatic/js/whiteboard/rpc.js.Test Results
cargo test --workspace --lib: 4 lib targets, 0 tests / 0 passed / 0 failed each (no Rust unit tests for these crates).cargo clippy --workspace -- -D warnings: clean.cargo check --workspace: clean (template and embedded JS compile via Askama).This is an HTML-template-only change. Manual verification recommended:
+ New workspace...option exists at the bottom.+ New workspace..., enter a name, confirm the workspace is created and selected; cancel via Escape and confirm the dropdown reverts.New Board— confirm a modal opens with name and workspace fields.+ New workspace...in the modal, enter a name plus a board name, click Create. Confirm the workspace is created, then the board is created in it, and the page navigates to the new board.(no workspace)and with an existing workspace selected; confirm the board lands in the right workspace.Implementation Summary
Changes
crates/hero_whiteboard_ui/templates/web/home.html(+146 / -18)New Boardmodal (board-name input + workspace picker + inline new-workspace name input).createNewBoard()flow withopenNewBoardModal() / submitNewBoard()driven by the new modal.submitNewBoardcallsworkspace.createfirst when+ New workspace...is selected, thenboard.createwith the resultingworkspace_id.+ New workspace...sentinel option to the existing top-of-page workspace filter dropdown. Picking it reverts the visible selection so a cancel doesn't strand the dropdown, prompts for a name, callsworkspace.create, refreshes the list, and selects the new workspace.workspacesCache) inloadWorkspacesso the new-board modal can populate without an extra RPC every time it opens.Why this lives entirely in one template
The JSON-RPC surface already supports everything needed:
workspace.create(static/openrpc.json:69, used today only by the admin dashboard atstatic/js/dashboard.js:305) andboard.createwith optionalworkspace_id(static/openrpc.json:195). No server / SDK / openrpc / DB changes.Verification
cargo test --workspace --libpasses (4 lib targets, 0 tests).cargo clippy --workspace -- -D warnings: clean.cargo check --workspace: clean (Askama compiled the template successfully).Notes / caveats