From 7a107296e517ed2cb8fd78de50720e091e188605 Mon Sep 17 00:00:00 2001 From: Kirill Ilin Date: Thu, 26 Feb 2026 13:43:07 +0500 Subject: [PATCH] fix(dashboard): hide sidebar on cluster-level pages when no tenant selected Remove stock-instance-* sidebars that were populated with namespace-scoped menu items, causing the sidebar to incorrectly appear on cluster-level pages. Clear the sidebar fallback ID so the frontend gracefully renders no sidebar when no matching sidebar resource exists. Co-Authored-By: Claude Signed-off-by: Kirill Ilin --- internal/controller/dashboard/manager.go | 4 ---- internal/controller/dashboard/sidebar.go | 11 ++--------- packages/system/dashboard/templates/web.yaml | 2 +- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/internal/controller/dashboard/manager.go b/internal/controller/dashboard/manager.go index b0a4cd1b..339c9b9e 100644 --- a/internal/controller/dashboard/manager.go +++ b/internal/controller/dashboard/manager.go @@ -299,10 +299,6 @@ func (m *Manager) buildExpectedResourceSet(crds []cozyv1alpha1.ApplicationDefini // Add other stock sidebars that are created for each CRD stockSidebars := []string{ - "stock-instance-api-form", - "stock-instance-api-table", - "stock-instance-builtin-form", - "stock-instance-builtin-table", "stock-project-factory-marketplace", "stock-project-factory-workloadmonitor-details", "stock-project-api-form", diff --git a/internal/controller/dashboard/sidebar.go b/internal/controller/dashboard/sidebar.go index 8216d39a..0ea41f0d 100644 --- a/internal/controller/dashboard/sidebar.go +++ b/internal/controller/dashboard/sidebar.go @@ -17,8 +17,7 @@ import ( // ensureSidebar creates/updates multiple Sidebar resources that share the same menu: // - The "details" sidebar tied to the current kind (stock-project-factory--details) -// - The stock-instance sidebars: api-form, api-table, builtin-form, builtin-table -// - The stock-project sidebars: api-form, api-table, builtin-form, builtin-table, crd-form, crd-table +// - The stock-project sidebars: api-form, api-table, builtin-form, builtin-table, crd-form, crd-table // // Menu rules: // - The first section is "Marketplace" with two hardcoded entries: @@ -228,13 +227,7 @@ func (m *Manager) ensureSidebar(ctx context.Context, crd *cozyv1alpha1.Applicati // 6) Prepare the list of Sidebar IDs to upsert with the SAME content // Create sidebars for ALL CRDs with dashboard config targetIDs := []string{ - // stock-instance sidebars - "stock-instance-api-form", - "stock-instance-api-table", - "stock-instance-builtin-form", - "stock-instance-builtin-table", - - // stock-project sidebars + // stock-project sidebars (namespace-level, full menu) "stock-project-factory-marketplace", "stock-project-factory-workloadmonitor-details", "stock-project-factory-kube-service-details", diff --git a/packages/system/dashboard/templates/web.yaml b/packages/system/dashboard/templates/web.yaml index defb087b..7799afbf 100644 --- a/packages/system/dashboard/templates/web.yaml +++ b/packages/system/dashboard/templates/web.yaml @@ -136,7 +136,7 @@ spec: - name: CUSTOMIZATION_NAVIGATION_RESOURCE_PLURAL value: navigations - name: CUSTOMIZATION_SIDEBAR_FALLBACK_ID - value: stock-project-api-table + value: "" - name: CUSTOMIZATION_BREADCRUMBS_FALLBACK_ID value: stock-project-api-table - name: INSTANCES_API_GROUP