From 500d1407cc176053fef91c354ce60d06d94c8154 Mon Sep 17 00:00:00 2001 From: Rizqi Date: Mon, 22 Jun 2026 02:20:50 +0700 Subject: [PATCH] feat: add background backup execution endpoint and job detail UI template --- gui_app.py | 17 +++++++++++++++++ templates/job_detail.html | 10 +++++++++- templates/jobs.html | 8 +++++++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/gui_app.py b/gui_app.py index b6a63de..076f5ad 100644 --- a/gui_app.py +++ b/gui_app.py @@ -898,6 +898,23 @@ def cancel_schedule(jobid): return redirect(url_for('job_detail', jobid=jobid)) +@app.route('/job//run', methods=['POST']) +@login_required +def run_job_now(jobid): + info = jobs.get(jobid) + if not info: + abort(404) + if info.get('status') in ('running', 'queued'): + flash('Backup is already running or queued.', 'warning') + return redirect(url_for('job_detail', jobid=jobid)) + + # Start backup execution in a background thread + t = threading.Thread(target=run_job_thread, args=(jobid,), daemon=True) + t.start() + flash('Backup triggered successfully and is running in the background.', 'success') + return redirect(url_for('job_detail', jobid=jobid)) + + # ── Template filter ─────────────────────────────────────────────────────────── @app.template_filter('startswith') def startswith_filter(value, prefix): diff --git a/templates/job_detail.html b/templates/job_detail.html index b9b6e44..0274c03 100644 --- a/templates/job_detail.html +++ b/templates/job_detail.html @@ -142,7 +142,15 @@
Job ID: {{ job.id }}
-
+
+ {% if job.status != 'running' and job.status != 'queued' %} +
+ +
+ {% endif %} All Jobs diff --git a/templates/jobs.html b/templates/jobs.html index fb986b2..781a025 100644 --- a/templates/jobs.html +++ b/templates/jobs.html @@ -167,10 +167,16 @@ {{ job.started_fmt }} -
+
View + {% if job.status != 'running' and job.status != 'queued' %} +
+ +
+ {% endif %} {% if job.schedule_id %}