98 lines
4.1 KiB
HTML
98 lines
4.1 KiB
HTML
{% extends 'tasks/base.html' %}
|
|
|
|
{% block content %}
|
|
<h1 class="mb-4">任务详情</h1>
|
|
|
|
<div class="card mb-4">
|
|
<div class="card-header">
|
|
<h5>{{ task.name }}</h5>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<p><strong>ID:</strong> {{ task.id }}</p>
|
|
<p><strong>指定客户端:</strong> {{ task.client_name|default:'未指定' }}</p>
|
|
<p><strong>实际执行客户端:</strong> {{ task.assigned_to|default:'未分配' }}</p>
|
|
<p><strong>状态:</strong>
|
|
<span class="badge bg-{{
|
|
'success' if task.status == 'success' else
|
|
'danger' if task.status in ['failed', 'timeout'] else
|
|
'warning' if task.status in ['assigned', 'running', 'retrying'] else
|
|
'info'
|
|
}}">
|
|
{{ task.get_status_display }}
|
|
</span>
|
|
</p>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<p><strong>创建时间:</strong> {{ task.created_at|date:'Y-m-d H:i:s' }}</p>
|
|
<p><strong>更新时间:</strong> {{ task.updated_at|date:'Y-m-d H:i:s' }}</p>
|
|
<p><strong>开始执行时间:</strong> {{ task.started_at|default:'未开始'|date:'Y-m-d H:i:s' }}</p>
|
|
<p><strong>完成时间:</strong> {{ task.completed_at|default:'未完成'|date:'Y-m-d H:i:s' }}</p>
|
|
<p><strong>超时时间:</strong> {{ task.timeout_seconds }} 秒</p>
|
|
</div>
|
|
</div>
|
|
|
|
{% if task.script %}
|
|
<div class="mt-4">
|
|
<h6>执行脚本:</h6>
|
|
<pre class="bg-light p-3 rounded">{{ task.script }}</pre>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<h2 class="mb-4">执行结果</h2>
|
|
|
|
<div class="card">
|
|
<div class="card-body">
|
|
{% if results %}
|
|
<table class="table table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>执行客户端</th>
|
|
<th>状态</th>
|
|
<th>执行消息</th>
|
|
<th>创建时间</th>
|
|
<th>结果文件</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for result in results %}
|
|
<tr>
|
|
<td>{{ result.id }}</td>
|
|
<td>{{ result.client.name }}</td>
|
|
<td>
|
|
<span class="badge bg-{{
|
|
'success' if result.status == 'success' else
|
|
'danger' if result.status in ['failed', 'timeout'] else
|
|
'warning' if result.status in ['assigned', 'running', 'retrying'] else
|
|
'info'
|
|
}}">
|
|
{{ result.get_status_display }}
|
|
</span>
|
|
</td>
|
|
<td>{{ result.message|default:'无消息' }}</td>
|
|
<td>{{ result.created_at|date:'Y-m-d H:i:s' }}</td>
|
|
<td>
|
|
{% if result.result_file %}
|
|
<a href="/api/task_results/{{ result.id }}/download/" class="btn btn-sm btn-success">下载</a>
|
|
{% else %}
|
|
无文件
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% else %}
|
|
<p class="text-center text-muted">暂无执行结果</p>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-4">
|
|
<a href="{% url 'task_list' %}" class="btn btn-secondary">返回任务列表</a>
|
|
</div>
|
|
{% endblock %} |