feat: badges SMART pills, versionning serveur, fix copier HTTP

- Dashboard: icônes SMART → pills OK/USAGÉ/PREFAIL/HS cliquables
  (tuile + popup détail + popup SMART redessiné pour novices)
- Serveur: constante version 0.1.0 exposée via WS server_stats → footer
- Fix copier script install en HTTP (isSecureContext avant clipboard API)
- install.sh: ajout ethtool, suppression logique OVERWRITE_CONFIG

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gilles Soulier
2026-05-23 05:56:44 +02:00
parent 982483e0bf
commit f93f5741da
8 changed files with 144 additions and 85 deletions
+21 -5
View File
@@ -58,6 +58,18 @@ const Grid = (() => {
</div>`;
}
const _stateLabel = { ok: 'OK', old: 'USAGÉ', prefail: 'PREFAIL', hs: 'HS' };
function smartState(s) {
if (!s.passed) return 'hs';
if (s.reallocated_sectors > 0 ||
(s.wear_level != null && s.wear_level < 20) ||
(s.power_on_hours != null && s.power_on_hours > 40000)) return 'prefail';
if ((s.wear_level != null && s.wear_level < 50) ||
(s.power_on_hours != null && s.power_on_hours > 25000)) return 'old';
return 'ok';
}
function renderTile(agent, metrics) {
const id = agent.id;
const sc = statusClass(agent);
@@ -78,10 +90,14 @@ const Grid = (() => {
}
const smartIco = !offline && metrics?.smart?.length > 0
? metrics.smart.map(s => s.passed
? `<i class="fa-solid fa-shield-check" style="color:var(--ok);font-size:10px;flex-shrink:0" data-tip="SMART OK — ${s.device}"></i>`
: `<i class="fa-solid fa-triangle-exclamation" style="color:var(--err);font-size:10px;flex-shrink:0" data-tip="SMART FAILED — ${s.device}"></i>`
).join('')
? '<div style="display:flex;gap:3px;flex-shrink:0">' +
metrics.smart.map((s, i) => {
const st = smartState(s);
const lbl = _stateLabel[st];
return `<span class="smart-pill ${st}"
onclick="event.stopPropagation();Popups.showSmart('${esc(id)}',${i})"
data-tip="SMART ${esc(s.device)}${lbl}">${lbl}</span>`;
}).join('') + '</div>'
: '';
const iconContent = `<img src="${API.iconUrl(id)}" alt=""
@@ -215,5 +231,5 @@ const Grid = (() => {
updateStats();
}
return { refresh, update, updateStatus, removeAgent, rerenderAll, getAgent, fmt, fmtPct };
return { refresh, update, updateStatus, removeAgent, rerenderAll, getAgent, fmt, fmtPct, smartState };
})();