Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 56 additions & 2 deletions web/maintenance/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ h1 {
margin-bottom: 12px;
}
.card table {
width: 100%; /* wieder volle Kartenbreite */
max-width: 100%; /* wieder volle Kartenbreite */
width: 100%; /* wieder volle Kartenbreite */
max-width: 100%; /* wieder volle Kartenbreite */
}
table {
border-collapse: collapse;
Expand Down Expand Up @@ -66,3 +66,57 @@ th {
align-items: center;
margin-right: 30px;
}

/* Modal Overlay */
.details-modal {
display: none;
position: fixed;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
background: rgba(0, 0, 0, 0.4);
align-items: center;
justify-content: center;
z-index: 10000;
}

/* Modal Inhalt */
.details-modal-content {
background: #fff;
padding: 24px 32px;
border-radius: 8px;
max-width: 90vw;
max-height: 80vh;
box-shadow: 0 2px 16px #0003;
position: relative;
display: flex;
flex-direction: column;
}

/* Modal Nachricht */
#details-modal-message {
white-space: pre-wrap;
margin-bottom: 20px;
}

/* Modal Schließen-Button */
#details-modal-close {
align-self: flex-end;
padding: 6px 18px;
font-size: 1em;
}

/* Info-Button */
.details-button {
font-size: 0.8em;
padding: 0 4px;
margin-left: 6px;
border-radius: 50%;
}

/* Modal Header */
#details-modal-header {
margin-top: 0;
margin-bottom: 16px;
}
49 changes: 45 additions & 4 deletions web/maintenance/systeminfo.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ <h1>Systeminformationen</h1>
<p>Lade Daten...</p>
</div>
<div id="error"></div>
<div id="details-modal" class="details-modal">
<div class="details-modal-content">
<h2 id="details-modal-header">Details</h2>
<pre id="details-modal-message"></pre>
<button id="details-modal-close">Schließen</button>
</div>
</div>
<script>
const fetchInterval = 5000; // 5 Sekunden
const maxHistoryLength = 60; // z.B. 5 Minuten bei 5s Intervall
Expand Down Expand Up @@ -94,6 +101,16 @@ <h1>Systeminformationen</h1>
for (const subKey in value) {
if (Object.hasOwn(value, subKey)) {
const v = value[subKey];
html += `<tr><th>${subKey}`;
// Falls "details" vorhanden, einen runden Info-Button anzeigen
if (v && typeof v === "object" && "details" in v) {
const infoBtnId = `info_${key}_${subKey}`.replace(
/\W/g,
"_"
);
html += ` <button class="details-button" data-details="${v.details}">i</button>`;
}
html += '</th><td style="text-align:right;">';
if (
v &&
typeof v === "object" &&
Expand All @@ -102,10 +119,11 @@ <h1>Systeminformationen</h1>
) {
let num = Number(v.value);
let formatted = isFinite(num) ? num.toFixed(1) : v.value;
html += `<tr><th>${subKey}</th><td style="text-align:right;">${formatted} <span style="color:#888;font-size:0.95em">${v.unit}</span></td></tr>`;
html += `${formatted} <span style="color:#888;font-size:0.95em">${v.unit}</span>`;
} else {
html += `<tr><th>${subKey}</th><td style="text-align:right;">${v}</td></tr>`;
html += `${v}`;
}
html += "</td></tr>";
}
}
html += "</table>";
Expand Down Expand Up @@ -168,6 +186,20 @@ <h1>Systeminformationen</h1>
}
}
}

// Event-Handler für Info-Buttons (Details)
document.querySelectorAll(".details-button").forEach((btn) => {
btn.onclick = function () {
const modal = document.getElementById("details-modal");
const msg = document.getElementById("details-modal-message");
msg.textContent = btn.getAttribute("data-details");
const header = document.getElementById("details-modal-header");
const th = btn.closest("th");
let subKeyText = th ? th.childNodes[0].textContent.trim() : "";
header.textContent = `Details zu '${subKeyText}'`;
modal.style.display = "flex";
};
});
}

function renderCharts() {
Expand All @@ -193,7 +225,8 @@ <h1>Systeminformationen</h1>
let chartsHtml = '<div class="card-container">';
for (const key in history) {
if (!Object.hasOwn(history, key)) continue;
if (!chartSections.some(section => key.startsWith(section))) continue;
if (!chartSections.some((section) => key.startsWith(section)))
continue;
const value = history[key];
// Prüfe, ob es sich um mehrere Reihen handelt (Objekt mit value/unit) oder Array
if (Array.isArray(value)) {
Expand Down Expand Up @@ -248,7 +281,8 @@ <h2>${key}</h2>
// Diagramme zeichnen
for (const key in history) {
if (!Object.hasOwn(history, key)) continue;
if (!chartSections.some(section => key.startsWith(section))) continue;
if (!chartSections.some((section) => key.startsWith(section)))
continue;
const value = history[key];
if (Array.isArray(value)) {
const canvas = document.getElementById(`chart_${key}`);
Expand Down Expand Up @@ -390,6 +424,13 @@ <h2>${key}</h2>
}
}

document.getElementById("details-modal-close").onclick = function () {
document.getElementById("details-modal").style.display = "none";
};
document.getElementById("details-modal").onclick = function (e) {
if (e.target === this) this.style.display = "none";
};

fetchSystemInfo();
setInterval(fetchSystemInfo, fetchInterval);
</script>
Expand Down
7 changes: 4 additions & 3 deletions web/maintenance/systeminfo_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ function getServiceStatus($services)
function getTopProcesses($order, $limit)
{
// ps gibt: PID, Benutzer, CPU-Auslastung, Speicher, Befehl
$data = ['comm', 'pid', '%cpu', '%mem'];
$data = ['comm', 'pid', '%cpu', '%mem', 'command'];
$index = array_search($order, $data);
if ($index === false) {
return [];
Expand All @@ -329,10 +329,11 @@ function getTopProcesses($order, $limit)
for ($i = 1; $i < count($output); $i++) {
// Spalten trennen (mehrere Leerzeichen)
$cols = preg_split('/\s+/', trim($output[$i]), 5);
if (count($cols) === 4) {
if (count($cols) === 5) {
$result[$cols[0] . ' (' . $cols[1] . ')'] = [
'value' => (float)$cols[$index],
'unit' => '%'
'unit' => '%',
'details' => $cols[4]
];
}
}
Expand Down