Distinguer alertes et notifications système
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run

This commit is contained in:
root 2026-08-21 11:47:58 +00:00
parent 04f85905eb
commit c4db4a1e12
4 changed files with 27 additions and 15 deletions

View file

@ -417,13 +417,18 @@ def template_debug():
"""Affiche les doublons et les décisions de nettoyage des templates.""" """Affiche les doublons et les décisions de nettoyage des templates."""
files, by_key = _template_inventory() files, by_key = _template_inventory()
selected_filter = request.args.get('filter', 'duplicates') selected_filter = request.args.get('filter', 'duplicates')
treated = lambda item: item['mark'] and item['mark'].status == 'obsolete'
if selected_filter == 'obsolete': if selected_filter == 'obsolete':
visible_files = [item for item in files if item['mark'] and item['mark'].status == 'obsolete'] visible_files = [item for item in files if item['mark'] and item['mark'].status == 'obsolete']
elif selected_filter == 'identical':
visible_files = [item for item in files if not treated(item) and item['duplicate_count'] > 1 and item['comparison'] == 'identique']
elif selected_filter == 'divergent':
visible_files = [item for item in files if not treated(item) and item['duplicate_count'] > 1 and item['comparison'] == 'divergent']
elif selected_filter == 'all': elif selected_filter == 'all':
visible_files = files visible_files = [item for item in files if not treated(item)]
else: else:
selected_filter = 'duplicates' selected_filter = 'duplicates'
visible_files = [item for item in files if item['duplicate_count'] > 1] visible_files = [item for item in files if not treated(item) and item['duplicate_count'] > 1]
stats = { stats = {
'total': len(files), 'total': len(files),
'duplicate_groups': sum(1 for group in by_key.values() if len(group) > 1), 'duplicate_groups': sum(1 for group in by_key.values() if len(group) > 1),

View file

@ -43,10 +43,15 @@
{% endfor %} {% endfor %}
</div> </div>
<div class="btn-group btn-group-sm mb-3" role="group"> <div class="d-flex flex-wrap gap-2 align-items-center mb-3">
<a class="btn {{ 'btn-primary' if selected_filter == 'duplicates' else 'btn-outline-primary' }}" href="{{ url_for('admin.template_debug', filter='duplicates') }}">Doublons</a> <span class="small text-muted">Afficher :</span>
<a class="btn {{ 'btn-primary' if selected_filter == 'obsolete' else 'btn-outline-primary' }}" href="{{ url_for('admin.template_debug', filter='obsolete') }}">Obsolètes</a> <div class="btn-group btn-group-sm" role="group" aria-label="Filtre des templates">
<a class="btn {{ 'btn-primary' if selected_filter == 'all' else 'btn-outline-primary' }}" href="{{ url_for('admin.template_debug', filter='all') }}">Tous</a> <a class="btn {{ 'btn-primary' if selected_filter == 'duplicates' else 'btn-outline-primary' }}" href="{{ url_for('admin.template_debug', filter='duplicates') }}">Doublons actifs</a>
<a class="btn {{ 'btn-primary' if selected_filter == 'identical' else 'btn-outline-primary' }}" href="{{ url_for('admin.template_debug', filter='identical') }}">Identiques</a>
<a class="btn {{ 'btn-primary' if selected_filter == 'divergent' else 'btn-outline-primary' }}" href="{{ url_for('admin.template_debug', filter='divergent') }}">Divergents</a>
<a class="btn {{ 'btn-primary' if selected_filter == 'all' else 'btn-outline-primary' }}" href="{{ url_for('admin.template_debug', filter='all') }}">Tous les actifs</a>
<a class="btn {{ 'btn-secondary' if selected_filter == 'obsolete' else 'btn-outline-secondary' }}" href="{{ url_for('admin.template_debug', filter='obsolete') }}">Traités / obsolètes</a>
</div>
</div> </div>
{% if groups %} {% if groups %}

View file

@ -111,25 +111,25 @@
</a> </a>
<div class="d-flex align-items-center order-lg-last"> <div class="d-flex align-items-center order-lg-last">
<!-- Alertes badge --> <!-- Alertes GMAO : alertes métier -->
{% set unread = stats.alerts_unread if stats is defined else 0 %} {% set unread = stats.alerts_unread if stats is defined else 0 %}
{% if unread %} <a href="{{ url_for('dashboard.alerts') }}" class="btn btn-sm btn-outline-warning me-2 position-relative" title="Alertes GMAO" aria-label="Alertes GMAO">
<a href="{{ url_for('dashboard.alerts') }}" class="btn btn-sm btn-outline-light me-2 position-relative"> <i class="bi bi-exclamation-triangle-fill"></i>
<i class="bi bi-bell"></i> {% if unread %}
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger" style="font-size:0.6rem;"> <span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-warning text-dark" style="font-size:0.6rem;">
{{ unread }} {{ unread }}
</span> </span>
{% endif %}
</a> </a>
{% endif %}
<!-- Theme toggle --> <!-- Theme toggle -->
<button class="theme-toggle" id="theme-toggle" title="Basculer le theme"> <button class="theme-toggle" id="theme-toggle" title="Basculer le theme">
<i class="bi bi-moon-fill" id="theme-icon"></i> <i class="bi bi-moon-fill" id="theme-icon"></i>
</button> </button>
<!-- Notifications --> <!-- Notifications système : interprétations et watchdogs -->
<a href="/logs/" class="btn btn-sm btn-outline-light me-2 position-relative" title="Notifications"> <a href="/logs/" class="btn btn-sm btn-outline-light me-2 position-relative" title="Notifications système et logs watchdogs" aria-label="Notifications système et logs watchdogs">
<i class="bi bi-bell"></i> <i class="bi bi-journal-text"></i>
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger" id="notif-count" style="font-size:0.6rem; display:none;">0</span> <span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger" id="notif-count" style="font-size:0.6rem; display:none;">0</span>
</a> </a>

View file

@ -7,6 +7,8 @@ def test_template_audit_can_mark_and_restore_without_deleting(authenticated_clie
assert 'Audit des templates' in response.get_data(as_text=True) assert 'Audit des templates' in response.get_data(as_text=True)
assert 'Architecture cible des templates' in response.get_data(as_text=True) assert 'Architecture cible des templates' in response.get_data(as_text=True)
assert 'app_new/chatbot/templates/chatbot/index.html' in response.get_data(as_text=True) assert 'app_new/chatbot/templates/chatbot/index.html' in response.get_data(as_text=True)
assert 'Identiques' in response.get_data(as_text=True)
assert 'Divergents' in response.get_data(as_text=True)
response = authenticated_client.get('/admin/debug/templates/preview?path=templates%2Fadmin%2Ftemplate_debug.html') response = authenticated_client.get('/admin/debug/templates/preview?path=templates%2Fadmin%2Ftemplate_debug.html')
assert response.status_code == 200 assert response.status_code == 200