feat(dockermem): sous-total RAM affiché + total tous conteneurs
Ajout .gitignore pour __pycache__/ (absent jusqu'ici).
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
__pycache__/
|
||||||
|
*.pyc
|
||||||
+15
-2
@@ -130,6 +130,8 @@
|
|||||||
.dm-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; font-size: 13px; }
|
.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"] { 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-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 { 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-save-btn:hover { background: #21262d; }
|
||||||
.netmap-flash { font-size: 11px; color: var(--green); width: 14px; display: inline-block; }
|
.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');
|
const el = document.getElementById('dockermem-body');
|
||||||
if (!el) return;
|
if (!el) return;
|
||||||
const thresholdBytes = dmThreshold * 1024 * 1024;
|
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) {
|
if (!rows.length) {
|
||||||
el.innerHTML = `<span style="color:var(--muted)">Aucun conteneur au-dessus de ${dmThreshold} Mo</span>`;
|
el.innerHTML = `<span style="color:var(--muted)">Aucun conteneur au-dessus de ${dmThreshold} Mo</span>`;
|
||||||
return;
|
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' : ''}` : '') +
|
||||||
|
`) : <b>${fmt_bytes(subtotalShown)}</b> · Total tous conteneurs : ${fmt_bytes(totalAll)}`;
|
||||||
|
|
||||||
const trs = rows.map(c => {
|
const trs = rows.map(c => {
|
||||||
const pct = c.mem_pct || 0;
|
const pct = c.mem_pct || 0;
|
||||||
const pctColor = pct > 50 ? 'var(--red)' : (pct > 20 ? 'var(--yellow)' : 'var(--muted)');
|
const pctColor = pct > 50 ? 'var(--red)' : (pct > 20 ? 'var(--yellow)' : 'var(--muted)');
|
||||||
@@ -609,7 +621,8 @@ function dmRender(containers) {
|
|||||||
<td style="color:${pctColor}">${pct.toFixed(1)}%</td>
|
<td style="color:${pctColor}">${pct.toFixed(1)}%</td>
|
||||||
</tr>`;
|
</tr>`;
|
||||||
}).join('');
|
}).join('');
|
||||||
el.innerHTML = `<table class="nc-table">
|
el.innerHTML = `<div class="dm-summary">${summary}</div>
|
||||||
|
<table class="nc-table">
|
||||||
<thead><tr><th>Conteneur</th><th>RAM utilisée</th><th>% limite</th></tr></thead>
|
<thead><tr><th>Conteneur</th><th>RAM utilisée</th><th>% limite</th></tr></thead>
|
||||||
<tbody>${trs}</tbody>
|
<tbody>${trs}</tbody>
|
||||||
</table>`;
|
</table>`;
|
||||||
|
|||||||
Reference in New Issue
Block a user