This commit is contained in:
parent
94d8e201f5
commit
594636b5cc
1 changed files with 1 additions and 48 deletions
|
|
@ -16,13 +16,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||
// Load initial data
|
||||
refreshStations();
|
||||
|
||||
startAutoRefresh();
|
||||
});
|
||||
|
||||
// Start auto-refresh interval
|
||||
function startAutoRefresh() {
|
||||
setInterval(refreshStations, REFRESH_INTERVAL);
|
||||
}
|
||||
});
|
||||
|
||||
// Refresh station data
|
||||
async function refreshStations() {
|
||||
|
|
@ -176,38 +171,6 @@ function formatBytes(bytes) {
|
|||
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
||||
}
|
||||
|
||||
// Format duration from seconds to human readable format
|
||||
function formatDuration(secondsStr) {
|
||||
if (!secondsStr) return 'N/A';
|
||||
|
||||
const seconds = parseInt(secondsStr);
|
||||
if (isNaN(seconds) || seconds <= 0) return 'Just now';
|
||||
|
||||
const hours = Math.floor(seconds / 3600);
|
||||
const minutes = Math.floor((seconds % 3600) / 60);
|
||||
const secs = seconds % 60;
|
||||
|
||||
if (hours > 0) {
|
||||
return `${hours}h ${minutes}m`;
|
||||
} else if (minutes > 0) {
|
||||
return `${minutes}m ${secs}s`;
|
||||
} else {
|
||||
return `${secs}s`;
|
||||
}
|
||||
}
|
||||
|
||||
// Get connection status based on connection time
|
||||
function getConnectionStatus(connectedTimeStr) {
|
||||
if (!connectedTimeStr) return 'Unknown';
|
||||
|
||||
const seconds = parseInt(connectedTimeStr);
|
||||
if (isNaN(seconds)) return 'Connected';
|
||||
|
||||
if (seconds < 60) return 'New';
|
||||
else if (seconds < 300) return 'Medium';
|
||||
else return 'Established';
|
||||
}
|
||||
|
||||
// Get CSS class for connection status
|
||||
function getConnectionStatusClass(connectedTimeStr) {
|
||||
if (!connectedTimeStr) return 'status-established';
|
||||
|
|
@ -219,13 +182,3 @@ function getConnectionStatusClass(connectedTimeStr) {
|
|||
else if (seconds < 300) return 'status-medium';
|
||||
else return 'status-established';
|
||||
}
|
||||
|
||||
// Add CSS classes for status indicators (in case they're not in the CSS)
|
||||
const style = document.createElement('style');
|
||||
style.textContent = `
|
||||
.status-connected { color: #27ae60; font-weight: bold; }
|
||||
.status-connecting { color: #f39c12; font-weight: bold; }
|
||||
.status-disconnected { color: #7f8c8d; font-weight: bold; }
|
||||
.status-error { color: #e74c3c; font-weight: bold; }
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue