Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
ppisljar committed Apr 21, 2020
1 parent 0553da9 commit 6c223c3
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const mockField = {
};

describe('createFiltersFromValueClick', () => {
let dataPoints: ValueClickTriggerContext['data'];
let dataPoints: ValueClickTriggerContext['data']['data'];

beforeEach(() => {
dataPoints = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const createFilter = async (
export const createFiltersFromValueClickAction = async ({
data,
negate,
}: ValueClickTriggerContext) => {
}: ValueClickTriggerContext['data']) => {
const filters: Filter[] = [];

await Promise.all(
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/data/public/actions/value_click_action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export type ValueClickActionContext = ValueClickTriggerContext;

async function isCompatible(context: ValueClickActionContext) {
try {
const filters: Filter[] = await createFiltersFromValueClickAction(context);
const filters: Filter[] = await createFiltersFromValueClickAction(context.data);
return filters.length > 0;
} catch {
return false;
Expand All @@ -61,7 +61,7 @@ export function valueClickAction(
throw new IncompatibleActionError();
}

const filters: Filter[] = await createFiltersFromValueClickAction(context);
const filters: Filter[] = await createFiltersFromValueClickAction(context.data);

let selectedFilters = filters;

Expand Down
6 changes: 4 additions & 2 deletions src/plugins/embeddable/public/lib/triggers/triggers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ interface EventData {
export interface ValueClickTriggerContext {
embeddable?: IEmbeddable;
timeFieldName?: string;
data: EventData[];
negate?: boolean;
data: {
data: EventData[];
negate?: boolean;
};
}

export interface RangeSelectTriggerContext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export class VisualizeEmbeddable extends Embeddable<VisualizeInput, VisualizeOut
const context = {
embeddable: this,
timeFieldName: this.vis.data.indexPattern!.timeFieldName!,
...event.data,
data: event.data,
};
getUiActions()
.getTrigger(triggerId)
Expand Down
7 changes: 6 additions & 1 deletion src/plugins/visualizations/public/expressions/vis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,12 @@ export class ExprVis extends EventEmitter {
if (!this.eventsSubject) return;
this.eventsSubject.next({
name: 'filterBucket',
data: data.data ? data : { data: [data] },
data: data.data
? {
data: data.data,
negate: data.negate,
}
: { data: [data] },
});
},
brush: (data: any) => {
Expand Down

0 comments on commit 6c223c3

Please sign in to comment.