Fix: No default selection of destination namespace when importing with GH, BB ad Gitea
What does this MR do and why?
The previous version of this MR was reverted to address an oversight. The previous button did not include validation for importing all repos.
This regards the import project status page for the following types of imports:
- GitHub
- BitBucket / Gitea
- Manifest imports
These types of projects imports all use the same UI as a base - ImportProjectsTable and ProviderRepoTableRow. The project status page is seen after 1) connecting to GitHub or Gitea, etc, or 2) Uploading a manifest file. This is the page where a user can choose the destination namespace / group for their imports.
Overview of problem
When a user gets to import status page the personal namespace is selected by default in the dropdown for each project. However, we don't want to encourage users to import to personal namespaces - instead they should choose a group, so the MR should remove the default selection in the dropdown.
In addition there is a button at the top of the ImportProjectsTable that allows the user to Import All repos. By removing the default namespace at the ProviderRepoTableRow level it exposed the absence of validation that ensures all rows have a target group selected when the Import <Num> repositories
button is clicked. The previous version of this MR was reverted to address this oversight.
Solution
The MR does the following:
- Removes the manual setting of default namespace (it used to be user namespace)
- Ensures no namespace is selected by default for each provider row of the import project status page for every provider except Manifest imports (Manifest import requires selecting the target namespace before getting to the import status page).
- If a user tries to import or reimport without choosing a namespace, they should see the error underneath the dropdown:
Select a destination namespace
. - When a user tries to follow the 'import All' flow without choosing a destination group for every importable project, they are prompted to first choose namespaces with
Select a destination namespace for each repository before importing all.
- Updates tests
Note
I observed what looks like an existing bug (or potential UX improvement) in the count shown in the 'Import Num repositories' button. Created the issue -> #548223
References
Issue - #534663
MR reverted to fix import all
flow - !192713 (merged)
Screenshots or screen recordings
Before - GitHub import project | After - GitHub import project |
---|---|
Gitea import all |
Gitea import all |
How to set up and validate locally
This requires a github account at minimum to reproduce the frontend UI.
GitHub setup
- Load the app and attempt to create a new project into a group by import from GitHub
- Click the + sign next to your user avatar
- Click Import project, then select GitHub as the source
- Add a GitHub access token in order to connect (you need access to an active GitHub account with at least one repo)
- You will see a list of github projects with 'Select' as the chosen namespace
- Click
Import [N] repository
button towards the top of the page. - You should see a modal requiring namespace
- Click "Import" without changing the namespace for one of the rows
- You should see the 'select a destination namespace' error
- Select a group namespace for that row and the error is removed.
- Click import for that row. You will not see the same error.
Manifest import
- Navigate to http://127.0.0.1:300/import/manifest/new
- Pick a target group
- Upload a manifest file. There's one available at spec/fixtures/aosp_manifest.xml
- click the 'List repositories' button
- When you try to import all / import one / reimport one, you should not be prompted for a namespace.
Gitea (optional)
- Follow the steps to connect to Gitea https://gitlab.com/gitlab-org/foundations/import-and-integrate/team/-/blob/main/importers/gitea.md
- Create a public repo in Gitea that you'll import
- The above doc also includes the process for importing from Gitea
- If all goes well you'll be redirected to the /import/gitea/status page
- Test import and reimport
- Test the Import All process
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #534663