From ad6cf6c49846b9544c44e8cc2fc19ab305a12079 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 12 Apr 2026 04:13:13 +0000 Subject: [PATCH] fix: show already up to date instead of full update flow when no updates available Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/fb575403-f4f0-41bb-8fb1-12f7d9874009 Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com> --- app/sovran_systemsos_web/server.py | 4 +++ app/sovran_systemsos_web/static/js/update.js | 33 ++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/app/sovran_systemsos_web/server.py b/app/sovran_systemsos_web/server.py index 4cc9a99..ac80ab0 100644 --- a/app/sovran_systemsos_web/server.py +++ b/app/sovran_systemsos_web/server.py @@ -2375,6 +2375,10 @@ async def api_updates_run(): if status == "RUNNING": return {"ok": True, "status": "already_running"} + available = await loop.run_in_executor(None, check_for_updates) + if not available: + return {"ok": True, "status": "no_updates"} + # Clear stale status and log BEFORE starting the unit _write_update_status("RUNNING") try: diff --git a/app/sovran_systemsos_web/static/js/update.js b/app/sovran_systemsos_web/static/js/update.js index 040ec44..8d70ab7 100644 --- a/app/sovran_systemsos_web/static/js/update.js +++ b/app/sovran_systemsos_web/static/js/update.js @@ -3,6 +3,30 @@ // ── Update modal ────────────────────────────────────────────────── function openUpdateModal() { + if (!$modal) return; + apiFetch("/api/updates/check") + .then(function(data) { + if (!data.available) { + _updateLog = ""; + _updateLogOffset = 0; + _updateFinished = true; + if ($modalLog) $modalLog.textContent = ""; + if ($modalStatus) $modalStatus.textContent = "✓ System is already up to date"; + if ($modalSpinner) $modalSpinner.classList.remove("spinning"); + if ($btnReboot) $btnReboot.style.display = "none"; + if ($btnSave) $btnSave.style.display = "none"; + if ($btnCloseModal) $btnCloseModal.disabled = false; + $modal.classList.add("open"); + return; + } + _doOpenUpdateModal(); + }) + .catch(function() { + _doOpenUpdateModal(); + }); +} + +function _doOpenUpdateModal() { if (!$modal) return; _updateLog = ""; _updateLogOffset = 0; @@ -37,6 +61,15 @@ function startUpdate() { return response.json(); }) .then(function(data) { + if (data.status === "no_updates") { + if ($modalStatus) $modalStatus.textContent = "✓ System is already up to date"; + if ($modalSpinner) $modalSpinner.classList.remove("spinning"); + if ($btnReboot) $btnReboot.style.display = "none"; + if ($btnSave) $btnSave.style.display = "none"; + if ($btnCloseModal) $btnCloseModal.disabled = false; + _updateFinished = true; + return; + } if (data.status === "already_running") appendLog("[Update already in progress, attaching…]\n\n"); if ($modalStatus) $modalStatus.textContent = "Updating…"; startUpdatePoll();