{{define "tasks"}}
<div class="card" id="tasks-container">
  <h2>执行历史</h2>
  <div class="table-wrap" style="margin-top:10px">
    <table>
      <thead>
        <tr><th>任务</th><th>类型</th><th>设备数</th><th>状态</th><th>创建时间</th><th>完成时间</th></tr>
      </thead>
      <tbody>
        {{range .Tasks}}
        <tr>
          <td>
            <div><a class="mono" href="/ui/tasks/{{.ID}}">{{shortID .ID}}</a></div>
            <div class="muted small">{{taskActionLabel .Type}}</div>
          </td>
          <td>
            <span class="{{taskGroupClass .Type}}">{{taskGroupLabel .Type}}</span>
          </td>
          <td>{{len .DeviceIDs}} 台</td>
          <td>
            <span class="{{taskStatusClass .Status}}">{{taskStatusLabel .Status}}</span>
          </td>
          <td class="muted small">{{.CreatedAt}}</td>
          <td class="muted small">{{.CompletedAt}}</td>
        </tr>
        {{else}}
        <tr>
          <td colspan="4" class="muted">还没有批量任务。从设备页选择设备后发起操作，这里会展示执行记录。</td>
        </tr>
        {{end}}
      </tbody>
    </table>
  </div>
</div>
{{end}}
