|
|
|
|
@ -135,6 +135,46 @@ $assert(str_contains($planRenderer, "'plan-table-head'")
|
|
|
|
|
&& !str_contains($cloudTemplate, 'id="create-cloud-tip"')
|
|
|
|
|
&& !str_contains($cloudTemplate, 'id="create-iso-tip"'),
|
|
|
|
|
'Deployment plans must use selectable specification rows without obsolete helper panels.');
|
|
|
|
|
$runtimeDeployScript = file_get_contents($public . '/runtime.js');
|
|
|
|
|
$resetStart = strpos($runtimeDeployScript, 'function resetInstallChoices()');
|
|
|
|
|
$resetEnd = $resetStart === false ? false
|
|
|
|
|
: strpos($runtimeDeployScript, 'function renderRegionPicker()', $resetStart);
|
|
|
|
|
$resetInstall = $resetStart === false || $resetEnd === false ? ''
|
|
|
|
|
: substr($runtimeDeployScript, $resetStart, $resetEnd - $resetStart);
|
|
|
|
|
$resourcesStart = strpos($runtimeDeployScript, 'async function loadPlanResources()');
|
|
|
|
|
$resourcesEnd = $resourcesStart === false ? false
|
|
|
|
|
: strpos($runtimeDeployScript, 'function provisionInvoiceStorageKey()', $resourcesStart);
|
|
|
|
|
$resourceLoader = $resourcesStart === false || $resourcesEnd === false ? ''
|
|
|
|
|
: substr($runtimeDeployScript, $resourcesStart, $resourcesEnd - $resourcesStart);
|
|
|
|
|
$statusStart = strpos($runtimeDeployScript, 'function renderTemplateCatalogStatus(');
|
|
|
|
|
$statusEnd = $statusStart === false ? false
|
|
|
|
|
: strpos($runtimeDeployScript, 'function renderTemplateCatalog(', $statusStart);
|
|
|
|
|
$templateStatus = $statusStart === false || $statusEnd === false ? ''
|
|
|
|
|
: substr($runtimeDeployScript, $statusStart, $statusEnd - $statusStart);
|
|
|
|
|
$loadingPosition = strpos($resourceLoader,
|
|
|
|
|
"renderTemplateCatalogStatus('vm-template', '正在加载系统镜像…', true)");
|
|
|
|
|
$requestPosition = strpos($resourceLoader,
|
|
|
|
|
'const resources = await api(`/api/v1/resources?plan_id=');
|
|
|
|
|
$templatesPosition = strpos($resourceLoader,
|
|
|
|
|
'state.templates = items(resources.templates || resources.cloud_templates)');
|
|
|
|
|
$catalogPosition = strpos($resourceLoader, "renderTemplateCatalog('vm-template')");
|
|
|
|
|
$assert($resetInstall !== ''
|
|
|
|
|
&& !str_contains($resetInstall, "renderTemplateCatalog('vm-template')")
|
|
|
|
|
&& str_contains($resetInstall, 'templateInput.disabled = true')
|
|
|
|
|
&& str_contains($resetInstall, 'templateCatalog.replaceChildren()')
|
|
|
|
|
&& $loadingPosition !== false && $requestPosition !== false
|
|
|
|
|
&& $templatesPosition !== false && $catalogPosition !== false
|
|
|
|
|
&& $loadingPosition < $requestPosition
|
|
|
|
|
&& $requestPosition < $templatesPosition
|
|
|
|
|
&& $templatesPosition < $catalogPosition
|
|
|
|
|
&& str_contains($templateStatus, 'container.setAttribute("aria-busy", String(busy))')
|
|
|
|
|
&& str_contains($templateStatus, '"template-catalog-status"')
|
|
|
|
|
&& !str_contains($templateStatus, 'template-catalog-empty')
|
|
|
|
|
&& str_contains($resourceLoader, '系统镜像加载失败,请重新选择实例规格。')
|
|
|
|
|
&& str_contains($resourceLoader,
|
|
|
|
|
"epoch === state.formEpoch && error.name !== 'AbortError'")
|
|
|
|
|
&& str_contains($runtimeDeployScript, '暂无可用云镜像,请联系管理员导入模板。'),
|
|
|
|
|
'Plan changes must distinguish the cloud-image loading, failure and true-empty states.');
|
|
|
|
|
$assert(str_contains($baseStyles, '.deployment-step')
|
|
|
|
|
&& str_contains($baseStyles, '.region-option')
|
|
|
|
|
&& str_contains($baseStyles, '.plan-option')
|
|
|
|
|
|