Qualys tags page: bandeau sync en cours + bouton Resync API disable
This commit is contained in:
parent
48249d1c82
commit
9e03fd84c0
@ -153,12 +153,16 @@ async def qualys_tags(request: Request, db=Depends(get_db),
|
|||||||
FROM qualys_tags
|
FROM qualys_tags
|
||||||
""")).fetchone()
|
""")).fetchone()
|
||||||
|
|
||||||
|
from ..services.qualys_service import is_refresh_running
|
||||||
|
sync_running = is_refresh_running()
|
||||||
|
|
||||||
ctx = base_context(request, db, user)
|
ctx = base_context(request, db, user)
|
||||||
ctx.update({
|
ctx.update({
|
||||||
"app_name": APP_NAME, "tags": tags, "stats": stats,
|
"app_name": APP_NAME, "tags": tags, "stats": stats,
|
||||||
"search": search, "tag_type": tag_type,
|
"search": search, "tag_type": tag_type,
|
||||||
"can_edit_qualys": can_edit(perms, "qualys"),
|
"can_edit_qualys": can_edit(perms, "qualys"),
|
||||||
"msg": request.query_params.get("msg"),
|
"msg": request.query_params.get("msg"),
|
||||||
|
"sync_running": sync_running,
|
||||||
})
|
})
|
||||||
return templates.TemplateResponse("qualys_tags.html", ctx)
|
return templates.TemplateResponse("qualys_tags.html", ctx)
|
||||||
|
|
||||||
|
|||||||
@ -6,13 +6,20 @@
|
|||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
{% if can_edit_qualys %}
|
{% if can_edit_qualys %}
|
||||||
<form method="POST" action="/qualys/tags/resync" style="display:inline">
|
<form method="POST" action="/qualys/tags/resync" style="display:inline">
|
||||||
<button class="btn-sm bg-cyber-border text-cyber-accent" data-loading="Synchronisation des tags Qualys...|Cette opération peut prendre 1 à 2 minutes">Resync API</button>
|
<button class="btn-sm bg-cyber-border text-cyber-accent" {% if sync_running %}disabled title="Sync Qualys agents en cours"{% else %}data-loading="Synchronisation des tags Qualys...|Cette opération peut prendre 1 à 2 minutes"{% endif %}>Resync API</button>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="/qualys/tags/export" class="btn-sm bg-cyber-green text-black">Export CSV</a>
|
<a href="/qualys/tags/export" class="btn-sm bg-cyber-green text-black">Export CSV</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if sync_running %}
|
||||||
|
<div class="card p-3 mb-4" style="border:1px solid #f59e0b;background:rgba(245,158,11,0.1)">
|
||||||
|
<span class="text-cyber-yellow font-bold">⏳ Synchronisation Qualys en cours</span>
|
||||||
|
<span class="text-xs text-gray-400 ml-2">Le bouton Resync API est désactivé. Patiente la fin du sync agents.</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if msg %}
|
{% if msg %}
|
||||||
<div class="mb-3 p-2 rounded text-sm {% if 'error' in msg or 'ko' in msg %}bg-red-900/30 text-cyber-red{% else %}bg-green-900/30 text-cyber-green{% endif %}">
|
<div class="mb-3 p-2 rounded text-sm {% if 'error' in msg or 'ko' in msg %}bg-red-900/30 text-cyber-red{% else %}bg-green-900/30 text-cyber-green{% endif %}">
|
||||||
{% if msg == 'resync_ok' %}Tags resynchronisés depuis l'API Qualys.{% elif msg == 'busy' %}⏳ Une synchronisation Qualys est déjà en cours (agents). Patiente quelques minutes puis réessaie.{% elif msg and msg.startswith('resync_ko') %}Erreur de synchronisation : {{ msg[10:].replace('+', ' ') if msg|length > 10 else 'API Qualys indisponible' }}{% elif msg == 'created' %}Tag créé.{% elif msg == 'create_error' %}Erreur création.{% elif msg == 'deleted' %}Tag supprimé.{% elif msg == 'delete_error' %}Erreur suppression.{% endif %}
|
{% if msg == 'resync_ok' %}Tags resynchronisés depuis l'API Qualys.{% elif msg == 'busy' %}⏳ Une synchronisation Qualys est déjà en cours (agents). Patiente quelques minutes puis réessaie.{% elif msg and msg.startswith('resync_ko') %}Erreur de synchronisation : {{ msg[10:].replace('+', ' ') if msg|length > 10 else 'API Qualys indisponible' }}{% elif msg == 'created' %}Tag créé.{% elif msg == 'create_error' %}Erreur création.{% elif msg == 'deleted' %}Tag supprimé.{% elif msg == 'delete_error' %}Erreur suppression.{% endif %}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user