From 295c6ea7969bda8136a8948180b56a388a5259ad Mon Sep 17 00:00:00 2001 From: Bobby Driggs Date: Wed, 11 Sep 2024 18:14:49 -0700 Subject: [PATCH] Fix: Technitium widget percentage display (#3984) --------- Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com> --- src/widgets/technitium/component.jsx | 29 ++++++++++++++++++---------- src/widgets/technitium/widget.js | 2 +- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/widgets/technitium/component.jsx b/src/widgets/technitium/component.jsx index 76165763c..d510a59df 100644 --- a/src/widgets/technitium/component.jsx +++ b/src/widgets/technitium/component.jsx @@ -53,7 +53,7 @@ export default function Component({ service }) { function toPercent(value, total) { return t("common.percent", { - value: !Number.isNaN(value / total) ? value / total : 0, + value: !Number.isNaN(value / total) ? 100 * (value / total) : 0, maximumFractionDigits: 2, }); } @@ -64,55 +64,64 @@ export default function Component({ service }) { diff --git a/src/widgets/technitium/widget.js b/src/widgets/technitium/widget.js index fb0d42bd0..c3432a677 100644 --- a/src/widgets/technitium/widget.js +++ b/src/widgets/technitium/widget.js @@ -9,7 +9,7 @@ const widget = { endpoint: "dashboard/stats/get", validate: ["response", "status"], params: ["type"], - map: (data) => asJson(data).response.stats, + map: (data) => asJson(data).response?.stats, }, }, };