swirl/views/stack/list.jet
2018-04-28 15:27:32 +08:00

120 lines
4.0 KiB
Go

{{ extends "../_layouts/default" }}
{{ block script() }}
<script>$(() => new Swirl.Stack.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("stack.title") }}</h1>
<h2 class="subtitle is-5">{{ i18n("stack.description") }}</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" type="text" placeholder="Search by name">
</p>
<p class="control">
<button type="submit" class="button is-primary">{{ i18n("button.search") }}</button>
</p>
</div>
</form>
</div>
<div class="level-item">
<p class="subtitle is-5">
<strong>{{len(.Stacks)}}</strong>
<span class="is-lowercase">{{ i18n("menu.stack") }}</span>
</p>
</div>
</div>
<!-- Right side -->
<div class="level-right">
<p class="level-item">
{{if .Filter == ""}}
<strong>All</strong>
{{else}}
<a href="/stack/">All</a>
{{end}}
</p>
<p class="level-item">
{{if .Filter == "up"}}
<strong>Up</strong>
{{else}}
<a href="?filter=up">Up</a>
{{end}}
</p>
<p class="level-item">
{{if .Filter == "internal"}}
<strong>Internal</strong>
{{else}}
<a href="?filter=internal">Internal</a>
{{end}}
</p>
<p class="level-item">
{{if .Filter == "external"}}
<strong>External</strong>
{{else}}
<a href="?filter=external">External</a>
{{end}}
</p>
<p class="level-item">
<a href="new" class="button is-success"><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>Services</th>
<th>{{ i18n("field.created-at") }}</th>
<th>{{ i18n("field.updated-at") }}</th>
<th>{{ i18n("field.action") }}</th>
</tr>
</thead>
<tbody>
{{range .Stacks}}
<tr>
<td>
{{ if .Internal }}
<a href="{{.Name}}/detail">{{.Name}}</a>
{{ else }}
{{.Name}}<span class="icon has-text-danger tooltip is-tooltip-right" data-tooltip="External stack, can't be edited by Swirl"><i class="fas fa-exclamation-circle"></i></span>
{{ end }}
</td>
<td>
<div class="tags">
{{range .Services}}
<a href="/service/{{.}}/detail" class="tag is-success">{{.}}</a>
{{end}}
</div>
</td>
<td>{{time(.CreatedAt)}}</td>
<td>{{time(.UpdatedAt)}}</td>
<td>
{{ if .Internal }}
<a href="{{ .Name }}/edit" class="button is-small is-dark is-outlined">{{ i18n("button.edit") }}</a>
<button class="button is-small is-info is-outlined" data-action="deploy-stack">{{ i18n("stack.button.deploy") }}</button>
{{ end }}
{{ if .Services }}
<button class="button is-small is-danger is-outlined" data-action="shutdown-stack">{{ i18n("stack.button.shutdown") }}</button>
{{ end }}
{{ if .Internal }}
<button class="button is-small is-danger is-outlined" data-action="delete-stack">{{ i18n("button.delete") }}</button>
{{ end }}
</td>
</tr>
{{end}}
</tbody>
</table>
</section>
{{ end }}