From c1c51beee48da8d64a764939ec5b2b49785dec01 Mon Sep 17 00:00:00 2001 From: Alex Khomenko Date: Tue, 2 Sep 2025 11:27:33 +0300 Subject: [PATCH] Provisioning: Update branch selection (#110389) --- .../Dashboards/SaveProvisionedDashboardForm.test.tsx | 6 +++--- .../Dashboards/SaveProvisionedDashboardForm.tsx | 9 +++++---- .../components/Folders/NewProvisionedFolderForm.tsx | 2 +- .../components/Shared/ResourceEditFormSharedFields.tsx | 10 +++++----- public/locales/en-US/grafana.json | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/public/app/features/provisioning/components/Dashboards/SaveProvisionedDashboardForm.test.tsx b/public/app/features/provisioning/components/Dashboards/SaveProvisionedDashboardForm.test.tsx index f144f03fda0..07b21a5424e 100644 --- a/public/app/features/provisioning/components/Dashboards/SaveProvisionedDashboardForm.test.tsx +++ b/public/app/features/provisioning/components/Dashboards/SaveProvisionedDashboardForm.test.tsx @@ -240,7 +240,7 @@ describe('SaveProvisionedDashboardForm', () => { await waitFor(() => { expect(mockAction).toHaveBeenCalledWith({ - ref: undefined, + ref: 'dashboard/2023-01-01-abcde', name: 'test-repo', path: 'test-dashboard.json', message: 'Initial commit', @@ -296,7 +296,7 @@ describe('SaveProvisionedDashboardForm', () => { await user.click(submitButton); await waitFor(() => { expect(mockAction).toHaveBeenCalledWith({ - ref: undefined, + ref: 'dashboard/2023-01-01-abcde', name: 'test-repo', path: 'test-dashboard.json', message: 'Update dashboard', @@ -351,7 +351,7 @@ describe('SaveProvisionedDashboardForm', () => { await waitFor(() => { expect(mockAction).toHaveBeenCalledWith({ - ref: undefined, + ref: 'dashboard/2023-01-01-abcde', name: 'test-repo', path: 'error-dashboard.json', message: 'Error commit', diff --git a/public/app/features/provisioning/components/Dashboards/SaveProvisionedDashboardForm.tsx b/public/app/features/provisioning/components/Dashboards/SaveProvisionedDashboardForm.tsx index 5dc1c88df26..1f2811089fc 100644 --- a/public/app/features/provisioning/components/Dashboards/SaveProvisionedDashboardForm.tsx +++ b/public/app/features/provisioning/components/Dashboards/SaveProvisionedDashboardForm.tsx @@ -136,10 +136,11 @@ export function SaveProvisionedDashboardForm({ return; } - // If user is writing to the original branch, override ref with whatever we loaded from - if (workflow === 'write') { - ref = loadedFromRef; - } + // TODO: Revisit after we decide on whether to keep the branch selection functionality + // If user is updating a dashboard in the original branch, override ref with whatever we loaded from + // if (workflow === 'write' && !isNew) { + // ref = loadedFromRef; + // } const message = comment || `Save dashboard: ${dashboard.state.title}`; diff --git a/public/app/features/provisioning/components/Folders/NewProvisionedFolderForm.tsx b/public/app/features/provisioning/components/Folders/NewProvisionedFolderForm.tsx index 98d228dbc76..6eeaab029d7 100644 --- a/public/app/features/provisioning/components/Folders/NewProvisionedFolderForm.tsx +++ b/public/app/features/provisioning/components/Folders/NewProvisionedFolderForm.tsx @@ -162,7 +162,7 @@ function FormContent({ initialValues, repository, workflowOptions, folder, onDis { - const options: Array<{ label: string; value: string }> = []; + const options: Array<{ label: string; value: string; description?: string }> = []; const configuredBranch = repository?.branch; const prefix = t( 'provisioned-resource-form.save-or-delete-resource-shared-fields.suffix-configured-branch', - '(Configured branch)' + 'Configured branch' ); // Show the configured branch first in the list if (configuredBranch) { options.push({ - label: `${configuredBranch} ${prefix}`, + label: `${configuredBranch}`, value: configuredBranch, + description: prefix, }); } @@ -129,6 +130,7 @@ export const ResourceEditFormSharedFields = memo { onChange(nextWorkflow); clearErrors('ref'); @@ -138,7 +140,6 @@ export const ResourceEditFormSharedFields = memo )} /> @@ -178,7 +179,6 @@ export const ResourceEditFormSharedFields = memo ) : ( diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index f71b9cd5c16..3d7f02a77ff 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -11164,7 +11164,7 @@ "label-workflow": "Workflow", "placeholder-branch": "Select or enter branch name", "placeholder-new-branch": "Enter new branch name", - "suffix-configured-branch": "(Configured branch)" + "suffix-configured-branch": "Configured branch" } }, "provisioned-resource-preview-banner": {