Files
decent-webui/internal/admin/tpl/partials_items.html
jbergner b7729e8b39
All checks were successful
release-tag / release-image (push) Successful in 1m52s
Test-1
2025-09-29 23:08:34 +02:00

101 lines
3.6 KiB
HTML

<div class="row">
<div style="flex: 1 1 360px">
<form hx-post="/admin/items/create" hx-target="#items" hx-swap="outerHTML">
<label>Neue leere Datei (nur Metadaten)</label>
<div style="display:flex; gap:8px; margin-top:6px">
<input type="text" name="name" placeholder="z.B. notes.txt" required>
<button class="btn" type="submit">Anlegen</button>
</div>
</form>
</div>
<div style="flex: 1 1 360px">
<form action="/admin/files/upload" method="post" enctype="multipart/form-data">
<label>Datei hochladen</label>
<div style="display:flex; gap:8px; margin-top:6px">
<input type="file" name="file" required>
<input type="text" name="name" placeholder="Name (optional)">
<button class="btn btn-primary" type="submit">Upload</button>
</div>
</form>
</div>
</div>
<div id="items" style="margin-top:14px">
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Updated</th>
<th>Blob</th>
<th>Owner</th>
<th>Status</th>
<th style="width:320px">Aktionen</th>
</tr>
</thead>
<tbody>
{{ range .Items }}
<tr>
<td><code style="font-size:12px">{{ .ID }}</code></td>
<td>{{ .Name }}</td>
<td><small class="muted">{{ printf "%.19s" (timeRFC3339 .UpdatedAt) }}</small></td>
<td>
{{ if .HasBlob }}
<span class="pill">vorhanden</span>
<small class="muted">{{ .Size }} B</small>
{{ else }}
<span class="pill" style="background:#3a0b0b;border-color:#5b1a1a;color:#fbb;">fehlt</span>
{{ end }}
</td>
<td><small class="muted">{{ .Owner }}</small></td>
<td>
{{ if .OwnerActive }}
<span class="pill">online</span>
{{ else }}
<span class="pill" style="background:#5b1a1a;border-color:#7a2b2b;color:#fbb">offline</span>
<!-- Owner-Handover nur wenn offline -->
<form style="display:inline"
hx-post="/admin/items/takeover"
hx-target="#items" hx-swap="outerHTML"
onsubmit="return confirm('Owner übernehmen?');">
<input type="hidden" name="id" value="{{ .ID }}">
<button class="btn" type="submit">Übernehmen</button>
</form>
{{ end }}
</td>
<td>
<form style="display:inline-flex; gap:6px"
hx-post="/admin/items/rename"
hx-target="#items" hx-swap="outerHTML">
<input type="hidden" name="id" value="{{ .ID }}">
<input type="text" name="name" placeholder="Neuer Name">
<button class="btn" type="submit">Rename</button>
</form>
<form style="display:inline"
hx-post="/admin/items/delete"
hx-target="#items" hx-swap="outerHTML"
onsubmit="return confirm('Wirklich löschen (inkl. Blob)?');">
<input type="hidden" name="id" value="{{ .ID }}">
<button class="btn" type="submit">Delete</button>
</form>
{{ if .HasBlob }}
<a class="btn" href="/admin/files/{{ .ID }}/download">Download</a>
{{ end }}
</td>
</tr>
{{ else }}
<tr><td colspan="7" class="muted">Keine Dateien vorhanden.</td></tr>
{{ end }}
</tbody>
</table>
{{ if .Next }}
<div style="margin-top:10px">
<button class="btn"
hx-get="/admin/items?next={{ .Next }}"
hx-target="#items" hx-swap="outerHTML">Mehr laden</button>
<span class="pill">next={{ .Next }}</span>
</div>
{{ end }}
</div>