Files
OPNexus/frontend/lib/clusters.ts
T
Julian Boldt e26b26eca6
Release / verify (push) Canceled after 0s
CI / checks (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
CI / backend (push) Canceled after 0s
Release / test (push) Canceled after 0s
Release / publish (backend) (push) Canceled after 0s
Release / publish (frontend) (push) Canceled after 0s
Release / publish (proxy) (push) Canceled after 0s
Release v1.10.1-rc2
Siehe CHANGELOG.md
2026-10-07 09:34:26 +02:00

15 lines
421 B
TypeScript

import { Host } from "./api";
export function groupHostsByCluster(hosts: Host[]): { clusters: Record<string, Host[]>; ungrouped: Host[] } {
const clusters: Record<string, Host[]> = {};
const ungrouped: Host[] = [];
for (const host of hosts) {
if (host.cluster_name) {
(clusters[host.cluster_name] ??= []).push(host);
} else {
ungrouped.push(host);
}
}
return { clusters, ungrouped };
}