Skip to content
This repository was archived by the owner on Jun 23, 2026. It is now read-only.

feat: add board (dashboard) CRUD commands - #6

Open
beengud wants to merge 1 commit into
observeinc:mainfrom
beengud:upstream/feat-board-commands
Open

feat: add board (dashboard) CRUD commands#6
beengud wants to merge 1 commit into
observeinc:mainfrom
beengud:upstream/feat-board-commands

Conversation

@beengud

@beengud beengud commented Jun 2, 2026

Copy link
Copy Markdown

Summary

Adds a full suite of observe board subcommands for managing Observe dashboards programmatically:

Command Description
observe list board List all dashboards in a workspace
observe get board <id> Fetch a single dashboard by ID (JSON)
observe board create <file.json> Create a new dashboard from a JSON definition
observe board update <id> <file.json> Update an existing dashboard
observe board scaffold <dsid> Generate a starter dashboard template for a dataset
observe delete board <id> Delete a dashboard
observe board set-default <dsid> <bid> Set the default board for a dataset
observe board clear-default <dsid> Clear the default board for a dataset

Bug fixes included

Three bugs were found and fixed while implementing this:

  1. workspaceId array typelistBoards query requires workspaceId: [ObjectId!]! (array), not a scalar
  2. Read-only updatedDate field — the saveDashboard mutation rejects updatedDate; strip it from input before sending
  3. Missing stage.inputDashboardStageInput requires input: [] to be present (not null/absent); normalize missing values to []

Files

  • cmd_board.go — CLI command handlers
  • ot_board.go — GraphQL operations (listBoards, getDashboard, saveDashboard, deleteDashboard, setDefaultBoard, clearDefaultBoard)
  • docs/board.md — usage documentation
  • cmd_board_search_test.go — unit tests for board list filtering

* feat: add board (dashboard) command and object type

* fix: board list workspaceId must be array type [ObjectId!]

* fix: strip read-only fields (updatedDate) from board input before saveDashboard mutation

The Observe API returns updatedDate in board responses but does not accept
it in the DashboardInput type. Sending it causes GRAPHQL_VALIDATION_FAILED.

* fix: normalize missing stage input to [] for DashboardStageInput GraphQL type

The saveDashboard mutation requires stages[n].input to be defined.
Pure pipeline stages (no dataset input) omit the field entirely, causing
GRAPHQL_VALIDATION_FAILED. Default missing input to empty array.

* feat: enhance board list with dashboardSearch and add set/clear-default commands

Adds --name and --folder flags to `observe list board` to trigger dashboardSearch
with filter terms instead of the plain workspace list. The global --workspace flag
(cfg.WorkspaceIdOrName) is used as the workspace filter when search is active.

Adds `observe board set-default <dataset-id> <board-id>` and
`observe board clear-default <dataset-id>` subcommands using
setDefaultDashboard / clearDefaultDashboard mutations.

Includes unit tests in cmd_board_search_test.go covering:
- Plain list (no flags) uses dashboards field
- Name filter triggers dashboardSearch results field
- Workspace-via-config passes through to search terms
- Folder filter triggers dashboardSearch
- Empty results produces header-only output
- unpackBoardItems helper tested directly

Closes #10
Closes #12

---------

Co-authored-by: Aaron Brewbaker <abrewbaker@nhl.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant