feat: add mock mode
This commit is contained in:
@@ -263,15 +263,18 @@ class NodeDetailsComponent extends Component {
|
||||
if (monitoringResources.filesystem) {
|
||||
const usedKB = Math.round(monitoringResources.filesystem.used_bytes / 1024);
|
||||
const totalKB = Math.round(monitoringResources.filesystem.total_bytes / 1024);
|
||||
const usagePercent = monitoringResources.filesystem.total_bytes > 0
|
||||
? ((monitoringResources.filesystem.used_bytes / monitoringResources.filesystem.total_bytes) * 100).toFixed(1)
|
||||
: '0.0';
|
||||
html += `
|
||||
<div class="detail-row">
|
||||
<span class="detail-label">Filesystem:</span>
|
||||
<span class="detail-value">${monitoringResources.filesystem.usage_percent ? monitoringResources.filesystem.usage_percent.toFixed(1) + '%' : 'N/A'} (${usedKB}KB / ${totalKB}KB)</span>
|
||||
<span class="detail-value">${usagePercent}% (${usedKB}KB / ${totalKB}KB)</span>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
// System Uptime
|
||||
// System Information
|
||||
if (monitoringResources.system) {
|
||||
html += `
|
||||
<div class="detail-row">
|
||||
@@ -281,6 +284,25 @@ class NodeDetailsComponent extends Component {
|
||||
`;
|
||||
}
|
||||
|
||||
// Network Information
|
||||
if (monitoringResources.network) {
|
||||
const uptimeSeconds = monitoringResources.network.uptime_seconds || 0;
|
||||
const uptimeHours = Math.floor(uptimeSeconds / 3600);
|
||||
const uptimeMinutes = Math.floor((uptimeSeconds % 3600) / 60);
|
||||
const uptimeFormatted = `${uptimeHours}h ${uptimeMinutes}m`;
|
||||
|
||||
html += `
|
||||
<div class="detail-row">
|
||||
<span class="detail-label">WiFi RSSI:</span>
|
||||
<span class="detail-value">${monitoringResources.network.wifi_rssi || 'N/A'} dBm</span>
|
||||
</div>
|
||||
<div class="detail-row">
|
||||
<span class="detail-label">Network Uptime:</span>
|
||||
<span class="detail-value">${uptimeFormatted}</span>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
html += `</div>`;
|
||||
}
|
||||
|
||||
@@ -291,9 +313,9 @@ class NodeDetailsComponent extends Component {
|
||||
// Get values with fallbacks and ensure they are numbers
|
||||
const cpuUsage = parseFloat(monitoringResources.cpu?.average_usage) || 0;
|
||||
const heapUsage = parseFloat(monitoringResources.memory?.heap_usage_percent) || 0;
|
||||
const filesystemUsage = parseFloat(monitoringResources.filesystem?.usage_percent) || 0;
|
||||
const filesystemUsed = parseFloat(monitoringResources.filesystem?.used_bytes) || 0;
|
||||
const filesystemTotal = parseFloat(monitoringResources.filesystem?.total_bytes) || 0;
|
||||
const filesystemUsage = filesystemTotal > 0 ? (filesystemUsed / filesystemTotal) * 100 : 0;
|
||||
|
||||
// Convert filesystem bytes to KB
|
||||
const filesystemUsedKB = Math.round(filesystemUsed / 1024);
|
||||
|
||||
Reference in New Issue
Block a user