diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7a60b85 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +__pycache__/ +*.pyc diff --git a/static/index.html b/static/index.html index 5262b8b..689e74d 100644 --- a/static/index.html +++ b/static/index.html @@ -130,6 +130,8 @@ .dm-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 13px; } .dm-toolbar input[type="number"] { background: #21262d; border: 1px solid var(--border); color: var(--text); border-radius: 5px; padding: 3px 8px; font-size: 12px; width: 70px; } .dm-toolbar input[type="number"]:focus { outline: none; border-color: var(--accent); } + .dm-summary { font-size: 12px; color: var(--muted); margin-bottom: 8px; } + .dm-summary b { color: var(--text); } .netmap-save-btn { background: none; border: 1px solid var(--border); color: var(--accent); border-radius: 5px; padding: 3px 10px; font-size: 11px; cursor: pointer; transition: background .15s; } .netmap-save-btn:hover { background: #21262d; } .netmap-flash { font-size: 11px; color: var(--green); width: 14px; display: inline-block; } @@ -595,11 +597,21 @@ function dmRender(containers) { const el = document.getElementById('dockermem-body'); if (!el) return; const thresholdBytes = dmThreshold * 1024 * 1024; - const rows = containers.filter(c => c.mem_bytes >= thresholdBytes).slice(0, 20); + const matching = containers.filter(c => c.mem_bytes >= thresholdBytes); + const rows = matching.slice(0, 20); + const totalAll = containers.reduce((s, c) => s + c.mem_bytes, 0); + if (!rows.length) { el.innerHTML = `Aucun conteneur au-dessus de ${dmThreshold} Mo`; return; } + + const subtotalShown = rows.reduce((s, c) => s + c.mem_bytes, 0); + const hiddenCount = matching.length - rows.length; + const summary = `Sous-total (${rows.length} conteneur${rows.length > 1 ? 's' : ''} affiché${rows.length > 1 ? 's' : ''}` + + (hiddenCount > 0 ? `, ${hiddenCount} de plus au-dessus du seuil non affiché${hiddenCount > 1 ? 's' : ''}` : '') + + `) : ${fmt_bytes(subtotalShown)} · Total tous conteneurs : ${fmt_bytes(totalAll)}`; + const trs = rows.map(c => { const pct = c.mem_pct || 0; const pctColor = pct > 50 ? 'var(--red)' : (pct > 20 ? 'var(--yellow)' : 'var(--muted)'); @@ -609,7 +621,8 @@ function dmRender(containers) { ${pct.toFixed(1)}% `; }).join(''); - el.innerHTML = ` + el.innerHTML = `
${summary}
+
${trs}
ConteneurRAM utilisée% limite
`;