Files
FabledSteward/steward/templates/ansible/inventory/group_detail.html
T
bvandeusenandClaude Opus 5.5 955450d33f
CI / lint (push) Successful in 2s
CI / integration (push) Successful in 55s
CI / unit (push) Successful in 1m22s
CI / publish (push) Successful in 1m36s
fix(ui): section tabs above the breadcrumb, so the Ansible tab strip holds still (#5214)
The tabs were drawn in each page's content block, which base.html renders
after the breadcrumb, so on every nested Ansible page the strip moved down a
line. base.html now has a section_tabs block above the breadcrumb, and every
Ansible page fills it. A guard in test_breadcrumbs.py fails any page that calls
a tabs macro outside that block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 06:28:02 -04:00

69 lines
3.7 KiB
HTML

{# ansible/inventory/group_detail.html — one group (#5333): its members and
the schedules aimed at it, its form (operators), and at the foot Delete
behind the confirm dialog. #}
{% extends "base.html" %}
{% from "_macros.html" import crumbs, page_header %}
{% from "ansible/_tabs.html" import ansible_tabs %}
{% block title %}{{ group.name }} — Inventory — Steward{% endblock %}
{% block breadcrumb %}{{ crumbs([("Ansible", "/ansible/"), ("Inventory", "/ansible/inventory/"), (group.name, "")]) }}{% endblock %}
{% block section_tabs %}{{ ansible_tabs("inventory") }}{% endblock %}
{% block content %}
{% set can_edit = session.user_role in ('operator', 'admin') %}
{{ page_header(group.name) }}
{#- The name a play uses for it (#5334): Ansible takes only letters, digits and _. #}
<p class="page-verdict">
{%- set members = group.targets|sort(attribute='name') %}
{%- if members %}{{ members|length }} member{{ 's' if members|length != 1 }}:
{% for t in members %}<a href="/ansible/inventory/targets/{{ t.id }}">{{ t.name }}</a>{{ ", " if not loop.last }}{% endfor %}
{%- else %}<span class="tone-warn">no members</span>{% endif %}
· plays call it <code>{{ ansible_name }}</code>
{%- if used %} · scheduled by {% for s in used %}<a href="/ansible/schedules/{{ s.id }}">{{ s.name }}</a>{{ ", " if not loop.last }}{% endfor %}{% endif %}
</p>
{% if can_edit %}
<form method="post" action="/ansible/inventory/groups/{{ group.id }}" class="form-page">{{ csrf_field() }}
<section class="card form-section" aria-labelledby="grp-settings">
<h2 id="grp-settings" class="section-title">Group</h2>
<div class="field">
<label class="field-label" for="grp-name">Name</label>
<input class="input" id="grp-name" type="text" name="name" value="{{ group.name }}" required>
</div>
<div class="field">
<label class="field-label" for="grp-vars">Variables</label>
<textarea class="input mono" id="grp-vars" name="ansible_vars" rows="6"
placeholder="ansible_user: deploy&#10;http_port: 80">{{ ansible_vars_yaml }}</textarea>
<span class="field-hint">YAML, applied to every member. A target's own variables override these.</span>
</div>
</section>
<section class="card form-section" aria-labelledby="grp-members">
<h2 id="grp-members" class="section-title">Members</h2>
{% if not all_targets %}
<p class="tone-muted">No targets yet. <a href="/ansible/inventory/?add=target">Add a target</a> first.</p>
{% else %}
<div class="check-list">
{% for tgt in all_targets %}
<label class="field-check">
<input type="checkbox" name="target_ids" value="{{ tgt.id }}" {% if tgt.id in member_ids %}checked{% endif %}>
<span>{{ tgt.name }}</span> <span class="mono tone-dim">{{ tgt.address }}</span>
</label>
{% endfor %}
</div>
{% endif %}
</section>
<button type="submit" class="btn">Save</button>
</form>
<section class="danger-zone" aria-labelledby="grp-delete">
<h2 id="grp-delete" class="section-title">Delete this group</h2>
<p class="field-hint">{% if used %}{{ used|length }} schedule{{ 's' if used|length != 1 }} run{{ 's' if used|length == 1 }} on it and would find nothing to run on.{% else %}Its targets stay; only the grouping goes.{% endif %}</p>
<form method="post" action="/ansible/inventory/groups/{{ group.id }}/delete"
data-confirm="Delete group {{ group.name }}? {% if used %}{{ used|length }} schedule{{ 's' if used|length != 1 }} aimed at it would find nothing to run on.{% else %}Its targets stay; only the grouping goes.{% endif %}">{{ csrf_field() }}
<button class="btn btn-danger" type="submit">Delete group</button>
</form>
</section>
{% endif %}
{% endblock %}