grafana-jump: fix dark-mode inputs, add repo-shared config - #39
Merged
Conversation
Config modal inputs relied on the browser's default text/background colors, which dark-mode browsers render illegibly against the modal's fixed light panel - now explicitly styled. Also lets a repo publish shared dashboard config via .github/jump-links.config.yaml, fetched from raw.githubusercontent.com so it works without any auth. A contributor's personal config still wins outright wherever it applies; the repo config is only a fallback for pages nobody has personally configured. The config panel gains "Create repo config template" and "Export my config to repo" buttons that hand off to GitHub's own create-file UI, so the userscript never touches git history itself - export unions the two configs (deduped by dashboard uid) rather than overwriting the repo's file. Adds this repo's own .github/jump-links.config.yaml as a live example.
Userscript Version PreviewPreview only — versions and CHANGELOGs are bumped automatically on merge to
|
Jump targets previously mapped one page context to exactly one filter
value (branch, PR number, workflow file, or runner ID). Extends the
page-provided field set to include the repo name, runner group, workflow
run ID, and job ID, and generalizes matching so a target only shows up
when *every* field it's configured to use is actually present on the
current page - not just one, since different targets now legitimately
need different combinations (e.g. a "span for this job" target needs
both a run ID and a job ID, which only coexist on a job's own page).
Adds two new page contexts to source those fields: a workflow run's
own page (optionally drilled into one job), and an org's runner group
detail page.
Also adds a second kind of jump target alongside the existing Grafana
dashboard link: a Tempo trace search, built as a Grafana Explore TraceQL
query with `{{fieldKey}}` placeholders filled in from the current page.
A target's required fields are inferred from its varNames (dashboard)
or its query's placeholders (trace), so no separate "required fields"
list needs to be kept in sync by hand.
Fixes a latent bug in the YAML-lite parser surfaced by this: it quoted
values containing embedded double quotes (like a TraceQL query) on
write but never unescaped them on read, so such a value wouldn't
round-trip through the checked-in config file correctly.
Updates the repo config template and this repo's own example config
with five examples: workflow runs for this repo, for this branch, and
on this runner, plus a trace for a workflow run and a span for one job.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
background/coloron inputs instead of relying on default form-control styling..github/jump-links.config.yaml, fetched viaGM.xmlHttpRequestfromraw.githubusercontent.com(no auth required). A contributor's personal config still wins outright for any page it covers; the repo config is only used as a fallback where nobody has personally configured a target.{{fieldKey}}placeholders filled in from the current page - for when there's no dashboard UID to jump to, only a trace/span to search for..github/jump-links.config.yamlas a live example with five targets: workflow runs for this repo, for this branch, and on this runner, plus a trace for a workflow run and a span for one job.Changes
packages/github-actions-grafana-jump/src/index.ts: dark-mode input fix; repo-config discovery/fetching (fetchRepoConfig,resolveDefaultBranch) with a hand-rolled YAML-lite parser/serializer (parseYamlLite/configToYamlLite) to avoid a third-party@required YAML library;repoContextForJump;activeDashboards(personal-wins-else-repo-fallback);mergeConfigsForExport(deduped union);buildCreateFileUrlfor the GitHub create-file deep link; newRunContext/RunnerGroupContext; a generalizedcontextFields/requiredFields/applicableDashboards(all-fields-required matching); a newTraceTargetjump-target type alongside the existing dashboard target, withbuildTraceExploreUrl/renderTemplate; expanded config-panel UI (target type selector, 8 filterable fields, trace-specific fields, repo-sync buttons).packages/github-actions-grafana-jump/src/meta.json: addedGM.xmlHttpRequestgrant and@connectentries forraw.githubusercontent.com/api.github.com.packages/github-actions-grafana-jump/test/grafana-jump.test.js: unit tests for all of the above..github/jump-links.config.yaml: example/dogfood config for this repo.Test plan
tsc --build) compiles cleanly.node --test) pass, including the new context-parsing, multi-field applicability, trace-target URL-building, and YAML-lite round-trip cases.