refactor(admin): redesign object cleanup debt workspace

go
codex 3 weeks ago
parent 56c5af7713
commit da03a61b1a

@ -784,35 +784,100 @@ body.os-drawer-open {
}
}
.os-debt-table {
overflow-x: auto;
.os-cleanup-legend {
display: flex;
flex-wrap: wrap;
gap: 10px 24px;
margin-bottom: 16px;
padding: 12px 14px;
border-radius: 10px;
color: #60758b;
background: #f4f8fa;
font-size: 12px;
line-height: 1.55;
}
.os-debt-table table {
width: 100%;
min-width: 780px;
border-collapse: collapse;
.os-cleanup-legend > span {
display: inline-flex;
align-items: center;
gap: 6px;
}
.os-debt-table th,
.os-debt-table td {
padding: 12px 10px;
border-bottom: 1px solid #e2e8f0;
text-align: left;
vertical-align: middle;
.os-cleanup-legend i {
color: #0f9fa8;
font-size: 17px;
}
.os-debt-table th {
color: #64748b;
font-size: 12px;
.os-cleanup-legend b {
color: #334b62;
}
.os-debt-table td {
color: #334155;
.os-debt-list {
overflow: hidden;
border: 1px solid #e0e9ee;
border-radius: 12px;
}
.os-debt-table tr:last-child td {
border-bottom: 0;
.os-debt-list-head,
.os-debt-row {
display: grid;
grid-template-columns: minmax(210px, 1.6fr) minmax(125px, 0.8fr) minmax(210px, 1.35fr) minmax(150px, 0.9fr) minmax(110px, 0.65fr);
gap: 14px;
align-items: center;
}
.os-debt-list-head {
padding: 11px 16px;
color: #7b8da0;
background: #f3f7f9;
font-size: 11px;
font-weight: 800;
letter-spacing: 0.02em;
}
.os-debt-row {
padding: 15px 16px;
border-top: 1px solid #e5ecef;
background: #fff;
}
.os-debt-cell {
display: grid;
gap: 5px;
min-width: 0;
}
.os-debt-cell strong {
overflow-wrap: anywhere;
color: #31495f;
font-size: 13px;
}
.os-debt-cell small {
overflow-wrap: anywhere;
color: #8192a4;
font-size: 11px;
line-height: 1.45;
}
.os-cell-label {
display: none;
color: #8495a7;
font-size: 10px;
font-weight: 800;
letter-spacing: 0.05em;
}
.os-debt-action {
justify-items: start;
}
.os-waiting-action {
display: inline-flex;
align-items: center;
gap: 5px;
color: #8293a5;
font-size: 12px;
}
.os-debt-state {
@ -927,4 +992,51 @@ body.os-drawer-open {
.os-drawer-footer .btn {
flex: 1 1 0;
}
.os-cleanup-legend {
display: grid;
}
.os-debt-list {
overflow: visible;
border: 0;
}
.os-debt-list-head {
display: none;
}
.os-debt-row {
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px 16px;
margin-bottom: 12px;
padding: 16px;
border: 1px solid #e0e9ee;
border-radius: 12px;
box-shadow: 0 7px 20px rgba(35, 61, 82, 0.04);
}
.os-debt-identity,
.os-debt-action {
grid-column: 1 / -1;
}
.os-cell-label {
display: block;
}
.os-debt-action .btn {
width: 100%;
}
}
@media (max-width: 480px) {
.os-debt-row {
grid-template-columns: 1fr;
}
.os-debt-identity,
.os-debt-action {
grid-column: auto;
}
}

@ -132,22 +132,21 @@
<div class="os-status-item"><span>占用空间</span><strong class="os-byte-value" data-bytes="{$cleanup_debt.summary.bytes}">{$cleanup_debt.summary.bytes} B</strong></div>
</div>
{if $cleanup_debt.items|@count > 0}
<div class="os-debt-table">
<table>
<thead><tr><th>备份</th><th>用户 / 实例</th><th>状态</th><th>删除代次</th><th>对象大小</th><th>操作</th></tr></thead>
<tbody>
{foreach $cleanup_debt.items as $item}
<tr>
<td><strong>#{$item.id} {$item.name|escape}</strong><div class="os-help">{$item.error_code|escape}</div></td>
<td>用户 #{$item.user_id}<div class="os-help">实例 #{$item.source_instance_id}</div></td>
<td><span class="os-debt-state {if $item.state == 'delete_attention'}is-attention{/if}">{if $item.state == 'delete_attention'}需人工处理{else}自动核对中{/if}</span></td>
<td>总计 {$item.delete_generation}<div class="os-help">本轮 {$item.cycle_attempts} / 3</div></td>
<td><span class="os-byte-value" data-bytes="{$item.object_size_bytes}">{$item.object_size_bytes} B</span></td>
<td>{if $item.can_retry}<button class="btn btn-sm btn-outline-danger os-cleanup-retry" type="button" data-backup-id="{$item.id}">手动重试</button>{else}<span class="os-help">等待系统核对</span>{/if}</td>
</tr>
{/foreach}
</tbody>
</table>
<div class="os-cleanup-legend" role="note">
<span><i class="mdi mdi-progress-clock"></i><b>自动核对中</b>系统按受限周期验证对象是否仍存在。</span>
<span><i class="mdi mdi-account-alert-outline"></i><b>需人工处理</b>当前周期已停止,管理员检查后才能重新进入稳定性核对。</span>
</div>
<div class="os-debt-list" role="list">
<div class="os-debt-list-head" aria-hidden="true"><span>备份对象</span><span>归属</span><span>清理状态</span><span>代次 / 大小</span><span>操作</span></div>
{foreach $cleanup_debt.items as $item}
<article class="os-debt-row" role="listitem">
<div class="os-debt-cell os-debt-identity"><span class="os-cell-label">备份对象</span><strong>#{$item.id} {$item.name|escape}</strong><small class="os-mono">{$item.error_code|escape}</small></div>
<div class="os-debt-cell"><span class="os-cell-label">归属</span><strong>用户 #{$item.user_id}</strong><small>实例 #{$item.source_instance_id}</small></div>
<div class="os-debt-cell"><span class="os-cell-label">清理状态</span><span class="os-debt-state {if $item.state == 'delete_attention'}is-attention{/if}">{if $item.state == 'delete_attention'}需人工处理{else}自动核对中{/if}</span><small>{if $item.state == 'delete_attention'}{if $item.attention_at}停止于 {$item.attention_at|date_format:'%Y-%m-%d %H:%M:%S'|escape}{else}等待管理员检查{/if}{else}{if $item.next_check_at}下次核对 {$item.next_check_at|date_format:'%Y-%m-%d %H:%M:%S'|escape}{else}等待调度{/if}{/if}</small></div>
<div class="os-debt-cell"><span class="os-cell-label">代次 / 大小</span><strong>总计 {$item.delete_generation} · 本轮 {$item.cycle_attempts} / 3</strong><small class="os-byte-value" data-bytes="{$item.object_size_bytes}">{$item.object_size_bytes} B</small></div>
<div class="os-debt-cell os-debt-action"><span class="os-cell-label">操作</span>{if $item.can_retry}<button class="btn btn-sm btn-outline-danger os-cleanup-retry" type="button" data-backup-id="{$item.id}">重新核对</button>{else}<span class="os-waiting-action"><i class="mdi mdi-lock-clock"></i>系统处理</span>{/if}</div>
</article>
{/foreach}
</div>
{if $cleanup_debt.pagination.total_pages > 1}
<div class="os-actions os-pagination">

@ -75,6 +75,10 @@ $assert(str_contains($template, "admin_title value='对象存储'")
&& str_contains($template, 'id="osConfigDrawer"')
&& str_contains($template, 'id="osReplaceCredentials"')
&& str_contains($template, '保存任何连接字段都会使当前验证失效')
&& str_contains($template, 'class="os-debt-list"')
&& str_contains($template, '$item.next_check_at')
&& str_contains($template, '$item.attention_at')
&& !str_contains($template, '<table>')
&& str_contains($template, '/cloud/admin-object-storage.css?v={$venix_asset_version}')
&& str_contains($template, '/cloud/admin-object-storage.js?v={$venix_asset_version}')
&& !str_contains($template, '<style>')

@ -43,7 +43,36 @@ $state = [
];
$cleanupDebt = [
'summary' => ['count' => 2, 'bytes' => 4096, 'attention_count' => 1],
'items' => [],
'items' => [
[
'id' => '31',
'name' => 'automatic-31',
'source_instance_id' => '41',
'user_id' => '5',
'state' => 'delete_uncertain',
'object_size_bytes' => 1024,
'delete_generation' => 1,
'cycle_attempts' => 1,
'next_check_at' => 1792877100,
'attention_at' => null,
'error_code' => 'delete_effect_unknown',
'can_retry' => false,
],
[
'id' => '32',
'name' => 'automatic-32',
'source_instance_id' => '42',
'user_id' => '6',
'state' => 'delete_attention',
'object_size_bytes' => 3072,
'delete_generation' => 2,
'cycle_attempts' => 3,
'next_check_at' => 0,
'attention_at' => 1792877200,
'error_code' => 'reconciliation_limit_reached',
'can_retry' => true,
],
],
'pagination' => [
'page' => 1,
'per_page' => 20,
@ -88,6 +117,11 @@ $assert($xpath->query('//*[@role="tab" and @data-os-tab]')->length === 2
&& $xpath->query('//*[@role="tabpanel" and @data-os-panel]')->length === 2
&& $one($xpath, '//*[@data-os-panel="cleanup"]')->hasAttribute('hidden'),
'Object-storage overview and cleanup workspaces are not accessible tabs.');
$assert($xpath->query('//*[@class="os-debt-list"]/*[@role="listitem"]')->length === 2
&& $xpath->query('//table')->length === 0
&& str_contains($html, '下次核对')
&& str_contains($html, '停止于'),
'Cleanup debt did not render its responsive state and scheduling list.');
$form = $one($xpath, '//form[@id="objectStorageForm"]');
$assert($form->getAttribute('action') === '/admin/object-storage/config'
&& $form->getAttribute('method') === 'post'

Loading…
Cancel
Save