推进 INI 面板 launcher link view-model helper
This commit is contained in:
125
text11.txt
125
text11.txt
@@ -1633,3 +1633,128 @@ host_wasm_opfs_browser_smokes=ok
|
||||
继续推进实质 UI/API surface。下一批建议把 `ui-shell.js` 中用于 launcher 的入口列表再封装成
|
||||
`getVisibleIniPanelEntries()`,让页面不需要知道 manifest 复制语义;仍保持只读,不新增控制
|
||||
按钮,不解析 G-code。
|
||||
|
||||
二十一、2026-06-14 继续执行记录:INI panel visible entries helper
|
||||
|
||||
本轮按“加快实质性推进”在 `ui-shell.js` 增加 launcher-facing 的可见入口 helper,让页面和
|
||||
文档使用 `getVisibleIniPanelEntries()`,不再直接依赖 manifest 复制语义。
|
||||
|
||||
完成内容:
|
||||
|
||||
- `wasm-port/runtime/ui/ini-panel/ui-shell.js` 新增 `getVisibleIniPanelEntries()`;
|
||||
- `getVisibleIniPanelEntries()` 返回 launcher 可见入口列表;
|
||||
- `wasm-port/runtime/ui/ini-panel/launch.html` 改为调用 `getVisibleIniPanelEntries()`;
|
||||
- `wasm-port/tests/browser/ini_panel_launch_smoke.html` 改为验证 visible entries;
|
||||
- `wasm-port/tests/ui/node/verify_ini_panel_ui_shell.mjs` 覆盖 visible entries 与复制语义;
|
||||
- `wasm-port/docs/panel-entry.md` 改为以 `getVisibleIniPanelEntries()` 作为入口列表 API;
|
||||
- `wasm-port/tests/ui/node/verify_ini_panel_entry_docs.mjs` 同步验证文档和 visible entries;
|
||||
- 未新增控制按钮;
|
||||
- 未解析 G-code;
|
||||
- 未解释 canonical events;
|
||||
- 未改变 OPFS/session persistence、LinuxCNC interpreter、tool、parameter、planner 或
|
||||
LinuxCNC-owned runtime semantics。
|
||||
|
||||
验证已通过:
|
||||
|
||||
```bash
|
||||
git diff --check
|
||||
wasm-port/tests/ui/node/verify_ini_panel_ui_shell.sh
|
||||
wasm-port/tests/ui/node/verify_ini_panel_entry_docs.sh
|
||||
wasm-port/tests/ui/node/verify_ui_node_smokes.sh
|
||||
wasm-port/tests/browser/verify_ini_panel_browser.sh
|
||||
wasm-port/tools/verify_vendor_sync.sh
|
||||
wasm-port/tools/verify_no_standalone_cnc_semantics.sh
|
||||
SKIP_INTERP_BUILD=1 wasm-port/tests/wasm/node/verify_interp_wasm.sh
|
||||
SKIP_INTERP_BUILD=1 wasm-port/tests/wasm/node/verify_sim_configs_inventory_wasm.sh
|
||||
wasm-port/tests/host/verify_host_smokes.sh
|
||||
```
|
||||
|
||||
关键输出:
|
||||
|
||||
```text
|
||||
ini_panel_ui_shell_node_smoke=ok
|
||||
ini_panel_entry_docs_node_smoke=ok
|
||||
ui_node_smokes=ok
|
||||
browser_ini_opfs_smoke=ok
|
||||
browser_ini_control_page_smoke=ok
|
||||
browser_ini_launch_smoke=ok
|
||||
vendor sync up to date
|
||||
standalone CNC semantics guard complete
|
||||
interp_wasm_node_smoke=ok
|
||||
sim_configs_wasm_node_inventory_executed=28
|
||||
sim_configs_wasm_node_inventory_passed=28
|
||||
sim_configs_wasm_node_inventory_skipped=131
|
||||
sim_configs_wasm_node_inventory_unexpected_fail=0
|
||||
host_wasm_opfs_browser_smokes=ok
|
||||
```
|
||||
|
||||
下一步建议:
|
||||
|
||||
继续推进 UI/API surface,但避免纯文档循环。下一批建议把 `getVisibleIniPanelEntries()` 用到
|
||||
更多外层 shell 消费示例,或新增一个小型 Node helper 生成 launcher link view-model;仍保持
|
||||
只读,不新增控制按钮,不解析 G-code。
|
||||
|
||||
二十二、2026-06-15 继续执行记录:INI panel launcher link view-model helper
|
||||
|
||||
本轮按“加快实质性推进”继续推进 UI/API surface,在 shell 层新增 launcher link
|
||||
view-model helper,让 launcher 页面不直接读取 manifest 字段名。
|
||||
|
||||
完成内容:
|
||||
|
||||
- `wasm-port/runtime/ui/ini-panel/ui-shell.js` 新增
|
||||
`createIniPanelLauncherLinkViewModel()`;
|
||||
- launcher link view-model 输出 `entryId`、`href`、`label`,作为外层 shell 可直接渲染的
|
||||
链接模型;
|
||||
- `wasm-port/runtime/ui/ini-panel/launch.html` 改为调用
|
||||
`createIniPanelLauncherLinkViewModel()` 渲染链接;
|
||||
- `wasm-port/tests/browser/ini_panel_launch_smoke.html` 覆盖 launcher link view-model;
|
||||
- `wasm-port/tests/ui/node/verify_ini_panel_ui_shell.mjs` 覆盖 view-model 内容与复制语义;
|
||||
- `wasm-port/tests/ui/node/verify_ini_panel_entry_docs.mjs` 同步校验文档和 shell helper;
|
||||
- `wasm-port/docs/panel-entry.md` 记录 launcher link view-model API;
|
||||
- 未新增控制按钮;
|
||||
- 未解析 G-code;
|
||||
- 未解释 canonical events;
|
||||
- 未改变 OPFS/session persistence、LinuxCNC interpreter、tool、parameter、planner 或
|
||||
LinuxCNC-owned runtime semantics。
|
||||
|
||||
验证已通过:
|
||||
|
||||
```bash
|
||||
git diff --check
|
||||
wasm-port/tests/ui/node/verify_ini_panel_ui_shell.sh
|
||||
wasm-port/tests/ui/node/verify_ini_panel_entry_docs.sh
|
||||
wasm-port/tests/browser/verify_ini_panel_browser.sh
|
||||
wasm-port/tests/ui/node/verify_ui_node_smokes.sh
|
||||
wasm-port/tools/verify_vendor_sync.sh
|
||||
wasm-port/tools/verify_no_standalone_cnc_semantics.sh
|
||||
SKIP_INTERP_BUILD=1 wasm-port/tests/wasm/node/verify_interp_wasm.sh
|
||||
SKIP_INTERP_BUILD=1 wasm-port/tests/wasm/node/verify_sim_configs_inventory_wasm.sh
|
||||
SKIP_INI_BUILD=1 SKIP_INTERP_BUILD=1 wasm-port/tests/browser/verify_ini_panel_browser.sh
|
||||
wasm-port/tests/host/verify_host_smokes.sh
|
||||
```
|
||||
|
||||
关键输出:
|
||||
|
||||
```text
|
||||
ini_panel_ui_shell_node_smoke=ok
|
||||
ini_panel_entry_docs_node_smoke=ok
|
||||
browser_ini_opfs_smoke=ok
|
||||
browser_ini_control_page_smoke=ok
|
||||
browser_ini_launch_smoke=ok
|
||||
ui_node_smokes=ok
|
||||
vendor sync up to date
|
||||
standalone CNC semantics guard complete
|
||||
interp_wasm_node_smoke=ok
|
||||
sim_configs_wasm_node_inventory_executed=28
|
||||
sim_configs_wasm_node_inventory_passed=28
|
||||
sim_configs_wasm_node_inventory_skipped=131
|
||||
sim_configs_wasm_node_inventory_unexpected_fail=0
|
||||
browser_interp_smoke=ok
|
||||
host_wasm_opfs_browser_smokes=ok
|
||||
```
|
||||
|
||||
下一步建议:
|
||||
|
||||
继续推进 UI/API surface 的可复用边界。下一批建议新增一个
|
||||
`createIniPanelShellViewModel()`,把 launcher links、可用页面和 control-page helper 暴露为
|
||||
单一 shell model,供外层应用一次性挂载;仍保持只读,不新增控制按钮,不解析 G-code。
|
||||
|
||||
@@ -10,8 +10,9 @@ control view:
|
||||
```js
|
||||
import {
|
||||
INI_PANEL_ENTRIES,
|
||||
createIniPanelLauncherLinkViewModel,
|
||||
getIniPanelEntryByHref,
|
||||
getIniPanelEntryManifest,
|
||||
getVisibleIniPanelEntries,
|
||||
createMachineSessionControlPageController,
|
||||
renderMachineSessionControlView,
|
||||
} from "../runtime/ui/ini-panel/ui-shell.js";
|
||||
@@ -28,15 +29,19 @@ controller, and the control-view renderer. It does not implement CNC behavior.
|
||||
| Edit and run | `runtime/ui/ini-panel/index.html` | Editable INI panel and existing run workflow surface. |
|
||||
| Read-only control view | `runtime/ui/ini-panel/control-page.html` | Read-only control view backed by the panel API. |
|
||||
|
||||
## Entry Manifest
|
||||
## Visible Entries
|
||||
|
||||
The visible launch entries come from `getIniPanelEntryManifest()`:
|
||||
The visible launch entries come from `getVisibleIniPanelEntries()`:
|
||||
|
||||
| Entry id | Href | Title |
|
||||
| --- | --- | --- |
|
||||
| `edit-run` | `./index.html` | Open edit and run panel |
|
||||
| `control-view` | `./control-page.html` | Open read-only control view |
|
||||
|
||||
Launcher pages can render links from `createIniPanelLauncherLinkViewModel()`
|
||||
without reading manifest field names directly. Each item has `entryId`, `href`,
|
||||
and `label`.
|
||||
|
||||
## Boundary
|
||||
|
||||
The entry shell only links pages and renders already-observed panel state. It
|
||||
|
||||
@@ -73,16 +73,16 @@
|
||||
</section>
|
||||
</main>
|
||||
<script type="module">
|
||||
import { getIniPanelEntryManifest } from "./ui-shell.js";
|
||||
import { createIniPanelLauncherLinkViewModel } from "./ui-shell.js";
|
||||
|
||||
const manifest = getIniPanelEntryManifest();
|
||||
for (const entry of manifest) {
|
||||
const link = document.querySelector(`a[data-entry-id="${entry.id}"]`);
|
||||
const links = createIniPanelLauncherLinkViewModel();
|
||||
for (const linkModel of links) {
|
||||
const link = document.querySelector(`a[data-entry-id="${linkModel.entryId}"]`);
|
||||
if (!link) {
|
||||
throw new Error(`Missing launcher entry ${entry.id}`);
|
||||
throw new Error(`Missing launcher entry ${linkModel.entryId}`);
|
||||
}
|
||||
link.textContent = entry.title;
|
||||
link.href = entry.href;
|
||||
link.textContent = linkModel.label;
|
||||
link.href = linkModel.href;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
import {
|
||||
INI_PANEL_ENTRIES,
|
||||
getIniPanelEntryByHref,
|
||||
getIniPanelEntryManifest,
|
||||
} from "./entry-manifest.js";
|
||||
export {
|
||||
INI_PANEL_ENTRIES,
|
||||
getIniPanelEntryByHref,
|
||||
@@ -9,3 +14,15 @@ export {
|
||||
export {
|
||||
renderMachineSessionControlView,
|
||||
} from "./control-view-renderer.js";
|
||||
|
||||
export function getVisibleIniPanelEntries() {
|
||||
return getIniPanelEntryManifest();
|
||||
}
|
||||
|
||||
export function createIniPanelLauncherLinkViewModel(entries = getVisibleIniPanelEntries()) {
|
||||
return entries.map(({ id, href, title }) => ({
|
||||
entryId: id,
|
||||
href,
|
||||
label: title,
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
<pre id="status">running</pre>
|
||||
<script type="module">
|
||||
import {
|
||||
createIniPanelLauncherLinkViewModel,
|
||||
getIniPanelEntryByHref,
|
||||
getIniPanelEntryManifest,
|
||||
getVisibleIniPanelEntries,
|
||||
} from "../../runtime/ui/ini-panel/ui-shell.js";
|
||||
|
||||
function assertEqual(actual, expected, label) {
|
||||
@@ -30,8 +31,13 @@
|
||||
}
|
||||
|
||||
try {
|
||||
const manifest = getIniPanelEntryManifest();
|
||||
assertEqual(manifest.length, 2, "launch manifest length");
|
||||
const visibleEntries = getVisibleIniPanelEntries();
|
||||
assertEqual(visibleEntries.length, 2, "launch visible entry length");
|
||||
const launcherLinks = createIniPanelLauncherLinkViewModel();
|
||||
assertEqual(launcherLinks.length, 2, "launcher link model length");
|
||||
assertEqual(launcherLinks[0].entryId, "edit-run", "launcher link entry id");
|
||||
assertEqual(launcherLinks[0].label, "Open edit and run panel", "launcher link label");
|
||||
assertEqual(launcherLinks[0].href, "./index.html", "launcher link href");
|
||||
assertEqual(getIniPanelEntryByHref("./index.html").id, "edit-run", "launch manifest edit entry");
|
||||
assertEqual(
|
||||
getIniPanelEntryByHref("./control-page.html").title,
|
||||
|
||||
@@ -5,7 +5,8 @@ import { dirname, resolve } from "node:path";
|
||||
|
||||
import {
|
||||
INI_PANEL_ENTRIES,
|
||||
getIniPanelEntryManifest,
|
||||
createIniPanelLauncherLinkViewModel,
|
||||
getVisibleIniPanelEntries,
|
||||
} from "../../../runtime/ui/ini-panel/ui-shell.js";
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
@@ -15,8 +16,9 @@ const shellText = readFileSync(resolve(root, "runtime/ui/ini-panel/ui-shell.js")
|
||||
|
||||
const requiredShellExports = [
|
||||
"INI_PANEL_ENTRIES",
|
||||
"createIniPanelLauncherLinkViewModel",
|
||||
"getIniPanelEntryByHref",
|
||||
"getIniPanelEntryManifest",
|
||||
"getVisibleIniPanelEntries",
|
||||
"createMachineSessionControlPageController",
|
||||
"renderMachineSessionControlView",
|
||||
];
|
||||
@@ -36,7 +38,15 @@ for (const [label, path] of requiredPages) {
|
||||
assert.match(docText, new RegExp(`\\| ${label} \\| \`${path.replaceAll("/", "\\/")}\``));
|
||||
}
|
||||
|
||||
assert.deepEqual(getIniPanelEntryManifest(), INI_PANEL_ENTRIES);
|
||||
assert.deepEqual(getVisibleIniPanelEntries(), INI_PANEL_ENTRIES);
|
||||
assert.deepEqual(
|
||||
createIniPanelLauncherLinkViewModel(),
|
||||
INI_PANEL_ENTRIES.map(({ id, href, title }) => ({
|
||||
entryId: id,
|
||||
href,
|
||||
label: title,
|
||||
})),
|
||||
);
|
||||
|
||||
for (const entry of INI_PANEL_ENTRIES) {
|
||||
const escapedHref = entry.href.replace(".", "\\.");
|
||||
|
||||
@@ -2,13 +2,16 @@ import assert from "node:assert/strict";
|
||||
|
||||
import {
|
||||
INI_PANEL_ENTRIES,
|
||||
createIniPanelLauncherLinkViewModel,
|
||||
createMachineSessionControlPageController,
|
||||
getIniPanelEntryByHref,
|
||||
getIniPanelEntryManifest,
|
||||
getVisibleIniPanelEntries,
|
||||
renderMachineSessionControlView,
|
||||
} from "../../../runtime/ui/ini-panel/ui-shell.js";
|
||||
|
||||
assert.deepEqual(getIniPanelEntryManifest(), INI_PANEL_ENTRIES);
|
||||
assert.deepEqual(getVisibleIniPanelEntries(), INI_PANEL_ENTRIES);
|
||||
assert.equal(getIniPanelEntryByHref("./index.html")?.id, "edit-run");
|
||||
assert.equal(typeof createMachineSessionControlPageController, "function");
|
||||
assert.equal(typeof renderMachineSessionControlView, "function");
|
||||
@@ -16,6 +19,24 @@ assert.equal(typeof renderMachineSessionControlView, "function");
|
||||
const shellManifest = getIniPanelEntryManifest();
|
||||
shellManifest[0].title = "changed";
|
||||
assert.equal(INI_PANEL_ENTRIES[0].title, "Open edit and run panel");
|
||||
const visibleEntries = getVisibleIniPanelEntries();
|
||||
visibleEntries[0].title = "changed";
|
||||
assert.equal(INI_PANEL_ENTRIES[0].title, "Open edit and run panel");
|
||||
assert.deepEqual(createIniPanelLauncherLinkViewModel(), [
|
||||
{
|
||||
entryId: "edit-run",
|
||||
href: "./index.html",
|
||||
label: "Open edit and run panel",
|
||||
},
|
||||
{
|
||||
entryId: "control-view",
|
||||
href: "./control-page.html",
|
||||
label: "Open read-only control view",
|
||||
},
|
||||
]);
|
||||
const launcherLinks = createIniPanelLauncherLinkViewModel();
|
||||
launcherLinks[0].label = "changed";
|
||||
assert.equal(INI_PANEL_ENTRIES[0].title, "Open edit and run panel");
|
||||
|
||||
const panelFrame = {
|
||||
contentWindow: {
|
||||
|
||||
Reference in New Issue
Block a user