feat: restyle admin UI and add per-user sync run history

Adds a self-hosted stylesheet (no CDN dependencies) with a card-based
dashboard and color-coded status badges, and shows the last 10 sync
runs per user on the detail page.
This commit is contained in:
Bastian Wagner
2026-08-15 20:19:31 +02:00
parent 990a55af14
commit 85b0d861b4
13 changed files with 597 additions and 126 deletions

View File

@@ -1,6 +1,7 @@
from fastapi.testclient import TestClient
from app.db.repositories import UserRepository
from app.db.models import SyncRunStatus
from app.db.repositories import SyncRunRepository, UserRepository
from app.security.credentials import CredentialCipher
@@ -171,6 +172,30 @@ def test_user_detail_page_shows_no_secrets(client: TestClient) -> None:
assert "Max" in response.text
def test_user_detail_page_shows_recent_sync_runs(client: TestClient) -> None:
login(client)
user_id = create_user_via_http(client)
with client.app.state.session_factory() as session:
repo = SyncRunRepository(session)
run = repo.start(user_id)
repo.finish(
run.id,
status=SyncRunStatus.SUCCESS,
discovered=3,
imported=2,
skipped=1,
failed=0,
)
response = client.get(f"/users/{user_id}")
assert response.status_code == 200
assert "Recent sync runs" in response.text
assert "success" in response.text
assert ">3<" in response.text
assert ">2<" in response.text
def test_unknown_user_returns_404_for_detail(client: TestClient) -> None:
login(client)
response = client.get("/users/999999")