Files
dbx/src-tauri/src/commands/plugins.rs
T
t8y2 6e0f4e1dc3 feat: enable driver management on web version
- Extract JDBC driver/plugin logic from Tauri commands to dbx-core::jdbc
- Add web API routes for JDBC drivers, JDBC plugin, Agent JAR import, system fonts
- Upgrade zip crate from v2 to v4 in dbx-core
- Replace http.ts stubs with real HTTP calls (support File and string paths)
- Remove isWeb restrictions in DriverStoreDialog, add browser file picker support
- Fix Mac traffic light inset incorrectly applied on web version
- Show driver management toolbar button on web version
2026-05-26 01:23:26 +08:00

54 lines
1.7 KiB
Rust

use std::sync::Arc;
use tauri::State;
use dbx_core::jdbc::{self, JdbcDriverInfo, JdbcPluginStatus};
use dbx_core::plugins::InstalledPlugin;
use super::connection::AppState;
#[tauri::command]
pub async fn list_plugins(state: State<'_, Arc<AppState>>) -> Result<Vec<InstalledPlugin>, String> {
state.plugins.list_installed()
}
#[tauri::command]
pub async fn jdbc_plugin_status(state: State<'_, Arc<AppState>>) -> Result<JdbcPluginStatus, String> {
jdbc::get_jdbc_plugin_status(&state.plugins.root_dir()).await
}
#[tauri::command]
pub async fn install_jdbc_plugin(state: State<'_, Arc<AppState>>) -> Result<JdbcPluginStatus, String> {
jdbc::install_jdbc_plugin(&state.plugins.root_dir()).await
}
#[tauri::command]
pub async fn install_jdbc_plugin_local(
state: State<'_, Arc<AppState>>,
path: String,
) -> Result<JdbcPluginStatus, String> {
jdbc::install_jdbc_plugin_from_file(&state.plugins.root_dir(), &path).await
}
#[tauri::command]
pub async fn uninstall_jdbc_plugin(state: State<'_, Arc<AppState>>) -> Result<JdbcPluginStatus, String> {
jdbc::uninstall_jdbc_plugin(&state.plugins.root_dir())
}
#[tauri::command]
pub async fn list_jdbc_drivers(state: State<'_, Arc<AppState>>) -> Result<Vec<JdbcDriverInfo>, String> {
jdbc::list_jdbc_drivers(&state.plugins.root_dir())
}
#[tauri::command]
pub async fn import_jdbc_drivers(
state: State<'_, Arc<AppState>>,
paths: Vec<String>,
) -> Result<Vec<JdbcDriverInfo>, String> {
jdbc::import_jdbc_drivers(&state.plugins.root_dir(), &paths)
}
#[tauri::command]
pub async fn delete_jdbc_driver(state: State<'_, Arc<AppState>>, path: String) -> Result<Vec<JdbcDriverInfo>, String> {
jdbc::delete_jdbc_driver(&state.plugins.root_dir(), &path)
}