From 7098f014337779aabfa31d29810412bb0c428071 Mon Sep 17 00:00:00 2001 From: absinthe Date: Sun, 14 Jun 2026 09:13:53 +0800 Subject: [PATCH] fix: rewrite peanut smartcard status --- src/components/services/PeaNUT.vue | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/src/components/services/PeaNUT.vue b/src/components/services/PeaNUT.vue index 0e525f8..d15032f 100644 --- a/src/components/services/PeaNUT.vue +++ b/src/components/services/PeaNUT.vue @@ -32,28 +32,18 @@ export default { }), computed: { status_text: function () { - switch (this.ups_status) { - case "OL": - return "online"; - case "OB": - return "on battery"; - case "LB": - return "low battery"; - default: - return "unknown"; - } + const status = this.ups_status; + if (status.includes("LB")) return "low battery"; + if (status.includes("OB")) return "on battery"; + if (status.includes("OL")) return "online"; + return "unknown"; }, status_class: function () { - switch (this.ups_status) { - case "OL": - return "online"; - case "OB": // On battery - return "pending"; - case "LB": // Low battery - return "offline"; - default: - return "unknown"; - } + const status = this.ups_status; + if (status.includes("LB")) return "offline"; + if (status.includes("OB")) return "pending"; + if (status.includes("OL")) return "online"; + return "unknown"; }, load: function () { if (this.ups_load) {