Skip to content

feat(github-actions-grafana-jump): make the jump button fully generic - #24

Open
nsheaps-oura wants to merge 1 commit into
mainfrom
nate-ai/generic-grafana-jump
Open

feat(github-actions-grafana-jump): make the jump button fully generic#24
nsheaps-oura wants to merge 1 commit into
mainfrom
nate-ai/generic-grafana-jump

Conversation

@nsheaps-oura

@nsheaps-oura nsheaps-oura commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Reworks the Grafana jump button (merged via #4) so no Grafana instance, dashboard UID, or template-variable name is baked in:

  • Not configured: clicking the button opens an in-page config panel (not a native prompt()) to set a Grafana base URL and one or more dashboards, each with whichever template-variable names it uses for filtering by branch/PR/workflow/runner.
  • Configured: jumps straight to the first applicable dashboard for the current page, with a small "▾" menu to pick a different configured dashboard or reopen the config panel to edit the list.
  • Config persists via GM.setValue/GM.getValue (@grant changed from none to GM.setValue/GM.getValue).

This also resolves the reason the script's header said it was intentionally not published to GreasyFork (baked-in internal Oura infra links) — that constraint no longer applies now that it's fully user-configured. Not touched here: @downloadURL/@updateURL and the changeset/publish wiring — whether/how to actually publish is a separate decision, left for follow-up per the task.

The existing context-detection logic (parsePrContext, parseBranchContext, parseRunnerContext, parseWorkflowContext, resolveJumpContext, extractBranchFromQuery) is untouched. The still-unconfirmed TODO(nathan) about the two Oura dashboards' real template-variable names is now moot for this file's own contents (no dashboard config ships by default at all), not resolved as a general finding.

⚠️ CI dependency

This branch is based on pre-#23 main, so its own CI will fail on the same pre-existing moduleResolution/TypeScript-6.0.3 issue that #23 (#23) fixes — unrelated to this PR's actual changes. Will rebase onto main once #23 merges to get a clean CI run here.

Test plan

🤖 Generated with Claude Code

Reworks the Grafana jump button so no Grafana instance, dashboard UID,
or template-variable name is baked into the script. This also removes
the reason the script's header previously said it was intentionally
NOT published to GreasyFork (baked-in internal Oura infra links) -
that constraint is gone now that it's fully user-configured, though
whether/how to actually publish is a separate decision.

Behavior:
- Not configured yet -> the jump button opens an in-page config panel
  (not a native prompt) to set a Grafana base URL and one or more
  dashboards, each with whichever template-variable names it uses for
  filtering by branch/PR/workflow/runner.
- Configured -> jumps straight to the first applicable dashboard for
  the current page, with a small "▾" menu to jump to a different
  configured dashboard or reopen the config panel.
- Config persists via GM.setValue/GM.getValue (@grant changed from
  `none` to GM.setValue/GM.getValue accordingly), scoped to this
  script/browser.

The existing context-detection logic (parsePrContext,
parseBranchContext, parseRunnerContext, parseWorkflowContext,
resolveJumpContext, extractBranchFromQuery) is untouched. New pure,
unit-tested logic: contextVarKey/contextFilterValue (map a context to
its filter field/value), applicableDashboards (which configured
dashboards can handle this context), buildJumpUrl (per-dashboard URL
building), defaultConfig/normalizeConfig/isConfigured (config
lifecycle). test/grafana-jump.test.js updated accordingly - all 22
tests pass against the built dist/.

tsconfig.json: added an explicit "types": ["node", "greasemonkey"]
override. Under this repo's moduleResolution setting, tsc doesn't
reliably auto-discover @types packages from node_modules/@types the
way it does under other resolution modes, and this is now the one
package that references both @types/node's `module` (existing
test-export guard) and @types/greasemonkey's `GM` global.

Deliberately left alone per the task: the still-unconfirmed
TODO(nathan) about the two Oura dashboards' real template-variable
names is moot for the shipped script now (no dashboard config ships
by default at all - users fill in their own), but is not being
resolved as a general finding one way or the other; it just no longer
applies to this file's own contents.

Not touched, pending a separate decision: @downloadURL/@updateURL and
the changeset/publish wiring. Generic now, but publishing is a
follow-up call, not assumed here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant