feat: expand advanced widget experiences
This commit is contained in:
1 parent
55226842f9
commit
65a7e84bea
137 files changed
+3684
-850
No files matched your search
@@ -0,0 +1,28 @@
|
||||
export const beszelTableMetricOptionKeys = [
|
||||
"showCpu",
|
||||
"showMemory",
|
||||
"showDisk",
|
||||
"showGpu",
|
||||
"showLoadAvg",
|
||||
"showNet",
|
||||
"showTemp",
|
||||
"showBattery",
|
||||
"showServices",
|
||||
"showUptime",
|
||||
"showAgent",
|
||||
] as const;
|
||||
|
||||
type BeszelTableMetricOptions = Record<(typeof beszelTableMetricOptionKeys)[number], boolean>;
|
||||
|
||||
export const getBeszelTableVisibleMetricKeys = (
|
||||
options: BeszelTableMetricOptions,
|
||||
width: number,
|
||||
isAdvanced: boolean,
|
||||
) => {
|
||||
const enabled = isAdvanced
|
||||
? [...beszelTableMetricOptionKeys]
|
||||
: beszelTableMetricOptionKeys.filter((key) => options[key]);
|
||||
const budget = isAdvanced ? enabled.length : width < 360 ? 1 : width < 560 ? 2 : width < 760 ? 4 : enabled.length;
|
||||
|
||||
return new Set(enabled.slice(0, budget));
|
||||
};
|
||||
Reference in new issue
Block a user