From 222d896db6de0c7fb1dae149a3bd5a937c38e1b6 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Tue, 4 Mar 2025 09:58:47 +0300 Subject: [PATCH] Provisioning: Only show setup page when feature toggles are missing (#101502) --- .betterer.results | 28 ++++++--- .../app/features/provisioning/ConfigForm.tsx | 35 +++++------ .../provisioning/ConfigFormGithubCollapse.tsx | 62 +++++++++++++++++++ .../provisioning/NewRepositoryPage.tsx | 2 - .../features/provisioning/OnboardingPage.tsx | 2 - .../provisioning/RepositoryListPage.tsx | 2 - .../app/features/provisioning/Setup/types.ts | 5 +- .../app/features/provisioning/Setup/utils.ts | 2 +- .../provisioning/TokenPermissionsInfo.tsx | 5 +- .../Wizard/MigrateToProvisioningPage.tsx | 2 - .../provisioning/Wizard/RepositoryStep.tsx | 16 ++++- public/app/features/provisioning/types.ts | 6 +- .../app/features/provisioning/utils/routes.ts | 3 +- 13 files changed, 121 insertions(+), 49 deletions(-) create mode 100644 public/app/features/provisioning/ConfigFormGithubCollapse.tsx diff --git a/.betterer.results b/.betterer.results index a40f5a89929..d732ff0ee73 100644 --- a/.betterer.results +++ b/.betterer.results @@ -5608,11 +5608,23 @@ exports[`better eslint`] = { [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "19"], [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "20"], [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "21"], - [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "22"], - [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "23"], - [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "24"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "25"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "26"] + [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "22"] + ], + "public/app/features/provisioning/ConfigFormGithubCollapse.tsx:5381": [ + [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"], + [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "1"], + [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "2"], + [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "3"], + [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "4"], + [0, 0, 0, "No untranslated strings. Wrap text with ", "5"], + [0, 0, 0, "No untranslated strings. Wrap text with ", "6"], + [0, 0, 0, "No untranslated strings. Wrap text with ", "7"], + [0, 0, 0, "No untranslated strings. Wrap text with ", "8"], + [0, 0, 0, "No untranslated strings. Wrap text with ", "9"], + [0, 0, 0, "No untranslated strings. Wrap text with ", "10"], + [0, 0, 0, "No untranslated strings. Wrap text with ", "11"], + [0, 0, 0, "No untranslated strings. Wrap text with ", "12"], + [0, 0, 0, "No untranslated strings. Wrap text with ", "13"] ], "public/app/features/provisioning/DeleteRepositoryButton.tsx:5381": [ [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"], @@ -5788,8 +5800,7 @@ exports[`better eslint`] = { [0, 0, 0, "No untranslated strings. Wrap text with ", "8"], [0, 0, 0, "No untranslated strings. Wrap text with ", "9"], [0, 0, 0, "No untranslated strings. Wrap text with ", "10"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "11"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "12"] + [0, 0, 0, "No untranslated strings. Wrap text with ", "11"] ], "public/app/features/provisioning/Wizard/ConnectionStep.tsx:5381": [ [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "0"], @@ -5833,7 +5844,8 @@ exports[`better eslint`] = { [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "14"], [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "15"], [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "16"], - [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "17"] + [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "17"], + [0, 0, 0, "No untranslated strings in text props. Wrap text with or use t()", "18"] ], "public/app/features/provisioning/Wizard/Stepper.tsx:5381": [ [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] diff --git a/public/app/features/provisioning/ConfigForm.tsx b/public/app/features/provisioning/ConfigForm.tsx index f64a2d344c6..47590efb6cc 100644 --- a/public/app/features/provisioning/ConfigForm.tsx +++ b/public/app/features/provisioning/ConfigForm.tsx @@ -8,8 +8,8 @@ import { Button, Combobox, ComboboxOption, + ControlledCollapse, Field, - FieldSet, Input, MultiCombobox, RadioButtonGroup, @@ -19,6 +19,7 @@ import { } from '@grafana/ui'; import { FormPrompt } from 'app/core/components/FormPrompt/FormPrompt'; +import { ConfigFormGithubCollpase } from './ConfigFormGithubCollapse'; import { TokenPermissionsInfo } from './TokenPermissionsInfo'; import { Repository, RepositorySpec } from './api'; import { useCreateOrUpdateRepository } from './hooks'; @@ -53,7 +54,7 @@ export function getDefaultValues(repository?: RepositorySpec): RepositoryFormDat url: '', branch: 'main', generateDashboardPreviews: true, - workflows: ['write', 'branch'], + workflows: ['branch', 'write'], sync: { enabled: true, target: 'instance', @@ -139,8 +140,8 @@ export function ConfigForm({ data }: ConfigFormProps) { {type === 'github' && ( -
- + <> + - - Render before/after images and link them to the pull request. -
- NOTE! these will be public URLs!!!" - - } - > - -
- {/* The lint option is intentionally not presented here, as it's an experimental feature. */} -
+ )} {type === 'local' && ( @@ -229,7 +217,13 @@ export function ConfigForm({ data }: ConfigFormProps) { /> -
+ {type === 'github' && ( + } + /> + )} + + @@ -253,7 +247,8 @@ export function ConfigForm({ data }: ConfigFormProps) { -
+ +