推进 INI 面板 control view renderer helper
This commit is contained in:
@@ -23,6 +23,9 @@ For control-page polling, use
|
||||
smaller workflow-facing object derived from the same report data.
|
||||
For a single read call, use `window.linuxCncIniPanelApi.getMachineSessionStateBundle()`.
|
||||
For direct rendering, use `window.linuxCncIniPanelApi.getMachineSessionControlView()`.
|
||||
The panel also exposes
|
||||
`window.linuxCncIniPanelApi.renderMachineSessionControlView(container)`, which
|
||||
renders the current view into a supplied DOM container.
|
||||
|
||||
## `createIniPanelStateSummary(input)`
|
||||
|
||||
@@ -164,15 +167,22 @@ canonical events, or LinuxCNC-owned runtime content.
|
||||
A minimal read-only browser consumer can render the sections directly:
|
||||
|
||||
```js
|
||||
const view = window.linuxCncIniPanelApi.getMachineSessionControlView();
|
||||
for (const section of view.sections) {
|
||||
renderSection(section.title, section.rows);
|
||||
}
|
||||
window.linuxCncIniPanelApi.renderMachineSessionControlView(
|
||||
document.getElementById("machine-session-control-view"),
|
||||
);
|
||||
```
|
||||
|
||||
Consumers should treat `rows` as display data and keep actions wired through
|
||||
explicit workflow APIs instead of deriving behavior from labels.
|
||||
|
||||
For external pages that only have a view object, import the pure renderer:
|
||||
|
||||
```js
|
||||
import { renderMachineSessionControlView } from "./control-view-renderer.js";
|
||||
|
||||
renderMachineSessionControlView(container, view);
|
||||
```
|
||||
|
||||
## Boundary Rules
|
||||
|
||||
- Do not parse G-code text in this helper.
|
||||
|
||||
Reference in New Issue
Block a user