From dddd80e03ab7047e0217cde80376dc757ea3871b Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Fri, 3 Apr 2020 09:06:44 -0600 Subject: [PATCH 1/3] [Maps] Show create filter button top-term tooltip property --- .../maps/public/layers/fields/es_agg_field.ts | 2 +- .../layers/tooltips/es_agg_tooltip_property.ts | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/maps/public/layers/fields/es_agg_field.ts b/x-pack/plugins/maps/public/layers/fields/es_agg_field.ts index 65f952ca01038c..34f7dd4b9578fc 100644 --- a/x-pack/plugins/maps/public/layers/fields/es_agg_field.ts +++ b/x-pack/plugins/maps/public/layers/fields/es_agg_field.ts @@ -90,7 +90,7 @@ export class ESAggField implements IESAggField { async createTooltipProperty(value: string | undefined): Promise { const indexPattern = await this._source.getIndexPattern(); const tooltipProperty = new TooltipProperty(this.getName(), await this.getLabel(), value); - return new ESAggTooltipProperty(tooltipProperty, indexPattern, this); + return new ESAggTooltipProperty(tooltipProperty, indexPattern, this, this.getAggType()); } getValueAggDsl(indexPattern: IndexPattern): unknown | null { diff --git a/x-pack/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.ts b/x-pack/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.ts index 24011c51ddbaad..29fa3abbd8c047 100644 --- a/x-pack/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.ts +++ b/x-pack/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.ts @@ -4,9 +4,22 @@ * you may not use this file except in compliance with the Elastic License. */ import { ESTooltipProperty } from './es_tooltip_property'; +import { AGG_TYPE } from '../../../common/constants'; export class ESAggTooltipProperty extends ESTooltipProperty { + private readonly _aggType: AGG_TYPE; + + constructor( + tooltipProperty: ITooltipProperty, + indexPattern: IndexPattern, + field: IField, + aggType: AGG_TYPE + ) { + super(tooltipProperty, indexPattern, field); + this._aggType = aggType; + } + isFilterable(): boolean { - return false; + return this._aggType === AGG_TYPE.TERMS; } } From f856dae3e47e7d30e5e6fdfc34fff0f224eec9a3 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Fri, 3 Apr 2020 11:45:23 -0600 Subject: [PATCH 2/3] add missing imports --- .../maps/public/layers/tooltips/es_agg_tooltip_property.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/x-pack/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.ts b/x-pack/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.ts index 29fa3abbd8c047..96ebd5bfca31fa 100644 --- a/x-pack/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.ts +++ b/x-pack/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.ts @@ -5,6 +5,9 @@ */ import { ESTooltipProperty } from './es_tooltip_property'; import { AGG_TYPE } from '../../../common/constants'; +import { ITooltipProperty } from './tooltip_property'; +import { IField } from '../fields/field'; +import { IndexPattern } from '../../../../../../../src/plugins/data/public'; export class ESAggTooltipProperty extends ESTooltipProperty { private readonly _aggType: AGG_TYPE; From d356c4b2d6a4e9360e6eebdca7ef866ff0ce86a2 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Wed, 8 Apr 2020 08:40:11 -0600 Subject: [PATCH 3/3] update import for NP migration --- .../maps/public/layers/tooltips/es_agg_tooltip_property.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.ts b/x-pack/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.ts index 96ebd5bfca31fa..acd05475f97627 100644 --- a/x-pack/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.ts +++ b/x-pack/plugins/maps/public/layers/tooltips/es_agg_tooltip_property.ts @@ -7,7 +7,7 @@ import { ESTooltipProperty } from './es_tooltip_property'; import { AGG_TYPE } from '../../../common/constants'; import { ITooltipProperty } from './tooltip_property'; import { IField } from '../fields/field'; -import { IndexPattern } from '../../../../../../../src/plugins/data/public'; +import { IndexPattern } from '../../../../../../src/plugins/data/public'; export class ESAggTooltipProperty extends ESTooltipProperty { private readonly _aggType: AGG_TYPE;