Files
dozzle/assets/stores/hosts.ts
T
Amir Raminfar 727b33c8cc feat: detect podman vs docker and show runtime icon (#4717)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 05:47:08 -07:00

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,
};
}