优化
This commit is contained in:
@@ -16,6 +16,20 @@ const CONFIGURED_MODULES = ['merchant-qualification-fixture', 'customers', 'over
|
||||
|
||||
export function normalizeModuleOrder(modules) {
|
||||
const normalized = [...modules]
|
||||
if (normalized.includes('fee-items')) {
|
||||
const prerequisites = ['merchant-qualification-fixture', 'orders']
|
||||
const feeItemsIndex = normalized.indexOf('fee-items')
|
||||
const ordered = prerequisites.every((name, index) => {
|
||||
const prerequisiteIndex = normalized.indexOf(name)
|
||||
const previousIndex = index === 0 ? -1 : normalized.indexOf(prerequisites[index - 1])
|
||||
return prerequisiteIndex > previousIndex && prerequisiteIndex < feeItemsIndex
|
||||
})
|
||||
if (!ordered) {
|
||||
const requested = normalized.filter((name) => !prerequisites.includes(name))
|
||||
requested.splice(requested.indexOf('fee-items'), 0, ...prerequisites)
|
||||
normalized.splice(0, normalized.length, ...requested)
|
||||
}
|
||||
}
|
||||
const loadingIndex = normalized.indexOf('phase3-loading')
|
||||
const overviewIndex = normalized.indexOf('phase3-container-overview')
|
||||
if (loadingIndex < 0 || overviewIndex < 0 || overviewIndex > loadingIndex) return normalized
|
||||
|
||||
Reference in New Issue
Block a user