推进 INI 面板 shell handoff workflow display-model helper
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user