Compare commits

...

8 Commits

Author SHA1 Message Date
shamoon
e4d42b5393 FIx: glances containers header position (#4496) 2024-12-26 14:51:11 -08:00
shamoon
f717e59085 Enhancement: support 'nice name' for beszel system ID (#4495) 2024-12-26 11:07:33 -08:00
shamoon
fd05ae377c Enhancement: Better handle some beszel errors (#4493) 2024-12-25 12:17:10 -08:00
shamoon
cc9b4782f2 Merge branch 'dev' 2024-12-24 22:20:20 -08:00
github-actions[bot]
14cda38dbb New Crowdin translations by GitHub Action (#4481)
Co-authored-by: Crowdin Bot <support+bot@crowdin.com>
2024-12-24 22:19:23 -08:00
shamoon
27e3c9f1ed Merge branch 'dev' 2024-12-24 22:18:55 -08:00
shamoon
607c4b7750 Fix: fun with padding and margins (#4489) 2024-12-24 12:22:06 -08:00
shamoon
1c6480586c Fix: fix search overlay behind status indicators in 0.10.x (#4484) 2024-12-23 18:28:04 -08:00
8 changed files with 46 additions and 32 deletions

View File

@@ -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 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 'overview' mode: `["systems", "up"]`
Allowed fields for a single system: `["name", "status", "updated", "cpu", "memory", "disk", "network"]` Allowed fields for a single system: `["name", "status", "updated", "cpu", "memory", "disk", "network"]`

View File

@@ -335,7 +335,7 @@
}, },
"technitium": { "technitium": {
"totalQueries": "Richieste", "totalQueries": "Richieste",
"totalNoError": "Success", "totalNoError": "Successo",
"totalServerFailure": "Failures", "totalServerFailure": "Failures",
"totalNxDomain": "NX Domains", "totalNxDomain": "NX Domains",
"totalRefused": "Refused", "totalRefused": "Refused",
@@ -590,7 +590,7 @@
"total": "Totale" "total": "Totale"
}, },
"peanut": { "peanut": {
"battery_charge": "Battery Charge", "battery_charge": "Carica Batteria",
"ups_load": "Carico UPS", "ups_load": "Carico UPS",
"ups_status": "Stato UPS", "ups_status": "Stato UPS",
"online": "Online", "online": "Online",
@@ -854,7 +854,7 @@
}, },
"romm": { "romm": {
"platforms": "Piattaforme", "platforms": "Piattaforme",
"totalRoms": "Games", "totalRoms": "Giochi",
"saves": "Saves", "saves": "Saves",
"states": "States", "states": "States",
"screenshots": "Screenshots", "screenshots": "Screenshots",
@@ -890,7 +890,7 @@
"sceneDuration": "Durata Delle Scene", "sceneDuration": "Durata Delle Scene",
"images": "Immagini", "images": "Immagini",
"imageSize": "Dimensioni immagine", "imageSize": "Dimensioni immagine",
"galleries": "Galleries", "galleries": "Gallerie",
"performers": "Esecutori", "performers": "Esecutori",
"studios": "Studi", "studios": "Studi",
"movies": "Film", "movies": "Film",
@@ -933,7 +933,7 @@
}, },
"stocks": { "stocks": {
"stocks": "Stocks", "stocks": "Stocks",
"loading": "Loading", "loading": "Caricamento",
"open": "Open - US Market", "open": "Open - US Market",
"closed": "Closed - US Market", "closed": "Closed - US Market",
"invalidConfiguration": "Invalid Configuration" "invalidConfiguration": "Invalid Configuration"
@@ -944,8 +944,8 @@
"version": "Versione" "version": "Versione"
}, },
"linkwarden": { "linkwarden": {
"links": "Links", "links": "Collegamenti",
"collections": "Collections", "collections": "Raccolte",
"tags": "Tag" "tags": "Tag"
}, },
"zabbix": { "zabbix": {
@@ -957,12 +957,12 @@
"disaster": "Disaster" "disaster": "Disaster"
}, },
"lubelogger": { "lubelogger": {
"vehicle": "Vehicle", "vehicle": "Veicolo",
"vehicles": "Vehicles", "vehicles": "Veicoli",
"serviceRecords": "Service Records", "serviceRecords": "Service Records",
"reminders": "Reminders", "reminders": "Promemoria",
"nextReminder": "Next Reminder", "nextReminder": "Promemoria Seguente",
"none": "None" "none": "Nessuno"
}, },
"vikunja": { "vikunja": {
"projects": "Active Projects", "projects": "Active Projects",
@@ -1000,7 +1000,7 @@
"suspended": "Suspended" "suspended": "Suspended"
}, },
"spoolman": { "spoolman": {
"loading": "Loading" "loading": "Caricamento"
}, },
"gitlab": { "gitlab": {
"groups": "Groups", "groups": "Groups",

View File

@@ -23,10 +23,7 @@ export default function ServicesGroup({
if (layout?.initiallyCollapsed ?? groupsInitiallyCollapsed) panel.current.style.height = `0`; if (layout?.initiallyCollapsed ?? groupsInitiallyCollapsed) panel.current.style.height = `0`;
}, [layout, groupsInitiallyCollapsed]); }, [layout, groupsInitiallyCollapsed]);
let groupMargin = layout?.header === false ? "-my-1" : ""; let groupPadding = layout?.header === false ? "px-1" : "p-1 pb-0";
if (isSubgroup && layout?.header === false) groupMargin = "-my-3";
let groupPadding = layout?.header === false ? "px-1" : "p-1";
if (isSubgroup) groupPadding = ""; if (isSubgroup) groupPadding = "";
return ( return (
@@ -36,7 +33,6 @@ export default function ServicesGroup({
"services-group flex-1", "services-group flex-1",
layout?.style === "row" ? "basis-full" : "basis-full md:basis-1/2 lg:basis-1/3 xl:basis-1/4", layout?.style === "row" ? "basis-full" : "basis-full md:basis-1/2 lg:basis-1/3 xl:basis-1/4",
layout?.style !== "row" && fiveColumns ? "3xl:basis-1/5" : "", layout?.style !== "row" && fiveColumns ? "3xl:basis-1/5" : "",
groupMargin,
groupPadding, groupPadding,
isSubgroup ? "subgroup" : "", isSubgroup ? "subgroup" : "",
)} )}
@@ -89,6 +85,7 @@ export default function ServicesGroup({
services={group.services} services={group.services}
layout={layout} layout={layout}
useEqualHeights={useEqualHeights} useEqualHeights={useEqualHeights}
header={layout?.header !== false}
/> />
{group.groups?.length > 0 && ( {group.groups?.length > 0 && (
<div <div

View File

@@ -86,7 +86,7 @@ export default function Item({ service, groupName, useEqualHeights }) {
<div <div
className={`absolute top-0 right-0 flex flex-row justify-end ${ className={`absolute top-0 right-0 flex flex-row justify-end ${
statusStyle === "dot" ? "gap-0" : "gap-2 mr-2" statusStyle === "dot" ? "gap-0" : "gap-2 mr-2"
} z-30 service-tags`} } z-10 service-tags`}
> >
{service.ping && ( {service.ping && (
<div className="flex-shrink-0 flex items-center justify-center service-tag service-ping"> <div className="flex-shrink-0 flex items-center justify-center service-tag service-ping">

View File

@@ -4,12 +4,13 @@ import { columnMap } from "../../utils/layout/columns";
import Item from "components/services/item"; import Item from "components/services/item";
export default function List({ groupName, services, layout, useEqualHeights }) { export default function List({ groupName, services, layout, useEqualHeights, header }) {
return ( return (
<ul <ul
className={classNames( className={classNames(
layout?.style === "row" ? `grid ${columnMap[layout?.columns]} gap-x-2` : "flex flex-col", layout?.style === "row" ? `grid ${columnMap[layout?.columns]} gap-x-2` : "flex flex-col",
"mt-3 services-list", header ? "mt-3" : "",
"services-list",
)} )}
> >
{services.map((service) => ( {services.map((service) => (

View File

@@ -20,8 +20,20 @@ export default function Component({ service }) {
widget.fields = widget.fields.slice(0, MAX_ALLOWED_FIELDS); widget.fields = widget.fields.slice(0, MAX_ALLOWED_FIELDS);
} }
if (systemsError) { let system = null;
return <Container service={service} error={systemsError} />; let finalError = systemsError;
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 || item.name === systemId);
if (!system) {
finalError = { message: `System with id ${systemId} not found` };
}
}
if (finalError) {
return <Container service={service} error={finalError} />;
} }
if (!systems) { if (!systems) {
@@ -33,9 +45,7 @@ export default function Component({ service }) {
); );
} }
if (systemId) { if (system) {
const system = systems.items.find((item) => item.id === systemId);
return ( return (
<Container service={service}> <Container service={service}>
<Block label="beszel.name" value={system.name} /> <Block label="beszel.name" value={system.name} />

View File

@@ -59,7 +59,7 @@ export default async function beszelProxyHandler(req, res) {
if (!token) { if (!token) {
[status, token] = await login(loginUrl, widget.username, widget.password, service); [status, token] = await login(loginUrl, widget.username, widget.password, service);
if (status !== 200) { if (status !== 200) {
logger.debug(`HTTP ${status} logging into Beszel: ${token}`); logger.debug(`HTTP ${status} logging into Beszel: ${JSON.stringify(token)}`);
return res.status(status).send(token); return res.status(status).send(token);
} }
} }
@@ -72,13 +72,13 @@ export default async function beszelProxyHandler(req, res) {
}, },
}); });
if (status === 403) { if ([400, 403].includes(status)) {
logger.debug(`HTTP ${status} retrieving data from Beszel, logging in and trying again.`); logger.debug(`HTTP ${status} retrieving data from Beszel, logging in and trying again.`);
cache.del(`${tokenCacheKey}.${service}`); cache.del(`${tokenCacheKey}.${service}`);
[status, token] = await login(loginUrl, widget.username, widget.password, service); [status, token] = await login(loginUrl, widget.username, widget.password, service);
if (status !== 200) { if (status !== 200) {
logger.debug(`HTTP ${status} logging into Beszel: ${data}`); logger.debug(`HTTP ${status} logging into Beszel: ${JSON.stringify(data)}`);
return res.status(status).send(data); return res.status(status).send(data);
} }

View File

@@ -38,10 +38,16 @@ export default function Component({ service }) {
} }
data.splice(chart ? 5 : 1); data.splice(chart ? 5 : 1);
let headerYPosition = "top-4";
let listYPosition = "bottom-4";
if (chart) {
headerYPosition = "-top-6";
listYPosition = "-top-3";
}
return ( return (
<Container chart={chart}> <Container chart={chart}>
<Block position="top-4 right-3 left-3"> <Block position={`${headerYPosition} right-3 left-3`}>
<div className="flex items-center text-xs"> <div className="flex items-center text-xs">
<div className="grow" /> <div className="grow" />
<div className="w-14 text-right italic">{t("resources.cpu")}</div> <div className="w-14 text-right italic">{t("resources.cpu")}</div>
@@ -49,7 +55,7 @@ export default function Component({ service }) {
</div> </div>
</Block> </Block>
<Block position="bottom-4 right-3 left-3"> <Block position={`${listYPosition} right-3 left-3`}>
<div className="pointer-events-none text-theme-900 dark:text-theme-200"> <div className="pointer-events-none text-theme-900 dark:text-theme-200">
{data.map((item) => ( {data.map((item) => (
<div key={item[idKey]} className="text-[0.75rem] h-[0.8rem]"> <div key={item[idKey]} className="text-[0.75rem] h-[0.8rem]">