Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

docs(beszel): update system stats widget documentation and add time-period config

Thomas Camlonge22eee271c6b
diff --git a/apps/docs/docs/widgets/beszel-system-stats/index.ts b/apps/docs/docs/widgets/beszel-system-stats/index.ts
index 4b7d5fe7c..d19ae9154 100644
--- a/apps/docs/docs/widgets/beszel-system-stats/index.ts
+++ b/apps/docs/docs/widgets/beszel-system-stats/index.ts
@@ -10,10 +10,10 @@ export const beszelSystemStatsWidget: WidgetDefinition = {
items: [
{
name: "Time period",
- description: "The time range for chart data",
+ description: "The time range for chart data. '1 Minute' enables live streaming via PocketBase SSE (requires Beszel agent >= 0.13.0)",
values: {
type: "select",
- options: ["1 Hour", "12 Hours", "24 Hours", "1 Week", "30 Days"],
+ options: ["1 Minute", "1 Hour", "12 Hours", "24 Hours", "1 Week", "30 Days"],
},
defaultValue: "1 Hour",
},
diff --git a/packages/widgets/src/beszel/_shared/time-period.ts b/packages/widgets/src/beszel/_shared/time-period.ts
new file mode 100644
index 000000000..83ecba855
--- /dev/null
+++ b/packages/widgets/src/beszel/_shared/time-period.ts
@@ -0,0 +1,19 @@
+export const beszelTimePeriods = ["1m", "1h", "12h", "24h", "1w", "30d"] as const;
+export type BeszelTimePeriod = (typeof beszelTimePeriods)[number];
+
+export const beszelTimePeriodConfig: Record<
+ BeszelTimePeriod,
+ {
+ beszelStatType: string;
+ perPage: number;
+ refetchMs: number;
+ serverCacheSeconds: number;
+ }
+> = {
+ "1m": { beszelStatType: "1m", perPage: 60, refetchMs: 0, serverCacheSeconds: 5 },
+ "1h": { beszelStatType: "1m", perPage: 60, refetchMs: 60_000, serverCacheSeconds: 60 },
+ "12h": { beszelStatType: "10m", perPage: 72, refetchMs: 300_000, serverCacheSeconds: 300 },
+ "24h": { beszelStatType: "20m", perPage: 72, refetchMs: 600_000, serverCacheSeconds: 600 },
+ "1w": { beszelStatType: "120m", perPage: 84, refetchMs: 1_800_000, serverCacheSeconds: 1800 },
+ "30d": { beszelStatType: "480m", perPage: 90, refetchMs: 3_600_000, serverCacheSeconds: 3600 },
+};