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

[uiActions] Support emitting nested triggers and actions #70602

Merged
merged 16 commits into from
Jul 15, 2020

Conversation

Dosant
Copy link
Contributor

@Dosant Dosant commented Jul 2, 2020

Summary

closes #59162

Needed for:

  1. URL Drilldown MVP #69409
  2. Possible way forward for dashboard drilldown and TSVB Drilldowns for TSVB #60611

Clean up In next PR:

  1. "Show underlying data" to work with Apply filter trigger directly Use "Apply_filter_trigger" in "explore underlying data" action #71445
  2. Dashboard drilldown to work with apply filter trigger directly Use "Apply_filter_trigger" in dashboard drilldown #71468

Implementation (more in #59162):

  1. Concept of automatically executed actions
    Such actions won't be batched into 1 context menu but will automatically execute. This could be useful for other reasons anyway (consider the situation of a HOVER trigger and wanting to attach it to an action that shows a tooltip and an action that shows a global threshold line - those are two actions that should be executed simultaneously, and not shown to the user in a context menu for them to choose from).

  2. Introduce batching of emitted triggers to be execute on the next event loop.
    An auto executed action can be attached to VALUE_CLICK_TRIGGER - ACTION_EMIT_APPLY_FILTER_TRIGGER. This checks to see if the data can be transformed into a Filter shape. If it does, it uiActionApi.emit(APPLY_FILTER_TRIGGER, filters). Because this is auto executed, it gets emitted before the event loop, should get batched up and then the context menu shown to the user should contain both actions attached to VALUE_CLICK_TRIGGER and actions attached to APPLY_FILTER_TRIGGER

Checklist

Delete any items that are not applicable to this PR.

@Dosant
Copy link
Contributor Author

Dosant commented Jul 3, 2020

@elasticmachine merge upstream

@Dosant Dosant added Team:AppArch v7.9.0 v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Feature:Drilldowns Embeddable panel Drilldowns Feature:UIActions UI actions. These are client side only, not related to the server side actions.. labels Jul 3, 2020
@Dosant Dosant marked this pull request as ready for review July 3, 2020 14:15
@Dosant Dosant requested a review from a team as a code owner July 3, 2020 14:15
@elasticmachine
Copy link
Contributor

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

@botelastic botelastic bot added the Feature:Embedding Embedding content via iFrame label Jul 3, 2020
Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

LGTM, but i suggest keeping two distinct actions which autoexecute instead of groupuing value_click and range_select triggers under one action.

Copy link
Contributor

@stacey-gammon stacey-gammon left a comment

Choose a reason for hiding this comment

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

  • Like the addition of shouldAutoExecute.
  • Verified the example plugin was updated, with the nested action (didn't test).
  • Didn't pull down and test, just a quick code review.
  • Didn't look too deeply into UiActionsExecutionService.
  • Agree with Peter's remarks about not combining the two triggers.
  • Some public API docs look like they could use some more comments.

Overall, approach looks good. 👍

…iggers

# Conflicts:
#	src/plugins/data/public/public.api.md
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.

LGTM, tested on Mac Chrome, I only think we should add unit tests for the new service.

filterManager.addFilters(restOfFilters);
if (timeRangeFilter) {
esFilters.changeTimeFilter(timeFilter, timeRangeFilter);
shouldAutoExecute: async () => true,
Copy link
Contributor

Choose a reason for hiding this comment

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

Curious, can this be

Suggested change
shouldAutoExecute: async () => true,
autoExecute: true,

? I.e. does it have to by async?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No use case now, but I thought of having it as flexible as possible from that start (doesn't add much burden). Recently had to change getHref: () => string to getHref: () => Promise<string>

@streamich
Copy link
Contributor

Talked over Zoom, the new service has some integration tests covering it, so unit test can be skipped.

@Dosant Dosant added v7.10.0 and removed v7.9.0 labels Jul 15, 2020
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

miscellaneous assets size

id value diff baseline
data 402.6KB -74.0B 402.7KB
embeddable 131.3KB +8.0B 131.2KB
uiActions 88.1KB +1.6KB 86.4KB
upgradeAssistant 22.6KB -1.0B 22.6KB
total - +1.6KB -

page load bundle size

id value diff baseline
data 1.5MB -1.8KB 1.5MB
embeddable 446.8KB +26.0B 446.8KB
uiActions 210.5KB +6.9KB 203.6KB
total - +5.1KB -

History

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

@Dosant Dosant merged commit 1ac56d7 into elastic:master Jul 15, 2020
@Dosant Dosant deleted the dev/nested-triggers branch July 15, 2020 14:44
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jul 15, 2020
* master:
  [Form lib] Memoize form hook object and fix hook array deps (elastic#71237)
  [uiActions] Support emitting nested triggers and actions (elastic#70602)
  add short sleep before clicking Remove on sample data (elastic#71104)
  Fixed the beta badge layout. (elastic#71835)
  Restores task for downloading Chromium builds (elastic#71749)
  [logging] Format new platform json logging to ECS (elastic#71138)
  add policy details and update SO limit requests (elastic#71789)
  Convert vis_type_vega to Typescript (elastic#68915)
  [ML] Fix UI Actions context menu positioning for the Anomaly Swim Lane (elastic#71839)
Dosant added a commit to Dosant/kibana that referenced this pull request Jul 16, 2020
* Introduce automatically executed actions
* Introduce batching of emitted triggers to be execute on the macro task
Dosant added a commit that referenced this pull request Jul 16, 2020
…2027)

* Introduce automatically executed actions
* Introduce batching of emitted triggers to be execute on the macro task
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:skip Skip the PR/issue when compiling release notes v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Ui Actions] Support emitting nested triggers and actions
6 participants