swirl/views/node/edit.jet
2018-03-16 16:50:03 +08:00

80 lines
2.9 KiB
Go

{{ extends "../_layouts/default" }}
{{ import "../_modules/form" }}
{{ block script() }}
<script>$(() => new Swirl.Node.EditPage())</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>
<div class="container">
<nav class="breadcrumb has-succeeds-separator is-small is-marginless" aria-label="breadcrumbs">
<ul>
<li><a href="/">{{ i18n("menu.home") }}</a></li>
<li><a href="/node/">{{ i18n("menu.node") }}</a></li>
<li class="is-active"><a>{{ i18n("menu.edit") }}</a></li>
</ul>
</nav>
</div>
<section class="hero is-small is-light">
<div class="hero-body">
<div class="container">
<h2 class="title is-2">
{{ .Node.Spec.Name ? .Node.Spec.Name : (.Node.Description.Hostname ? .Node.Description.Hostname : .Node.ID) }}
</h2>
</div>
</div>
</section>
<nav class="navbar has-shadow">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item is-tab" href="/node/{{.Node.ID}}/detail">{{ i18n("menu.detail") }}</a>
<a class="navbar-item is-tab" href="/node/{{.Node.ID}}/raw">{{ i18n("menu.raw") }}</a>
<a class="navbar-item is-tab is-active" href="/node/{{.Node.ID}}/edit">{{ i18n("menu.edit") }}</a>
</div>
</div>
</nav>
<section class="section">
<div class="container">
<form method="post" action="update" data-form="ajax-json" data-url="/node/">
<input name="version" value="{{ .Node.Version.Index }}" data-type="integer" type="hidden">
<div class="field">
<label class="label">{{ i18n("field.name") }}</label>
<div class="control">
<input name="name" value="{{ .Node.Spec.Name }}" class="input" placeholder="">
</div>
</div>
<div class="field">
<label class="label">Role</label>
<div class="control">
{{ yield radio(name="role", value="worker", label="Worker", checked=.Node.Spec.Role) }}
{{ yield radio(name="role", value="manager", label="Manager", checked=.Node.Spec.Role) }}
</div>
</div>
<div class="field">
<label class="label">Availability</label>
<div class="control">
{{ yield radio(name="availability", value="active", label="Active", checked=.Node.Spec.Availability) }}
{{ yield radio(name="availability", value="pause", label="Pause", checked=.Node.Spec.Availability) }}
{{ yield radio(name="availability", value="drain", label="Drain", checked=.Node.Spec.Availability) }}
</div>
</div>
<fieldset>
<legend class="lead is-5">Labels</legend>
{{ yield options(name="label", items=.Node.Spec.Labels) }}
</fieldset>
{{ yield form_submit(url="/node/") }}
</form>
</div>
</section>
{{ end }}