推进 INI 面板 shell handoff mount-state display
This commit is contained in:
@@ -161,6 +161,18 @@
|
||||
})
|
||||
: shellViewModel.shellSessionHandoffPackageMountState
|
||||
),
|
||||
getShellSessionHandoffPackageMountDisplayViewModel: (mountState) => (
|
||||
shellViewModel.createShellSessionHandoffPackageMountDisplayViewModel(
|
||||
mountState ?? shellViewModel.shellSessionHandoffPackageMountState,
|
||||
)
|
||||
),
|
||||
getShellSessionHandoffPackageMountRenderState: (mountState) => (
|
||||
shellViewModel.createShellSessionHandoffPackageMountRenderState(
|
||||
shellViewModel.createShellSessionHandoffPackageMountDisplayViewModel(
|
||||
mountState ?? shellViewModel.shellSessionHandoffPackageMountState,
|
||||
),
|
||||
)
|
||||
),
|
||||
isSupportedShellSessionHandoffPackage: shellViewModel.isSupportedShellSessionHandoffPackage,
|
||||
getLauncherLinks: () => shellViewModel.launcherLinks,
|
||||
getControlPageApiMethods: () => shellViewModel.controlPage.browserApiMethods,
|
||||
|
||||
@@ -141,6 +141,8 @@ export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntr
|
||||
"getShellSessionHandoffPackageDisplayViewModel",
|
||||
"getShellSessionHandoffPackageRenderState",
|
||||
"getShellSessionHandoffPackageMountState",
|
||||
"getShellSessionHandoffPackageMountDisplayViewModel",
|
||||
"getShellSessionHandoffPackageMountRenderState",
|
||||
"isSupportedShellSessionHandoffPackage",
|
||||
"getLauncherLinks",
|
||||
"getControlPageApiMethods",
|
||||
@@ -1018,6 +1020,64 @@ export function createIniPanelShellSessionHandoffPackageMountState({
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellSessionHandoffPackageMountDisplayViewModel(
|
||||
mountState = createIniPanelShellSessionHandoffPackageMountState(),
|
||||
) {
|
||||
const checks = Array.isArray(mountState?.checks) ? mountState.checks : [];
|
||||
const blockingChecks = checks.filter(({ status }) => status !== "pass");
|
||||
const blockingReasons = Array.isArray(mountState?.blockingReasons) ? mountState.blockingReasons : [];
|
||||
const problems = [
|
||||
...blockingReasons,
|
||||
...blockingChecks.map(({ id }) => id),
|
||||
];
|
||||
|
||||
return {
|
||||
phase: mountState?.phase === "ready" ? "ready" : "blocked",
|
||||
title: "Shell handoff mount",
|
||||
statusText: mountState?.ready ? "Ready" : "Blocked",
|
||||
detailText: problems.length === 0 ? "No blocking reasons" : problems.join(", "),
|
||||
rows: checks.map(({ id, label, status, value }) => ({
|
||||
id,
|
||||
label,
|
||||
value,
|
||||
status,
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellSessionHandoffPackageMountRenderState(
|
||||
displayViewModel = createIniPanelShellSessionHandoffPackageMountDisplayViewModel(),
|
||||
) {
|
||||
const rows = Array.isArray(displayViewModel?.rows)
|
||||
? displayViewModel.rows.map(({ id, label, value, status }) => ({
|
||||
id,
|
||||
label,
|
||||
value: value == null ? "" : String(value),
|
||||
status: status ?? "blocked",
|
||||
}))
|
||||
: [];
|
||||
const ready = displayViewModel?.phase === "ready" && displayViewModel?.statusText === "Ready";
|
||||
const statusText = displayViewModel?.statusText ?? (ready ? "Ready" : "Blocked");
|
||||
const detailText = displayViewModel?.detailText ?? "No blocking reasons";
|
||||
|
||||
return {
|
||||
apiName: "ini-panel-shell-session-handoff-package-mount-render-state",
|
||||
renderStateVersion: 1,
|
||||
phase: ready ? "ready" : "blocked",
|
||||
ready,
|
||||
title: displayViewModel?.title ?? "Shell handoff mount",
|
||||
statusText,
|
||||
detailText,
|
||||
statusLine: `${statusText}: ${detailText}`,
|
||||
rows,
|
||||
dataset: {
|
||||
handoffPhase: ready ? "ready" : "blocked",
|
||||
handoffReady: ready ? "true" : "false",
|
||||
handoffScope: "mount",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries()) {
|
||||
const shellIntegrationManifest = createIniPanelShellIntegrationManifest(entries);
|
||||
const shellIntegrationReadiness = createIniPanelShellIntegrationReadiness(shellIntegrationManifest);
|
||||
@@ -1075,6 +1135,12 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
handoffPackage: shellSessionHandoffPackage,
|
||||
packageRenderState: shellSessionHandoffPackageRenderState,
|
||||
});
|
||||
const shellSessionHandoffPackageMountDisplayViewModel = createIniPanelShellSessionHandoffPackageMountDisplayViewModel(
|
||||
shellSessionHandoffPackageMountState,
|
||||
);
|
||||
const shellSessionHandoffPackageMountRenderState = createIniPanelShellSessionHandoffPackageMountRenderState(
|
||||
shellSessionHandoffPackageMountDisplayViewModel,
|
||||
);
|
||||
return {
|
||||
pages: entries.map(({ id, href, title }) => ({
|
||||
id,
|
||||
@@ -1100,6 +1166,8 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
shellSessionHandoffPackageDisplayViewModel,
|
||||
shellSessionHandoffPackageRenderState,
|
||||
shellSessionHandoffPackageMountState,
|
||||
shellSessionHandoffPackageMountDisplayViewModel,
|
||||
shellSessionHandoffPackageMountRenderState,
|
||||
launchApiSchema: createIniPanelLaunchApiSchema(),
|
||||
launchApiManifest: createIniPanelLaunchApiManifest(entries),
|
||||
isSupportedShellIntegrationManifest: isSupportedIniPanelShellIntegrationManifest,
|
||||
@@ -1120,6 +1188,8 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
createShellSessionHandoffPackageDisplayViewModel: createIniPanelShellSessionHandoffPackageDisplayViewModel,
|
||||
createShellSessionHandoffPackageRenderState: createIniPanelShellSessionHandoffPackageRenderState,
|
||||
createShellSessionHandoffPackageMountState: createIniPanelShellSessionHandoffPackageMountState,
|
||||
createShellSessionHandoffPackageMountDisplayViewModel: createIniPanelShellSessionHandoffPackageMountDisplayViewModel,
|
||||
createShellSessionHandoffPackageMountRenderState: createIniPanelShellSessionHandoffPackageMountRenderState,
|
||||
isSupportedShellSessionHandoffPackage: isSupportedIniPanelShellSessionHandoffPackage,
|
||||
controlPage: {
|
||||
browserApiSchema: createControlPageBrowserApiSchema(),
|
||||
|
||||
Reference in New Issue
Block a user