-
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
[Lens] Make open in discover drilldown work #131237
Conversation
Pinging @elastic/kibana-vis-editors @elastic/kibana-vis-editors-external (Team:VisEditors) |
@elasticmachine merge upstream |
@flash1293 I create a drilldown with the open in new tab switch off but when I use it , it opens Discover in a new tab. Am I missing something? |
@stratoula Good catch, something I missed during refactoring. SHould be fixed now. |
@flash1293 it is fixed thanx! Another question. I can see the new drilldown on aggregation based visualizations. I can configure it, but it doesn't work (which makes sense). Can we enable this only for Lens panels? |
That's a good point @stratoula. @ghudgins what do think about this? Would it be OK if the drilldown is showing up even if the panel won't be able to handle it? |
So, I looked into how this drilldown (which will only work in the Lens context) can be ignored otherwise and it's not that hard to add a callback for it. @vadimkibana what do you think about this extension? I'm sure it will be useful for other things as well. |
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.
Nice work! Left a couple of questions. Code review only.
x-pack/plugins/lens/public/trigger_actions/open_in_discover_action.test.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/lens/public/trigger_actions/open_in_discover_action.ts
Outdated
Show resolved
Hide resolved
x-pack/plugins/lens/public/trigger_actions/open_in_discover_helpers.ts
Outdated
Show resolved
Hide resolved
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.
This works great Joe! I find it super useful to be able to add drilldowns specific per embeddable type so my +1 on this approach!
I guess it closes this issue: #60227 |
@vadimkibana I changed it to the discover icon in the code already, the screenshots are outdated. |
@@ -14,14 +14,17 @@ export const ActionFactoryPicker: React.FC = ({}) => { | |||
const drilldowns = useDrilldownManager(); | |||
const factory = drilldowns.useActionFactory(); | |||
const context = React.useMemo(() => drilldowns.getActionFactoryContext(), [drilldowns]); | |||
const applicableFactories = drilldowns.deps.actionFactories.filter((actionFactory) => | |||
actionFactory.isConfigurable(context) |
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.
Shouldn't this be
actionFactory.isConfigurable(context) | |
actionFactory.isCompatible(context) |
and we would not need the new isConfigurable
property? Or am I missing something. What is the difference between isCompatible
and isConfigurable
for the action factory?
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.
@vadimkibana what do you think about this extension? I'm sure it will be useful for other things as well.
I'm trying to understand how isConfigurable
is different from the existing isCompatible
.
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.
I wasn't sure about the semantics of isCompatible
in this place, but it seems like it's coming from here
* Returns a promise that resolves to true if this item is compatible given |
- in this case it's a pretty good fit. Will adjust
@vadimkibana Found a solution I'm happy with - most of the logic is in the state manager now. Could you check out the PR again? |
💚 Build SucceededMetrics [docs]Module Count
Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
References to deprecated APIs
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
* make open in discover drilldown work * cleanup and tests * fix test * fix icon * fix type * fix open in new tab * fix open in new tab * fix test * make it possible to filter out drilldowns from list based on context * review comments * remove isConfigurable from the actionfactory Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Stratoula Kalafateli <[email protected]>
Fixes #122631
Fixes #60227
Adds a drilldown "open in discover" to Lens panels - only config option is whether or not discover is opened in a new tab.
The drilldown becomes active for the filter trigger and basically does the same thing as the panel action "Open in Discover", but it takes the context of the filter click into account as well
Tech details
As it's sharing almost all logic with the existing action, I moved these parts into
open_in_discover
helpers, which are called from the drilldown as well as the action definition, with the following additions:getViewUnderlyingData
To be able to only show the drilldown in the form flyout for Lens embeddables, I added an
isConfigurable
callback to both the drilldown and actionfactory interfaces and call it before rendering the keypad menu to only show it in case the current embeddable is a Lens embeddable.Open question
Which icon to use? The screenshots are outdated, I went with
discoverApp
but I'm not sure - it would be nice to stay consistent with the panel action but the icon only makes sense for "open in new tab"