mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-29 00:09:52 +00:00
feat: multi-JRE support, Oracle 10g driver profile, and JRE uninstall
- Support multiple JRE versions per agent driver (jre-8/, jre-17/) - Auto-migrate legacy jre/ directory to jre-17/ - Detect macOS Adoptium JRE 8 Contents/Home/ layout - Route Oracle 10g connections to oracle-10g agent via driver_profile - Add Oracle 10g option in connection dialog - Add JRE uninstall with dependency check - Show per-JRE status and controls in driver management UI
This commit is contained in:
@@ -161,6 +161,25 @@ pub async fn check_jre_installed(state: State<'_, Arc<AppState>>, jre_key: Optio
|
||||
Ok(state.agent_manager.is_jre_installed(key))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn uninstall_jre(state: State<'_, Arc<AppState>>, jre_key: String) -> Result<(), String> {
|
||||
let am = &state.agent_manager;
|
||||
let local_state = am.load_state();
|
||||
let dependents: Vec<&str> =
|
||||
local_state.installed_drivers.iter().filter(|(_, d)| d.jre == jre_key).map(|(k, _)| k.as_str()).collect();
|
||||
if !dependents.is_empty() {
|
||||
return Err(format!("JRE {} 正在被以下驱动使用: {},请先卸载这些驱动", jre_key, dependents.join(", ")));
|
||||
}
|
||||
let jre_dir = am.jre_dir(&jre_key);
|
||||
if jre_dir.exists() {
|
||||
std::fs::remove_dir_all(&jre_dir).map_err(|e| format!("Failed to remove JRE: {e}"))?;
|
||||
}
|
||||
let mut local_state = am.load_state();
|
||||
local_state.jre_versions.remove(&jre_key);
|
||||
am.save_state(&local_state)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn invalidate_agent_registry_cache() -> Result<(), String> {
|
||||
*REGISTRY_CACHE.lock().await = None;
|
||||
|
||||
@@ -149,6 +149,7 @@ pub fn run() {
|
||||
commands::agents::install_agent,
|
||||
commands::agents::uninstall_agent,
|
||||
commands::agents::check_jre_installed,
|
||||
commands::agents::uninstall_jre,
|
||||
commands::agents::reinstall_jre,
|
||||
commands::agents::invalidate_agent_registry_cache,
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user