推进 INI 面板 entry manifest

This commit is contained in:
2026-06-14 23:16:52 +08:00
parent c18aa21d70
commit 77d32a3f17
8 changed files with 154 additions and 2 deletions

View 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;
}

View File

@@ -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>