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
Siehe CHANGELOG.md
15 lines
421 B
TypeScript
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 };
|
|
}
|