diff --git a/crates/nx9-wg-api/src/routes/app_client_js.js b/crates/nx9-wg-api/src/routes/app_client_js.js index 6e7124d..934d928 100644 --- a/crates/nx9-wg-api/src/routes/app_client_js.js +++ b/crates/nx9-wg-api/src/routes/app_client_js.js @@ -2353,7 +2353,7 @@ } } - function updateCliCommandPreview() { + window.updateCliCommandPreview = function() { const preview = document.getElementById('cli-constructed-cmd'); const execBtn = document.getElementById('cli-exec-btn'); if (!preview || !execBtn) return; @@ -2407,7 +2407,7 @@ preview.textContent = parts.join(' '); execBtn.disabled = !canExecute; - } + }; window.executeCliConsoleCommand = async function() { const execBtn = document.getElementById('cli-exec-btn'); diff --git a/crates/nx9-wg-api/tests/test_ui_endpoints.rs b/crates/nx9-wg-api/tests/test_ui_endpoints.rs index 36f6f8e..b3fb62f 100644 --- a/crates/nx9-wg-api/tests/test_ui_endpoints.rs +++ b/crates/nx9-wg-api/tests/test_ui_endpoints.rs @@ -124,6 +124,13 @@ async fn test_ui_spa_index_and_stylesheet_endpoints() { assert!(html.contains("openClientExportModal")); assert!(html.contains("openAddPeerModal")); + // CLI console global preview and handler exposure + assert!(html.contains("window.updateCliCommandPreview")); + assert!(html.contains("window.onCliCommandChange")); + assert!(html.contains("window.onCliSubcommandChange")); + assert!(html.contains("window.onCliSubSubcommandChange")); + assert!(html.contains("window.executeCliConsoleCommand")); + // Peer enrollment must submit the selected Network UUID as network_id, // never the display name or CIDR. assert!(html.contains(r#"value="${n.id}""#));