[ARCH] Dashboard: live Audit 360 counts
lint / hygiene (pull_request) Failing after 19s
standard / check (pull_request) Successful in 9s
lint / hygiene (push) Failing after 16s
standard / check (push) Successful in 8s

This commit is contained in:
architect committed 2026-11-26 23:57:41 +03:00
1 parent f77fd832f3
commit 019abfc4ef
1 file changed
+18 -1
+18 -1
View File
@@ -46,6 +46,22 @@ def prism_stats():
return json.load(r)
def audit_status():
try:
import psycopg2
pw = Path("/root/.pg-superuser-pass").read_text().strip()
conn = psycopg2.connect(host="192.168.1.151", dbname="rag",
user="postgres", password=pw, connect_timeout=4)
cur = conn.cursor()
cur.execute("select status,count(*) from audit.sprint_items group by status")
out = {k: int(v) for k, v in cur.fetchall()}
cur.close()
conn.close()
return out
except Exception as e:
return {"error": str(e)[:80]}
def home_status():
out = {"ok": True, "alpha": "read-only", "links": {
"audit": "/", "prism": "http://192.168.1.10:9161/",
@@ -60,6 +76,7 @@ def home_status():
out["prism"] = {k: p.get(k) for k in ("pending_tasks", "done_tasks", "error_tasks", "runs")}
except Exception:
out["prism"] = {"error": "unavailable"}
out["audit"] = audit_status()
return out
@@ -290,7 +307,7 @@ async function boot(){try{const m=await (await fetch('v1/me')).json();document.g
try{const s=await (await fetch('v1/home/status')).json();const p=s.prism||{};document.getElementById('status').innerHTML=`
<div class=card><h3>Jellyfin</h3><div class=tag>${s.jellyfin==='ok'?'работает':'недоступен'}</div></div>
<div class=card><h3>Prism</h3><div class=tag>pending ${p.pending_tasks??'—'} · running ${p.running_tasks??'—'} · errors ${p.error_tasks??'—'}</div></div>
<div class=card><h3>Audit 360</h3><div class=tag><a href="http://192.168.1.10:9161/">открыть трекер</a></div></div>
<div class=card><h3>Audit 360</h3><div class=tag>done ${(s.audit||{}).done??'—'} · review ${(s.audit||{}).review_pending??'—'} · open ${(s.audit||{}).in_progress??'—'}</div><div class=tag><a href="http://192.168.1.10:9161/">открыть трекер</a></div></div>
<div class=card><h3>Режим</h3><div class=tag>read-only · без записи</div></div>`}catch(e){}
try{const r=await (await fetch('v1/media/recent')).json();const xs=r.items||[];document.getElementById('recent').innerHTML=xs.map(x=>`<div class=card><h3>${e(x.name)}</h3><div class=tag>${e(x.type)} ${e(x.year||'')}</div><div class=mut style="margin-top:6px">${e(x.overview||'')}</div></div>`).join('')}catch(e){}}
document.getElementById('q').addEventListener('keydown',e=>{if(e.key==='Enter')go()});boot();