swirl/views/service/list.jet
2017-10-26 16:16:51 +08:00

91 lines
3.6 KiB
Go

{{ extends "_base" }}
{{ import "../_modules/pager" }}
{{ block script() }}
<script>$(() => new Swirl.Service.ListPage())</script>
{{ end }}
{{ 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="name" value="{{.Name}}" class="input" placeholder="Search by name">
</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.service") }}</span>
</p>
</div>
</div>
<!-- Right side -->
<div class="level-right">
<p class="level-item">
<button id="btn-delete" class="button is-danger"><span class="icon"><i class="fa fa-remove"></i></span><span>{{ i18n("button.delete") }}</span></button>
</p>
<p class="level-item">
<a class="button is-success" href="new"><span class="icon"><i class="fa fa-plus"></i></span><span>{{ i18n("button.new") }}</span></a>
</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>{{ i18n("field.name") }}</th>
<th>{{ i18n("field.image") }}</th>
<th width="145">Mode</th>
<th>{{ i18n("field.updated-at") }}</th>
<th width="140">{{ i18n("field.action") }}</th>
</tr>
</thead>
<tbody>
{{range .Services}}
<tr>
<td><input type="checkbox" value="{{.Name}}" data-action="check"></td>
<td><a href="{{.Name}}/detail">{{.Name}}</a></td>
<td>{{ limit(.Image, 60) }}</td>
<td>
<div class="tags has-addons">
<span class="tag is-{{.Mode == "replicated" ? "info" : "dark"}}">{{.Mode}}</span>
<span class="tag is-{{.Actives == 0 ? "danger" : (.Actives < .Replicas ? "warning" : "success")}}">{{.Actives}}/{{.Replicas}}</span>
</div>
</td>
<td>{{time(.UpdatedAt)}}</td>
<td>
<a href="{{.Name}}/edit" class="button is-small is-dark is-outlined tooltip is-tooltip-bottom" data-tooltip="{{ i18n("button.edit") }}">
<span class="icon"><i class="fa fa-edit"></i></span>
</a>
{{if .Mode == "replicated"}}
<button type="button" class="button is-small is-info is-outlined tooltip is-tooltip-bottom" data-tooltip="{{ i18n("button.scale") }}" data-action="scale-service" data-replicas="{{.Replicas}}">
<span class="icon"><i class="fa fa-arrows"></i></span>
</button>
{{end}}
{{if .Rollback }}
<button type="button" class="button is-small is-info is-outlined tooltip is-tooltip-bottom" data-tooltip="{{ i18n("button.rollback") }}" data-action="rollback-service">
<span class="icon"><i class="fa fa-history"></i></span>
</button>
{{end}}
<button class="button is-small is-danger is-outlined tooltip is-tooltip-bottom" data-tooltip="{{ i18n("button.delete") }}" data-action="delete-service">
<span class="icon"><i class="fa fa-remove"></i></span>
</button>
</td>
</tr>
{{end}}
</tbody>
</table>
{{ yield pager(info=.Pager) }}
</section>
{{ end }}