cibles_hotes.html
67 lignes · 5084 octets
{% import "components/badge.html" as badge %} {% import "components/bouton.html" as b %} {# E003-C4 — tableau des serveurs (fragment #hotes), diagnostic SSH par serveur #} <div id="hotes"{% if oob %} hx-swap-oob="true"{% endif %} class="flex flex-col gap-sm"> {% if let Some(e) = erreur %}<p class="border-l-4 border-l-error bg-error-bg p-md text-sm text-foreground" role="alert">{{ e }}</p>{% endif %} {% if hotes.is_empty() %} <p class="rounded-sm bg-muted p-md text-sm text-muted-foreground">Ajoutez au moins un serveur.</p> {% else %} <div class="overflow-x-auto" tabindex="0" aria-label="Tableau des serveurs"> <table class="w-full text-sm text-foreground"> <thead><tr class="text-left text-xs text-muted-foreground"><th class="px-sm py-xs">Serveur</th><th class="px-sm py-xs">Accès</th><th class="px-sm py-xs">Rôles</th><th class="px-sm py-xs">Connexion</th><th class="px-sm py-xs"><span class="sr-only">Actions</span></th></tr></thead> <tbody> {% for h in hotes %} <tr class="border-t border-card-border align-top"> <td class="px-sm py-sm"><span class="font-mono">{{ h.nom }}</span>{% if h.local %} <span class="text-xs text-muted-foreground">(cette machine)</span>{% endif %}{% if let Some(p) = h.provenance %} {% call badge::badge("neutre", p) %}{% endcall %}{% endif %}</td> <td class="px-sm py-sm font-mono text-xs">{{ h.utilisateur }}@{{ h.adresse }}:{{ h.port }}</td> <td class="px-sm py-sm"><span class="flex flex-wrap gap-xxs">{% for r in h.roles %}{% call badge::badge("neutre", r) %}{% endcall %}{% endfor %}</span></td> <td class="px-sm py-sm"> {% if let Some(d) = h.diagnostic %} {% if d.ok %}{% call badge::badge("ok", "connexion vérifiée") %}{% endcall %}{% else %}{% call badge::badge("erreur", "échec") %}{% endcall %}{% endif %} <ul class="mt-xs flex flex-col gap-xxs text-xs wrap-anywhere"> {% for (controle, ok, detail) in d.controles %} <li class="{% if *ok %}text-muted-foreground{% else %}text-error-ink{% endif %}"><span aria-hidden="true">{% if *ok %}✓{% else %}✕{% endif %}</span> {{ controle }} : {{ detail }}</li> {% endfor %} </ul> {% else %} {% call badge::badge("neutre", "non testé") %}{% endcall %} {% endif %} </td> <td class="px-sm py-sm"> <div class="flex flex-wrap gap-xs"> <button type="button" class="{% call b::classes("outline") %}{% endcall %} h-8 px-sm text-xs" hx-post="/install/cibles/hotes/{{ h.segment }}/test" hx-target="#hotes" hx-swap="outerHTML" hx-disabled-elt="this">Tester</button> {% if let Some(url) = h.modification %} {# OI-212 (19c) : machine prévue, rouverte dans E-035 #} <a href="{{ url }}" class="{% call b::classes("outline") %}{% endcall %} h-8 px-sm text-xs">Modifier<span class="sr-only"> {{ h.nom }}</span></a> {% endif %} {% if h.retrait_machine %} {# E003-C14 (M8, D-085) : machine créée, jamais installée : plan de destruction en E-036 #} <button type="button" class="{% call b::classes("outline") %}{% endcall %} h-8 px-sm text-xs" hx-post="/install/cibles/machines/{{ h.segment }}/retrait" hx-swap="none" hx-disabled-elt="this" hx-confirm="Détruire la machine {{ h.nom }} chez le fournisseur ? Un plan vous sera montré avant.">Retirer</button> {% else if h.retirable %} <button type="button" class="{% call b::classes("icone") %}{% endcall %}" hx-delete="/install/cibles/hotes/{{ h.segment }}" hx-target="#hotes" hx-swap="outerHTML" hx-confirm="Retirer {{ h.nom }} de la liste ?" aria-label="Retirer {{ h.nom }}"><span aria-hidden="true">🗑</span></button> {% endif %} </div> </td> </tr> {% if !h.ajoutables.is_empty() %} {# E-022 (arbitrage 5) : rôles attribuables à un serveur déclaré, jamais de retrait de serveur ; sur une ligne pleine largeur, visible même quand le tableau déborde de l'écran #} <tr class="align-top"> <td colspan="5" class="px-sm pb-sm"> <div class="flex flex-wrap items-center gap-xs"> <span class="text-xs text-muted-foreground">Rôles à attribuer<span class="sr-only"> à {{ h.nom }}</span> :</span> {% for r in h.ajoutables %} <button type="button" class="{% call b::classes("outline") %}{% endcall %} h-8 px-sm text-xs" hx-post="/install/cibles/hotes" hx-vals="{{ r.vals }}" hx-target="#hotes" hx-swap="outerHTML" hx-disabled-elt="this">{% if r.porte %}Retirer le rôle {{ r.libelle }}{% else %}Attribuer le rôle {{ r.libelle }}{% endif %}<span class="sr-only"> : {{ h.nom }}</span></button> {% endfor %} </div> </td> </tr> {% endif %} {% endfor %} </tbody> </table> </div> {% endif %} </div>
GitRust