feat(integrations): recover beszel integration from worktree

Recovered all beszel integration files from the local worktree
at /Users/ajnart/.cursor/worktrees/homarr/pwxp that were built
and tested with the homarr:beszel docker image.
This commit is contained in:
Thomas Camlong committed 2026-06-08 12:54:30 +02:00
1 parent 87d3f6a0a1
commit 6757fbe956
29 files changed
+2526 -18

No files matched your search

@@ -0,0 +1,21 @@
import type { BeszelSystemStatus } from "./types";
export const thresholdColor = (value: number): string => {
if (value >= 80) return "red";
if (value >= 50) return "yellow";
return "green";
};
export const loadAvgColor = (la1: number, cores: number): string => {
const ratio = la1 / cores;
if (ratio >= 1.5) return "red";
if (ratio >= 0.8) return "yellow";
return "green";
};
export const statusColorMap: Record<BeszelSystemStatus, string> = {
up: "green",
down: "red",
paused: "gray",
pending: "yellow",
};
@@ -0,0 +1,29 @@
export const formatBytes = (bytes: number): string => {
if (bytes === 0) return "0 B/s";
const units = ["B/s", "KB/s", "MB/s", "GB/s"];
const i = Math.floor(Math.log(bytes) / Math.log(1024));
const value = bytes / Math.pow(1024, i);
return `${value.toFixed(value < 10 ? 2 : 1)} ${units[i]}`;
};
export const formatUptime = (seconds: number): string => {
const days = Math.floor(seconds / 86400);
const hours = Math.floor((seconds % 86400) / 3600);
if (days > 0) return `${days} day${days > 1 ? "s" : ""}`;
if (hours > 0) return `${hours} hour${hours > 1 ? "s" : ""}`;
const minutes = Math.floor((seconds % 3600) / 60);
return `${minutes} min`;
};
export const formatTemp = (celsius: number | null, fahrenheit: boolean): string => {
if (celsius === null) return "—";
if (fahrenheit) return `${((celsius * 9) / 5 + 32).toFixed(1)} °F`;
return `${celsius.toFixed(2)} °C`;
};
export const formatPercent = (value: number): string => `${value.toFixed(1)}%`;
export const formatLoadAvg = (la: [number, number, number] | null): string => {
if (!la) return "—";
return la.map((v) => v.toFixed(2)).join(" ");
};
@@ -0,0 +1,23 @@
export type BeszelSystemStatus = "up" | "down" | "paused" | "pending";
export interface BeszelSystemRow {
id: string;
name: string;
status: BeszelSystemStatus;
cpu: number;
memory: number;
disk: number;
gpu: number;
loadAvg: [number, number, number] | null;
netBytes: number;
temp: number | null;
battery: [number, number] | null;
services: number;
uptime: number;
agentVersion: string;
hostname: string;
cpuModel: string;
cores: number;
memoryTotal: number;
osName: string;
}