Agents sans Qualys: filtres Alpine.js sur hostname, OS, domaine, env, état

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalid MOUTAOUAKIL 2026-04-07 01:20:59 +02:00
parent 6a5bdefde5
commit 5db47c497f

View File

@ -85,8 +85,34 @@
<!-- Serveurs sans agent Qualys --> <!-- Serveurs sans agent Qualys -->
{% if no_agent_servers %} {% if no_agent_servers %}
<div class="card p-4 mb-4"> <div class="card p-4 mb-4" x-data="{fHost:'', fOs:'', fDom:'', fEnv:'', fEtat:''}">
<h3 class="text-sm font-bold text-cyber-red mb-3">Serveurs en production sans agent Qualys ({{ no_agent_servers|length }})</h3> <div class="flex justify-between items-center mb-3">
<h3 class="text-sm font-bold text-cyber-red">Serveurs sans agent Qualys (<span x-text="document.querySelectorAll('#noagent-body tr:not([style*=none])').length">{{ no_agent_servers|length }}</span>)</h3>
</div>
<div class="flex gap-2 mb-3">
<input type="text" x-model="fHost" placeholder="Hostname..." class="text-xs py-1 px-2 flex-1 font-mono">
<select x-model="fOs" class="text-xs py-1 px-2">
<option value="">OS</option>
<option value="linux">Linux</option>
<option value="windows">Windows</option>
</select>
<select x-model="fDom" class="text-xs py-1 px-2">
<option value="">Domaine</option>
{% set doms = no_agent_servers|map(attribute='domain')|unique|sort %}
{% for d in doms %}{% if d %}<option value="{{ d }}">{{ d }}</option>{% endif %}{% endfor %}
</select>
<select x-model="fEnv" class="text-xs py-1 px-2">
<option value="">Env</option>
{% set envs = no_agent_servers|map(attribute='env')|unique|sort %}
{% for e in envs %}{% if e %}<option value="{{ e }}">{{ e }}</option>{% endif %}{% endfor %}
</select>
<select x-model="fEtat" class="text-xs py-1 px-2">
<option value="">État</option>
{% set etats = no_agent_servers|map(attribute='etat')|unique|sort %}
{% for e in etats %}{% if e %}<option value="{{ e }}">{{ e }}</option>{% endif %}{% endfor %}
</select>
<button @click="fHost='';fOs='';fDom='';fEnv='';fEtat=''" class="text-xs text-gray-400 hover:text-cyber-accent">Reset</button>
</div>
<table class="w-full table-cyber text-xs"> <table class="w-full table-cyber text-xs">
<thead><tr> <thead><tr>
<th class="text-left p-2">Hostname</th> <th class="text-left p-2">Hostname</th>
@ -96,9 +122,15 @@
<th class="p-2">Zone</th> <th class="p-2">Zone</th>
<th class="p-2">État</th> <th class="p-2">État</th>
</tr></thead> </tr></thead>
<tbody> <tbody id="noagent-body">
{% for s in no_agent_servers %} {% for s in no_agent_servers %}
<tr> <tr x-show="
(fHost === '' || '{{ s.hostname }}'.toLowerCase().includes(fHost.toLowerCase()))
&& (fOs === '' || '{{ s.os_family or '' }}'.toLowerCase() === fOs.toLowerCase())
&& (fDom === '' || '{{ s.domain or '' }}' === fDom)
&& (fEnv === '' || '{{ s.env or '' }}' === fEnv)
&& (fEtat === '' || '{{ s.etat or '' }}' === fEtat)
">
<td class="p-2 font-mono text-cyber-accent">{{ s.hostname }}</td> <td class="p-2 font-mono text-cyber-accent">{{ s.hostname }}</td>
<td class="p-2 text-center">{{ s.os_family or '-' }}</td> <td class="p-2 text-center">{{ s.os_family or '-' }}</td>
<td class="p-2 text-center text-gray-400">{{ s.domain or '-' }}</td> <td class="p-2 text-center text-gray-400">{{ s.domain or '-' }}</td>