Replace toggle with commit changes UI
What does this MR do and why?
This MR reuses CommitChangesModal component for NewDirectoryModal. The change unifies UI for creating new directory with uploading/deleting/replacing files in a repository view and editing files in a single file editor.
I was able to remove some of the consts for translations, since they are now only used in CommitChangesModal.
I have also added one more test case for when user wants to push to a new branch without creating an MR.
Note: there's a slight change of behaviour that we decided on. All the modals we're rewriting will not give an option to create an MR, if a change is pushed to the same branch (see the discussion)
References
Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.
- issue solved with this MR
- decision to not give an option for creating a new MR, when change is added to the current branch
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Context | Before | After |
---|---|---|
new directory on the same branch | BEFORE_new_dir_same_branch | AFTER_new_dir_same_branch |
new directory on a new branch with an MR | BEFORE_new_dir_new_branch_with_MR | AFTER_new_dir_new_branch_with_MR |
new directory on a new branch without an MR | BEFORE_new_dir_new_branch_no_MR | AFTER_new_dir_new_branch_no_MR |
new directory on a different branch that already exists | BEFORE_new_dir_already_existing_branch | AFTER_new_dir_already_existing_branch |
How to set up and validate locally
- Go to a Project / Repository
- On the Repository breadcrumbs click plus button and select New directory
- Check creating the a new folder for the following scenarios:
- new directory on the same branch
- new directory on a new branch with an MR
- new directory on a new branch without an MR
- new directory on a different branch that already exists
- Make sure there are no console errors.
Numbered steps to set up and validate the change are strongly suggested.
Related to #502483