-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Visualize Editor] Add cancel button when navigating from Dashboard #77608
Conversation
261ea8d
to
8acab1e
Compare
Pinging @elastic/kibana-app (Team:KibanaApp) |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally in chrome, and mostly works as expected. One thing I noticed, though is that the 'unsaved changes' warning is triggered any time you press Cancel, even if you haven't changed anything, or if you've just created a blank visualization with no customizations.
I think this should be addressed, either by fixing it in this PR (see my code comments), or by letting this PR simply be the addition of a cancel button, with no confirmation, and creating a separate leave confirmation PR.
src/plugins/visualize/public/application/utils/get_top_nav_config.tsx
Outdated
Show resolved
Hide resolved
src/plugins/visualize/public/application/utils/get_top_nav_config.tsx
Outdated
Show resolved
Hide resolved
src/plugins/visualize/public/application/utils/get_top_nav_config.tsx
Outdated
Show resolved
Hide resolved
src/plugins/visualize/public/application/utils/get_top_nav_config.tsx
Outdated
Show resolved
Hide resolved
@elasticmachine merge upstream |
4116923
to
6214a92
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for switching this out to use appLeaveHandler
.
Test additions are looking great, and the confirm dialogue comes up mostly when expected with two small exceptions:
- appearing on app leave after a 'create new' without any active changes.
- appearing on save in by value mode.
Overall, LGTM once the CI is passing - tested locally on Chrome
The hook is based on As for the second part, it's gonna be difficult to distinguish between "there is an unsaved change, but I want to discard the modal because there is a save in progress" vs "there is an unsaved change and I wish to show the modal". |
The first problem may just come down to a difference in the 'unsaved changes' calculation between lens and visualize - which might be out of scope for this PR. The second problem we also faced on lens, and found that the most explicit way to do this was to set the onAppLeave((actions) => {
return actions.default();
}); |
9a7e39e
to
9166947
Compare
💚 Build SucceededMetrics [docs]async chunks size
page load bundle size
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally on chrome, everything works as expected!
LGTM.
…77608) (#79738) * Add cancel button in the visualize editor * Fixing i18n namespace * Always show cancel button * Always show cancel button * Adding a fucntional test * Show confirm dialog only if there are unsaved changes * Show confirm modal only if there are changes * Add onAppLeave handler and ditch confirmModal * Fix functional test * Only use onAppLeave if coming from dashboard/canvas * Add actions.default to onSave and onSaveAndReturn Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
Summary
Fixes: #70650
When editing visualizations from Dashboard, currently there is no simple way to cancel editing and return to Dashboard. This PR addresses that, by adding a cancel button. This button is present both the old and new (by-value) flow.
Checklist
Delete any items that are not applicable to this PR.
For maintainers