From f717e5908577f8fdbb55dec10c1c320e07579809 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu, 26 Dec 2024 11:07:33 -0800 Subject: [PATCH] Enhancement: support 'nice name' for beszel system ID (#4495) --- docs/widgets/services/beszel.md | 2 +- src/widgets/beszel/component.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/widgets/services/beszel.md b/docs/widgets/services/beszel.md index c5391568..99715191 100644 --- a/docs/widgets/services/beszel.md +++ b/docs/widgets/services/beszel.md @@ -7,7 +7,7 @@ Learn more about [Beszel](https://github.com/henrygd/beszel) The widget has two modes, a single system with detailed info if `systemId` is provided, or an overview of all systems if `systemId` is not provided. -The `systemID` in the `id` field on the collections page of Beszel. +The `systemID` is the `id` field on the collections page of Beszel under the PocketBase admin panel. You can also use the 'nice name' from the Beszel UI. Allowed fields for 'overview' mode: `["systems", "up"]` Allowed fields for a single system: `["name", "status", "updated", "cpu", "memory", "disk", "network"]` diff --git a/src/widgets/beszel/component.jsx b/src/widgets/beszel/component.jsx index 493a169e..da1b7a48 100644 --- a/src/widgets/beszel/component.jsx +++ b/src/widgets/beszel/component.jsx @@ -26,7 +26,7 @@ export default function Component({ service }) { if (systems && !systems.items) { finalError = { message: "No items returned from beszel API" }; } else if (systems && systems.items && systemId) { - system = systems.items.find((item) => item.id === systemId); + system = systems.items.find((item) => item.id === systemId || item.name === systemId); if (!system) { finalError = { message: `System with id ${systemId} not found` }; }