swirl/views/container/list.jet
2017-10-10 16:26:53 +08:00

96 lines
2.7 KiB
Go

{{ extends "../_layouts/default" }}
{{ import "../_modules/pager" }}
{{ block script() }}
<script>$(() => new Swirl.Container.ListPage())</script>
{{ end }}
{{ block body() }}
<section class="hero is-info">
<div class="hero-body">
<div class="container has-text-centered">
<h1 class="title is-2">
CONTAINER
</h1>
<h2 class="subtitle is-5">
A container is a running instance of image.
</h2>
</div>
</div>
</section>
<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="name" value="{{.Name}}" class="input" placeholder="Search by name">
</p>
<p class="control">
<button class="button is-primary">Search</button>
</p>
</div>
</form>
</div>
<div class="level-item">
<p class="subtitle is-5">
<strong>{{.Pager.Count}}</strong> containers
</p>
</div>
</div>
<!-- Right side -->
<div class="level-right">
<p class="level-item">
{{if .Filter == ""}}
<strong>All</strong>
{{else}}
<a href="/container/">All</a>
{{end}}
</p>
<p class="level-item">
{{if .Filter == "running"}}
<strong>Running</strong>
{{else}}
<a href="?filter=running">Running</a>
{{end}}
</p>
<p class="level-item">
<button id="btn-delete" class="button is-danger"><span class="icon"><i class="fa fa-remove"></i></span><span>Delete</span></button>
</p>
</div>
</nav>
<table id="table-items" class="table is-bordered is-striped is-narrow is-fullwidth">
<thead>
<tr>
<th width="30"><input type="checkbox" data-action="check-all"></th>
<th>Name</th>
<th>Image</th>
<th>State</th>
<th>Created</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{{range .Containers}}
<tr>
<td><input type="checkbox" value="{{.ID}}" data-action="check"></td>
<td><a href="{{.ID}}/detail">{{ limit(.Names[0], 36)}}</a></td>
<td>{{ limit(.Image, 50) }}</td>
<td><span class="tag is-{{ .State == "running" ? "success" : "danger" }}">{{ .State }}</span></td>
<td>{{ time(.CreatedAt) }}</td>
<td>
<div class="field has-addons">
<p class="control"><button class="button is-small is-danger is-outlined" data-action="delete-container">Delete</button></p>
</div>
</td>
</tr>
{{end}}
</tbody>
</table>
{{ yield pager(info=.Pager) }}
</section>
{{ end }}