Files

92 lines
3.5 KiB
HTML

<!doctype html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="refresh" content="5">
<title>jellybit</title>
<style>
:root { color-scheme: light dark; }
body { font-family: system-ui, sans-serif; max-width: 60rem; margin: 2rem auto; padding: 0 1rem; }
h1 { margin-bottom: .25rem; }
form.add { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
form.add input[name=source] { flex: 1 1 24rem; }
input, button { padding: .4rem .6rem; font-size: 1rem; }
table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
th, td { text-align: left; padding: .4rem .5rem; border-bottom: 1px solid #8884; vertical-align: top; }
td.src { font-family: monospace; font-size: .85rem; word-break: break-all; }
.err { color: #c0392b; }
.state { font-size: .8rem; padding: .1rem .5rem; border-radius: 1rem; background: #8883; white-space: nowrap; }
.state-completed { background: #2ecc7155; }
.state-downloading { background: #3498db55; }
.state-recognizing { background: #9b59b655; }
.state-review { background: #f1c40f88; }
.state-deferred { background: #f39c1255; }
.state-linking { background: #1abc9c55; }
.state-done { background: #2ecc7188; }
.state-stuck { background: #f39c1255; }
.state-failed { background: #e74c3c55; }
.state-cancelled { background: #95a5a655; }
.state-reverted { background: #95a5a655; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; }
a.button { display: inline-block; padding: .35rem .6rem; border: 1px solid #8886; border-radius: .3rem; text-decoration: none; }
small { color: #8888; }
</style>
</head>
<body>
<h1>jellybit</h1>
<p><small>обновляется каждые 5 с</small></p>
<form class="add" method="post" action="/ui/downloads">
<input type="text" name="source" placeholder="magnet:?xt=urn:btih:…" required>
<input type="text" name="context" placeholder="контекст (опц.)">
<button type="submit">Добавить</button>
</form>
{{if .Error}}<p class="err">{{.Error}}</p>{{end}}
<table>
<thead>
<tr><th>#</th><th>Источник</th><th>Контекст</th><th>Состояние</th><th></th></tr>
</thead>
<tbody>
{{range .Downloads}}
<tr>
<td>{{.ID}}</td>
<td class="src" title="{{.Infohash}}">{{.Source}}</td>
<td>{{.Context}}</td>
<td>
<span class="state state-{{.State}}">{{.State}}</span>
{{if .Error}}<br><small>{{.Error}}</small>{{end}}
</td>
<td>
<div class="actions">
{{if .Reviewable}}
<a class="button" href="/review/{{.ID}}">Ревью →</a>
{{end}}
{{if .Undoable}}
<form method="post" action="/ui/downloads/{{.ID}}/undo">
<button type="submit">Откатить</button>
</form>
{{end}}
{{if .Relinkable}}
<form method="post" action="/ui/downloads/{{.ID}}/relink">
<button type="submit">Привязать заново</button>
</form>
{{end}}
{{if not .Terminal}}
<form method="post" action="/ui/downloads/{{.ID}}/cancel">
<button type="submit">Отклонить</button>
</form>
{{end}}
</div>
</td>
</tr>
{{else}}
<tr><td colspan="5"><small>пока пусто</small></td></tr>
{{end}}
</tbody>
</table>
</body>
</html>