v0.1.0-pre.059

This commit is contained in:
2026-07-27 10:02:26 +02:00
parent e828677201
commit 626385f9b6
10 changed files with 219 additions and 408 deletions

View File

@@ -1,9 +1,8 @@
// file: kb-app-demo-desktop/src/demo_sql_common.rs
// version: 9
// version: 10
//! Shared SQL demo helpers and serializable payloads.
use tauri::Manager; // rust-rules: trait-import
use ts_rs::TS; // rust-rules: derive-import
/// UI-safe table diagnostics shown by SQL demo windows.
@@ -35,58 +34,6 @@ pub(crate) struct DemoSqlTableSnapshot {
pub(crate) latest_created_at: std::option::Option<std::string::String>,
}
/// Opens or focuses a SQL demo window.
pub(crate) fn open_sql_demo_window(
app_handle: tauri::AppHandle,
label: &str,
html_path: &str,
title: &str,
) -> std::result::Result<(), std::string::String> {
tracing::info!(target: crate::TRACING_TARGET, window = label, "open SQL demo window");
let existing_window = app_handle.get_webview_window(label);
if let std::option::Option::Some(window) = existing_window {
let show_result = window.show();
if let std::result::Result::Err(error) = show_result {
return std::result::Result::Err(
kb_core::Error::tauri(format!("cannot show {label} window: {error}")).to_string(),
);
}
let focus_result = window.set_focus();
if let std::result::Result::Err(error) = focus_result {
return std::result::Result::Err(
kb_core::Error::tauri(format!("cannot focus {label} window: {error}")).to_string(),
);
}
return std::result::Result::Ok(());
}
let builder = tauri::WebviewWindowBuilder::new(
&app_handle,
label,
tauri::WebviewUrl::App(html_path.into()),
)
.title(title)
.inner_size(1500.0, 960.0)
.min_inner_size(1024.0, 768.0)
.resizable(true)
.visible(true);
let build_result = builder.build();
return match build_result {
std::result::Result::Ok(window) => {
let focus_result = window.set_focus();
if let std::result::Result::Err(error) = focus_result {
return std::result::Result::Err(
kb_core::Error::tauri(format!("cannot focus created {label} window: {error}"))
.to_string(),
);
}
std::result::Result::Ok(())
},
std::result::Result::Err(error) => std::result::Result::Err(
kb_core::Error::tauri(format!("cannot create {label} window: {error}")).to_string(),
),
};
}
/// Builds PostgreSQL options from the active profile without coupling kb-store to kb-config.
pub(crate) fn postgres_store_options_from_profile(
profile: &kb_config::ProfileConfig,