diff --git a/resource/template/page/home.html b/resource/template/page/home.html index 635d6c8..1a698ab 100644 --- a/resource/template/page/home.html +++ b/resource/template/page/home.html @@ -134,6 +134,13 @@ const keys = Object.keys(statusCards.servers) for (let i = 0; i < keys.length; i++) { const ns = statusCards.servers[keys[i]]; + // 进度条 + const bars = [ + $('#' + ns.ID + ' .cpu.progress'), + $('#' + ns.ID + ' .mem.progress'), + $('#' + ns.ID + ' .swap.progress'), + $('#' + ns.ID + ' .disk.progress') + ] for (let j = 0; j < oldServers.length; j++) { const os = oldServers[j]; if (ns.ID == os.ID) { @@ -145,11 +152,8 @@ }); } // 刷新进度条 - const bars = [$('#' + ns.ID + ' .cpu.progress'), - $('#' + ns.ID + ' .mem.progress'), - $('#' + ns.ID + ' .swap.progress'), - $('#' + ns.ID + ' .disk.progress')] - bars.forEach(b => { + bars.forEach((b, i) => { + b.progress('set total', i == 0 ? 100 : b[0].dataset.total); b.progress('update progress', b[0].dataset.value); }) }