feat: add Clone Database to Docker functionality
Clone any database to a local Docker PostgreSQL container with schema and/or data transfer via pg_dump. Supports three modes: schema only, full clone, and sample data. Includes container lifecycle management (start/stop/remove) in the Admin panel, progress tracking with collapsible process log, and automatic connection creation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,11 @@ import type {
|
||||
OllamaModel,
|
||||
EntityLookupResult,
|
||||
LookupProgress,
|
||||
DockerStatus,
|
||||
CloneToDockerParams,
|
||||
CloneProgress,
|
||||
CloneResult,
|
||||
TuskContainer,
|
||||
} from "@/types";
|
||||
|
||||
// Connections
|
||||
@@ -291,3 +296,27 @@ export const onLookupProgress = (
|
||||
callback: (p: LookupProgress) => void
|
||||
): Promise<UnlistenFn> =>
|
||||
listen<LookupProgress>("lookup-progress", (e) => callback(e.payload));
|
||||
|
||||
// Docker
|
||||
export const checkDocker = () =>
|
||||
invoke<DockerStatus>("check_docker");
|
||||
|
||||
export const listTuskContainers = () =>
|
||||
invoke<TuskContainer[]>("list_tusk_containers");
|
||||
|
||||
export const cloneToDocker = (params: CloneToDockerParams, cloneId: string) =>
|
||||
invoke<CloneResult>("clone_to_docker", { params, cloneId });
|
||||
|
||||
export const startContainer = (name: string) =>
|
||||
invoke<void>("start_container", { name });
|
||||
|
||||
export const stopContainer = (name: string) =>
|
||||
invoke<void>("stop_container", { name });
|
||||
|
||||
export const removeContainer = (name: string) =>
|
||||
invoke<void>("remove_container", { name });
|
||||
|
||||
export const onCloneProgress = (
|
||||
callback: (p: CloneProgress) => void
|
||||
): Promise<UnlistenFn> =>
|
||||
listen<CloneProgress>("clone-progress", (e) => callback(e.payload));
|
||||
|
||||
Reference in New Issue
Block a user