42 lines
1.8 KiB
JavaScript
42 lines
1.8 KiB
JavaScript
import { SIM_DISPLAY_FAMILY_CATALOG } from "./sim-display-families.mjs";
|
|
|
|
const CAPABILITIES = Object.freeze({
|
|
axis: ["DRO", "jog", "home", "override", "G-code", "plot"],
|
|
qtvcp: ["DRO", "jog", "home", "override", "G-code", "VCP boundary"],
|
|
gscreen: ["DRO", "jog", "home", "override", "G-code", "VCP boundary"],
|
|
touchy: ["touch jog", "home", "MDI", "G-code"],
|
|
gladevcp: ["HAL pins", "jog", "home", "VCP boundary"],
|
|
pyvcp: ["HAL pins", "jog", "home", "VCP boundary"],
|
|
vismach: ["joints", "toolpath", "machine geometry", "G-code"],
|
|
other: ["Worker state", "G-code", "capability diagnostics"],
|
|
});
|
|
|
|
export function displayFamilyForCase(path) {
|
|
return SIM_DISPLAY_FAMILY_CATALOG.find((entry) => entry.path === path) ?? null;
|
|
}
|
|
|
|
export function renderDisplayFamily(document, { casePath = null } = {}) {
|
|
const entry = displayFamilyForCase(casePath);
|
|
const section = document.createElement("div");
|
|
section.className = "display-family";
|
|
const title = document.createElement("h3");
|
|
title.className = "display-family-title";
|
|
title.textContent = entry ? `${entry.family.toUpperCase()} controls` : "Display controls";
|
|
section.append(title);
|
|
const summary = document.createElement("p");
|
|
summary.className = "display-family-summary";
|
|
summary.textContent = entry ? `${entry.display ?? "display declared by include"} | ${entry.host_boundaries.length ? `boundary: ${entry.host_boundaries.join(", ")}` : "worker-native controls"}` : "Select a LinuxCNC case";
|
|
section.append(summary);
|
|
const list = document.createElement("ul");
|
|
list.className = "display-family-list";
|
|
for (const capability of CAPABILITIES[entry?.family ?? "other"]) {
|
|
const item = document.createElement("li");
|
|
item.textContent = capability;
|
|
list.append(item);
|
|
}
|
|
section.append(list);
|
|
return section;
|
|
}
|
|
|
|
export { CAPABILITIES };
|