diff --git a/public/app/features/browse-dashboards/components/FolderActionsButton.test.tsx b/public/app/features/browse-dashboards/components/FolderActionsButton.test.tsx
index 2a546571934..15c9470edf0 100644
--- a/public/app/features/browse-dashboards/components/FolderActionsButton.test.tsx
+++ b/public/app/features/browse-dashboards/components/FolderActionsButton.test.tsx
@@ -3,6 +3,7 @@ import userEvent from '@testing-library/user-event';
import { TestProvider } from 'test/helpers/TestProvider';
import { appEvents } from 'app/core/core';
+import { ManagerKind } from 'app/features/apiserver/types';
import { ShowModalReactEvent } from 'app/types/events';
import { mockFolderDTO } from '../fixtures/folder.fixture';
@@ -152,4 +153,47 @@ describe('browse-dashboards FolderActionsButton', () => {
)
);
});
+
+ // Git sync related tests
+ it('does not render the "Manage permissions" option if folder is provisioned', async () => {
+ jest.spyOn(permissions, 'getFolderPermissions').mockImplementation(() => {
+ return {
+ ...mockPermissions,
+ canViewPermissions: false,
+ };
+ });
+ render();
+
+ await userEvent.click(screen.getByRole('button', { name: 'Folder actions' }));
+ expect(screen.queryByRole('menuitem', { name: 'Manage permissions' })).not.toBeInTheDocument();
+ expect(screen.getByRole('menuitem', { name: 'Delete' })).toBeInTheDocument();
+ });
+
+ it('does not render the "Move" option if folder is provisioned and is root repo folder', async () => {
+ jest.spyOn(permissions, 'getFolderPermissions').mockImplementation(() => {
+ return {
+ ...mockPermissions,
+ canViewPermissions: false,
+ };
+ });
+ render();
+
+ await userEvent.click(screen.getByRole('button', { name: 'Folder actions' }));
+ expect(screen.queryByRole('menuitem', { name: 'Move' })).not.toBeInTheDocument();
+ expect(screen.getByRole('menuitem', { name: 'Delete' })).toBeInTheDocument();
+ });
+
+ it('does render the "Move" option if folder is provisioned and is NOT root repo folder', async () => {
+ jest.spyOn(permissions, 'getFolderPermissions').mockImplementation(() => {
+ return {
+ ...mockPermissions,
+ canViewPermissions: false,
+ };
+ });
+ render();
+
+ await userEvent.click(screen.getByRole('button', { name: 'Folder actions' }));
+ expect(screen.getByRole('menuitem', { name: 'Move' })).toBeInTheDocument();
+ expect(screen.getByRole('menuitem', { name: 'Delete' })).toBeInTheDocument();
+ });
});
diff --git a/public/app/features/browse-dashboards/components/FolderActionsButton.tsx b/public/app/features/browse-dashboards/components/FolderActionsButton.tsx
index 2fc2a30a32f..03e54a24122 100644
--- a/public/app/features/browse-dashboards/components/FolderActionsButton.tsx
+++ b/public/app/features/browse-dashboards/components/FolderActionsButton.tsx
@@ -131,7 +131,9 @@ export function FolderActionsButton({ folder, repoType, isReadOnlyRepo }: Props)
const menu = (