From 129f095af0963d4b5654c3f56f75c5dc2d00bc5c Mon Sep 17 00:00:00 2001 From: Alexey Antonov Date: Mon, 17 May 2021 19:50:03 +0300 Subject: [PATCH] fix CI --- .../public/expression_functions/index.ts | 16 +++---- .../public/expression_functions_register.ts | 43 ------------------- src/plugins/vis_type_xy/public/plugin.ts | 25 +++++------ .../vis_type_xy/public/types/config.ts | 2 +- src/plugins/vis_type_xy/public/types/param.ts | 29 +++++++------ 5 files changed, 37 insertions(+), 78 deletions(-) delete mode 100644 src/plugins/vis_type_xy/public/expression_functions_register.ts diff --git a/src/plugins/vis_type_xy/public/expression_functions/index.ts b/src/plugins/vis_type_xy/public/expression_functions/index.ts index 069c1339a0976..4e7db57ee65d7 100644 --- a/src/plugins/vis_type_xy/public/expression_functions/index.ts +++ b/src/plugins/vis_type_xy/public/expression_functions/index.ts @@ -8,11 +8,11 @@ export { visTypeXyVisFn } from './xy_vis_fn'; -export { categoryAxis } from './category_axis'; -export { timeMarker } from './time_marker'; -export { valueAxis } from './value_axis'; -export { seriesParam } from './series_param'; -export { thresholdLine } from './threshold_line'; -export { label } from './label'; -export { visScale } from './vis_scale'; -export { xyDimension } from './xy_dimension'; +export { categoryAxis, ExpressionValueCategoryAxis } from './category_axis'; +export { timeMarker, ExpressionValueTimeMarker } from './time_marker'; +export { valueAxis, ExpressionValueValueAxis } from './value_axis'; +export { seriesParam, ExpressionValueSeriesParam } from './series_param'; +export { thresholdLine, ExpressionValueThresholdLine } from './threshold_line'; +export { label, ExpressionValueLabel } from './label'; +export { visScale, ExpressionValueScale } from './vis_scale'; +export { xyDimension, ExpressionValueXYDimension } from './xy_dimension'; diff --git a/src/plugins/vis_type_xy/public/expression_functions_register.ts b/src/plugins/vis_type_xy/public/expression_functions_register.ts deleted file mode 100644 index 1b38a00e6bcdd..0000000000000 --- a/src/plugins/vis_type_xy/public/expression_functions_register.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ - -import { VisTypeXyPluginSetupDependencies } from './plugin'; - -export function getExpressionFunctionsRegister( - expressions: VisTypeXyPluginSetupDependencies['expressions'] -) { - let isExpressionFunctionsRegistered = false; - - return async () => { - if (!isExpressionFunctionsRegistered) { - const { - visTypeXyVisFn, - categoryAxis, - timeMarker, - valueAxis, - seriesParam, - thresholdLine, - label, - visScale, - xyDimension, - } = await import('./expression_functions'); - - expressions.registerFunction(visTypeXyVisFn); - expressions.registerFunction(categoryAxis); - expressions.registerFunction(timeMarker); - expressions.registerFunction(valueAxis); - expressions.registerFunction(seriesParam); - expressions.registerFunction(thresholdLine); - expressions.registerFunction(label); - expressions.registerFunction(visScale); - expressions.registerFunction(xyDimension); - - isExpressionFunctionsRegistered = true; - } - }; -} diff --git a/src/plugins/vis_type_xy/public/plugin.ts b/src/plugins/vis_type_xy/public/plugin.ts index 4017a323e5bb4..7bdb4f78bc631 100644 --- a/src/plugins/vis_type_xy/public/plugin.ts +++ b/src/plugins/vis_type_xy/public/plugin.ts @@ -21,10 +21,12 @@ import { setPalettesService, setTrackUiMetric, } from './services'; + import { visTypesDefinitions } from './vis_types'; import { LEGACY_CHARTS_LIBRARY } from '../common'; import { xyVisRenderer } from './vis_renderer'; -import { getExpressionFunctionsRegister } from './expression_functions_register'; + +import * as expressionFunctions from './expression_functions'; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface VisTypeXyPluginSetup {} @@ -67,18 +69,17 @@ export class VisTypeXyPlugin setPalettesService(charts.palettes); expressions.registerRenderer(xyVisRenderer); + expressions.registerFunction(expressionFunctions.visTypeXyVisFn); + expressions.registerFunction(expressionFunctions.categoryAxis); + expressions.registerFunction(expressionFunctions.timeMarker); + expressions.registerFunction(expressionFunctions.valueAxis); + expressions.registerFunction(expressionFunctions.seriesParam); + expressions.registerFunction(expressionFunctions.thresholdLine); + expressions.registerFunction(expressionFunctions.label); + expressions.registerFunction(expressionFunctions.visScale); + expressions.registerFunction(expressionFunctions.xyDimension); - const expressionFunctionsRegister = getExpressionFunctionsRegister(expressions); - - visTypesDefinitions.forEach((item) => { - visualizations.createBaseVisualization({ - setup: async (vis) => { - await expressionFunctionsRegister(); - return vis; - }, - ...item, - }); - }); + visTypesDefinitions.forEach(visualizations.createBaseVisualization); } setTrackUiMetric(usageCollection?.reportUiCounter.bind(usageCollection, 'vis_type_xy')); diff --git a/src/plugins/vis_type_xy/public/types/config.ts b/src/plugins/vis_type_xy/public/types/config.ts index d5c5bfe004191..f025a36a82410 100644 --- a/src/plugins/vis_type_xy/public/types/config.ts +++ b/src/plugins/vis_type_xy/public/types/config.ts @@ -20,7 +20,7 @@ import { YDomainRange, } from '@elastic/charts'; -import { Dimension, Scale, ThresholdLine } from './param'; +import type { Dimension, Scale, ThresholdLine } from './param'; export interface Column { id: string | null; diff --git a/src/plugins/vis_type_xy/public/types/param.ts b/src/plugins/vis_type_xy/public/types/param.ts index c62befd9c61f9..f90899620126a 100644 --- a/src/plugins/vis_type_xy/public/types/param.ts +++ b/src/plugins/vis_type_xy/public/types/param.ts @@ -6,20 +6,21 @@ * Side Public License, v 1. */ -import { Fit, Position } from '@elastic/charts'; - -import { Style, Labels, PaletteOutput } from '../../../charts/public'; -import { SchemaConfig } from '../../../visualizations/public'; - -import { ChartType, XyVisType } from '../../common'; -import { ExpressionValueCategoryAxis } from '../expression_functions/category_axis'; -import { ExpressionValueSeriesParam } from '../expression_functions/series_param'; -import { ExpressionValueValueAxis } from '../expression_functions/value_axis'; -import { ExpressionValueLabel } from '../expression_functions/label'; -import { ExpressionValueThresholdLine } from '../expression_functions/threshold_line'; -import { ExpressionValueTimeMarker } from '../expression_functions/time_marker'; -import { ExpressionValueXYDimension } from '../expression_functions/xy_dimension'; -import { +import type { Fit, Position } from '@elastic/charts'; +import type { Style, Labels, PaletteOutput } from '../../../charts/public'; +import type { SchemaConfig } from '../../../visualizations/public'; +import type { ChartType, XyVisType } from '../../common'; +import type { + ExpressionValueCategoryAxis, + ExpressionValueSeriesParam, + ExpressionValueValueAxis, + ExpressionValueLabel, + ExpressionValueThresholdLine, + ExpressionValueTimeMarker, + ExpressionValueXYDimension, +} from '../expression_functions'; + +import type { ChartMode, AxisMode, AxisType,