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.

99 lines
10 KiB
Smarty

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<div id="vm-workspace">
<section id="create-view" class="workspace-form-page" aria-labelledby="create-title">
<a id="create-back" class="button button-ghost workspace-form-back" href="/user/cloud/instances">← 返回实例列表</a>
<div class="page-heading workspace-form-heading"><div><span class="eyebrow">DEPLOY INSTANCE</span><h1 id="create-title" tabindex="-1">部署实例</h1></div></div>
<form id="create-form" class="inventory-panel workspace-form-card">
<div class="workspace-form-body deploy-flow">
<section class="deployment-step" aria-labelledby="deploy-region-title">
<div class="deployment-step-heading"><span>1</span><h2 id="deploy-region-title">选择地区</h2></div>
<input id="vm-region" type="hidden" value="{$cloud_deploy_default_region_id|default:''|escape:"html"}" />
<div id="vm-region-picker" class="region-picker" role="group" aria-labelledby="deploy-region-title">
{if empty($cloud_deploy_regions)}
<p class="template-catalog-empty">暂无可部署地区,请联系管理员配置在售商品。</p>
{else}
{foreach $cloud_deploy_regions as $region}
<button class="region-option" type="button" data-region-id="{$region.id|escape:"html"}" aria-pressed="{if $region.id == $cloud_deploy_default_region_id}true{else}false{/if}" aria-label="选择地区 {$region.name|escape:"html"}">
<span class="region-flag" aria-hidden="true">{$region.flag|default:'🌐'|escape:"html"}</span>
<strong>{$region.name|escape:"html"}</strong>
</button>
{/foreach}
{/if}
</div>
</section>
{if !empty($cloud_deploy_lines_enabled)}
<section id="vm-line-step" class="deployment-step{if empty($cloud_deploy_regions)} is-disabled{/if}" aria-labelledby="deploy-line-title" aria-disabled="{if empty($cloud_deploy_regions)}true{else}false{/if}">
<div class="deployment-step-heading"><span>2</span><h2 id="deploy-line-title">选择线路</h2></div>
<div id="vm-line-picker" class="line-picker" role="group" aria-labelledby="deploy-line-title">
{assign var=default_region_has_lines value=false}
{foreach $cloud_deploy_lines as $line}
{if $line.region_id == $cloud_deploy_default_region_id}
{assign var=default_region_has_lines value=true}
<button class="line-option" type="button" data-line-id="{$line.id|escape:"html"}" aria-pressed="{if $line.id == $cloud_deploy_default_line_id}true{else}false{/if}" aria-label="选择线路 {$line.name|escape:"html"}"><strong>{$line.name|escape:"html"}</strong></button>
{/if}
{/foreach}
{if !$default_region_has_lines}<p class="template-catalog-empty">当前地区暂无可用线路。</p>{/if}
</div>
</section>
{/if}
<input id="vm-line" type="hidden" value="{$cloud_deploy_default_line_id|default:''|escape:"html"}" />
<section id="vm-offer-step" class="deployment-step{if empty($cloud_deploy_default_line_id)} is-disabled{/if}" aria-labelledby="deploy-offer-title" aria-disabled="{if empty($cloud_deploy_default_line_id)}true{else}false{/if}">
<div class="deployment-step-heading"><span>{if !empty($cloud_deploy_lines_enabled)}3{else}2{/if}</span><h2 id="deploy-offer-title">选择实例规格</h2></div>
<input id="vm-offer" type="hidden" value="" />
<div id="vm-offer-picker" class="offer-picker" role="group" aria-labelledby="deploy-offer-title">
{assign var=default_line_has_offers value=false}
{foreach $cloud_deploy_offers as $offer}
{if $offer.region_id == $cloud_deploy_default_region_id && $offer.line_id == $cloud_deploy_default_line_id}
{if !$default_line_has_offers}<div class="offer-table-head"><span>名称</span><span>CPU</span><span>内存</span><span>硬盘</span><span>每期流量</span><span>价格</span></div>{/if}
{assign var=default_line_has_offers value=true}
{assign var=offer_memory_gib value=$offer.memory_mib/1024}
<button class="offer-option{if empty($offer.sellable)} is-sold-out{/if}" type="button" data-offer-id="{$offer.id|escape:"html"}" aria-pressed="false" aria-disabled="{if empty($offer.sellable)}true{else}false{/if}" aria-label="{if empty($offer.sellable)}实例规格 {$offer.name|escape:"html"},暂时售罄{else}选择实例规格 {$offer.name|escape:"html"}{/if}"{if empty($offer.sellable)} disabled{/if}>
<strong class="offer-option-name">{$offer.name|escape:"html"}{if empty($offer.sellable)}<span class="offer-option-status">暂时售罄</span>{/if}</strong>
<span class="offer-option-value">{$offer.cpu_cores|escape:"html"} vCPU</span>
<span class="offer-option-value">{$offer_memory_gib|string_format:"%g"|escape:"html"} GB</span>
<span class="offer-option-value">{$offer.disk_gib|escape:"html"} GB</span>
<span class="offer-option-value">{if $offer.traffic_gib == 0}不限{else}{$offer.traffic_tib|escape:"html"} TB{/if}</span>
<strong class="offer-option-price">${$offer.price|escape:"html"} USD</strong>
</button>
{/if}
{/foreach}
{if !$default_line_has_offers}<p class="template-catalog-empty">当前选择暂无可用实例规格。</p>{/if}
</div>
</section>
<section id="vm-source-step" class="deployment-step" aria-labelledby="deploy-source-title" aria-disabled="false">
<div class="deployment-step-heading"><span>{if !empty($cloud_deploy_lines_enabled)}4{else}3{/if}</span><h2 id="deploy-source-title">选择系统镜像</h2></div>
<div class="field full" id="vm-template-field"><input id="vm-template" name="template_id" type="hidden" value=""{if empty($cloud_deploy_template_groups)} disabled{/if} /><div id="vm-template-catalog" class="template-catalog" role="group" aria-labelledby="deploy-source-title" aria-required="true">
{if empty($cloud_deploy_template_groups)}
<p class="template-catalog-empty">{if !empty($cloud_deploy_catalog_unavailable)}系统镜像目录暂时无法读取,请稍后刷新。{else}暂无可用云镜像,请联系管理员导入模板。{/if}</p>
{else}
{foreach $cloud_deploy_template_groups as $group}
<details class="template-family-card" name="vm-template-family" data-family="{$group.family|escape:"html"}">
<summary class="template-family-summary" aria-label="{$group.family|escape:"html"},展开选择版本">
<span class="template-family-selected-mark" aria-hidden="true">&#x2713;</span>
<span class="template-family-icon{if !empty($group.icon_path)} system{/if}" aria-hidden="true">{if !empty($group.icon_path)}<img class="template-system-logo" src="{$group.icon_path|escape:"html"}" alt="" />{else}&#x25C8;{/if}</span>
<strong>{$group.family|escape:"html"}</strong><span class="template-family-footer"><span class="template-family-selection" aria-hidden="true"></span><span class="template-family-arrow" aria-hidden="true"></span></span>
</summary>
<div class="template-versions" role="group" aria-label="{$group.family|escape:"html"} 可用版本">
{foreach $group.templates as $template}
<button class="template-version-option" type="button" data-template-id="{$template.id|escape:"html"}" aria-pressed="false" aria-label="选择模板 {$template.name|escape:"html"}"><strong>{$template.name|escape:"html"}</strong></button>
{/foreach}
</div>
</details>
{/foreach}
{/if}
</div></div>
</section>
<section id="vm-config-step" class="deployment-step" aria-labelledby="deploy-config-title" aria-disabled="false">
<div class="deployment-step-heading"><span>{if !empty($cloud_deploy_lines_enabled)}5{else}4{/if}</span><h2 id="deploy-config-title">实例信息</h2></div>
<div class="form-grid">
<div class="field full"><label for="vm-name">实例名称(可选)</label><input id="vm-name" name="name" type="text" maxlength="63" pattern="[a-zA-Z0-9][a-zA-Z0-9._-]*" autocomplete="off" placeholder="留空自动生成,例如 vm-k7m4p2" /><small>留空时由系统生成 vm- 加 6 位随机编码。</small></div>
<div class="cloud-fields full" id="vm-cloud-fields"><div class="form-grid vm-cloud-auth-fields"><div class="field full"><span class="ssh-key-picker-title">SSH 公钥(可选)</span><div id="vm-guest-ssh-key-cards" class="ssh-key-picker" role="group" aria-label="部署实例时选择 SSH 公钥">{if empty($cloud_deploy_ssh_keys)}<p class="muted">暂无公钥,可先到“公钥管理”添加。不选公钥也会生成强密码。</p>{else}{foreach $cloud_deploy_ssh_keys as $key}<button class="ssh-key-option" type="button" aria-pressed="false" data-key-id="{$key.id|escape:"html"}" aria-label="选择 SSH 公钥 {$key.name|escape:"html"},指纹 {$key.fingerprint|escape:"html"}"><i class="mdi mdi-key-variant ssh-key-choice-icon" aria-hidden="true"></i><span class="ssh-key-choice-copy"><strong class="ssh-key-choice-label">{$key.name|escape:"html"}</strong><small class="ssh-key-choice-fingerprint" title="{$key.fingerprint|escape:"html"}">{$key.fingerprint|escape:"html"}</small></span><span class="ssh-key-choice-check" aria-hidden="true">&#x2713;</span></button>{/foreach}{/if}</div><a id="vm-open-ssh-keys" class="ssh-key-picker-manage" href="/user/cloud/ssh-keys">管理我的公钥</a></div><div class="field full" id="vm-root-password-field"><label for="vm-root-password">初始 root 密码(可选)</label><input id="vm-root-password" name="root_password" type="password" maxlength="128" autocomplete="new-password" spellcheck="false" /><small>留空时生成 32 位完全随机密码;自行设置需为 12–128 位不含空格的英文可打印字符,包含大写、小写、数字和符号。</small></div></div></div>
</div>
</section>
<p id="create-error" class="form-error" role="alert" hidden></p>
</div>
<div class="workspace-form-actions"><button id="create-submit" class="button button-primary" type="submit" disabled>创建实例</button></div>
</form>
</section>
</div>
<script id="deploy-bootstrap" type="application/json">{$cloud_deploy_bootstrap_json nofilter}</script>