From f70f5c3704e2da48376788350653007077f4378c Mon Sep 17 00:00:00 2001 From: Admin MPCZ Date: Mon, 4 May 2026 14:05:16 +0200 Subject: [PATCH] feat(patching/import): retire colonnes Coupure/Pb disque/Lien serveur/Mode op de l affichage, link sur Asset, raccourci OS version (RedHat 8, Win 2022, ...) --- app/templates/patching_import.html | 39 ++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/app/templates/patching_import.html b/app/templates/patching_import.html index be67c82..1801dd6 100644 --- a/app/templates/patching_import.html +++ b/app/templates/patching_import.html @@ -146,16 +146,12 @@ Valideur RA Resp. Domaine DTS Référent tech. - Mode op. Impacts BDD Date Heure - Coupure - Pb disque - Lien serveur @@ -196,6 +192,27 @@ return String(s).replace(/[&<>"']/g, c => ({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c])); } + function shortOSVersion(v){ + if (!v) return ''; + const s = String(v); + let m = s.match(/red\s*hat[^0-9]+(\d+)/i); + if (m) return 'RedHat ' + m[1]; + m = s.match(/centos[^0-9]+(\d+)/i); + if (m) return 'CentOS ' + m[1]; + m = s.match(/oracle\s*linux[^0-9]+(\d+)/i); + if (m) return 'Oracle ' + m[1]; + m = s.match(/ubuntu[^0-9]+(\d+(?:\.\d+)?)/i); + if (m) return 'Ubuntu ' + m[1]; + m = s.match(/debian[^0-9]+(\d+)/i); + if (m) return 'Debian ' + m[1]; + m = s.match(/windows\s*server\s*(\d{4})/i); + if (m) return 'Win ' + m[1]; + m = s.match(/windows\s*(\d+)/i); + if (m) return 'Win ' + m[1]; + // Fallback : 30 premiers chars + return s.length > 30 ? s.slice(0, 30) + '…' : s; + } + function refreshSelection(){ const visible = tbody.querySelectorAll('tr:not(.row-hidden)'); const visibleCb = tbody.querySelectorAll('tr:not(.row-hidden) input.row-cb'); @@ -289,33 +306,29 @@ }); } tbody.innerHTML = rows.map(r => { - const linkSrv = r.server_id - ? '' + escapeHTML(r.resolved_hostname || r.asset_name) + '' + const display = escapeHTML(r.resolved_hostname || r.asset_name || ''); + const assetCell = r.server_id + ? '' + display + '' : '' + escapeHTML(r.asset_name || '') + ' ⚠'; - const pb = r.pb_espace_disque === true ? '⚠ Oui' : (r.pb_espace_disque === false ? 'Non' : ''); return '' + '' - + '' + escapeHTML(r.asset_name||'') + '' + + '' + assetCell + '' + '' + escapeHTML(r.environnement||'') + '' + '' + escapeHTML(r.domaine||'') + '' + '' + escapeHTML(r.os||'') + '' - + '' + escapeHTML(r.os_version||'') + '' + + '' + escapeHTML(shortOSVersion(r.os_version)) + '' + '' + escapeHTML(r.application_name||'') + '' + '' + escapeHTML(r.intervenant||'') + '' + '' + escapeHTML(r.valideur_ra||'') + '' + '' + escapeHTML(r.responsable_domaine_dts||'') + '' + '' + escapeHTML(r.referent_technique||'') + '' - + '' + escapeHTML(r.mode_operatoire||'') + '' + '' + escapeHTML(r.impacts||'') + '' + '' + escapeHTML(r.base_de_donnees||'') + '' + '' + (r.jour ? escapeHTML(r.jour) : (r.jour_text ? '' + escapeHTML(r.jour_text) + '' : '')) + '' + '' + escapeHTML(r.heure||'') + '' - + '' + escapeHTML(r.duree_coupure||'') + '' - + '' + pb + '' - + '' + linkSrv + '' + ''; }).join(''); tbody.querySelectorAll('input.row-cb').forEach(cb => cb.addEventListener('change', refreshSelection));