feat(connection): add configurable SSH timeout
This commit is contained in:
1 parent
a8d45ca0e7
commit
9c71442f43
9 files changed
+87
-14
No files matched your search
@@ -63,6 +63,7 @@ const defaultForm = (): Omit<ConnectionConfig, "id"> => ({
|
||||
ssh_key_path: "",
|
||||
ssh_key_passphrase: "",
|
||||
ssh_expose_lan: false,
|
||||
ssh_connect_timeout_secs: 5,
|
||||
ssl: false,
|
||||
connection_string: undefined,
|
||||
});
|
||||
@@ -245,6 +246,7 @@ watch(
|
||||
ssh_key_path: config.ssh_key_path || "",
|
||||
ssh_key_passphrase: config.ssh_key_passphrase || "",
|
||||
ssh_expose_lan: config.ssh_expose_lan || false,
|
||||
ssh_connect_timeout_secs: config.ssh_connect_timeout_secs || 5,
|
||||
ssl: config.ssl || false,
|
||||
connection_string: config.connection_string,
|
||||
};
|
||||
@@ -429,6 +431,8 @@ async function testConnection() {
|
||||
|
||||
function connectionConfigForSubmit(id: string): ConnectionConfig {
|
||||
const config: ConnectionConfig = { ...form.value, id };
|
||||
const sshTimeout = Number(config.ssh_connect_timeout_secs);
|
||||
config.ssh_connect_timeout_secs = Number.isFinite(sshTimeout) && sshTimeout > 0 ? sshTimeout : 5;
|
||||
if (config.db_type === "mongodb" && !mongoUseUrl.value) {
|
||||
config.connection_string = undefined;
|
||||
}
|
||||
@@ -965,6 +969,18 @@ async function browseDbFilePath() {
|
||||
<span class="text-xs text-muted-foreground">{{ t("connection.sshExposeLan") }}</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="grid grid-cols-4 items-center gap-4">
|
||||
<Label class="text-right text-xs">{{ t("connection.sshConnectTimeout") }}</Label>
|
||||
<Input
|
||||
v-model.number="form.ssh_connect_timeout_secs"
|
||||
type="number"
|
||||
min="5"
|
||||
max="300"
|
||||
step="1"
|
||||
class="col-span-3"
|
||||
:disabled="!form.ssh_enabled"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
|
||||
@@ -116,6 +116,7 @@ export default {
|
||||
sshKeyPassphrasePlaceholder: "Leave empty if key is not encrypted",
|
||||
sshKeyPathBrowse: "Browse",
|
||||
sshExposeLan: "Expose tunnel to LAN",
|
||||
sshConnectTimeout: "SSH Timeout (seconds)",
|
||||
dmCompatHint: "Requires DM8 ODBC driver installed on your system.",
|
||||
dmDownload: "Download from Dameng",
|
||||
mongoLegacyHint:
|
||||
|
||||
@@ -115,6 +115,7 @@ export default {
|
||||
sshKeyPassphrasePlaceholder: "密钥未加密则留空",
|
||||
sshKeyPathBrowse: "浏览",
|
||||
sshExposeLan: "允许局域网访问隧道",
|
||||
sshConnectTimeout: "SSH 超时时间(秒)",
|
||||
dmCompatHint: "需要在系统上安装达梦 DM8 ODBC 驱动程序。",
|
||||
dmDownload: "前往达梦官网下载",
|
||||
mongoLegacyHint:
|
||||
|
||||
@@ -163,6 +163,7 @@ export const useConnectionStore = defineStore("connection", () => {
|
||||
driver_profile: profile,
|
||||
driver_label: config.driver_label || labelMap[profile] || config.db_type,
|
||||
url_params: config.url_params || "",
|
||||
ssh_connect_timeout_secs: config.ssh_connect_timeout_secs || 5,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ export interface ConnectionConfig {
|
||||
ssh_key_path?: string;
|
||||
ssh_key_passphrase?: string;
|
||||
ssh_expose_lan?: boolean;
|
||||
ssh_connect_timeout_secs?: number;
|
||||
ssl?: boolean;
|
||||
sysdba?: boolean;
|
||||
connection_string?: string;
|
||||
|
||||
Reference in new issue
Block a user