fix(jdbc): support reusable multi-JAR driver bundles
This commit is contained in:
1 parent
a6de6a1f08
commit
bab94cc52b
15 files changed
+355
-24
No files matched your search
@@ -2,7 +2,9 @@ use std::sync::Arc;
|
||||
use tauri::{Emitter, State};
|
||||
|
||||
use dbx_core::agent_service::AgentProgressEvent;
|
||||
use dbx_core::jdbc::{self, JdbcDriverInfo, JdbcMavenBundleInfo, JdbcMavenInstallRequest, JdbcPluginStatus};
|
||||
use dbx_core::jdbc::{
|
||||
self, JdbcDriverInfo, JdbcLocalBundleInfo, JdbcMavenBundleInfo, JdbcMavenInstallRequest, JdbcPluginStatus,
|
||||
};
|
||||
use dbx_core::plugins::InstalledPlugin;
|
||||
|
||||
use super::connection::AppState;
|
||||
@@ -67,6 +69,14 @@ pub async fn list_jdbc_maven_bundles(state: State<'_, Arc<AppState>>) -> Result<
|
||||
.map_err(|err| err.to_string())?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn list_jdbc_local_bundles(state: State<'_, Arc<AppState>>) -> Result<Vec<JdbcLocalBundleInfo>, String> {
|
||||
let root_dir = state.plugins.root_dir().to_path_buf();
|
||||
tauri::async_runtime::spawn_blocking(move || jdbc::list_jdbc_local_bundles(&root_dir))
|
||||
.await
|
||||
.map_err(|err| err.to_string())?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn install_jdbc_driver_from_maven(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
@@ -111,6 +121,17 @@ pub async fn delete_jdbc_maven_bundle(
|
||||
.map_err(|err| err.to_string())?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn delete_jdbc_local_bundle(
|
||||
state: State<'_, Arc<AppState>>,
|
||||
bundle_id: String,
|
||||
) -> Result<Vec<JdbcDriverInfo>, String> {
|
||||
let root_dir = state.plugins.root_dir().to_path_buf();
|
||||
tauri::async_runtime::spawn_blocking(move || jdbc::delete_jdbc_local_bundle(&root_dir, &bundle_id))
|
||||
.await
|
||||
.map_err(|err| err.to_string())?
|
||||
}
|
||||
|
||||
fn emit_agent_progress(app: &tauri::AppHandle, event: AgentProgressEvent) {
|
||||
let _ = app.emit("agent-install-progress", event);
|
||||
}
|
||||
Reference in new issue
Block a user