Skip to content

Add warning modal when a DAST profile has unsaved changes

Artur Fedorov requested to merge 366759-dast-profiles-warning-modal into master

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.

  1. 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).
  2. Using store in not efficient, as dast_profiles_configurator component is reused across on_demand_scans and dast_profiles_configuration, and we have to inject store in several places and it is harder to re-use component and test it
  3. 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.
  4. 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

after_saving

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

  1. Go to URL/root/PROJECT_ID/-/security/configuration/dast
  2. Open Sidebar with Select scanner|site profile
  3. Open new|edit form and type something in any input field, make form dirty
  4. 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.

Related to #366759 (closed)

Edited by Artur Fedorov

Merge request reports