@@ -87,6 +87,20 @@ function serverSpecLabel(s){
8787function cpuModelLabel ( s ) {
8888 return String ( s ?. cpu_model || '' ) . trim ( ) ;
8989}
90+ function shortCpuModel ( model ) {
91+ const raw = String ( model || '' ) . trim ( ) ;
92+ if ( ! raw ) return '' ;
93+ const text = raw
94+ . replace ( / \( (?: R | T M | C ) \) / gi, '' )
95+ . replace ( / \s + @ .* $ / g, '' )
96+ . replace ( / \b (?: C P U | P r o c e s s o r ) \b / gi, '' )
97+ . replace ( / \b \d + \s * - ? \s * C o r e \b / gi, '' )
98+ . replace ( / \b \d + \s * - ? \s * T h r e a d \b / gi, '' )
99+ . replace ( / \b (?: I n t e l | A M D ) \b / gi, '' )
100+ . replace ( / \s + / g, ' ' )
101+ . trim ( ) ;
102+ return text || raw ;
103+ }
90104function humanAgo ( ts ) {
91105 if ( ! ts ) return '-' ;
92106 const sec = Math . max ( 0 , Math . floor ( Date . now ( ) / 1000 - Number ( ts ) ) ) ;
@@ -592,7 +606,8 @@ function refreshDetail(){
592606 const title = $ ( 'detailTitle' ) ;
593607 const spec = serverSpecLabel ( s ) ;
594608 const cpuModel = cpuModelLabel ( s ) ;
595- title . innerHTML = `${ esc ( s . name || '-' ) } 详情${ s . os ? `<span class="os-chip${ osClass ( s . os ) } ">${ esc ( osLabel ( s . os ) ) } </span>` : '' } ${ spec ? `<span class="spec-chip" title="CPU 核心 / 总内存">${ esc ( spec ) } </span>` : '' } ${ cpuModel ? `<span class="cpu-model-chip" title="${ esc ( cpuModel ) } ">${ esc ( cpuModel ) } </span>` : '' } ` ;
609+ const shortModel = shortCpuModel ( cpuModel ) ;
610+ title . innerHTML = `${ esc ( s . name || '-' ) } 详情${ s . os ? `<span class="os-chip${ osClass ( s . os ) } ">${ esc ( osLabel ( s . os ) ) } </span>` : '' } ${ spec ? `<span class="spec-chip" title="CPU 核心 / 总内存">${ esc ( spec ) } </span>` : '' } ${ cpuModel ? `<span class="cpu-model-chip" title="${ esc ( cpuModel ) } ">${ esc ( shortModel ) } </span>` : '' } ` ;
596611 const modalBox = document . querySelector ( '#detailModal .modal-box' ) ;
597612 if ( modalBox ) {
598613 modalBox . classList . toggle ( 'alert-critical' , m . rowLevel === 'critical' ) ;
0 commit comments