Skip to content
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

[Inventory v2] Open Explore in Discover link in a new tab #207064

Closed
jennypavlova opened this issue Jan 17, 2025 · 6 comments · Fixed by #207346
Closed

[Inventory v2] Open Explore in Discover link in a new tab #207064

jennypavlova opened this issue Jan 17, 2025 · 6 comments · Fixed by #207346
Assignees
Labels
bug Fixes for quality problems that affect the customer experience Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team

Comments

@jennypavlova
Copy link
Member

jennypavlova commented Jan 17, 2025

Summary

While testing the Explore in Discover link we saw a different behavior based on how the link is opened. If the link opens in the same time it works as expected (We are using the discover locator - implementation)

same_tab_working.mov

When opening the same link in a new tab (or copy/paste) the ad-hoc data view is not shown (there is a warning message on the screen)

new_tab_not_working.mov

I am wondering if opening in a new tab is a limitation of the ad-hoc dataviews or something that Discover locator doesn't support (in the screen recording is visible that the id is populated and then changes when the page loaded) Or if there are any changes to the redirect required to support it 🤔
Pinging @elastic/kibana-data-discovery as Codeowner of the discover locator- Can you please take a look at the issue and help us fix that?

Implementation details

We should try the solution mentioned in #207064 (comment) and fix this #204026 (comment)

AC

  • The link to discover should navigate to discover with the correct data view based on the selected entity
    • Should work the same when the link is clicked and when it's opened in a new tab
@jennypavlova jennypavlova added the Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team label Jan 17, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@davismcphee
Copy link
Contributor

@jennypavlova Based on the code, I'm guessing the issue here is that only the dataViewId is being passed to the locator and added to the URL, so Discover doesn't know how to recreate the data view when opened in a new tab. It works when opened in the same tab because the ad hoc data view still exists in memory.

Instead you can pass dataViewSpec to the locator, which embeds the whole spec and allows Discover to recreate it from the URL: dataViewSpec: dataView?.toMinimalSpec(). It may also help to type the locator params when retrieving it so you get proper typing: share.url.locators.get<DiscoverAppLocatorParams>('DISCOVER_APP_LOCATOR').

On a side note, I think there may be an issue with the conditions for showing the locator link which I left a comment about here: #204026 (comment).

@jennypavlova
Copy link
Member Author

@davismcphee Thank you for your help! I updated the issue and we will try to solve both things as part of the fix here :)

@jennypavlova jennypavlova added the bug Fixes for quality problems that affect the customer experience label Jan 20, 2025
@rmyz rmyz self-assigned this Jan 21, 2025
@rmyz
Copy link
Contributor

rmyz commented Jan 21, 2025

Hey @roshan-elastic, working on this, I found a small rare issue:

There's a case that may happen with the custom entity definitions if the index pattern is not defined/empty if we click the Explore in Discover button for an entity, redirecting you to the Discover view but with no title and no available suggested fields.

Image

This is happening right now, what should we do? Some options here

  1. If we don't have a title in the data view, we can remove the Explore in Discover button
  2. Make a default title + index pattern for the data views if the entity definition doesn't contain it.
  3. Keep it like it is now (having no title + suggested fields) may seem weird but it's working.

CC @jennypavlova

@rmyz
Copy link
Contributor

rmyz commented Jan 21, 2025

As discussed with @roshan-elastic, we will leave it as it is, no changes are needed as this is not critical.

@roshan-elastic
Copy link

Thanks both. Yeah, I'm OK leaving this if as it's a 'nice-to-have' (especially handling data views where the index pattern is missing in the source - that is an edge case).

@rmyz rmyz closed this as completed in 131a543 Jan 21, 2025
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue Jan 21, 2025
…07346)

## Summary

Closes elastic#207064

This PR fixes the Explore in Discover link to be able to open it in a
new tab using `dataViewSpec: dataView.toMinimalSpec()`.

## How to test it
1. Enable `entityCentricExperience` feature flag
2. Run some synthtrace scenario, for example `node scripts/synthtrace
infra_docker_containers`
3. Click into an entity group and select Explore in Discover in any
entity.
4. You should be redirected to the data view correctly by clicking or
opening in a new tab

---------

Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit 131a543)
kibanamachine added a commit that referenced this issue Jan 21, 2025
…7346) (#207434)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Inventory] Fix Open Explore in Discover link in a new tab
(#207346)](#207346)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Sergi
Romeu","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-21T19:54:55Z","message":"[Inventory]
Fix Open Explore in Discover link in a new tab (#207346)\n\n##
Summary\n\nCloses #207064\n\nThis PR fixes the Explore in Discover link
to be able to open it in a\nnew tab using `dataViewSpec:
dataView.toMinimalSpec()`.\n\n## How to test it\n1. Enable
`entityCentricExperience` feature flag\n2. Run some synthtrace scenario,
for example `node scripts/synthtrace\ninfra_docker_containers`\n3. Click
into an entity group and select Explore in Discover in any\nentity.\n4.
You should be redirected to the data view correctly by clicking
or\nopening in a new tab\n\n---------\n\nCo-authored-by: kibanamachine
<[email protected]>","sha":"131a543eb280e45d3d4493da96e29fbd2e5df87c","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","v9.0.0","backport:prev-minor","Team:obs-ux-infra_services"],"title":"[Inventory]
Fix Open Explore in Discover link in a new
tab","number":207346,"url":"https://github.com/elastic/kibana/pull/207346","mergeCommit":{"message":"[Inventory]
Fix Open Explore in Discover link in a new tab (#207346)\n\n##
Summary\n\nCloses #207064\n\nThis PR fixes the Explore in Discover link
to be able to open it in a\nnew tab using `dataViewSpec:
dataView.toMinimalSpec()`.\n\n## How to test it\n1. Enable
`entityCentricExperience` feature flag\n2. Run some synthtrace scenario,
for example `node scripts/synthtrace\ninfra_docker_containers`\n3. Click
into an entity group and select Explore in Discover in any\nentity.\n4.
You should be redirected to the data view correctly by clicking
or\nopening in a new tab\n\n---------\n\nCo-authored-by: kibanamachine
<[email protected]>","sha":"131a543eb280e45d3d4493da96e29fbd2e5df87c"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/207346","number":207346,"mergeCommit":{"message":"[Inventory]
Fix Open Explore in Discover link in a new tab (#207346)\n\n##
Summary\n\nCloses #207064\n\nThis PR fixes the Explore in Discover link
to be able to open it in a\nnew tab using `dataViewSpec:
dataView.toMinimalSpec()`.\n\n## How to test it\n1. Enable
`entityCentricExperience` feature flag\n2. Run some synthtrace scenario,
for example `node scripts/synthtrace\ninfra_docker_containers`\n3. Click
into an entity group and select Explore in Discover in any\nentity.\n4.
You should be redirected to the data view correctly by clicking
or\nopening in a new tab\n\n---------\n\nCo-authored-by: kibanamachine
<[email protected]>","sha":"131a543eb280e45d3d4493da96e29fbd2e5df87c"}}]}]
BACKPORT-->

Co-authored-by: Sergi Romeu <[email protected]>
viduni94 pushed a commit to viduni94/kibana that referenced this issue Jan 23, 2025
…07346)

## Summary

Closes elastic#207064

This PR fixes the Explore in Discover link to be able to open it in a
new tab using `dataViewSpec: dataView.toMinimalSpec()`.

## How to test it
1. Enable `entityCentricExperience` feature flag
2. Run some synthtrace scenario, for example `node scripts/synthtrace
infra_docker_containers`
3. Click into an entity group and select Explore in Discover in any
entity.
4. You should be redirected to the data view correctly by clicking or
opening in a new tab

---------

Co-authored-by: kibanamachine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants