[Import by URL] Migrate retry logic to Vue form
What does this MR do and why?
There are two user (UI) flows for importing a project via URL.
-
New project creation flow (
/import/url/new): This is a multi-step Vue form that creates a project AND starts an import. See !201202 (merged) -
Existing project (or retry import) flow (
/projects/:id/-/import/new): The project already exists. The user needs to import a repo OR retry a failed url import.
This MR focuses on updating the second flow to Vue.
Note: I considered modifying import_by_url_form.vue to handle the second flow. But clearly the old Haml code differentiated between these flows with app/views/shared/_import_form.html.haml acting as the retry form. The backend logic is also different for the two cases, as path 1 creates a new project whilepath 2 depends on a project existing.
Thus I found it cleaner to migrate the retry form to Vue and make it's purpose more clear.
What was migrated
- Repository URL input
- Username/password fields
- Mirror checkbox (with feature flag check)
- SaaS subscription disclaimer for mirroring
- Timeout message
- SVN message
- General info card with repository requirements
What has been modified
- Added check connection button to match import_by_url_form.vue and using the same validation
- Modified the information card as it seemed repetitive.
References
Screenshots or screen recordings
| Before | After |
|---|---|
![]() |
![]() |
How to set up and validate locally
- Fail a url import in order to get to this form. You'd need to do it in the main Create Project via Repo URL form.
-
Enable
import_by_url_new_pageor make sure already enabled -
In admin settings make sure Repository By URL is enabled in
admin/application_settings/general#js-import-export-settings -
Navigate to a group -> Create Project -> Import Project -> Repository by URL
-
Enter a fake git url that should pass the simple client side validation, and a project name and start import
-
If the import does not fail quickly, you may need to open rails console and using the group and project
project = Project.find_by_full_path('namespace/project-name') project.import_state.mark_as_failed('Manual test failure') -
You should be alerted that the import failed OR no repo exists.
-
If you weren't redirected to the retry form, you'd need to go to the failed project page manually and click Import Repository
-
- In the retry form, test the git url validation
- Test the check repository connection (note this is optional to the user)
- Attempt to 'Start import' for an invalid url (such as "not valid")
- Replace url with a valid git url and click Start Import
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 #582110

