Files
flowdeck/app/routers/dashboard.py
T
bruno d15cfb1d33
CI / test (push) Failing after 4s
CI / lint (push) Failing after 4s
fix: login button works, header no longer overflows
- dashboard.py: decode session cookie and pass user to template
- notes.py: pass user to template (both GET and POST)
- CSS: .header-right flex layout, #user-info styles, min-height instead of fixed height
- Removed duplicate #user-info CSS block
- Login now properly shows admin/Deconnexion after authentication
2026-07-08 10:00:30 -04:00

54 lines
1.6 KiB
Python

"""FlowDeck — Dashboard: liste des projets Gitea."""
from __future__ import annotations
import logging
from fastapi import APIRouter, Request, HTTPException, Query
from fastapi.responses import HTMLResponse
from app.services.gitea_client import gitea
logger = logging.getLogger(__name__)
router = APIRouter(tags=["dashboard"])
@router.get("/", response_class=HTMLResponse)
async def dashboard(
request: Request,
search: str = Query(default=""),
show_archived: bool = Query(default=False),
):
"""Dashboard: liste tous les projets Gitea (user + orgs)."""
try:
# User repos already includes all accessible org repos in Gitea
repos = await gitea.get_user_repos(page=1, limit=50)
# Filter
if search:
q = search.lower()
repos = [r for r in repos if q in r.get("full_name", "").lower() or q in (r.get("description") or "").lower()]
if not show_archived:
repos = [r for r in repos if not r.get("archived", False)]
# Sort by updated_at desc
repos.sort(key=lambda r: r.get("updated_at", ""), reverse=True)
except Exception as e:
logger.error("Dashboard error: %s", e)
repos = []
from jinja2 import Environment, FileSystemLoader
from app.auth.session import SessionManager
env = Environment(loader=FileSystemLoader("app/templates"))
user = SessionManager.decode_session(request.cookies.get("flowdeck_session", ""))
template = env.get_template("dashboard.html")
return template.render(
request=request,
repos=repos,
search=search,
show_archived=show_archived,
user=user,
)