v0.1.0-pre.059
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!-- file: kb-app-demo-desktop/frontend/demo_core_extraction.html -->
|
||||
<!-- version: 7 -->
|
||||
<!-- version: 8 -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
@@ -34,14 +34,16 @@
|
||||
<main class="app-main">
|
||||
<div class="osb-scrollable pt-1 pb-4" data-simplebar>
|
||||
<div class="container-fluid px-4 py-4">
|
||||
<div class="row g-4 justify-content-center">
|
||||
<div class="col-12 col-xl-5">
|
||||
<div class="card shadow-sm border-0 mb-4">
|
||||
<div class="row g-4">
|
||||
<div class="col-12">
|
||||
<div class="card shadow-sm border-0">
|
||||
<div class="card-body">
|
||||
<h1 class="h3 card-title">Extraction transactionnelle canonical vers core</h1>
|
||||
<p class="text-body-secondary mb-0">Chaque transaction canonique sélectionnée est validée, normalisée dans les tables core et enregistrée dans le ledger de traitement au sein d'une seule transaction PostgreSQL.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="accordion shadow-sm" id="coreExtractionAccordion">
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header" id="coreExtractionSettingsHeading">
|
||||
@@ -127,20 +129,27 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="card shadow-sm border-0 mt-4">
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<div class="card shadow-sm border-0">
|
||||
<div class="card-body">
|
||||
<h2 class="h5 mb-3">Journal et résultat</h2>
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h3 class="h6 mb-0">Journal</h3>
|
||||
<div class="row g-4">
|
||||
<div class="col-12 col-xl-7">
|
||||
<h3 class="h6">Journal</h3>
|
||||
<textarea class="form-control font-monospace" id="coreExtractionLogOutput" readonly="" style="height: 28rem; overflow-y: auto;">Aucune campagne exécutée.</textarea>
|
||||
</div>
|
||||
<div class="col-12 col-xl-5">
|
||||
<h3 class="h6">Résumé JSON</h3>
|
||||
<textarea class="form-control font-monospace" data-json-viewer="true" id="coreExtractionSummaryOutput" readonly="" style="height: 28rem; overflow-y: auto;">Aucun résultat.</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<textarea class="form-control font-monospace mb-3" id="coreExtractionLogOutput" readonly="" rows="15">Aucune campagne exécutée.</textarea>
|
||||
<h3 class="h6">Résumé JSON</h3>
|
||||
<textarea class="form-control font-monospace" data-json-viewer="true" id="coreExtractionSummaryOutput" readonly="" rows="16">Aucun résultat.</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer class="app-footer bg-dark text-light">
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<div class="osb-scrollable pt-1 pb-4" data-simplebar>
|
||||
<div class="container-fluid px-4 py-4">
|
||||
<div class="row g-4 justify-content-center">
|
||||
<div class="col-12 col-xl-5">
|
||||
<div class="col-12 col-xl-7">
|
||||
<div class="card shadow-sm border-0 mb-4">
|
||||
<div class="card-body">
|
||||
<h1 class="h4 mb-3">Sélection bornée</h1>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/demo_core_extraction.rs
|
||||
// version: 9
|
||||
// version: 10
|
||||
|
||||
//! Tauri commands and UI payloads for canonical transaction to core extraction.
|
||||
|
||||
@@ -158,6 +158,70 @@ impl std::ops::Drop for crate::DemoCoreExtractionRunGuard<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn demo_core_extraction_options_payload(
|
||||
state: &crate::AppState,
|
||||
) -> crate::DemoCoreExtractionOptionsPayload {
|
||||
return crate::DemoCoreExtractionOptionsPayload {
|
||||
processor_version: kb_pipeline::CORE_EXTRACTION_PROCESSOR_VERSION.to_string(),
|
||||
default_limit: 100,
|
||||
default_max_concurrent_extractions: 4,
|
||||
running: state.demo_core_extraction_running().load(std::sync::atomic::Ordering::Acquire),
|
||||
};
|
||||
}
|
||||
|
||||
pub(crate) async fn execute_demo_core_extraction(
|
||||
app_handle: tauri::AppHandle,
|
||||
state: &crate::AppState,
|
||||
request: crate::DemoCoreExtractionRequest,
|
||||
) -> std::result::Result<crate::DemoCoreExtractionSummaryPayload, std::string::String> {
|
||||
let acquire_result = state.demo_core_extraction_running().compare_exchange(
|
||||
false,
|
||||
true,
|
||||
std::sync::atomic::Ordering::AcqRel,
|
||||
std::sync::atomic::Ordering::Acquire,
|
||||
);
|
||||
if acquire_result.is_err() {
|
||||
return std::result::Result::Err(
|
||||
"a core extraction campaign is already running".to_string(),
|
||||
);
|
||||
}
|
||||
let _run_guard = crate::DemoCoreExtractionRunGuard {
|
||||
running: state.demo_core_extraction_running(),
|
||||
};
|
||||
state
|
||||
.demo_core_extraction_cancel_requested()
|
||||
.store(false, std::sync::atomic::Ordering::Release);
|
||||
let pipeline_request_result = crate::build_demo_core_extraction_pipeline_request(request);
|
||||
let pipeline_request = match pipeline_request_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let store_result = crate::connect_postgres_store(state.active_profile()).await;
|
||||
let store = match store_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let observer = crate::DemoCoreExtractionObserver {
|
||||
app_handle,
|
||||
cancel_requested: state.demo_core_extraction_cancel_requested(),
|
||||
};
|
||||
let summary_result =
|
||||
kb_pipeline::execute_core_extraction(&store, &pipeline_request, &observer).await;
|
||||
let summary = match summary_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
return std::result::Result::Ok(crate::demo_core_extraction_summary_payload(summary));
|
||||
}
|
||||
|
||||
pub(crate) fn cancel_demo_core_extraction(state: &crate::AppState) -> bool {
|
||||
let running = state.demo_core_extraction_running().load(std::sync::atomic::Ordering::Acquire);
|
||||
state
|
||||
.demo_core_extraction_cancel_requested()
|
||||
.store(true, std::sync::atomic::Ordering::Release);
|
||||
return running;
|
||||
}
|
||||
|
||||
pub(crate) fn build_demo_core_extraction_pipeline_request(
|
||||
request: crate::DemoCoreExtractionRequest,
|
||||
) -> std::result::Result<kb_pipeline::CoreExtractionRequest, std::string::String> {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -76,7 +76,13 @@ pub(crate) use self::demo_core_extraction::DemoCoreExtractionSummaryPayload;
|
||||
/// Internal demo core extraction item.
|
||||
pub(crate) use self::demo_core_extraction::build_demo_core_extraction_pipeline_request;
|
||||
/// Internal demo core extraction item.
|
||||
pub(crate) use self::demo_core_extraction::cancel_demo_core_extraction;
|
||||
/// Internal demo core extraction item.
|
||||
pub(crate) use self::demo_core_extraction::demo_core_extraction_options_payload;
|
||||
/// Internal demo core extraction item.
|
||||
pub(crate) use self::demo_core_extraction::demo_core_extraction_summary_payload;
|
||||
/// Internal demo core extraction item.
|
||||
pub(crate) use self::demo_core_extraction::execute_demo_core_extraction;
|
||||
/// Internal demo decode replay item.
|
||||
pub(crate) use self::demo_decode_replay::DemoDecodeCoverageSummaryPayload;
|
||||
/// Internal demo decode replay item.
|
||||
@@ -231,8 +237,6 @@ pub(crate) use self::demo_sql_common::connect_postgres_store;
|
||||
pub(crate) use self::demo_sql_common::debug_status;
|
||||
/// Initializes the PostgreSQL schema during startup.
|
||||
pub(crate) use self::demo_sql_common::initialize_postgres_schema_for_startup;
|
||||
/// Opens or focuses one SQL demo window.
|
||||
pub(crate) use self::demo_sql_common::open_sql_demo_window;
|
||||
/// Builds PostgreSQL options from the active profile.
|
||||
pub(crate) use self::demo_sql_common::postgres_store_options_from_profile;
|
||||
/// Converts one PostgreSQL table diagnostic.
|
||||
|
||||
@@ -171,8 +171,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn splash_timing_is_ordered() {
|
||||
assert_eq!(crate::SPLASH_MINIMUM_MS, 3100);
|
||||
assert_eq!(crate::SPLASH_FADE_MS, 3000);
|
||||
assert_eq!(crate::SPLASH_MINIMUM_MS, 12100);
|
||||
assert_eq!(crate::SPLASH_FADE_MS, 12000);
|
||||
assert!(crate::SPLASH_CLOSE_WAIT_MS >= u64::from(crate::SPLASH_FADE_MS));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: kb-app-demo-desktop/src/tauri.rs
|
||||
// version: 12
|
||||
// version: 14
|
||||
|
||||
//! Tauri runtime assembly and private command wrappers.
|
||||
|
||||
@@ -7,6 +7,7 @@ use tauri::Manager; // rust-rules: trait-import
|
||||
|
||||
/// Runs the desktop demo application.
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
pub fn run() -> kb_core::Result<()> {
|
||||
let rustls_result = install_default_rustls_provider();
|
||||
if let std::result::Result::Err(error) = rustls_result {
|
||||
@@ -149,156 +150,95 @@ fn install_default_rustls_provider() -> kb_core::Result<()> {
|
||||
)),
|
||||
};
|
||||
}
|
||||
/// Opens or focuses the canonical to core extraction demo window.
|
||||
#[tauri::command]
|
||||
fn open_demo_core_extraction_window(
|
||||
|
||||
fn open_or_focus_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, "open core extraction demo window");
|
||||
let existing_window = app_handle.get_webview_window("demo_core_extraction");
|
||||
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(error.to_string());
|
||||
tracing::info!(target: crate::TRACING_TARGET, action = "open_window", window = label, "open demo window");
|
||||
if let std::option::Option::Some(window) = app_handle.get_webview_window(label) {
|
||||
if let std::result::Result::Err(error) = window.show() {
|
||||
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(error.to_string());
|
||||
if let std::result::Result::Err(error) = window.set_focus() {
|
||||
return std::result::Result::Err(
|
||||
kb_core::Error::tauri(format!("cannot focus {label} window: {error}")).to_string(),
|
||||
);
|
||||
}
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
let build_result = tauri::WebviewWindowBuilder::new(
|
||||
&app_handle,
|
||||
"demo_core_extraction",
|
||||
tauri::WebviewUrl::App("demo_core_extraction.html".into()),
|
||||
label,
|
||||
tauri::WebviewUrl::App(html_path.into()),
|
||||
)
|
||||
.title("Extraction canonical vers core")
|
||||
.title(title)
|
||||
.inner_size(1500.0, 960.0)
|
||||
.min_inner_size(1024.0, 768.0)
|
||||
.resizable(true)
|
||||
.visible(true)
|
||||
.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(error.to_string());
|
||||
}
|
||||
std::result::Result::Ok(())
|
||||
std::result::Result::Ok(window) => match window.set_focus() {
|
||||
std::result::Result::Ok(()) => std::result::Result::Ok(()),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(
|
||||
kb_core::Error::tauri(format!("cannot focus created {label} window: {error}"))
|
||||
.to_string(),
|
||||
),
|
||||
},
|
||||
std::result::Result::Err(error) => std::result::Result::Err(error.to_string()),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(
|
||||
kb_core::Error::tauri(format!("cannot create {label} window: {error}")).to_string(),
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
/// Returns the initial core extraction demo options.
|
||||
#[tauri::command]
|
||||
fn open_demo_core_extraction_window(
|
||||
app_handle: tauri::AppHandle,
|
||||
) -> std::result::Result<(), std::string::String> {
|
||||
return open_or_focus_demo_window(
|
||||
app_handle,
|
||||
"demo_core_extraction",
|
||||
"demo_core_extraction.html",
|
||||
"Extraction canonical vers core",
|
||||
);
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn demo_core_extraction_options(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> crate::DemoCoreExtractionOptionsPayload {
|
||||
return crate::DemoCoreExtractionOptionsPayload {
|
||||
processor_version: kb_pipeline::CORE_EXTRACTION_PROCESSOR_VERSION.to_string(),
|
||||
default_limit: 100,
|
||||
default_max_concurrent_extractions: 4,
|
||||
running: state.demo_core_extraction_running().load(std::sync::atomic::Ordering::Acquire),
|
||||
};
|
||||
return crate::demo_core_extraction_options_payload(&state);
|
||||
}
|
||||
|
||||
/// Executes one bounded canonical transaction to core extraction campaign.
|
||||
#[tauri::command]
|
||||
async fn demo_core_extraction_execute(
|
||||
app_handle: tauri::AppHandle,
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
request: crate::DemoCoreExtractionRequest,
|
||||
) -> std::result::Result<crate::DemoCoreExtractionSummaryPayload, std::string::String> {
|
||||
let acquire_result = state.demo_core_extraction_running().compare_exchange(
|
||||
false,
|
||||
true,
|
||||
std::sync::atomic::Ordering::AcqRel,
|
||||
std::sync::atomic::Ordering::Acquire,
|
||||
);
|
||||
if acquire_result.is_err() {
|
||||
return std::result::Result::Err(
|
||||
"a core extraction campaign is already running".to_string(),
|
||||
);
|
||||
}
|
||||
let _run_guard = crate::DemoCoreExtractionRunGuard {
|
||||
running: state.demo_core_extraction_running(),
|
||||
};
|
||||
state
|
||||
.demo_core_extraction_cancel_requested()
|
||||
.store(false, std::sync::atomic::Ordering::Release);
|
||||
let pipeline_request_result = crate::build_demo_core_extraction_pipeline_request(request);
|
||||
let pipeline_request = match pipeline_request_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let store_result = crate::connect_postgres_store(state.active_profile()).await;
|
||||
let store = match store_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
let observer = crate::DemoCoreExtractionObserver {
|
||||
app_handle,
|
||||
cancel_requested: state.demo_core_extraction_cancel_requested(),
|
||||
};
|
||||
let summary_result =
|
||||
kb_pipeline::execute_core_extraction(&store, &pipeline_request, &observer).await;
|
||||
let summary = match summary_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
return std::result::Result::Ok(crate::demo_core_extraction_summary_payload(summary));
|
||||
return crate::execute_demo_core_extraction(app_handle, &state, request).await;
|
||||
}
|
||||
|
||||
/// Requests cooperative cancellation of the current core extraction campaign.
|
||||
#[tauri::command]
|
||||
fn demo_core_extraction_cancel(state: tauri::State<'_, crate::AppState>) -> bool {
|
||||
let running = state.demo_core_extraction_running().load(std::sync::atomic::Ordering::Acquire);
|
||||
state
|
||||
.demo_core_extraction_cancel_requested()
|
||||
.store(true, std::sync::atomic::Ordering::Release);
|
||||
return running;
|
||||
return crate::cancel_demo_core_extraction(&state);
|
||||
}
|
||||
|
||||
/// Opens or focuses the contextual decode replay window.
|
||||
#[tauri::command]
|
||||
fn open_demo_decode_replay_window(
|
||||
app_handle: tauri::AppHandle,
|
||||
) -> std::result::Result<(), std::string::String> {
|
||||
tracing::info!(target: crate::TRACING_TARGET, action = "open_window", window = "demo_decode_replay", "open contextual decode replay window");
|
||||
let existing_window = app_handle.get_webview_window("demo_decode_replay");
|
||||
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(error.to_string());
|
||||
}
|
||||
let focus_result = window.set_focus();
|
||||
if let std::result::Result::Err(error) = focus_result {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
let build_result = tauri::WebviewWindowBuilder::new(
|
||||
&app_handle,
|
||||
return open_or_focus_demo_window(
|
||||
app_handle,
|
||||
"demo_decode_replay",
|
||||
tauri::WebviewUrl::App("demo_decode_replay.html".into()),
|
||||
)
|
||||
.title("Décodage et matérialisation")
|
||||
.inner_size(1500.0, 960.0)
|
||||
.min_inner_size(1024.0, 768.0)
|
||||
.resizable(true)
|
||||
.visible(true)
|
||||
.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(error.to_string());
|
||||
}
|
||||
std::result::Result::Ok(())
|
||||
},
|
||||
std::result::Result::Err(error) => std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
"demo_decode_replay.html",
|
||||
"Décodage et matérialisation",
|
||||
);
|
||||
}
|
||||
|
||||
/// Returns available decoders and default replay bounds.
|
||||
@@ -584,33 +524,12 @@ async fn demo_decode_replay_annotations(
|
||||
fn open_demo_config_window(
|
||||
app_handle: tauri::AppHandle,
|
||||
) -> std::result::Result<(), std::string::String> {
|
||||
if let std::option::Option::Some(window) = app_handle.get_webview_window("demo_config") {
|
||||
if let std::result::Result::Err(error) = window.show() {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
if let std::result::Result::Err(error) = window.set_focus() {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
let builder = tauri::WebviewWindowBuilder::new(
|
||||
&app_handle,
|
||||
return open_or_focus_demo_window(
|
||||
app_handle,
|
||||
"demo_config",
|
||||
tauri::WebviewUrl::App("demo_config.html".into()),
|
||||
)
|
||||
.title("Configuration")
|
||||
.inner_size(1500.0, 960.0)
|
||||
.min_inner_size(1024.0, 768.0);
|
||||
let window = match builder.build() {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
},
|
||||
};
|
||||
if let std::result::Result::Err(error) = window.set_focus() {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
return std::result::Result::Ok(());
|
||||
"demo_config.html",
|
||||
"Configuration",
|
||||
);
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
@@ -648,34 +567,12 @@ fn demo_backfill_cancel(state: tauri::State<'_, crate::AppState>) -> bool {
|
||||
fn open_demo_backfill_window(
|
||||
app_handle: tauri::AppHandle,
|
||||
) -> std::result::Result<(), std::string::String> {
|
||||
let existing_window = app_handle.get_webview_window("demo_backfill");
|
||||
if let std::option::Option::Some(window) = existing_window {
|
||||
if let std::result::Result::Err(error) = window.show() {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
if let std::result::Result::Err(error) = window.set_focus() {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
let build_result = tauri::WebviewWindowBuilder::new(
|
||||
&app_handle,
|
||||
return open_or_focus_demo_window(
|
||||
app_handle,
|
||||
"demo_backfill",
|
||||
tauri::WebviewUrl::App("demo_backfill.html".into()),
|
||||
)
|
||||
.title("Backfill HTTP")
|
||||
.inner_size(1500.0, 960.0)
|
||||
.min_inner_size(1024.0, 768.0)
|
||||
.resizable(true)
|
||||
.visible(true)
|
||||
.build();
|
||||
return match build_result {
|
||||
std::result::Result::Ok(window) => match window.set_focus() {
|
||||
std::result::Result::Ok(()) => std::result::Result::Ok(()),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(error.to_string()),
|
||||
},
|
||||
std::result::Result::Err(error) => std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
"demo_backfill.html",
|
||||
"Backfill HTTP",
|
||||
);
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
@@ -711,7 +608,6 @@ fn demo_backfill_options(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn demo_backfill_execute(
|
||||
app_handle: tauri::AppHandle,
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
@@ -773,34 +669,7 @@ async fn demo_backfill_execute(
|
||||
fn open_demo_http_window(
|
||||
app_handle: tauri::AppHandle,
|
||||
) -> std::result::Result<(), std::string::String> {
|
||||
let existing_window = app_handle.get_webview_window("demo_http");
|
||||
if let std::option::Option::Some(window) = existing_window {
|
||||
if let std::result::Result::Err(error) = window.show() {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
if let std::result::Result::Err(error) = window.set_focus() {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
let build_result = tauri::WebviewWindowBuilder::new(
|
||||
&app_handle,
|
||||
"demo_http",
|
||||
tauri::WebviewUrl::App("demo_http.html".into()),
|
||||
)
|
||||
.title("HTTP JSON-RPC")
|
||||
.inner_size(1500.0, 960.0)
|
||||
.min_inner_size(1024.0, 768.0)
|
||||
.resizable(true)
|
||||
.visible(true)
|
||||
.build();
|
||||
return match build_result {
|
||||
std::result::Result::Ok(window) => match window.set_focus() {
|
||||
std::result::Result::Ok(()) => std::result::Result::Ok(()),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(error.to_string()),
|
||||
},
|
||||
std::result::Result::Err(error) => std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
return open_or_focus_demo_window(app_handle, "demo_http", "demo_http.html", "HTTP JSON-RPC");
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
@@ -819,7 +688,6 @@ fn demo_http_options(state: tauri::State<'_, crate::AppState>) -> crate::DemoHtt
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn demo_http_execute_request(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
request: crate::DemoHttpRequest,
|
||||
@@ -827,48 +695,11 @@ async fn demo_http_execute_request(
|
||||
return crate::demo_http_execute_request_inner(state, request).await;
|
||||
}
|
||||
|
||||
/// Opens or focuses the WebSocket demo window.
|
||||
#[tauri::command]
|
||||
fn open_demo_ws_window(
|
||||
app_handle: tauri::AppHandle,
|
||||
) -> std::result::Result<(), std::string::String> {
|
||||
tracing::info!(target: crate::TRACING_TARGET, "open_demo_ws_window");
|
||||
if let std::option::Option::Some(window) = app_handle.get_webview_window("demo_ws") {
|
||||
if let std::result::Result::Err(error) = window.show() {
|
||||
return std::result::Result::Err(
|
||||
kb_core::Error::tauri(format!("cannot show demo_ws window: {error}")).to_string(),
|
||||
);
|
||||
}
|
||||
if let std::result::Result::Err(error) = window.set_focus() {
|
||||
return std::result::Result::Err(
|
||||
kb_core::Error::tauri(format!("cannot focus demo_ws window: {error}")).to_string(),
|
||||
);
|
||||
}
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
let build_result = tauri::WebviewWindowBuilder::new(
|
||||
&app_handle,
|
||||
"demo_ws",
|
||||
tauri::WebviewUrl::App("demo_ws.html".into()),
|
||||
)
|
||||
.title("WebSocket standard")
|
||||
.inner_size(1500.0, 960.0)
|
||||
.min_inner_size(1024.0, 768.0)
|
||||
.resizable(true)
|
||||
.visible(true)
|
||||
.build();
|
||||
return match build_result {
|
||||
std::result::Result::Ok(window) => match window.set_focus() {
|
||||
std::result::Result::Ok(()) => std::result::Result::Ok(()),
|
||||
std::result::Result::Err(error) => std::result::Result::Err(
|
||||
kb_core::Error::tauri(format!("cannot focus created demo_ws window: {error}"))
|
||||
.to_string(),
|
||||
),
|
||||
},
|
||||
std::result::Result::Err(error) => std::result::Result::Err(
|
||||
kb_core::Error::tauri(format!("cannot create demo_ws window: {error}")).to_string(),
|
||||
),
|
||||
};
|
||||
return open_or_focus_demo_window(app_handle, "demo_ws", "demo_ws.html", "WebSocket standard");
|
||||
}
|
||||
|
||||
/// Lists WebSocket endpoints available through the configured pool.
|
||||
@@ -902,7 +733,6 @@ fn demo_ws_options(
|
||||
|
||||
/// Returns the current WebSocket demo session status.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn demo_ws_status(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> std::result::Result<crate::DemoWsStatusPayload, std::string::String> {
|
||||
@@ -911,7 +741,6 @@ async fn demo_ws_status(
|
||||
|
||||
/// Connects if needed, then subscribes through `kb_onchain_transport::WsSession`.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn demo_ws_connect(
|
||||
app_handle: tauri::AppHandle,
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
@@ -922,7 +751,6 @@ async fn demo_ws_connect(
|
||||
|
||||
/// Unsubscribes one subscription while keeping the WebSocket connection open.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn demo_ws_unsubscribe(
|
||||
app_handle: tauri::AppHandle,
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
@@ -934,19 +762,17 @@ async fn demo_ws_unsubscribe(
|
||||
|
||||
/// Disconnects the current persistent WebSocket demo session.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn demo_ws_disconnect(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> std::result::Result<crate::DemoWsStatusPayload, std::string::String> {
|
||||
return crate::demo_ws_disconnect_inner(state.inner()).await;
|
||||
}
|
||||
|
||||
/// Opens or focuses the SQL diagnostic demo window.
|
||||
#[tauri::command]
|
||||
fn open_demo_sql_diag_window(
|
||||
app_handle: tauri::AppHandle,
|
||||
) -> std::result::Result<(), std::string::String> {
|
||||
return crate::open_sql_demo_window(
|
||||
return open_or_focus_demo_window(
|
||||
app_handle,
|
||||
"demo_sql_diag",
|
||||
"demo_sql_diag.html",
|
||||
@@ -956,7 +782,6 @@ fn open_demo_sql_diag_window(
|
||||
|
||||
/// Loads read-only SQL diagnostics from the active profile.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn load_demo_sql_diag(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> std::result::Result<crate::DemoSqlDiagPayload, std::string::String> {
|
||||
@@ -991,12 +816,11 @@ async fn load_demo_sql_diag(
|
||||
});
|
||||
}
|
||||
|
||||
/// Opens or focuses the PostgreSQL canonical acquisition demo window.
|
||||
#[tauri::command]
|
||||
fn open_demo_sql_pg_raw_window(
|
||||
app_handle: tauri::AppHandle,
|
||||
) -> std::result::Result<(), std::string::String> {
|
||||
return crate::open_sql_demo_window(
|
||||
return open_or_focus_demo_window(
|
||||
app_handle,
|
||||
"demo_sql_pg_raw",
|
||||
"demo_sql_pg_raw.html",
|
||||
@@ -1006,7 +830,6 @@ fn open_demo_sql_pg_raw_window(
|
||||
|
||||
/// Loads read-only raw table diagnostics from PostgreSQL.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn load_demo_sql_pg_raw(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> std::result::Result<crate::DemoSqlPgRawPayload, std::string::String> {
|
||||
@@ -1028,12 +851,11 @@ async fn load_demo_sql_pg_raw(
|
||||
});
|
||||
}
|
||||
|
||||
/// Opens or focuses the PostgreSQL core store demo window.
|
||||
#[tauri::command]
|
||||
fn open_demo_sql_pg_core_window(
|
||||
app_handle: tauri::AppHandle,
|
||||
) -> std::result::Result<(), std::string::String> {
|
||||
return crate::open_sql_demo_window(
|
||||
return open_or_focus_demo_window(
|
||||
app_handle,
|
||||
"demo_sql_pg_core",
|
||||
"demo_sql_pg_core.html",
|
||||
@@ -1043,7 +865,6 @@ fn open_demo_sql_pg_core_window(
|
||||
|
||||
/// Loads read-only core table diagnostics from PostgreSQL.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn load_demo_sql_pg_core(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> std::result::Result<crate::DemoSqlPgCorePayload, std::string::String> {
|
||||
@@ -1065,12 +886,11 @@ async fn load_demo_sql_pg_core(
|
||||
});
|
||||
}
|
||||
|
||||
/// Opens or focuses the SQL replay candidate browser.
|
||||
#[tauri::command]
|
||||
fn open_demo_sql_replay_candidates_window(
|
||||
app_handle: tauri::AppHandle,
|
||||
) -> std::result::Result<(), std::string::String> {
|
||||
return crate::open_sql_demo_window(
|
||||
return open_or_focus_demo_window(
|
||||
app_handle,
|
||||
"demo_sql_replay_candidates",
|
||||
"demo_sql_replay_candidates.html",
|
||||
@@ -1080,7 +900,6 @@ fn open_demo_sql_replay_candidates_window(
|
||||
|
||||
/// Writes a bounded replay-candidate CSV file into `./data/exports_csv/`.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn export_demo_sql_replay_csv(
|
||||
file_name: std::string::String,
|
||||
content: std::string::String,
|
||||
@@ -1127,7 +946,6 @@ async fn export_demo_sql_replay_csv(
|
||||
|
||||
/// Loads static browser options from the active PostgreSQL profile.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn demo_sql_replay_options(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
) -> std::result::Result<crate::DemoSqlReplayOptionsPayload, std::string::String> {
|
||||
@@ -1155,7 +973,6 @@ async fn demo_sql_replay_options(
|
||||
|
||||
/// Loads bounded transaction replay candidates from PostgreSQL.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn load_demo_sql_replay_transactions(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
request: crate::DemoSqlReplayTransactionRequest,
|
||||
@@ -1207,7 +1024,6 @@ async fn load_demo_sql_replay_transactions(
|
||||
|
||||
/// Loads bounded program summaries from PostgreSQL.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn load_demo_sql_replay_programs(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
request: crate::DemoSqlReplayProgramRequest,
|
||||
@@ -1238,7 +1054,6 @@ async fn load_demo_sql_replay_programs(
|
||||
|
||||
/// Loads bounded mint, owner or account-key summaries from PostgreSQL core tables.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn load_demo_sql_replay_entities(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
request: crate::DemoSqlReplayEntityRequest,
|
||||
@@ -1275,44 +1090,16 @@ async fn load_demo_sql_replay_entities(
|
||||
return std::result::Result::Ok(output);
|
||||
}
|
||||
|
||||
/// Opens or focuses the Solana Core execution demo window.
|
||||
#[tauri::command]
|
||||
fn open_demo_execution_solana_core_window(
|
||||
app_handle: tauri::AppHandle,
|
||||
) -> std::result::Result<(), std::string::String> {
|
||||
let existing_window = app_handle.get_webview_window("demo_execution_solana_core");
|
||||
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(error.to_string());
|
||||
}
|
||||
let focus_result = window.set_focus();
|
||||
if let std::result::Result::Err(error) = focus_result {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
let build_result = tauri::WebviewWindowBuilder::new(
|
||||
&app_handle,
|
||||
return open_or_focus_demo_window(
|
||||
app_handle,
|
||||
"demo_execution_solana_core",
|
||||
tauri::WebviewUrl::App("demo_execution_solana_core.html".into()),
|
||||
)
|
||||
.title("Exécution Solana Devnet")
|
||||
.inner_size(1500.0, 960.0)
|
||||
.min_inner_size(1024.0, 768.0)
|
||||
.resizable(true)
|
||||
.visible(true)
|
||||
.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(error.to_string());
|
||||
}
|
||||
std::result::Result::Ok(())
|
||||
},
|
||||
std::result::Result::Err(error) => std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
"demo_execution_solana_core.html",
|
||||
"Exécution Solana Devnet",
|
||||
);
|
||||
}
|
||||
|
||||
/// Returns compatible Devnet profiles and conservative defaults.
|
||||
@@ -1349,7 +1136,6 @@ fn demo_execution_solana_core_generate_recipient()
|
||||
|
||||
/// Executes one bounded System transfer simulation or Devnet submission.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn demo_execution_solana_core_execute(
|
||||
app_handle: tauri::AppHandle,
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
@@ -1436,7 +1222,6 @@ async fn demo_execution_solana_core_execute(
|
||||
|
||||
/// Executes one Memo v4 simulation or explicitly authorized Devnet submission.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn demo_execution_spl_memo_execute(
|
||||
app_handle: tauri::AppHandle,
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
@@ -1566,50 +1351,20 @@ fn demo_execution_spl_validation_scenarios()
|
||||
.collect();
|
||||
}
|
||||
|
||||
/// Opens or focuses the dedicated SPL execution window.
|
||||
#[tauri::command]
|
||||
fn open_demo_execution_spl_window(
|
||||
app_handle: tauri::AppHandle,
|
||||
) -> std::result::Result<(), std::string::String> {
|
||||
tracing::info!(target: crate::TRACING_TARGET, "open SPL Devnet execution window");
|
||||
let existing_window = app_handle.get_webview_window("demo_execution_spl");
|
||||
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(error.to_string());
|
||||
}
|
||||
let focus_result = window.set_focus();
|
||||
if let std::result::Result::Err(error) = focus_result {
|
||||
return std::result::Result::Err(error.to_string());
|
||||
}
|
||||
return std::result::Result::Ok(());
|
||||
}
|
||||
let build_result = tauri::WebviewWindowBuilder::new(
|
||||
&app_handle,
|
||||
return open_or_focus_demo_window(
|
||||
app_handle,
|
||||
"demo_execution_spl",
|
||||
tauri::WebviewUrl::App("demo_execution_spl.html".into()),
|
||||
)
|
||||
.title("Exécution SPL Devnet")
|
||||
.inner_size(1500.0, 960.0)
|
||||
.min_inner_size(1024.0, 768.0)
|
||||
.resizable(true)
|
||||
.visible(true)
|
||||
.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(error.to_string());
|
||||
}
|
||||
std::result::Result::Ok(())
|
||||
},
|
||||
std::result::Result::Err(error) => std::result::Result::Err(error.to_string()),
|
||||
};
|
||||
"demo_execution_spl.html",
|
||||
"Exécution SPL Devnet",
|
||||
);
|
||||
}
|
||||
|
||||
/// Executes one checked SPL Token simulation or explicitly authorized Devnet submission.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn demo_execution_spl_token_execute(
|
||||
app_handle: tauri::AppHandle,
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
@@ -1704,7 +1459,6 @@ async fn demo_execution_spl_token_execute(
|
||||
|
||||
/// Loads a bounded, typed journal of committed classic SPL Token projections.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn demo_spl_token_journal(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
request: crate::DemoSplTokenJournalRequest,
|
||||
@@ -1763,7 +1517,6 @@ async fn demo_spl_token_journal(
|
||||
|
||||
/// Derives the representative profile wallet ATA without exposing private key material.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn demo_spl_ata_derive(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
request: crate::DemoSplAtaDerivationRequest,
|
||||
@@ -1800,7 +1553,6 @@ async fn demo_spl_ata_derive(
|
||||
|
||||
/// Executes one representative Create or CreateIdempotent ATA flow.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn demo_execution_spl_ata_execute(
|
||||
app_handle: tauri::AppHandle,
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
@@ -1910,7 +1662,6 @@ async fn demo_execution_spl_ata_execute(
|
||||
|
||||
/// Loads a bounded journal of ATA-owned lifecycle facts.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn demo_spl_ata_journal(
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
request: crate::DemoSplAtaJournalRequest,
|
||||
@@ -1958,7 +1709,6 @@ async fn demo_spl_ata_journal(
|
||||
|
||||
/// Executes one public Token-2022 simulation or explicitly authorized Devnet submission.
|
||||
#[tauri::command]
|
||||
#[allow(clippy::question_mark_used)]
|
||||
async fn demo_execution_spl_token2022_execute(
|
||||
app_handle: tauri::AppHandle,
|
||||
state: tauri::State<'_, crate::AppState>,
|
||||
|
||||
Reference in New Issue
Block a user