mirror of
https://github.com/amir20/dozzle.git
synced 2026-06-23 04:10:12 +00:00
727b33c8cc
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
38 lines
709 B
TypeScript
38 lines
709 B
TypeScript
export type Host = {
|
|
id: string;
|
|
name: string;
|
|
nCPU: number;
|
|
memTotal: number;
|
|
type: "agent" | "local" | "remote" | "swarm" | "k8s";
|
|
endpoint: string;
|
|
available: boolean;
|
|
dockerVersion: string;
|
|
runtime?: "docker" | "podman";
|
|
agentVersion: string;
|
|
group?: string;
|
|
};
|
|
|
|
const hosts = ref(
|
|
config.hosts
|
|
.sort((a, b) => a.name.localeCompare(b.name))
|
|
.reduce(
|
|
(acc, item) => {
|
|
acc[item.id] = item;
|
|
return acc;
|
|
},
|
|
{} as Record<string, Host>,
|
|
),
|
|
);
|
|
const updateHost = (host: Host) => {
|
|
delete hosts.value[host.endpoint];
|
|
hosts.value[host.id] = host;
|
|
return host;
|
|
};
|
|
|
|
export function useHosts() {
|
|
return {
|
|
hosts,
|
|
updateHost,
|
|
};
|
|
}
|