You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
2.4 KiB
PHP
55 lines
2.4 KiB
PHP
<?php
|
|
|
|
$root = dirname(__DIR__);
|
|
$read = static function (string $path) use ($root): string {
|
|
$contents = file_get_contents($root . '/' . $path);
|
|
if (!is_string($contents)) {
|
|
throw new RuntimeException('Unable to read ' . $path);
|
|
}
|
|
return $contents;
|
|
};
|
|
$assert = static function (bool $condition, string $message): void {
|
|
if (!$condition) {
|
|
throw new RuntimeException($message);
|
|
}
|
|
};
|
|
|
|
$template = $read('resources/views/venix/admin/hosts/index.tpl');
|
|
$script = $read('public/cloud/admin.js');
|
|
$styles = $read('public/cloud/admin.css');
|
|
$assets = $read('resources/views/venix/layout_assets.tpl');
|
|
|
|
$assert(str_contains($template, 'id="host-summary"')
|
|
&& str_contains($template, 'id="host-search"')
|
|
&& str_contains($template, 'id="host-region-filter"')
|
|
&& str_contains($template, 'id="host-state-filter"')
|
|
&& substr_count($template, 'id="host-new"') === 1
|
|
&& str_contains($template, '>计算节点</h4>')
|
|
&& str_contains($template, '>Agent API</a>'),
|
|
'Compute-node page is missing its summary, filters or primary actions.');
|
|
|
|
$assert(str_contains($script, 'state.hostRegions = collection(payload, \'regions\')')
|
|
&& str_contains($script, 'state.hostSummary = payload?.summary')
|
|
&& str_contains($script, 'function hostRegionKey(')
|
|
&& str_contains($script, "element('details', 'cloud-admin-host-region')")
|
|
&& str_contains($script, 'function hostMatchesFilter(')
|
|
&& str_contains($script, "host?.readiness?.placement_ready")
|
|
&& str_contains($script, "host?.needs_attention")
|
|
&& str_contains($script, "host.enabled ? '服务启用' : '服务停用'")
|
|
&& str_contains($script, 'agentLabel(host?.agent?.state)')
|
|
&& str_contains($script, 'schedulerLabel(host.scheduler_state)'),
|
|
'Region rendering must keep Agent, service and scheduling state separate.');
|
|
|
|
$assert(str_contains($styles, '.cloud-admin-host-summary')
|
|
&& str_contains($styles, '.cloud-admin-host-region')
|
|
&& str_contains($styles, '.cloud-admin-host-node')
|
|
&& str_contains($styles, '.cloud-admin-host-badge.is-success')
|
|
&& str_contains($styles, '@media (max-width: 767.98px)'),
|
|
'Compute-node region layout is missing desktop or responsive styles.');
|
|
|
|
$assert(preg_match("/venix_asset_version value='([0-9]+)'/", $assets,
|
|
$match) === 1 && (int) $match[1] >= 2026103101,
|
|
'Compute-node region UI changes require a new shared asset version.');
|
|
|
|
echo "Administrator compute-node region UI contracts passed.\n";
|