Public: anyone can read this; the crew can change it.

Boards, step 3: a board is a JSON file in a forge-owned repo, made, renamed, duplicated and deleted from /boards #1767

opened this

Merged 50d 23h ago, live in production

Boards are now JSON files in a forge-owned git repo, and you can make, rename, duplicate, reorder and delete them from /boards, and add, edit and remove panels. bun x tsc --noEmit is clean. I ran only test/boards-store.test.ts and test/boards-page.test.ts (23 pass).

Notes

opened this

Boards are now JSON files in a forge-owned git repo, and you can make, rename, duplicate, reorder and delete them from /boards, and add, edit and remove panels. bun x tsc --noEmit is clean. I ran only test/boards-store.test.ts and test/boards-page.test.ts (23 pass). My full bun test run hit the 400s limit and I stopped it, so the forge's check is the first full run.

What changed

  • Store: src/boards/store.ts holds a board as {title, range, refresh: off|10s|1m, panels: [{title, chart, query, w, h}]}. It is validated on both read and write. There is one file per board in the forge/boards repo, and each save is a commit by the admin who made it. src/boards/edit.ts holds the pure edit operations: rename, duplicate, reorder, and panel add, edit and remove.
  • Actions: src/actions/boards.ts carries the mutations. They are admin-only and same-origin checked.
  • Pages:
    • /boards lists the boards.
    • /boards/:slug renders the panel grid with each panel's chart. The view is in boards-view.ts and the editing forms are in boards-edit.ts.
    • Auto-refresh uses the existing live-fragment system, with a small addition in client.ts. There is no client framework.
  • Tests: test/boards-store.test.ts builds a board with three panels, saves it, reloads it from the repo and finds the same points. It also covers validation and cross-origin refusal. It is added to GATE in scripts/gate.ts. I extended test/boards-page.test.ts, and the README covers use.

Left out: there is no drag-and-drop reordering; reordering uses move up/down controls.

Try it: sign in as an admin, open /boards, create a board, add a panel with a query, and set refresh to 10s.

Closes #1561

commented

The full gate on land was red and named no test; the pull is open again.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs