v0.3.8-pre.003
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-store-desk/frontend/ts/main.ts
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
import DataTable from "datatables.net-bs5";
|
||||
import "datatables.net-bs5/css/dataTables.bootstrap5.css";
|
||||
@@ -130,13 +130,41 @@ function installInteractions(): void {
|
||||
frontendDebug("main", "Store Desk diagnostics refresh button clicked");
|
||||
void refreshDiagnostics();
|
||||
});
|
||||
document.querySelectorAll<HTMLButtonElement>("button").forEach(button => {
|
||||
if (button.dataset.view || button.id === "refreshDiagnostics") {
|
||||
document.addEventListener("click", event => {
|
||||
const eventTarget = event.target;
|
||||
if (!(eventTarget instanceof Element)) {
|
||||
return;
|
||||
}
|
||||
button.addEventListener("click", () => frontendDebug("main", "Store Desk generic button clicked", { buttonId: button.id || "anonymous" }));
|
||||
const control = eventTarget.closest<HTMLElement>("button, [role='tab'], [data-bs-toggle='tab']");
|
||||
if (!control) {
|
||||
return;
|
||||
}
|
||||
if (control instanceof HTMLButtonElement && (control.dataset.view || control.id === "refreshDiagnostics")) {
|
||||
return;
|
||||
}
|
||||
const controlId = control.id || control.getAttribute("data-bs-target") || control.getAttribute("aria-controls") || "anonymous";
|
||||
if (control.matches("[role='tab'], [data-bs-toggle='tab']")) {
|
||||
frontendDebug("main", "Store Desk tab control clicked", { controlId });
|
||||
return;
|
||||
}
|
||||
frontendDebug("main", "Store Desk generic button clicked", { buttonId: controlId });
|
||||
});
|
||||
frontendTrace("main", "Store Desk frontend interactions installed");
|
||||
document.addEventListener("shown.bs.tab", event => {
|
||||
const target = event.target;
|
||||
const tabId = target instanceof HTMLElement ? target.id || target.getAttribute("data-bs-target") || target.textContent?.trim() || "anonymous" : "unknown";
|
||||
frontendDebug("main", "Store Desk tab activated", { tabId });
|
||||
});
|
||||
document.addEventListener("change", event => {
|
||||
const target = event.target;
|
||||
if (!(target instanceof HTMLInputElement || target instanceof HTMLSelectElement || target instanceof HTMLTextAreaElement)) {
|
||||
return;
|
||||
}
|
||||
frontendDebug("main", "Store Desk interactive control changed", {
|
||||
controlId: target.id || target.getAttribute("name") || "anonymous",
|
||||
controlType: target instanceof HTMLSelectElement ? "select" : target.type || "text",
|
||||
});
|
||||
});
|
||||
frontendTrace("main", "Store Desk frontend interactions installed", { buttons: true, controls: true, tabs: true });
|
||||
}
|
||||
|
||||
async function initializeMain(): Promise<void> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// file: crates/ksp-app-store-desk/src/bootstrap.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
//! Transient standard Config and Logging bootstrap for Store Desk scaffold.
|
||||
//! Standard Config and verbose development Logging bootstrap for Store Desk.
|
||||
|
||||
/// Crate-internal Logging startup state shared by the application state.
|
||||
pub(crate) struct LoggingStartup {
|
||||
@@ -31,7 +31,7 @@ pub(crate) fn config_management(arguments: &[std::ffi::OsString]) -> ksp_core_li
|
||||
return std::result::Result::Ok(ksp_config_lib::ConfigManagement::new(engine));
|
||||
}
|
||||
|
||||
/// Initializes Logging from the standard Config document, with a trace-level in-memory fallback.
|
||||
/// Initializes development Logging from the standard `supertrace` profile, with a trace-level in-memory fallback.
|
||||
pub(crate) fn initialize_logging(
|
||||
management: &ksp_config_lib::ConfigManagement,
|
||||
runtime_identity: &ksp_logging_lib::LoggingRuntimeIdentity,
|
||||
@@ -41,7 +41,7 @@ pub(crate) fn initialize_logging(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return initialize_fallback_logging(error, runtime_identity),
|
||||
};
|
||||
let resolved = management.engine().load_resolved_logging_config(std::option::Option::None, &environment);
|
||||
let resolved = management.engine().load_resolved_logging_config(std::option::Option::Some(crate::DEVELOPMENT_LOGGING_PROFILE), &environment);
|
||||
let resolved = match resolved {
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return initialize_fallback_logging(error, runtime_identity),
|
||||
@@ -55,7 +55,7 @@ pub(crate) fn initialize_logging(
|
||||
target: crate::TRACING_TARGET,
|
||||
domain = crate::TRACING_DOMAIN_BOOTSTRAP,
|
||||
active_profile = active_profile_id.as_str(),
|
||||
"initialized Store Desk scaffold logging from standard Config"
|
||||
"initialized Store Desk development logging from explicit supertrace Config profile"
|
||||
);
|
||||
std::result::Result::Ok(crate::LoggingStartup {
|
||||
guard,
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
// file: crates/ksp-app-store-desk/src/constants.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
//! Application-owned tracing targets and domains.
|
||||
|
||||
/// Logging profile used while Store Desk is under active development.
|
||||
pub(crate) const DEVELOPMENT_LOGGING_PROFILE: &str = "supertrace";
|
||||
/// Structured domain used while bootstrapping Config and Logging.
|
||||
pub(crate) const TRACING_DOMAIN_BOOTSTRAP: &str = "store.bootstrap";
|
||||
/// Structured domain used by technical frontend events.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-store-desk/src/lib.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
//! Tauri desktop scaffold for backend-neutral KSP Store inspection.
|
||||
|
||||
@@ -28,8 +28,10 @@ pub(crate) use self::app_state::AppState;
|
||||
pub(crate) use self::bootstrap::LoggingStartup;
|
||||
/// Builds the Config management facade from the common KSP CLI bootstrap contract.
|
||||
pub(crate) use self::bootstrap::config_management;
|
||||
/// Initializes Logging from the standard Config document for the scaffold.
|
||||
/// Initializes verbose development Logging from the standard Config document.
|
||||
pub(crate) use self::bootstrap::initialize_logging;
|
||||
/// Logging profile used while Store Desk is under active development.
|
||||
pub(crate) use self::constants::DEVELOPMENT_LOGGING_PROFILE;
|
||||
/// Structured domain used while bootstrapping Config and Logging.
|
||||
pub(crate) use self::constants::TRACING_DOMAIN_BOOTSTRAP;
|
||||
/// Structured domain used by technical frontend events.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-store-desk/tests/desktop_security.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
//! Security boundary tests for the Store Desk scaffold.
|
||||
|
||||
@@ -41,13 +41,27 @@ fn pre_002_frontend_avoids_network_browser_storage_and_blocking_dialogs() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_002_frontend_tracing_covers_navigation_buttons_refresh_and_ipc() {
|
||||
fn pre_003_frontend_tracing_covers_navigation_buttons_tabs_controls_refresh_and_ipc() {
|
||||
let main = include_str!("../frontend/ts/main.ts");
|
||||
let invoke = include_str!("../frontend/ts/invoke.ts");
|
||||
assert!(main.contains("navigation button clicked"));
|
||||
assert!(main.contains("diagnostics refresh button clicked"));
|
||||
assert!(main.contains("generic button clicked"));
|
||||
assert!(main.contains("tab control clicked"));
|
||||
assert!(main.contains("tab activated"));
|
||||
assert!(main.contains("interactive control changed"));
|
||||
assert!(main.contains("view activated"));
|
||||
assert!(invoke.contains("IPC command requested"));
|
||||
assert!(invoke.contains("IPC command completed"));
|
||||
assert!(invoke.contains("IPC command failed"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn pre_003_store_desk_development_logging_explicitly_selects_supertrace() {
|
||||
let constants = include_str!("../src/constants.rs");
|
||||
let bootstrap = include_str!("../src/bootstrap.rs");
|
||||
assert!(constants.contains("DEVELOPMENT_LOGGING_PROFILE: &str = \"supertrace\""));
|
||||
assert!(bootstrap.contains("std::option::Option::Some(crate::DEVELOPMENT_LOGGING_PROFILE)"));
|
||||
assert!(bootstrap.contains("LogFilterLevel::Trace"));
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user