mirror of
https://github.com/cuigh/swirl
synced 2025-01-01 00:32:09 +00:00
92 lines
3.8 KiB
Go
92 lines
3.8 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">
|
|
<a class="button is-success" href="new"><span class="icon"><i class="fas fa-plus"></i></span><span>{{ i18n("button.new") }}</span></a>
|
|
</p>
|
|
</div>
|
|
</nav>
|
|
|
|
<table id="table-items" class="table is-bordered is-striped is-hoverable is-narrow is-fullwidth">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ i18n("field.name") }}</th>
|
|
<th>{{ i18n("field.image") }}</th>
|
|
<th width="145">Mode</th>
|
|
<th>{{ i18n("field.updated-at") }}</th>
|
|
<th width="190">{{ i18n("field.action") }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{range .Services}}
|
|
<tr>
|
|
<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)}}{{ if .UpdateStatus }}<span class="icon {{ if .UpdateStatus == "completed" }}has-text-success{{ else if .UpdateStatus == "updating" }}has-text-warning{{ else }}has-text-danger{{ end }} tooltip" data-tooltip="{{.UpdateStatus}}"><i class="fas fa-circle"></i></span>{{ end }}</td>
|
|
<td>
|
|
<a href="{{.Name}}/edit" class="button is-small is-dark is-outlined">{{ i18n("button.edit") }}</a>
|
|
<button class="button is-small is-danger is-outlined" data-action="delete-service">{{ i18n("button.delete") }}</button>
|
|
<div class="dropdown is-hoverable is-right">
|
|
<div class="dropdown-trigger">
|
|
<button class="button is-small" aria-haspopup="true" aria-controls="dropdown-menu-{{ .Name }}">
|
|
<span>{{ i18n("button.more") }}</span>
|
|
<span class="icon is-small">
|
|
<i class="fas fa-angle-down" aria-hidden="true"></i>
|
|
{*<i class="fas fa-ellipsis-v" aria-hidden="true"></i>*}
|
|
</span>
|
|
</button>
|
|
</div>
|
|
<div class="dropdown-menu" id="dropdown-menu-{{ .Name }}" role="menu">
|
|
<div class="dropdown-content">
|
|
{{if .Mode == "replicated" }}<a class="dropdown-item" data-action="scale-service" data-replicas="{{.Replicas}}">{{ i18n("button.scale") }}</a>{{end}}
|
|
{{if .Rollback }}<a class="dropdown-item" data-action="rollback-service">{{ i18n("button.rollback") }}</a>{{end}}
|
|
<a class="dropdown-item" data-action="restart-service">{{ i18n("button.restart") }}</a>
|
|
{*<a class="dropdown-item has-text-danger" data-action="delete-service">{{ i18n("button.delete") }}</a>*}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
{{ yield pager(info=.Pager) }}
|
|
</section>
|
|
{{ end }} |