Workload page: result hero, hide unavailable actions, confirm destructive ones

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TyAt5S5MAwLBY2idan1SwU
This commit is contained in:
claude committed 2026-10-11 11:55:32 +02:00
1 parent 7718d593f4
commit 236d69cfb8
2 files changed
+74 -13

No files matched your search

+32 -13
View File
@@ -5,6 +5,7 @@
{% block scripts %}
<link rel="stylesheet" href="{% static 'workload.css' %}?{{ static_version }}">
<link rel="stylesheet" href="{% static 'workload-refresh.css' %}?{{ static_version }}">
<script src="{% static 'copy_text.js' %}?{{ static_version }}"></script>
<script src="{% static 'llr_history.js' %}?{{ static_version }}" defer></script>
{% endblock %}
@@ -15,6 +16,24 @@
<div class="workload-container">
{% if type == "TEST" %}
{% with progress=workload|progress_info %}
<div id="summary" class="result-hero state-{{ workload|test_status }}">
<div class="statblock statblock-{{ workload|testResultColour }} state-{{ workload|test_status }}"><strong>{{ workload|shortStatBlock|linebreaksbr }}</strong></div>
{% if progress.gauge %}
<div class="result-hero-gauge">
<div class="llr llr-{{ progress.tone }}" role="meter" aria-label="LLR" aria-valuemin="{{ progress.lower }}" aria-valuemax="{{ progress.upper }}" aria-valuenow="{{ progress.llr }}">
<span class="llr-fill" style="left: {{ progress.left }}%; width: {{ progress.width }}%"></span>
<span class="llr-zero" style="left: {{ progress.zero }}%"></span>
</div>
<div class="llr-scale"><span>{{ progress.lower }}</span><b>LLR {{ progress.llr }}</b><span>{{ progress.upper }}</span></div>
</div>
{% endif %}
</div>
{% endwith %}
{% endif %}
<div id="config" class="card">
<header class="card-head"><h2 class="card-title">Configuration</h2></header>
<table class="test-config left-align wrappable">
@@ -83,25 +102,25 @@
{% elif not workload.approved and request.user.is_superuser %}
<a class="anchorbutton btn-blue" href="/{{type|lower}}/{{workload.id}}/APPROVE"><i class="fa-solid fa-check fa-fw"></i> Approve</a>
{% else %}
<span class="anchorbutton btn-disabled" aria-disabled="true"><i class="fa-solid fa-check fa-fw"></i> Approve</span>
{% endif %}
<!-- Restart Button: For Approvers or Workload Authors of finished workloads -->
{% if workload.finished and not workload.passed and not workload.failed and profile.approver %}
<a class="anchorbutton btn-yellow" href="/{{type|lower}}/{{workload.id}}/RESTART"><i class="fa-solid fa-rotate-right fa-fw"></i> Restart</a>
<a class="anchorbutton btn-yellow" href="/{{type|lower}}/{{workload.id}}/RESTART" onclick="return confirm('Restart this {{type|lower}}? Its results will be reset.')"><i class="fa-solid fa-rotate-right fa-fw"></i> Restart</a>
{% elif workload.finished and not workload.passed and not workload.failed and profile.user.username == workload.author %}
<a class="anchorbutton btn-yellow" href="/{{type|lower}}/{{workload.id}}/RESTART"><i class="fa-solid fa-rotate-right fa-fw"></i> Restart</a>
<a class="anchorbutton btn-yellow" href="/{{type|lower}}/{{workload.id}}/RESTART" onclick="return confirm('Restart this {{type|lower}}? Its results will be reset.')"><i class="fa-solid fa-rotate-right fa-fw"></i> Restart</a>
{% elif workload.finished %}
<span class="anchorbutton btn-disabled" aria-disabled="true"><i class="fa-solid fa-rotate-right fa-fw"></i> Restart</span>
{% endif %}
<!-- Stop Button: For Approvers or Workload Authors of active workloads -->
{% if not workload.finished and profile.approver %}
<a class="anchorbutton btn-yellow" href="/{{type|lower}}/{{workload.id}}/STOP"><i class="fa-solid fa-stop fa-fw"></i> Stop</a>
<a class="anchorbutton btn-yellow" href="/{{type|lower}}/{{workload.id}}/STOP" onclick="return confirm('Stop this {{type|lower}}?')"><i class="fa-solid fa-stop fa-fw"></i> Stop</a>
{% elif not workload.finished and profile.user.username == workload.author %}
<a class="anchorbutton btn-yellow" href="/{{type|lower}}/{{workload.id}}/STOP"><i class="fa-solid fa-stop fa-fw"></i> Stop</a>
<a class="anchorbutton btn-yellow" href="/{{type|lower}}/{{workload.id}}/STOP" onclick="return confirm('Stop this {{type|lower}}?')"><i class="fa-solid fa-stop fa-fw"></i> Stop</a>
{% elif not workload.finished %}
<span class="anchorbutton btn-disabled" aria-disabled="true"><i class="fa-solid fa-stop fa-fw"></i> Stop</span>
{% endif %}
<!-- Delete/Restore Button: For Approvers or Workload Authors -->
@@ -109,13 +128,13 @@
{% if workload.deleted %}
<a class="anchorbutton btn-preset" href="/{{type|lower}}/{{workload.id}}/RESTORE"><i class="fa-solid fa-rotate-left fa-fw"></i> Restore</a>
{% else %}
<a class="anchorbutton btn-red" href="/{{type|lower}}/{{workload.id}}/DELETE"><i class="fa-solid fa-trash-can fa-fw"></i> Delete</a>
<a class="anchorbutton btn-red" href="/{{type|lower}}/{{workload.id}}/DELETE" onclick="return confirm('Delete this {{type|lower}}?')"><i class="fa-solid fa-trash-can fa-fw"></i> Delete</a>
{% endif %}
{% else %}
{% if workload.deleted %}
<span class="anchorbutton btn-disabled" aria-disabled="true"><i class="fa-solid fa-rotate-left fa-fw"></i> Restore</span>
{% else %}
<span class="anchorbutton btn-disabled" aria-disabled="true"><i class="fa-solid fa-trash-can fa-fw"></i> Delete</span>
{% endif %}
{% endif %}
</div>
@@ -174,18 +193,18 @@
<div class="row">
<label for="priority">Priority</label>
<input value="{{workload.priority}}" id="priority" name="priority">
<input value="{{workload.priority}}" id="priority" name="priority" inputmode="numeric">
</div>
<div class="row">
<label for="throughput">Throughput</label>
<input value="{{workload.throughput}}" id="throughput" name="throughput">
<input value="{{workload.throughput}}" id="throughput" name="throughput" inputmode="numeric">
</div>
{% if type == "TEST" or type == "DATAGEN" %}
<div class="row">
<label for="workload_size">Workload Size</label>
<input value="{{workload.workload_size}}" id="workload_size" name="workload_size">
<input value="{{workload.workload_size}}" id="workload_size" name="workload_size" inputmode="numeric">
</div>
{% endif %}