Ajouter les liens réels des templates
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run

This commit is contained in:
root 2026-08-21 13:28:59 +00:00
parent c5760e4aea
commit 5ddfb3d70f
3 changed files with 19 additions and 1 deletions

View file

@ -328,6 +328,21 @@ def _template_inventory():
app_root = Path(current_app.root_path).resolve() app_root = Path(current_app.root_path).resolve()
domain_aliases = {'admin': 'core', 'auth': 'core', 'dashboard': 'core', 'setup_wizard': 'core'} domain_aliases = {'admin': 'core', 'auth': 'core', 'dashboard': 'core', 'setup_wizard': 'core'}
page_urls = {
'chatbot/index.html': '/chatbot/',
'companies/index.html': '/companies/', 'companies/detail.html': '/companies/2',
'ent/index.html': '/ent/', 'ent/messages.html': '/ent/messages', 'ent/staff.html': '/ent/staff',
'equipments/index.html': '/equipments/', 'equipments/detail.html': '/equipments/42',
'equipments/categories.html': '/equipments/categories', 'equipments/buildings.html': '/equipments/buildings/',
'equipments/rooms.html': '/equipments/rooms/', 'equipments/room_detail.html': '/equipments/rooms/12',
'interventions/index.html': '/interventions/', 'interventions/detail.html': '/interventions/39',
'lots/index.html': '/lots/', 'lots/detail.html': '/lots/3',
'parts/index.html': '/parts/', 'parts/detail.html': '/parts/4',
'planning/index.html': '/planning/', 'pronote/index.html': '/pronote/',
'room_types/index.html': '/room-types/', 'training/index.html': '/training/',
'training/detail.html': '/training/6', 'yeastar/index.html': '/yeastar/',
'gmao_config/index.html': '/gmao-config/', 'admin/index.html': '/admin/',
}
files = [] files = []
for path in sorted(app_root.rglob('*.html')): for path in sorted(app_root.rglob('*.html')):
relative = path.relative_to(app_root).as_posix() relative = path.relative_to(app_root).as_posix()
@ -351,6 +366,7 @@ def _template_inventory():
'logical_key': logical_key, 'logical_key': logical_key,
'source': source, 'source': source,
'hash': digest, 'hash': digest,
'page_url': page_urls.get(logical_key),
'target_path': ( 'target_path': (
f"app_new/{parts[0]}/templates/{logical_key}" f"app_new/{parts[0]}/templates/{logical_key}"
if template_index > 0 if template_index > 0

View file

@ -68,12 +68,13 @@
</div> </div>
<div class="table-responsive"> <div class="table-responsive">
<table class="table table-sm align-middle mb-0"> <table class="table table-sm align-middle mb-0">
<thead><tr><th>Fichier</th><th>Architecture cible</th><th>Source</th><th>État estimé</th><th>Empreinte</th><th>Actions</th><th style="min-width:300px">Décision</th></tr></thead> <thead><tr><th>Fichier</th><th>Architecture cible</th><th>Page réelle</th><th>Source</th><th>État estimé</th><th>Empreinte</th><th>Actions</th><th style="min-width:300px">Décision</th></tr></thead>
<tbody> <tbody>
{% for template in templates %} {% for template in templates %}
<tr class="{% if template.mark and template.mark.status == 'obsolete' %}table-secondary{% endif %}"> <tr class="{% if template.mark and template.mark.status == 'obsolete' %}table-secondary{% endif %}">
<td><code class="text-break">{{ template.path }}</code></td> <td><code class="text-break">{{ template.path }}</code></td>
<td><code class="text-break small">{{ template.target_path }}</code></td> <td><code class="text-break small">{{ template.target_path }}</code></td>
<td>{% if template.page_url %}<a href="{{ template.page_url }}" target="_blank" rel="noopener" class="btn btn-outline-success btn-sm"><i class="bi bi-box-arrow-up-right"></i> Ouvrir</a><br><code class="small">{{ template.page_url }}</code>{% else %}<span class="text-muted small">Pas de page directe</span>{% endif %}</td>
<td><span class="badge bg-{{ 'primary' if template.source == 'global' else 'info' }}">{{ template.source }}</span></td> <td><span class="badge bg-{{ 'primary' if template.source == 'global' else 'info' }}">{{ template.source }}</span></td>
<td> <td>
{% if template.mark and template.mark.status == 'obsolete' %}<span class="badge bg-secondary">Obsolète</span> {% if template.mark and template.mark.status == 'obsolete' %}<span class="badge bg-secondary">Obsolète</span>

View file

@ -7,6 +7,7 @@ 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 '/chatbot/' in response.get_data(as_text=True)
assert 'Identiques' 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) assert 'Divergents' in response.get_data(as_text=True)