Add warning modal when a DAST profile has unsaved changes
What does this MR do and why?
This MR resolves #366759 (closed)
Describe in detail what your merge request does and why.
When user touches new/edit form, before save button is clicked, there will be unsaved changes.
If user wants to change view back to profiles list, warning modal should appear with prompt question and several action options.
Implementation details.
- There are a lot of deep nested components, that are involved hence there are a lot of scenarios when to show and not to show modal (for example: edited from list should return to list if changes are discarded or should be closed completely if was initially opened from active selector).
- Using store in not efficient, as
dast_profiles_configurator
component is reused acrosson_demand_scans
anddast_profiles_configuration
, and we have to inject store in several places and it is harder to re-use component and test it - Prop drilling is bad idea as logic is spread across several component layers and it harder to maintain, as you have to look across components for different
if
else
scenarios. - I decided to go with wrapper component, that contains modal and its internal logic weather to stop event propagation and show modal or bubble event up. It serves as a proxy. With that approach
dast_profiles_sidebar
logic is untouched and we delegate showing/hiding modal logic to independent component
Screenshots or screen recordings
before |
---|
before |
after |
---|
after_edit |
These are strongly recommended to assist reviewers and reduce the time to merge your change.
How to set up and validate locally
- Go to
URL/root/
PROJECT_ID/-/security/configuration/dast - Open Sidebar with
Select scanner|site profile
- Open
new|edit
form and type something in any input field, make form dirty - Then try to either cancel or click edit another profile or change
scanner|site
profile
Numbered steps to set up and validate the change are strongly suggested.
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 #366759 (closed)
Edited by Artur Fedorov