From 454cd0f38585d3e93b31daf06a25e808fb6f9b17 Mon Sep 17 00:00:00 2001 From: Yunwen Zheng Date: Thu, 2 Oct 2025 22:51:45 -0400 Subject: [PATCH] BrowseView: Git Provisioned Read Only Folder Disable Empty State Create Dashboard Button (#111971) BrowseView: Disable empty state create dashboard button when repo is read only --- .../features/browse-dashboards/BrowseDashboardsPage.tsx | 8 +++++++- .../features/browse-dashboards/components/BrowseView.tsx | 6 ++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/public/app/features/browse-dashboards/BrowseDashboardsPage.tsx b/public/app/features/browse-dashboards/BrowseDashboardsPage.tsx index c658fbaa6cd..bc9572efdbd 100644 --- a/public/app/features/browse-dashboards/BrowseDashboardsPage.tsx +++ b/public/app/features/browse-dashboards/BrowseDashboardsPage.tsx @@ -206,7 +206,13 @@ const BrowseDashboardsPage = memo(({ queryParams }: { queryParams: Record ) : ( - + ) } diff --git a/public/app/features/browse-dashboards/components/BrowseView.tsx b/public/app/features/browse-dashboards/components/BrowseView.tsx index 1c98b2d440a..19b6ee383fc 100644 --- a/public/app/features/browse-dashboards/components/BrowseView.tsx +++ b/public/app/features/browse-dashboards/components/BrowseView.tsx @@ -33,9 +33,10 @@ interface BrowseViewProps { width: number; folderUID: string | undefined; permissions: BrowseDashboardsPermissions; + isReadOnlyRepo?: boolean; } -export function BrowseView({ folderUID, width, height, permissions }: BrowseViewProps) { +export function BrowseView({ folderUID, width, height, permissions, isReadOnlyRepo }: BrowseViewProps) { const status = useBrowseLoadingStatus(folderUID); const dispatch = useDispatch(); const flatTree = useFlatTreeState(folderUID); @@ -163,6 +164,7 @@ export function BrowseView({ folderUID, width, height, permissions }: BrowseView href={folderUID ? `dashboard/new?folderUid=${folderUID}` : 'dashboard/new'} icon="plus" size="lg" + disabled={isReadOnlyRepo} > Create dashboard @@ -173,7 +175,7 @@ export function BrowseView({ folderUID, width, height, permissions }: BrowseView : t('browse-dashboards.empty-state.title', "You haven't created any dashboards yet") } > - {folderUID && ( + {folderUID && !isReadOnlyRepo && ( Add/move dashboards to your folder at{' '}