diff --git a/main.py b/main.py index 38fb4da..b556103 100644 --- a/main.py +++ b/main.py @@ -193,6 +193,18 @@ async def _collect_instance(inst) -> dict | None: errors.append(f"agent policies: {e}") agent_policies = [] + backups_data = [] + try: + backups_data = await client.fetch_backups() + except Exception as e: + errors.append(f"backups: {e}") + + restore_points = [] + try: + restore_points = await client.fetch_restore_points(200) + except Exception as e: + errors.append(f"restore points: {e}") + for s in sessions_data: if isinstance(s.get("result"), dict): s["result"] = s["result"].get("result") or s["result"].get("Result") or "unknown" @@ -228,6 +240,27 @@ async def _collect_instance(inst) -> dict | None: if j_name in job_last_backup: j["last_backup"] = job_last_backup[j_name] + rp_per_backup: dict[str, int] = {} + for rp in restore_points: + bid = rp.get("backupId") or "" + if bid: + rp_per_backup[bid] = rp_per_backup.get(bid, 0) + 1 + backup_to_job: dict[str, str] = {} + for b in backups_data: + bid = b.get("id") or "" + jid = b.get("jobId") or "" + if bid and jid: + backup_to_job[bid] = jid + rp_per_job: dict[str, int] = {} + for bid, count in rp_per_backup.items(): + jid = backup_to_job.get(bid, "") + if jid: + rp_per_job[jid] = rp_per_job.get(jid, 0) + count + for j in jobs_data: + jid = j.get("id") or j.get("Id") or "" + if jid in rp_per_job: + j["actual_restore_points"] = rp_per_job[jid] + job_count = len(jobs_data) success = sum(1 for j in jobs_data if _safe_str(j.get("result") or "").lower() in ("success", "true")) failed = sum(1 for j in jobs_data if _safe_str(j.get("result") or "").lower() in ("failed", "error", "false")) @@ -262,6 +295,7 @@ async def _collect_instance(inst) -> dict | None: "alarms": alarms_data, "agents": agents_data, "agent_policies": agent_policies, + "restore_points": restore_points[:50] if restore_points else [], } await set_cache(inst.id, "dashboard", result) @@ -285,6 +319,7 @@ async def _collect_instance(inst) -> dict | None: "alarms": [], "agents": [], "agent_policies": [], + "restore_points": [], } return error_result finally: diff --git a/static/index.html b/static/index.html index a3241ee..fe71dd0 100644 --- a/static/index.html +++ b/static/index.html @@ -489,10 +489,12 @@ function renderJobsTable(inst) { for (const j of jobs) { const isDisabled = j.schedule_enabled === false || (j.state || '').toLowerCase() === 'disabled'; const pts = j.restore_points_to_keep != null ? j.restore_points_to_keep : (j.restorePointsToKeep != null ? j.restorePointsToKeep : '—'); + const actual = j.actual_restore_points != null ? j.actual_restore_points : null; + const ptsDisplay = actual != null ? (pts !== '—' ? pts + ' / ' + actual : actual) : pts; rows += '