From 7c0680d95121972ee6e2738acf6805c521fe1cb5 Mon Sep 17 00:00:00 2001 From: brikim Date: Mon, 29 Jan 2024 19:13:35 -0600 Subject: [PATCH] Add a used setting for resources and glances information widgets. Defaults to false but when set to true displayed used values for memory and disk. Label is also changed to Used instead of Free when set. Documentation has also been updated. --- docs/widgets/info/glances.md | 1 + docs/widgets/info/resources.md | 11 +++++++++++ src/components/widgets/glances/glances.jsx | 8 ++++---- src/components/widgets/resources/disk.jsx | 6 +++--- src/components/widgets/resources/memory.jsx | 8 ++++---- src/components/widgets/resources/resources.jsx | 8 +++++--- 6 files changed, 28 insertions(+), 14 deletions(-) diff --git a/docs/widgets/info/glances.md b/docs/widgets/info/glances.md index e6fc2a61..887fd073 100644 --- a/docs/widgets/info/glances.md +++ b/docs/widgets/info/glances.md @@ -18,6 +18,7 @@ The Glances widget allows you to monitor the resources (CPU, memory, storage, te uptime: true # disabled by default disk: / # disabled by default, use mount point of disk(s) in glances. Can also be a list (see below) expanded: true # show the expanded view + used: false # show used values instead of free label: MyMachine # optional ``` diff --git a/docs/widgets/info/resources.md b/docs/widgets/info/resources.md index 35f2177b..f68250a5 100644 --- a/docs/widgets/info/resources.md +++ b/docs/widgets/info/resources.md @@ -68,4 +68,15 @@ You can additionally supply an optional `expanded` property set to true in order - /disk3 ``` +You can additionally supply an optional `used` property set to true in order to show used capacity instead of free capacity for memory and disk resources. By default the used property is set to false when not supplied. + +```yaml +- resources: + label: Memory Resouces + used: true + memory: true + disk: + - /disk1 +``` + ![194136533-c4238c82-4d67-41a4-b3c8-18bf26d33ac2](https://user-images.githubusercontent.com/3441425/194728642-a9885274-922b-4027-acf5-a746f58fdfce.png) diff --git a/src/components/widgets/glances/glances.jsx b/src/components/widgets/glances/glances.jsx index 0834b775..fc04f0a3 100644 --- a/src/components/widgets/glances/glances.jsx +++ b/src/components/widgets/glances/glances.jsx @@ -113,11 +113,11 @@ export default function Widget({ options }) {
{options.cpu && } - {options.memory && } + {options.memory && } {Array.isArray(options.disk) - ? options.disk.map((disk) => ) - : options.disk && } + ? options.disk.map((disk) => ) + : options.disk && } {options.cputemp && } {options.uptime && }