Skip to content

Commit

Permalink
refactor: 💡 change how uiActions are passed to vis embeddable
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Mar 23, 2020
1 parent af3777c commit e29030f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ export class VisualizeEmbeddableFactory extends EmbeddableFactory<
public readonly type = VISUALIZE_EMBEDDABLE_TYPE;

constructor(
private readonly getServices: () => Promise<Pick<VisualizationsStartDeps, 'uiActions'>>
private readonly getUiActions: () => Promise<
Pick<VisualizationsStartDeps, 'uiActions'>['uiActions']
>
) {
super({
savedObjectMetaData: {
Expand Down Expand Up @@ -117,7 +119,7 @@ export class VisualizeEmbeddableFactory extends EmbeddableFactory<

const indexPattern = await getIndexPattern(savedObject);
const indexPatterns = indexPattern ? [indexPattern] : [];
const { uiActions } = await this.getServices();
const uiActions = await this.getUiActions();

const editable = await this.isEditable();
return new VisualizeEmbeddable(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export class VisualizationsPlugin
expressions.registerRenderer(visualizationRenderer);

const embeddableFactory = new VisualizeEmbeddableFactory(
async () => (await core.getStartServices())[1]
async () => (await core.getStartServices())[1].uiActions
);
embeddable.registerEmbeddableFactory(VISUALIZE_EMBEDDABLE_TYPE, embeddableFactory);

Expand Down

0 comments on commit e29030f

Please sign in to comment.