feat: add doc type and saved view counters to dashboard
All checks were successful
Deploy / deploy (push) Successful in 34s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-30 08:51:14 +02:00
parent 8c7826727c
commit dc44452834
2 changed files with 20 additions and 7 deletions

View File

@@ -1 +1,5 @@
@AGENTS.MD
## Workflow
After every successful test run, commit and push to origin.

View File

@@ -74,15 +74,24 @@ async def doc_counts_fragment(request: Request, session: Session = Depends(get_s
all_counts = await asyncio.gather(
*[_fetch_count(url, tok) for _, url, tok in tasks],
*[_fetch_count(url, tok, "/api/tags/") for _, url, tok in tasks],
*[_fetch_count(url, tok, "/api/document_types/") for _, url, tok in tasks],
*[_fetch_count(url, tok, "/api/saved_views/") for _, url, tok in tasks],
)
doc_counts = all_counts[:n]
tag_counts = all_counts[n:]
doc_counts = all_counts[0 * n : 1 * n]
tag_counts = all_counts[1 * n : 2 * n]
dt_counts = all_counts[2 * n : 3 * n]
view_counts = all_counts[3 * n : 4 * n]
parts = []
for (label, _, _), docs, tags in zip(tasks, doc_counts, tag_counts):
doc_val = str(docs) if docs is not None else "?"
tag_val = str(tags) if tags is not None else "?"
parts.append(f"<span><strong>{label}:</strong> {doc_val} docs, {tag_val} tags</span>")
for (label, _, _), docs, tags, dts, views in zip(tasks, doc_counts, tag_counts, dt_counts, view_counts):
doc_val = str(docs) if docs is not None else "?"
tag_val = str(tags) if tags is not None else "?"
dt_val = str(dts) if dts is not None else "?"
view_val = str(views) if views is not None else "?"
parts.append(
f"<span><strong>{label}:</strong> {doc_val} docs, {tag_val} tags,"
f" {dt_val} doc types, {view_val} views</span>"
)
html = (
'<div style="display:flex; gap:1.5rem; flex-wrap:wrap; margin-bottom:1rem; font-size:0.95em;">'