From 49c4dcfd132c96dcdf0bff221c4e689789716912 Mon Sep 17 00:00:00 2001 From: Yunwen Zheng Date: Wed, 24 Sep 2025 16:50:24 -0400 Subject: [PATCH] FileStatusPage: Disable save button if repo is read only (#111561) --- .../provisioning/File/FileStatusPage.tsx | 19 +++++++++++++++---- public/locales/en-US/grafana.json | 1 + 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/public/app/features/provisioning/File/FileStatusPage.tsx b/public/app/features/provisioning/File/FileStatusPage.tsx index 7b122e3b666..f910d8160ba 100644 --- a/public/app/features/provisioning/File/FileStatusPage.tsx +++ b/public/app/features/provisioning/File/FileStatusPage.tsx @@ -17,6 +17,7 @@ import { Page } from 'app/core/components/Page/Page'; import { useQueryParams } from 'app/core/hooks/useQueryParams'; import { PROVISIONING_URL } from '../constants'; +import { useGetResourceRepositoryView } from '../hooks/useGetResourceRepositoryView'; export default function FileStatusPage() { const params = useParams(); @@ -26,6 +27,8 @@ export default function FileStatusPage() { const name = params['name'] ?? ''; const path = params['*'] ?? ''; const file = useGetRepositoryFilesWithPathQuery({ name, path, ref }); + const { isReadOnlyRepo } = useGetResourceRepositoryView({ name }); + console.log('isReadOnlyRepo', isReadOnlyRepo); return ( )} - {file.isSuccess && file.data && } + {file.isSuccess && file.data && ( + + )} @@ -59,9 +64,10 @@ interface Props { repo: string; repoRef?: string; tab: TabSelection; + isReadOnlyRepo: boolean; } -function ResourceView({ wrap, repo, repoRef, tab }: Props) { +function ResourceView({ wrap, repo, repoRef, tab, isReadOnlyRepo }: Props) { const isDashboard = wrap.resource?.type?.kind === 'Dashboard'; const existingName = wrap.resource?.existing?.metadata?.name; const location = useLocation(); @@ -159,8 +165,13 @@ function ResourceView({ wrap, repo, repoRef, tab }: Props) { { deleteFile({ name: repo, diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index 752658e887d..c82c89e0a68 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -11637,6 +11637,7 @@ "removed-from-repo-test-ui": "removed from repo test UI", "updated-from-repo-test-ui": "updated from repo test UI" }, + "read-only-repo-tooltip": "This is a read-only repository", "repository": "Repository", "tab-info": { "label": {