Upload new file modal: Replace toggle with commit changes UI
Proposal
After discussions in #444302 (closed), the piece of UI that allows users to commit to a new/existing branch has been updated for the Edit/Delete file flow in !170512 (merged). This branch selection UI inside modals that allow users to commit changes should also be percolated to: New file, Upload file, and New directory. The design proposal is:
- Replace the toggle for "Start a new merge request with these changes" with a checkbox as per Pajamas guidelines
- Update the "Target branch" section of the UI to allow users to commit to the current branch, or new branch
| Current | Proposed |
|---|---|
|
![]() |
Problem
When you go to upload a file, the option to start a merge request is a toggle.
Steps
- Go to "Code > Repository"
- Click on the "+"
- Click on "Upload file"
Implementation guide
The same toggle is used in three places. That is:
Change GlToggle to GlFormCheckbox
Scenarios
The following conditions should be considered (see !170512 (merged)):
- Commit to the current branch and user can push to the branch
- Commit to the current branch and user can NOT push to the branch
- Commit to new branch and open a MR
- Commit to new branch and NOT open a MR
- Cancel button pops a confirmation modal
- Mobile screen
Related UI
These are areas of the UI that should all be using the same commit changes modal UI:
| UI element | Issues/MRs | Reproduction steps |
|---|---|---|
| Edit file |
!170512 (merged) (reverted) |
Code > Repository > Select a file > Edit > Edit single file |
| Delete file |
#503405 (closed) (open) |
Code > Repository > Select a file > Delete |
| New file |
#502460 (closed) (open) |
Code > Repository > New file |
| Upload file |
#479249 (closed) (this, open) |
Code > Repository > Upload file |
| New directory |
#502483 (closed) (open) |
Code > Repository > New directory |


