feat(server): copy job YAML, Job YAML tab, syntax-highlighted job definition#1147
Open
mz2 wants to merge 4 commits into
Open
feat(server): copy job YAML, Job YAML tab, syntax-highlighted job definition#1147mz2 wants to merge 4 commits into
mz2 wants to merge 4 commits into
Conversation
Add a button on the job detail page that copies a submittable job-definition YAML (job_queue, provision_data, firmware_update_data, test_data, etc.) for the job being viewed, reconstructed via build_job_yaml() with multiline values rendered as YAML literal blocks. A small generic clipboard.js handles the copy. Also add local-development conveniences for testing the change: - bind-mount src/ in docker-compose and an env-guarded TEMPLATES_AUTO_RELOAD so view/template/static edits are picked up without rebuilding the image - include provision_data in create_sample_data.py so seeded jobs produce a representative copied YAML
Place the button on the same line as the Provision Data / Test Data tabs (right-aligned) instead of next to the Job Definition heading.
448fd6c to
826bb42
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1147 +/- ##
==========================================
- Coverage 77.90% 75.82% -2.08%
==========================================
Files 118 99 -19
Lines 12350 10499 -1851
Branches 1018 841 -177
==========================================
- Hits 9621 7961 -1660
+ Misses 2508 2366 -142
+ Partials 221 172 -49
*This pull request uses carry forward flags. Click here to find out more.
🚀 New features to boost your workflow:
|
…yntax Render the Provision/Firmware sections of the job detail page as YAML instead of a Python dict repr, add a "Job YAML" tab (the full submittable definition) shown by default, and syntax-highlight the YAML and the test_cmds script. Highlighting is done server-side with Pygments (a real, lockfile-tracked dependency) rather than a vendored JS bundle, so it needs no client-side JavaScript and works in offline/air-gapped deployments. A small generated Pygments stylesheet is loaded only on the job detail page. The "Copy job YAML" button keeps copying the clean, unhighlighted YAML from a dedicated hidden payload, so the clipboard output is unaffected.
826bb42 to
86bfdf0
Compare
ajzobro
requested changes
Jun 18, 2026
| </div> | ||
| {% endif %} | ||
| </div> | ||
| <button class="p-button--base has-icon" |
Collaborator
Contributor
There was a problem hiding this comment.
Yeah, I think its because the margin-bottom in CSS:
I was playing around and setting it to 0rem seems to at least not display that white border and it seems more inline with the tabs
rene-oromtz
reviewed
Jun 18, 2026
rene-oromtz
reviewed
Jun 18, 2026
rene-oromtz
left a comment
Contributor
There was a problem hiding this comment.
I really like how its getting displayed in the job view! Thanks for taking care of this! I just added a comment regarding pygments that might as well do it now given we are explicitly including it as dependency.
Co-authored-by: rene-oromtz <157750458+rene-oromtz@users.noreply.github.com>
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.

Overview
Adds a "Copy job YAML" button and a clearer job-definition view to the dashboard job detail page. The stored
job_datais reconstructed into a submittable job-definition YAML (theJobschema top-level fields, in schema order), shown in a default Job YAML tab and copyable to the clipboard in one click.What changed
New: Job YAML tab + Copy button
views.py):build_job_yaml()rebuilds a submittable definition from the storedjob_data, with multiline strings (e.g. the test script) rendered as literal|blocks.clipboard.js): a generic[data-copy-target]handler copies the clean, unhighlighted YAML from a hidden payload and shows brief "Copied!" feedback.Changed: how the existing Provision / Test tabs are presented
These tabs already existed but rendered their content awkwardly. This PR fixes the presentation:
dictrepr — e.g.{'distro': 'jammy'}— because the template emitted{{ job.job_data.provision_data }}directly. It now renders as YAML (distro: jammy) via a newas_yamlJinja filter. Rationale: the underlying job definition is YAML, so showing a Python repr was both inconsistent with how jobs are authored and harder to read for nested data; rendering YAML also matches the new Copy-job-YAML output exactly.test_data.test_cmds, which is a shell script — not a generic data structure. The tab was renamed from "Test Data" to "Test Script" to say what it actually is, and the script is now bash syntax-highlighted. Rationale: "Test Data" was misleading (it implied the wholetest_datamapping); "Test Script" is accurate, and highlighting a multi-line shell script makes it far easier to scan.Syntax highlighting
pygments.cssis loaded only on this page. Output is XSS-safe — Pygments HTML-escapes the content.Local-dev conveniences
docker-compose.ymlbind-mountssrc/and setsTEMPLATES_AUTO_RELOAD(env-guarded, default off, inapplication.py) for hot-reload without rebuilds;create_sample_data.pyseeds representativeprovision_data.Screenshots
Job YAML tab (new, shown by default) — full submittable definition, syntax-highlighted, with the Copy button on the tab row:
Provision Data tab — now rendered as YAML (
distro: jammy) instead of a Python repr:Test Script tab — renamed from "Test Data" (it always was including just the test_cmds), with bash syntax highlighting:
Testing
tests/test_views.py):build_job_yaml, theas_yamlandhighlightfilters (including HTML-escaping), the copy button/payload, and that sections render as YAML rather than a Python repr.No API changes, database migrations, or new endpoints.
TEMPLATES_AUTO_RELOADis development-only and defaults off.