swirl/views/node/list.jet
2018-04-23 16:36:19 +08:00

62 lines
2.1 KiB
Go

{{ extends "../_layouts/default" }}
{{ block script() }}
<script>$(() => new Swirl.Node.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 is-uppercase">{{ i18n("node.title") }}</h1>
<h2 class="subtitle is-5">{{ i18n("node.description") }}</h2>
</div>
</div>
</section>
<section class="section">
<nav class="level">
<!-- Left side -->
<div class="level-left">
<div class="level-item">
<p class="subtitle is-5">
<strong>{{len(.Nodes)}}</strong>
<span class="is-lowercase">{{ i18n("menu.node") }}</span>
</p>
</div>
</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>Role</th>
<th>Version</th>
<th>CPU</th>
<th>Memory</th>
<th>{{ i18n("field.address") }}</th>
<th>{{ i18n("field.status") }}</th>
<th>{{ i18n("field.action") }}</th>
</tr>
</thead>
<tbody>
{{range .Nodes}}
<tr>
<td><a href="{{.ID}}/detail">{{.Name}}</a></td>
<td>{{.Role}}{{ if .Role == "manager" && .Leader }}<span class="icon has-text-danger tooltip" data-tooltip="Leader"><i class="fas fa-flag"></i></span>{{ end }}</td>
<td>{{.Version}}</td>
<td>{{.CPU}}</td>
<td>{{printf("%.2f", .Memory)}} GB</td>
<td>{{.Address}}</td>
<td><span class="tag is-{{.Status == "ready" ? "success" : (.Status == "down" ? "danger" : "warning")}}">{{.Status}}</span></td>
<td>
<a href="{{.ID}}/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-node" value="{{.ID}}">{{ i18n("button.delete") }}</button>
</td>
</tr>
{{end}}
</tbody>
</table>
</section>
{{ end }}