swirl/views/task/list.jet
2021-02-26 13:32:05 +08:00

73 lines
2.2 KiB
Go

{{ extends "base" }}
{{ import "../_modules/pager" }}
{{ block body_content() }}
<section class="section">
<nav class="level">
<!-- Left side -->
<div class="level-left">
<div class="level-item">
<form>
<div class="field has-addons">
<p class="control">
<input name="service" value="{{ .Args.Service }}" class="input" placeholder="Search by service">
</p>
<p class="control">
<button class="button is-primary">{{ i18n("button.search") }}</button>
</p>
</div>
</form>
</div>
<div class="level-item">
<p class="subtitle is-5">
<strong>{{.Pager.Count}}</strong>
<span class="is-lowercase">{{ i18n("menu.task") }}</span>
</p>
</div>
</div>
<!-- Right side -->
<div class="level-right">
<p class="level-item">
{{if .Args.State == ""}}
<strong>All</strong>
{{else}}
<a href="/task/">All</a>
{{end}}
</p>
<p class="level-item">
{{if .Args.State == "running"}}
<strong>Running</strong>
{{else}}
<a href="?state=running">Running</a>
{{end}}
</p>
</div>
</nav>
<table id="table-items" class="table is-bordered is-striped is-hoverable is-narrow is-fullwidth">
<thead>
<tr>
<th>{{ i18n("field.id") }}</th>
<th>Service</th>
<th>{{ i18n("field.image") }}</th>
<th>Node</th>
<th>{{ i18n("field.state") }}</th>
<th>{{ i18n("field.created-at") }}</th>
</tr>
</thead>
<tbody>
{{range .Tasks}}
<tr>
<td><a href="{{ .ID }}/detail">{{ .ID }}</a></td>
<td><a href="/service/{{ .ServiceID }}/detail">{{ .ServiceID }}</a></td>
<td>{{ limit(.Image, 50) }}</td>
<td><a href="/node/{{ .NodeID }}/detail">{{ .NodeName }}</a></td>
<td><span class="tag is-{{ .Status.State == "running" ? "success" : "danger" }}">{{ .Status.State }}</span></td>
<td>{{ time(.CreatedAt) }}</td>
</tr>
{{end}}
</tbody>
</table>
{{ yield pager(info=.Pager) }}
</section>
{{ end }}