5 files changed,
+9
−6
Makefile
+1 −1
internal/home/credits_inventory_test.go
+1 −1
internal/home/dashboard.go
+3 −3
internal/home/dashboard_test.go
+3 −0
internal/home/templates/dashboard.html
+1 −1
| index f4ebd01..bb60285 100644 |
| --- a/Makefile |
| +++ b/Makefile |
| @@ -148,6 +148,6 @@ credits: |
| go build -o "$$notices_tmp/notices" amadan.net/oficina/estilo.git/cmd/oficina-notices; \ |
| GOOS=linux GOARCH=arm64 CGO_ENABLED=0 "$$notices_tmp/notices" \ |
| -package ./cmd/home -lucide -onest \ |
| - -exclude amadan.net/oficina/estilo.git,amadan.net/oficina/home/handoff,amadan.net/oficina/home/roster \ |
| + -exclude amadan.net/oficina/home/dashboard,amadan.net/oficina/estilo.git,amadan.net/oficina/home/handoff,amadan.net/oficina/home/roster \ |
| > "$$notices_tmp/notices.json"; \ |
| mv "$$notices_tmp/notices.json" internal/home/credits/notices.json |
| index fd7352c..dee8559 100644 |
| --- a/internal/home/credits_inventory_test.go |
| +++ b/internal/home/credits_inventory_test.go |
| @@ -34,7 +34,7 @@ func TestCreditsMatchProductionDependencies(t *testing.T) { |
| if err != nil { |
| t.Fatal("production dependency graph unavailable", err) |
| } |
| - inventory, err := catalog.Collect(bytes.NewReader(raw), map[string]bool{"amadan.net/oficina/estilo.git": true, "amadan.net/oficina/home/handoff": true, "amadan.net/oficina/home/roster": true}) |
| + inventory, err := catalog.Collect(bytes.NewReader(raw), map[string]bool{"amadan.net/oficina/home/dashboard": true, "amadan.net/oficina/estilo.git": true, "amadan.net/oficina/home/handoff": true, "amadan.net/oficina/home/roster": true}) |
| if err != nil { |
| t.Fatal(err) |
| } |
| index 7c0ba8d..78cecd8 100644 |
| --- a/internal/home/dashboard.go |
| +++ b/internal/home/dashboard.go |
| @@ -37,12 +37,12 @@ func (a *App) handleDashboard(w http.ResponseWriter, r *http.Request) { |
| return |
| } |
| q, e := url.ParseQuery(r.URL.RawQuery) |
| - if e != nil || len(q) > 2 || len(q["team"]) > 1 || len(q["dashboard"]) > 1 { |
| + if e != nil || len(q) > 2 || len(q["team"]) > 1 || len(q["dashboard"]) > 1 || len(q["refresh"]) > 1 || (q.Has("refresh") && (q.Get("refresh") != "1" || q.Has("dashboard"))) { |
| http.NotFound(w, r) |
| return |
| } |
| for k := range q { |
| - if k != "team" && k != "dashboard" { |
| + if k != "team" && k != "dashboard" && k != "refresh" { |
| http.NotFound(w, r) |
| return |
| } |
| @@ -70,7 +70,7 @@ func (a *App) handleDashboard(w http.ResponseWriter, r *http.Request) { |
| a.dash.mu.Lock() |
| a.dash.sweep(now) |
| cached, found := a.dash.cache[key] |
| - if q.Get("dashboard") == "" && found && now.Sub(cached.At) < 30*time.Second { |
| + if q.Get("dashboard") == "" && !q.Has("refresh") && found && now.Sub(cached.At) < 30*time.Second { |
| a.dash.mu.Unlock() |
| a.renderDashboard(w, r, team, cached.Results) |
| return |
| index b4ef26e..a065598 100644 |
| --- a/internal/home/dashboard_test.go |
| +++ b/internal/home/dashboard_test.go |
| @@ -113,6 +113,9 @@ func TestDashboardExchangeIsolationAndPrivacy(t *testing.T) { |
| if page.Code != 200 || !strings.Contains(page.Body.String(), "Dashboard private title <script>") || strings.Contains(page.Body.String(), "https://blue.docs.oficina.works/") || calls != 1 { |
| t.Fatal("selection, rendering, or cache failed", page.Code) |
| } |
| + if refresh := exchangeRequest(p.directory, "GET", directoryOrigin+"/?refresh=1", "", nil, directorySession, preference); refresh.Code != 303 { |
| + t.Fatal("refresh reused cached result") |
| + } |
| if strings.Contains(page.Body.String(), "Nothing scheduled") { |
| t.Fatal("unconfigured calendar looks empty") |
| } |
| index 0af86c7..6c8b966 100644 |
| --- a/internal/home/templates/dashboard.html |
| +++ b/internal/home/templates/dashboard.html |
| @@ -30,6 +30,6 @@ |
| </div> |
| <section home-dashboard-sources aria-label="Connected apps"> |
| {{range .Data.Sources}}{{if .Status}}<p><b>{{.Source.Name}}</b>: {{.Status}} <a href="{{.Source.Origin}}/">Open {{.Source.Name}}</a></p>{{else if .Response.Truncated}}<p><a href="{{.Source.Origin}}/">More in {{.Source.Name}}</a></p>{{end}}{{end}} |
| -<p><a href="/?team={{.Data.Team.ID}}">Refresh dashboard</a></p> |
| +<p><a href="/?team={{.Data.Team.ID}}&refresh=1">Refresh dashboard</a></p> |
| </section> |
| {{end}} |