diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-06-09 01:21:56 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-06-09 01:21:56 +0900 |
| commit | d041232ccd712eb48a10b10ec6a1e83bc6bf9a34 (patch) | |
| tree | 2fd64bf12009a3365b9ab6a4c4b94663aeb3eb2a /src/web | |
| parent | Fix bug (diff) | |
| download | misskey-d041232ccd712eb48a10b10ec6a1e83bc6bf9a34.tar.gz misskey-d041232ccd712eb48a10b10ec6a1e83bc6bf9a34.tar.bz2 misskey-d041232ccd712eb48a10b10ec6a1e83bc6bf9a34.zip | |
[Client] Improve server home widget
Diffstat (limited to 'src/web')
| -rw-r--r-- | src/web/app/desktop/tags/home-widgets/server.tag | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/web/app/desktop/tags/home-widgets/server.tag b/src/web/app/desktop/tags/home-widgets/server.tag index 0d869eec9d..94418005b8 100644 --- a/src/web/app/desktop/tags/home-widgets/server.tag +++ b/src/web/app/desktop/tags/home-widgets/server.tag @@ -73,7 +73,7 @@ <mk-server-home-widget-stats> <svg riot-viewBox="0 0 { viewBoxX } { viewBoxY }" preserveAspectRatio="none"> - <text dx="1" dy="5">CPU</text> + <text dx="1" dy="5">CPU <tspan>{ cpuP }%</tspan></text> <polygon riot-points={ cpuPolygonPoints } riot-fill={ cpuColor } @@ -85,7 +85,7 @@ riot-stroke={ cpuColor }/> </svg> <svg riot-viewBox="0 0 { viewBoxX } { viewBoxY }" preserveAspectRatio="none"> - <text dx="1" dy="5">MEM</text> + <text dx="1" dy="5">MEM <tspan>{ memP }%</tspan></text> <polygon riot-points={ memPolygonPoints } riot-fill={ memColor } @@ -116,6 +116,9 @@ font-size 5px fill #7b7b7b + > tspan + opacity 0.5 + &:after content "" display block @@ -152,13 +155,18 @@ const cpuColor = `hsl(${180 - (stats.cpu_usage * 180)}, 80%, 70%)`; const memColor = `hsl(${180 - (stats.mem.used / stats.mem.total * 180)}, 80%, 70%)`; + const cpuP = (stats.cpu_usage * 100).toFixed(0); + const memP = (stats.mem.used / stats.mem.total * 100).toFixed(0); + this.update({ cpuPolylinePoints, memPolylinePoints, cpuPolygonPoints, memPolygonPoints, cpuColor, - memColor + memColor, + cpuP, + memP }); }; </script> |