[Discover][Traces] All "Open in Discover" links now open in a new Discover Tab on left-click#251103
Conversation
…liverable-open-in-discover-in-logs-traces-discover-fly-outs-open-new-tab
…liverable-open-in-discover-in-logs-traces-discover-fly-outs-open-new-tab
…liverable-open-in-discover-in-logs-traces-discover-fly-outs-open-new-tab
…er-fly-outs-open-new-tab' of https://github.com/iblancof/kibana into 4863-deliverable-open-in-discover-in-logs-traces-discover-fly-outs-open-new-tab
...ns/shared/unified_doc_viewer/public/components/content_framework/section/section_actions.tsx
Outdated
Show resolved
Hide resolved
...oc_viewer/public/components/doc_viewer_logs_overview/sub_components/similar_errors/index.tsx
Outdated
Show resolved
Hide resolved
...unified_doc_viewer/public/components/observability/traces/components/errors/errors_table.tsx
Outdated
Show resolved
Hide resolved
...orm/plugins/shared/unified_doc_viewer/public/hooks/use_doc_viewer_extension_actions/index.ts
Outdated
Show resolved
Hide resolved
| if (canOpenInNewTab) { | ||
| openInNewTab({ | ||
| query: { esql }, | ||
| tabLabel, | ||
| }); | ||
| } |
There was a problem hiding this comment.
You could do like this if you want to:
| if (canOpenInNewTab) { | |
| openInNewTab({ | |
| query: { esql }, | |
| tabLabel, | |
| }); | |
| } | |
| actions?.openInNewTab?.( | |
| query: { esql }, | |
| tabLabel | |
| }); |
There was a problem hiding this comment.
The condition checks for esql too, as it needs to be defined to run the action.
That’s why I’m using canOpenInNewTab (also used later in the code), which ensures both openInNewTab and esql are defined
davismcphee
left a comment
There was a problem hiding this comment.
Data Discovery changes look good overall, just a small request to adjust the types a bit.
| export interface DocViewActions { | ||
| openInNewTab?: (params: { | ||
| query?: Query | AggregateQuery; | ||
| tabLabel?: string; | ||
| timeRange?: TimeRange; | ||
| }) => void; | ||
| updateESQLQuery?: (queryOrUpdater: string | ((prevQuery: string) => string)) => void; | ||
| } |
There was a problem hiding this comment.
These actions are too Discover specific to add on all doc views. Can we instead make doc views that want to use them extend a common props interface with actions?: DocViewActions; to make it opt in?
Also unfortunate we need to duplicate types from Discover, but that's more an issue on our end. We originally assumed contextual components would live directly in the Discover codebase.
There was a problem hiding this comment.
Hey Davis, thanks so much for the feedback.
These actions are too Discover specific to add on all doc views. Can we instead make doc views that want to use them extend a common props interface with
actions?: DocViewActions;to make it opt in?
I actually had the same question initially when adding actions directly to DocViewRenderProps, but I decided to include it after seeing that filters, onAddColumn, and onRemoveColumn were already defined there, and those also feel quite tightly coupled to Discover. Are those functions meant to be used outside of Discover as well? Maybe I’m missing some context here.
That said, I’ll follow your recommendation since you suggested it, but I’d still love to better understand what makes actions different from the other functions I mentioned above.
Also unfortunate we need to duplicate types from Discover, but that's more an issue on our end. We originally assumed contextual components would live directly in the Discover codebase.
Yeah, I did run into circular deps at some point because of types. We could probably “just” extract them, but based on what you mentioned about the initial assumption, I get the sense that the issue goes beyond that.
There was a problem hiding this comment.
Thanks for updating it!
Are those functions meant to be used outside of Discover as well?
While it's not the way I'd model it personally tbh, yes they can be. They're for integrating with any consumers supporting Unified Search or displaying tabular results (e.g. Timeline, Streams, etc.). Also worth noting Unified Doc Viewer is quite old and carries around some unfortunate tech debt.
We could probably “just” extract them, but based on what you mentioned about the initial assumption, I get the sense that the issue goes beyond that.
I think extracting them is probably an acceptable solution, it just hadn't been an issue until more recently so we never did. I'm also ok with components living outside the Discover codebase, just an incorrect assumption when we first built things.
There was a problem hiding this comment.
In general we're adding more and more Discover specific code like these hooks to the Unified Doc Viewer plugin, but it's really intended to be generic. Not an ask for this PR of course, but I think we should discuss migrating contextual components to the @kbn/discover-contextual-components package.
There was a problem hiding this comment.
Yeah, we’re adding quite a bit of Discover specific functionality right now, mainly because that’s where we're using it the most at the moment. I also understand that unified_doc_viewer is meant to be reused in other areas (probably APM for us in the future), similar to what the logs embeddable is doing, am I right?
It might be helpful to clarify some guidelines around this, since having things like filter, onAddColumn, or onRemoveColumn can be a bit confusing when trying to keep the architectural structure you’re aiming for in mind.
I’d be happy to have a conversation about this, and if moving things to @kbn/discover-contextual-components makes sense, I think doing it sooner rather than later would help us get the most out of it while keeping a clean structure.
Would One Discover sync be the right place for this, especially considering Security might start adding things on their side soon?
There was a problem hiding this comment.
Yeah, Unified Doc Viewer is used in a few different places currently. Streams, ES|QL grid, synthetics, etc., but Discover is the main one. Similar to the embeddable, but also our other shared components like Unified Data Table and Unified Field List.
I don't think we need to be too worried about the other props though and can still treat the Discover actions differently. I'm also in part pushing for this approach because I'd like to unify extension point actions handling, and this way simplifies that later.
Definitely up to chat more about moving things to @kbn/discover-contextual-components though, and agreed sooner is better. Been meaning to for a while tbh, and One Discover would be the place to do it!
…liverable-open-in-discover-in-logs-traces-discover-fly-outs-open-new-tab
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Public APIs missing exports
Unknown metric groupsReferences to deprecated APIs
Unreferenced deprecated APIs
History
cc @iblancof |
davismcphee
left a comment
There was a problem hiding this comment.
Thanks for the updates! Tested the trace overview locally and it works well, LGTM 👍
| export interface DocViewActions { | ||
| openInNewTab?: (params: { | ||
| query?: Query | AggregateQuery; | ||
| tabLabel?: string; | ||
| timeRange?: TimeRange; | ||
| }) => void; | ||
| updateESQLQuery?: (queryOrUpdater: string | ((prevQuery: string) => string)) => void; | ||
| } |
There was a problem hiding this comment.
Thanks for updating it!
Are those functions meant to be used outside of Discover as well?
While it's not the way I'd model it personally tbh, yes they can be. They're for integrating with any consumers supporting Unified Search or displaying tabular results (e.g. Timeline, Streams, etc.). Also worth noting Unified Doc Viewer is quite old and carries around some unfortunate tech debt.
We could probably “just” extract them, but based on what you mentioned about the initial assumption, I get the sense that the issue goes beyond that.
I think extracting them is probably an acceptable solution, it just hadn't been an issue until more recently so we never did. I'm also ok with components living outside the Discover codebase, just an incorrect assumption when we first built things.
There was a problem hiding this comment.
Yeah, Unified Doc Viewer is used in a few different places currently. Streams, ES|QL grid, synthetics, etc., but Discover is the main one. Similar to the embeddable, but also our other shared components like Unified Data Table and Unified Field List.
I don't think we need to be too worried about the other props though and can still treat the Discover actions differently. I'm also in part pushing for this approach because I'd like to unify extension point actions handling, and this way simplifies that later.
Definitely up to chat more about moving things to @kbn/discover-contextual-components though, and agreed sooner is better. Been meaning to for a while tbh, and One Discover would be the place to do it!
…n in new Discover tabs (#251879) ## Summary Relates to #241280 Closes #251104 With the recent addition of Discover Tabs, we wanted to update all links in the Overview tab that open Discover queries so that they now open in a new Discover tab on left-click, instead of reloading Discover, providing a more seamless experience. This work was split into two parts: - “Open in Discover” links in all sections - #251103 - Links to specific documents or contexts (handled in this PR) Some of the links in this PR may eventually open the details in a child flyout. However, to maintain a consistent pattern for all links pointing to Discover, we decided to migrate them all now, even if their behavior will change in the future. |Section|Behaviour| |-|-| |Errors|| |Span links|| --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
…n in new Discover tabs (elastic#251879) ## Summary Relates to elastic#241280 Closes elastic#251104 With the recent addition of Discover Tabs, we wanted to update all links in the Overview tab that open Discover queries so that they now open in a new Discover tab on left-click, instead of reloading Discover, providing a more seamless experience. This work was split into two parts: - “Open in Discover” links in all sections - elastic#251103 - Links to specific documents or contexts (handled in this PR) Some of the links in this PR may eventually open the details in a child flyout. However, to maintain a consistent pattern for all links pointing to Discover, we decided to migrate them all now, even if their behavior will change in the future. |Section|Behaviour| |-|-| |Errors|| |Span links|| --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Summary
Closes #241280
Now that we have Discover Tabs, all links from Discover within Discover should open in a new tab.
This PR updates all the "Open in Discover" buttons to follow that pattern, as decided by the product team.
Span/Transaction flyout
TODO, pending on #249632 to be mergedℹ️ Updated
data-test-subjfor Span Links and Errors sections, which were duplicated and wrong.Log flyout