推进 INI 面板 launch manifest version schema
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
INI_PANEL_ENTRIES,
|
||||
createControlPageBrowserApiMethods,
|
||||
createIniPanelLaunchApiManifest,
|
||||
createIniPanelLaunchApiSchema,
|
||||
createIniPanelLauncherLinkViewModel,
|
||||
createIniPanelShellControlPageContract,
|
||||
createIniPanelShellViewModel,
|
||||
@@ -87,6 +88,8 @@ Use `createIniPanelLaunchApiManifest()` or
|
||||
single read-only description of launch methods, visible entries, target pages,
|
||||
the control-page browser API methods, and OPFS/session persistence capabilities
|
||||
for machine files, session snapshots, and read-only status.
|
||||
Use `createIniPanelLaunchApiSchema()` or `manifestVersion` when an outer shell
|
||||
needs to check launch manifest compatibility before consuming these fields.
|
||||
|
||||
The control-page refresh workflow lives in
|
||||
`runtime/ui/ini-panel/control-page-refresh-workflow.js`. Use
|
||||
|
||||
@@ -61,9 +61,27 @@ export function createIniPanelLauncherLinkViewModel(entries = getVisibleIniPanel
|
||||
}));
|
||||
}
|
||||
|
||||
export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntries()) {
|
||||
export function createIniPanelLaunchApiSchema() {
|
||||
return {
|
||||
apiName: "ini-panel-launch",
|
||||
manifestVersion: 1,
|
||||
fields: [
|
||||
"apiName",
|
||||
"manifestVersion",
|
||||
"methods",
|
||||
"visibleEntries",
|
||||
"targetPages",
|
||||
"controlPageApiMethods",
|
||||
"persistenceCapabilities",
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntries()) {
|
||||
const schema = createIniPanelLaunchApiSchema();
|
||||
return {
|
||||
apiName: schema.apiName,
|
||||
manifestVersion: schema.manifestVersion,
|
||||
methods: [
|
||||
"getLaunchApiManifest",
|
||||
"getLauncherLinks",
|
||||
|
||||
@@ -74,6 +74,11 @@
|
||||
"ini-panel-launch",
|
||||
"launch API manifest name",
|
||||
);
|
||||
assertEqual(
|
||||
launchApiManifest.manifestVersion,
|
||||
1,
|
||||
"launch API manifest version",
|
||||
);
|
||||
assertEqual(
|
||||
launchApiManifest.methods.join(","),
|
||||
"getLaunchApiManifest,getLauncherLinks,getControlPageApiMethods",
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
createControlPageSessionLoadState,
|
||||
createControlPageBrowserApiMethods,
|
||||
createIniPanelLaunchApiManifest,
|
||||
createIniPanelLaunchApiSchema,
|
||||
createIniPanelLauncherLinkViewModel,
|
||||
createIniPanelShellControlPageContract,
|
||||
createIniPanelShellViewModel,
|
||||
@@ -41,6 +42,7 @@ const requiredShellExports = [
|
||||
"createControlPageBrowserApiMethods",
|
||||
"createControlPageSessionLoadState",
|
||||
"createIniPanelLaunchApiManifest",
|
||||
"createIniPanelLaunchApiSchema",
|
||||
"createIniPanelLauncherLinkViewModel",
|
||||
"createIniPanelShellControlPageContract",
|
||||
"createIniPanelShellViewModel",
|
||||
@@ -99,6 +101,7 @@ assert.deepEqual(
|
||||
assert.deepEqual(createIniPanelShellViewModel().pages, getVisibleIniPanelEntries());
|
||||
assert.deepEqual(createIniPanelShellViewModel().launcherLinks, createIniPanelLauncherLinkViewModel());
|
||||
assert.deepEqual(createIniPanelShellViewModel().launchApiManifest, createIniPanelLaunchApiManifest());
|
||||
assert.equal(createIniPanelShellViewModel().launchApiManifest.manifestVersion, createIniPanelLaunchApiSchema().manifestVersion);
|
||||
assert.deepEqual(
|
||||
createIniPanelShellViewModel().controlPage.contract,
|
||||
createIniPanelShellControlPageContract(),
|
||||
@@ -131,6 +134,7 @@ assert.equal(createIniPanelShellViewModel().controlPage.readStatus, readMachineS
|
||||
assert.equal(createIniPanelShellViewModel().controlPage.refresh, refreshMachineSessionControlPage);
|
||||
assert.equal(typeof createIniPanelShellViewModel().controlPage.renderView, "function");
|
||||
assert.match(shellText, /\bexport function createControlPageBrowserApiMethods\b/);
|
||||
assert.match(shellText, /\bexport function createIniPanelLaunchApiSchema\b/);
|
||||
assert.match(shellText, /\bexport function createIniPanelLaunchApiManifest\b/);
|
||||
assert.match(controlPageText, /\bgetControlPageApiMethods\b/);
|
||||
assert.match(launchText, /\blinuxCncIniPanelLaunchApi\b/);
|
||||
@@ -143,6 +147,7 @@ assert.match(docText, /\blinuxCncIniPanelControlPageApi\.getControlPageApiMethod
|
||||
assert.match(docText, /\blinuxCncIniPanelControlPageApi\.getControlPageContract\b/);
|
||||
assert.match(docText, /\blinuxCncIniPanelControlPageApi\.readControlPageStatus\b/);
|
||||
assert.match(docText, /\bcreateIniPanelLaunchApiManifest\b/);
|
||||
assert.match(docText, /\bcreateIniPanelLaunchApiSchema\b/);
|
||||
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getLaunchApiManifest\b/);
|
||||
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getControlPageApiMethods\b/);
|
||||
assert.match(docText, /\bOPFS\/session persistence capabilities\b/);
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
INI_PANEL_ENTRIES,
|
||||
createControlPageBrowserApiMethods,
|
||||
createIniPanelLaunchApiManifest,
|
||||
createIniPanelLaunchApiSchema,
|
||||
createIniPanelShellViewModel,
|
||||
getVisibleIniPanelEntries,
|
||||
} from "../../../runtime/ui/ini-panel/ui-shell.js";
|
||||
@@ -17,9 +18,25 @@ const launchText = readFileSync(resolve(root, "runtime/ui/ini-panel/launch.html"
|
||||
const shellText = readFileSync(resolve(root, "runtime/ui/ini-panel/ui-shell.js"), "utf8");
|
||||
|
||||
const manifest = createIniPanelLaunchApiManifest();
|
||||
const schema = createIniPanelLaunchApiSchema();
|
||||
|
||||
assert.deepEqual(schema, {
|
||||
apiName: "ini-panel-launch",
|
||||
manifestVersion: 1,
|
||||
fields: [
|
||||
"apiName",
|
||||
"manifestVersion",
|
||||
"methods",
|
||||
"visibleEntries",
|
||||
"targetPages",
|
||||
"controlPageApiMethods",
|
||||
"persistenceCapabilities",
|
||||
],
|
||||
});
|
||||
|
||||
assert.deepEqual(manifest, {
|
||||
apiName: "ini-panel-launch",
|
||||
manifestVersion: 1,
|
||||
methods: [
|
||||
"getLaunchApiManifest",
|
||||
"getLauncherLinks",
|
||||
@@ -68,6 +85,7 @@ assert.deepEqual(manifest, {
|
||||
});
|
||||
|
||||
assert.deepEqual(createIniPanelShellViewModel().launchApiManifest, manifest);
|
||||
assert.equal(createIniPanelShellViewModel().launchApiManifest.manifestVersion, schema.manifestVersion);
|
||||
assert.deepEqual(getVisibleIniPanelEntries(), INI_PANEL_ENTRIES);
|
||||
|
||||
manifest.visibleEntries[0].title = "changed";
|
||||
@@ -101,6 +119,7 @@ assert.deepEqual(customManifest.targetPages, [
|
||||
]);
|
||||
|
||||
assert.match(shellText, /\bexport function createIniPanelLaunchApiManifest\b/);
|
||||
assert.match(shellText, /\bexport function createIniPanelLaunchApiSchema\b/);
|
||||
assert.match(launchText, /\bgetLaunchApiManifest\b/);
|
||||
assert.match(launchText, /\blinuxCncIniPanelLaunchApi\b/);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
controlPageStatusText,
|
||||
createControlPageBrowserApiMethods,
|
||||
createIniPanelLaunchApiManifest,
|
||||
createIniPanelLaunchApiSchema,
|
||||
createIniPanelLauncherLinkViewModel,
|
||||
createIniPanelShellControlPageContract,
|
||||
createIniPanelShellViewModel,
|
||||
@@ -48,6 +49,7 @@ assert.equal(typeof createMachineSessionReadonlyStatus, "function");
|
||||
assert.equal(typeof createMachineSessionReadonlyStatusApiManifest, "function");
|
||||
assert.equal(typeof createControlPageBrowserApiMethods, "function");
|
||||
assert.equal(typeof createIniPanelLaunchApiManifest, "function");
|
||||
assert.equal(typeof createIniPanelLaunchApiSchema, "function");
|
||||
assert.equal(typeof createIniPanelShellControlPageContract, "function");
|
||||
assert.equal(typeof loadMachineSessionForControlPageWorkflow, "function");
|
||||
assert.equal(typeof readMachineSessionReadonlyStatus, "function");
|
||||
@@ -90,6 +92,7 @@ assert.deepEqual(shellViewModel.pages, [
|
||||
]);
|
||||
assert.deepEqual(shellViewModel.launcherLinks, createIniPanelLauncherLinkViewModel());
|
||||
assert.deepEqual(shellViewModel.launchApiManifest, createIniPanelLaunchApiManifest());
|
||||
assert.equal(shellViewModel.launchApiManifest.manifestVersion, createIniPanelLaunchApiSchema().manifestVersion);
|
||||
assert.deepEqual(shellViewModel.controlPage.browserApiMethods, createControlPageBrowserApiMethods());
|
||||
assert.equal(shellViewModel.controlPage.createController, createMachineSessionControlPageController);
|
||||
assert.deepEqual(shellViewModel.controlPage.contract, createIniPanelShellControlPageContract());
|
||||
|
||||
Reference in New Issue
Block a user