推进 INI 面板 readonly status API manifest
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
getVisibleIniPanelEntries,
|
||||
createMachineSessionControlPageController,
|
||||
createMachineSessionReadonlyStatus,
|
||||
createMachineSessionReadonlyStatusApiManifest,
|
||||
readMachineSessionReadonlyStatus,
|
||||
loadMachineSessionForControlPageWorkflow,
|
||||
createControlPageSessionLoadState,
|
||||
@@ -26,8 +27,8 @@ import {
|
||||
```
|
||||
|
||||
`ui-shell.js` re-exports the entry manifest, the read-only control-page
|
||||
controller, the unified read-only status API, and the control-view renderer. It
|
||||
does not implement CNC behavior.
|
||||
controller, the unified read-only status API, the readonly-status API manifest,
|
||||
and the control-view renderer. It does not implement CNC behavior.
|
||||
|
||||
## Pages
|
||||
|
||||
@@ -56,6 +57,9 @@ mounting the existing control-page controller, refresh workflow, and renderer.
|
||||
Use `controlPage.readStatus` or `readMachineSessionReadonlyStatus()` when an
|
||||
outer shell needs one stable read of `stateBundle`, `workflowStatus`,
|
||||
`overview`, `controlView`, `session`, `runReadiness`, and `run`.
|
||||
Use `createMachineSessionReadonlyStatusApiManifest()` or
|
||||
`controlPage.readonlyStatusApiManifest` when you only need the API shape and
|
||||
method names.
|
||||
|
||||
The control-page refresh workflow lives in
|
||||
`runtime/ui/ini-panel/control-page-refresh-workflow.js`. Use
|
||||
|
||||
@@ -21,6 +21,35 @@ export function createMachineSessionReadonlyStatus({
|
||||
};
|
||||
}
|
||||
|
||||
export function createMachineSessionReadonlyStatusApiManifest() {
|
||||
return {
|
||||
apiName: "machine-session-readonly-status",
|
||||
methods: {
|
||||
readStatus: {
|
||||
input: "{ getPanelApi, getControlView }",
|
||||
output: "readonly machine-session status snapshot",
|
||||
},
|
||||
},
|
||||
relatedControlPageMethods: [
|
||||
"loadSessionState",
|
||||
"readStatus",
|
||||
"refresh",
|
||||
"renderView",
|
||||
],
|
||||
statusFields: [
|
||||
"stateBundle",
|
||||
"workflowStatus",
|
||||
"overview",
|
||||
"controlView",
|
||||
"report",
|
||||
"runReadiness",
|
||||
"run",
|
||||
"session",
|
||||
"status",
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export function readMachineSessionReadonlyStatus({ getPanelApi, getControlView } = {}) {
|
||||
if (typeof getPanelApi !== "function") {
|
||||
throw new Error("A panel API getter is required.");
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
} from "./control-page-session-workflow.js";
|
||||
import {
|
||||
createMachineSessionReadonlyStatus,
|
||||
createMachineSessionReadonlyStatusApiManifest,
|
||||
readMachineSessionReadonlyStatus,
|
||||
} from "./readonly-status-api.js";
|
||||
export {
|
||||
@@ -33,6 +34,7 @@ export {
|
||||
} from "./control-page-session-workflow.js";
|
||||
export {
|
||||
createMachineSessionReadonlyStatus,
|
||||
createMachineSessionReadonlyStatusApiManifest,
|
||||
readMachineSessionReadonlyStatus,
|
||||
} from "./readonly-status-api.js";
|
||||
export {
|
||||
@@ -70,6 +72,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
controlPage: {
|
||||
createController: createMachineSessionControlPageController,
|
||||
loadSessionState: loadMachineSessionForControlPageWorkflow,
|
||||
readonlyStatusApiManifest: createMachineSessionReadonlyStatusApiManifest(),
|
||||
readStatus: readMachineSessionReadonlyStatus,
|
||||
refresh: refreshMachineSessionControlPage,
|
||||
renderView: renderMachineSessionControlView,
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
createIniPanelLauncherLinkViewModel,
|
||||
createIniPanelShellViewModel,
|
||||
createMachineSessionReadonlyStatus,
|
||||
createMachineSessionReadonlyStatusApiManifest,
|
||||
loadMachineSessionForControlPageWorkflow,
|
||||
readMachineSessionReadonlyStatus,
|
||||
refreshMachineSessionControlPage,
|
||||
@@ -39,6 +40,7 @@ const requiredShellExports = [
|
||||
"getVisibleIniPanelEntries",
|
||||
"createMachineSessionControlPageController",
|
||||
"createMachineSessionReadonlyStatus",
|
||||
"createMachineSessionReadonlyStatusApiManifest",
|
||||
"loadMachineSessionForControlPageWorkflow",
|
||||
"readMachineSessionReadonlyStatus",
|
||||
"refreshMachineSessionControlPage",
|
||||
@@ -101,7 +103,13 @@ assert.deepEqual(createControlPageSessionLoadState({ phase: "waiting-panel" }),
|
||||
});
|
||||
assert.equal(typeof createIniPanelShellViewModel().controlPage.createController, "function");
|
||||
assert.equal(typeof createMachineSessionReadonlyStatus, "function");
|
||||
assert.equal(typeof createMachineSessionReadonlyStatusApiManifest, "function");
|
||||
assert.equal(createIniPanelShellViewModel().controlPage.loadSessionState, loadMachineSessionForControlPageWorkflow);
|
||||
assert.equal(createIniPanelShellViewModel().controlPage.readonlyStatusApiManifest.apiName, "machine-session-readonly-status");
|
||||
assert.deepEqual(
|
||||
createIniPanelShellViewModel().controlPage.readonlyStatusApiManifest,
|
||||
createMachineSessionReadonlyStatusApiManifest(),
|
||||
);
|
||||
assert.equal(createIniPanelShellViewModel().controlPage.readStatus, readMachineSessionReadonlyStatus);
|
||||
assert.equal(createIniPanelShellViewModel().controlPage.refresh, refreshMachineSessionControlPage);
|
||||
assert.equal(typeof createIniPanelShellViewModel().controlPage.renderView, "function");
|
||||
|
||||
@@ -2,6 +2,7 @@ import assert from "node:assert/strict";
|
||||
|
||||
import {
|
||||
createMachineSessionReadonlyStatus,
|
||||
createMachineSessionReadonlyStatusApiManifest,
|
||||
readMachineSessionReadonlyStatus,
|
||||
} from "../../../runtime/ui/ini-panel/readonly-status-api.js";
|
||||
|
||||
@@ -82,6 +83,33 @@ assert.deepEqual(createMachineSessionReadonlyStatus(), {
|
||||
},
|
||||
});
|
||||
|
||||
assert.deepEqual(createMachineSessionReadonlyStatusApiManifest(), {
|
||||
apiName: "machine-session-readonly-status",
|
||||
methods: {
|
||||
readStatus: {
|
||||
input: "{ getPanelApi, getControlView }",
|
||||
output: "readonly machine-session status snapshot",
|
||||
},
|
||||
},
|
||||
relatedControlPageMethods: [
|
||||
"loadSessionState",
|
||||
"readStatus",
|
||||
"refresh",
|
||||
"renderView",
|
||||
],
|
||||
statusFields: [
|
||||
"stateBundle",
|
||||
"workflowStatus",
|
||||
"overview",
|
||||
"controlView",
|
||||
"report",
|
||||
"runReadiness",
|
||||
"run",
|
||||
"session",
|
||||
"status",
|
||||
],
|
||||
});
|
||||
|
||||
const panelApi = {
|
||||
getMachineSessionStateBundle: () => stateBundle,
|
||||
getMachineSessionWorkflowStatus: () => workflowStatus,
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
createIniPanelLauncherLinkViewModel,
|
||||
createIniPanelShellViewModel,
|
||||
createMachineSessionReadonlyStatus,
|
||||
createMachineSessionReadonlyStatusApiManifest,
|
||||
createControlPageRefreshState,
|
||||
createControlPageSessionLoadState,
|
||||
createMachineSessionControlPageController,
|
||||
@@ -41,6 +42,7 @@ assert.deepEqual(createControlPageSessionLoadState({ phase: "waiting-panel" }),
|
||||
assert.equal(getIniPanelEntryByHref("./index.html")?.id, "edit-run");
|
||||
assert.equal(typeof createMachineSessionControlPageController, "function");
|
||||
assert.equal(typeof createMachineSessionReadonlyStatus, "function");
|
||||
assert.equal(typeof createMachineSessionReadonlyStatusApiManifest, "function");
|
||||
assert.equal(typeof loadMachineSessionForControlPageWorkflow, "function");
|
||||
assert.equal(typeof readMachineSessionReadonlyStatus, "function");
|
||||
assert.equal(typeof refreshMachineSessionControlPage, "function");
|
||||
@@ -83,6 +85,8 @@ assert.deepEqual(shellViewModel.pages, [
|
||||
assert.deepEqual(shellViewModel.launcherLinks, createIniPanelLauncherLinkViewModel());
|
||||
assert.equal(shellViewModel.controlPage.createController, createMachineSessionControlPageController);
|
||||
assert.equal(shellViewModel.controlPage.loadSessionState, loadMachineSessionForControlPageWorkflow);
|
||||
assert.equal(shellViewModel.controlPage.readonlyStatusApiManifest.apiName, "machine-session-readonly-status");
|
||||
assert.deepEqual(shellViewModel.controlPage.readonlyStatusApiManifest, createMachineSessionReadonlyStatusApiManifest());
|
||||
assert.equal(shellViewModel.controlPage.readStatus, readMachineSessionReadonlyStatus);
|
||||
assert.equal(shellViewModel.controlPage.refresh, refreshMachineSessionControlPage);
|
||||
assert.equal(shellViewModel.controlPage.renderView, renderMachineSessionControlView);
|
||||
|
||||
Reference in New Issue
Block a user