feat(plugins): support local JDBC plugin installation

Add a "local install" button that lets users install the JDBC plugin
from a local zip file when online download fails (e.g. draft release).
This commit is contained in:
t8y2
2026-05-14 11:42:21 +08:00
parent 3c0d0fbad9
commit 081a356832
3 changed files with 43 additions and 0 deletions
@@ -281,6 +281,27 @@ async function installJdbcPlugin() {
}
}
async function installJdbcPluginLocal() {
if (isWeb || isInstallingJdbcPlugin.value) return;
const { open } = await import("@tauri-apps/plugin-dialog");
const selected = await open({
title: "选择 JDBC 插件 zip 文件",
multiple: false,
filters: [{ name: "ZIP", extensions: ["zip"] }],
});
if (typeof selected !== "string") return;
isInstallingJdbcPlugin.value = true;
try {
jdbcPluginStatus.value = await invoke<JdbcPluginStatus>("install_jdbc_plugin_local", { path: selected });
toast(t("settings.jdbcPluginInstallSuccess"));
await loadJdbcDrivers();
} catch (e: any) {
toast(String(e?.message || e), 5000);
} finally {
isInstallingJdbcPlugin.value = false;
}
}
async function uninstallJdbcPlugin() {
if (isWeb || isUninstallingJdbcPlugin.value) return;
isUninstallingJdbcPlugin.value = true;
@@ -636,6 +657,16 @@ onUnmounted(() => {
>
{{ isInstallingJdbcPlugin ? t("common.loading") : t("settings.jdbcPluginInstall") }}
</Button>
<Button
v-if="!jdbcPluginStatus?.installed"
type="button"
variant="outline"
:disabled="isInstallingJdbcPlugin"
@click="installJdbcPluginLocal"
>
<FolderOpen class="h-3.5 w-3.5 mr-1" />
本地安装
</Button>
</div>
</div>
</div>