Align AXIS Web control lifecycle with LinuxCNC
This commit is contained in:
@@ -4,18 +4,17 @@ import type { SimSnapshotV1 } from "./protocol";
|
||||
|
||||
type Command = (kind: string, payload?: Record<string, unknown>, action?: string) => void;
|
||||
|
||||
export function XyzacKinematicsControl({ view, command }: { view: XyzacPanelView; command: Command }) {
|
||||
export function XyzacKinematicsControl({ view, command, loading = false }: { view: XyzacPanelView; command: Command; loading?: boolean }) {
|
||||
const active = view.kinematics?.active_type;
|
||||
return <section className="xyzac-kinematics" aria-label="XYZAC kinematics">
|
||||
<div className="xyzac-section-title"><strong>Switchkins</strong><span>{view.kinematics?.native_type ?? "Unavailable"}</span></div>
|
||||
<div className="xyzac-segments" role="group" aria-label="Kinematics mode">
|
||||
{XYZAC_KINEMATICS.map((item) => {
|
||||
const gate = view.gates[item.action];
|
||||
const disabled = view.status !== "ready" || gate?.enabled === false;
|
||||
const disabled = loading || view.status !== "ready" || gate?.enabled === false;
|
||||
return <button key={item.type} type="button" className={active === item.type ? "active" : ""} aria-pressed={active === item.type} disabled={disabled} title={gate?.reason ?? item.mcode} onClick={() => command("KINEMATICS_SELECT", { type: item.type }, item.action)}><span>{item.label}</span><small>{item.mcode}</small></button>;
|
||||
})}
|
||||
</div>
|
||||
<button type="button" className="xyzac-clear" title={view.gates.vismachClear?.reason ?? "Clear visual plot"} disabled={view.gates.vismachClear?.enabled === false} onClick={() => command("VISUAL_CLEAR", {}, "vismachClear")}>Clear plot</button>
|
||||
</section>;
|
||||
}
|
||||
|
||||
@@ -66,6 +65,6 @@ export function XyzacDiagnostics({ view, operations, alarms, error }: { view: Xy
|
||||
</section>;
|
||||
}
|
||||
|
||||
export function XyzacTrtPanel({ view, command }: { view: XyzacPanelView; command: Command }) {
|
||||
return <section className="xyzac-control-band" aria-label="XYZAC TRT controls"><XyzacKinematicsControl view={view} command={command} /><XyzacManualPanel view={view} /></section>;
|
||||
export function XyzacTrtPanel({ view, command, loading = false }: { view: XyzacPanelView; command: Command; loading?: boolean }) {
|
||||
return <section className="xyzac-control-band" aria-label="XYZAC TRT controls"><XyzacKinematicsControl view={view} command={command} loading={loading} /><XyzacManualPanel view={view} /></section>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user