* [bug#57876] adjust js load logic for system dashboard.

This commit is contained in:
caoyanyi
2024-12-10 16:20:04 +08:00
committed by 田淑杰
parent 8c76f49309
commit 1ccd8df78e
+19 -20
View File
@@ -1,23 +1,5 @@
var baseFontSize = parseInt($("html").css("font-size"), 10);
var progressTemplate = '<div class="progress rounded-lg w-40 h-2 mr-2 inline-block" style="width:120px;" title="{tip}"><div class="progress-bar {color}" style="width: {rate};"></div></div>';
var statusTemplate = '<span id="instance-status-{id}" data-status="{status}" class="{class}">{text}</span>';
var enableTimer = false;
const cpuProgressCircle = new zui.ProgressCircle('#progressCpu', {
percent: cpuInfo.rate,
size: baseFontSize * 10,
circleColor: cpuInfo.color,
circleWidth: 8,
text: '',
});
const memoryProgressCircle = new zui.ProgressCircle('#progressMemory', {
percent: memoryInfo.rate,
size: baseFontSize * 10,
circleColor: memoryInfo.color,
circleWidth: 8,
text: '',
});
let progressTemplate = '<div class="progress rounded-lg w-40 h-2 mr-2 inline-block" style="width:120px;" title="{tip}"><div class="progress-bar {color}" style="width: {rate};"></div></div>';
let statusTemplate = '<span id="instance-status-{id}" data-status="{status}" class="{class}">{text}</span>';
window.renderInstanceList = function (result, {col, row, value})
{
@@ -47,6 +29,23 @@ window.renderInstanceList = function (result, {col, row, value})
$(function()
{
const baseFontSize = parseInt($("html").css("font-size"), 10);
new zui.ProgressCircle('#progressCpu', {
percent: cpuInfo.rate,
size: baseFontSize * 10,
circleColor: cpuInfo.color,
circleWidth: 8,
text: '',
});
new zui.ProgressCircle('#progressMemory', {
percent: memoryInfo.rate,
size: baseFontSize * 10,
circleColor: memoryInfo.color,
circleWidth: 8,
text: '',
});
if(typeof timer !== 'undefined') clearInterval(timer);
if(instanceIdList.length === 0) return;
if(inQuickon) timer = setInterval(refreshStatus, 5000);