构建列表操作按钮修正:成功任务不再显示重试,统一操作列排版
- 成功状态的构建记录不再显示「重试」按钮,仅保留下载产物/日志/删除; 失败、取消、超时仍保留一键重试(线上核对确认仅新快照成功任务误显示) - retry_build 后端增加 success 状态拦截,防止绕过页面直接 POST - 操作列改为统一 flex 容器(flex-wrap + gap),按钮数量随状态变化时 间距一致、左对齐、窄屏自动换行;后台任务管理页同款统一
This commit is contained in:
@@ -396,6 +396,14 @@ input[type="file"].form-control::-webkit-file-upload-button {
|
|||||||
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
|
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
|
||||||
.inline-form { display: inline-flex; vertical-align: middle; }
|
.inline-form { display: inline-flex; vertical-align: middle; }
|
||||||
.table .btn + .btn, .table .btn + .inline-form { margin-left: 8px; }
|
.table .btn + .btn, .table .btn + .inline-form { margin-left: 8px; }
|
||||||
|
/* 表格操作列:按钮数量随任务状态变化,用单一 flex 容器统一间距与换行,
|
||||||
|
避免各行 2~4 个按钮时排列参差 */
|
||||||
|
.col-actions { min-width: 168px; }
|
||||||
|
.table .row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
|
||||||
|
.table .row-actions > .btn,
|
||||||
|
.table .row-actions > .inline-form { margin-left: 0; }
|
||||||
|
.table .row-actions .inline-form { margin: 0; }
|
||||||
|
.table .row-actions .btn { white-space: nowrap; }
|
||||||
|
|
||||||
/* ===== 平台选择卡 ===== */
|
/* ===== 平台选择卡 ===== */
|
||||||
.platform-grid {
|
.platform-grid {
|
||||||
|
|||||||
@@ -49,7 +49,8 @@
|
|||||||
<td>{{ run.platform_label }}</td>
|
<td>{{ run.platform_label }}</td>
|
||||||
<td><span class="badge {{ run.status_badge }} {% if not run.is_finished %}badge-dot{% endif %}">{{ run.status_label }}</span></td>
|
<td><span class="badge {{ run.status_badge }} {% if not run.is_finished %}badge-dot{% endif %}">{{ run.status_label }}</span></td>
|
||||||
<td class="mono text-muted">{{ run.short_uuid }}</td>
|
<td class="mono text-muted">{{ run.short_uuid }}</td>
|
||||||
<td style="white-space:nowrap">
|
<td class="col-actions">
|
||||||
|
<div class="row-actions">
|
||||||
<a class="btn btn-secondary btn-sm"
|
<a class="btn btn-secondary btn-sm"
|
||||||
href="/check_for_file?filename={{ run.filename|urlencode }}&uuid={{ run.uuid|urlencode }}&platform={{ run.platform|urlencode }}">查看</a>
|
href="/check_for_file?filename={{ run.filename|urlencode }}&uuid={{ run.uuid|urlencode }}&platform={{ run.platform|urlencode }}">查看</a>
|
||||||
<form method="post" class="inline-form" action="{% url 'delete_build' run.id %}"
|
<form method="post" class="inline-form" action="{% url 'delete_build' run.id %}"
|
||||||
@@ -59,6 +60,7 @@
|
|||||||
<svg class="icon"><use href="#i-trash"/></svg> 删除
|
<svg class="icon"><use href="#i-trash"/></svg> 删除
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -32,7 +32,8 @@
|
|||||||
<td><span class="badge {{ run.backend_badge_class }}">{{ run.backend_label }}</span></td>
|
<td><span class="badge {{ run.backend_badge_class }}">{{ run.backend_label }}</span></td>
|
||||||
<td><span class="badge {{ run.status_badge }} {% if not run.is_finished %}badge-dot{% endif %}">{{ run.status_label }}</span></td>
|
<td><span class="badge {{ run.status_badge }} {% if not run.is_finished %}badge-dot{% endif %}">{{ run.status_label }}</span></td>
|
||||||
<td class="mono text-muted">{{ run.short_uuid }}</td>
|
<td class="mono text-muted">{{ run.short_uuid }}</td>
|
||||||
<td style="white-space:nowrap">
|
<td class="col-actions">
|
||||||
|
<div class="row-actions">
|
||||||
<a class="btn btn-secondary btn-sm"
|
<a class="btn btn-secondary btn-sm"
|
||||||
href="/check_for_file?filename={{ run.filename|urlencode }}&uuid={{ run.uuid|urlencode }}&platform={{ run.platform|urlencode }}">
|
href="/check_for_file?filename={{ run.filename|urlencode }}&uuid={{ run.uuid|urlencode }}&platform={{ run.platform|urlencode }}">
|
||||||
{% if run.status == 'success' %}<svg class="icon"><use href="#i-download"/></svg> 下载产物{% elif run.is_finished %}<svg class="icon"><use href="#i-eye"/></svg> 查看详情{% else %}<svg class="icon"><use href="#i-eye"/></svg> 查看进度{% endif %}
|
{% if run.status == 'success' %}<svg class="icon"><use href="#i-download"/></svg> 下载产物{% elif run.is_finished %}<svg class="icon"><use href="#i-eye"/></svg> 查看详情{% else %}<svg class="icon"><use href="#i-eye"/></svg> 查看进度{% endif %}
|
||||||
@@ -42,7 +43,7 @@
|
|||||||
<svg class="icon"><use href="#i-external"/></svg> 日志
|
<svg class="icon"><use href="#i-external"/></svg> 日志
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if run.is_finished and run.config_data %}
|
{% if run.is_finished and run.status != 'success' and run.config_data %}
|
||||||
<form method="post" class="inline-form" action="{% url 'retry_build' run.id %}"
|
<form method="post" class="inline-form" action="{% url 'retry_build' run.id %}"
|
||||||
onsubmit="return confirm('将使用该任务的原始配置重新提交一次构建(原任务记录保留),是否继续?');">
|
onsubmit="return confirm('将使用该任务的原始配置重新提交一次构建(原任务记录保留),是否继续?');">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
@@ -69,6 +70,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -93,6 +93,9 @@ def retry_build(request, run_id):
|
|||||||
if not run.is_finished():
|
if not run.is_finished():
|
||||||
messages.error(request, "该任务尚未结束,无需重试。")
|
messages.error(request, "该任务尚未结束,无需重试。")
|
||||||
return redirect('my_builds')
|
return redirect('my_builds')
|
||||||
|
if run.status == 'success':
|
||||||
|
messages.info(request, "该任务已构建成功,请直接下载产物;如需重新生成请重新提交配置。")
|
||||||
|
return redirect('my_builds')
|
||||||
if not run.config_data:
|
if not run.config_data:
|
||||||
messages.error(request, "该任务提交时未保存配置快照(较早的历史任务),无法一键重试,请重新填写配置后提交。")
|
messages.error(request, "该任务提交时未保存配置快照(较早的历史任务),无法一键重试,请重新填写配置后提交。")
|
||||||
return redirect('my_builds')
|
return redirect('my_builds')
|
||||||
|
|||||||
Reference in New Issue
Block a user