diff --git a/public/app/features/provisioning/File/FilesView.test.tsx b/public/app/features/provisioning/File/FilesView.test.tsx
index 8f3412188b1..ed29db649ae 100644
--- a/public/app/features/provisioning/File/FilesView.test.tsx
+++ b/public/app/features/provisioning/File/FilesView.test.tsx
@@ -146,4 +146,21 @@ describe('FilesView', () => {
expect(screen.getByRole('link', { name: 'View' })).toBeInTheDocument();
expect(screen.queryByRole('link', { name: 'History' })).not.toBeInTheDocument();
});
+
+ it('renders plain text and hides actions for .keep files', () => {
+ mockRepositoryFilesQuery({
+ isSuccess: true,
+ status: 'fulfilled',
+ data: {
+ items: [{ path: 'dashboards/.keep', hash: 'abc', size: '0' }],
+ },
+ });
+
+ renderComponent();
+
+ expect(screen.getByText('dashboards/.keep')).toBeInTheDocument();
+ expect(screen.queryByRole('link', { name: 'dashboards/.keep' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('link', { name: 'View' })).not.toBeInTheDocument();
+ expect(screen.queryByRole('link', { name: 'History' })).not.toBeInTheDocument();
+ });
});
diff --git a/public/app/features/provisioning/File/FilesView.tsx b/public/app/features/provisioning/File/FilesView.tsx
index 031784c0d20..97ac77b2fc4 100644
--- a/public/app/features/provisioning/File/FilesView.tsx
+++ b/public/app/features/provisioning/File/FilesView.tsx
@@ -31,6 +31,10 @@ export function FilesView({ repo }: FilesViewProps) {
sortType: 'string',
cell: ({ row: { original } }: FileCell<'path'>) => {
const { path } = original;
+ const isDotKeepFile = getIsDotKeepFile(path);
+ if (isDotKeepFile) {
+ return path;
+ }
return {path};
},
},
@@ -44,6 +48,10 @@ export function FilesView({ repo }: FilesViewProps) {
header: '',
cell: ({ row: { original } }: FileCell<'path'>) => {
const { path } = original;
+ const isDotKeepFile = getIsDotKeepFile(path);
+ if (isDotKeepFile) {
+ return null;
+ }
return (
{(path.endsWith('.json') || path.endsWith('.yaml') || path.endsWith('.yml')) && (
@@ -84,3 +92,8 @@ export function FilesView({ repo }: FilesViewProps) {
);
}
+
+function getIsDotKeepFile(path: string): boolean {
+ // e.g. 'dashboards/.keep' → true, 'dashboards/example.keep.json' → false
+ return path.split('/').pop() === '.keep';
+}