From aecdca2d05ffef1c3b5812d9e46e2257939f5794 Mon Sep 17 00:00:00 2001 From: codex Date: Sun, 1 Nov 2026 16:33:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=94=A8=E6=88=B7=20VPC=20?= =?UTF-8?q?=E5=AE=9E=E4=BE=8B=E9=A1=B5=E7=AD=BE=E4=B8=8E=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/public/cloud/styles.css | 16 ++++++++++------ web/resources/views/venix/cloud/pages/vpcs.tpl | 2 +- web/resources/views/venix/layout_assets.tpl | 2 +- web/tests/CloudUserFirstPaintViewTest.php | 5 ++++- web/tests/CloudVpcUserContractTest.php | 10 ++++++++++ 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/web/public/cloud/styles.css b/web/public/cloud/styles.css index 22d597fd..d4aa1ce4 100644 --- a/web/public/cloud/styles.css +++ b/web/public/cloud/styles.css @@ -430,9 +430,11 @@ body.vu-body .ssh-key-picker-manage:hover { .cloud-vpc-facts dt { color:#8798a6; font-size:10px; font-weight:700; } .cloud-vpc-facts dd { margin:0; color:#334e62; font-size:13px; font-weight:800; overflow-wrap:anywhere; } .cloud-vpc-facts>div:nth-child(2) dd,.cloud-vpc-facts>div:nth-child(3) dd,.cloud-vpc-table-address code,.cloud-vpc-confirm-instances code { font:500 14px/1.6 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace; color:#486579; background:none; padding:0; } -.cloud-vpc-tabs { display:flex; gap:28px; padding:0 24px; border-bottom:1px solid #e5ecf0; } -.cloud-vpc-tabs a { display:inline-flex; align-items:center; gap:7px; min-height:58px; padding:17px 0 15px; border-bottom:2px solid transparent; color:#7b909f; text-decoration:none; font-size:14px; font-weight:600; } -.cloud-vpc-tabs a[aria-current="page"] { border-bottom-color:#0c9eaa; color:#078f9b; } +.cloud-vpc-tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:4px; margin:0 22px 18px; padding:5px; border:1px solid #dfeaec; border-radius:11px; background:#f3f8f9; } +.cloud-vpc-tabs a { display:inline-flex; align-items:center; justify-content:center; gap:7px; min-height:39px; padding:9px 14px; border-radius:8px; color:#718497; text-decoration:none; font-size:12px; font-weight:800; } +.cloud-vpc-tabs a:hover { color:#237f88; background:#e8f4f4; } +.cloud-vpc-tabs a:focus-visible { outline:2px solid #25adb4; outline-offset:2px; } +.cloud-vpc-tabs a[aria-current="page"] { background:#fff; color:#157f88; box-shadow:0 2px 9px rgba(27,71,87,.1); } .cloud-vpc-tab-count { display:inline-grid; min-width:22px; height:22px; padding:0 6px; place-items:center; border-radius:999px; background:#edf3f5; color:#718694; font-size:11px; line-height:1; } .cloud-vpc-tabs a[aria-current="page"] .cloud-vpc-tab-count { background:#e1f5f4; color:#078f9b; } .cloud-vpc-list-hint { margin:0; padding:17px 24px; font-size:12px; color:#8194a2; line-height:1.6; } @@ -461,7 +463,7 @@ body.vu-body .ssh-key-picker-manage:hover { .cloud-vpc-batch-toolbar { display:flex; align-items:center; justify-content:flex-end; gap:18px; padding:20px 24px; border-top:1px solid #e6edf1; background:#fdfefe; } .cloud-vpc-batch-toolbar>span { flex:none; margin-right:auto; font-size:13px; color:#607889; font-weight:600; } .cloud-vpc-batch-toolbar>.button { min-width:168px; } -.cloud-vpc-batch-status { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:20px; padding:18px 22px; border:1px solid #cde8e9; border-radius:10px; background:#f0fafa; } +.cloud-vpc-batch-status { display:flex; align-items:center; justify-content:space-between; gap:16px; margin:0 22px 16px; padding:16px 18px; border:1px solid #cde8e9; border-radius:10px; background:#f0fafa; } .cloud-vpc-batch-status strong { display:block; color:#2d6570; font-size:14px; line-height:1.6; } .cloud-vpc-batch-status small { display:block; margin-top:6px; color:#6b8c97; font-size:12px; line-height:1.7; } .cloud-vpc-batch-status.uncertain { background:#fffaf1; border-color:#efdfbc; } @@ -529,8 +531,8 @@ html.cloud-vpc-confirm-open { overflow:hidden; } .cloud-vpc-instance-status .cloud-vpc-text-button { min-height:40px; margin-top:0; } .cloud-vpc-create-fields { grid-template-columns:1fr; gap:22px; } .cloud-vpc-create-form .field input,.cloud-vpc-create-form .field select { font-size:16px; } - .cloud-vpc-tabs { gap:22px; padding-inline:16px; background:#fff; } - .cloud-vpc-tabs a { min-height:54px; padding-block:15px 13px; } + .cloud-vpc-tabs { margin:0 16px 16px; } + .cloud-vpc-tabs a { min-height:44px; padding:10px 8px; } .cloud-vpc-list-hint { padding:15px 16px; } .cloud-vpc-instance-search { width:auto; margin:0 12px 12px; } .cloud-vpc-instance-search-input { min-height:46px; font-size:16px; } @@ -557,6 +559,8 @@ html.cloud-vpc-confirm-open { overflow:hidden; } .cloud-vpc-create-form>.cloud-vpc-create-footer { align-items:stretch; flex-direction:column; padding:14px 16px 16px; } .cloud-vpc-create-form>.cloud-vpc-create-footer .button { width:100%; justify-content:center; } .cloud-vpc-members-overview { padding:16px; } + .cloud-vpc-batch-status { align-items:stretch; flex-direction:column; margin-inline:16px; } + .cloud-vpc-batch-actions { justify-content:flex-start; } } @media(max-width:400px) { .cloud-vpc-table tr { padding-inline:14px; } diff --git a/web/resources/views/venix/cloud/pages/vpcs.tpl b/web/resources/views/venix/cloud/pages/vpcs.tpl index 7d9c6e43..6fcde94e 100644 --- a/web/resources/views/venix/cloud/pages/vpcs.tpl +++ b/web/resources/views/venix/cloud/pages/vpcs.tpl @@ -44,9 +44,9 @@
PRIVATE NETWORK

{$cloud_vpc_view.current.name|default:''|escape:'html'}

{$cloud_vpc_view.current.state_label|default:''|escape:'html'}

管理实例成员、私网地址和连接状态。

-
{if !empty($cloud_vpc_view.current.batch)}
正在应用私网变更共 {$cloud_vpc_view.current.batch.total|default:0|escape:'html'} 台 · {$cloud_vpc_view.current.batch.succeeded|default:0|escape:'html'} 台成功。离开页面不会中断任务。
{/if}
{if !empty($cloud_vpc_view.current)}
地区
{$cloud_vpc_view.current.region_name|escape:'html'}
私网网段
{$cloud_vpc_view.current.cidr|escape:'html'}
默认网关
{$cloud_vpc_view.current.gateway|escape:'html'}
已加入实例
{$cloud_vpc_view.member_count|default:0|escape:'html'} 台
{/if}
+
{if !empty($cloud_vpc_view.current.batch)}
正在应用私网变更共 {$cloud_vpc_view.current.batch.total|default:0|escape:'html'} 台 · {$cloud_vpc_view.current.batch.succeeded|default:0|escape:'html'} 台成功。离开页面不会中断任务。
{/if}
{if !empty($cloud_vpc_view.current)} diff --git a/web/resources/views/venix/layout_assets.tpl b/web/resources/views/venix/layout_assets.tpl index 18bb8e6f..4ca045b6 100644 --- a/web/resources/views/venix/layout_assets.tpl +++ b/web/resources/views/venix/layout_assets.tpl @@ -1,2 +1,2 @@ {* Shared Venix CSS/JS cache key. Increment whenever a shared browser asset changes. *} -{assign var=venix_asset_version value='2026110113' scope='global'} +{assign var=venix_asset_version value='2026110114' scope='global'} diff --git a/web/tests/CloudUserFirstPaintViewTest.php b/web/tests/CloudUserFirstPaintViewTest.php index fa2f7f01..3c7cf962 100644 --- a/web/tests/CloudUserFirstPaintViewTest.php +++ b/web/tests/CloudUserFirstPaintViewTest.php @@ -97,13 +97,16 @@ foreach ([['query' => [], 'page' => 'home'], ['query' => ['view' => 'create'], ' $text = $one($xpath, 'cloud-vpc-instance-manager')->textContent; $summary = $one($xpath, 'cloud-vpc-network-summary')->textContent; $joining = ($case['query']['view'] ?? '') === 'join'; + $activeTab = $one($xpath, $joining ? 'cloud-vpc-join-link' : 'cloud-vpc-members-link'); $assert(str_contains($text, $joining ? 'vm-candidate' : 'vm-member') && !str_contains($text, 'other-region') && str_contains($text, $joining ? '192.0.2.8' : '10.0.1.2') && str_contains($summary, '香港') && str_contains($summary, '10.0.1.0/24') && str_contains($summary, '10.0.1.1') - && str_contains($summary, '1 台'), + && str_contains($summary, '1 台') + && $activeTab->getAttribute('aria-current') === 'page' + && $xpath->query('//*[contains(concat(" ", normalize-space(@class), " "), " cloud-vpc-members-panel ")]//*[@id="cloud-vpc-batch-status"]')->length === 1, 'VPC members, network facts or addresses do not match the requested view.'); } } diff --git a/web/tests/CloudVpcUserContractTest.php b/web/tests/CloudVpcUserContractTest.php index 0e8c4bd4..e9e4ff35 100644 --- a/web/tests/CloudVpcUserContractTest.php +++ b/web/tests/CloudVpcUserContractTest.php @@ -103,6 +103,16 @@ $assert(str_contains($template, 'id="cloud-vpcs-home"') && str_contains($styles, '.cloud-vpc-member-table') && str_contains($styles, '.cloud-vpc-batch-status'), 'The VPC page must expose list, creation and member-management views.'); +$membersPanelOffset = strpos($template, 'class="inventory-panel cloud-vpc-members-panel"'); +$batchStatusOffset = strpos($template, 'id="cloud-vpc-batch-status"'); +$membersTabsOffset = strpos($template, 'class="cloud-vpc-tabs"'); +$assert($membersPanelOffset !== false + && $batchStatusOffset !== false + && $membersTabsOffset !== false + && $membersPanelOffset < $batchStatusOffset + && $batchStatusOffset < $membersTabsOffset + && str_contains($styles, '.cloud-vpc-tabs { display:grid;'), + 'The VPC member task state and segmented tabs must live inside the member panel.'); $assert(str_contains($javascript, 'function renderHome(') && str_contains($javascript, 'function renderNetworkCard(') && str_contains($javascript, 'function renderInstanceManager(')