Support DBX connection deep links (#359)
* fix(mysql): avoid metadata collation conflicts Split MySQL column and primary key metadata lookups so MariaDB and OceanBase do not join information_schema tables with incompatible collations. * feat(grid): add invert column visibility action * feat(grid): improve cell detail editing * feat(grid): add keyboard cell navigation * feat(grid): add column name copy in header tooltip * feat(grid): improve transpose navigation * feat(connection): support dbx connection deep links * docs: document connection deep links * fix(connection): harden deep link boolean handling
This commit is contained in:
1 parent
c41c2ae1af
commit
13424588b9
26 files changed
+635
-25
No files matched your search
@@ -13,6 +13,8 @@ use tauri::{
|
||||
tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent},
|
||||
};
|
||||
use tauri::{Emitter, Manager, RunEvent};
|
||||
#[cfg(any(windows, target_os = "linux"))]
|
||||
use tauri_plugin_deep_link::DeepLinkExt;
|
||||
|
||||
fn should_hide_window_on_close(target_os: &str) -> bool {
|
||||
matches!(target_os, "macos" | "windows")
|
||||
@@ -26,6 +28,17 @@ fn show_main_window(app: &tauri::AppHandle) {
|
||||
}
|
||||
}
|
||||
|
||||
fn open_connection_deep_links(app: &tauri::AppHandle, links: Vec<String>) {
|
||||
if links.is_empty() {
|
||||
return;
|
||||
}
|
||||
if let Some(state) = app.try_state::<commands::deep_link::DeepLinkOpenState>() {
|
||||
state.push(links.clone());
|
||||
}
|
||||
let _ = app.emit("dbx-open-connection-links", links);
|
||||
show_main_window(app);
|
||||
}
|
||||
|
||||
#[cfg_attr(not(target_os = "windows"), allow(dead_code))]
|
||||
fn setup_windows_tray(app: &mut tauri::App) -> tauri::Result<()> {
|
||||
let menu = MenuBuilder::new(app).text("show", "Show DBX").separator().text("quit", "Quit DBX").build()?;
|
||||
@@ -75,9 +88,13 @@ pub fn run() {
|
||||
let startup_begin = Instant::now();
|
||||
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_deep_link::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_single_instance::init(|app, args, cwd| {
|
||||
let links = commands::deep_link::connection_deep_links_from_args(args.clone());
|
||||
open_connection_deep_links(app, links);
|
||||
|
||||
let paths = commands::external_sql::sql_file_paths_from_args(args, std::path::Path::new(&cwd));
|
||||
if !paths.is_empty() {
|
||||
if let Some(state) = app.try_state::<commands::external_sql::ExternalSqlOpenState>() {
|
||||
@@ -123,6 +140,9 @@ pub fn run() {
|
||||
));
|
||||
app.manage(state.clone());
|
||||
app.manage(commands::external_sql::ExternalSqlOpenState::default());
|
||||
app.manage(commands::deep_link::DeepLinkOpenState::default());
|
||||
let startup_links = commands::deep_link::connection_deep_links_from_args(std::env::args().skip(1));
|
||||
open_connection_deep_links(app.handle(), startup_links);
|
||||
|
||||
let app_handle = app.handle().clone();
|
||||
commands::mcp_bridge::start(app_handle, state);
|
||||
@@ -137,6 +157,8 @@ pub fn run() {
|
||||
#[cfg(target_os = "windows")]
|
||||
setup_windows_tray(app)?;
|
||||
window_state_guard::enforce_main_window_bounds(app.handle());
|
||||
#[cfg(any(windows, target_os = "linux"))]
|
||||
let _ = app.deep_link().register_all();
|
||||
|
||||
Ok(())
|
||||
})
|
||||
@@ -198,6 +220,7 @@ pub fn run() {
|
||||
commands::sql_file::cancel_sql_file_execution,
|
||||
commands::external_sql::pending_open_sql_files,
|
||||
commands::external_sql::read_external_sql_file,
|
||||
commands::deep_link::pending_open_connection_links,
|
||||
commands::table_import::preview_table_import_file,
|
||||
commands::table_import::import_table_file,
|
||||
commands::table_import::cancel_table_import,
|
||||
@@ -260,6 +283,13 @@ pub fn run() {
|
||||
.run(|app_handle, event| {
|
||||
#[cfg(target_os = "macos")]
|
||||
if let RunEvent::Opened { urls } = &event {
|
||||
let links: Vec<String> = urls
|
||||
.iter()
|
||||
.map(|url| url.to_string())
|
||||
.filter_map(|url| commands::deep_link::connection_deep_link_from_arg(&url))
|
||||
.collect();
|
||||
open_connection_deep_links(app_handle, links);
|
||||
|
||||
let paths: Vec<String> = urls
|
||||
.iter()
|
||||
.filter_map(|url| url.to_file_path().ok())
|
||||
|
||||
Reference in new issue
Block a user