wolbodge/index.tmpl

85 lines
2.6 KiB
Cheetah

<!DOCTYPE html>
<html lang="">
<head>
<meta charset="UTF-8" />
<title>WoLBodge</title>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="description" content="" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css">
</head>
<body>
<nav class="container-fluid">
<ul>
<li>
<strong>WoLBodge</strong>
</li>
</ul>
<ul>
<li>
<a href="https://git.1e99.eu/1e99/wolbodge/">Source</a>
</li>
</ul>
</nav>
<main class="container">
<article>
<header>Status</header>
<p>
{{ if .DeviceStatus }}
On
{{ else }}
Off
{{ end }}
</p>
</article>
<article>
<header>Start a new session</header>
<form method="post" action="/start_session" enctype="multipart/form-data">
<label>
Description
<input type="text" name="description" placeholder="e.g. Maintenance" />
</label>
<input type="submit" value="Start session"/>
</form>
</article>
<h2>Active sessions</h2>
<div class="overflow-auto">
<table>
<thead>
<tr>
<th style="width: 10%">ID</th>
<th style="width: 50%">Description</th>
<th style="width: 20%">Created at</th>
<th style="width: 25%">Exists for</th>
<th style="width: 15%">Actions</th>
</tr>
</thead>
<tbody>
{{ range $session := .Sessions }}
<tr>
<td>{{ $session.Id }}</td>
<td>{{ $session.Description }}</td>
<td>{{ $session.CreatedAt.Format "02.01.2006 15:04:05" }}</td>
<td>{{ $session.ExistsFor.Round 1000000000 }}</td> {{/* 1 second */}}
<td>
<form method="post" action="/end_session" enctype="multipart/form-data">
<input type="hidden" name="session_id" value="{{ $session.Id }}">
<input type="submit" value="End" class="secondary">
</form>
</td>
</tr>
{{ end }}
</tbody>
</table>
</div>
</main>
</body>
</html>