Bundle Debian CentOS and Ubuntu template icons

main
admin 2 months ago
parent e42ad09867
commit 14970dd1b0

@ -0,0 +1,12 @@
# 操作系统图标来源
这些图标随面板保存在 `static/`,页面运行时不向图标来源站点发起请求。它们仅用于标识实际系统模板,不表示发行版项目或商标持有人认可本面板。
| 本地文件 | 官方来源 | 使用说明 |
| --- | --- | --- |
| `static/almalinux-icon.svg` | [AlmaLinux 官方圆形图标](https://almalinux.org/branding/AlmaLinux%20Icon%20Circle.svg) | 保留官方图形及颜色;参阅 [AlmaLinux 品牌规范](https://almalinux.org/branding/brand-book)。 |
| `static/debian-icon.svg` | [Debian Open Use Logo(无文字版)](https://www.debian.org/logos/openlogo-nd.svg) | Copyright © 1999 Software in the Public Interest, Inc.;官方提供 LGPL-3.0-or-later 或 [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/) 双重许可。此本地 SVG 移除了原文件的外部 DTD 与 Illustrator 元数据,图形路径和颜色保持不变。参阅 [Debian 图标说明](https://www.debian.org/logos/)。 |
| `static/centos-icon.svg` | [CentOS 官网图形标识](https://www.centos.org/assets/img/centos-symbol.svg) | 保留官方图形及颜色;参阅 [CentOS 商标指南](https://www.centos.org/legal/trademarks/)。 |
| `static/ubuntu-icon.svg` | [Canonical 官方 Circle of Friends SVG](https://assets.ubuntu.com/v1/ce518a18-CoF-2022_solid+O.svg) | 保留官方图形及颜色;参阅 [Canonical 知识产权政策](https://canonical.com/legal/intellectual-property-policy)。 |
目前后端仍只允许导入 AlmaLinux 9/10 镜像。预存另外三个图标不等于已开放对应系统的镜像导入、创建或销售。未来正式提供商业套餐前,应核对相应镜像的再分发条件和商标使用要求,尤其是 CentOS 的商业使用限制。

@ -87,7 +87,7 @@ SELECT id, username, email FROM users WHERE id = 1;
## 公网云镜像模板创建(无需手动安装)
创建与重装页面的 AlmaLinux 标识使用随项目保存的[官方圆形图标 SVG](https://almalinux.org/branding/AlmaLinux%20Icon%20Circle.svg),页面运行时不会从外网加载图标。该标识仅用于识别系统镜像;本面板并非 AlmaLinux OS Foundation 官方产品。
面板随项目预存 AlmaLinux、Debian、CentOS 和 Ubuntu 的官方图标,页面运行时不会从外网加载图标;来源与使用说明见 [ICON-SOURCES.md](ICON-SOURCES.md)。图标仅用于识别真实的系统模板,不表示发行版项目认可本面板。当前后端仍只允许导入 AlmaLinux 9/10 镜像,预存其他图标并未开放相应系统的导入或销售。
面板的“创建虚拟机”有独立的“公网云镜像”方式。先在宿主机设置中选择已工作的 Linux 网桥,例如 `bridge:br0`。只有管理员可进入侧栏的“云镜像模板”页面,填写 [AlmaLinux 官方 Generic Cloud qcow2 镜像](https://wiki.almalinux.org/cloud/Generic-cloud)在 `https://repo.almalinux.org/almalinux/9/cloud/x86_64/images/` 或 `https://repo.almalinux.org/almalinux/10/cloud/x86_64/images/` 下的下载地址、发布方 SHA-256 和模板显示名;已保存的显示名也可在该页修改。地址必须是官方 HTTPS 直链,面板不会跟随重定向。面板服务器 A 需要能访问该地址。导入在后台运行,一次只允许一个任务,面板下载、校验 SHA-256 后通过当前 libvirt SSH 连接把模板镜像上传到 B 的磁盘池;无需登录 B 手工复制。模板目录记录加密保存在 MariaDB,绑定当前宿主机身份和磁盘池。改名不会改动镜像文件、模板 ID 或已经创建的虚拟机的系统名称记录,只影响后续创建和重装时的显示。普通用户只能在创建或重装页面从已导入的镜像卡片中选择具体版本,不能导入或改名。不要在导入期间关闭面板进程;若进程异常退出,运行中的导入任务记录不会恢复,可能需要检查项目 `data/` 中的 `.cloud-image-*` 临时文件和 B 磁盘池中 `panel-template-*` 卷,不要未经核对就删除。

@ -1922,10 +1922,28 @@ async function loadResources() {
}
}
const TEMPLATE_FAMILY_NAMES = {
almalinux: "AlmaLinux",
debian: "Debian",
centos: "CentOS",
centosstream: "CentOS",
ubuntu: "Ubuntu",
};
const TEMPLATE_ICON_PATHS = {
AlmaLinux: "/static/almalinux-icon.svg",
Debian: "/static/debian-icon.svg",
CentOS: "/static/centos-icon.svg",
Ubuntu: "/static/ubuntu-icon.svg",
};
function templateSystem(item) {
const id = String(item?.id || "");
const family = String(item?.os_family || "").toLowerCase() === "almalinux" || /^alma(?:9|10)-/.test(id)
? "AlmaLinux" : "其他系统";
const familyKey = String(item?.os_family || "").trim().toLowerCase().replace(/[\s_-]+/g, "");
const namedFamily = Object.prototype.hasOwnProperty.call(TEMPLATE_FAMILY_NAMES, familyKey)
? TEMPLATE_FAMILY_NAMES[familyKey] : "";
const family = namedFamily
|| (/^alma(?:9|10)-/.test(id) ? "AlmaLinux" : "其他系统");
const oldVersion = /^alma(9|10)-/.exec(id)?.[1] || "";
const version = /^[0-9]+$/.test(String(item?.os_version || ""))
? String(item.os_version) : oldVersion;
@ -1933,11 +1951,12 @@ function templateSystem(item) {
}
function templateIcon(family, className) {
const icon = makeElement("span", `${className}${family === "AlmaLinux" ? " alma" : ""}`);
const logoPath = TEMPLATE_ICON_PATHS[family];
const icon = makeElement("span", `${className}${logoPath ? " system" : ""}`);
icon.setAttribute("aria-hidden", "true");
if (family === "AlmaLinux") {
const logo = makeElement("img", "template-almalinux-logo");
logo.src = "/static/almalinux-icon.svg";
if (logoPath) {
const logo = makeElement("img", "template-system-logo");
logo.src = logoPath;
logo.alt = "";
icon.append(logo);
} else {

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="160" height="160" viewBox="0 0 42.333 42.333"><g transform="matrix(1.0529 0 0 1.05289 -387.492 265.985)"><circle cx="435.079" cy="-124.144" r="20.103" style="fill:#a14f8c;fill-opacity:1;stroke:none;stroke-width:1.32292;stroke-linecap:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke;stop-color:#000" transform="rotate(-15)"/><path d="m384.257-249.617-3.875 3.875h-5.479v5.48l-3.875 3.875 3.875 3.874v5.48h5.48l3.874 3.875 3.875-3.875h5.48v-5.48l3.874-3.874-3.875-3.875-5.48-5.48zm1.176 3.875v4.18l-1.176 1.176-1.176-1.176v-4.18zm-6.959 1.908 2.956 2.957v1.662h-1.663l-2.956-2.956zm-3.571 6.27h4.18l1.176 1.177-1.176 1.176h-4.18zm14.434 0h4.18v2.353h-4.18l-1.176-1.176zm-9.503 3.937h1.663v1.663l-2.956 2.956-1.663-1.663zm7.184 0h1.663l2.956 2.956-1.663 1.663-2.956-2.956zm-2.76 1.143 1.175 1.176v4.18h-2.352v-4.18z" style="fill:#fff;fill-opacity:1;stroke-width:7.93746;stroke-linecap:round;paint-order:fill markers stroke;stop-color:#000" transform="translate(-53.772 39.325)scale(1.15)"/><path d="m385.433-239.09-1.176 1.04-1.176-1.04v1.526h-1.526l1.039 1.177-1.04 1.176h1.527v1.526l1.176-1.04 1.176 1.04v-1.526h1.527l-1.04-1.176 1.04-1.177h-1.527z" style="fill:#efa724;fill-opacity:1;stroke-width:8.59212;stroke-linecap:round;paint-order:fill markers stroke;stop-color:#000" transform="translate(-53.772 39.325)scale(1.15)"/><path d="m388.135-245.738 1.905 1.905-2.956 2.956v1.663h1.663l2.956-2.956 1.911 1.911-.003-5.483z" style="fill:#efa724;fill-opacity:1;stroke-width:6.14231;stroke-linecap:round;paint-order:fill markers stroke;stop-color:#000" transform="translate(-53.772 39.325)scale(1.15)"/></g></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -0,0 +1,51 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 87.041 108.445">
<path fill="#A80030" d="M51.986,57.297c-1.797,0.025,0.34,0.926,2.686,1.287
c0.648-0.506,1.236-1.018,1.76-1.516C54.971,57.426,53.484,57.434,51.986,57.297"/>
<path fill="#A80030" d="M61.631,54.893c1.07-1.477,1.85-3.094,2.125-4.766c-0.24,1.192-0.887,2.221-1.496,3.307
c-3.359,2.115-0.316-1.256-0.002-2.537C58.646,55.443,61.762,53.623,61.631,54.893"/>
<path fill="#A80030" d="M65.191,45.629c0.217-3.236-0.637-2.213-0.924-0.978
C64.602,44.825,64.867,46.932,65.191,45.629"/>
<path fill="#A80030" d="M45.172,1.399c0.959,0.172,2.072,0.304,1.916,0.533
C48.137,1.702,48.375,1.49,45.172,1.399"/>
<path fill="#A80030" d="M47.088,1.932l-0.678,0.14l0.631-0.056L47.088,1.932"/>
<path fill="#A80030" d="M76.992,46.856c0.107,2.906-0.85,4.316-1.713,6.812l-1.553,0.776
c-1.271,2.468,0.123,1.567-0.787,3.53c-1.984,1.764-6.021,5.52-7.313,5.863c-0.943-0.021,0.639-1.113,0.846-1.541
c-2.656,1.824-2.131,2.738-6.193,3.846l-0.119-0.264c-10.018,4.713-23.934-4.627-23.751-17.371
c-0.107,0.809-0.304,0.607-0.526,0.934c-0.517-6.557,3.028-13.143,9.007-15.832c5.848-2.895,12.704-1.707,16.893,2.197
c-2.301-3.014-6.881-6.209-12.309-5.91c-5.317,0.084-10.291,3.463-11.951,7.131c-2.724,1.715-3.04,6.611-4.227,7.507
C31.699,56.271,36.3,61.342,44.083,67.307c1.225,0.826,0.345,0.951,0.511,1.58c-2.586-1.211-4.954-3.039-6.901-5.277
c1.033,1.512,2.148,2.982,3.589,4.137c-2.438-0.826-5.695-5.908-6.646-6.115c4.203,7.525,17.052,13.197,23.78,10.383
c-3.113,0.115-7.068,0.064-10.566-1.229c-1.469-0.756-3.467-2.322-3.11-2.615c9.182,3.43,18.667,2.598,26.612-3.771
c2.021-1.574,4.229-4.252,4.867-4.289c-0.961,1.445,0.164,0.695-0.574,1.971c2.014-3.248-0.875-1.322,2.082-5.609l1.092,1.504
c-0.406-2.696,3.348-5.97,2.967-10.234c0.861-1.304,0.961,1.403,0.047,4.403c1.268-3.328,0.334-3.863,0.66-6.609
c0.352,0.923,0.814,1.904,1.051,2.878c-0.826-3.216,0.848-5.416,1.262-7.285c-0.408-0.181-1.275,1.422-1.473-2.377
c0.029-1.65,0.459-0.865,0.625-1.271c-0.324-0.186-1.174-1.451-1.691-3.877c0.375-0.57,1.002,1.478,1.512,1.562
c-0.328-1.929-0.893-3.4-0.916-4.88c-1.49-3.114-0.527,0.415-1.736-1.337c-1.586-4.947,1.316-1.148,1.512-3.396
c2.404,3.483,3.775,8.881,4.404,11.117c-0.48-2.726-1.256-5.367-2.203-7.922c0.73,0.307-1.176-5.609,0.949-1.691
c-2.27-8.352-9.715-16.156-16.564-19.818c0.838,0.767,1.896,1.73,1.516,1.881c-3.406-2.028-2.807-2.186-3.295-3.043
c-2.775-1.129-2.957,0.091-4.795,0.002c-5.23-2.774-6.238-2.479-11.051-4.217l0.219,1.023c-3.465-1.154-4.037,0.438-7.782,0.004
c-0.228-0.178,1.2-0.644,2.375-0.815c-3.35,0.442-3.193-0.66-6.471,0.122c0.808-0.567,1.662-0.942,2.524-1.424
c-2.732,0.166-6.522,1.59-5.352,0.295c-4.456,1.988-12.37,4.779-16.811,8.943l-0.14-0.933c-2.035,2.443-8.874,7.296-9.419,10.46
l-0.544,0.127c-1.059,1.793-1.744,3.825-2.584,5.67c-1.385,2.36-2.03,0.908-1.833,1.278c-2.724,5.523-4.077,10.164-5.246,13.97
c0.833,1.245,0.02,7.495,0.335,12.497c-1.368,24.704,17.338,48.69,37.785,54.228c2.997,1.072,7.454,1.031,11.245,1.141
c-4.473-1.279-5.051-0.678-9.408-2.197c-3.143-1.48-3.832-3.17-6.058-5.102l0.881,1.557c-4.366-1.545-2.539-1.912-6.091-3.037
l0.941-1.229c-1.415-0.107-3.748-2.385-4.386-3.646l-1.548,0.061c-1.86-2.295-2.851-3.949-2.779-5.23l-0.5,0.891
c-0.567-0.973-6.843-8.607-3.587-6.83c-0.605-0.553-1.409-0.9-2.281-2.484l0.663-0.758c-1.567-2.016-2.884-4.6-2.784-5.461
c0.836,1.129,1.416,1.34,1.99,1.533c-3.957-9.818-4.179-0.541-7.176-9.994l0.634-0.051c-0.486-0.732-0.781-1.527-1.172-2.307
l0.276-2.75C4.667,58.121,6.719,47.409,7.13,41.534c0.285-2.389,2.378-4.932,3.97-8.92l-0.97-0.167
c1.854-3.234,10.586-12.988,14.63-12.486c1.959-2.461-0.389-0.009-0.772-0.629c4.303-4.453,5.656-3.146,8.56-3.947
c3.132-1.859-2.688,0.725-1.203-0.709c5.414-1.383,3.837-3.144,10.9-3.846c0.745,0.424-1.729,0.655-2.35,1.205
c4.511-2.207,14.275-1.705,20.617,1.225c7.359,3.439,15.627,13.605,15.953,23.17l0.371,0.1
c-0.188,3.802,0.582,8.199-0.752,12.238L76.992,46.856"/>
<path fill="#A80030" d="M32.372,59.764l-0.252,1.26c1.181,1.604,2.118,3.342,3.626,4.596
C34.661,63.502,33.855,62.627,32.372,59.764"/>
<path fill="#A80030" d="M35.164,59.654c-0.625-0.691-0.995-1.523-1.409-2.352
c0.396,1.457,1.207,2.709,1.962,3.982L35.164,59.654"/>
<path fill="#A80030" d="M84.568,48.916l-0.264,0.662c-0.484,3.438-1.529,6.84-3.131,9.994
C82.943,56.244,84.088,52.604,84.568,48.916"/>
<path fill="#A80030" d="M45.527,0.537C46.742,0.092,48.514,0.293,49.803,0c-1.68,0.141-3.352,0.225-5.003,0.438
L45.527,0.537"/>
<path fill="#A80030" d="M2.872,23.219c0.28,2.592-1.95,3.598,0.494,1.889
C4.676,22.157,2.854,24.293,2.872,23.219"/>
<path fill="#A80030" d="M0,35.215c0.563-1.728,0.665-2.766,0.88-3.766C-0.676,33.438,0.164,33.862,0,35.215"/>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

@ -5,8 +5,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#101d2c" />
<title>VirtPilot · 虚拟机管理</title>
<link rel="stylesheet" href="/static/styles.css?v=template-catalog-2" />
<script type="module" src="/static/app.js?v=template-catalog-2"></script>
<link rel="stylesheet" href="/static/styles.css?v=template-catalog-3" />
<script type="module" src="/static/app.js?v=template-catalog-3"></script>
</head>
<body>
<div id="boot-screen" class="boot-screen" role="status" aria-live="polite">

@ -142,8 +142,8 @@ tbody tr:hover{background:#fcfefe}
.workspace-form-page{width:min(100%,900px);margin:0 auto 48px}.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:block;border:1px solid #dce4eb;border-radius:9px;padding:12px 14px;min-height:65px;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}.create-source-picker small{display:block;color:#8999a8;font-size:10px;margin-top:5px}
.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{grid-column:1/-1;margin:0;padding:17px;border:1px dashed #cbdbe3;border-radius:10px;background:#f8fbfc;color:#698094;font-size:12px}.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-icon.alma{background:conic-gradient(from 35deg,#32bac4 0 28%,#5277cb 28% 51%,#e7ad54 51% 72%,#3ea67b 72% 100%);border:5px solid #f5faf9;color:#fff;text-shadow:0 1px 4px rgba(8,45,65,.35)}.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 small{margin:0;color:#899cac;font-size:10px;overflow-wrap:anywhere}.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.alma,.template-admin-icon.alma{background:transparent;border:0;box-shadow:none;color:inherit;text-shadow:none}.template-almalinux-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-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{grid-column:1/-1;margin:0;padding:17px;border:1px dashed #cbdbe3;border-radius:10px;background:#f8fbfc;color:#698094;font-size:12px}.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-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}
.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}
.vm-auto-public-pool{display:grid;gap:5px;margin:0 0 18px;padding:13px 15px;border:1px solid #cce9e0;border-radius:9px;background:#f0fbf8}.vm-auto-public-pool strong{font-size:12px;color:#217d6e}.vm-auto-public-pool span{font-size:11px;line-height:1.6;color:#5b837a}.vm-cloud-auth-fields{margin-top:18px}
.input-suffix{position:relative}.input-suffix input{padding-right:48px}.input-suffix span{position:absolute;right:13px;top:13px;color:#97a4b2;font-size:12px}

@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 767.40668 738.31421"><defs><style>.cls-1{fill:#e9500e;}</style></defs><circle class="cls-1" cx="109.02696" cy="348.09412" r="109.02696"/><circle class="cls-1" cx="563.08369" cy="109.02698" r="109.02698"/><path class="cls-1" d="M492.48194,1336.66577a265.52505,265.52505,0,0,1-181.0712-138.09814,156.94784,156.94784,0,0,1-93.21911,11.45825,354.93524,354.93524,0,0,0,255.53723,214.16455,359.20777,359.20777,0,0,0,77.41949,7.967,156.00313,156.00313,0,0,1-31.92236-91.15466C510.24622,1340.00525,501.27735,1338.548,492.48194,1336.66577Z" transform="translate(-137.56155 -707.97998)"/><circle class="cls-1" cx="538.52046" cy="629.28723" r="109.02698"/><path class="cls-1" d="M827.798,1297.22095A356.70056,356.70056,0,0,0,845.67283,878.702a157.14441,157.14441,0,0,1-61.30975,71.8031,267.293,267.293,0,0,1-8.73688,265.4884A156.34677,156.34677,0,0,1,827.798,1297.22095Z" transform="translate(-137.56155 -707.97998)"/><path class="cls-1" d="M238.17644,899.71906q4.1505-.22779,8.30533-.22553A157.34626,157.34626,0,0,1,329.16416,923.039,265.90653,265.90653,0,0,1,543.27238,808.52966a158.0877,158.0877,0,0,1,33.076-88.42022C439.24549,709.25177,306.02421,780.001,238.17644,899.71906Z" transform="translate(-137.56155 -707.97998)"/></svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -6,6 +6,7 @@ from dataclasses import dataclass
from html.parser import HTMLParser
from pathlib import Path
import re
from xml.etree import ElementTree
import pytest
@ -117,20 +118,33 @@ def test_catalog_renders_expandable_family_and_version_cards() -> None:
assert 'input.value = id;' in script
def test_almalinux_cards_use_local_vector_logo_instead_of_letter_placeholder() -> None:
@pytest.mark.parametrize(
("family", "filename"),
[
("AlmaLinux", "almalinux-icon.svg"),
("Debian", "debian-icon.svg"),
("CentOS", "centos-icon.svg"),
("Ubuntu", "ubuntu-icon.svg"),
],
)
def test_system_cards_use_bundled_vector_logos(family: str, filename: str) -> None:
script = (STATIC / "app.js").read_text(encoding="utf-8")
logo = STATIC / "almalinux-icon.svg"
logo = STATIC / filename
assert logo.is_file()
artwork = logo.read_text(encoding="utf-8")
assert "<svg" in artwork
assert "<path" in artwork
assert "/static/almalinux-icon.svg" in script
root = ElementTree.fromstring(artwork)
assert root.tag == "{http://www.w3.org/2000/svg}svg"
assert any(element.tag.endswith("}path") for element in root.iter())
assert f'{family}: "/static/{filename}"' in script
icon_code = script.split("function templateIcon(family, className) {", 1)[1].split(
"function renderTemplateCatalog(inputId) {", 1
)[0]
assert 'makeElement("img", "template-almalinux-logo")' in icon_code
assert 'logo.src = "/static/almalinux-icon.svg";' in icon_code
assert "TEMPLATE_ICON_PATHS[family]" in icon_code
assert 'makeElement("img", "template-system-logo")' in icon_code
assert "logo.src = logoPath;" in icon_code
assert 'icon.append(logo);' in icon_code
assert 'icon.textContent = "A"' not in icon_code
catalog_code = script.split("function renderTemplateCatalog(inputId) {", 1)[1].split(
"function renderTemplateAdminList() {", 1
@ -138,8 +152,25 @@ def test_almalinux_cards_use_local_vector_logo_instead_of_letter_placeholder() -
admin_code = script.split("function renderTemplateAdminList() {", 1)[1].split(
"function fillTemplateViews", 1
)[0]
assert 'family === "AlmaLinux" ? "A"' not in catalog_code
assert 'family === "AlmaLinux" ? "A"' not in admin_code
assert 'templateIcon(family, "template-family-icon")' in catalog_code
assert 'templateIcon(family, "template-admin-icon")' in admin_code
def test_system_family_metadata_recognizes_debian_centos_and_ubuntu() -> None:
script = (STATIC / "app.js").read_text(encoding="utf-8")
names = script.split("const TEMPLATE_FAMILY_NAMES = {", 1)[1].split("};", 1)[0]
for metadata, family in (
("debian", "Debian"),
("centos", "CentOS"),
("centosstream", "CentOS"),
("ubuntu", "Ubuntu"),
):
assert f'{metadata}: "{family}"' in names
system_code = script.split("function templateSystem(item) {", 1)[1].split(
"function templateIcon(family, className) {", 1
)[0]
assert "item?.os_family" in system_code
assert "TEMPLATE_FAMILY_NAMES[familyKey]" in system_code
def test_version_cards_show_only_centered_template_name() -> None:

Loading…
Cancel
Save