推进 INI 面板 launch entry

This commit is contained in:
2026-06-14 23:12:22 +08:00
parent 59ffacb64e
commit c18aa21d70
5 changed files with 203 additions and 0 deletions

View File

@@ -32,6 +32,7 @@ and mirrors the same control view into the visible page.
The page uses `createMachineSessionControlPageController(...)` from
`runtime/ui/ini-panel/control-page-controller.js` so other read-only shells can
reuse the same iframe/API polling contract.
For a light navigation entry, open `runtime/ui/ini-panel/launch.html`.
## `createIniPanelStateSummary(input)`

View File

@@ -0,0 +1,76 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>LinuxCNC INI Panel Launch</title>
<style>
:root {
color-scheme: light;
--bg: #f2f5f8;
--panel: #ffffff;
--border: #cfd8e1;
--text: #17212b;
--muted: #5a6875;
--accent: #1366a6;
}
* { box-sizing: border-box; }
body {
margin: 0;
font-family: "Segoe UI", "Noto Sans", sans-serif;
background: var(--bg);
color: var(--text);
}
main {
max-width: 960px;
margin: 0 auto;
padding: 24px;
display: grid;
gap: 16px;
}
.panel {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 8px;
box-shadow: 0 10px 30px rgba(17, 34, 51, 0.06);
padding: 16px;
display: grid;
gap: 14px;
}
h1 {
margin: 0;
font-size: 18px;
font-weight: 600;
}
.links {
display: grid;
gap: 8px;
}
a {
color: var(--accent);
text-decoration: none;
font: 14px/1.4 "Segoe UI", "Noto Sans", sans-serif;
}
a:hover {
text-decoration: underline;
}
p {
margin: 0;
color: var(--muted);
font: 13px/1.5 "Segoe UI", "Noto Sans", sans-serif;
}
</style>
</head>
<body>
<main>
<section class="panel">
<h1>LinuxCNC INI Panel</h1>
<p>Choose the editable panel or the read-only control view.</p>
<div class="links">
<a href="./index.html">Open edit and run panel</a>
<a href="./control-page.html">Open read-only control view</a>
</div>
</section>
</main>
</body>
</html>

View File

@@ -0,0 +1,48 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>LinuxCNC INI Launch Smoke</title>
</head>
<body>
<pre id="status">running</pre>
<script type="module">
function assertEqual(actual, expected, label) {
if (actual !== expected) {
throw new Error(`${label}: expected ${expected}, got ${actual}`);
}
}
async function loadLaunchFrame() {
const frame = document.createElement("iframe");
frame.src = "../../runtime/ui/ini-panel/launch.html";
document.body.appendChild(frame);
await new Promise((resolve, reject) => {
frame.addEventListener("load", resolve, { once: true });
frame.addEventListener("error", reject, { once: true });
});
return frame.contentDocument;
}
try {
const launchDoc = await loadLaunchFrame();
assertEqual(
launchDoc.querySelector('a[href="./index.html"]').textContent,
"Open edit and run panel",
"launch panel edit link",
);
assertEqual(
launchDoc.querySelector('a[href="./control-page.html"]').textContent,
"Open read-only control view",
"launch panel control link",
);
status.textContent = "browser_ini_launch_smoke=ok";
console.log("browser_ini_launch_smoke=ok");
} catch (error) {
status.textContent = `browser_ini_launch_smoke=failed: ${error.message}`;
console.error(error);
throw error;
}
</script>
</body>
</html>

View File

@@ -62,8 +62,10 @@ fi
PORT="$(cat "$PORT_FILE")"
URL="http://127.0.0.1:$PORT/tests/browser/ini_panel_smoke.html"
CONTROL_URL="http://127.0.0.1:$PORT/tests/browser/ini_panel_control_page_smoke.html"
LAUNCH_URL="http://127.0.0.1:$PORT/tests/browser/ini_panel_launch_smoke.html"
OUT="$TMP_DIR/chromium.out"
CONTROL_OUT="$TMP_DIR/chromium-control.out"
LAUNCH_OUT="$TMP_DIR/chromium-launch.out"
"$CHROMIUM" \
--headless=new \
@@ -98,3 +100,20 @@ if ! grep -Fq "browser_ini_control_page_smoke=ok" "$CONTROL_OUT"; then
fi
echo "browser_ini_control_page_smoke=ok"
"$CHROMIUM" \
--headless=new \
--disable-gpu \
--no-sandbox \
--user-data-dir="$CHROME_PROFILE" \
--virtual-time-budget=10000 \
--dump-dom \
"$LAUNCH_URL" >"$LAUNCH_OUT" 2>&1
if ! grep -Fq "browser_ini_launch_smoke=ok" "$LAUNCH_OUT"; then
echo "browser INI launch smoke failed" >&2
sed -n '1,220p' "$LAUNCH_OUT" >&2
exit 1
fi
echo "browser_ini_launch_smoke=ok"