fix: finalize adding docker to db
This commit is contained in:
@@ -201,12 +201,14 @@ async function initializeCompleteDatabase(): Promise<void> {
|
|||||||
enable_tunnel INTEGER NOT NULL DEFAULT 1,
|
enable_tunnel INTEGER NOT NULL DEFAULT 1,
|
||||||
tunnel_connections TEXT,
|
tunnel_connections TEXT,
|
||||||
enable_file_manager INTEGER NOT NULL DEFAULT 1,
|
enable_file_manager INTEGER NOT NULL DEFAULT 1,
|
||||||
|
enable_docker INTEGER NOT NULL DEFAULT 0,
|
||||||
default_path TEXT,
|
default_path TEXT,
|
||||||
autostart_password TEXT,
|
autostart_password TEXT,
|
||||||
autostart_key TEXT,
|
autostart_key TEXT,
|
||||||
autostart_key_password TEXT,
|
autostart_key_password TEXT,
|
||||||
force_keyboard_interactive TEXT,
|
force_keyboard_interactive TEXT,
|
||||||
stats_config TEXT,
|
stats_config TEXT,
|
||||||
|
docker_config TEXT,
|
||||||
terminal_config TEXT,
|
terminal_config TEXT,
|
||||||
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
@@ -486,6 +488,12 @@ const migrateSchema = () => {
|
|||||||
addColumnIfNotExists("ssh_data", "stats_config", "TEXT");
|
addColumnIfNotExists("ssh_data", "stats_config", "TEXT");
|
||||||
addColumnIfNotExists("ssh_data", "terminal_config", "TEXT");
|
addColumnIfNotExists("ssh_data", "terminal_config", "TEXT");
|
||||||
addColumnIfNotExists("ssh_data", "quick_actions", "TEXT");
|
addColumnIfNotExists("ssh_data", "quick_actions", "TEXT");
|
||||||
|
addColumnIfNotExists(
|
||||||
|
"ssh_data",
|
||||||
|
"enable_docker",
|
||||||
|
"INTEGER NOT NULL DEFAULT 0",
|
||||||
|
);
|
||||||
|
addColumnIfNotExists("ssh_data", "docker_config", "TEXT");
|
||||||
|
|
||||||
addColumnIfNotExists("ssh_credentials", "private_key", "TEXT");
|
addColumnIfNotExists("ssh_credentials", "private_key", "TEXT");
|
||||||
addColumnIfNotExists("ssh_credentials", "public_key", "TEXT");
|
addColumnIfNotExists("ssh_credentials", "public_key", "TEXT");
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ export interface DockerConfig {
|
|||||||
tlsCaCert?: string;
|
tlsCaCert?: string;
|
||||||
tlsCert?: string;
|
tlsCert?: string;
|
||||||
tlsKey?: string;
|
tlsKey?: string;
|
||||||
apiVersion?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SSHHost {
|
export interface SSHHost {
|
||||||
|
|||||||
@@ -577,7 +577,6 @@ export function HostManagerEditor({
|
|||||||
tlsCaCert: z.string().optional(),
|
tlsCaCert: z.string().optional(),
|
||||||
tlsCert: z.string().optional(),
|
tlsCert: z.string().optional(),
|
||||||
tlsKey: z.string().optional(),
|
tlsKey: z.string().optional(),
|
||||||
apiVersion: z.string().optional(),
|
|
||||||
})
|
})
|
||||||
.optional(),
|
.optional(),
|
||||||
})
|
})
|
||||||
@@ -682,7 +681,6 @@ export function HostManagerEditor({
|
|||||||
tlsCaCert: "",
|
tlsCaCert: "",
|
||||||
tlsCert: "",
|
tlsCert: "",
|
||||||
tlsKey: "",
|
tlsKey: "",
|
||||||
apiVersion: "",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -738,6 +736,28 @@ export function HostManagerEditor({
|
|||||||
|
|
||||||
parsedStatsConfig = { ...DEFAULT_STATS_CONFIG, ...parsedStatsConfig };
|
parsedStatsConfig = { ...DEFAULT_STATS_CONFIG, ...parsedStatsConfig };
|
||||||
|
|
||||||
|
let parsedDockerConfig = {
|
||||||
|
connectionType: "socket" as const,
|
||||||
|
socketPath: "/var/run/docker.sock",
|
||||||
|
host: "",
|
||||||
|
port: 2375,
|
||||||
|
tlsVerify: true,
|
||||||
|
tlsCaCert: "",
|
||||||
|
tlsCert: "",
|
||||||
|
tlsKey: "",
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
if (cleanedHost.dockerConfig) {
|
||||||
|
const parsed =
|
||||||
|
typeof cleanedHost.dockerConfig === "string"
|
||||||
|
? JSON.parse(cleanedHost.dockerConfig)
|
||||||
|
: cleanedHost.dockerConfig;
|
||||||
|
parsedDockerConfig = { ...parsedDockerConfig, ...parsed };
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Failed to parse dockerConfig:", error);
|
||||||
|
}
|
||||||
|
|
||||||
const formData = {
|
const formData = {
|
||||||
name: cleanedHost.name || "",
|
name: cleanedHost.name || "",
|
||||||
ip: cleanedHost.ip || "",
|
ip: cleanedHost.ip || "",
|
||||||
@@ -780,17 +800,7 @@ export function HostManagerEditor({
|
|||||||
},
|
},
|
||||||
forceKeyboardInteractive: Boolean(cleanedHost.forceKeyboardInteractive),
|
forceKeyboardInteractive: Boolean(cleanedHost.forceKeyboardInteractive),
|
||||||
enableDocker: Boolean(cleanedHost.enableDocker),
|
enableDocker: Boolean(cleanedHost.enableDocker),
|
||||||
dockerConfig: cleanedHost.dockerConfig || {
|
dockerConfig: parsedDockerConfig,
|
||||||
connectionType: "socket" as const,
|
|
||||||
socketPath: "/var/run/docker.sock",
|
|
||||||
host: "",
|
|
||||||
port: 2375,
|
|
||||||
tlsVerify: true,
|
|
||||||
tlsCaCert: "",
|
|
||||||
tlsCert: "",
|
|
||||||
tlsKey: "",
|
|
||||||
apiVersion: "",
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (defaultAuthType === "password") {
|
if (defaultAuthType === "password") {
|
||||||
@@ -852,7 +862,6 @@ export function HostManagerEditor({
|
|||||||
tlsCaCert: "",
|
tlsCaCert: "",
|
||||||
tlsCert: "",
|
tlsCert: "",
|
||||||
tlsKey: "",
|
tlsKey: "",
|
||||||
apiVersion: "",
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2877,26 +2886,6 @@ export function HostManagerEditor({
|
|||||||
</AccordionItem>
|
</AccordionItem>
|
||||||
</Accordion>
|
</Accordion>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<FormField
|
|
||||||
control={form.control}
|
|
||||||
name="dockerConfig.apiVersion"
|
|
||||||
render={({ field }) => (
|
|
||||||
<FormItem>
|
|
||||||
<FormLabel>API Version (Optional)</FormLabel>
|
|
||||||
<FormControl>
|
|
||||||
<Input
|
|
||||||
placeholder="1.41 (leave empty for auto)"
|
|
||||||
{...field}
|
|
||||||
/>
|
|
||||||
</FormControl>
|
|
||||||
<FormDescription>
|
|
||||||
Specify Docker API version, or leave empty to use
|
|
||||||
the default
|
|
||||||
</FormDescription>
|
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
|
|||||||
@@ -461,7 +461,7 @@ export function ServerStats({
|
|||||||
{(metricsEnabled && showStatsUI) ||
|
{(metricsEnabled && showStatsUI) ||
|
||||||
(currentHostConfig?.quickActions &&
|
(currentHostConfig?.quickActions &&
|
||||||
currentHostConfig.quickActions.length > 0) ? (
|
currentHostConfig.quickActions.length > 0) ? (
|
||||||
<div className="rounded-lg border-2 border-dark-border m-3 p-4 overflow-y-auto relative flex-1 flex flex-col">
|
<div className="rounded-lg border-dark-border m-3 p-1 overflow-y-auto relative flex-1 flex flex-col">
|
||||||
{currentHostConfig?.quickActions &&
|
{currentHostConfig?.quickActions &&
|
||||||
currentHostConfig.quickActions.length > 0 && (
|
currentHostConfig.quickActions.length > 0 && (
|
||||||
<div className={metricsEnabled && showStatsUI ? "mb-4" : ""}>
|
<div className={metricsEnabled && showStatsUI ? "mb-4" : ""}>
|
||||||
|
|||||||
Reference in New Issue
Block a user