From 1d9bb26b85eb98694003221df96fb9f474e470f9 Mon Sep 17 00:00:00 2001 From: pyob-bot Date: Mon, 9 Mar 2026 14:31:27 +0000 Subject: [PATCH] PyOB Evolution: Automated refactor of `src/pyob/pyob_dashboard.py` (Iteration 4) --- src/pyob/pyob_dashboard.py | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/src/pyob/pyob_dashboard.py b/src/pyob/pyob_dashboard.py index 95409a3..7b43ffe 100644 --- a/src/pyob/pyob_dashboard.py +++ b/src/pyob/pyob_dashboard.py @@ -66,6 +66,10 @@
Architectural Analysis
Scanning structure...
+
+
Pending Patch Reviews
+
No pending patches.
+
Manual Override
@@ -94,6 +98,7 @@ document.getElementById('analysis').innerText = data.analysis || "Parsing..."; const queueDiv = document.getElementById('queue'); queueDiv.innerText = data.cascade_queue?.length > 0 ? data.cascade_queue.join('\\n') : "EMPTY"; + await updatePendingPatches(); // Refresh pending patches } catch (e) { document.getElementById('status-pill').innerText = "OFFLINE"; } } @@ -108,6 +113,50 @@ document.getElementById('manualTargetFile').value = ''; } + async function updatePendingPatches() { + try { + const response = await fetch('/api/pending_patches'); + const data = await response.json(); + const patchesDiv = document.getElementById('pending-patches'); + patchesDiv.innerHTML = ''; // Clear previous content + + if (data.patches && data.patches.length > 0) { + data.patches.forEach(patch => { + const patchElement = document.createElement('div'); + patchElement.style.marginBottom = '10px'; + patchElement.innerHTML = ` + Patch ID: ${patch.id}
+ File: ${patch.target_file}
+ Description: ${patch.description || 'N/A'}
+ + + `; + patchesDiv.appendChild(patchElement); + }); + } else { + patchesDiv.innerText = "No pending patches."; + } + } catch (e) { + console.error("Failed to fetch pending patches:", e); + document.getElementById('pending-patches').innerText = "Error loading patches."; + } + } + + async function reviewPatch(patchId, action) { + try { + await fetch('/api/review_patch', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ patch_id: patchId, action: action }) + }); + // Refresh stats and patches after review + await updateStats(); + } catch (e) { + console.error(`Failed to ${action} patch ${patchId}:`, e); + alert(`Failed to ${action} patch ${patchId}. Check console for details.`); + } + } + setInterval(updateStats, 3000); updateStats();