|
|
@ -113,6 +113,16 @@ function displayServerData(data){ |
|
|
|
serverName.textContent = serverTitle + " - Not update -"; |
|
|
|
} |
|
|
|
|
|
|
|
// 添加公告
|
|
|
|
if ('note' in serverData && serverData['note'] != ''){ |
|
|
|
let noteInfo = document.createElement('div'); |
|
|
|
noteInfo.className = 'note-info'; |
|
|
|
|
|
|
|
noteInfo.innerHTML = '<div style="text-align: center;"><strong>公告</strong></div>' + serverData['note']; |
|
|
|
|
|
|
|
serverCard.appendChild(noteInfo); |
|
|
|
} |
|
|
|
|
|
|
|
// 网速
|
|
|
|
if ('network_list' in serverData){ |
|
|
|
let networkInfo = document.createElement('div'); |
|
|
@ -214,13 +224,14 @@ function displayServerData(data){ |
|
|
|
let markLightOccupy = '<span class="state-light-occupy"> 占用</span>'; |
|
|
|
let markOccupy = '<span class="state-occupy"> 占用</span>'; |
|
|
|
let tmpMark = markFree; |
|
|
|
if (gpu.used_memory < 1000 && gpu.utilization < 20){ |
|
|
|
tmpMark = markFree; |
|
|
|
let memory_used_ratio = gpu.used_memory / gpu.total_memory; |
|
|
|
if (memory_used_ratio > 0.25 && gpu.utilization > 50){ |
|
|
|
tmpMark = markOccupy; |
|
|
|
} |
|
|
|
else if (gpu.util_mem < 50){ |
|
|
|
else if (memory_used_ratio > 0.25 || gpu.utilization > 50){ |
|
|
|
tmpMark = markLightOccupy; |
|
|
|
}else{ |
|
|
|
tmpMark = markOccupy; |
|
|
|
tmpMark = markFree; |
|
|
|
} |
|
|
|
gpuInfo.innerHTML = '<strong>' + gpu.idx + ' - ' + gpu.name + tmpMark + '</strong><br>' |
|
|
|
+ '温度: ' + gpu.temperature + '°C<br>' |
|
|
@ -276,5 +287,5 @@ function displayServerData(data){ |
|
|
|
// 页面加载时获取数据并定时刷新
|
|
|
|
document.addEventListener('DOMContentLoaded', function() { |
|
|
|
fetchData(); |
|
|
|
setInterval(fetchData, 3500); // 每3.5秒刷新一次数据
|
|
|
|
setInterval(fetchData, 4000); // 每4秒刷新一次数据
|
|
|
|
}); |
|
|
|