v0.2.6-pre.003-fix.001
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-wallet-desk/frontend/ts/main.ts
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
import "bootstrap";
|
||||
import DataTable from "datatables.net-bs5";
|
||||
@@ -55,6 +55,33 @@ function activateView(viewId: ViewId, source: "startup" | "user"): void {
|
||||
frontendTrace("main", "Wallet Desk view DOM updated", { viewId, source });
|
||||
}
|
||||
|
||||
function bindFrontendInteractions(): void {
|
||||
document.addEventListener(
|
||||
"click",
|
||||
event => {
|
||||
const source = event.target;
|
||||
if (!(source instanceof Element)) {
|
||||
return;
|
||||
}
|
||||
const control = source.closest<HTMLElement>('button, a, input, select, textarea, [role="button"], [role="tab"], [data-view], [data-shell-action]');
|
||||
if (!control) {
|
||||
return;
|
||||
}
|
||||
frontendTrace("main", "Frontend control clicked", {
|
||||
controlId: control.id || null,
|
||||
controlType: control instanceof HTMLButtonElement ? control.type : null,
|
||||
disabled: control instanceof HTMLButtonElement ? control.disabled : control.getAttribute("aria-disabled") === "true",
|
||||
role: control.getAttribute("role"),
|
||||
shellAction: control.dataset.shellAction ?? null,
|
||||
tagName: control.tagName.toLowerCase(),
|
||||
viewId: control.dataset.view ?? null,
|
||||
});
|
||||
},
|
||||
true,
|
||||
);
|
||||
frontendTrace("main", "Frontend control interaction logger installed");
|
||||
}
|
||||
|
||||
function bindNavigation(): void {
|
||||
document.querySelectorAll<HTMLButtonElement>("[data-view]").forEach(button => {
|
||||
button.addEventListener("click", () => {
|
||||
@@ -159,6 +186,7 @@ function bindShellActions(): void {
|
||||
async function initializeMain(): Promise<void> {
|
||||
const windowLabel = getCurrentWindow().label;
|
||||
frontendInfo("main", "Wallet Desk main frontend loaded", { windowLabel });
|
||||
bindFrontendInteractions();
|
||||
bindNavigation();
|
||||
bindShellActions();
|
||||
initializeWalletTable();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ksp-app-wallet-desk",
|
||||
"private": true,
|
||||
"version": "0.2.6-pre.3",
|
||||
"version": "0.2.6-pre.3.fix.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "KSP Wallet Desk",
|
||||
"version": "0.2.6-pre.3",
|
||||
"version": "0.2.6-pre.3.fix.1",
|
||||
"identifier": "com.sasedev.ksp-app-wallet-desk",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-wallet-desk/tests/config_composition.rs
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
//! Config composition contracts introduced for Wallet Desk pre.003.
|
||||
|
||||
@@ -29,7 +29,8 @@ fn wallet_desk_composite_selects_logging_transport_and_wallet_by_file_id() {
|
||||
assert!(composite.is_ok(), "committed Wallet Desk composite should resolve: {composite:?}");
|
||||
if let std::result::Result::Ok(composite) = composite {
|
||||
assert_eq!(composite.profile_id(), "devnet");
|
||||
assert_component(&composite, "logging", ksp_config_lib::FILE_ID_STD_LOGGING, "local_dev");
|
||||
assert_component(&composite, "logging", ksp_config_lib::FILE_ID_STD_LOGGING, "wallet_desk_dev");
|
||||
assert_wallet_desk_logging_trace_profile(&composite);
|
||||
assert_component(&composite, "transport", ksp_config_lib::FILE_ID_STD_TRANSPORT, "devnet_public");
|
||||
assert_component(&composite, "wallet", ksp_config_lib::FILE_ID_STD_WALLET, "default");
|
||||
}
|
||||
@@ -37,6 +38,46 @@ fn wallet_desk_composite_selects_logging_transport_and_wallet_by_file_id() {
|
||||
}
|
||||
}
|
||||
|
||||
fn assert_wallet_desk_logging_trace_profile(composite: &ksp_config_lib::ResolvedConfigComposite) {
|
||||
let component = composite.component("logging");
|
||||
assert!(component.is_some(), "missing logging component");
|
||||
if let std::option::Option::Some(component) = component {
|
||||
let profile = component.resolved().profile();
|
||||
assert_eq!(profile.get("default_filter").and_then(serde_json::Value::as_str), std::option::Option::Some("info"));
|
||||
let console = profile.get("console").and_then(serde_json::Value::as_object);
|
||||
let console_filter = console
|
||||
.and_then(|value| {
|
||||
return value.get("filter");
|
||||
})
|
||||
.and_then(serde_json::Value::as_object);
|
||||
let console_level = console_filter
|
||||
.and_then(|value| {
|
||||
return value.get("level");
|
||||
})
|
||||
.and_then(serde_json::Value::as_str);
|
||||
assert_eq!(console_level, std::option::Option::Some("trace"));
|
||||
let targets = console_filter
|
||||
.and_then(|value| {
|
||||
return value.get("targets");
|
||||
})
|
||||
.and_then(serde_json::Value::as_array);
|
||||
assert!(targets.is_some(), "Wallet Desk console targets should exist");
|
||||
if let std::option::Option::Some(targets) = targets {
|
||||
assert!(targets.iter().any(|target| -> bool {
|
||||
return target.as_str() == std::option::Option::Some("ksp-app-wallet-desk");
|
||||
}));
|
||||
}
|
||||
let target_filters = profile.get("target_filters").and_then(serde_json::Value::as_array);
|
||||
assert!(target_filters.is_some(), "Wallet Desk target filters should exist");
|
||||
if let std::option::Option::Some(target_filters) = target_filters {
|
||||
assert!(target_filters.iter().any(|filter| -> bool {
|
||||
return filter.get("target_prefix").and_then(serde_json::Value::as_str) == std::option::Option::Some("ksp-app-wallet-desk")
|
||||
&& filter.get("level").and_then(serde_json::Value::as_str) == std::option::Option::Some("trace");
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn assert_component(composite: &ksp_config_lib::ResolvedConfigComposite, component_id: &str, file_id: &str, profile_id: &str) {
|
||||
let component = composite.component(component_id);
|
||||
assert!(component.is_some(), "missing component {component_id}");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-wallet-desk/tests/desktop_contract.rs
|
||||
// version: 2
|
||||
// version: 3
|
||||
|
||||
//! Desktop build, shell and Config-status contract audits for Wallet Desk.
|
||||
|
||||
@@ -85,3 +85,15 @@ fn shell_contains_wallet_navigation_datatable_and_lock_state_icons() {
|
||||
assert!(main.contains("ResizeObserver"));
|
||||
assert!(main.contains("simplebar"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn frontend_control_interactions_are_trace_logged_without_control_values() {
|
||||
let root = app_root();
|
||||
let main = read_text(root.join("frontend/ts/main.ts").as_path());
|
||||
assert!(main.contains("bindFrontendInteractions"));
|
||||
assert!(main.contains("Frontend control clicked"));
|
||||
assert!(main.contains("[role=\"tab\"]"));
|
||||
assert!(main.contains("shellAction: control.dataset.shellAction"));
|
||||
assert!(main.contains("viewId: control.dataset.view"));
|
||||
assert!(!main.contains("control.value"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user