Handle unsaved dashboard changed when a user navigates away
What does this MR do and why?
This MR is based off Update customizable dashboard to handle unsaved... (!132114 - merged) and further updates the analytics dashboard to also handle unsaved changes when a user navigates away for [Bug] Handle unsaved changes in analytics dashb... (#410349 - closed).
The following changes are made:
- Add a
beforeunload
event handler. - Add a
beforeRouteLeave
hook to the analytics dashboard. - Update specs.
Note: Product analytics is an experimental feature hidden behind a default off feature flag.
Note: The webpack runtime error is a known issue https://gitlab.slack.com/archives/C03M4R74NDU/p1695736698915219 (internal link).
Screenshots or screen recordings
Recording in chrome
Screen_Recording_2023-09-26_at_17.45.19
Firefox dialog
Safari dialog
How to set up and validate locally
- Be sure to run
yarn
when switching branch to have the correct @cubejs-client dependency installed - Follow these instructions to setup Product Analytics in GDK.
- Onboard
Product Analytics
by setting up the feature at Project > Analytics > Analytics dashboards. - Follow the alert prompt on Project > Analytics > Analytics dashboards to enable customizable dashboards.
- Navigate back to Project > Analytics > Analytics dashboards and click on
New dashboard
. - Make some changes and click on the
Analytics dashboards
breadcrumb. - Confirm that the confirmation modal is shown.
- Navigate again to the
New dashboard
view and make some changes. - Click on any other link and confirm that the browser dialog is shown.
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 #410349 (closed)
Edited by Jiaan Louw