Skip to content

Commit d7676b3

Browse files
sarg3ntclaude
andcommitted
feat(sidebar): hide gears whose agent reports them unavailable (#112)
filterGearsByAgentCapabilities is the framework's existing capability-aware gear filter. Today it's only used by the Gears settings page (`/settings/gears`) — so the **sidebar** still renders HAProxy, Logs, Services, Certificates, etc. for an active box whose agent doesn't run any of those gears. Clicking them lands the operator on an empty page or a JSON-envelope error. Run the same filter on the per-box integration list inside InjectIntegrationStatus, so the sidebar reflects what the agent can actually serve. Failures stay fail-open (an unreachable agent does not strip the sidebar) by reusing the existing helper's contract. Phase 2 slice of #112. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 0799f82 commit d7676b3

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

gearbox/internal/framework/handler/handler.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,13 @@ func (h *Handler) InjectIntegrationStatus(next http.Handler) http.Handler {
524524
next.ServeHTTP(w, r.WithContext(ctx))
525525
return
526526
}
527+
// Filter the per-box gear list by the agent's probe table —
528+
// if the agent reports a gear as unavailable, hide it from
529+
// the sidebar entirely so the operator doesn't click into a
530+
// page the box physically can't serve (issue #112). The
531+
// filter fails OPEN: when the agent is unreachable the full
532+
// list is preserved, matching the Gears-settings-page filter.
533+
integrations = h.filterGearsByAgentCapabilities(activeBox.ID, integrations)
527534
for _, i := range integrations {
528535
status[i.Name] = i.Enabled
529536
orderedIntegrations = append(orderedIntegrations, auth.SidebarIntegration{

0 commit comments

Comments
 (0)