From d24c5fe471412559e40e9ca0f4a906eb1312aa6c Mon Sep 17 00:00:00 2001 From: Uladzislau Lasitsa Date: Thu, 19 Nov 2020 12:04:23 +0300 Subject: [PATCH] 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 />