Skip to content

Commit

Permalink
feat: 🎸 allow disablint action trigger execution in embeddables
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Feb 14, 2020
1 parent f8b06e3 commit 1815dce
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 @@ -294,13 +294,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 @@ -46,6 +46,7 @@ export function savedVisualization(): ExpressionFunctionDefinition<
type: EmbeddableExpressionType,
input: {
id,
disableTriggers: true,
...buildEmbeddableFilters(filters),
},
embeddableType: EmbeddableTypes.visualization,
Expand Down

0 comments on commit 1815dce

Please sign in to comment.