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

Decouple actions from embeddables: step 1 #44503

Merged

Conversation

stacey-gammon
Copy link
Contributor

@stacey-gammon stacey-gammon commented Aug 30, 2019

Fixes second part of #40491

Second part will be to pull into a separate plugin.

fixes #44342

Dev Docs

The action interface no longer requires an embeddable and triggerContext to be passed in. The shape of ActionContext is now completely up to the specific action implementation.

Previously:

interface Action<
  TEmbeddable extends IEmbeddable = IEmbeddable,	
  TTriggerContext extends {} = {}
> {
  execute(context: { embeddable: TEmbeddable, triggerContext: TriggerContext });
}

Now:

interface Action<ActionContext extends {} = {}> {
  execute(context: ActionContext);
}

@stacey-gammon stacey-gammon added release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. Team:AppArch v7.5.0 v8.0.0 labels Aug 30, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch

@stacey-gammon stacey-gammon added Feature:Embedding Embedding content via iFrame Feature:UIActions UI actions. These are client side only, not related to the server side actions.. labels Aug 30, 2019
@stacey-gammon stacey-gammon force-pushed the 2019-08-30-decouple-action-embeds branch from f378893 to 34a463f Compare August 30, 2019 16:08
@elasticmachine
Copy link
Contributor

💔 Build Failed

const triggerContext = {};
if (isEmbeddable(embeddable) && isTriggerContext(triggerContext)) {
if (isEmbeddable(embeddable)) {
// @ts-ignore
const result = await action.isCompatible({
Copy link
Contributor

Choose a reason for hiding this comment

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

It is not recommended to use @ts-ignore, if there is some TypeScript type mismatch you can cast to specific type or cast to any.

(action as any).isCompatible
(action.isCompatible as any)
(action as SomeType).isCompatible

@stacey-gammon stacey-gammon force-pushed the 2019-08-30-decouple-action-embeds branch from 34a463f to 304f791 Compare August 31, 2019 13:00
@elasticmachine
Copy link
Contributor

💔 Build Failed

@stacey-gammon stacey-gammon force-pushed the 2019-08-30-decouple-action-embeds branch from 2bd4f90 to fb08367 Compare September 3, 2019 13:15
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@stacey-gammon stacey-gammon mentioned this pull request Sep 3, 2019
4 tasks
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

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

context.triggerContext &&
context.triggerContext.filters !== undefined
);
return Boolean(root.getInput().filters !== undefined && context.filters !== undefined);
Copy link
Member

Choose a reason for hiding this comment

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

check embeddable exists as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, should be done in latest commit!

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@stacey-gammon stacey-gammon merged commit 81d06d5 into elastic:master Sep 5, 2019
stacey-gammon added a commit to stacey-gammon/kibana that referenced this pull request Sep 5, 2019
* Decouple actions from embeddables: step 1

* prefer as any instead of is-ignore

* Remove unneccessary test, no more triggerContext to be null.

* Fix bug and fix the test that should have caught it.  Be more strict about checking isCompatible.
@stacey-gammon stacey-gammon requested a review from spong September 5, 2019 14:19
stacey-gammon added a commit that referenced this pull request Sep 5, 2019
* Decouple actions from embeddables: step 1

* prefer as any instead of is-ignore

* Remove unneccessary test, no more triggerContext to be null.

* Fix bug and fix the test that should have caught it.  Be more strict about checking isCompatible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. review v7.5.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Embeddables] ApplyFilterAction calling async isCompatible() without await keyword
4 participants