Skip to content

Show confirmation dialog when exiting pipeline editor

Mireya Andres requested to merge pipeline-editor-confirm-dialog into master

What does this MR do?

For issue #277005 (closed)

When there are unsaved changes in the pipeline editor and the user tries to exit the page, a confirmation dialog will pop up to warn the user that they may lose these changes upon exiting.

Dev Notes

Note that modern browsers no longer allow custom messages to be set for system notifications during the onbeforeunload event, so the MR will use the default messages for each browser. From the MDN docs:

In older browsers, the return value of the event is displayed in this dialog. Starting with Firefox 44, Chrome 51, Opera 38, and Safari 9.1, a generic string not under the control of the webpage will be shown instead of the returned string. For example:

  • Firefox displays the string, "This page is asking you to confirm that you want to leave - data you have entered may not be saved." (see bug 588292).
  • Chrome displays the string, "Do you want to leave this site? Changes you made may not be saved." (see Chrome Platform Status).

Follow Up Issues

There is a follow up issue to revisit testing when the dialog is triggered. This was created for several reasons:

  • To investigate better ways of how to test the behavior
  • The pipeline editor app will have a major restructuring after this refactor is merged, which may change how this is implemented.

The component for the dialog box itself will still have tests. The issue is for integrating tests for when the notification should appear.

Screenshots

Chrome: Chrome

Firefox: Firefox

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited by Mireya Andres

Merge request reports