kibana icon indicating copy to clipboard operation
kibana copied to clipboard

Switch without saving warning appears when users switches from ES|QL even after saving the current state

Open bhavyarm opened this issue 1 year ago • 6 comments

Kibana version: 8.13.0 latest snapshot

Browser OS version: Chrome latest

Original install method (e.g. download page, yum, from source, etc.): from snapshots

Describe the bug: Kibana displays "Switch without saving" warning when user tries to switch from ES|QL to non-esql mode even after saving the current state and the query.

Oh please note - all this is happening when I am on a saved search. Should the saved search state remain the same when user switches between ES|QL and non-ESQL mode?

Steps to reproduce:

  1. Open discover and some dataview in regular mode and query something and save it
  2. Switch to ES|QL mode - you can see you are in ES|QL but in the saved search from step 1 - click on save and save again
  3. Try to switch to non-ES|QL mode now and Kibana warns the user about losing the query even though you already saved it in step 2

Screenshots (if relevant):

https://github.com/elastic/kibana/assets/7074629/2305b13c-7254-4391-bc78-45fd28824b8a

bhavyarm avatar Feb 12 '24 23:02 bhavyarm

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

elasticmachine avatar Feb 12 '24 23:02 elasticmachine

cc @stratoula

bhavyarm avatar Feb 12 '24 23:02 bhavyarm

I hear this we can definitely do something better here in the wording.

@MichaelMarcialis wdyt? If a user has saved a saved ES|QL search maybe this modal doesn't make sense or maybe we shuld change the wording?

stratoula avatar Feb 13 '24 06:02 stratoula

Thanks for catching this, @bhavyarm. @stratoula, yes, this warning modal should not be shown if the user transitions from an unmodified (i.e. not dirty) ES|QL-based saved search to a data view. If the ES|QL query is not part of a saved search or is dirty (i.e. has been modified but not resaved), then the modal should continue to show.

MichaelMarcialis avatar Feb 13 '24 16:02 MichaelMarcialis

Luckily, unless I'm missing something, we should be able to support this quite easily by checking the same hasChanged state in Discover that we use to toggle the unsaved changes badge.

davismcphee avatar Feb 13 '24 18:02 davismcphee

This sounds great Davis!

stratoula avatar Feb 14 '24 06:02 stratoula