25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
feat(agent): add reinstall JRE button in Driver Manager
t8y2bc687cee7fc7
diff --git a/src-tauri/src/commands/agents.rs b/src-tauri/src/commands/agents.rsindex 8832ad18a6..cb76dc83f4 100644--- a/src-tauri/src/commands/agents.rs+++ b/src-tauri/src/commands/agents.rs@@ -93,6 +93,27 @@ pub async fn check_jre_installed(state: State<'_, Arc<AppState>>) -> Result<boolOk(state.agent_manager.is_jre_installed())}+#[tauri::command]+pub async fn reinstall_jre(state: State<'_, Arc<AppState>>) -> Result<(), String> {+ let am = &state.agent_manager;+ let jre_dir = am.base_dir().join("jre");+ if jre_dir.exists() {+ std::fs::remove_dir_all(&jre_dir).map_err(|e| format!("Failed to remove old JRE: {e}"))?;+ }+ let registry = fetch_registry().await?;+ let platform = AgentManager::current_platform();+ let jre_info =+ registry.jre.platforms.get(platform).ok_or_else(|| format!("No JRE available for platform: {platform}"))?;+ let jre_archive = am.base_dir().join("jre-download.tar.gz");+ download_with_proxy(&jre_info.url, &jre_archive).await?;+ extract_archive(&jre_archive, &jre_dir)?;+ std::fs::remove_file(&jre_archive).ok();+ let mut local_state = am.load_state();+ local_state.jre_version = Some(registry.jre.version.clone());+ am.save_state(&local_state)?;+ Ok(())+}+async fn fetch_registry() -> Result<AgentRegistry, String> {let client = reqwest::Client::builder().timeout(std::time::Duration::from_secs(10))diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rsindex a431131d49..45a306493a 100644--- a/src-tauri/src/lib.rs+++ b/src-tauri/src/lib.rs@@ -147,6 +147,7 @@ pub fn run() {commands::agents::install_agent,commands::agents::uninstall_agent,commands::agents::check_jre_installed,+ commands::agents::reinstall_jre,]).build(tauri::generate_context!()).expect("error while building tauri application")diff --git a/src/components/config/DriverManager.vue b/src/components/config/DriverManager.vueindex 30c6dd3032..66e22de608 100644--- a/src/components/config/DriverManager.vue+++ b/src/components/config/DriverManager.vue@@ -16,6 +16,7 @@ interface AgentDriverInfo {const drivers = ref<AgentDriverInfo[]>([]);const jreInstalled = ref(false);const installing = ref<string | null>(null);+const reinstallingJre = ref(false);onMounted(async () => {await refresh();@@ -47,6 +48,18 @@ async function uninstallDriver(dbType: string) {}}+async function reinstallJre() {+ reinstallingJre.value = true;+ try {+ await invoke("reinstall_jre");+ await refresh();+ } catch (e: any) {+ alert(e);+ } finally {+ reinstallingJre.value = false;+ }+}+function formatSize(bytes: number): string {return `${(bytes / 1024 / 1024).toFixed(1)} MB`;}@@ -56,9 +69,18 @@ function formatSize(bytes: number): string {<div class="space-y-4 p-4"><h3 class="text-lg font-medium">驱动管理</h3>- <div class="text-sm text-muted-foreground">- JRE: {{ jreInstalled ? "✓ 已安装" : "未安装" }}- <span v-if="!jreInstalled" class="ml-2 text-xs">(首次安装驱动时自动下载)</span>+ <div class="flex items-center gap-3 text-sm text-muted-foreground">+ <span>JRE: {{ jreInstalled ? "✓ 已安装" : "未安装" }}</span>+ <span v-if="!jreInstalled" class="text-xs">(首次安装驱动时自动下载)</span>+ <Button+ v-if="jreInstalled"+ size="sm"+ variant="ghost"+ :disabled="reinstallingJre || installing !== null"+ @click="reinstallJre"+ >+ {{ reinstallingJre ? "重装中..." : "重新安装 JRE" }}+ </Button></div><div class="space-y-2">