From cf4b23b26eeed687d41068e97ecbe333c9aba4d3 Mon Sep 17 00:00:00 2001 From: Ivo Oskamp Date: Tue, 6 Jan 2026 15:21:26 +0100 Subject: [PATCH] Auto-commit local changes before build (2026-01-06 15:21:26) --- .last-branch | 2 +- .../src/backend/app/main/routes_run_checks.py | 47 ++++++++++++++++++- docs/changelog.md | 8 ++++ 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/.last-branch b/.last-branch index c5b9c7a..b7b7c98 100644 --- a/.last-branch +++ b/.last-branch @@ -1 +1 @@ -v20260106-18-Reset +v20260106-18-runchecks-popup-objects-fallback diff --git a/containers/backupchecks/src/backend/app/main/routes_run_checks.py b/containers/backupchecks/src/backend/app/main/routes_run_checks.py index 0ec069b..27760f8 100644 --- a/containers/backupchecks/src/backend/app/main/routes_run_checks.py +++ b/containers/backupchecks/src/backend/app/main/routes_run_checks.py @@ -19,7 +19,16 @@ from .routes_shared import ( get_active_role, ) from ..database import db -from ..models import Customer, Job, JobRun, JobRunReviewEvent, MailMessage, User +from ..models import ( + Customer, + Job, + JobObject, + JobRun, + JobRunReviewEvent, + MailMessage, + MailObject, + User, +) # Grace window for matching real runs to an expected schedule slot. # A run within +/- 1 hour of the inferred schedule time counts as fulfilling the slot. @@ -516,6 +525,7 @@ def run_checks_details(): has_eml = bool(getattr(msg, "eml_stored_at", None)) objects_payload = [] + # Preferred: read persisted objects for this run from run_object_links/customer_objects (Step 2). try: rows = ( db.session.execute( @@ -546,7 +556,40 @@ def run_checks_details(): } ) except Exception: - objects_payload = [] + # Fallback for older data / during upgrades + try: + objects = run.objects.order_by(JobObject.object_name.asc()).all() + except Exception: + objects = list(run.objects or []) + + for obj in objects: + objects_payload.append( + { + "name": obj.object_name, + "type": getattr(obj, "object_type", "") or "", + "status": obj.status or "", + "error_message": obj.error_message or "", + } + ) + + # If no run-linked objects exist yet, fall back to objects parsed/stored on the mail message. + if (not objects_payload) and msg: + try: + for mo in ( + MailObject.query.filter_by(mail_message_id=msg.id) + .order_by(MailObject.object_name.asc()) + .all() + ): + objects_payload.append( + { + "name": mo.object_name or "", + "type": mo.object_type or "", + "status": mo.status or "", + "error_message": mo.error_message or "", + } + ) + except Exception: + pass status_display = run.status or "-" try: diff --git a/docs/changelog.md b/docs/changelog.md index 132abcd..11f4493 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -131,6 +131,14 @@ Removed an incorrectly indented redirect statement so the module loads correctly - Objects with an error message are displayed first, sorted alphabetically by object name. - Remaining objects are displayed below, also sorted alphabetically by object name. +--- + +## v20260106-18-runchecks-popup-objects-fallback + +- Fixed Run Checks modal object list by adding fallbacks when persisted run_object_links are missing. +- Added legacy fallback to load objects via JobRun.objects for older data during/after upgrades. +- Added mail-based fallback to load objects via MailObject when no run-linked objects exist yet. +- Updated imports in routes_run_checks to include JobObject and MailObject used by the fallback logic. ================================================================================================================================================ ## v0.1.16 -- 2.45.2