From a3a1cbc107ba0ced845281cb3a52dedd6028b72f Mon Sep 17 00:00:00 2001 From: Shubham Mathur Date: Tue, 26 Aug 2025 15:04:26 -0400 Subject: [PATCH] feat: Enable 'All' namespaces view for non-admin users - Show 'All' option in namespace dropdown for all users with accessible namespaces - Remove admin-only restriction from pipelines overview pages - Non-admins see pipeline data scoped to their accessible namespaces - Maintains security through existing RBAC permissions Fixes: SRVKP-6766 --- src/components/pipelines-overview/NamespaceDropdown.tsx | 8 ++++++-- .../pipelines-overview/PipelinesOverviewPage.tsx | 5 ++--- .../pipelines-overview/PipelinesOverviewPageK8s.tsx | 5 ++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/components/pipelines-overview/NamespaceDropdown.tsx b/src/components/pipelines-overview/NamespaceDropdown.tsx index b2f43dd3..4344113d 100644 --- a/src/components/pipelines-overview/NamespaceDropdown.tsx +++ b/src/components/pipelines-overview/NamespaceDropdown.tsx @@ -58,11 +58,15 @@ const NameSpaceDropdown: React.FC = ({ items.push({ title: selected, key: selected }); // Add current namespace if it isn't included } items.sort((a, b) => alphanumericCompare(a.title, b.title)); - if (canListNS) { + + // Always show "All" option - behavior depends on user permissions: + // - Admins (canListNS=true): See all cluster namespaces + // - Non-admins (canListNS=false): See all their accessible namespaces + if (projects.length > 0) { items.unshift({ title: allNamespacesTitle, key: ALL_NAMESPACES_KEY }); } return items; - }, [projects, projectsLoaded]); + }, [projects, projectsLoaded, allNamespacesTitle]); return ( <> diff --git a/src/components/pipelines-overview/PipelinesOverviewPage.tsx b/src/components/pipelines-overview/PipelinesOverviewPage.tsx index fd7a180b..a905ab36 100644 --- a/src/components/pipelines-overview/PipelinesOverviewPage.tsx +++ b/src/components/pipelines-overview/PipelinesOverviewPage.tsx @@ -48,9 +48,8 @@ const PipelinesOverviewPage: React.FC = () => { loadFormat: parsePrometheusDuration, }); - if (!canListNS && activeNamespace === ALL_NAMESPACES_KEY) { - return ; - } + // Remove restriction - allow all users to see "All" namespaces view + // The data will be scoped to namespaces they have access to based on their permissions return ( <> diff --git a/src/components/pipelines-overview/PipelinesOverviewPageK8s.tsx b/src/components/pipelines-overview/PipelinesOverviewPageK8s.tsx index d391b1aa..47e0981d 100644 --- a/src/components/pipelines-overview/PipelinesOverviewPageK8s.tsx +++ b/src/components/pipelines-overview/PipelinesOverviewPageK8s.tsx @@ -50,9 +50,8 @@ const PipelinesOverviewPageK8s: React.FC = () => { loadFormat: parsePrometheusDuration, }); - if (!canListNS && activeNamespace === ALL_NAMESPACES_KEY) { - return ; - } + // Remove restriction - allow all users to see "All" namespaces view + // The data will be scoped to namespaces they have access to based on their permissions return ( <>