fix(ansible): the playbook variables partial on classes; Run again assertion matches the link (#5331, #5332)
CI / lint (push) Successful in 3s
CI / integration (push) Successful in 1m17s
CI / unit (push) Successful in 1m39s
CI / publish (push) Successful in 1m49s

CI run 8705 on 0c72892: the schedule page's no-inline-style guard caught
_playbook_vars.html (shared by the run and schedule forms), and the run
page's Run again assertion left out the link's class.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 23:53:38 -04:00
co-authored by Claude Opus 5.5
parent 0c72892f58
commit 4acaa42a97
3 changed files with 29 additions and 25 deletions
+14
View File
@@ -387,6 +387,20 @@ a.stat-tile:hover { border-color: var(--border-mid); background: var(--bg-elevat
.playbook-source > summary { cursor: pointer; margin: 0; }
.playbook-source[open] > summary { margin-bottom: 0.75rem; }
.card-flush-note { margin: 0; padding: 0.75rem 1rem; }
/* A playbook's own words above its fields (_playbook_vars.html): what it does,
the destructive gate, then its variables. */
.pb-about { background: var(--bg); border-left: 3px solid var(--accent); border-radius: var(--fs-radius-sm);
padding: 0.5rem 0.7rem; margin: 0.25rem 0 0.6rem; font-size: 0.82rem; color: var(--text-muted); }
.pb-category { display: inline-block; margin-right: 0.4rem; padding: 0.05em 0.45em; border-radius: var(--fs-radius-sm);
background: var(--bg-elevated); color: var(--text-dim); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; }
.pb-confirm { display: flex; align-items: flex-start; gap: 0.5rem; margin: 0 0 0.6rem; padding: 0.6rem 0.8rem; cursor: pointer;
background: color-mix(in srgb, var(--red) 10%, var(--bg-elevated)); border: 1px solid color-mix(in srgb, var(--red) 35%, var(--border));
border-radius: 6px; font-size: 0.82rem; font-weight: normal; }
.pb-confirm input { margin-top: 0.15rem; }
.pb-confirm strong { color: var(--red); }
.pb-vars-title { margin: 0.5rem 0 0.25rem; font-size: 0.82rem; color: var(--text-muted); font-weight: 500; }
.pb-vars-hint { margin: 0 0 0.6rem; }
.pb-var-name { color: var(--text-muted); font-weight: normal; font-size: 0.76rem; }
/* Monospaced data: ids, limits, tags, paths. */
.mono { font-family: var(--fs-font-mono); font-size: 0.85em; }
/* The host page's health header (_host_vitals.html). */
+14 -24
View File
@@ -1,5 +1,5 @@
{# Description + discovered variable fields for a selected playbook. Shared by
the browse run form, host run form, and schedule form. Expects `variables`
the playbook page's run form and the schedule form. Expects `variables`
and `description`. Rendered standalone by /ansible/playbook-vars.
Optional: `values` (dict var-name→saved value, prefills fields for edit
forms) and `schedule` (True in the schedule form — schedules can't prompt,
@@ -7,57 +7,47 @@
{% set _values = values|default({}) %}
{% set _schedule = schedule|default(false) %}
{% if description or category %}
<div style="background:var(--bg);border-left:3px solid var(--accent);border-radius:3px;
padding:0.5rem 0.7rem;margin:0.25rem 0 0.6rem;font-size:0.82rem;color:var(--text-muted);">
{% if category %}<span style="display:inline-block;font-size:0.68rem;text-transform:uppercase;letter-spacing:0.04em;
background:var(--bg-elevated);color:var(--text-dim);border-radius:3px;padding:0.05em 0.45em;margin-right:0.4rem;">{{ category }}</span>{% endif %}
<div class="pb-about">
{% if category %}<span class="pb-category">{{ category }}</span>{% endif %}
{{ description }}
</div>
{% endif %}
{% if confirm %}
<label style="display:flex;align-items:flex-start;gap:0.5rem;background:color-mix(in srgb,var(--red) 10%,var(--bg-elevated));
border:1px solid color-mix(in srgb,var(--red) 35%,var(--border));border-radius:6px;
padding:0.6rem 0.8rem;margin:0 0 0.6rem;font-size:0.82rem;font-weight:normal;cursor:pointer;">
<input type="checkbox" name="confirmed" {% if not _schedule %}required{% endif %} style="margin-top:0.15rem;">
<span><strong style="color:var(--red);">Confirm:</strong> this playbook is marked as making
<label class="pb-confirm">
<input type="checkbox" name="confirmed" {% if not _schedule %}required{% endif %}>
<span><strong>Confirm:</strong> this playbook is marked as making
significant or destructive changes. Tick to enable running it.</span>
</label>
{% endif %}
{% if variables %}
<div style="margin:0.5rem 0 0.25rem;font-size:0.82rem;color:var(--text-muted);font-weight:500;">
Playbook variables
</div>
<p style="color:var(--text-dim);font-size:0.76rem;margin:0 0 0.6rem;">
<div class="pb-vars-title">Playbook variables</div>
<p class="field-hint pb-vars-hint">
Leave a field blank to use the playbook/inventory default. Secret fields are never stored.
</p>
{% for v in variables %}
<div class="form-group">
<label>
{{ v.prompt or v.name }}
<span style="color:var(--text-muted);font-weight:normal;font-size:0.76rem;">
<span class="pb-var-name">
({{ v.name }}{% if v.required %}, required{% endif %}{% if v.secret %}, secret{% endif %})
</span>
</label>
{% if v.secret and _schedule %}
{# Scheduled runs can't prompt, so secret vars are dropped downstream — show
the field disabled rather than inviting silent data loss. #}
<input type="text" disabled
placeholder="secrets can't be scheduled — set via inventory / global creds"
style="width:100%;font-family:ui-monospace,monospace;font-size:0.85rem;opacity:0.55;">
<input type="text" disabled class="input mono"
placeholder="secrets can't be scheduled — set via inventory / global creds">
{% else %}
{% if v.secret %}<input type="hidden" name="secret__{{ v.name }}" value="1">{% endif %}
<input type="{{ 'password' if v.secret else 'text' }}"
<input type="{{ 'password' if v.secret else 'text' }}" class="input mono"
name="var__{{ v.name }}"
{% if not v.secret %}value="{{ _values.get(v.name, '') }}"{% endif %}
{% if v.required %}required{% endif %}
{% if v.secret %}autocomplete="new-password"{% endif %}
placeholder="{% if v.secret %}(hidden){% elif v.default not in (None, '') %}default: {{ v.default }}{% else %}no default{% endif %}"
style="width:100%;font-family:ui-monospace,monospace;font-size:0.85rem;">
placeholder="{% if v.secret %}(hidden){% elif v.default not in (None, '') %}default: {{ v.default }}{% else %}no default{% endif %}">
{% endif %}
</div>
{% endfor %}
{% else %}
<p style="color:var(--text-dim);font-size:0.8rem;margin:0.25rem 0 0.6rem;">
No declared variables found in this playbook.
</p>
<p class="field-hint pb-vars-hint">No declared variables found in this playbook.</p>
{% endif %}
+1 -1
View File
@@ -182,7 +182,7 @@ async def test_run_detail_titles_the_run_and_keeps_the_trail(app):
assert page.index(">zulu<") < page.index(">alpha<")
assert '<span class="tone-crit">1 failed</span> · 1 ok' in page and ">3 ok<" in page
assert 'href="/ansible/playbooks/builtin/update.yml"' in page # the playbook it ran
assert 'href="/ansible/playbooks/builtin/update.yml?from=dddd4444#run-form">Run again</a>' in page
assert 'href="/ansible/playbooks/builtin/update.yml?from=dddd4444#run-form" class="btn btn-sm btn-ghost">Run again</a>' in page
main = page[page.index("<main"):]
assert 'style="' not in main[:main.index('id="run-output"')] # no hand-set colours
assert not hex_colours(main), hex_colours(main)