推进 INI 面板 workflow overview embedding contract
This commit is contained in:
@@ -270,6 +270,15 @@
|
||||
documentRef: document,
|
||||
})
|
||||
),
|
||||
getWorkflowOverviewContract: (options) => (
|
||||
shellViewModel.createWorkflowOverviewContract(options)
|
||||
),
|
||||
getWorkflowOverviewReadiness: (options) => (
|
||||
shellViewModel.createWorkflowOverviewReadiness(options)
|
||||
),
|
||||
mountWorkflowOverviewEmbedding: (options) => (
|
||||
shellViewModel.mountWorkflowOverviewEmbedding(options)
|
||||
),
|
||||
isSupportedShellSessionHandoffPackage: shellViewModel.isSupportedShellSessionHandoffPackage,
|
||||
getLauncherLinks: () => shellViewModel.launcherLinks,
|
||||
getControlPageApiMethods: () => shellViewModel.controlPage.browserApiMethods,
|
||||
|
||||
@@ -156,6 +156,9 @@ export function createIniPanelLaunchApiManifest(entries = getVisibleIniPanelEntr
|
||||
"getShellSessionHandoffWorkflowDomReadiness",
|
||||
"renderShellSessionHandoffWorkflowState",
|
||||
"mountShellSessionHandoffWorkflow",
|
||||
"getWorkflowOverviewContract",
|
||||
"getWorkflowOverviewReadiness",
|
||||
"mountWorkflowOverviewEmbedding",
|
||||
"isSupportedShellSessionHandoffPackage",
|
||||
"getLauncherLinks",
|
||||
"getControlPageApiMethods",
|
||||
@@ -1559,6 +1562,41 @@ export function createIniPanelShellSessionHandoffWorkflowDomContract({
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellWorkflowOverviewContract() {
|
||||
return {
|
||||
pageHref: "./workflow-overview.html",
|
||||
entryId: "workflow-overview",
|
||||
apiName: "linuxCncIniPanelWorkflowOverviewApi",
|
||||
methodNames: [
|
||||
"getWorkflowOverviewRenderState",
|
||||
"getWorkflowOverviewDisplayViewModel",
|
||||
"getWorkflowOverviewSummary",
|
||||
"getWorkflowOverviewDomContract",
|
||||
"getWorkflowOverviewDomReadiness",
|
||||
"renderWorkflowOverview",
|
||||
"mountWorkflowOverview",
|
||||
"createWorkflowOverviewRenderState",
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellWorkflowOverviewReadiness({
|
||||
overviewApi = null,
|
||||
contract = createIniPanelShellWorkflowOverviewContract(),
|
||||
} = {}) {
|
||||
const methodNames = Array.isArray(contract?.methodNames) ? contract.methodNames : [];
|
||||
const missing = methodNames.filter((methodName) => typeof overviewApi?.[methodName] !== "function");
|
||||
const ready = missing.length === 0;
|
||||
return {
|
||||
apiName: "ini-panel-shell-workflow-overview-readiness",
|
||||
readinessVersion: 1,
|
||||
phase: ready ? "ready" : "blocked",
|
||||
ready,
|
||||
missing,
|
||||
contract,
|
||||
};
|
||||
}
|
||||
|
||||
export function createIniPanelShellSessionHandoffWorkflowDomReadiness({
|
||||
rowDatasetPrefix = "handoffWorkflow",
|
||||
contract = createIniPanelShellSessionHandoffWorkflowDomContract({ rowDatasetPrefix }),
|
||||
@@ -1714,6 +1752,61 @@ export function mountIniPanelShellSessionHandoffWorkflow({
|
||||
}
|
||||
}
|
||||
|
||||
export function mountIniPanelShellWorkflowOverviewEmbedding({
|
||||
overviewApi = null,
|
||||
contract = createIniPanelShellWorkflowOverviewContract(),
|
||||
mountOptions = {},
|
||||
} = {}) {
|
||||
const readiness = createIniPanelShellWorkflowOverviewReadiness({
|
||||
overviewApi,
|
||||
contract,
|
||||
});
|
||||
if (!readiness.ready) {
|
||||
return {
|
||||
apiName: "ini-panel-shell-workflow-overview-embedding",
|
||||
embeddingVersion: 1,
|
||||
phase: "blocked",
|
||||
ready: false,
|
||||
pageHref: contract.pageHref,
|
||||
contract,
|
||||
readiness,
|
||||
renderState: null,
|
||||
mountResult: null,
|
||||
error: null,
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
const renderState = overviewApi.getWorkflowOverviewRenderState();
|
||||
const mountResult = overviewApi.mountWorkflowOverview(mountOptions);
|
||||
return {
|
||||
apiName: "ini-panel-shell-workflow-overview-embedding",
|
||||
embeddingVersion: 1,
|
||||
phase: mountResult?.phase ?? "blocked",
|
||||
ready: mountResult?.ready === true,
|
||||
pageHref: contract.pageHref,
|
||||
contract,
|
||||
readiness,
|
||||
renderState,
|
||||
mountResult,
|
||||
error: null,
|
||||
};
|
||||
} catch (error) {
|
||||
return {
|
||||
apiName: "ini-panel-shell-workflow-overview-embedding",
|
||||
embeddingVersion: 1,
|
||||
phase: "blocked",
|
||||
ready: false,
|
||||
pageHref: contract.pageHref,
|
||||
contract,
|
||||
readiness,
|
||||
renderState: null,
|
||||
mountResult: null,
|
||||
error: error?.message ?? String(error),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries()) {
|
||||
const shellIntegrationManifest = createIniPanelShellIntegrationManifest(entries);
|
||||
const shellIntegrationReadiness = createIniPanelShellIntegrationReadiness(shellIntegrationManifest);
|
||||
@@ -1800,6 +1893,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
shellSessionHandoffWorkflowDisplayViewModel,
|
||||
);
|
||||
const shellSessionHandoffWorkflowDomContract = createIniPanelShellSessionHandoffWorkflowDomContract();
|
||||
const shellWorkflowOverviewContract = createIniPanelShellWorkflowOverviewContract();
|
||||
return {
|
||||
pages: entries.map(({ id, href, title }) => ({
|
||||
id,
|
||||
@@ -1832,6 +1926,7 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
shellSessionHandoffWorkflowDisplayViewModel,
|
||||
shellSessionHandoffWorkflowRenderState,
|
||||
shellSessionHandoffWorkflowDomContract,
|
||||
shellWorkflowOverviewContract,
|
||||
launchApiSchema: createIniPanelLaunchApiSchema(),
|
||||
launchApiManifest: createIniPanelLaunchApiManifest(entries),
|
||||
isSupportedShellIntegrationManifest: isSupportedIniPanelShellIntegrationManifest,
|
||||
@@ -1867,6 +1962,9 @@ export function createIniPanelShellViewModel(entries = getVisibleIniPanelEntries
|
||||
createShellSessionHandoffWorkflowDomReadiness: createIniPanelShellSessionHandoffWorkflowDomReadiness,
|
||||
renderShellSessionHandoffWorkflowState: renderIniPanelShellSessionHandoffWorkflowState,
|
||||
mountShellSessionHandoffWorkflow: mountIniPanelShellSessionHandoffWorkflow,
|
||||
createWorkflowOverviewContract: createIniPanelShellWorkflowOverviewContract,
|
||||
createWorkflowOverviewReadiness: createIniPanelShellWorkflowOverviewReadiness,
|
||||
mountWorkflowOverviewEmbedding: mountIniPanelShellWorkflowOverviewEmbedding,
|
||||
isSupportedShellSessionHandoffPackage: isSupportedIniPanelShellSessionHandoffPackage,
|
||||
controlPage: {
|
||||
browserApiSchema: createControlPageBrowserApiSchema(),
|
||||
|
||||
@@ -87,6 +87,9 @@
|
||||
createIniPanelShellSessionHandoffWorkflowDomContract,
|
||||
createIniPanelShellSessionHandoffWorkflowDomReadiness,
|
||||
createIniPanelShellSessionHandoffWorkflowRenderState,
|
||||
createIniPanelShellWorkflowOverviewContract,
|
||||
createIniPanelShellWorkflowOverviewReadiness,
|
||||
mountIniPanelShellWorkflowOverviewEmbedding,
|
||||
renderIniPanelShellSessionHandoffWorkflowState,
|
||||
mountIniPanelShellSessionHandoffWorkflow,
|
||||
} from "./ui-shell.js";
|
||||
@@ -118,6 +121,16 @@
|
||||
})
|
||||
),
|
||||
createWorkflowOverviewRenderState: createIniPanelShellSessionHandoffWorkflowRenderState,
|
||||
getWorkflowOverviewContract: () => createIniPanelShellWorkflowOverviewContract(),
|
||||
getWorkflowOverviewReadinessFromApi: () => createIniPanelShellWorkflowOverviewReadiness({
|
||||
overviewApi: window.linuxCncIniPanelWorkflowOverviewApi,
|
||||
}),
|
||||
mountWorkflowOverviewEmbedding: (options) => (
|
||||
mountIniPanelShellWorkflowOverviewEmbedding({
|
||||
overviewApi: window.linuxCncIniPanelWorkflowOverviewApi,
|
||||
...(options ?? {}),
|
||||
})
|
||||
),
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user