Skip to content

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

Screen_Recording_2025-05-08_at_12.34.39_PM.mov

Screen Recording 2025-06-06 at 9.27.13 PM.mov

Gitea import all

Gitea-ImportAll-Before.mov

Gitea import all

Gitea-ImportAll-After.mov

How to set up and validate locally

This requires a github account at minimum to reproduce the frontend UI.

GitHub setup

  1. Load the app and attempt to create a new project into a group by import from GitHub
    1. Click the + sign next to your user avatar
    2. Click Import project, then select GitHub as the source
  2. Add a GitHub access token in order to connect (you need access to an active GitHub account with at least one repo)
  3. You will see a list of github projects with 'Select' as the chosen namespace
  4. Click Import [N] repository button towards the top of the page.
  5. You should see a modal requiring namespace
  6. Click "Import" without changing the namespace for one of the rows
  7. You should see the 'select a destination namespace' error
  8. Select a group namespace for that row and the error is removed.
  9. Click import for that row. You will not see the same error.

Manifest import

  1. Navigate to http://127.0.0.1:300/import/manifest/new
  2. Pick a target group
  3. Upload a manifest file. There's one available at spec/fixtures/aosp_manifest.xml
  4. click the 'List repositories' button
  5. When you try to import all / import one / reimport one, you should not be prompted for a namespace.

Gitea (optional)

  1. Follow the steps to connect to Gitea https://gitlab.com/gitlab-org/foundations/import-and-integrate/team/-/blob/main/importers/gitea.md
  2. Create a public repo in Gitea that you'll import
  3. The above doc also includes the process for importing from Gitea
  4. If all goes well you'll be redirected to the /import/gitea/status page
  5. Test import and reimport
  6. 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

Edited by Oiza Baiye

Merge request reports

Loading