@@ -11,6 +11,13 @@ <h1>Systeminformationen</h1>
1111 < p > Lade Daten...</ p >
1212 </ div >
1313 < div id ="error "> </ div >
14+ < div id ="details-modal " class ="details-modal ">
15+ < div class ="details-modal-content ">
16+ < h2 id ="details-modal-header "> Details</ h2 >
17+ < div id ="details-modal-message "> </ div >
18+ < button id ="details-modal-close "> Schließen</ button >
19+ </ div >
20+ </ div >
1421 < script >
1522 const fetchInterval = 5000 ; // 5 Sekunden
1623 const maxHistoryLength = 60 ; // z.B. 5 Minuten bei 5s Intervall
@@ -94,6 +101,16 @@ <h1>Systeminformationen</h1>
94101 for ( const subKey in value ) {
95102 if ( Object . hasOwn ( value , subKey ) ) {
96103 const v = value [ subKey ] ;
104+ html += `<tr><th>${ subKey } ` ;
105+ // Falls "details" vorhanden, einen runden Info-Button anzeigen
106+ if ( v && typeof v === "object" && "details" in v ) {
107+ const infoBtnId = `info_${ key } _${ subKey } ` . replace (
108+ / \W / g,
109+ "_"
110+ ) ;
111+ html += ` <button class="details-button" data-details="${ v . details } ">i</button>` ;
112+ }
113+ html += '</th><td style="text-align:right;">' ;
97114 if (
98115 v &&
99116 typeof v === "object" &&
@@ -102,10 +119,11 @@ <h1>Systeminformationen</h1>
102119 ) {
103120 let num = Number ( v . value ) ;
104121 let formatted = isFinite ( num ) ? num . toFixed ( 1 ) : v . value ;
105- html += `<tr><th> ${ subKey } </th><td style="text-align:right;"> ${ formatted } <span style="color:#888;font-size:0.95em">${ v . unit } </span></td></tr >` ;
122+ html += `${ formatted } <span style="color:#888;font-size:0.95em">${ v . unit } </span>` ;
106123 } else {
107- html += `<tr><th> ${ subKey } </th><td style="text-align:right;"> ${ v } </td></tr> ` ;
124+ html += `${ v } ` ;
108125 }
126+ html += "</td></tr>" ;
109127 }
110128 }
111129 html += "</table>" ;
@@ -168,6 +186,20 @@ <h1>Systeminformationen</h1>
168186 }
169187 }
170188 }
189+
190+ // Event-Handler für Info-Buttons (Details)
191+ document . querySelectorAll ( ".details-button" ) . forEach ( ( btn ) => {
192+ btn . onclick = function ( ) {
193+ const modal = document . getElementById ( "details-modal" ) ;
194+ const msg = document . getElementById ( "details-modal-message" ) ;
195+ msg . textContent = btn . getAttribute ( "data-details" ) ;
196+ const header = document . getElementById ( "details-modal-header" ) ;
197+ const th = btn . closest ( "th" ) ;
198+ let subKeyText = th ? th . childNodes [ 0 ] . textContent . trim ( ) : "" ;
199+ header . textContent = `Details zu '${ subKeyText } '` ;
200+ modal . style . display = "flex" ;
201+ } ;
202+ } ) ;
171203 }
172204
173205 function renderCharts ( ) {
@@ -193,7 +225,8 @@ <h1>Systeminformationen</h1>
193225 let chartsHtml = '<div class="card-container">' ;
194226 for ( const key in history ) {
195227 if ( ! Object . hasOwn ( history , key ) ) continue ;
196- if ( ! chartSections . some ( section => key . startsWith ( section ) ) ) continue ;
228+ if ( ! chartSections . some ( ( section ) => key . startsWith ( section ) ) )
229+ continue ;
197230 const value = history [ key ] ;
198231 // Prüfe, ob es sich um mehrere Reihen handelt (Objekt mit value/unit) oder Array
199232 if ( Array . isArray ( value ) ) {
@@ -248,7 +281,8 @@ <h2>${key}</h2>
248281 // Diagramme zeichnen
249282 for ( const key in history ) {
250283 if ( ! Object . hasOwn ( history , key ) ) continue ;
251- if ( ! chartSections . some ( section => key . startsWith ( section ) ) ) continue ;
284+ if ( ! chartSections . some ( ( section ) => key . startsWith ( section ) ) )
285+ continue ;
252286 const value = history [ key ] ;
253287 if ( Array . isArray ( value ) ) {
254288 const canvas = document . getElementById ( `chart_${ key } ` ) ;
@@ -390,6 +424,13 @@ <h2>${key}</h2>
390424 }
391425 }
392426
427+ document . getElementById ( "details-modal-close" ) . onclick = function ( ) {
428+ document . getElementById ( "details-modal" ) . style . display = "none" ;
429+ } ;
430+ document . getElementById ( "details-modal" ) . onclick = function ( e ) {
431+ if ( e . target === this ) this . style . display = "none" ;
432+ } ;
433+
393434 fetchSystemInfo ( ) ;
394435 setInterval ( fetchSystemInfo , fetchInterval ) ;
395436 </ script >
0 commit comments