feat: Update job detail and logs routes to return friendly pages instead of 404 errors

This commit is contained in:
JB
2025-12-21 16:21:45 -08:00
parent 63d179ba19
commit ede5343e0c
3 changed files with 32 additions and 4 deletions
+6 -4
View File
@@ -32,10 +32,11 @@ logger = logging.getLogger(__name__)
jobs_bp = Blueprint("jobs", __name__)
@jobs_bp.get("/<job_id>")
def job_detail(job_id: str) -> str:
def job_detail(job_id: str) -> ResponseReturnValue:
job = get_service().get_job(job_id)
if not job:
abort(404)
# Return a friendly page instead of 404 to avoid confusion from stale browser tabs
return render_template("job_not_found.html"), 200
return render_template(
"job_detail.html",
job=job,
@@ -246,10 +247,11 @@ def download_file(job_id: str, file_type: str) -> ResponseReturnValue:
abort(404)
@jobs_bp.get("/<job_id>/logs")
def job_logs(job_id: str) -> str:
def job_logs(job_id: str) -> ResponseReturnValue:
job = get_service().get_job(job_id)
if not job:
abort(404)
# Return a simple page instead of 404 to avoid log spam from stale browser tabs
return render_template("job_logs_missing.html"), 200
return render_template("job_logs_static.html", job=job)
@@ -0,0 +1,13 @@
{% extends "base.html" %}
{% block title %}Job Not Found{% endblock %}
{% block content %}
<section class="card logs-static">
<div class="card__title-row">
<div class="card__title">Job Not Found</div>
</div>
<p>This job no longer exists. It may have been deleted or the server was restarted.</p>
<p><a href="{{ url_for('main.index') }}" class="button button--primary">Return to Dashboard</a></p>
</section>
{% endblock %}
+13
View File
@@ -0,0 +1,13 @@
{% extends "base.html" %}
{% block title %}Job Not Found{% endblock %}
{% block content %}
<section class="card">
<div class="card__title-row">
<div class="card__title">Job Not Found</div>
</div>
<p>This job no longer exists. It may have been deleted or the server was restarted.</p>
<p><a href="{{ url_for('main.index') }}" class="button button--primary">Return to Dashboard</a></p>
</section>
{% endblock %}