From 81e3b0bd1e35570e927f7aad536c501a1e4a068c Mon Sep 17 00:00:00 2001 From: Ben Phelps Date: Wed, 7 Sep 2022 17:17:01 +0300 Subject: [PATCH] cleanup resource widget design --- src/components/widgets/resources/cpu.jsx | 27 ++++++++++-------- src/components/widgets/resources/disk.jsx | 28 ++++++++++++------- src/components/widgets/resources/memory.jsx | 26 +++++++++++------ .../widgets/resources/resources.jsx | 4 +-- 4 files changed, 51 insertions(+), 34 deletions(-) diff --git a/src/components/widgets/resources/cpu.jsx b/src/components/widgets/resources/cpu.jsx index 541f1a421..1e6cd438c 100644 --- a/src/components/widgets/resources/cpu.jsx +++ b/src/components/widgets/resources/cpu.jsx @@ -11,9 +11,8 @@ export default function Cpu() { return (
-
- Resources - Error +
+ API Error
); @@ -23,24 +22,28 @@ export default function Cpu() { return (
-
+
- Usage - - Load
); } + const percent = data.cpu.usage; + return (
-
- - {`${Math.round(data.cpu.usage)}%`.padEnd(3, " ")} Usage - - - {`${(Math.round(data.cpu.load * 100) / 100).toFixed(1)}`.padEnd(3, " ")} Load - +
+
{`${Math.round(data.cpu.usage)}%`}
+
+
+
); diff --git a/src/components/widgets/resources/disk.jsx b/src/components/widgets/resources/disk.jsx index f78a3a2e1..4121c9ff5 100644 --- a/src/components/widgets/resources/disk.jsx +++ b/src/components/widgets/resources/disk.jsx @@ -14,8 +14,7 @@ export default function Disk({ options }) {
- Resources - Error + API Error
); @@ -26,23 +25,32 @@ export default function Disk({ options }) {
- - Free - - Used + -
); } + const percent = Math.round((data.drive.usedGb / data.drive.totalGb) * 100); + return ( -
+
-
- - {formatBytes(data.drive.freeGb * 1024 * 1024 * 1024)} Free +
+ + {formatBytes(data.drive.freeGb * 1024 * 1024 * 1024, 0)} Free - - {formatBytes(data.drive.usedGb * 1024 * 1024 * 1024)} Used + + {formatBytes(data.drive.totalGb * 1024 * 1024 * 1024, 0)} Total +
+
+
); diff --git a/src/components/widgets/resources/memory.jsx b/src/components/widgets/resources/memory.jsx index e8d60ccc5..4224785e5 100644 --- a/src/components/widgets/resources/memory.jsx +++ b/src/components/widgets/resources/memory.jsx @@ -14,8 +14,7 @@ export default function Memory() {
- Resources - Error + API Error
); @@ -26,23 +25,32 @@ export default function Memory() {
- - GB Used - - GB Free + -
); } + const percent = Math.round((data.memory.usedMemMb / data.memory.totalMemMb) * 100); + return ( -
+
- - {formatBytes(data.memory.usedMemMb * 1024 * 1024)} Used - - + {formatBytes(data.memory.freeMemMb * 1024 * 1024)} Free + + {formatBytes(data.memory.usedMemMb * 1024 * 1024)} Used + +
+
+
); diff --git a/src/components/widgets/resources/resources.jsx b/src/components/widgets/resources/resources.jsx index 711e97fb7..4275cf263 100644 --- a/src/components/widgets/resources/resources.jsx +++ b/src/components/widgets/resources/resources.jsx @@ -11,9 +11,7 @@ export default function Resources({ options }) { {options.disk && }
{options.label && ( -
- {options.label} -
+
{options.label}
)}
);