Skip to content

Commit

Permalink
feat: 🎸 show warning message if embeddable not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed May 4, 2020
1 parent 33719b1 commit d50c59c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions x-pack/plugins/embeddable_enhanced/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,15 @@ export class EmbeddableEnhancedPlugin

const storage = new EmbeddableActionStorage(embeddable as EmbeddableWithDynamicActions);
const dynamicActions = new DynamicActionManager({
isCompatible: async (context: unknown) =>
(context as EmbeddableContext).embeddable.runtimeId === embeddable.runtimeId,
isCompatible: async (context: unknown) => {
if (!(context as EmbeddableContext)?.embeddable) {
// eslint-disable-next-line no-console
console.warn('For drilldowns to work action context should contain .embeddable field.');
return false;
}

return (context as EmbeddableContext).embeddable.runtimeId === embeddable.runtimeId;
},
storage,
uiActions: this.uiActions!,
});
Expand Down

0 comments on commit d50c59c

Please sign in to comment.