shelfy/templates/downloads_table.pages.tmpl

43 lines
1.8 KiB
Cheetah
Raw Normal View History

2025-06-12 08:57:10 +00:00
<div id="downloads-table" hx-get="/api/download/all" hx-trigger="every 2s" hx-swap="outerHTML">
<table class="table is-fullwidth is-striped">
<thead>
<tr>
<th>Fichier</th>
<th>Statut</th>
<th>Vitesse</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{{ range .jobs }}
<tr class="border-b {{ if eq .Status "error" }}bg-red-100 text-red-800{{ end }}">
2025-06-13 15:12:32 +00:00
<td class="px-2 py-1 text-sm">{{ .Name }}</td>
2025-06-12 08:57:10 +00:00
<td class="px-2 py-1 text-sm">{{ .Status }}</td>
2025-06-13 15:12:32 +00:00
<td class="px-2 py-1 text-sm">{{ .Progress }}</td>
2025-06-12 08:57:10 +00:00
<td class="px-2 py-1 text-sm">
2025-06-13 15:12:32 +00:00
{{ if eq .Status "waiting" }}
2025-06-12 08:57:10 +00:00
<button hx-post="/api/download/start/{{ .ID }}" class="text-indigo-600">⬇ Télécharger</button>
{{ end }}
{{ if eq .Status "paused" }}
<button hx-post="/api/download/resume/{{ .ID }}" class="text-blue-600">▶</button>
{{ else if eq .Status "downloading" }}
<button hx-post="/api/download/pause/{{ .ID }}" class="text-yellow-600">⏸</button>
{{ end }}
{{ if and (eq .Status "downloaded") .StreamURL }}
<a href="/stream/{{ .ID }}" target="_blank" class="text-green-600 ml-2">🎬 Stream</a>
<button onclick="navigator.clipboard.writeText('{{ .StreamURL }}')" class="text-gray-600 ml-1">📋</button>
<a href="{{ .DownloadLink }}" class="text-blue-600 ml-1" download>⬇</a>
{{ end }}
<button hx-delete="/api/download/delete/{{ .ID }}" class="text-red-600 ml-2">✖</button>
</td>
</tr>
{{ if eq .Status "error" }}
<tr class="bg-red-50 text-sm text-red-600">
<td colspan="4" class="px-2 py-1">Erreur : {{ .ErrorMsg }}</td>
</tr>
{{ end }}
{{ end }}
</tbody>
</table>
</div>