Skip to content

Conversation

@sddonne
Copy link
Contributor

@sddonne sddonne commented Oct 30, 2025

Part of 235730

Summary

Now "Open in Discover" button opens in a new Discover tab instead of a browser tab.

  • If there are unsaved changes, a confirmation modal is shown before leaving.
  • If there are not unsaved changes, it opens the new tab right away.
  • If tabs feature is disabled, it opens Discover in a new browser tab.
  • If Discover callback for handling tab navigation is not provided, it opens Discover in a new browser tab.

tab-2

Checklist

@sddonne sddonne marked this pull request as ready for review October 31, 2025 13:32
@sddonne sddonne requested review from a team as code owners October 31, 2025 13:32
@sddonne sddonne added v9.3.0 Feature:ES|QL ES|QL related features in Kibana Team:ESQL ES|QL related features in Kibana t// labels Oct 31, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-esql (Team:ESQL)

@sddonne sddonne added backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes labels Oct 31, 2025
Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, some small comments from my side

disableAutoFocus,
controlsContext,
esqlVariables,
onOpenQueryInNewTab,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why in one component is onOpenQuery and on the other is onOpenIndex ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the index editor point of view, it wants to open a specific index in a new tab.
From the esql editor point of view, it provides a general purpose callback to open any kind of query in a new tab.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, makes sense

}, [share?.url.locators]);

const isOpeningInNewTabEnabled = useMemo(
() => featureFlags?.getBooleanValue('discover.tabsEnabled', true) ?? true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we tracking this somewhere? I understand why you didnt add the constant from here src/platform/plugins/shared/discover/public/constants.ts but we might miss it when the discovery team removes the flag.

@davismcphee is there any issue already for this to add a comment?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add the check directly to the Discover codebase instead, that way we can use the const? Would be great to keep references to the flag within Discover as much as possible. Thinking we could check the flag and pass undefined for onOpenQueryInNewTab if it's disabled.

In either case though, we do have an issue for it here to reference: #235232.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes this is much better, it would be great if we can do it ++

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! here it is 198d6aa

Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didnt test again, thanx Sebastian, looks very nice

Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small Unified search changes LGTM! Code review only

Copy link
Contributor

@davismcphee davismcphee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data Discovery changes LGTM and it works well, thanks!

}, [share?.url.locators]);

const isOpeningInNewTabEnabled = useMemo(
() => featureFlags?.getBooleanValue('discover.tabsEnabled', true) ?? true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add the check directly to the Discover codebase instead, that way we can use the const? Would be great to keep references to the flag within Discover as much as possible. Thinking we could check the flag and pass undefined for onOpenQueryInNewTab if it's disabled.

In either case though, we do have an issue for it here to reference: #235232.

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/index-editor 21 24 +3

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
discover 1.2MB 1.2MB +135.0B
esql 579.4KB 579.8KB +392.0B
unifiedSearch 407.9KB 408.0KB +93.0B
total +620.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
unifiedSearch 22.7KB 22.7KB +42.0B
Unknown metric groups

API count

id before after diff
@kbn/index-editor 24 27 +3

ESLint disabled line counts

id before after diff
@kbn/index-editor 2 3 +1

Total ESLint disabled count

id before after diff
@kbn/index-editor 2 3 +1

History

@sddonne sddonne merged commit 20e089c into elastic:main Nov 6, 2025
12 checks passed
wildemat pushed a commit to wildemat/kibana that referenced this pull request Nov 6, 2025
Part of [235730](elastic#235730)
## Summary
Now "Open in Discover" button opens in a new Discover tab instead of a
browser tab.

* If there are unsaved changes, a confirmation modal is shown before
leaving.
* If there are not unsaved changes, it opens the new tab right away.
* If tabs feature is disabled, it opens Discover in a new browser tab.
* If Discover callback for handling tab navigation is not provided, it
opens Discover in a new browser tab.


![tab-2](https://github.com/user-attachments/assets/45497f9c-5d6c-448e-ae37-368cb31dc84e)

### Checklist
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Feature:ES|QL ES|QL related features in Kibana release_note:skip Skip the PR/issue when compiling release notes Team:ESQL ES|QL related features in Kibana t// v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants