swirl/views/node/list.jet

65 lines
2.0 KiB
Go
Raw Normal View History

2017-09-26 12:50:09 +00:00
{{ 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">
NODE
</h1>
<h2 class="subtitle is-5">
Nodes are instances of the Engine participating in a swarm.
</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> nodes
</p>
</div>
</div>
</nav>
<table id="table-items" class="table is-bordered is-striped is-narrow is-fullwidth">
<thead>
<tr>
<th>Name</th>
<th>Role</th>
<th>Version</th>
<th>CPU</th>
<th>Memory</th>
<th>Address</th>
<th>Status</th>
<th>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="fa 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">Edit</a>
<button class="button is-small is-danger is-outlined" data-action="delete-node" value="{{.ID}}">Delete</button>
</td>
</tr>
{{end}}
</tbody>
</table>
</section>
{{ end }}