diff --git a/web/index.html b/web/index.html index f6b2deb..7950bbe 100644 --- a/web/index.html +++ b/web/index.html @@ -6,7 +6,7 @@ 云监控 - +
@@ -200,6 +200,6 @@ ServerStatus中文版 - + diff --git a/web/js/app.js b/web/js/app.js index a4e4995..5251169 100644 --- a/web/js/app.js +++ b/web/js/app.js @@ -87,6 +87,20 @@ function serverSpecLabel(s){ function cpuModelLabel(s){ return String(s?.cpu_model || '').trim(); } +function shortCpuModel(model){ + const raw = String(model || '').trim(); + if(!raw) return ''; + const text = raw + .replace(/\((?:R|TM|C)\)/gi, '') + .replace(/\s+@.*$/g, '') + .replace(/\b(?:CPU|Processor)\b/gi, '') + .replace(/\b\d+\s*-?\s*Core\b/gi, '') + .replace(/\b\d+\s*-?\s*Thread\b/gi, '') + .replace(/\b(?:Intel|AMD)\b/gi, '') + .replace(/\s+/g, ' ') + .trim(); + return text || raw; +} function humanAgo(ts){ if(!ts) return '-'; const sec = Math.max(0, Math.floor(Date.now() / 1000 - Number(ts))); @@ -592,7 +606,8 @@ function refreshDetail(){ const title = $('detailTitle'); const spec = serverSpecLabel(s); const cpuModel = cpuModelLabel(s); - title.innerHTML = `${esc(s.name || '-')} 详情${s.os ? `${esc(osLabel(s.os))}` : ''}${spec ? `${esc(spec)}` : ''}${cpuModel ? `${esc(cpuModel)}` : ''}`; + const shortModel = shortCpuModel(cpuModel); + title.innerHTML = `${esc(s.name || '-')} 详情${s.os ? `${esc(osLabel(s.os))}` : ''}${spec ? `${esc(spec)}` : ''}${cpuModel ? `${esc(shortModel)}` : ''}`; const modalBox = document.querySelector('#detailModal .modal-box'); if(modalBox){ modalBox.classList.toggle('alert-critical', m.rowLevel === 'critical');