diff --git a/web/public/cloud/runtime.js b/web/public/cloud/runtime.js index bd260556..c24f53a0 100644 --- a/web/public/cloud/runtime.js +++ b/web/public/cloud/runtime.js @@ -1979,6 +1979,36 @@ function renderTemplateCatalogStatus(inputId, message, busy = false) { container.replaceChildren(status); } +function closeTemplateVersionMenus(except = null) { + document.querySelectorAll(".template-family-card[open]").forEach((card) => { + if (card !== except) card.open = false; + }); +} + +function bindTemplateVersionMenu(card, container) { + card.addEventListener("toggle", () => { + if (!card.open) return; + container.querySelectorAll(".template-family-card[open]").forEach((other) => { + if (other !== card) other.open = false; + }); + }); +} + +function updateTemplateFamilySelection(card, selectedName = "") { + const family = String(card.dataset.family || "系统镜像"); + const summary = card.querySelector("summary"); + const label = card.querySelector(".template-family-selection"); + const selected = Boolean(selectedName); + card.classList.toggle("has-selection", selected); + if (label) { + label.textContent = selected ? `✓ ${selectedName}` : ""; + label.title = selected ? selectedName : ""; + } + summary?.setAttribute("aria-label", selected + ? `${family},已选择 ${selectedName},展开更改版本` + : `${family},展开选择版本`); +} + function renderTemplateCatalog(inputId) { const input = byId(inputId); const container = byId(inputId === "vm-template" ? "vm-template-catalog" : "reinstall-template-catalog"); @@ -2008,10 +2038,16 @@ function renderTemplateCatalog(inputId) { || String(a.item.name || "").localeCompare(String(b.item.name || ""), "zh-CN")); const card = makeElement("details", "template-family-card"); card.dataset.family = family; - card.open = opened.has(family) || entries.some(({ item }) => String(item.id) === input.value); + card.setAttribute("name", `${inputId}-family`); + card.open = opened.has(family); + bindTemplateVersionMenu(card, container); const summary = makeElement("summary", "template-family-summary"); const icon = templateIcon(family, "template-family-icon"); - summary.append(icon, makeElement("strong", "", family), makeElement("span", "template-family-arrow", "⌄")); + const selection = makeElement("span", "template-family-selection"); + selection.setAttribute("aria-hidden", "true"); + const arrow = makeElement("span", "template-family-arrow", "⌄"); + arrow.setAttribute("aria-hidden", "true"); + summary.append(icon, makeElement("strong", "", family), selection, arrow); const versions = makeElement("div", "template-versions"); versions.setAttribute("role", "group"); versions.setAttribute("aria-label", `${family} 可用版本`); @@ -2029,16 +2065,43 @@ function renderTemplateCatalog(inputId) { container.querySelectorAll(".template-version-option").forEach((button) => { button.setAttribute("aria-pressed", String(button.dataset.templateId === id)); }); + container.querySelectorAll(".template-family-card").forEach((familyCard) => { + updateTemplateFamilySelection(familyCard, familyCard === card ? name : ""); + }); + card.open = false; + summary.focus({ preventScroll: true }); if (inputId === "vm-template") { showError("create-error", ""); updateCreateAvailability(); } else showError("reinstall-error", ""); }); versions.append(option); } card.append(summary, versions); + const selectedEntry = entries.find(({ item }) => String(item.id) === input.value); + updateTemplateFamilySelection(card, selectedEntry + ? String(selectedEntry.item.name || selectedEntry.item.id) : ""); cards.push(card); } container.replaceChildren(...cards); } + +document.addEventListener("click", (event) => { + if (!(event.target instanceof Element) || !event.target.closest(".template-family-card")) { + closeTemplateVersionMenus(); + } +}); +document.addEventListener("focusin", (event) => { + const openCard = document.querySelector(".template-family-card[open]"); + if (!openCard || (event.target instanceof Element && openCard.contains(event.target))) return; + closeTemplateVersionMenus(); +}); +document.addEventListener("keydown", (event) => { + if (event.key !== "Escape") return; + const openCard = document.querySelector(".template-family-card[open]"); + if (!openCard) return; + closeTemplateVersionMenus(); + openCard.querySelector("summary")?.focus({ preventScroll: true }); +}); + async function initializeSession(view, bootstrapUser = null) { state.view = view; if (bootstrapUser && typeof bootstrapUser === 'object') { diff --git a/web/public/cloud/styles.css b/web/public/cloud/styles.css index e2a940c3..b6e68fa7 100644 --- a/web/public/cloud/styles.css +++ b/web/public/cloud/styles.css @@ -142,8 +142,9 @@ tbody tr:hover{background:#fcfefe} .workspace-form-page{width:min(100%,900px);margin:0 auto 48px}#create-view.workspace-form-page,#reinstall-view.workspace-form-page{width:100%;margin-left:0;margin-right:0}.workspace-form-back{padding-left:0;margin-bottom:15px;min-height:34px}.workspace-form-heading{margin-bottom:22px}.workspace-form-heading h1{margin-top:8px}.workspace-form-card{overflow:hidden}.workspace-form-body{padding:28px clamp(22px,3vw,36px) 32px}.workspace-form-actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:10px;padding:18px clamp(22px,3vw,36px);border-top:1px solid #edf1f5;background:#fbfdfe}.workspace-form-actions .button{min-width:120px}.workspace-form-body>.form-error{margin:18px 0 0} .form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 17px}.field.full{grid-column:1/-1}.field label{display:block}.field label span{color:#dc5965}.field small{display:block;color:#a1adbb;font-size:10px;margin-top:7px;line-height:1.5}.field select{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2393a1ae' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;padding-right:35px} .create-source-picker{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;border:0;padding:0;margin:0 0 23px;min-width:0}.create-source-picker legend{color:#34445a;font-size:13px;font-weight:700;padding:0;margin-bottom:10px}.create-source-picker label{position:relative;display:block;cursor:pointer}.create-source-picker input{position:absolute;opacity:0;width:1px;height:1px}.create-source-picker label span{display:flex;align-items:center;border:1px solid #dce4eb;border-radius:9px;padding:12px 14px;min-height:50px;background:#fff}.create-source-picker input:checked+span{border-color:#3bb5bc;background:#effafa;box-shadow:0 0 0 2px rgba(20,166,175,.08)}.create-source-picker input:focus-visible+span{outline:3px solid rgba(18,166,176,.22);outline-offset:2px}.create-source-picker strong{display:block;color:#334a5f;font-size:12px} -.template-field-label{display:block;color:#34445a;font-size:13px;font-weight:700;margin-bottom:10px}.template-field-label span{color:#dc5965}.template-catalog{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:14px}.template-catalog-empty,.template-catalog-status{grid-column:1/-1;margin:0;padding:17px;border:1px dashed #cbdbe3;border-radius:10px;background:#f8fbfc;color:#698094;font-size:12px}.template-catalog-status{border-style:solid;background:#f1f9fa;color:#2f7f87}.template-family-card{min-width:0;border:1px solid #dce7ec;border-radius:12px;background:#fff;overflow:hidden}.template-family-card[open]{border-color:#46b6ba;box-shadow:0 0 0 2px rgba(20,166,175,.07)}.template-family-summary{display:flex;align-items:center;flex-direction:column;gap:9px;min-height:153px;padding:20px 13px 13px;cursor:pointer;text-align:center;list-style:none}.template-family-summary::-webkit-details-marker{display:none}.template-family-summary:focus-visible{outline:3px solid rgba(18,166,176,.22);outline-offset:-3px}.template-family-summary strong{color:#30465a;font-size:13px}.template-family-icon{display:flex;align-items:center;justify-content:center;width:65px;height:65px;border-radius:17px;background:linear-gradient(145deg,#2a6385,#173d58);color:#fff;font-size:31px;font-weight:800;box-shadow:0 6px 16px rgba(24,68,90,.15)}.template-family-arrow{color:#258f9b;font-size:20px;line-height:1;transition:transform .2s}.template-family-card[open] .template-family-arrow{transform:rotate(180deg)}.template-versions{display:grid;gap:7px;padding:12px;border-top:1px solid #e7edf2;background:#fbfdfd}.template-version-option{width:100%;display:grid;gap:3px;padding:11px 12px;border:1px solid #dee8ed;border-radius:8px;background:#fff;text-align:left;color:#344e60}.template-version-option strong{font-size:12px}.template-version-option[aria-pressed="true"]{border-color:#35afb7;background:#eaf8f8;box-shadow:0 0 0 2px rgba(20,166,175,.09)}.template-version-option:hover{border-color:#48b6bd}.template-admin-grid{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);align-items:start;gap:19px}.template-admin-grid .host-card{min-width:0}.template-admin-grid .form-stack .button{align-self:flex-start}.template-field-help{display:block;margin:-16px 0 19px;color:#8b9bab;font-size:11px;line-height:1.55}.template-import-status{margin:0 0 14px;padding:10px 12px;border-radius:8px;background:#edf8f8;color:#317c85;font-size:11px;line-height:1.6}.template-admin-list{display:grid;gap:10px}.template-admin-list>.muted{margin:0}.template-admin-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:9px 11px;align-items:end;padding:14px;border:1px solid #e0e9ee;border-radius:10px;background:#fbfdfd}.template-admin-row-heading{grid-column:1/-1;display:flex;align-items:center;gap:9px;margin-bottom:3px;color:#34495c;font-size:12px}.template-admin-icon{display:flex;align-items:center;justify-content:center;width:27px;height:27px;border-radius:7px;background:#e3f6f3;color:#138d8f;font-weight:800}.template-admin-row label{grid-column:1/-1;margin:0;color:#75899b;font-size:11px;font-weight:700}.template-admin-row input{width:100%;min-width:0;height:37px;padding:0 10px;border:1px solid #dce4eb;border-radius:7px;background:#fff;color:#20364a;font-size:12px}.template-admin-row .button{min-height:37px}.template-admin-row .form-error{grid-column:1/-1;margin:0} +.template-field-label{display:block;color:#34445a;font-size:13px;font-weight:700;margin-bottom:10px}.template-field-label span{color:#dc5965}.template-catalog{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));align-items:start;gap:14px}.template-catalog-empty,.template-catalog-status{grid-column:1/-1;margin:0;padding:17px;border:1px dashed #cbdbe3;border-radius:10px;background:#f8fbfc;color:#698094;font-size:12px}.template-catalog-status{border-style:solid;background:#f1f9fa;color:#2f7f87}.template-family-card{position:relative;z-index:1;min-width:0;border:1px solid #dce7ec;border-radius:12px;background:#fff;overflow:visible}.template-family-card[open]{z-index:20;border-color:#46b6ba;box-shadow:0 0 0 2px rgba(20,166,175,.07)}.template-family-card.has-selection{border-color:#46b6ba}.template-family-summary{display:flex;align-items:center;flex-direction:column;gap:9px;min-height:153px;padding:20px 13px 13px;border-radius:inherit;cursor:pointer;text-align:center;list-style:none}.template-family-summary::-webkit-details-marker{display:none}.template-family-summary:focus-visible{outline:3px solid rgba(18,166,176,.22);outline-offset:-3px}.template-family-summary strong{color:#30465a;font-size:13px}.template-family-icon{display:flex;align-items:center;justify-content:center;width:65px;height:65px;border-radius:17px;background:linear-gradient(145deg,#2a6385,#173d58);color:#fff;font-size:31px;font-weight:800;box-shadow:0 6px 16px rgba(24,68,90,.15)}.template-family-arrow{color:#258f9b;font-size:20px;line-height:1;transition:transform .2s}.template-family-card[open] .template-family-arrow{transform:rotate(180deg)}.template-versions{position:absolute;top:calc(100% + 8px);left:0;right:0;z-index:30;display:grid;gap:7px;max-height:min(260px,50vh);padding:12px;overflow-y:auto;border:1px solid #dce7ec;border-radius:10px;background:#fbfdfd;box-shadow:0 16px 36px rgba(25,55,76,.18)}.template-version-option{width:100%;display:grid;gap:3px;padding:11px 12px;border:1px solid #dee8ed;border-radius:8px;background:#fff;text-align:left;color:#344e60}.template-version-option strong{font-size:12px}.template-version-option[aria-pressed="true"]{border-color:#35afb7;background:#eaf8f8;box-shadow:0 0 0 2px rgba(20,166,175,.09)}.template-version-option:hover{border-color:#48b6bd}.template-admin-grid{display:grid;grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr);align-items:start;gap:19px}.template-admin-grid .host-card{min-width:0}.template-admin-grid .form-stack .button{align-self:flex-start}.template-field-help{display:block;margin:-16px 0 19px;color:#8b9bab;font-size:11px;line-height:1.55}.template-import-status{margin:0 0 14px;padding:10px 12px;border-radius:8px;background:#edf8f8;color:#317c85;font-size:11px;line-height:1.6}.template-admin-list{display:grid;gap:10px}.template-admin-list>.muted{margin:0}.template-admin-row{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:9px 11px;align-items:end;padding:14px;border:1px solid #e0e9ee;border-radius:10px;background:#fbfdfd}.template-admin-row-heading{grid-column:1/-1;display:flex;align-items:center;gap:9px;margin-bottom:3px;color:#34495c;font-size:12px}.template-admin-icon{display:flex;align-items:center;justify-content:center;width:27px;height:27px;border-radius:7px;background:#e3f6f3;color:#138d8f;font-weight:800}.template-admin-row label{grid-column:1/-1;margin:0;color:#75899b;font-size:11px;font-weight:700}.template-admin-row input{width:100%;min-width:0;height:37px;padding:0 10px;border:1px solid #dce4eb;border-radius:7px;background:#fff;color:#20364a;font-size:12px}.template-admin-row .button{min-height:37px}.template-admin-row .form-error{grid-column:1/-1;margin:0} .template-family-icon.system,.template-admin-icon.system{background:transparent;border:0;box-shadow:none;color:inherit;text-shadow:none}.template-system-logo{display:block;width:100%;height:100%;object-fit:contain}.template-version-option{display:flex;align-items:center;justify-content:center;text-align:center}.template-version-option strong{overflow-wrap:anywhere} +.template-family-summary{gap:6px;min-height:170px}.template-family-selection{display:block;max-width:100%;min-height:14px;overflow:hidden;color:#168e98;font-size:10px;font-weight:800;line-height:1.4;text-overflow:ellipsis;white-space:nowrap}.template-family-selection:empty{visibility:hidden} .cloud-fields{grid-column:1/-1;border-top:1px solid #e7edf2;padding-top:18px}.cloud-fields-heading{margin-bottom:17px}.cloud-fields-heading strong{display:block;color:#34445a;font-size:13px}.cloud-fields-heading small{display:block;color:#8798a7;font-size:10px;line-height:1.6;margin-top:6px} .input-suffix{position:relative}.input-suffix input{padding-right:48px}.input-suffix span{position:absolute;right:13px;top:13px;color:#97a4b2;font-size:12px} .form-tip{display:flex;gap:10px;background:#f1f9fa;border:1px solid #e1f2f3;border-radius:9px;padding:12px 14px;color:#318b96;margin-top:22px}.form-tip>span{font-size:16px;line-height:1}.form-tip p{font-size:11px;line-height:1.55;margin:0}.modal-body>.form-error{margin:18px 0 0} @@ -168,7 +169,7 @@ tbody tr:hover{background:#fcfefe} @media(max-width:510px){.topbar{padding:0 17px}.content{padding:25px 14px}.page-heading{padding:0 3px}.overview-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.stat-card{padding:13px 11px;min-height:112px}.stat-card>strong{font-size:23px}.stat-icon{display:none}.topbar-right{gap:4px}.topbar-user{font-size:11px}.breadcrumb{font-size:11px}.modal-backdrop{padding:10px}.modal-header,.modal-body{padding-left:19px;padding-right:19px}.modal-footer{padding:14px 19px}.form-grid{gap:15px 10px}.console-backdrop{padding:0}.console-modal{height:100vh;max-height:100vh;border-radius:0}.console-stage{flex:1;height:auto}.console-tools .button{display:none}.console-password{flex-wrap:wrap}.console-password input{flex:1;min-width:130px}} @media(max-width:510px){.topbar-right{flex-wrap:nowrap;justify-content:flex-end;gap:5px;min-width:0}.topbar-user{min-width:0}.topbar-user #current-username{display:block;max-width:90px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.topbar-user .avatar{display:none}.topbar-right #logout-button{font-size:10px;padding:5px;min-height:28px}.breadcrumb{white-space:nowrap}.breadcrumb span{padding:0 5px}.update-versions{grid-template-columns:1fr}} @media(max-width:510px){.create-source-picker,.cloud-fields>.form-grid{grid-template-columns:1fr}} -@media(max-width:510px){.template-catalog{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.template-family-summary{min-height:137px;padding:16px 9px 11px}.template-family-icon{width:55px;height:55px;font-size:27px}.template-versions{padding:8px}.template-version-option{padding:9px 8px}.template-admin-row{grid-template-columns:1fr}.template-admin-row .button{justify-self:start}} +@media(max-width:510px){.template-catalog{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}.template-family-summary{min-height:151px;padding:16px 9px 11px}.template-family-icon{width:55px;height:55px;font-size:27px}.template-versions{padding:8px}.template-version-option{padding:9px 8px}.template-admin-row{grid-template-columns:1fr}.template-admin-row .button{justify-self:start}} @media(max-width:510px){.workspace-form-body{padding:22px 19px 25px}.workspace-form-actions{padding:15px 19px}.workspace-form-actions .button{flex:1 1 100%}.workspace-form-back{margin-bottom:10px}} @media(max-width:510px){.host-public-pool>.form-grid{grid-template-columns:1fr}} @media(max-width:510px){.register-code-row{flex-wrap:wrap}.register-code-row input{flex-basis:100%}.register-code-row .button{width:100%}.pending-user-row{align-items:flex-start;flex-direction:column}.pending-user-row .button{width:100%}.smtp-card .form-grid{grid-template-columns:1fr}} @@ -209,7 +210,7 @@ tbody tr:hover{background:#fcfefe} .plan-table-head,.plan-option{display:grid;grid-template-columns:minmax(150px,1.35fr) repeat(5,minmax(92px,1fr));align-items:center;column-gap:18px} .plan-table-head{padding:13px 48px 13px 19px;border-bottom:1px solid #e5ecef;background:#f8fafb;color:#8292a3;font-size:10px;font-weight:800} .plan-option{position:relative;width:100%;min-width:0;min-height:72px;padding:15px 48px 15px 19px;border:0;border-bottom:1px solid #e7edef;border-radius:0;background:#fff;color:#4e6577;text-align:left} -.plan-option:last-child{border-bottom:0} +.plan-option:last-of-type{border-bottom:0;border-bottom-right-radius:10px;border-bottom-left-radius:10px} .plan-option:hover{background:#f7fbfc} .plan-option:focus-visible{z-index:2;outline:3px solid rgba(18,166,176,.22);outline-offset:-3px} .plan-option[aria-pressed="true"]{z-index:1;background:#eef9fa;box-shadow:inset 0 0 0 2px #2eabb4;color:#30485d} @@ -242,6 +243,7 @@ tbody tr:hover{background:#fcfefe} @media(max-width:740px){ .region-picker{grid-template-columns:repeat(2,minmax(0,1fr))} .plan-table-head{display:none} + .plan-option:first-of-type{border-top-left-radius:10px;border-top-right-radius:10px} .plan-option{grid-template-columns:repeat(2,minmax(0,1fr));gap:13px 18px;min-height:0;padding:18px 45px 18px 18px} .plan-option-name{grid-column:1/-1;font-size:13px} .plan-option-value,.plan-option-price{display:grid;gap:3px;white-space:normal} @@ -252,4 +254,4 @@ tbody tr:hover{background:#fcfefe} .plan-option>:nth-child(5)::before{content:"每月流量"} .plan-option>:nth-child(6)::before{content:"价格"} } -@media(max-width:510px){.deployment-step{padding-bottom:23px;margin-bottom:22px}.deployment-step-heading{margin-bottom:16px}.region-picker,.user-iso-picker{grid-template-columns:1fr}.region-option{min-height:66px}.user-iso-row{align-items:flex-start;flex-direction:column}.user-iso-row .row-button{width:100%}.user-iso-empty{align-items:flex-start;flex-direction:column}} +@media(max-width:510px){.deployment-step{padding-bottom:23px;margin-bottom:22px}.deployment-step-heading{margin-bottom:16px}.region-picker,.user-iso-picker{grid-template-columns:1fr}.region-option{min-height:66px}.template-versions{width:min(280px,calc(100vw - 66px));right:auto}.template-family-card:nth-child(even) .template-versions{right:0;left:auto}.user-iso-row{align-items:flex-start;flex-direction:column}.user-iso-row .row-button{width:100%}.user-iso-empty{align-items:flex-start;flex-direction:column}} diff --git a/web/resources/views/venix/cloud/pages/deploy.tpl b/web/resources/views/venix/cloud/pages/deploy.tpl index f7df7eeb..4536f492 100644 --- a/web/resources/views/venix/cloud/pages/deploy.tpl +++ b/web/resources/views/venix/cloud/pages/deploy.tpl @@ -53,10 +53,10 @@

{if !empty($cloud_deploy_catalog_unavailable)}系统镜像目录暂时无法读取,请稍后刷新。{else}暂无可用云镜像,请联系管理员导入模板。{/if}

{else} {foreach $cloud_deploy_template_groups as $group} -
- +
+ - {$group.family|escape:"html"}⌄ + {$group.family|escape:"html"}
{foreach $group.templates as $template} diff --git a/web/resources/views/venix/cloud/pages/reinstall.tpl b/web/resources/views/venix/cloud/pages/reinstall.tpl index bf5f080b..2fca271e 100644 --- a/web/resources/views/venix/cloud/pages/reinstall.tpl +++ b/web/resources/views/venix/cloud/pages/reinstall.tpl @@ -9,7 +9,7 @@

重装将永久清除原系统盘中的全部数据。面板会先请求虚拟机正常关机;若关机超时,重装会停止,不会强制断电。libvirt/QEMU 报告虚拟机已从新盘启动后,原系统盘将自动删除。这个“启动”不保证客户机系统、网络或 SSH 已经可用,请确认模板和网络配置。

沿用首次创建的公网网络信息:{if !empty($cloud_reinstall_vm.public_ip)}{$cloud_reinstall_vm.public_ip|escape:"html"}{elseif !empty($cloud_reinstall_vm.public_ip_cidr)}{$cloud_reinstall_vm.public_ip_cidr|escape:"html"}{else}未记录{/if}。网桥、MAC、网关和 DNS 也会保持原配置。

-
重装镜像 *
{if empty($cloud_reinstall_template_groups)}

{if !empty($cloud_reinstall_catalog_unavailable)}系统镜像目录暂时无法读取,请稍后刷新。{else}暂无可用云镜像,请联系管理员导入模板。{/if}

{else}{foreach $cloud_reinstall_template_groups as $group}
{$group.family|escape:"html"}⌄
{foreach $group.templates as $template}{/foreach}
{/foreach}{/if}
点击系统图标下方的箭头展开版本,选择全局云镜像版本。
+
重装镜像 *
{if empty($cloud_reinstall_template_groups)}

{if !empty($cloud_reinstall_catalog_unavailable)}系统镜像目录暂时无法读取,请稍后刷新。{else}暂无可用云镜像,请联系管理员导入模板。{/if}

{else}{foreach $cloud_reinstall_template_groups as $group}
{$group.family|escape:"html"}
{foreach $group.templates as $template}{/foreach}
{/foreach}{/if}
点击系统图标下方的箭头展开版本,选择全局云镜像版本。
SSH 公钥(可选)
{if empty($cloud_reinstall_ssh_keys)}

暂无公钥,可先到“公钥管理”添加。不选公钥也会生成强密码。

{else}{foreach $cloud_reinstall_ssh_keys as $key}{/foreach}{/if}
直接选择“公钥管理”中保存的公钥;再次点击已选公钥可取消。填写密码时可与公钥同时使用。管理我的公钥
留空时自动生成强密码,即使选择了公钥;自行设置需至少 12 个字符,包含大写字母、小写字母、数字和符号。
diff --git a/web/resources/views/venix/layout_assets.tpl b/web/resources/views/venix/layout_assets.tpl index 10b896b6..f3c46b54 100644 --- a/web/resources/views/venix/layout_assets.tpl +++ b/web/resources/views/venix/layout_assets.tpl @@ -1 +1 @@ -{assign var=venix_asset_version value='2026092811' scope='global'} +{assign var=venix_asset_version value='2026092812' scope='global'} diff --git a/web/tests/VirtualizationAssetsTest.php b/web/tests/VirtualizationAssetsTest.php index 99877211..c1149094 100644 --- a/web/tests/VirtualizationAssetsTest.php +++ b/web/tests/VirtualizationAssetsTest.php @@ -141,6 +141,13 @@ $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.'); +$assert(str_contains($baseStyles, + '.plan-option:last-of-type{border-bottom:0;border-bottom-right-radius:10px;border-bottom-left-radius:10px}') + && str_contains($baseStyles, + '.plan-option:first-of-type{border-top-left-radius:10px;border-top-right-radius:10px}') + && str_contains($baseStyles, + '.plan-option[aria-pressed="true"]{z-index:1;background:#eef9fa;box-shadow:inset 0 0 0 2px #2eabb4;'), + 'Selected plan rows must preserve rounded first/last corners without clipping their inset border.'); $runtimeDeployScript = file_get_contents($public . '/runtime.js'); $selectRegionStart = strpos($runtimeDeployScript, 'async function selectRegion('); $selectRegionEnd = $selectRegionStart === false ? false @@ -225,6 +232,62 @@ $assert($selectRegion !== '' && $selectPlan !== '' && !str_contains($selectPlan, 'loadGlobalTemplates(') && !str_contains($selectPlan, "byId('vm-template').value"), 'Changing regions or plans must preserve the global image catalog and selected image.'); +$catalogRendererStart = strpos($runtimeDeployScript, 'function renderTemplateCatalog(inputId)'); +$catalogRendererEnd = $catalogRendererStart === false ? false + : strpos($runtimeDeployScript, 'async function initializeSession(', $catalogRendererStart); +$catalogRenderer = $catalogRendererStart === false || $catalogRendererEnd === false ? '' + : substr($runtimeDeployScript, $catalogRendererStart, + $catalogRendererEnd - $catalogRendererStart); +$assert(str_contains($baseStyles, + '.template-catalog{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));align-items:start;') + && str_contains($baseStyles, + '.template-family-card{position:relative;z-index:1;') + && str_contains($baseStyles, 'background:#fff;overflow:visible}') + && str_contains($baseStyles, '.template-family-card[open]{z-index:20;') + && str_contains($baseStyles, + '.template-versions{position:absolute;top:calc(100% + 8px);left:0;right:0;z-index:30;') + && str_contains($baseStyles, 'max-height:min(260px,50vh);') + && str_contains($baseStyles, 'overflow-y:auto;') + && str_contains($baseStyles, + '.template-versions{width:min(280px,calc(100vw - 66px));right:auto}') + && str_contains($baseStyles, + '.template-family-card:nth-child(even) .template-versions{right:0;left:auto}') + && str_contains($baseStyles, '.template-family-summary{gap:6px;min-height:170px}') + && str_contains($baseStyles, '.template-family-selection{display:block;') + && str_contains($deployTemplate, 'name="vm-template-family"') + && str_contains($reinstallTemplate, 'name="reinstall-template-family"') + && str_contains($deployTemplate, 'class="template-family-selection" aria-hidden="true"') + && str_contains($reinstallTemplate, 'class="template-family-selection" aria-hidden="true"'), + 'Image versions must open as one anchored floating panel without resizing sibling cards.'); +$assert($catalogRenderer !== '' + && str_contains($runtimeDeployScript, 'function bindTemplateVersionMenu(card, container)') + && str_contains($runtimeDeployScript, 'function updateTemplateFamilySelection(card, selectedName = "")') + && str_contains($runtimeDeployScript, + 'container.querySelectorAll(".template-family-card[open]")') + && str_contains($runtimeDeployScript, 'if (other !== card) other.open = false;') + && str_contains($catalogRenderer, + 'card.setAttribute("name", `${inputId}-family`);') + && str_contains($catalogRenderer, 'card.open = opened.has(family);') + && !str_contains($catalogRenderer, 'card.open = opened.has(family) ||') + && str_contains($catalogRenderer, 'card.open = false;') + && str_contains($catalogRenderer, 'summary.focus({ preventScroll: true });') + && str_contains($catalogRenderer, + 'updateTemplateFamilySelection(familyCard, familyCard === card ? name : "");') + && str_contains($runtimeDeployScript, + '? `${family},已选择 ${selectedName},展开更改版本`') + && str_contains($runtimeDeployScript, + 'if (event.key !== "Escape") return;') + && str_contains($runtimeDeployScript, + '!event.target.closest(".template-family-card")') + && substr_count($runtimeDeployScript, + 'document.addEventListener("click", (event) => {') === 1 + && substr_count($runtimeDeployScript, + 'document.addEventListener("keydown", (event) => {') === 1 + && substr_count($runtimeDeployScript, + 'document.addEventListener("focusin", (event) => {') === 1 + && str_contains($runtimeDeployScript, + 'openCard.contains(event.target)'), + 'Image version menus must be single-open, dismissible, and close after selection.'); $availabilityStart = strpos($runtimeDeployScript, 'function updateCreateAvailability()'); $availabilityEnd = $availabilityStart === false ? false : strpos($runtimeDeployScript, 'function strongPassword(', $availabilityStart);