tableau.html 139 lignes · 8110 octets
{# E-021 Tableau de bord de la console (OI-909, tranche 7 du plan M9) : installation, session,
   serveurs, services et dernières actions. Sans lecture de l'annuaire en M9. #}
{% extends "layouts/session.html" %}
{% import "components/badge.html" as bd %}
{% import "components/code.html" as c %}

{% block title %}Tableau de bord de la console{% endblock %}

{% block content %}
<h1 class="mb-xl text-2xl text-foreground">Tableau de bord</h1>

{# E021-C1 Encadré de versions, seulement si elles diffèrent (R-19). #}
{% if let Some(v) = installeur_different %}
<p class="mb-lg border-l-4 border-l-info bg-info-bg p-md text-sm text-foreground" role="status">La console ({{ version }}) et l'installeur qui l'a déployée ({{ v }}) n'ont pas la même version.</p>
{% endif %}

{# E021-C7 Journal d'audit modifiable, faute de l'attribut « ajout seul » (OI-209). #}
{% if journal_modifiable %}
<div id="journal-modifiable" class="mb-lg border-l-4 border-l-warning bg-warning-bg p-md text-sm text-foreground" role="status">
  <p class="font-semibold">Journal d'audit modifiable</p>
  <p class="mt-xs">Ce serveur n'a pas permis de verrouiller le journal : on peut encore en modifier ou en effacer des lignes. Un compte qui prendrait la main sur la console pourrait réécrire son historique. Voir le <a href="{{ open_iam_commun::documentation::SITE }}/guides/proteger-le-journal-d-audit-de-la-console.html" class="text-primary underline underline-offset-4">guide « Protéger le journal d'audit de la console »</a>.</p>
</div>
{% endif %}

<div class="grid gap-lg lg:grid-cols-2">
  {# E021-C2 Installation #}
  <section class="border border-border bg-card p-xl" aria-labelledby="titre-installation">
    <h2 id="titre-installation" class="mb-md text-lg text-foreground">Installation</h2>
    {% if let Some(i) = description %}
    <dl class="grid grid-cols-[auto_1fr] gap-x-lg gap-y-xs text-sm">
      <dt class="text-muted-foreground">Organisation</dt><dd class="text-foreground">{{ i.organisation.nom }}</dd>
      <dt class="text-muted-foreground">Domaine</dt><dd class="break-all font-mono text-foreground">{{ i.organisation.domaine }}</dd>
      <dt class="text-muted-foreground">Version de la console</dt><dd class="font-mono text-foreground">{{ version }}</dd>
      <dt class="text-muted-foreground">Version de l'installeur</dt><dd class="font-mono text-foreground">{% if let Some(v) = i.installeur %}{{ v }}{% else %}inconnue{% endif %}</dd>
      {% if let Some(d) = deploiement %}<dt class="text-muted-foreground">Déploiement</dt><dd class="text-foreground">Déployée {{ d }}</dd>{% endif %}
    </dl>
    {% else %}
    <p class="border-l-4 border-l-error bg-error-bg p-md text-sm text-foreground" role="alert">La description de l'installation est {{ description_etat }} (<code class="break-all font-mono">{{ description_chemin }}</code>). Relancez une évolution depuis l'installeur.</p>
    {% endif %}
  </section>

  {# E021-C3 Votre session #}
  <section class="border border-border bg-card p-xl" aria-labelledby="titre-session">
    <h2 id="titre-session" class="mb-md text-lg text-foreground">Votre session</h2>
    <dl class="grid grid-cols-[auto_1fr] gap-x-lg gap-y-xs text-sm">
      <dt class="text-muted-foreground">Identité</dt>
      <dd class="text-foreground">{{ session.nom }}{% if let Some(u) = session.uid %} <span class="font-mono">{{ u }}</span>{% endif %}</dd>
      <dt class="text-muted-foreground">Authentification</dt><dd class="text-foreground">Mot de passe et second facteur</dd>
    </dl>
    <ul class="mt-md flex flex-col gap-xxs text-sm text-foreground">
      <li>Connecté depuis {{ session.depuis }}</li>
      <li>Fin de session au plus tard à {{ session.fin }}</li>
      <li>Déconnexion après 45 minutes d'inactivité</li>
    </ul>
  </section>
</div>

{% if let Some(i) = description %}
{# E021-C4 Serveurs #}
<section class="mt-lg border border-border bg-card p-xl" aria-labelledby="titre-serveurs">
  <h2 id="titre-serveurs" class="mb-md text-lg text-foreground">Serveurs</h2>
  <div class="overflow-x-auto" tabindex="0" role="region" aria-label="Tableau des serveurs">
    <table class="w-full text-sm">
      <thead class="bg-muted text-left text-xs text-muted-foreground">
        <tr><th scope="col" class="px-md py-sm">Serveur</th><th scope="col" class="px-md py-sm">Rôles</th><th scope="col" class="px-md py-sm">Adresse</th></tr>
      </thead>
      <tbody>
        {% for s in serveurs %}
        <tr class="border-b border-border">
          <th scope="row" class="px-md py-sm text-left font-normal text-foreground"><span class="font-mono">{{ s.nom }}</span>{% if s.console %} <span class="text-muted-foreground">(cette console)</span>{% endif %}</th>
          <td class="px-md py-sm"><span class="flex flex-wrap gap-xxs">{% for r in s.roles %}{% call bd::badge("inactif", r) %}{% endcall %}{% endfor %}</span></td>
          <td class="px-md py-sm font-mono text-foreground">{% if let Some(a) = s.adresse %}{{ a }}{% else %}—{% endif %}</td>
        </tr>
        {% else %}
        <tr><td colspan="3" class="px-md py-sm text-muted-foreground">Aucun serveur décrit.</td></tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
</section>

{# E021-C5 Services : un lien pour les services web, une adresse copiable pour LDAPS. #}
<section class="mt-lg border border-border bg-card p-xl" aria-labelledby="titre-services">
  <h2 id="titre-services" class="mb-md text-lg text-foreground">Services</h2>
  {% if services.is_empty() %}
  <p class="text-sm text-muted-foreground">Aucun service publié.</p>
  {% else %}
  <div class="overflow-x-auto" tabindex="0" role="region" aria-label="Tableau des services">
    <table class="w-full text-sm">
      <thead class="bg-muted text-left text-xs text-muted-foreground">
        <tr><th scope="col" class="px-md py-sm">Service</th><th scope="col" class="px-md py-sm">Adresse</th></tr>
      </thead>
      <tbody>
        {% for s in services %}
        <tr class="border-b border-border">
          <th scope="row" class="px-md py-sm text-left font-normal text-foreground">{{ s.libelle }}</th>
          <td class="px-md py-sm">
            {%- if s.lien %}<a href="{{ s.adresse }}" class="break-all font-mono text-primary underline underline-offset-4">{{ s.adresse }}</a>
            {%- else if s.copiable %}{% call c::code(s.id, s.adresse, s.libelle) %}{% endcall %}
            {%- else %}<span class="break-all font-mono text-foreground">{{ s.adresse }}</span>{% endif -%}
          </td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
  {% endif %}
</section>
{% endif %}

{# E021-C6 Dernières actions, avec l'état de la chaîne (C-008). #}
<section class="mt-lg border border-border bg-card p-xl" aria-labelledby="titre-actions">
  <div class="mb-md flex flex-wrap items-center justify-between gap-sm">
    <h2 id="titre-actions" class="text-lg text-foreground">Dernières actions</h2>
    {% call bd::badge(chaine_etat, chaine_libelle) %}{% endcall %}
  </div>
  {% if actions.is_empty() %}
  <p class="text-sm text-muted-foreground">Aucune action enregistrée pour l'instant.</p>
  {% else %}
  <div class="overflow-x-auto" tabindex="0" role="region" aria-label="Tableau des dernières actions">
    <table class="w-full text-sm">
      <thead class="bg-muted text-left text-xs text-muted-foreground">
        <tr><th scope="col" class="px-md py-sm">Date</th><th scope="col" class="px-md py-sm">Compte</th><th scope="col" class="px-md py-sm">Action</th><th scope="col" class="px-md py-sm">Adresse source</th></tr>
      </thead>
      <tbody>
        {% for a in actions %}
        <tr class="border-b border-border">
          <td class="whitespace-nowrap px-md py-sm font-mono text-foreground">{{ a.date }}</td>
          <td class="px-md py-sm text-foreground">{{ a.identite }}</td>
          <td class="px-md py-sm text-foreground">{{ a.evenement }}</td>
          <td class="px-md py-sm font-mono text-foreground">{{ a.source }}</td>
        </tr>
        {% endfor %}
      </tbody>
    </table>
  </div>
  {% endif %}
</section>
{% endblock %}