推进 INI 面板 shell handoff workflow display-model helper
This commit is contained in:
@@ -35,6 +35,7 @@ import {
|
||||
mountIniPanelShellSessionHandoff,
|
||||
mountIniPanelShellSessionHandoffFromControlPage,
|
||||
createIniPanelShellSessionHandoffWorkflowSummary,
|
||||
createIniPanelShellSessionHandoffWorkflowDisplayViewModel,
|
||||
renderIniPanelShellSessionHandoffMountState,
|
||||
createIniPanelShellSessionHandoffPackageReport,
|
||||
createIniPanelShellSessionHandoffPackageRenderState,
|
||||
@@ -256,6 +257,10 @@ the expected handoff status fields as a structured ready/blocked result. Use
|
||||
outer shell needs one stable end-to-end summary that combines mount workflow,
|
||||
control-page mount workflow, readonly status result, and current blocking
|
||||
reasons into display rows. Use
|
||||
`createIniPanelShellSessionHandoffWorkflowDisplayViewModel()` or
|
||||
`linuxCncIniPanelLaunchApi.getShellSessionHandoffWorkflowDisplayViewModel()`
|
||||
when an outer shell needs that end-to-end summary compressed into stable
|
||||
`title`, `statusText`, `detailText`, and rows for direct display. Use
|
||||
`renderIniPanelShellSessionHandoffMountState()` or
|
||||
`linuxCncIniPanelLaunchApi.renderShellSessionHandoffMountState()` when an outer
|
||||
shell needs the shared read-only DOM renderer for those rows. The launch page
|
||||
|
||||
@@ -112,6 +112,7 @@
|
||||
mountIniPanelShellSessionHandoffFromControlPage,
|
||||
readIniPanelShellSessionHandoffStatusFromControlPage,
|
||||
createIniPanelShellSessionHandoffWorkflowSummary,
|
||||
createIniPanelShellSessionHandoffWorkflowDisplayViewModel,
|
||||
renderIniPanelShellSessionHandoffMountState,
|
||||
} from "./ui-shell.js";
|
||||
|
||||
@@ -232,6 +233,11 @@
|
||||
}),
|
||||
})
|
||||
),
|
||||
getShellSessionHandoffWorkflowDisplayViewModel: (options) => (
|
||||
createIniPanelShellSessionHandoffWorkflowDisplayViewModel(
|
||||
options ?? shellViewModel.shellSessionHandoffWorkflowSummary,
|
||||
)
|
||||
),
|
||||
isSupportedShellSessionHandoffPackage: shellViewModel.isSupportedShellSessionHandoffPackage,
|
||||
getLauncherLinks: () => shellViewModel.launcherLinks,
|
||||
getControlPageApiMethods: () => shellViewModel.controlPage.browserApiMethods,
|
||||
|
||||
@@ -150,6 +150,7 @@ export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntr
|
||||
"mountShellSessionHandoffFromControlPage",
|
||||
"readShellSessionHandoffStatusFromControlPage",
|
||||
"getShellSessionHandoffWorkflowSummary",
|
||||
"getShellSessionHandoffWorkflowDisplayViewModel",
|
||||
"isSupportedShellSessionHandoffPackage",
|
||||
"getLauncherLinks",
|
||||
"getControlPageApiMethods",
|
||||
@@ -1474,6 +1475,27 @@ export function createIniPanelShellSessionHandoffWorkflowSummary({
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellSessionHandoffWorkflowDisplayViewModel(
|
||||
workflowSummary = createIniPanelShellSessionHandoffWorkflowSummary(),
|
||||
) {
|
||||
const blockingReasons = Array.isArray(workflowSummary?.blockingReasons)
|
||||
? workflowSummary.blockingReasons
|
||||
: [];
|
||||
return {
|
||||
phase: workflowSummary?.phase === "ready" ? "ready" : "blocked",
|
||||
title: "Shell handoff workflow",
|
||||
statusText: workflowSummary?.ready ? "Ready" : "Blocked",
|
||||
detailText: blockingReasons.length > 0 ? blockingReasons.join(", ") : "No blocking reasons",
|
||||
rows: Array.isArray(workflowSummary?.rows)
|
||||
? workflowSummary.rows.map(({ id, label, value }) => ({
|
||||
id,
|
||||
label,
|
||||
value,
|
||||
}))
|
||||
: [],
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries()) {
|
||||
const shellIntegrationManifest = createIniPanelShellIntegrationManifest(entries);
|
||||
const shellIntegrationReadiness = createIniPanelShellIntegrationReadiness(shellIntegrationManifest);
|
||||
@@ -1538,6 +1560,24 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
shellSessionHandoffPackageMountDisplayViewModel,
|
||||
);
|
||||
const shellSessionHandoffMountDomContract = createIniPanelShellSessionHandoffMountDomContract();
|
||||
const shellSessionHandoffWorkflowSummary = createIniPanelShellSessionHandoffWorkflowSummary({
|
||||
mountWorkflow: {
|
||||
phase: shellSessionHandoffPackageMountRenderState.phase,
|
||||
ready: shellSessionHandoffPackageMountRenderState.ready,
|
||||
statusLine: shellSessionHandoffPackageMountRenderState.statusLine,
|
||||
},
|
||||
controlPageMountWorkflow: {
|
||||
phase: shellSessionHandoffPackageMountState.phase,
|
||||
ready: shellSessionHandoffPackageMountState.ready,
|
||||
statusLine: shellSessionHandoffPackageMountState.statusLine,
|
||||
},
|
||||
readonlyStatusResult: readIniPanelShellSessionHandoffStatusFromControlPage({
|
||||
handoffSummary: shellSessionHandoffSummary,
|
||||
}),
|
||||
});
|
||||
const shellSessionHandoffWorkflowDisplayViewModel = createIniPanelShellSessionHandoffWorkflowDisplayViewModel(
|
||||
shellSessionHandoffWorkflowSummary,
|
||||
);
|
||||
return {
|
||||
pages: entries.map(({ id, href, title }) => ({
|
||||
id,
|
||||
@@ -1566,6 +1606,8 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
shellSessionHandoffPackageMountDisplayViewModel,
|
||||
shellSessionHandoffPackageMountRenderState,
|
||||
shellSessionHandoffMountDomContract,
|
||||
shellSessionHandoffWorkflowSummary,
|
||||
shellSessionHandoffWorkflowDisplayViewModel,
|
||||
launchApiSchema: createIniPanelLaunchApiSchema(),
|
||||
launchApiManifest: createIniPanelLaunchApiManifest(entries),
|
||||
isSupportedShellIntegrationManifest: isSupportedIniPanelShellIntegrationManifest,
|
||||
@@ -1595,6 +1637,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
mountShellSessionHandoffFromControlPage: mountIniPanelShellSessionHandoffFromControlPage,
|
||||
readShellSessionHandoffStatusFromControlPage: readIniPanelShellSessionHandoffStatusFromControlPage,
|
||||
createShellSessionHandoffWorkflowSummary: createIniPanelShellSessionHandoffWorkflowSummary,
|
||||
createShellSessionHandoffWorkflowDisplayViewModel: createIniPanelShellSessionHandoffWorkflowDisplayViewModel,
|
||||
isSupportedShellSessionHandoffPackage: isSupportedIniPanelShellSessionHandoffPackage,
|
||||
controlPage: {
|
||||
browserApiSchema: createControlPageBrowserApiSchema(),
|
||||
|
||||
@@ -92,6 +92,7 @@ TOOL_TABLE = browser-shell-tool.tbl
|
||||
!launchApi?.mountShellSessionHandoffFromControlPage ||
|
||||
!launchApi?.readShellSessionHandoffStatusFromControlPage ||
|
||||
!launchApi?.getShellSessionHandoffWorkflowSummary ||
|
||||
!launchApi?.getShellSessionHandoffWorkflowDisplayViewModel ||
|
||||
!launchApi?.isSupportedShellSessionHandoffPackage
|
||||
) {
|
||||
throw new Error("launch API namespace did not expose shell integration helpers");
|
||||
@@ -363,6 +364,9 @@ TOOL_TABLE = browser-shell-tool.tbl
|
||||
controlPageMountWorkflow: readyControlPageMountWorkflow,
|
||||
readonlyStatusResult,
|
||||
});
|
||||
const workflowDisplayResult = launchApi.getShellSessionHandoffWorkflowDisplayViewModel(
|
||||
workflowSummaryResult,
|
||||
);
|
||||
assertEqual(readonlyStatusResult.phase, "ready", "shell handoff readonly status result phase");
|
||||
assertEqual(readonlyStatusResult.ready, true, "shell handoff readonly status result readiness");
|
||||
assertEqual(
|
||||
@@ -373,6 +377,9 @@ TOOL_TABLE = browser-shell-tool.tbl
|
||||
assertEqual(workflowSummaryResult.phase, "ready", "shell handoff workflow summary phase");
|
||||
assertEqual(workflowSummaryResult.ready, true, "shell handoff workflow summary readiness");
|
||||
assertEqual(workflowSummaryResult.blockingReasons.join(","), "", "shell handoff workflow summary blocking reasons");
|
||||
assertEqual(workflowDisplayResult.phase, "ready", "shell handoff workflow display phase");
|
||||
assertEqual(workflowDisplayResult.statusText, "Ready", "shell handoff workflow display status");
|
||||
assertEqual(workflowDisplayResult.detailText, "No blocking reasons", "shell handoff workflow display detail");
|
||||
assertEqual(
|
||||
readonlyStatus.workflowStatus.lastAction,
|
||||
"load-session",
|
||||
|
||||
@@ -33,6 +33,7 @@ import {
|
||||
mountIniPanelShellSessionHandoffFromControlPage,
|
||||
readIniPanelShellSessionHandoffStatusFromControlPage,
|
||||
createIniPanelShellSessionHandoffWorkflowSummary,
|
||||
createIniPanelShellSessionHandoffWorkflowDisplayViewModel,
|
||||
renderIniPanelShellSessionHandoffMountState,
|
||||
createIniPanelShellSessionHandoffPackageReport,
|
||||
createIniPanelShellSessionHandoffPackageRenderState,
|
||||
@@ -105,6 +106,7 @@ const requiredShellExports = [
|
||||
"mountIniPanelShellSessionHandoffFromControlPage",
|
||||
"readIniPanelShellSessionHandoffStatusFromControlPage",
|
||||
"createIniPanelShellSessionHandoffWorkflowSummary",
|
||||
"createIniPanelShellSessionHandoffWorkflowDisplayViewModel",
|
||||
"renderIniPanelShellSessionHandoffMountState",
|
||||
"createIniPanelShellSessionHandoffPackageReport",
|
||||
"createIniPanelShellSessionHandoffPackageRenderState",
|
||||
@@ -315,6 +317,10 @@ assert.equal(
|
||||
createIniPanelShellSessionHandoffWorkflowSummary().phase,
|
||||
"blocked",
|
||||
);
|
||||
assert.equal(
|
||||
createIniPanelShellSessionHandoffWorkflowDisplayViewModel().phase,
|
||||
"blocked",
|
||||
);
|
||||
assert.equal(isSupportedIniPanelShellSessionHandoffPackage(createIniPanelShellViewModel().shellSessionHandoffPackage), true);
|
||||
assert.equal(isSupportedIniPanelShellIntegrationManifest(createIniPanelShellViewModel().shellIntegrationManifest), true);
|
||||
assert.deepEqual(createIniPanelShellViewModel().launchApiSchema, createIniPanelLaunchApiSchema());
|
||||
@@ -478,6 +484,7 @@ assert.match(docText, /\blinuxCncIniPanelLaunchApi\.mountShellSessionHandoff\b/)
|
||||
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.mountShellSessionHandoffFromControlPage\b/);
|
||||
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.readShellSessionHandoffStatusFromControlPage\b/);
|
||||
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellSessionHandoffWorkflowSummary\b/);
|
||||
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getShellSessionHandoffWorkflowDisplayViewModel\b/);
|
||||
assert.match(docText, /\blinuxCncIniPanelLaunchApi\.getControlPageApiMethods\b/);
|
||||
assert.match(docText, /\bini_panel_shell_integration_workflow_smoke\.html\b/);
|
||||
assert.match(browserIniPanelText, /\bini_panel_shell_integration_workflow_smoke\.html\b/);
|
||||
@@ -500,6 +507,7 @@ assert.match(shellIntegrationWorkflowSmokeText, /\bmountShellSessionHandoff\b/);
|
||||
assert.match(shellIntegrationWorkflowSmokeText, /\bmountShellSessionHandoffFromControlPage\b/);
|
||||
assert.match(shellIntegrationWorkflowSmokeText, /\breadShellSessionHandoffStatusFromControlPage\b/);
|
||||
assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffWorkflowSummary\b/);
|
||||
assert.match(shellIntegrationWorkflowSmokeText, /\bgetShellSessionHandoffWorkflowDisplayViewModel\b/);
|
||||
assert.match(shellIntegrationWorkflowSmokeText, /\brenderShellSessionHandoffMountState\b/);
|
||||
assert.match(shellIntegrationWorkflowSmokeText, /\bdata-external-shell-mount\b/);
|
||||
assert.match(shellIntegrationWorkflowSmokeText, /\bdata-external-mount-value\b/);
|
||||
|
||||
@@ -70,6 +70,7 @@ assert.deepEqual(manifest, {
|
||||
"mountShellSessionHandoffFromControlPage",
|
||||
"readShellSessionHandoffStatusFromControlPage",
|
||||
"getShellSessionHandoffWorkflowSummary",
|
||||
"getShellSessionHandoffWorkflowDisplayViewModel",
|
||||
"isSupportedShellSessionHandoffPackage",
|
||||
"getLauncherLinks",
|
||||
"getControlPageApiMethods",
|
||||
@@ -195,6 +196,7 @@ assert.match(launchText, /\bmountShellSessionHandoff\b/);
|
||||
assert.match(launchText, /\bmountShellSessionHandoffFromControlPage\b/);
|
||||
assert.match(launchText, /\breadShellSessionHandoffStatusFromControlPage\b/);
|
||||
assert.match(launchText, /\bgetShellSessionHandoffWorkflowSummary\b/);
|
||||
assert.match(launchText, /\bgetShellSessionHandoffWorkflowDisplayViewModel\b/);
|
||||
assert.match(launchText, /\bisSupportedShellSessionHandoffPackage\b/);
|
||||
assert.match(launchText, /\bdata-handoff-mount\b/);
|
||||
assert.match(launchText, /\bdata-handoff-mount-status\b/);
|
||||
|
||||
@@ -29,6 +29,7 @@ import {
|
||||
mountIniPanelShellSessionHandoffFromControlPage,
|
||||
readIniPanelShellSessionHandoffStatusFromControlPage,
|
||||
createIniPanelShellSessionHandoffWorkflowSummary,
|
||||
createIniPanelShellSessionHandoffWorkflowDisplayViewModel,
|
||||
createIniPanelShellSessionHandoffPackageReport,
|
||||
createIniPanelShellSessionHandoffPackageRenderState,
|
||||
createIniPanelShellSessionHandoffPackageSchema,
|
||||
@@ -155,7 +156,7 @@ assert.deepEqual(readiness, {
|
||||
counts: {
|
||||
pages: 2,
|
||||
launcherLinks: 2,
|
||||
launchMethods: 33,
|
||||
launchMethods: 34,
|
||||
controlPageMethods: 11,
|
||||
persistenceCapabilities: 3,
|
||||
},
|
||||
@@ -217,7 +218,7 @@ assert.deepEqual(handoffSummary, {
|
||||
counts: {
|
||||
pages: 2,
|
||||
launcherLinks: 2,
|
||||
launchMethods: 33,
|
||||
launchMethods: 34,
|
||||
controlPageMethods: 11,
|
||||
persistenceCapabilities: 3,
|
||||
},
|
||||
@@ -721,6 +722,10 @@ assert.equal(
|
||||
createIniPanelShellSessionHandoffWorkflowSummary().phase,
|
||||
"blocked",
|
||||
);
|
||||
assert.equal(
|
||||
createIniPanelShellSessionHandoffWorkflowDisplayViewModel().phase,
|
||||
"blocked",
|
||||
);
|
||||
assert.deepEqual(
|
||||
createIniPanelShellSessionHandoffPackageMountState({
|
||||
handoffPackage,
|
||||
@@ -1132,7 +1137,7 @@ assert.deepEqual(createIniPanelShellIntegrationReadiness(blockedManifest), {
|
||||
counts: {
|
||||
pages: 2,
|
||||
launcherLinks: 2,
|
||||
launchMethods: 33,
|
||||
launchMethods: 34,
|
||||
controlPageMethods: 11,
|
||||
persistenceCapabilities: 3,
|
||||
},
|
||||
@@ -1307,6 +1312,7 @@ assert.match(shellText, /\bexport function mountIniPanelShellSessionHandoff\b/);
|
||||
assert.match(shellText, /\bexport function mountIniPanelShellSessionHandoffFromControlPage\b/);
|
||||
assert.match(shellText, /\bexport function readIniPanelShellSessionHandoffStatusFromControlPage\b/);
|
||||
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffWorkflowSummary\b/);
|
||||
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffWorkflowDisplayViewModel\b/);
|
||||
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageReport\b/);
|
||||
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageRenderState\b/);
|
||||
assert.match(shellText, /\bexport function createIniPanelShellSessionHandoffPackageSchema\b/);
|
||||
@@ -1338,6 +1344,7 @@ assert.match(docText, /\bmountIniPanelShellSessionHandoff\b/);
|
||||
assert.match(docText, /\bmountIniPanelShellSessionHandoffFromControlPage\b/);
|
||||
assert.match(docText, /\breadIniPanelShellSessionHandoffStatusFromControlPage\b/);
|
||||
assert.match(docText, /\bcreateIniPanelShellSessionHandoffWorkflowSummary\b/);
|
||||
assert.match(docText, /\bcreateIniPanelShellSessionHandoffWorkflowDisplayViewModel\b/);
|
||||
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageReport\b/);
|
||||
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageRenderState\b/);
|
||||
assert.match(docText, /\bcreateIniPanelShellSessionHandoffPackageSchema\b/);
|
||||
|
||||
@@ -29,6 +29,7 @@ import {
|
||||
mountIniPanelShellSessionHandoffFromControlPage,
|
||||
readIniPanelShellSessionHandoffStatusFromControlPage,
|
||||
createIniPanelShellSessionHandoffWorkflowSummary,
|
||||
createIniPanelShellSessionHandoffWorkflowDisplayViewModel,
|
||||
renderIniPanelShellSessionHandoffMountState,
|
||||
createIniPanelShellSessionHandoffPackageReport,
|
||||
createIniPanelShellSessionHandoffPackageRenderState,
|
||||
@@ -106,6 +107,7 @@ assert.equal(typeof mountIniPanelShellSessionHandoff, "function");
|
||||
assert.equal(typeof mountIniPanelShellSessionHandoffFromControlPage, "function");
|
||||
assert.equal(typeof readIniPanelShellSessionHandoffStatusFromControlPage, "function");
|
||||
assert.equal(typeof createIniPanelShellSessionHandoffWorkflowSummary, "function");
|
||||
assert.equal(typeof createIniPanelShellSessionHandoffWorkflowDisplayViewModel, "function");
|
||||
assert.equal(typeof renderIniPanelShellSessionHandoffMountState, "function");
|
||||
assert.equal(typeof createIniPanelShellSessionHandoffPackageReport, "function");
|
||||
assert.equal(typeof createIniPanelShellSessionHandoffPackageRenderState, "function");
|
||||
@@ -720,6 +722,10 @@ assert.equal(
|
||||
shellViewModel.createShellSessionHandoffWorkflowSummary,
|
||||
createIniPanelShellSessionHandoffWorkflowSummary,
|
||||
);
|
||||
assert.equal(
|
||||
shellViewModel.createShellSessionHandoffWorkflowDisplayViewModel,
|
||||
createIniPanelShellSessionHandoffWorkflowDisplayViewModel,
|
||||
);
|
||||
assert.equal(shellViewModel.createShellSessionHandoffPackageReport, createIniPanelShellSessionHandoffPackageReport);
|
||||
assert.equal(shellViewModel.createShellSessionHandoffPackageSchema, createIniPanelShellSessionHandoffPackageSchema);
|
||||
assert.equal(shellViewModel.isSupportedShellSessionHandoffPackage, isSupportedIniPanelShellSessionHandoffPackage);
|
||||
@@ -966,6 +972,20 @@ const readyWorkflowSummaryResult = createIniPanelShellSessionHandoffWorkflowSumm
|
||||
assert.equal(readyWorkflowSummaryResult.phase, "ready");
|
||||
assert.equal(readyWorkflowSummaryResult.ready, true);
|
||||
assert.equal(readyWorkflowSummaryResult.blockingReasons.length, 0);
|
||||
const workflowDisplayViewModel = createIniPanelShellSessionHandoffWorkflowDisplayViewModel(
|
||||
workflowSummaryResult,
|
||||
);
|
||||
assert.equal(workflowDisplayViewModel.phase, "blocked");
|
||||
assert.equal(workflowDisplayViewModel.title, "Shell handoff workflow");
|
||||
assert.equal(workflowDisplayViewModel.statusText, "Blocked");
|
||||
assert.equal(workflowDisplayViewModel.detailText, "mount:blocked");
|
||||
assert.equal(workflowDisplayViewModel.rows.length, 5);
|
||||
const readyWorkflowDisplayViewModel = createIniPanelShellSessionHandoffWorkflowDisplayViewModel(
|
||||
readyWorkflowSummaryResult,
|
||||
);
|
||||
assert.equal(readyWorkflowDisplayViewModel.phase, "ready");
|
||||
assert.equal(readyWorkflowDisplayViewModel.statusText, "Ready");
|
||||
assert.equal(readyWorkflowDisplayViewModel.detailText, "No blocking reasons");
|
||||
assert.deepEqual(
|
||||
mountIniPanelShellSessionHandoff({ documentRef: mountDocument }).renderResult,
|
||||
null,
|
||||
|
||||
Reference in New Issue
Block a user