Skip to content

Commit

Permalink
feat: 🎸 allow disablint action trigger execution in embeddables (#57691…
Browse files Browse the repository at this point in the history
…) (#57979)

Co-authored-by: Elastic Machine <[email protected]>

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
streamich and elasticmachine authored Feb 19, 2020
1 parent f0d5222 commit 0beb112
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,15 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
return;
}

const eventName = event.name === 'brush' ? SELECT_RANGE_TRIGGER : VALUE_CLICK_TRIGGER;
if (!this.input.disableTriggers) {
const eventName = event.name === 'brush' ? SELECT_RANGE_TRIGGER : VALUE_CLICK_TRIGGER;

npStart.plugins.uiActions.executeTriggerActions(eventName, {
embeddable: this,
timeFieldName: this.vis.indexPattern.timeFieldName,
data: event.data,
});
npStart.plugins.uiActions.executeTriggerActions(eventName, {
embeddable: this,
timeFieldName: this.vis.indexPattern.timeFieldName,
data: event.data,
});
}
})
);

Expand Down
6 changes: 6 additions & 0 deletions src/plugins/embeddable/public/lib/embeddables/i_embeddable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,16 @@ export interface EmbeddableInput {
lastReloadRequestTime?: number;
hidePanelTitles?: boolean;
isEmptyState?: boolean;

/**
* List of action IDs that this embeddable should not render.
*/
disabledActions?: string[];

/**
* Whether this embeddable should not execute triggers.
*/
disableTriggers?: boolean;
}

export interface EmbeddableOutput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function savedVisualization(): ExpressionFunctionDefinition<
type: EmbeddableExpressionType,
input: {
id,
disableTriggers: true,
...buildEmbeddableFilters(filters),
},
embeddableType: EmbeddableTypes.visualization,
Expand Down

0 comments on commit 0beb112

Please sign in to comment.