diff --git a/public/app/features/provisioning/components/BulkActions/BulkExportProvisionedResource.tsx b/public/app/features/provisioning/components/BulkActions/BulkExportProvisionedResource.tsx
index bbd4491f5c9..82bc2ec9b46 100644
--- a/public/app/features/provisioning/components/BulkActions/BulkExportProvisionedResource.tsx
+++ b/public/app/features/provisioning/components/BulkActions/BulkExportProvisionedResource.tsx
@@ -50,6 +50,13 @@ function FormContent({ initialValues, selectedItems, workflowOptions, onDismiss
const { data: settingsData, isLoading: isLoadingRepos } = useGetFrontendSettingsQuery();
const repositories = settingsData?.items ?? [];
+ // Auto-select first repository when repositories are loaded
+ useEffect(() => {
+ if (repositories.length > 0 && !selectedRepositoryName && !isLoadingRepos) {
+ setSelectedRepositoryName(repositories[0].name || '');
+ }
+ }, [repositories, selectedRepositoryName, isLoadingRepos]);
+
// Get selected repository
const repositoryView: RepositoryView | undefined = repositories.find(
(repo) => repo.name === selectedRepositoryName
@@ -73,10 +80,8 @@ function FormContent({ initialValues, selectedItems, workflowOptions, onDismiss
} else if (selectedDefaultWorkflow === 'write' && repositoryView.branch) {
methods.setValue('ref', repositoryView.branch);
}
- // Set the path to the repository's configured path
- if (repositoryView.path) {
- methods.setValue('path', repositoryView.path);
- }
+ // Clear the path when repository changes - user will enter sub-path only
+ methods.setValue('path', '');
}
}, [repositoryView, selectedDefaultWorkflow, methods]);
@@ -117,8 +122,10 @@ function FormContent({ initialValues, selectedItems, workflowOptions, onDismiss
});
// Create the export job spec (backend uses 'push' action)
- // Use repository path as default if no path is provided
- const exportPath = data.path || repositoryView.path || undefined;
+ // Combine repository path with user's sub-path
+ const repoPath = repositoryView.path || '';
+ const subPath = (data.path || '').trim();
+ const exportPath = subPath ? `${repoPath}${repoPath.endsWith('/') ? '' : '/'}${subPath}` : repoPath || undefined;
const jobSpec: ExportJobSpec = {
action: 'push',
push: {
@@ -243,35 +250,68 @@ function FormContent({ initialValues, selectedItems, workflowOptions, onDismiss
{/* Path field */}
-
-
-
+ {repositoryView?.path && (
+
+
+
+
+ {repositoryView.path}
+
+
+
+
+
+ )}
+ {!repositoryView?.path && (
+
+
+
+ )}
{/* Shared fields (comment, workflow, branch) */}
{repositoryView && (