1
0
mirror of https://github.com/amir20/dozzle.git synced 2026-01-01 10:37:26 +01:00
Files
dozzle/assets/stores/hosts.ts

28 lines
492 B
TypeScript

export type Host = {
name: string;
id: string;
nCPU: number;
memTotal: number;
available: boolean;
};
const hosts = computed(() =>
config.hosts.reduce(
(acc, item) => {
acc[item.id] = { ...item, available: true };
return acc;
},
{} as Record<string, Host>,
),
);
const markHostAvailable = (id: string, available: boolean) => {
hosts.value[id].available = available;
};
export function useHosts() {
return {
hosts,
markHostAvailable,
};
}