Frontend: sidebar shows hardcoded "3" badge on Jobs forever #113

Closed
opened 2026-05-26 18:20:13 -04:00 by zgaetano · 1 comment
Owner

Duplicate of #130 — fixed there. Sidebar Jobs badge now polls /jobs?status=active every 10s and renders the live count (warning style when > 5, hidden when 0).

Duplicate of #130 — fixed there. Sidebar Jobs badge now polls `/jobs?status=active` every 10s and renders the live count (warning style when > 5, hidden when 0).
Author
Owner

Fix Plan — #113 Sidebar shows hardcoded "3" badge on Jobs

Root cause: shell.jsx:19 — badge text is literal "3" sentinel value. Never changes.

Fix — poll for real counts:

// In shell.jsx or shared state:
const [jobCounts, setJobCounts] = useState({ running: 0, failed: 0 });

useEffect(() => {
  const poll = async () => {
    const [running, failed] = await Promise.all([
      fetch("/api/v1/jobs?status=running&limit=0").then(r => r.json()),
      fetch("/api/v1/jobs?status=failed&limit=0").then(r => r.json()),
    ]);
    setJobCounts({ running: running.total, failed: failed.total });
  };
  poll();
  const iv = setInterval(poll, 10000);
  return () => clearInterval(iv);
}, []);

Show badge only when count > 0. Color: red for failed, blue for running.

Files: shell.jsx:19
Effort: ~1h
**Priority: P2 — UX

## Fix Plan — #113 Sidebar shows hardcoded "3" badge on Jobs **Root cause:** `shell.jsx:19` — badge text is literal `"3"` sentinel value. Never changes. **Fix — poll for real counts:** ```js // In shell.jsx or shared state: const [jobCounts, setJobCounts] = useState({ running: 0, failed: 0 }); useEffect(() => { const poll = async () => { const [running, failed] = await Promise.all([ fetch("/api/v1/jobs?status=running&limit=0").then(r => r.json()), fetch("/api/v1/jobs?status=failed&limit=0").then(r => r.json()), ]); setJobCounts({ running: running.total, failed: failed.total }); }; poll(); const iv = setInterval(poll, 10000); return () => clearInterval(iv); }, []); ``` Show badge only when count > 0. Color: red for failed, blue for running. **Files:** `shell.jsx:19` **Effort:** ~1h **Priority: P2 — UX
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: WildDragonLLC/dragonflight#113
No description provided.