From 0b8e7aca656cfd61295c3bb60eccb09be647c64b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=B6=E7=88=B8?= Date: Wed, 11 Dec 2019 15:56:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=9B=B4=E6=8E=A5100%?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/template/page/home.html | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) 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); }) }