Update: Separate uptime UI updates and enhance logging for WebSocket messages
- Add `updateUptimeUI` function for dedicated uptime handling. - Modify WebSocket message handling to update uptime separately from sensor data. - Adjust logging to provide better clarity for unknown payload types. - Fix formatting inconsistency in uptime display (`1d` -> `1days`). Signed-off-by: YoungSoo Shin <shinys000114@gmail.com>
This commit is contained in:
@@ -47,14 +47,20 @@ export function updateSensorUI(data) {
|
||||
dom.powerDisplay.textContent = `${data.VIN.power.toFixed(2)} W`;
|
||||
}
|
||||
|
||||
if (data.uptime_sec !== undefined) {
|
||||
dom.uptimeDisplay.textContent = formatUptime(data.uptime_sec);
|
||||
}
|
||||
|
||||
// Pass the entire multi-channel data object to the charts
|
||||
updateCharts(data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the system uptime display in the UI.
|
||||
* @param {number} uptimeInSeconds - The system uptime in seconds.
|
||||
*/
|
||||
export function updateUptimeUI(uptimeInSeconds) {
|
||||
if (uptimeInSeconds !== undefined) {
|
||||
dom.uptimeDisplay.textContent = formatUptime(uptimeInSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the Wi-Fi status indicator in the header.
|
||||
* @param {Object} data - The Wi-Fi status object from the WebSocket.
|
||||
|
||||
Reference in New Issue
Block a user