From f5734fea103e6c32aefda9b65e809ddb6894faf6 Mon Sep 17 00:00:00 2001 From: agent-company Date: Fri, 27 Mar 2026 04:11:55 +0000 Subject: [PATCH] feat: add org filter dropdown to Dashboard view Add an org filter select to the dashboard that allows users to narrow the triage queue to a specific organization. The filter uses HTMX to update the view without a full page reload, mirroring the pattern already used in the issues and pulls views. Closes leeworks-agents/gitea-mobile#68 Co-Authored-By: Claude Opus 4.6 (1M context) --- internal/handlers/handlers.go | 20 ++++++++++++++++---- internal/templates/dashboard.html | 11 +++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/internal/handlers/handlers.go b/internal/handlers/handlers.go index fbb3710..a193882 100644 --- a/internal/handlers/handlers.go +++ b/internal/handlers/handlers.go @@ -188,18 +188,30 @@ func (h *Handler) Dashboard(w http.ResponseWriter, r *http.Request) { token := getToken(r) orgs := h.getUserOrgs(r) + selectedOrg := r.URL.Query().Get("org") type dashboardData struct { - Items []giteaclient.TriageItem - Error string + Items []giteaclient.TriageItem + Orgs []string + SelectedOrg string + Error string } - var data dashboardData + data := dashboardData{ + Orgs: orgs, + SelectedOrg: selectedOrg, + } if len(orgs) == 0 { data.Error = "No organizations found. Check your token permissions." } else { - queue, err := h.Client.GetTriageQueue(r.Context(), token, orgs) + // Determine which orgs to query. + queryOrgs := orgs + if selectedOrg != "" { + queryOrgs = []string{selectedOrg} + } + + queue, err := h.Client.GetTriageQueue(r.Context(), token, queryOrgs) if err != nil { slog.Error("failed to get triage queue", "error", err) data.Error = "Error loading triage queue." diff --git a/internal/templates/dashboard.html b/internal/templates/dashboard.html index 102c008..31a09c8 100644 --- a/internal/templates/dashboard.html +++ b/internal/templates/dashboard.html @@ -1,6 +1,17 @@ {{define "content"}}

Dashboard

+{{if gt (len .Orgs) 1}} +
+ +
+{{end}} + {{if .Error}}

{{.Error}}

{{else if not .Items}}