Files
alembic/app/templates/jobs/index.html
T
andrew 8f1fc458f6 Background long-running actions; confirm destructive ones
- Run now (jobs and playlists), dedup scan, genre preview/apply, and manual
  import now dispatch via BackgroundTasks and redirect immediately, instead
  of awaiting a job that can run for the better part of an hour and hang the
  browser or reverse proxy. Progress shows in the Jobs runs table (which
  already polls); if the pipeline is busy the run records skipped_lock there.
- Fix the import banner, which claimed work was ongoing after the request
  had actually blocked to completion; it now reflects the backgrounded start.
- Add confirmation prompts to the dedup per-row and bulk delete and to
  "Fix genres now", matching the existing confirms on library and playlist
  deletes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-09 14:31:54 -06:00

45 lines
1.9 KiB
HTML

{% extends "settings/_layout.html" %}
{% block settings_title %}Jobs{% endblock %}
{% block settings_content %}
{% if request.query_params.get('started') %}
<div class="notice">Started in the background. Watch the runs table below (it refreshes on its own). If the pipeline is already busy, this run shows as skipped.</div>
{% endif %}
<h2 style="margin-top:0;">Maintenance jobs</h2>
<div class="table-wrap scroll">
<table>
<thead><tr><th>Job</th><th>Status</th><th>Next run</th><th></th></tr></thead>
<tbody>
{% for job in maintenance_jobs %}
<tr>
<td>
<div title="{{ job.job_key }}">{{ job.label }}</div>
{% if job.description %}<div class="muted" style="font-size:0.8em; margin-top:0.15rem;">{{ job.description }}</div>{% endif %}
</td>
<td>{% if job.enabled %}<span class="badge badge-success">enabled</span>{% else %}<span class="badge badge-muted">disabled</span>{% endif %}</td>
<td class="muted mono">{{ job.next_run }}</td>
<td class="actions-cell">
<form method="post" action="/settings/jobs/{{ job.job_key }}/run" class="inline">
<button type="submit" class="btn btn-sm">Run now</button>
</form>
<form method="post" action="/settings/jobs/{{ job.job_key }}/toggle" class="inline">
<button type="submit" class="btn btn-sm btn-ghost">{{ "Disable" if job.enabled else "Enable" }}</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<p class="muted">Playlist syncs are triggered from each playlist's own page.</p>
<h2>Recent runs</h2>
<div class="table-wrap scroll">
<table>
<thead><tr><th>Job</th><th>Status</th><th>Triggered by</th><th>Summary</th><th></th></tr></thead>
<tbody id="runs-tbody" hx-get="/settings/jobs/_runs_table" hx-trigger="every 5s" hx-swap="innerHTML">
{% include "jobs/_runs_table.html" %}
</tbody>
</table>
</div>
{% endblock %}