Skip to content

Conversation

@Dosant
Copy link
Contributor

@Dosant Dosant commented Apr 10, 2020

Summary

  1. Addresses [Discuss] Separate action's execute() vs getHref() responsibility #63118
  2. Makes getHref async to be able to use urlGenerator inside

Dev Docs

getHref on Action interfaces in uiActions plugin is now async. getHref is now used only to support right click behaviour. execute() takes control on regular click.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@botelastic botelastic bot added the Feature:Embedding Embedding content via iFrame label Apr 10, 2020
@elastic elastic deleted a comment from kibanamachine Apr 10, 2020
@Dosant Dosant added Feature:UIActions UI actions. These are client side only, not related to the server side actions.. v8.0.0 Feature:Drilldowns Embeddable panel Drilldowns v7.8.0 release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. Team:AppArch labels Apr 10, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@Dosant Dosant marked this pull request as ready for review April 10, 2020 15:14
@Dosant Dosant requested a review from a team as a code owner April 10, 2020 15:14
@streamich streamich mentioned this pull request Apr 10, 2020
47 tasks
@Dosant
Copy link
Contributor Author

Dosant commented Apr 14, 2020

@elasticmachine merge upstream

Copy link
Contributor

@streamich streamich left a comment

Choose a reason for hiding this comment

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

Please see comment below, currently on Cmd + Click it navigates the current tab.

Otherwise LGTM, checked on Mac/Chrome.

menuPanelItem.onClick = () => {
action.execute(actionContext);
menuPanelItem.onClick = event => {
if (event.target instanceof HTMLAnchorElement) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this check could be the same as on line 135. I'm thinking of he case where tag might be <a> but action.getHref is not defined.

Suggested change
if (event.target instanceof HTMLAnchorElement) {
if (action.getHref) {

Copy link
Contributor

Choose a reason for hiding this comment

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

I've actually checked this locally, current behavior is that if you Cmd + Click it does two things: (1) navigates in current tab; (2) opens a new tab. Whereas it should just open a new tab.

The above change actually fixes it—not sure what is happening there but event.target does not seem to be <a>.

Copy link
Contributor Author

@Dosant Dosant Apr 15, 2020

Choose a reason for hiding this comment

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

Oh.. thanks! used "wrong" target. So it depended on where you clicked and not on what element handled the event. Should be good now

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@Dosant Dosant merged commit 3b64a65 into elastic:master Apr 15, 2020
Dosant added a commit to Dosant/kibana that referenced this pull request Apr 15, 2020
getHref on Action interfaces in uiActions plugin is now async. getHref is now used only to support right click behaviour. execute() takes control on regular click.
wayneseymour pushed a commit that referenced this pull request Apr 15, 2020
getHref on Action interfaces in uiActions plugin is now async. getHref is now used only to support right click behaviour. execute() takes control on regular click.
Dosant added a commit that referenced this pull request Apr 16, 2020
getHref on Action interfaces in uiActions plugin is now async. getHref is now used only to support right click behaviour. execute() takes control on regular click.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:Drilldowns Embeddable panel Drilldowns Feature:Embedding Embedding content via iFrame Feature:UIActions UI actions. These are client side only, not related to the server side actions.. release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. v7.8.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants