diff --git a/web/js/script.js b/web/js/script.js index c4e9e7e..54da40b 100644 --- a/web/js/script.js +++ b/web/js/script.js @@ -96,7 +96,6 @@ function displayServerData(data){ serverName.textContent = serverTitle + " - Not update -"; } - console.log(serverData); // 网速 if ('network_list' in serverData){ let networkInfo = document.createElement('div'); @@ -120,6 +119,24 @@ function displayServerData(data){ // 分割线 add_bar(serverCard); } + + // CPU + if ('cpu' in serverData){ + let cpuInfo = document.createElement('div'); + cpuInfo.className = 'cpu-info'; + + temperature_list_str = ""; + serverData.cpu['temperature_list'].forEach(function(v){ + temperature_list_str += v + " ℃ "; + }); + cpuInfo.innerHTML = "CPU型号 : " + serverData.cpu['name'] + "
" + + "温度 : " + temperature_list_str + "
" + + "占用率 : " + serverData.cpu['core_avg_occupy'] + "%"; + + serverCard.appendChild(cpuInfo); + // 分割线 + add_bar(serverCard); + } // 内存 if ('memory' in serverData){ @@ -194,7 +211,7 @@ function displayServerData(data){ // 添加进程信息 let processInfo = document.createElement('div'); processInfo.classList.add('process-info'); - processInfo.innerHTML = "使用情况:"; + processInfo.innerHTML = "使用情况: "; gpu.process_list.sort((a, b) => b.memory - a.memory); gpu.process_list.forEach(function(item, index){