Dernier patch: date/semaine depuis Excel, colonne triable, couleur vert/jaune/rouge
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2ac263e80a
commit
2b2fac7c13
@ -175,6 +175,14 @@ async def audit_full_list(request: Request, db=Depends(get_db)):
|
||||
audits.sort(key=uptime_days, reverse=(sort_dir == "desc"))
|
||||
elif sort == "reboot":
|
||||
audits.sort(key=lambda a: (1 if a.reboot_required else 0), reverse=(sort_dir == "desc"))
|
||||
elif sort == "patch":
|
||||
def patch_sort_key(a):
|
||||
if a.last_patch_date:
|
||||
return a.last_patch_date
|
||||
elif a.last_patch_year and a.last_patch_week:
|
||||
return f"{a.last_patch_year}-{a.last_patch_week}"
|
||||
return ""
|
||||
audits.sort(key=patch_sort_key, reverse=(sort_dir == "desc"))
|
||||
|
||||
# Pagination
|
||||
total_filtered = len(audits)
|
||||
|
||||
@ -403,6 +403,7 @@ def get_latest_audits(db, limit=100):
|
||||
return db.execute(text("""
|
||||
SELECT DISTINCT ON (hostname) id, server_id, hostname, audit_date,
|
||||
os_release, kernel, uptime, status, reboot_required,
|
||||
last_patch_date, last_patch_week, last_patch_year,
|
||||
jsonb_array_length(COALESCE(services, '[]')) as svc_count,
|
||||
jsonb_array_length(COALESCE(listen_ports, '[]')) as port_count,
|
||||
jsonb_array_length(COALESCE(connections, '[]')) as conn_count,
|
||||
|
||||
@ -103,6 +103,7 @@
|
||||
<th class="p-2">Ports</th>
|
||||
<th class="p-2">Conn</th>
|
||||
<th class="p-2"><a href="/audit-full?sort=reboot&dir={% if sort == 'reboot' and sort_dir == 'desc' %}asc{% else %}desc{% endif %}{% if filter %}&filter={{ filter }}{% endif %}{% if search %}&q={{ search }}{% endif %}{% if domain %}&domain={{ domain }}{% endif %}" class="hover:text-cyber-accent">Reboot {% if sort == 'reboot' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% endif %}</a></th>
|
||||
<th class="p-2"><a href="/audit-full?sort=patch&dir={% if sort == 'patch' and sort_dir == 'desc' %}asc{% else %}desc{% endif %}{% if filter %}&filter={{ filter }}{% endif %}{% if search %}&q={{ search }}{% endif %}{% if domain %}&domain={{ domain }}{% endif %}" class="hover:text-cyber-accent">Dernier patch {% if sort == 'patch' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% endif %}</a></th>
|
||||
<th class="p-2">Date</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
@ -117,6 +118,7 @@
|
||||
<td class="p-2 text-center">{{ a.port_count }}</td>
|
||||
<td class="p-2 text-center">{{ a.conn_count }}</td>
|
||||
<td class="p-2 text-center">{% if a.reboot_required %}<span class="text-cyber-red">Oui</span>{% else %}<span class="text-cyber-green">Non</span>{% endif %}</td>
|
||||
<td class="p-2 text-center font-mono {% if not a.last_patch_week %}text-cyber-red{% elif a.last_patch_year == 2026 %}text-cyber-green{% else %}text-cyber-yellow{% endif %}">{% if a.last_patch_date %}{{ a.last_patch_date }}{% elif a.last_patch_week %}{{ a.last_patch_week }} {{ a.last_patch_year }}{% else %}-{% endif %}</td>
|
||||
<td class="p-2 text-center text-gray-500">{{ a.audit_date.strftime('%d/%m %H:%M') if a.audit_date else '-' }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user