Handle non-committed changes when switching branches in PA editor
requested to merge 331107-handle-non-committed-changes-when-switching-branches-in-the-pipeline-editor into master
What does this MR do and why?
When user has unsaved changes in the PA editor and they try to switch branch, we now prompt them with a modal that ask them whether they want to discard their changes and switch branch or go back to the form so that they can commit their changes.
Screenshots or screen recordings
Screen_Recording_2021-10-21_at_1.14.42_PM
How to set up and validate locally
- In the rails console
rails c
, writeFeature.enable(:pipeline_editor_branch_switcher)
- Setup a project with at least 2 branches
- Write a CI/CD config (anything even something invalid will do)
- Navigate to CI/CD => Editor
- Switch branch
- Notice that no modal appears and you navigate to the other branch
- Modify the CI/CD config
- Try to switch branch
- Notice that a modal appears
- Click on "Commit changes"
- Notice that the modal closes and it scrolls down to the commit form
- Try to switch branch again
- click on "Switch branch"
- Notice that you now switch branch and you lost the modifications you made.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #331107 (closed)
Edited by Frédéric Caplette