推进 INI 面板 entry manifest
This commit is contained in:
20
wasm-port/runtime/ui/ini-panel/entry-manifest.js
Normal file
20
wasm-port/runtime/ui/ini-panel/entry-manifest.js
Normal file
@@ -0,0 +1,20 @@
|
||||
export const INI_PANEL_ENTRIES = [
|
||||
{
|
||||
id: "edit-run",
|
||||
title: "Open edit and run panel",
|
||||
href: "./index.html",
|
||||
},
|
||||
{
|
||||
id: "control-view",
|
||||
title: "Open read-only control view",
|
||||
href: "./control-page.html",
|
||||
},
|
||||
];
|
||||
|
||||
export function getIniPanelEntryManifest() {
|
||||
return INI_PANEL_ENTRIES.map((entry) => ({ ...entry }));
|
||||
}
|
||||
|
||||
export function getIniPanelEntryByHref(href) {
|
||||
return INI_PANEL_ENTRIES.find((entry) => entry.href === href) ?? null;
|
||||
}
|
||||
@@ -67,10 +67,23 @@
|
||||
<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>
|
||||
<a data-entry-id="edit-run" href="./index.html">Open edit and run panel</a>
|
||||
<a data-entry-id="control-view" href="./control-page.html">Open read-only control view</a>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<script type="module">
|
||||
import { getIniPanelEntryManifest } from "./entry-manifest.js";
|
||||
|
||||
const manifest = getIniPanelEntryManifest();
|
||||
for (const entry of manifest) {
|
||||
const link = document.querySelector(`a[data-entry-id="${entry.id}"]`);
|
||||
if (!link) {
|
||||
throw new Error(`Missing launcher entry ${entry.id}`);
|
||||
}
|
||||
link.textContent = entry.title;
|
||||
link.href = entry.href;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user