From 9434271c05cc9c4e013475900efe79c0b6ed488f Mon Sep 17 00:00:00 2001 From: Uladzislau Lasitsa Date: Wed, 18 Nov 2020 17:15:45 +0300 Subject: [PATCH 1/3] Added restrictions and type to filtering filed for group by --- .../components/panel_config/table.js | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js b/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js index bb3f0041abca7..a89e24923b8bb 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js +++ b/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js @@ -45,6 +45,7 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; import { QueryBarWrapper } from '../query_bar_wrapper'; import { getDefaultQueryLanguage } from '../lib/get_default_query_language'; +import { VisDataContext } from './../../contexts/vis_data_context'; export class TablePanelConfig extends Component { constructor(props) { super(props); @@ -115,13 +116,19 @@ export class TablePanelConfig extends Component { /> } > - + + {(visData) => ( + + )} + From 450402050c99edc8238838fb217002a0a6b8786b Mon Sep 17 00:00:00 2001 From: Uladzislau Lasitsa Date: Thu, 19 Nov 2020 11:42:43 +0300 Subject: [PATCH 2/3] Use context instead of consumer --- .../components/panel_config/table.js | 23 ++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js b/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js index a89e24923b8bb..aeabea388a7c6 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js +++ b/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js @@ -47,6 +47,7 @@ import { QueryBarWrapper } from '../query_bar_wrapper'; import { getDefaultQueryLanguage } from '../lib/get_default_query_language'; import { VisDataContext } from './../../contexts/vis_data_context'; export class TablePanelConfig extends Component { + static contextType = VisDataContext; constructor(props) { super(props); this.state = { selectedTab: 'data' }; @@ -116,19 +117,15 @@ export class TablePanelConfig extends Component { /> } > - - {(visData) => ( - - )} - + From d24c5fe471412559e40e9ca0f4a906eb1312aa6c Mon Sep 17 00:00:00 2001 From: Uladzislau Lasitsa Date: Thu, 19 Nov 2020 12:04:23 +0300 Subject: [PATCH 3/3] Added bucket types --- .../{metric_types.js => metric_types.ts} | 34 +++++++++++-------- .../components/panel_config/table.js | 3 +- 2 files changed, 22 insertions(+), 15 deletions(-) rename src/plugins/vis_type_timeseries/common/{metric_types.js => metric_types.ts} (63%) diff --git a/src/plugins/vis_type_timeseries/common/metric_types.js b/src/plugins/vis_type_timeseries/common/metric_types.ts similarity index 63% rename from src/plugins/vis_type_timeseries/common/metric_types.js rename to src/plugins/vis_type_timeseries/common/metric_types.ts index 05836a6df410a..a045dbf38c1f9 100644 --- a/src/plugins/vis_type_timeseries/common/metric_types.js +++ b/src/plugins/vis_type_timeseries/common/metric_types.ts @@ -17,20 +17,26 @@ * under the License. */ -export const METRIC_TYPES = { - PERCENTILE: 'percentile', - PERCENTILE_RANK: 'percentile_rank', - TOP_HIT: 'top_hit', - COUNT: 'count', - DERIVATIVE: 'derivative', - STD_DEVIATION: 'std_deviation', - VARIANCE: 'variance', - SUM_OF_SQUARES: 'sum_of_squares', - CARDINALITY: 'cardinality', - VALUE_COUNT: 'value_count', - AVERAGE: 'avg', - SUM: 'sum', -}; +// We should probably use METRIC_TYPES from data plugin in future. +export enum METRIC_TYPES { + PERCENTILE = 'percentile', + PERCENTILE_RANK = 'percentile_rank', + TOP_HIT = 'top_hit', + COUNT = 'count', + DERIVATIVE = 'derivative', + STD_DEVIATION = 'std_deviation', + VARIANCE = 'variance', + SUM_OF_SQUARES = 'sum_of_squares', + CARDINALITY = 'cardinality', + VALUE_COUNT = 'value_count', + AVERAGE = 'avg', + SUM = 'sum', +} + +// We should probably use BUCKET_TYPES from data plugin in future. +export enum BUCKET_TYPES { + TERMS = 'terms', +} export const EXTENDED_STATS_TYPES = [ METRIC_TYPES.STD_DEVIATION, diff --git a/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js b/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js index aeabea388a7c6..b2ea90d6a87fe 100644 --- a/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js +++ b/src/plugins/vis_type_timeseries/public/application/components/panel_config/table.js @@ -46,6 +46,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { QueryBarWrapper } from '../query_bar_wrapper'; import { getDefaultQueryLanguage } from '../lib/get_default_query_language'; import { VisDataContext } from './../../contexts/vis_data_context'; +import { BUCKET_TYPES } from '../../../../common/metric_types'; export class TablePanelConfig extends Component { static contextType = VisDataContext; constructor(props) { @@ -123,7 +124,7 @@ export class TablePanelConfig extends Component { indexPattern={model.index_pattern} onChange={this.handlePivotChange} uiRestrictions={this.context.uiRestrictions} - type={'terms'} + type={BUCKET_TYPES.TERMS} fullWidth />