优化
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
const MODULE = 'manual-state-matrix'
|
||||
const OPTIONS = { scenario: 'manual-clickable-list-state-matrix', deploymentBlocker: true }
|
||||
|
||||
const GROUPS = [
|
||||
'order-inbound-status-fixtures',
|
||||
'manual-state-loading-pda',
|
||||
'manual-state-ocean-trucking',
|
||||
]
|
||||
|
||||
function rows(value) { return Array.isArray(value) ? value : [] }
|
||||
|
||||
export async function run(context) {
|
||||
const matrix = { marker: context.marker, generatedAt: new Date().toISOString(), pages: {} }
|
||||
context.createdResources.manualStateMatrix = matrix
|
||||
|
||||
for (const name of GROUPS) {
|
||||
const extension = await import(new URL(`./${name}.mjs`, import.meta.url))
|
||||
if (typeof extension.run !== 'function') throw new Error(`${name} 必须导出 async function run(context)`)
|
||||
await extension.run(context, matrix)
|
||||
}
|
||||
|
||||
const pages = Object.entries(matrix.pages)
|
||||
const missing = pages.flatMap(([page, value]) => rows(value?.requiredStatuses)
|
||||
.filter((status) => !value?.fixtures?.[status]?.id)
|
||||
.map((status) => `${page}:${status}`))
|
||||
context.assert(MODULE, '人工验收列表状态数据全部生成并保留', null,
|
||||
pages.length > 0 && missing.length === 0,
|
||||
`pages=${pages.length}, missing=${missing.join(',') || 'none'}`, OPTIONS)
|
||||
}
|
||||
Reference in New Issue
Block a user