From dd7fb2a2e0f35345b244d97fe71f813065403ca9 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Thu, 2 Apr 2020 15:56:22 +0300 Subject: [PATCH 01/15] Move the default_editor to NP --- .../core_plugins/vis_default_editor/index.ts | 42 ------------------- .../vis_default_editor/package.json | 4 -- src/plugins/vis_default_editor/README.md | 15 +++++++ .../vis_default_editor/public/_agg.scss | 0 .../public/_agg_params.scss | 0 .../vis_default_editor/public/_default.scss | 0 .../vis_default_editor/public/_sidebar.scss | 0 .../__snapshots__/agg.test.tsx.snap | 0 .../__snapshots__/agg_group.test.tsx.snap | 0 .../public/components/agg.test.tsx | 0 .../public/components/agg.tsx | 3 +- .../public/components/agg_add.tsx | 2 +- .../public/components/agg_common_props.ts | 0 .../public/components/agg_group.test.tsx | 0 .../public/components/agg_group.tsx | 3 +- .../components/agg_group_helper.test.ts | 0 .../public/components/agg_group_helper.tsx | 0 .../public/components/agg_group_state.tsx | 0 .../public/components/agg_param.tsx | 0 .../public/components/agg_param_props.ts | 0 .../public/components/agg_params.test.tsx | 4 +- .../public/components/agg_params.tsx | 4 +- .../components/agg_params_helper.test.ts | 0 .../public/components/agg_params_helper.ts | 2 +- .../public/components/agg_params_map.ts | 7 +--- .../public/components/agg_params_state.ts | 0 .../public/components/agg_select.tsx | 2 +- .../extended_bounds.test.tsx.snap | 0 .../__snapshots__/metric_agg.test.tsx.snap | 0 .../controls/__snapshots__/size.test.tsx.snap | 0 .../__snapshots__/top_aggregate.test.tsx.snap | 0 .../components/controls/agg_control_props.tsx | 0 .../components/controls/agg_utils.test.tsx | 0 .../components/controls/auto_precision.tsx | 0 .../controls/components/from_to_list.tsx | 0 .../controls/components/input_list.tsx | 0 .../controls/components/mask_list.tsx | 0 .../__snapshots__/number_list.test.tsx.snap | 0 .../__snapshots__/number_row.test.tsx.snap | 0 .../controls/components/number_list/index.ts | 0 .../number_list/number_list.test.tsx | 0 .../components/number_list/number_list.tsx | 0 .../number_list/number_row.test.tsx | 0 .../components/number_list/number_row.tsx | 0 .../components/number_list/range.test.ts | 0 .../controls/components/number_list/range.ts | 0 .../components/number_list/utils.test.ts | 0 .../controls/components/number_list/utils.ts | 0 .../components/controls/date_ranges.test.tsx | 4 +- .../components/controls/date_ranges.tsx | 28 ++++++++----- .../components/controls/drop_partials.tsx | 0 .../controls/extended_bounds.test.tsx | 0 .../components/controls/extended_bounds.tsx | 0 .../public/components/controls/field.test.tsx | 0 .../public/components/controls/field.tsx | 0 .../public/components/controls/filter.tsx | 2 +- .../public/components/controls/filters.tsx | 6 +-- .../controls/has_extended_bounds.tsx | 3 +- .../public/components/controls/index.ts | 0 .../components/controls/ip_range_type.tsx | 0 .../public/components/controls/ip_ranges.tsx | 0 .../controls/is_filtered_by_collar.tsx | 0 .../components/controls/metric_agg.test.tsx | 0 .../public/components/controls/metric_agg.tsx | 0 .../components/controls/min_doc_count.tsx | 0 .../components/controls/missing_bucket.tsx | 3 +- .../components/controls/number_interval.tsx | 0 .../public/components/controls/order.tsx | 0 .../components/controls/order_agg.test.tsx | 0 .../public/components/controls/order_agg.tsx | 4 +- .../public/components/controls/order_by.tsx | 0 .../components/controls/other_bucket.tsx | 0 .../components/controls/percentile_ranks.tsx | 0 .../components/controls/percentiles.test.tsx | 0 .../components/controls/percentiles.tsx | 0 .../public/components/controls/precision.tsx | 0 .../controls/radius_ratio_option.tsx | 0 .../components/controls/range_control.tsx | 0 .../public/components/controls/ranges.tsx | 0 .../public/components/controls/raw_json.tsx | 0 .../components/controls/rows_or_columns.tsx | 0 .../components/controls/scale_metrics.tsx | 0 .../public/components/controls/size.test.tsx | 0 .../public/components/controls/size.tsx | 0 .../public/components/controls/string.tsx | 0 .../public/components/controls/sub_agg.tsx | 0 .../public/components/controls/sub_metric.tsx | 0 .../public/components/controls/switch.tsx | 0 .../public/components/controls/test_utils.ts | 0 .../components/controls/time_interval.tsx | 0 .../controls/top_aggregate.test.tsx | 0 .../components/controls/top_aggregate.tsx | 0 .../public/components/controls/top_field.tsx | 0 .../public/components/controls/top_size.tsx | 0 .../components/controls/top_sort_field.tsx | 0 .../components/controls/use_geocentroid.tsx | 0 .../components/controls/utils/agg_utils.ts | 0 .../public/components/controls/utils/index.ts | 0 .../controls/utils/inline_comp_wrapper.tsx | 0 .../strings/comma_separated_list.test.ts | 0 .../utils/strings/comma_separated_list.ts | 0 .../controls/utils/strings/index.ts | 0 .../controls/utils/strings/prose.test.ts | 0 .../controls/utils/strings/prose.ts | 0 .../components/controls/utils/use_handlers.ts | 0 .../public/components/sidebar/controls.tsx | 2 +- .../public/components/sidebar/data_tab.tsx | 4 +- .../public/components/sidebar/index.ts | 0 .../public/components/sidebar/navbar.tsx | 0 .../public/components/sidebar/sidebar.tsx | 7 ++-- .../components/sidebar/sidebar_title.tsx | 4 +- .../components/sidebar/state/actions.ts | 0 .../components/sidebar/state/constants.ts | 0 .../sidebar/state/editor_form_state.ts | 0 .../public/components/sidebar/state/index.ts | 2 +- .../components/sidebar/state/reducers.ts | 2 +- .../public/components/utils/editor_config.ts | 0 .../public/components/utils/index.ts | 0 .../public/default_editor.tsx | 4 +- .../public/default_editor_controller.tsx | 8 ++-- .../vis_default_editor/public/editor_size.ts | 0 .../vis_default_editor/public/index.scss | 0 .../vis_default_editor/public/index.ts | 0 .../vis_default_editor/public/schemas.ts | 2 +- .../vis_default_editor/public/types.ts | 0 .../vis_default_editor/public/utils.test.ts | 0 .../vis_default_editor/public/utils.ts | 0 .../public/vis_options_props.tsx | 0 .../public/vis_type_agg_filter.ts | 2 +- 129 files changed, 73 insertions(+), 102 deletions(-) delete mode 100644 src/legacy/core_plugins/vis_default_editor/index.ts delete mode 100644 src/legacy/core_plugins/vis_default_editor/package.json create mode 100644 src/plugins/vis_default_editor/README.md rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/_agg.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/_agg_params.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/_default.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/_sidebar.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/__snapshots__/agg.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/__snapshots__/agg_group.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg.test.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg.tsx (98%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_add.tsx (98%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_common_props.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_group.test.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_group.tsx (97%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_group_helper.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_group_helper.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_group_state.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_param.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_param_props.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_params.test.tsx (96%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_params.tsx (98%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_params_helper.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_params_helper.ts (99%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_params_map.ts (96%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_params_state.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/agg_select.tsx (98%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/__snapshots__/extended_bounds.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/__snapshots__/metric_agg.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/__snapshots__/size.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/__snapshots__/top_aggregate.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/agg_control_props.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/agg_utils.test.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/auto_precision.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/components/from_to_list.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/components/input_list.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/components/mask_list.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/components/number_list/__snapshots__/number_list.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/components/number_list/__snapshots__/number_row.test.tsx.snap (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/components/number_list/index.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/components/number_list/number_list.test.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/components/number_list/number_list.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/components/number_list/number_row.test.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/components/number_list/number_row.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/components/number_list/range.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/components/number_list/range.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/components/number_list/utils.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/components/number_list/utils.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/date_ranges.test.tsx (95%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/date_ranges.tsx (92%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/drop_partials.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/extended_bounds.test.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/extended_bounds.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/field.test.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/field.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/filter.tsx (97%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/filters.tsx (97%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/has_extended_bounds.tsx (94%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/index.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/ip_range_type.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/ip_ranges.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/is_filtered_by_collar.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/metric_agg.test.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/metric_agg.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/min_doc_count.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/missing_bucket.tsx (95%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/number_interval.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/order.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/order_agg.test.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/order_agg.tsx (97%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/order_by.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/other_bucket.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/percentile_ranks.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/percentiles.test.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/percentiles.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/precision.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/radius_ratio_option.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/range_control.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/ranges.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/raw_json.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/rows_or_columns.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/scale_metrics.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/size.test.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/size.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/string.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/sub_agg.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/sub_metric.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/switch.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/test_utils.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/time_interval.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/top_aggregate.test.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/top_aggregate.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/top_field.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/top_size.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/top_sort_field.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/use_geocentroid.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/utils/agg_utils.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/utils/index.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/utils/inline_comp_wrapper.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/utils/strings/comma_separated_list.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/utils/strings/comma_separated_list.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/utils/strings/index.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/utils/strings/prose.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/utils/strings/prose.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/controls/utils/use_handlers.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/sidebar/controls.tsx (98%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/sidebar/data_tab.tsx (97%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/sidebar/index.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/sidebar/navbar.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/sidebar/sidebar.tsx (96%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/sidebar/sidebar_title.tsx (97%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/sidebar/state/actions.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/sidebar/state/constants.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/sidebar/state/editor_form_state.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/sidebar/state/index.ts (96%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/sidebar/state/reducers.ts (99%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/utils/editor_config.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/components/utils/index.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/default_editor.tsx (94%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/default_editor_controller.tsx (92%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/editor_size.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/index.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/index.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/schemas.ts (96%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/types.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/utils.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/utils.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/vis_options_props.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_default_editor/public/vis_type_agg_filter.ts (97%) diff --git a/src/legacy/core_plugins/vis_default_editor/index.ts b/src/legacy/core_plugins/vis_default_editor/index.ts deleted file mode 100644 index ee7b5ee4a62ff..0000000000000 --- a/src/legacy/core_plugins/vis_default_editor/index.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { resolve } from 'path'; -import { Legacy } from 'kibana'; - -import { LegacyPluginApi, LegacyPluginInitializer } from '../../../../src/legacy/types'; - -const vidDefaultEditorPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) => - new Plugin({ - id: 'vis_default_editor', - require: [], - publicDir: resolve(__dirname, 'public'), - uiExports: { - styleSheetPaths: resolve(__dirname, 'public/index.scss'), - }, - init: (server: Legacy.Server) => ({}), - config(Joi: any) { - return Joi.object({ - enabled: Joi.boolean().default(true), - }).default(); - }, - } as Legacy.PluginSpecOptions); - -// eslint-disable-next-line import/no-default-export -export default vidDefaultEditorPluginInitializer; diff --git a/src/legacy/core_plugins/vis_default_editor/package.json b/src/legacy/core_plugins/vis_default_editor/package.json deleted file mode 100644 index 77dcaff41da6b..0000000000000 --- a/src/legacy/core_plugins/vis_default_editor/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "vis_default_editor", - "version": "kibana" -} diff --git a/src/plugins/vis_default_editor/README.md b/src/plugins/vis_default_editor/README.md new file mode 100644 index 0000000000000..76ac23682c6d6 --- /dev/null +++ b/src/plugins/vis_default_editor/README.md @@ -0,0 +1,15 @@ +# Visualization Deafult Editor plugin + +The default editor is used as visualize sidebar in most primary visualizations, e.x. `Area`, `Data table`, `Pie`, etc. +The plugun exposes the static `DefaultEditorController` class to consume. + +```ts +import { DefaultEditorController } from '../../vis_default_editor/public'; + +const editor = new DefaultEditorController( + element, + vis, + eventEmitter, + embeddableHandler +); +``` \ No newline at end of file diff --git a/src/legacy/core_plugins/vis_default_editor/public/_agg.scss b/src/plugins/vis_default_editor/public/_agg.scss similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/_agg.scss rename to src/plugins/vis_default_editor/public/_agg.scss diff --git a/src/legacy/core_plugins/vis_default_editor/public/_agg_params.scss b/src/plugins/vis_default_editor/public/_agg_params.scss similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/_agg_params.scss rename to src/plugins/vis_default_editor/public/_agg_params.scss diff --git a/src/legacy/core_plugins/vis_default_editor/public/_default.scss b/src/plugins/vis_default_editor/public/_default.scss similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/_default.scss rename to src/plugins/vis_default_editor/public/_default.scss diff --git a/src/legacy/core_plugins/vis_default_editor/public/_sidebar.scss b/src/plugins/vis_default_editor/public/_sidebar.scss similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/_sidebar.scss rename to src/plugins/vis_default_editor/public/_sidebar.scss diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/__snapshots__/agg.test.tsx.snap b/src/plugins/vis_default_editor/public/components/__snapshots__/agg.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/__snapshots__/agg.test.tsx.snap rename to src/plugins/vis_default_editor/public/components/__snapshots__/agg.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/__snapshots__/agg_group.test.tsx.snap b/src/plugins/vis_default_editor/public/components/__snapshots__/agg_group.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/__snapshots__/agg_group.test.tsx.snap rename to src/plugins/vis_default_editor/public/components/__snapshots__/agg_group.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg.test.tsx b/src/plugins/vis_default_editor/public/components/agg.test.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg.test.tsx rename to src/plugins/vis_default_editor/public/components/agg.test.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg.tsx b/src/plugins/vis_default_editor/public/components/agg.tsx similarity index 98% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg.tsx rename to src/plugins/vis_default_editor/public/components/agg.tsx index 83fbf70c9099e..c7e3e609490f9 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/agg.tsx +++ b/src/plugins/vis_default_editor/public/components/agg.tsx @@ -28,14 +28,13 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { IAggConfig } from 'src/plugins/data/public'; +import { IAggConfig, TimeRange } from 'src/plugins/data/public'; import { DefaultEditorAggParams } from './agg_params'; import { DefaultEditorAggCommonProps } from './agg_common_props'; import { AGGS_ACTION_KEYS, AggsAction } from './agg_group_state'; import { RowsOrColumnsControl } from './controls/rows_or_columns'; import { RadiusRatioOptionControl } from './controls/radius_ratio_option'; import { getSchemaByName } from '../schemas'; -import { TimeRange } from '../../../../../plugins/data/public'; import { buildAggDescription } from './agg_params_helper'; export interface DefaultEditorAggProps extends DefaultEditorAggCommonProps { diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_add.tsx b/src/plugins/vis_default_editor/public/components/agg_add.tsx similarity index 98% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_add.tsx rename to src/plugins/vis_default_editor/public/components/agg_add.tsx index 9df4ea58e0f07..f2c2f8b4d0b94 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/agg_add.tsx +++ b/src/plugins/vis_default_editor/public/components/agg_add.tsx @@ -29,7 +29,7 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { IAggConfig, AggGroupNames } from '../../../../../plugins/data/public'; +import { IAggConfig, AggGroupNames } from '../../../data/public'; import { Schema } from '../schemas'; interface DefaultEditorAggAddProps { diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_common_props.ts b/src/plugins/vis_default_editor/public/components/agg_common_props.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_common_props.ts rename to src/plugins/vis_default_editor/public/components/agg_common_props.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_group.test.tsx b/src/plugins/vis_default_editor/public/components/agg_group.test.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_group.test.tsx rename to src/plugins/vis_default_editor/public/components/agg_group.test.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_group.tsx b/src/plugins/vis_default_editor/public/components/agg_group.tsx similarity index 97% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_group.tsx rename to src/plugins/vis_default_editor/public/components/agg_group.tsx index 792595fd421f6..ecbc41f28003c 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/agg_group.tsx +++ b/src/plugins/vis_default_editor/public/components/agg_group.tsx @@ -30,7 +30,7 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { AggGroupNames, search, IAggConfig } from '../../../../../plugins/data/public'; +import { AggGroupNames, search, IAggConfig, TimeRange } from '../../../data/public'; import { DefaultEditorAgg } from './agg'; import { DefaultEditorAggAdd } from './agg_add'; import { AddSchema, ReorderAggs, DefaultEditorAggCommonProps } from './agg_common_props'; @@ -42,7 +42,6 @@ import { } from './agg_group_helper'; import { aggGroupReducer, initAggsState, AGGS_ACTION_KEYS } from './agg_group_state'; import { Schema } from '../schemas'; -import { TimeRange } from '../../../../../plugins/data/public'; export interface DefaultEditorAggGroupProps extends DefaultEditorAggCommonProps { schemas: Schema[]; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_group_helper.test.ts b/src/plugins/vis_default_editor/public/components/agg_group_helper.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_group_helper.test.ts rename to src/plugins/vis_default_editor/public/components/agg_group_helper.test.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_group_helper.tsx b/src/plugins/vis_default_editor/public/components/agg_group_helper.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_group_helper.tsx rename to src/plugins/vis_default_editor/public/components/agg_group_helper.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_group_state.tsx b/src/plugins/vis_default_editor/public/components/agg_group_state.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_group_state.tsx rename to src/plugins/vis_default_editor/public/components/agg_group_state.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_param.tsx b/src/plugins/vis_default_editor/public/components/agg_param.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_param.tsx rename to src/plugins/vis_default_editor/public/components/agg_param.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_param_props.ts b/src/plugins/vis_default_editor/public/components/agg_param_props.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_param_props.ts rename to src/plugins/vis_default_editor/public/components/agg_param_props.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_params.test.tsx b/src/plugins/vis_default_editor/public/components/agg_params.test.tsx similarity index 96% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_params.test.tsx rename to src/plugins/vis_default_editor/public/components/agg_params.test.tsx index 1c49ebf40640e..cac1b0851b92d 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/agg_params.test.tsx +++ b/src/plugins/vis_default_editor/public/components/agg_params.test.tsx @@ -25,8 +25,8 @@ import { DefaultEditorAggParams as PureDefaultEditorAggParams, DefaultEditorAggParamsProps, } from './agg_params'; -import { KibanaContextProvider } from '../../../../../plugins/kibana_react/public'; -import { dataPluginMock } from '../../../../../plugins/data/public/mocks'; +import { KibanaContextProvider } from '../../../kibana_react/public'; +import { dataPluginMock } from '../../../data/public/mocks'; import { EditorVisState } from './sidebar/state/reducers'; const mockEditorConfig = { diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_params.tsx b/src/plugins/vis_default_editor/public/components/agg_params.tsx similarity index 98% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_params.tsx rename to src/plugins/vis_default_editor/public/components/agg_params.tsx index b1555b76500d0..3674e39b558d2 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/agg_params.tsx +++ b/src/plugins/vis_default_editor/public/components/agg_params.tsx @@ -22,7 +22,7 @@ import { EuiForm, EuiAccordion, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import useUnmount from 'react-use/lib/useUnmount'; -import { IAggConfig, IndexPattern, AggGroupNames } from '../../../../../plugins/data/public'; +import { IAggConfig, IndexPattern, AggGroupNames } from '../../../data/public'; import { DefaultEditorAggSelect } from './agg_select'; import { DefaultEditorAggParam } from './agg_param'; @@ -40,7 +40,7 @@ import { import { DefaultEditorCommonProps } from './agg_common_props'; import { EditorParamConfig, TimeIntervalParam, FixedParam, getEditorConfig } from './utils'; import { Schema, getSchemaByName } from '../schemas'; -import { useKibana } from '../../../../../plugins/kibana_react/public'; +import { useKibana } from '../../../kibana_react/public'; import { VisDefaultEditorKibanaServices } from '../types'; const FIXED_VALUE_PROP = 'fixedValue'; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_params_helper.test.ts b/src/plugins/vis_default_editor/public/components/agg_params_helper.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_params_helper.test.ts rename to src/plugins/vis_default_editor/public/components/agg_params_helper.test.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_params_helper.ts b/src/plugins/vis_default_editor/public/components/agg_params_helper.ts similarity index 99% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_params_helper.ts rename to src/plugins/vis_default_editor/public/components/agg_params_helper.ts index 073cb7d5ac66c..a32bd76bafa5a 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/agg_params_helper.ts +++ b/src/plugins/vis_default_editor/public/components/agg_params_helper.ts @@ -34,7 +34,7 @@ import { AggParamEditorProps } from './agg_param_props'; import { aggParamsMap } from './agg_params_map'; import { EditorConfig } from './utils'; import { Schema, getSchemaByName } from '../schemas'; -import { search } from '../../../../../plugins/data/public'; +import { search } from '../../../data/public'; import { EditorVisState } from './sidebar/state/reducers'; interface ParamInstanceBase { diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_params_map.ts b/src/plugins/vis_default_editor/public/components/agg_params_map.ts similarity index 96% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_params_map.ts rename to src/plugins/vis_default_editor/public/components/agg_params_map.ts index 4517313b6fd6e..5af3cfc5b0928 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/agg_params_map.ts +++ b/src/plugins/vis_default_editor/public/components/agg_params_map.ts @@ -18,12 +18,7 @@ */ import * as controls from './controls'; -import { - AggGroupNames, - BUCKET_TYPES, - METRIC_TYPES, - search, -} from '../../../../../plugins/data/public'; +import { AggGroupNames, BUCKET_TYPES, METRIC_TYPES, search } from '../../../data/public'; import { wrapWithInlineComp } from './controls/utils'; const { siblingPipelineType, parentPipelineType } = search.aggs; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_params_state.ts b/src/plugins/vis_default_editor/public/components/agg_params_state.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_params_state.ts rename to src/plugins/vis_default_editor/public/components/agg_params_state.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_select.tsx b/src/plugins/vis_default_editor/public/components/agg_select.tsx similarity index 98% rename from src/legacy/core_plugins/vis_default_editor/public/components/agg_select.tsx rename to src/plugins/vis_default_editor/public/components/agg_select.tsx index 7ee432946f3c8..6cb76b18e24a6 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/agg_select.tsx +++ b/src/plugins/vis_default_editor/public/components/agg_select.tsx @@ -24,7 +24,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { IAggType, IndexPattern } from 'src/plugins/data/public'; -import { useKibana } from '../../../../../plugins/kibana_react/public'; +import { useKibana } from '../../../kibana_react/public'; import { ComboBoxGroupedOptions } from '../utils'; import { AGG_TYPE_ACTION_KEYS, AggTypeAction } from './agg_params_state'; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/__snapshots__/extended_bounds.test.tsx.snap b/src/plugins/vis_default_editor/public/components/controls/__snapshots__/extended_bounds.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/__snapshots__/extended_bounds.test.tsx.snap rename to src/plugins/vis_default_editor/public/components/controls/__snapshots__/extended_bounds.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/__snapshots__/metric_agg.test.tsx.snap b/src/plugins/vis_default_editor/public/components/controls/__snapshots__/metric_agg.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/__snapshots__/metric_agg.test.tsx.snap rename to src/plugins/vis_default_editor/public/components/controls/__snapshots__/metric_agg.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/__snapshots__/size.test.tsx.snap b/src/plugins/vis_default_editor/public/components/controls/__snapshots__/size.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/__snapshots__/size.test.tsx.snap rename to src/plugins/vis_default_editor/public/components/controls/__snapshots__/size.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/__snapshots__/top_aggregate.test.tsx.snap b/src/plugins/vis_default_editor/public/components/controls/__snapshots__/top_aggregate.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/__snapshots__/top_aggregate.test.tsx.snap rename to src/plugins/vis_default_editor/public/components/controls/__snapshots__/top_aggregate.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/agg_control_props.tsx b/src/plugins/vis_default_editor/public/components/controls/agg_control_props.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/agg_control_props.tsx rename to src/plugins/vis_default_editor/public/components/controls/agg_control_props.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/agg_utils.test.tsx b/src/plugins/vis_default_editor/public/components/controls/agg_utils.test.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/agg_utils.test.tsx rename to src/plugins/vis_default_editor/public/components/controls/agg_utils.test.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/auto_precision.tsx b/src/plugins/vis_default_editor/public/components/controls/auto_precision.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/auto_precision.tsx rename to src/plugins/vis_default_editor/public/components/controls/auto_precision.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/components/from_to_list.tsx b/src/plugins/vis_default_editor/public/components/controls/components/from_to_list.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/components/from_to_list.tsx rename to src/plugins/vis_default_editor/public/components/controls/components/from_to_list.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/components/input_list.tsx b/src/plugins/vis_default_editor/public/components/controls/components/input_list.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/components/input_list.tsx rename to src/plugins/vis_default_editor/public/components/controls/components/input_list.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/components/mask_list.tsx b/src/plugins/vis_default_editor/public/components/controls/components/mask_list.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/components/mask_list.tsx rename to src/plugins/vis_default_editor/public/components/controls/components/mask_list.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/__snapshots__/number_list.test.tsx.snap b/src/plugins/vis_default_editor/public/components/controls/components/number_list/__snapshots__/number_list.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/__snapshots__/number_list.test.tsx.snap rename to src/plugins/vis_default_editor/public/components/controls/components/number_list/__snapshots__/number_list.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/__snapshots__/number_row.test.tsx.snap b/src/plugins/vis_default_editor/public/components/controls/components/number_list/__snapshots__/number_row.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/__snapshots__/number_row.test.tsx.snap rename to src/plugins/vis_default_editor/public/components/controls/components/number_list/__snapshots__/number_row.test.tsx.snap diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/index.ts b/src/plugins/vis_default_editor/public/components/controls/components/number_list/index.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/index.ts rename to src/plugins/vis_default_editor/public/components/controls/components/number_list/index.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/number_list.test.tsx b/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.test.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/number_list.test.tsx rename to src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.test.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/number_list.tsx b/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/number_list.tsx rename to src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/number_row.test.tsx b/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_row.test.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/number_row.test.tsx rename to src/plugins/vis_default_editor/public/components/controls/components/number_list/number_row.test.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/number_row.tsx b/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_row.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/number_row.tsx rename to src/plugins/vis_default_editor/public/components/controls/components/number_list/number_row.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/range.test.ts b/src/plugins/vis_default_editor/public/components/controls/components/number_list/range.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/range.test.ts rename to src/plugins/vis_default_editor/public/components/controls/components/number_list/range.test.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/range.ts b/src/plugins/vis_default_editor/public/components/controls/components/number_list/range.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/range.ts rename to src/plugins/vis_default_editor/public/components/controls/components/number_list/range.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/utils.test.ts b/src/plugins/vis_default_editor/public/components/controls/components/number_list/utils.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/utils.test.ts rename to src/plugins/vis_default_editor/public/components/controls/components/number_list/utils.test.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/utils.ts b/src/plugins/vis_default_editor/public/components/controls/components/number_list/utils.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/components/number_list/utils.ts rename to src/plugins/vis_default_editor/public/components/controls/components/number_list/utils.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/date_ranges.test.tsx b/src/plugins/vis_default_editor/public/components/controls/date_ranges.test.tsx similarity index 95% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/date_ranges.test.tsx rename to src/plugins/vis_default_editor/public/components/controls/date_ranges.test.tsx index 6b1a4dca7b84f..b844fdfb82256 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/controls/date_ranges.test.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/date_ranges.test.tsx @@ -20,8 +20,8 @@ import React from 'react'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; import { DateRangesParamEditor } from './date_ranges'; -import { KibanaContextProvider } from '../../../../../../plugins/kibana_react/public'; -import { docLinksServiceMock } from '../../../../../../core/public/mocks'; +import { KibanaContextProvider } from '../../../../kibana_react/public'; +import { docLinksServiceMock } from '../../../../../core/public/mocks'; describe('DateRangesParamEditor component', () => { let setValue: jest.Mock; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/date_ranges.tsx b/src/plugins/vis_default_editor/public/components/controls/date_ranges.tsx similarity index 92% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/date_ranges.tsx rename to src/plugins/vis_default_editor/public/components/controls/date_ranges.tsx index ca4a9315d6bfb..0e4ef9bdf5540 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/controls/date_ranges.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/date_ranges.tsx @@ -37,7 +37,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; import { isEqual, omit } from 'lodash'; -import { useKibana } from '../../../../../../plugins/kibana_react/public'; +import { useKibana } from '../../../../kibana_react/public'; import { AggParamEditorProps } from '../agg_param_props'; const FROM_PLACEHOLDER = '\u2212\u221E'; @@ -77,7 +77,7 @@ function DateRangesParamEditor({ if (!value.length) { onAddRange(); } - }, []); + }, [onAddRange, value.length]); useEffect(() => { // responsible for discarding changes @@ -87,18 +87,24 @@ function DateRangesParamEditor({ ) { setRanges(value.map(range => ({ ...range, id: generateId() }))); } - }, [value]); + }, [ranges, value]); useEffect(() => { setValidity(!hasInvalidRange); - }, [hasInvalidRange]); - - const updateRanges = (rangeValues: DateRangeValuesModel[]) => { - // do not set internal id parameter into saved object - setValue(rangeValues.map(range => omit(range, 'id'))); - setRanges(rangeValues); - }; - const onAddRange = () => updateRanges([...ranges, { id: generateId() }]); + }, [hasInvalidRange, setValidity]); + + const updateRanges = useCallback( + (rangeValues: DateRangeValuesModel[]) => { + // do not set internal id parameter into saved object + setValue(rangeValues.map(range => omit(range, 'id'))); + setRanges(rangeValues); + }, + [setValue] + ); + const onAddRange = useCallback(() => updateRanges([...ranges, { id: generateId() }]), [ + ranges, + updateRanges, + ]); const onRemoveRange = (id: string) => updateRanges(ranges.filter(range => range.id !== id)); const onChangeRange = (id: string, key: string, newValue: string) => updateRanges( diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/drop_partials.tsx b/src/plugins/vis_default_editor/public/components/controls/drop_partials.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/drop_partials.tsx rename to src/plugins/vis_default_editor/public/components/controls/drop_partials.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/extended_bounds.test.tsx b/src/plugins/vis_default_editor/public/components/controls/extended_bounds.test.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/extended_bounds.test.tsx rename to src/plugins/vis_default_editor/public/components/controls/extended_bounds.test.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/extended_bounds.tsx b/src/plugins/vis_default_editor/public/components/controls/extended_bounds.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/extended_bounds.tsx rename to src/plugins/vis_default_editor/public/components/controls/extended_bounds.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/field.test.tsx b/src/plugins/vis_default_editor/public/components/controls/field.test.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/field.test.tsx rename to src/plugins/vis_default_editor/public/components/controls/field.test.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/field.tsx b/src/plugins/vis_default_editor/public/components/controls/field.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/field.tsx rename to src/plugins/vis_default_editor/public/components/controls/field.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/filter.tsx b/src/plugins/vis_default_editor/public/components/controls/filter.tsx similarity index 97% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/filter.tsx rename to src/plugins/vis_default_editor/public/components/controls/filter.tsx index e2e7c2895093e..006824724c7a3 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/controls/filter.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/filter.tsx @@ -21,7 +21,7 @@ import React, { useState } from 'react'; import { EuiForm, EuiButtonIcon, EuiFieldText, EuiFormRow, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { IAggConfig, Query, QueryStringInput } from '../../../../../../plugins/data/public'; +import { IAggConfig, Query, QueryStringInput } from 'src/plugins/data/public'; interface FilterRowProps { id: string; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/filters.tsx b/src/plugins/vis_default_editor/public/components/controls/filters.tsx similarity index 97% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/filters.tsx rename to src/plugins/vis_default_editor/public/components/controls/filters.tsx index be4c62ab08aa2..44ff14983cbd2 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/controls/filters.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/filters.tsx @@ -23,7 +23,7 @@ import { htmlIdGenerator, EuiButton, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { Query } from 'src/plugins/data/public'; -import { useKibana } from '../../../../../../plugins/kibana_react/public'; +import { useKibana } from '../../../../kibana_react/public'; import { FilterRow } from './filter'; import { AggParamEditorProps } from '../agg_param_props'; @@ -43,7 +43,7 @@ function FiltersParamEditor({ agg, value = [], setValue }: AggParamEditorProps { // set parsed values into model after initialization setValue(filters.map(filter => omit({ ...filter, input: filter.input }, 'id'))); - }, []); + }, [filters, setValue]); useEffect(() => { // responsible for discarding changes @@ -53,7 +53,7 @@ function FiltersParamEditor({ agg, value = [], setValue }: AggParamEditorProps ({ ...filter, id: generateId() }))); } - }, [value]); + }, [filters, value]); const updateFilters = (updatedFilters: FilterValue[]) => { // do not set internal id parameter into saved object diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx b/src/plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx similarity index 94% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx rename to src/plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx index 90b7cb03b7a5b..e123336cef482 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx @@ -20,7 +20,7 @@ import React, { useEffect } from 'react'; import { i18n } from '@kbn/i18n'; -import { search } from '../../../../../../plugins/data/public'; +import { search } from '../../../../data/public'; import { SwitchParamEditor } from './switch'; import { AggParamEditorProps } from '../agg_param_props'; @@ -29,6 +29,7 @@ const { isType } = search.aggs; function HasExtendedBoundsParamEditor(props: AggParamEditorProps) { useEffect(() => { props.setValue(props.value && props.agg.params.min_doc_count); + // eslint-disable-next-line react-hooks/exhaustive-deps }, [props.agg.params.min_doc_count]); return ( diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/index.ts b/src/plugins/vis_default_editor/public/components/controls/index.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/index.ts rename to src/plugins/vis_default_editor/public/components/controls/index.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/ip_range_type.tsx b/src/plugins/vis_default_editor/public/components/controls/ip_range_type.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/ip_range_type.tsx rename to src/plugins/vis_default_editor/public/components/controls/ip_range_type.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/ip_ranges.tsx b/src/plugins/vis_default_editor/public/components/controls/ip_ranges.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/ip_ranges.tsx rename to src/plugins/vis_default_editor/public/components/controls/ip_ranges.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/is_filtered_by_collar.tsx b/src/plugins/vis_default_editor/public/components/controls/is_filtered_by_collar.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/is_filtered_by_collar.tsx rename to src/plugins/vis_default_editor/public/components/controls/is_filtered_by_collar.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/metric_agg.test.tsx b/src/plugins/vis_default_editor/public/components/controls/metric_agg.test.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/metric_agg.test.tsx rename to src/plugins/vis_default_editor/public/components/controls/metric_agg.test.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/metric_agg.tsx b/src/plugins/vis_default_editor/public/components/controls/metric_agg.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/metric_agg.tsx rename to src/plugins/vis_default_editor/public/components/controls/metric_agg.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/min_doc_count.tsx b/src/plugins/vis_default_editor/public/components/controls/min_doc_count.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/min_doc_count.tsx rename to src/plugins/vis_default_editor/public/components/controls/min_doc_count.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/missing_bucket.tsx b/src/plugins/vis_default_editor/public/components/controls/missing_bucket.tsx similarity index 95% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/missing_bucket.tsx rename to src/plugins/vis_default_editor/public/components/controls/missing_bucket.tsx index 7010f0d53e569..808b62aa4908b 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/controls/missing_bucket.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/missing_bucket.tsx @@ -21,7 +21,7 @@ import React, { useEffect } from 'react'; import { i18n } from '@kbn/i18n'; import { SwitchParamEditor } from './switch'; -import { search } from '../../../../../../plugins/data/public'; +import { search } from '../../../../data/public'; import { AggParamEditorProps } from '../agg_param_props'; function MissingBucketParamEditor(props: AggParamEditorProps) { @@ -31,6 +31,7 @@ function MissingBucketParamEditor(props: AggParamEditorProps) { if (fieldTypeIsNotString) { props.setValue(false); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [fieldTypeIsNotString]); return ( diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/number_interval.tsx b/src/plugins/vis_default_editor/public/components/controls/number_interval.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/number_interval.tsx rename to src/plugins/vis_default_editor/public/components/controls/number_interval.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/order.tsx b/src/plugins/vis_default_editor/public/components/controls/order.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/order.tsx rename to src/plugins/vis_default_editor/public/components/controls/order.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/order_agg.test.tsx b/src/plugins/vis_default_editor/public/components/controls/order_agg.test.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/order_agg.test.tsx rename to src/plugins/vis_default_editor/public/components/controls/order_agg.test.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/order_agg.tsx b/src/plugins/vis_default_editor/public/components/controls/order_agg.tsx similarity index 97% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/order_agg.tsx rename to src/plugins/vis_default_editor/public/components/controls/order_agg.tsx index 41672bc192fab..c5a35cbbd7ab1 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/controls/order_agg.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/order_agg.tsx @@ -20,7 +20,7 @@ import React, { useEffect } from 'react'; import { EuiSpacer } from '@elastic/eui'; -import { AggParamType, IAggConfig, AggGroupNames } from '../../../../../../plugins/data/public'; +import { AggParamType, IAggConfig, AggGroupNames } from '../../../../data/public'; import { useSubAggParamsHandlers } from './utils'; import { AggParamEditorProps } from '../agg_param_props'; import { DefaultEditorAggParams } from '../agg_params'; @@ -47,7 +47,7 @@ function OrderAggParamEditor({ if (orderBy !== 'custom' && value) { setValue(undefined); } - }, [orderBy]); + }, [agg, aggParam, orderBy, setValue, value]); const { onAggTypeChange, setAggParamValue } = useSubAggParamsHandlers( agg, diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/order_by.tsx b/src/plugins/vis_default_editor/public/components/controls/order_by.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/order_by.tsx rename to src/plugins/vis_default_editor/public/components/controls/order_by.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/other_bucket.tsx b/src/plugins/vis_default_editor/public/components/controls/other_bucket.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/other_bucket.tsx rename to src/plugins/vis_default_editor/public/components/controls/other_bucket.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/percentile_ranks.tsx b/src/plugins/vis_default_editor/public/components/controls/percentile_ranks.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/percentile_ranks.tsx rename to src/plugins/vis_default_editor/public/components/controls/percentile_ranks.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/percentiles.test.tsx b/src/plugins/vis_default_editor/public/components/controls/percentiles.test.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/percentiles.test.tsx rename to src/plugins/vis_default_editor/public/components/controls/percentiles.test.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/percentiles.tsx b/src/plugins/vis_default_editor/public/components/controls/percentiles.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/percentiles.tsx rename to src/plugins/vis_default_editor/public/components/controls/percentiles.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/precision.tsx b/src/plugins/vis_default_editor/public/components/controls/precision.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/precision.tsx rename to src/plugins/vis_default_editor/public/components/controls/precision.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx b/src/plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx rename to src/plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/range_control.tsx b/src/plugins/vis_default_editor/public/components/controls/range_control.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/range_control.tsx rename to src/plugins/vis_default_editor/public/components/controls/range_control.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/ranges.tsx b/src/plugins/vis_default_editor/public/components/controls/ranges.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/ranges.tsx rename to src/plugins/vis_default_editor/public/components/controls/ranges.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/raw_json.tsx b/src/plugins/vis_default_editor/public/components/controls/raw_json.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/raw_json.tsx rename to src/plugins/vis_default_editor/public/components/controls/raw_json.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/rows_or_columns.tsx b/src/plugins/vis_default_editor/public/components/controls/rows_or_columns.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/rows_or_columns.tsx rename to src/plugins/vis_default_editor/public/components/controls/rows_or_columns.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/scale_metrics.tsx b/src/plugins/vis_default_editor/public/components/controls/scale_metrics.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/scale_metrics.tsx rename to src/plugins/vis_default_editor/public/components/controls/scale_metrics.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/size.test.tsx b/src/plugins/vis_default_editor/public/components/controls/size.test.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/size.test.tsx rename to src/plugins/vis_default_editor/public/components/controls/size.test.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/size.tsx b/src/plugins/vis_default_editor/public/components/controls/size.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/size.tsx rename to src/plugins/vis_default_editor/public/components/controls/size.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/string.tsx b/src/plugins/vis_default_editor/public/components/controls/string.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/string.tsx rename to src/plugins/vis_default_editor/public/components/controls/string.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/sub_agg.tsx b/src/plugins/vis_default_editor/public/components/controls/sub_agg.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/sub_agg.tsx rename to src/plugins/vis_default_editor/public/components/controls/sub_agg.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/sub_metric.tsx b/src/plugins/vis_default_editor/public/components/controls/sub_metric.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/sub_metric.tsx rename to src/plugins/vis_default_editor/public/components/controls/sub_metric.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/switch.tsx b/src/plugins/vis_default_editor/public/components/controls/switch.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/switch.tsx rename to src/plugins/vis_default_editor/public/components/controls/switch.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/test_utils.ts b/src/plugins/vis_default_editor/public/components/controls/test_utils.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/test_utils.ts rename to src/plugins/vis_default_editor/public/components/controls/test_utils.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/time_interval.tsx b/src/plugins/vis_default_editor/public/components/controls/time_interval.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/time_interval.tsx rename to src/plugins/vis_default_editor/public/components/controls/time_interval.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/top_aggregate.test.tsx b/src/plugins/vis_default_editor/public/components/controls/top_aggregate.test.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/top_aggregate.test.tsx rename to src/plugins/vis_default_editor/public/components/controls/top_aggregate.test.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/top_aggregate.tsx b/src/plugins/vis_default_editor/public/components/controls/top_aggregate.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/top_aggregate.tsx rename to src/plugins/vis_default_editor/public/components/controls/top_aggregate.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/top_field.tsx b/src/plugins/vis_default_editor/public/components/controls/top_field.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/top_field.tsx rename to src/plugins/vis_default_editor/public/components/controls/top_field.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/top_size.tsx b/src/plugins/vis_default_editor/public/components/controls/top_size.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/top_size.tsx rename to src/plugins/vis_default_editor/public/components/controls/top_size.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/top_sort_field.tsx b/src/plugins/vis_default_editor/public/components/controls/top_sort_field.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/top_sort_field.tsx rename to src/plugins/vis_default_editor/public/components/controls/top_sort_field.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/use_geocentroid.tsx b/src/plugins/vis_default_editor/public/components/controls/use_geocentroid.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/use_geocentroid.tsx rename to src/plugins/vis_default_editor/public/components/controls/use_geocentroid.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/agg_utils.ts b/src/plugins/vis_default_editor/public/components/controls/utils/agg_utils.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/agg_utils.ts rename to src/plugins/vis_default_editor/public/components/controls/utils/agg_utils.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/index.ts b/src/plugins/vis_default_editor/public/components/controls/utils/index.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/index.ts rename to src/plugins/vis_default_editor/public/components/controls/utils/index.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/inline_comp_wrapper.tsx b/src/plugins/vis_default_editor/public/components/controls/utils/inline_comp_wrapper.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/inline_comp_wrapper.tsx rename to src/plugins/vis_default_editor/public/components/controls/utils/inline_comp_wrapper.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/strings/comma_separated_list.test.ts b/src/plugins/vis_default_editor/public/components/controls/utils/strings/comma_separated_list.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/strings/comma_separated_list.test.ts rename to src/plugins/vis_default_editor/public/components/controls/utils/strings/comma_separated_list.test.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/strings/comma_separated_list.ts b/src/plugins/vis_default_editor/public/components/controls/utils/strings/comma_separated_list.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/strings/comma_separated_list.ts rename to src/plugins/vis_default_editor/public/components/controls/utils/strings/comma_separated_list.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/strings/index.ts b/src/plugins/vis_default_editor/public/components/controls/utils/strings/index.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/strings/index.ts rename to src/plugins/vis_default_editor/public/components/controls/utils/strings/index.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/strings/prose.test.ts b/src/plugins/vis_default_editor/public/components/controls/utils/strings/prose.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/strings/prose.test.ts rename to src/plugins/vis_default_editor/public/components/controls/utils/strings/prose.test.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/strings/prose.ts b/src/plugins/vis_default_editor/public/components/controls/utils/strings/prose.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/strings/prose.ts rename to src/plugins/vis_default_editor/public/components/controls/utils/strings/prose.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/use_handlers.ts b/src/plugins/vis_default_editor/public/components/controls/utils/use_handlers.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/controls/utils/use_handlers.ts rename to src/plugins/vis_default_editor/public/components/controls/utils/use_handlers.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/controls.tsx b/src/plugins/vis_default_editor/public/components/sidebar/controls.tsx similarity index 98% rename from src/legacy/core_plugins/vis_default_editor/public/components/sidebar/controls.tsx rename to src/plugins/vis_default_editor/public/components/sidebar/controls.tsx index 18b445b4a26db..db9d7d9e3316a 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/controls.tsx +++ b/src/plugins/vis_default_editor/public/components/sidebar/controls.tsx @@ -30,7 +30,7 @@ import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; import { useDebounce } from 'react-use'; -import { Vis } from '../../../../../../plugins/visualizations/public'; +import { Vis } from 'src/plugins/visualizations/public'; import { discardChanges, EditorAction } from './state'; interface DefaultEditorControlsProps { diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/data_tab.tsx b/src/plugins/vis_default_editor/public/components/sidebar/data_tab.tsx similarity index 97% rename from src/legacy/core_plugins/vis_default_editor/public/components/sidebar/data_tab.tsx rename to src/plugins/vis_default_editor/public/components/sidebar/data_tab.tsx index 0c967723db8e7..0466c64541e23 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/data_tab.tsx +++ b/src/plugins/vis_default_editor/public/components/sidebar/data_tab.tsx @@ -26,7 +26,8 @@ import { IAggConfig, IMetricAggType, search, -} from '../../../../../../plugins/data/public'; + TimeRange, +} from '../../../../data/public'; import { DefaultEditorAggGroup } from '../agg_group'; import { EditorAction, @@ -39,7 +40,6 @@ import { } from './state'; import { AddSchema, ReorderAggs, DefaultEditorAggCommonProps } from '../agg_common_props'; import { ISchemas } from '../../schemas'; -import { TimeRange } from '../../../../../../plugins/data/public'; import { EditorVisState } from './state/reducers'; export interface DefaultEditorDataTabProps { diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/index.ts b/src/plugins/vis_default_editor/public/components/sidebar/index.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/sidebar/index.ts rename to src/plugins/vis_default_editor/public/components/sidebar/index.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/navbar.tsx b/src/plugins/vis_default_editor/public/components/sidebar/navbar.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/sidebar/navbar.tsx rename to src/plugins/vis_default_editor/public/components/sidebar/navbar.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar.tsx b/src/plugins/vis_default_editor/public/components/sidebar/sidebar.tsx similarity index 96% rename from src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar.tsx rename to src/plugins/vis_default_editor/public/components/sidebar/sidebar.tsx index b24486a12fd24..9dfeae1815d1a 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar.tsx +++ b/src/plugins/vis_default_editor/public/components/sidebar/sidebar.tsx @@ -23,16 +23,15 @@ import { i18n } from '@kbn/i18n'; import { keyCodes, EuiButtonIcon, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { EventEmitter } from 'events'; -import { Vis } from 'src/plugins/visualizations/public'; +import { Vis, PersistedState } from 'src/plugins/visualizations/public'; +import { SavedSearch } from 'src/plugins/discover/public'; +import { TimeRange } from 'src/plugins/data/public'; import { DefaultEditorNavBar, OptionTab } from './navbar'; import { DefaultEditorControls } from './controls'; import { setStateParamValue, useEditorReducer, useEditorFormState, discardChanges } from './state'; import { DefaultEditorAggCommonProps } from '../agg_common_props'; import { SidebarTitle } from './sidebar_title'; -import { PersistedState } from '../../../../../../plugins/visualizations/public'; -import { SavedSearch } from '../../../../../../plugins/discover/public'; import { Schema } from '../../schemas'; -import { TimeRange } from '../../../../../../plugins/data/public'; interface DefaultEditorSideBarProps { isCollapsed: boolean; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar_title.tsx b/src/plugins/vis_default_editor/public/components/sidebar/sidebar_title.tsx similarity index 97% rename from src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar_title.tsx rename to src/plugins/vis_default_editor/public/components/sidebar/sidebar_title.tsx index fb63a598a4fae..c9f83e5b474a6 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar_title.tsx +++ b/src/plugins/vis_default_editor/public/components/sidebar/sidebar_title.tsx @@ -35,8 +35,8 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { Vis } from '../../../../../../plugins/visualizations/public'; -import { SavedSearch } from '../../../../../../plugins/discover/public'; +import { Vis } from 'src/plugins/visualizations/public'; +import { SavedSearch } from 'src/plugins/discover/public'; interface LinkedSearchProps { savedSearch: SavedSearch; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/actions.ts b/src/plugins/vis_default_editor/public/components/sidebar/state/actions.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/actions.ts rename to src/plugins/vis_default_editor/public/components/sidebar/state/actions.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/constants.ts b/src/plugins/vis_default_editor/public/components/sidebar/state/constants.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/constants.ts rename to src/plugins/vis_default_editor/public/components/sidebar/state/constants.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/editor_form_state.ts b/src/plugins/vis_default_editor/public/components/sidebar/state/editor_form_state.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/editor_form_state.ts rename to src/plugins/vis_default_editor/public/components/sidebar/state/editor_form_state.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/index.ts b/src/plugins/vis_default_editor/public/components/sidebar/state/index.ts similarity index 96% rename from src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/index.ts rename to src/plugins/vis_default_editor/public/components/sidebar/state/index.ts index d39d6d07b32d2..1bfa100cbd0f7 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/index.ts +++ b/src/plugins/vis_default_editor/public/components/sidebar/state/index.ts @@ -24,7 +24,7 @@ import { Vis } from 'src/plugins/visualizations/public'; import { createEditorStateReducer, initEditorState, EditorVisState } from './reducers'; import { EditorStateActionTypes } from './constants'; import { EditorAction } from './actions'; -import { useKibana } from '../../../../../../../plugins/kibana_react/public'; +import { useKibana } from '../../../../../kibana_react/public'; import { VisDefaultEditorKibanaServices } from '../../../types'; export * from './editor_form_state'; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/reducers.ts b/src/plugins/vis_default_editor/public/components/sidebar/state/reducers.ts similarity index 99% rename from src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/reducers.ts rename to src/plugins/vis_default_editor/public/components/sidebar/state/reducers.ts index b9f89cebd8bf3..4e7a2904584da 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/reducers.ts +++ b/src/plugins/vis_default_editor/public/components/sidebar/state/reducers.ts @@ -20,7 +20,7 @@ import { cloneDeep } from 'lodash'; import { Vis } from 'src/plugins/visualizations/public'; -import { AggGroupNames, DataPublicPluginStart } from '../../../../../../../plugins/data/public'; +import { AggGroupNames, DataPublicPluginStart } from '../../../../../data/public'; import { EditorStateActionTypes } from './constants'; import { getEnabledMetricAggsCount } from '../../agg_group_helper'; import { EditorAction } from './actions'; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/utils/editor_config.ts b/src/plugins/vis_default_editor/public/components/utils/editor_config.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/utils/editor_config.ts rename to src/plugins/vis_default_editor/public/components/utils/editor_config.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/utils/index.ts b/src/plugins/vis_default_editor/public/components/utils/index.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/components/utils/index.ts rename to src/plugins/vis_default_editor/public/components/utils/index.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/default_editor.tsx b/src/plugins/vis_default_editor/public/default_editor.tsx similarity index 94% rename from src/legacy/core_plugins/vis_default_editor/public/default_editor.tsx rename to src/plugins/vis_default_editor/public/default_editor.tsx index 899b9c1b5fd6e..f1963b94dcf95 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/default_editor.tsx +++ b/src/plugins/vis_default_editor/public/default_editor.tsx @@ -19,8 +19,8 @@ import React, { useEffect, useRef, useState, useCallback } from 'react'; -import { EditorRenderProps } from '../../kibana/public/visualize/np_ready/types'; -import { PanelsContainer, Panel } from '../../../../plugins/kibana_react/public'; +import { EditorRenderProps } from 'src/legacy/core_plugins/kibana/public/visualize/np_ready/types'; +import { PanelsContainer, Panel } from '../../kibana_react/public'; import './vis_type_agg_filter'; import { DefaultEditorSideBar } from './components/sidebar'; diff --git a/src/legacy/core_plugins/vis_default_editor/public/default_editor_controller.tsx b/src/plugins/vis_default_editor/public/default_editor_controller.tsx similarity index 92% rename from src/legacy/core_plugins/vis_default_editor/public/default_editor_controller.tsx rename to src/plugins/vis_default_editor/public/default_editor_controller.tsx index 58e67b5064da5..1c785fc991285 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/default_editor_controller.tsx +++ b/src/plugins/vis_default_editor/public/default_editor_controller.tsx @@ -17,15 +17,17 @@ * under the License. */ +import './index.scss'; + import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; import { i18n } from '@kbn/i18n'; import { EventEmitter } from 'events'; import { EditorRenderProps } from 'src/legacy/core_plugins/kibana/public/visualize/np_ready/types'; -import { Vis, VisualizeEmbeddableContract } from '../../../../plugins/visualizations/public'; -import { Storage } from '../../../../plugins/kibana_utils/public'; -import { KibanaContextProvider } from '../../../../plugins/kibana_react/public'; +import { Vis, VisualizeEmbeddableContract } from 'src/plugins/visualizations/public'; +import { Storage } from '../../kibana_utils/public'; +import { KibanaContextProvider } from '../../kibana_react/public'; import { DefaultEditor } from './default_editor'; import { DefaultEditorDataTab, OptionTab } from './components/sidebar'; diff --git a/src/legacy/core_plugins/vis_default_editor/public/editor_size.ts b/src/plugins/vis_default_editor/public/editor_size.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/editor_size.ts rename to src/plugins/vis_default_editor/public/editor_size.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/index.scss b/src/plugins/vis_default_editor/public/index.scss similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/index.scss rename to src/plugins/vis_default_editor/public/index.scss diff --git a/src/legacy/core_plugins/vis_default_editor/public/index.ts b/src/plugins/vis_default_editor/public/index.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/index.ts rename to src/plugins/vis_default_editor/public/index.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/schemas.ts b/src/plugins/vis_default_editor/public/schemas.ts similarity index 96% rename from src/legacy/core_plugins/vis_default_editor/public/schemas.ts rename to src/plugins/vis_default_editor/public/schemas.ts index 4e632da44afc0..05ba5fa9c9419 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/schemas.ts +++ b/src/plugins/vis_default_editor/public/schemas.ts @@ -21,7 +21,7 @@ import _, { defaults } from 'lodash'; import { Optional } from '@kbn/utility-types'; -import { AggGroupNames, AggParam, IAggGroupNames } from '../../../../plugins/data/public'; +import { AggGroupNames, AggParam, IAggGroupNames } from '../../data/public'; export interface ISchemas { [AggGroupNames.Buckets]: Schema[]; diff --git a/src/legacy/core_plugins/vis_default_editor/public/types.ts b/src/plugins/vis_default_editor/public/types.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/types.ts rename to src/plugins/vis_default_editor/public/types.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/utils.test.ts b/src/plugins/vis_default_editor/public/utils.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/utils.test.ts rename to src/plugins/vis_default_editor/public/utils.test.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/utils.ts b/src/plugins/vis_default_editor/public/utils.ts similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/utils.ts rename to src/plugins/vis_default_editor/public/utils.ts diff --git a/src/legacy/core_plugins/vis_default_editor/public/vis_options_props.tsx b/src/plugins/vis_default_editor/public/vis_options_props.tsx similarity index 100% rename from src/legacy/core_plugins/vis_default_editor/public/vis_options_props.tsx rename to src/plugins/vis_default_editor/public/vis_options_props.tsx diff --git a/src/legacy/core_plugins/vis_default_editor/public/vis_type_agg_filter.ts b/src/plugins/vis_default_editor/public/vis_type_agg_filter.ts similarity index 97% rename from src/legacy/core_plugins/vis_default_editor/public/vis_type_agg_filter.ts rename to src/plugins/vis_default_editor/public/vis_type_agg_filter.ts index 3ff212c43e6e8..bf5661f42a9f5 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/vis_type_agg_filter.ts +++ b/src/plugins/vis_default_editor/public/vis_type_agg_filter.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { IAggType, IAggConfig, IndexPattern, search } from '../../../../plugins/data/public'; +import { IAggType, IAggConfig, IndexPattern, search } from '../../data/public'; const { aggTypeFilters, propFilter } = search.aggs; const filterByName = propFilter('name'); From 9bbe16db5a63c50523fcc1b2995949908c77fac1 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Fri, 3 Apr 2020 17:13:39 +0300 Subject: [PATCH 02/15] Fix paths --- .../public/visualize/kibana_services.ts | 2 +- .../kibana/public/visualize/plugin.ts | 2 +- .../region_map/public/region_map_type.js | 2 +- .../tile_map/public/tile_map_type.js | 2 +- .../vis_type_markdown/public/markdown_vis.ts | 2 +- .../vis_type_metric/public/metric_vis_type.ts | 2 +- .../vis_type_table/public/table_vis_type.ts | 2 +- .../public/tag_cloud_type.ts | 2 +- .../public/components/timelion_interval.tsx | 2 +- .../public/timelion_vis_type.tsx | 2 +- .../vis_type_vega/public/vega_type.ts | 3 +- .../vis_type_vislib/public/area.ts | 2 +- .../public/components/common/color_ranges.tsx | 5 +- .../vis_type_vislib/public/gauge.ts | 2 +- .../vis_type_vislib/public/goal.ts | 2 +- .../vis_type_vislib/public/heatmap.ts | 2 +- .../vis_type_vislib/public/histogram.ts | 2 +- .../vis_type_vislib/public/horizontal_bar.ts | 2 +- .../vis_type_vislib/public/line.ts | 2 +- .../vis_type_vislib/public/pie.ts | 2 +- src/plugins/vis_default_editor/README.md | 5 +- .../controls/components/from_to_list.tsx | 2 +- .../controls/components/input_list.tsx | 19 +++--- .../controls/components/mask_list.tsx | 2 +- .../components/number_list/number_list.tsx | 4 +- .../components/number_list/range.test.ts | 1 - .../components/controls/date_ranges.tsx | 28 +++++---- .../public/components/controls/filter.tsx | 2 +- .../controls/has_extended_bounds.tsx | 6 +- .../components/controls/missing_bucket.tsx | 6 +- .../components/controls/number_interval.tsx | 2 +- .../public/components/controls/order_by.tsx | 4 +- .../public/components/controls/precision.tsx | 2 +- .../public/components/controls/ranges.tsx | 63 ++++++++++--------- .../public/components/controls/size.tsx | 2 +- .../public/components/controls/string.tsx | 2 +- .../public/components/controls/sub_agg.tsx | 4 +- .../public/components/controls/sub_metric.tsx | 4 +- .../components/controls/time_interval.tsx | 4 +- .../components/controls/top_aggregate.tsx | 4 +- .../public/default_editor_controller.tsx | 2 - .../vis_default_editor/public/index.ts | 2 + 42 files changed, 113 insertions(+), 101 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/visualize/kibana_services.ts b/src/legacy/core_plugins/kibana/public/visualize/kibana_services.ts index 2ed7e3d43168c..06825fdd39cbe 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/kibana_services.ts +++ b/src/legacy/core_plugins/kibana/public/visualize/kibana_services.ts @@ -36,7 +36,7 @@ import { VisualizationsStart } from '../../../../../plugins/visualizations/publi import { SavedVisualizations } from './np_ready/types'; import { UsageCollectionSetup } from '../../../../../plugins/usage_collection/public'; import { KibanaLegacyStart } from '../../../../../plugins/kibana_legacy/public'; -import { DefaultEditorController } from '../../../vis_default_editor/public'; +import { DefaultEditorController } from '../../../../../plugins/vis_default_editor/public'; export interface VisualizeKibanaServices { pluginInitializerContext: PluginInitializerContext; diff --git a/src/legacy/core_plugins/kibana/public/visualize/plugin.ts b/src/legacy/core_plugins/kibana/public/visualize/plugin.ts index 6d32579f5c541..7a0f42aca1b2e 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/plugin.ts +++ b/src/legacy/core_plugins/kibana/public/visualize/plugin.ts @@ -51,7 +51,7 @@ import { HomePublicPluginSetup, } from '../../../../../plugins/home/public'; import { UsageCollectionSetup } from '../../../../../plugins/usage_collection/public'; -import { DefaultEditorController } from '../../../vis_default_editor/public'; +import { DefaultEditorController } from '../../../../../plugins/vis_default_editor/public'; export interface VisualizePluginStartDependencies { data: DataPublicPluginStart; diff --git a/src/legacy/core_plugins/region_map/public/region_map_type.js b/src/legacy/core_plugins/region_map/public/region_map_type.js index 4faa3f92abb5a..9174b03cf843c 100644 --- a/src/legacy/core_plugins/region_map/public/region_map_type.js +++ b/src/legacy/core_plugins/region_map/public/region_map_type.js @@ -22,7 +22,7 @@ import { mapToLayerWithId } from './util'; import { createRegionMapVisualization } from './region_map_visualization'; import { RegionMapOptions } from './components/region_map_options'; import { truncatedColorSchemas } from '../../../../plugins/charts/public'; -import { Schemas } from '../../vis_default_editor/public'; +import { Schemas } from '../../../../plugins/vis_default_editor/public'; // TODO: reference to TILE_MAP plugin should be removed import { ORIGIN } from '../../tile_map/common/origin'; diff --git a/src/legacy/core_plugins/tile_map/public/tile_map_type.js b/src/legacy/core_plugins/tile_map/public/tile_map_type.js index 39d39a4c8f8fc..fe82ad5c7352b 100644 --- a/src/legacy/core_plugins/tile_map/public/tile_map_type.js +++ b/src/legacy/core_plugins/tile_map/public/tile_map_type.js @@ -22,7 +22,7 @@ import { i18n } from '@kbn/i18n'; import { convertToGeoJson } from 'ui/vis/map/convert_to_geojson'; -import { Schemas } from '../../vis_default_editor/public'; +import { Schemas } from '../../../../plugins/vis_default_editor/public'; import { createTileMapVisualization } from './tile_map_visualization'; import { TileMapOptions } from './components/tile_map_options'; import { MapTypes } from './map_types'; diff --git a/src/legacy/core_plugins/vis_type_markdown/public/markdown_vis.ts b/src/legacy/core_plugins/vis_type_markdown/public/markdown_vis.ts index b84d9638eb973..57ea6d9c9bb3d 100644 --- a/src/legacy/core_plugins/vis_type_markdown/public/markdown_vis.ts +++ b/src/legacy/core_plugins/vis_type_markdown/public/markdown_vis.ts @@ -22,7 +22,7 @@ import { i18n } from '@kbn/i18n'; import { MarkdownVisWrapper } from './markdown_vis_controller'; import { MarkdownOptions } from './markdown_options'; import { SettingsOptions } from './settings_options'; -import { DefaultEditorSize } from '../../vis_default_editor/public'; +import { DefaultEditorSize } from '../../../../plugins/vis_default_editor/public'; export const markdownVisDefinition = { name: 'markdown', diff --git a/src/legacy/core_plugins/vis_type_metric/public/metric_vis_type.ts b/src/legacy/core_plugins/vis_type_metric/public/metric_vis_type.ts index f29164f7e540d..3bbb8964122e5 100644 --- a/src/legacy/core_plugins/vis_type_metric/public/metric_vis_type.ts +++ b/src/legacy/core_plugins/vis_type_metric/public/metric_vis_type.ts @@ -24,7 +24,7 @@ import { MetricVisOptions } from './components/metric_vis_options'; import { ColorModes } from '../../vis_type_vislib/public'; import { ColorSchemas, colorSchemas } from '../../../../plugins/charts/public'; import { AggGroupNames } from '../../../../plugins/data/public'; -import { Schemas } from '../../vis_default_editor/public'; +import { Schemas } from '../../../../plugins/vis_default_editor/public'; export const createMetricVisTypeDefinition = () => ({ name: 'metric', diff --git a/src/legacy/core_plugins/vis_type_table/public/table_vis_type.ts b/src/legacy/core_plugins/vis_type_table/public/table_vis_type.ts index d26e860e51272..43816121bc23b 100644 --- a/src/legacy/core_plugins/vis_type_table/public/table_vis_type.ts +++ b/src/legacy/core_plugins/vis_type_table/public/table_vis_type.ts @@ -19,7 +19,7 @@ import { i18n } from '@kbn/i18n'; import { AggGroupNames } from '../../../../plugins/data/public'; -import { Schemas } from '../../vis_default_editor/public'; +import { Schemas } from '../../../../plugins/vis_default_editor/public'; import { Vis } from '../../../../plugins/visualizations/public'; import { tableVisResponseHandler } from './table_vis_response_handler'; // @ts-ignore diff --git a/src/legacy/core_plugins/vis_type_tagcloud/public/tag_cloud_type.ts b/src/legacy/core_plugins/vis_type_tagcloud/public/tag_cloud_type.ts index 5a8cc3004a315..b7dfa62c93fb9 100644 --- a/src/legacy/core_plugins/vis_type_tagcloud/public/tag_cloud_type.ts +++ b/src/legacy/core_plugins/vis_type_tagcloud/public/tag_cloud_type.ts @@ -19,7 +19,7 @@ import { i18n } from '@kbn/i18n'; -import { Schemas } from '../../vis_default_editor/public'; +import { Schemas } from '../../../../plugins/vis_default_editor/public'; import { TagCloudOptions } from './components/tag_cloud_options'; diff --git a/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_interval.tsx b/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_interval.tsx index 6e29b111d422a..8a8e1b22fb78d 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_interval.tsx +++ b/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_interval.tsx @@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n'; import { search } from '../../../../../plugins/data/public'; const { isValidEsInterval } = search.aggs; -import { useValidation } from '../../../vis_default_editor/public'; +import { useValidation } from '../../../../../plugins/vis_default_editor/public'; const intervalOptions = [ { diff --git a/src/legacy/core_plugins/vis_type_timelion/public/timelion_vis_type.tsx b/src/legacy/core_plugins/vis_type_timelion/public/timelion_vis_type.tsx index 6679553004097..5be77b3e51a6a 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/timelion_vis_type.tsx +++ b/src/legacy/core_plugins/vis_type_timelion/public/timelion_vis_type.tsx @@ -21,7 +21,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { KibanaContextProvider } from '../../../../plugins/kibana_react/public'; -import { DefaultEditorSize } from '../../vis_default_editor/public'; +import { DefaultEditorSize } from '../../../../plugins/vis_default_editor/public'; import { getTimelionRequestHandler } from './helpers/timelion_request_handler'; import { TimelionVisComponent, TimelionVisComponentProp } from './components'; import { TimelionOptions } from './timelion_options'; diff --git a/src/legacy/core_plugins/vis_type_vega/public/vega_type.ts b/src/legacy/core_plugins/vis_type_vega/public/vega_type.ts index b0ec90d2c378f..5d9ed5c8df91c 100644 --- a/src/legacy/core_plugins/vis_type_vega/public/vega_type.ts +++ b/src/legacy/core_plugins/vis_type_vega/public/vega_type.ts @@ -18,8 +18,7 @@ */ import { i18n } from '@kbn/i18n'; -// @ts-ignore -import { DefaultEditorSize } from '../../vis_default_editor/public'; +import { DefaultEditorSize } from '../../../../plugins/vis_default_editor/public'; import { VegaVisualizationDependencies } from './plugin'; import { VegaVisEditor } from './components'; import { defaultFeedbackMessage } from '../../../../plugins/kibana_utils/common'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/area.ts b/src/legacy/core_plugins/vis_type_vislib/public/area.ts index e79555470298b..68decacaaa040 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/area.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/area.ts @@ -24,7 +24,7 @@ import { palettes } from '@elastic/eui/lib/services'; import { euiPaletteColorBlind } from '@elastic/eui/lib/services'; import { AggGroupNames } from '../../../../plugins/data/public'; -import { Schemas } from '../../vis_default_editor/public'; +import { Schemas } from '../../../../plugins/vis_default_editor/public'; import { Positions, ChartTypes, diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/common/color_ranges.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/common/color_ranges.tsx index 2c9b1b543e8c2..84c70f10b12da 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/common/color_ranges.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/common/color_ranges.tsx @@ -22,7 +22,10 @@ import { last } from 'lodash'; import { i18n } from '@kbn/i18n'; -import { RangeValues, RangesParamEditor } from '../../../../vis_default_editor/public'; +import { + RangeValues, + RangesParamEditor, +} from '../../../../../../plugins/vis_default_editor/public'; export type SetColorRangeValue = (paramName: string, value: RangeValues[]) => void; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/gauge.ts b/src/legacy/core_plugins/vis_type_vislib/public/gauge.ts index 4610bd37db5f1..7ad821dbf2f30 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/gauge.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/gauge.ts @@ -19,7 +19,7 @@ import { i18n } from '@kbn/i18n'; -import { RangeValues, Schemas } from '../../vis_default_editor/public'; +import { RangeValues, Schemas } from '../../../../plugins/vis_default_editor/public'; import { AggGroupNames } from '../../../../plugins/data/public'; import { GaugeOptions } from './components/options'; import { getGaugeCollections, Alignments, ColorModes, GaugeTypes } from './utils/collections'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/goal.ts b/src/legacy/core_plugins/vis_type_vislib/public/goal.ts index c918128d01f11..6c311bebe0717 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/goal.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/goal.ts @@ -25,7 +25,7 @@ import { createVislibVisController } from './vis_controller'; import { VisTypeVislibDependencies } from './plugin'; import { ColorSchemas } from '../../../../plugins/charts/public'; import { AggGroupNames } from '../../../../plugins/data/public'; -import { Schemas } from '../../vis_default_editor/public'; +import { Schemas } from '../../../../plugins/vis_default_editor/public'; export const createGoalVisTypeDefinition = (deps: VisTypeVislibDependencies) => ({ name: 'goal', diff --git a/src/legacy/core_plugins/vis_type_vislib/public/heatmap.ts b/src/legacy/core_plugins/vis_type_vislib/public/heatmap.ts index 39a583f3c9641..88b4f0fcaf87e 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/heatmap.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/heatmap.ts @@ -19,7 +19,7 @@ import { i18n } from '@kbn/i18n'; -import { RangeValues, Schemas } from '../../vis_default_editor/public'; +import { RangeValues, Schemas } from '../../../../plugins/vis_default_editor/public'; import { AggGroupNames } from '../../../../plugins/data/public'; import { AxisTypes, getHeatmapCollections, Positions, ScaleTypes } from './utils/collections'; import { HeatmapOptions } from './components/options'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/histogram.ts b/src/legacy/core_plugins/vis_type_vislib/public/histogram.ts index 15ef369e5150e..54ec8f98203e2 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/histogram.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/histogram.ts @@ -24,7 +24,7 @@ import { palettes } from '@elastic/eui/lib/services'; import { euiPaletteColorBlind } from '@elastic/eui/lib/services'; import { AggGroupNames } from '../../../../plugins/data/public'; -import { Schemas } from '../../vis_default_editor/public'; +import { Schemas } from '../../../../plugins/vis_default_editor/public'; import { Positions, ChartTypes, diff --git a/src/legacy/core_plugins/vis_type_vislib/public/horizontal_bar.ts b/src/legacy/core_plugins/vis_type_vislib/public/horizontal_bar.ts index 8b5811628855c..dc47252ccd44f 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/horizontal_bar.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/horizontal_bar.ts @@ -24,7 +24,7 @@ import { palettes } from '@elastic/eui/lib/services'; import { euiPaletteColorBlind } from '@elastic/eui/lib/services'; import { AggGroupNames } from '../../../../plugins/data/public'; -import { Schemas } from '../../vis_default_editor/public'; +import { Schemas } from '../../../../plugins/vis_default_editor/public'; import { Positions, ChartTypes, diff --git a/src/legacy/core_plugins/vis_type_vislib/public/line.ts b/src/legacy/core_plugins/vis_type_vislib/public/line.ts index ac4cda869fe29..885ab295d11e1 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/line.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/line.ts @@ -24,7 +24,7 @@ import { palettes } from '@elastic/eui/lib/services'; import { euiPaletteColorBlind } from '@elastic/eui/lib/services'; import { AggGroupNames } from '../../../../plugins/data/public'; -import { Schemas } from '../../vis_default_editor/public'; +import { Schemas } from '../../../../plugins/vis_default_editor/public'; import { Positions, ChartTypes, diff --git a/src/legacy/core_plugins/vis_type_vislib/public/pie.ts b/src/legacy/core_plugins/vis_type_vislib/public/pie.ts index 0f1bd93f5b5bd..2774836baa381 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/pie.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/pie.ts @@ -20,7 +20,7 @@ import { i18n } from '@kbn/i18n'; import { AggGroupNames } from '../../../../plugins/data/public'; -import { Schemas } from '../../vis_default_editor/public'; +import { Schemas } from '../../../../plugins/vis_default_editor/public'; import { PieOptions } from './components/options'; import { getPositions, Positions } from './utils/collections'; import { createVislibVisController } from './vis_controller'; diff --git a/src/plugins/vis_default_editor/README.md b/src/plugins/vis_default_editor/README.md index 76ac23682c6d6..8607dfe486ace 100644 --- a/src/plugins/vis_default_editor/README.md +++ b/src/plugins/vis_default_editor/README.md @@ -1,7 +1,8 @@ # Visualization Deafult Editor plugin -The default editor is used as visualize sidebar in most primary visualizations, e.x. `Area`, `Data table`, `Pie`, etc. -The plugun exposes the static `DefaultEditorController` class to consume. +The default editor is used in most primary visualizations, e.x. `Area`, `Data table`, `Pie`, etc. +It acts as a container for a particular visualization and options tabs. Contains the default "Data" tab in `public/components/sidebar/data_tab.tsx`. +The plugin exposes the static `DefaultEditorController` class to consume. ```ts import { DefaultEditorController } from '../../vis_default_editor/public'; diff --git a/src/plugins/vis_default_editor/public/components/controls/components/from_to_list.tsx b/src/plugins/vis_default_editor/public/components/controls/components/from_to_list.tsx index e52b2c85b63fa..05b3538d8afa7 100644 --- a/src/plugins/vis_default_editor/public/components/controls/components/from_to_list.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/components/from_to_list.tsx @@ -21,7 +21,7 @@ import React from 'react'; import { EuiFieldText, EuiFlexItem, EuiIcon } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { Ipv4Address } from '../../../../../../../plugins/kibana_utils/public'; +import { Ipv4Address } from '../../../../../kibana_utils/public'; import { InputList, InputListConfig, InputModel, InputObject, InputItem } from './input_list'; const EMPTY_STRING = ''; diff --git a/src/plugins/vis_default_editor/public/components/controls/components/input_list.tsx b/src/plugins/vis_default_editor/public/components/controls/components/input_list.tsx index cc80d0073c904..f1a1b01810c7f 100644 --- a/src/plugins/vis_default_editor/public/components/controls/components/input_list.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/components/input_list.tsx @@ -17,7 +17,7 @@ * under the License. */ -import React, { useState, useEffect, Fragment } from 'react'; +import React, { useState, useEffect, Fragment, useCallback } from 'react'; import { isEmpty, isEqual, mapValues, omit, pick } from 'lodash'; import { EuiButtonIcon, @@ -102,10 +102,13 @@ function InputList({ config, list, onChange, setValidity }: InputListProps) { ); const hasInvalidValues = models.some(config.hasInvalidValuesFn); - const updateValues = (modelList: InputModel[]) => { - setModels(modelList); - onChange(modelList.map(config.onChangeFn)); - }; + const updateValues = useCallback( + (modelList: InputModel[]) => { + setModels(modelList); + onChange(modelList.map(config.onChangeFn)); + }, + [config.onChangeFn, onChange] + ); const onChangeValue = (index: number, value: string, modelName: string) => { const { model, isInvalid } = validateValue(value, config); updateValues( @@ -143,11 +146,11 @@ function InputList({ config, list, onChange, setValidity }: InputListProps) { } as InputModel, ]); } - }, []); + }, [config.defaultValue, list.length, updateValues]); useEffect(() => { setValidity(!hasInvalidValues); - }, [hasInvalidValues]); + }, [hasInvalidValues, setValidity]); useEffect(() => { // responsible for discarding changes @@ -171,7 +174,7 @@ function InputList({ config, list, onChange, setValidity }: InputListProps) { ) ); } - }, [list]); + }, [config, list, models]); return ( <> diff --git a/src/plugins/vis_default_editor/public/components/controls/components/mask_list.tsx b/src/plugins/vis_default_editor/public/components/controls/components/mask_list.tsx index f6edecbbcbd70..930b614d0d919 100644 --- a/src/plugins/vis_default_editor/public/components/controls/components/mask_list.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/components/mask_list.tsx @@ -22,7 +22,7 @@ import { EuiFieldText, EuiFlexItem } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { InputList, InputListConfig, InputObject, InputModel, InputItem } from './input_list'; -import { search } from '../../../../../../../plugins/data/public'; +import { search } from '../../../../../data/public'; const EMPTY_STRING = ''; diff --git a/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.tsx b/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.tsx index a43c66c2e08cc..b4683e47979ce 100644 --- a/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/components/number_list/number_list.tsx @@ -79,7 +79,7 @@ function NumberList({ if (!numberArray.length) { onChange([models[0].value as number]); } - }, []); + }, [models, numberArray.length, onChange]); const isValid = !hasInvalidValues(models); useValidation(setValidity, isValid); @@ -109,7 +109,7 @@ function NumberList({ }) ); }, - [numberRange, models, onUpdate] + [models, onUpdate] ); // Add an item to the end of the list diff --git a/src/plugins/vis_default_editor/public/components/controls/components/number_list/range.test.ts b/src/plugins/vis_default_editor/public/components/controls/components/number_list/range.test.ts index e9090e5b38ef7..a19034d3c8e92 100644 --- a/src/plugins/vis_default_editor/public/components/controls/components/number_list/range.test.ts +++ b/src/plugins/vis_default_editor/public/components/controls/components/number_list/range.test.ts @@ -108,7 +108,6 @@ describe('Range parsing utility', () => { }; forOwn(tests, (spec, str: any) => { - // eslint-disable-next-line jest/valid-describe describe(str, () => { const range = parseRange(str); diff --git a/src/plugins/vis_default_editor/public/components/controls/date_ranges.tsx b/src/plugins/vis_default_editor/public/components/controls/date_ranges.tsx index 0e4ef9bdf5540..b4691a189a19d 100644 --- a/src/plugins/vis_default_editor/public/components/controls/date_ranges.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/date_ranges.tsx @@ -17,7 +17,7 @@ * under the License. */ -import React, { Fragment, useState, useEffect } from 'react'; +import React, { Fragment, useState, useEffect, useCallback } from 'react'; import { htmlIdGenerator, EuiButtonIcon, @@ -72,6 +72,20 @@ function DateRangesParamEditor({ ({ from, to }) => (!from && !to) || !validateDateMath(from) || !validateDateMath(to) ); + const updateRanges = useCallback( + (rangeValues: DateRangeValuesModel[]) => { + // do not set internal id parameter into saved object + setValue(rangeValues.map(range => omit(range, 'id'))); + setRanges(rangeValues); + }, + [setValue] + ); + + const onAddRange = useCallback(() => updateRanges([...ranges, { id: generateId() }]), [ + ranges, + updateRanges, + ]); + // set up an initial range when there is no default range useEffect(() => { if (!value.length) { @@ -93,18 +107,6 @@ function DateRangesParamEditor({ setValidity(!hasInvalidRange); }, [hasInvalidRange, setValidity]); - const updateRanges = useCallback( - (rangeValues: DateRangeValuesModel[]) => { - // do not set internal id parameter into saved object - setValue(rangeValues.map(range => omit(range, 'id'))); - setRanges(rangeValues); - }, - [setValue] - ); - const onAddRange = useCallback(() => updateRanges([...ranges, { id: generateId() }]), [ - ranges, - updateRanges, - ]); const onRemoveRange = (id: string) => updateRanges(ranges.filter(range => range.id !== id)); const onChangeRange = (id: string, key: string, newValue: string) => updateRanges( diff --git a/src/plugins/vis_default_editor/public/components/controls/filter.tsx b/src/plugins/vis_default_editor/public/components/controls/filter.tsx index 006824724c7a3..16aaff47f49c3 100644 --- a/src/plugins/vis_default_editor/public/components/controls/filter.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/filter.tsx @@ -21,7 +21,7 @@ import React, { useState } from 'react'; import { EuiForm, EuiButtonIcon, EuiFieldText, EuiFormRow, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { IAggConfig, Query, QueryStringInput } from 'src/plugins/data/public'; +import { IAggConfig, Query, QueryStringInput } from '../../../../data/public'; interface FilterRowProps { id: string; diff --git a/src/plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx b/src/plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx index e123336cef482..0cfcf43e96136 100644 --- a/src/plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx @@ -27,10 +27,10 @@ import { AggParamEditorProps } from '../agg_param_props'; const { isType } = search.aggs; function HasExtendedBoundsParamEditor(props: AggParamEditorProps) { + const { agg, setValue, value } = props; useEffect(() => { - props.setValue(props.value && props.agg.params.min_doc_count); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [props.agg.params.min_doc_count]); + setValue(value && agg.params.min_doc_count); + }, [agg.params.min_doc_count, setValue, value]); return ( ) { const fieldTypeIsNotString = !search.aggs.isStringType(props.agg); + const { setValue } = props; useEffect(() => { if (fieldTypeIsNotString) { - props.setValue(false); + setValue(false); } - // eslint-disable-next-line react-hooks/exhaustive-deps - }, [fieldTypeIsNotString]); + }, [fieldTypeIsNotString, setValue]); return ( { setValidity(isValid); - }, [isValid]); + }, [isValid, setValidity]); const onChange = useCallback( ({ target }: React.ChangeEvent) => diff --git a/src/plugins/vis_default_editor/public/components/controls/order_by.tsx b/src/plugins/vis_default_editor/public/components/controls/order_by.tsx index 9f1aaa54a8ca3..1274f2af811d4 100644 --- a/src/plugins/vis_default_editor/public/components/controls/order_by.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/order_by.tsx @@ -28,7 +28,7 @@ import { useValidation, } from './utils'; import { AggParamEditorProps } from '../agg_param_props'; -import { search } from '../../../../../../plugins/data/public'; +import { search } from '../../../../data/public'; const { termsAggFilter } = search.aggs; const DEFAULT_VALUE = '_key'; @@ -70,7 +70,7 @@ function OrderByParamEditor({ setValue(respAgg.id); } - }, []); + }, [metricAggs, setValue, value]); useFallbackMetric(setValue, termsAggFilter, metricAggs, value, DEFAULT_VALUE); diff --git a/src/plugins/vis_default_editor/public/components/controls/precision.tsx b/src/plugins/vis_default_editor/public/components/controls/precision.tsx index df71e72ee6c61..ad2011513b171 100644 --- a/src/plugins/vis_default_editor/public/components/controls/precision.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/precision.tsx @@ -22,7 +22,7 @@ import React from 'react'; import { EuiRange, EuiFormRow } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { useKibana } from '../../../../../../plugins/kibana_react/public'; +import { useKibana } from '../../../../kibana_react/public'; import { AggParamEditorProps } from '../agg_param_props'; function PrecisionParamEditor({ agg, value, setValue }: AggParamEditorProps) { diff --git a/src/plugins/vis_default_editor/public/components/controls/ranges.tsx b/src/plugins/vis_default_editor/public/components/controls/ranges.tsx index 27de9dfe68ee0..5c6438b400408 100644 --- a/src/plugins/vis_default_editor/public/components/controls/ranges.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/ranges.tsx @@ -17,7 +17,7 @@ * under the License. */ -import React, { Fragment, useState, useEffect } from 'react'; +import React, { Fragment, useCallback, useState, useEffect } from 'react'; import { htmlIdGenerator, EuiButtonIcon, @@ -76,13 +76,44 @@ function RangesParamEditor({ validateRange, }: RangesParamEditorProps) { const [ranges, setRanges] = useState(() => value.map(range => ({ ...range, id: generateId() }))); + const updateRanges = useCallback( + (rangeValues: RangeValuesModel[]) => { + // do not set internal id parameter into saved object + setValue(rangeValues.map(range => omit(range, 'id'))); + setRanges(rangeValues); + + if (setTouched) { + setTouched(true); + } + }, + [setTouched, setValue] + ); + const onAddRange = useCallback( + () => + addRangeValues + ? updateRanges([...ranges, { ...addRangeValues(), id: generateId() }]) + : updateRanges([...ranges, { id: generateId() }]), + [addRangeValues, ranges, updateRanges] + ); + const onRemoveRange = (id: string) => updateRanges(ranges.filter(range => range.id !== id)); + const onChangeRange = (id: string, key: string, newValue: string) => + updateRanges( + ranges.map(range => + range.id === id + ? { + ...range, + [key]: newValue === '' ? undefined : parseFloat(newValue), + } + : range + ) + ); // set up an initial range when there is no default range useEffect(() => { if (!value.length) { onAddRange(); } - }, []); + }, [onAddRange, value.length]); useEffect(() => { // responsible for discarding changes @@ -92,33 +123,7 @@ function RangesParamEditor({ ) { setRanges(value.map(range => ({ ...range, id: generateId() }))); } - }, [value]); - - const updateRanges = (rangeValues: RangeValuesModel[]) => { - // do not set internal id parameter into saved object - setValue(rangeValues.map(range => omit(range, 'id'))); - setRanges(rangeValues); - - if (setTouched) { - setTouched(true); - } - }; - const onAddRange = () => - addRangeValues - ? updateRanges([...ranges, { ...addRangeValues(), id: generateId() }]) - : updateRanges([...ranges, { id: generateId() }]); - const onRemoveRange = (id: string) => updateRanges(ranges.filter(range => range.id !== id)); - const onChangeRange = (id: string, key: string, newValue: string) => - updateRanges( - ranges.map(range => - range.id === id - ? { - ...range, - [key]: newValue === '' ? undefined : parseFloat(newValue), - } - : range - ) - ); + }, [ranges, value]); const hasInvalidRange = validateRange && diff --git a/src/plugins/vis_default_editor/public/components/controls/size.tsx b/src/plugins/vis_default_editor/public/components/controls/size.tsx index 824ec4aeb253c..9f55eb9212dee 100644 --- a/src/plugins/vis_default_editor/public/components/controls/size.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/size.tsx @@ -48,7 +48,7 @@ function SizeParamEditor({ useEffect(() => { setValidity(isValid); - }, [isValid]); + }, [isValid, setValidity]); return ( { setValidity(isValid); - }, [isValid]); + }, [isValid, setValidity]); const onChange = useCallback(ev => setValue(ev.target.value), [setValue]); diff --git a/src/plugins/vis_default_editor/public/components/controls/sub_agg.tsx b/src/plugins/vis_default_editor/public/components/controls/sub_agg.tsx index c9f53a68b3e83..9a3c786651d7d 100644 --- a/src/plugins/vis_default_editor/public/components/controls/sub_agg.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/sub_agg.tsx @@ -20,7 +20,7 @@ import React, { useEffect } from 'react'; import { EuiSpacer } from '@elastic/eui'; -import { AggParamType, IAggConfig, AggGroupNames } from '../../../../../../plugins/data/public'; +import { AggParamType, IAggConfig, AggGroupNames } from '../../../../data/public'; import { useSubAggParamsHandlers } from './utils'; import { AggParamEditorProps } from '../agg_param_props'; import { DefaultEditorAggParams } from '../agg_params'; @@ -44,7 +44,7 @@ function SubAggParamEditor({ } else if (!agg.params.customMetric) { setValue(aggParam.makeAgg(agg)); } - }, [value, metricAggs]); + }, [value, metricAggs, agg, setValue, aggParam]); const { onAggTypeChange, setAggParamValue } = useSubAggParamsHandlers( agg, diff --git a/src/plugins/vis_default_editor/public/components/controls/sub_metric.tsx b/src/plugins/vis_default_editor/public/components/controls/sub_metric.tsx index ead3f8bb00623..5e655a24691e1 100644 --- a/src/plugins/vis_default_editor/public/components/controls/sub_metric.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/sub_metric.tsx @@ -21,7 +21,7 @@ import React, { useEffect } from 'react'; import { EuiFormLabel, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { AggParamType, IAggConfig, AggGroupNames } from '../../../../../../plugins/data/public'; +import { AggParamType, IAggConfig, AggGroupNames } from '../../../../data/public'; import { useSubAggParamsHandlers } from './utils'; import { AggParamEditorProps } from '../agg_param_props'; import { DefaultEditorAggParams } from '../agg_params'; @@ -54,7 +54,7 @@ function SubMetricParamEditor({ } else { setValue(aggParam.makeAgg(agg)); } - }, []); + }, [agg, aggParam, setValue, type]); const { onAggTypeChange, setAggParamValue } = useSubAggParamsHandlers( agg, diff --git a/src/plugins/vis_default_editor/public/components/controls/time_interval.tsx b/src/plugins/vis_default_editor/public/components/controls/time_interval.tsx index 971a62faf7d7c..4af41f67bc524 100644 --- a/src/plugins/vis_default_editor/public/components/controls/time_interval.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/time_interval.tsx @@ -23,7 +23,7 @@ import { EuiFormRow, EuiIconTip, EuiComboBox, EuiComboBoxOptionOption } from '@e import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { search, AggParamOption } from '../../../../../../plugins/data/public'; +import { search, AggParamOption } from '../../../../data/public'; import { AggParamEditorProps } from '../agg_param_props'; const { parseEsInterval, InvalidEsCalendarIntervalError } = search.aggs; @@ -161,7 +161,7 @@ function TimeIntervalParamEditor({ useEffect(() => { setValidity(isValid); - }, [isValid]); + }, [isValid, setValidity]); return ( { setValidity(isValid); - }, [isValid]); + }, [isValid, setValidity]); useEffect(() => { if (isFirstRun.current) { @@ -102,7 +102,7 @@ export function TopAggregateParamEditor({ if (filteredOptions.length === 1) { setValue(aggParam.options.find(opt => opt.value === filteredOptions[0].value)); } - }, [fieldType]); + }, [aggParam.options, fieldType, filteredOptions, setValue, value]); const handleChange = (event: React.ChangeEvent) => { if (event.target.value === emptyValue.value) { diff --git a/src/plugins/vis_default_editor/public/default_editor_controller.tsx b/src/plugins/vis_default_editor/public/default_editor_controller.tsx index 1c785fc991285..798da09f8e30b 100644 --- a/src/plugins/vis_default_editor/public/default_editor_controller.tsx +++ b/src/plugins/vis_default_editor/public/default_editor_controller.tsx @@ -17,8 +17,6 @@ * under the License. */ -import './index.scss'; - import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; import { i18n } from '@kbn/i18n'; diff --git a/src/plugins/vis_default_editor/public/index.ts b/src/plugins/vis_default_editor/public/index.ts index 156d50f451b57..6c58c6df26b00 100644 --- a/src/plugins/vis_default_editor/public/index.ts +++ b/src/plugins/vis_default_editor/public/index.ts @@ -17,6 +17,8 @@ * under the License. */ +import './index.scss'; + export { DefaultEditorController } from './default_editor_controller'; export { useValidation } from './components/controls/utils'; export { RangesParamEditor, RangeValues } from './components/controls/ranges'; From 51e775ff59a42085c43ad09e16fe067f4da71c72 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Fri, 3 Apr 2020 17:58:07 +0300 Subject: [PATCH 03/15] Import styles through the visualize --- src/legacy/core_plugins/kibana/public/visualize/_index.scss | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/legacy/core_plugins/kibana/public/visualize/_index.scss b/src/legacy/core_plugins/kibana/public/visualize/_index.scss index 0632831578bd0..079d82936bb57 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/_index.scss +++ b/src/legacy/core_plugins/kibana/public/visualize/_index.scss @@ -1,2 +1,5 @@ // Visualize plugin styles @import 'np_ready/index'; + +// should be removed while moving the visualize into NP +@import '../../../../../plugins/vis_default_editor/public/index' From 5f10f36f3b4b013af6a95bbe13178153369ed505 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Fri, 3 Apr 2020 18:51:40 +0300 Subject: [PATCH 04/15] Other fixes --- .eslintrc.js | 20 ------------------- .../public/components/editor/controls_tab.tsx | 2 +- .../public/components/editor/options_tab.tsx | 2 +- .../public/components/region_map_options.tsx | 2 +- .../public/components/tile_map_options.tsx | 2 +- .../public/markdown_options.tsx | 2 +- .../public/settings_options.tsx | 2 +- .../public/components/metric_vis_options.tsx | 2 +- .../public/metric_vis_fn.test.ts | 4 ---- .../public/metric_vis_type.test.ts | 4 ---- .../public/components/table_vis_options.tsx | 2 +- .../public/components/tag_cloud_options.tsx | 2 +- .../public/timelion_options.tsx | 2 +- .../public/components/vega_vis_editor.tsx | 2 +- .../components/common/basic_options.tsx | 2 +- .../public/components/common/color_schema.tsx | 2 +- .../components/common/validation_wrapper.tsx | 2 +- .../public/components/options/gauge/index.tsx | 2 +- .../components/options/heatmap/index.tsx | 2 +- .../options/heatmap/labels_panel.tsx | 2 +- .../metrics_axes/category_axis_panel.tsx | 2 +- .../public/components/options/pie.tsx | 2 +- .../options/point_series/grid_panel.tsx | 2 +- .../public/utils/common_config.tsx | 2 +- .../public/components/controls/field.tsx | 1 + .../public/components/controls/order.tsx | 2 +- .../controls/radius_ratio_option.tsx | 2 +- .../self_changing_editor.tsx | 2 +- 28 files changed, 25 insertions(+), 52 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index e66331594b4ae..af3ed728ccdd9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -69,26 +69,6 @@ module.exports = { 'jsx-a11y/no-onchange': 'off', }, }, - { - files: ['src/legacy/core_plugins/expressions/**/*.{js,ts,tsx}'], - rules: { - 'react-hooks/exhaustive-deps': 'off', - }, - }, - { - files: [ - 'src/legacy/core_plugins/vis_default_editor/public/components/controls/**/*.{ts,tsx}', - ], - rules: { - 'react-hooks/exhaustive-deps': 'off', - }, - }, - { - files: ['src/legacy/ui/public/vis/**/*.{js,ts,tsx}'], - rules: { - 'react-hooks/exhaustive-deps': 'off', - }, - }, { files: ['src/plugins/es_ui_shared/**/*.{js,ts,tsx}'], rules: { diff --git a/src/legacy/core_plugins/input_control_vis/public/components/editor/controls_tab.tsx b/src/legacy/core_plugins/input_control_vis/public/components/editor/controls_tab.tsx index 029e1f149d052..b7114f1029ef2 100644 --- a/src/legacy/core_plugins/input_control_vis/public/components/editor/controls_tab.tsx +++ b/src/legacy/core_plugins/input_control_vis/public/components/editor/controls_tab.tsx @@ -30,7 +30,7 @@ import { EuiSelect, } from '@elastic/eui'; -import { VisOptionsProps } from 'src/legacy/core_plugins/vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { IIndexPattern } from 'src/plugins/data/public'; import { ControlEditor } from './control_editor'; import { diff --git a/src/legacy/core_plugins/input_control_vis/public/components/editor/options_tab.tsx b/src/legacy/core_plugins/input_control_vis/public/components/editor/options_tab.tsx index 95b14619c3416..cdff6cabad8ba 100644 --- a/src/legacy/core_plugins/input_control_vis/public/components/editor/options_tab.tsx +++ b/src/legacy/core_plugins/input_control_vis/public/components/editor/options_tab.tsx @@ -23,7 +23,7 @@ import { EuiForm, EuiFormRow, EuiSwitch } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { EuiSwitchEvent } from '@elastic/eui'; -import { VisOptionsProps } from 'src/legacy/core_plugins/vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; interface OptionsTabParams { updateFiltersOnChange: boolean; diff --git a/src/legacy/core_plugins/region_map/public/components/region_map_options.tsx b/src/legacy/core_plugins/region_map/public/components/region_map_options.tsx index 4219e2e715150..61cfbf00ded9e 100644 --- a/src/legacy/core_plugins/region_map/public/components/region_map_options.tsx +++ b/src/legacy/core_plugins/region_map/public/components/region_map_options.tsx @@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { FileLayerField, VectorLayer, ServiceSettings } from 'ui/vis/map/service_settings'; -import { VisOptionsProps } from 'src/legacy/core_plugins/vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { NumberInputOption, SelectOption, SwitchOption } from '../../../vis_type_vislib/public'; import { WmsOptions } from '../../../tile_map/public/components/wms_options'; import { RegionMapVisParams } from '../types'; diff --git a/src/legacy/core_plugins/tile_map/public/components/tile_map_options.tsx b/src/legacy/core_plugins/tile_map/public/components/tile_map_options.tsx index 168f56b771b7e..9169647aa2aef 100644 --- a/src/legacy/core_plugins/tile_map/public/components/tile_map_options.tsx +++ b/src/legacy/core_plugins/tile_map/public/components/tile_map_options.tsx @@ -21,7 +21,7 @@ import React, { useEffect } from 'react'; import { EuiPanel, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { VisOptionsProps } from 'src/legacy/core_plugins/vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { BasicOptions, RangeOption, diff --git a/src/legacy/core_plugins/vis_type_markdown/public/markdown_options.tsx b/src/legacy/core_plugins/vis_type_markdown/public/markdown_options.tsx index 8a4297d3b8149..a6349793619a0 100644 --- a/src/legacy/core_plugins/vis_type_markdown/public/markdown_options.tsx +++ b/src/legacy/core_plugins/vis_type_markdown/public/markdown_options.tsx @@ -30,7 +30,7 @@ import { } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { VisOptionsProps } from 'src/legacy/core_plugins/vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { MarkdownVisParams } from './types'; function MarkdownOptions({ stateParams, setValue }: VisOptionsProps) { diff --git a/src/legacy/core_plugins/vis_type_markdown/public/settings_options.tsx b/src/legacy/core_plugins/vis_type_markdown/public/settings_options.tsx index ac1d4bcc82cec..552fd63373554 100644 --- a/src/legacy/core_plugins/vis_type_markdown/public/settings_options.tsx +++ b/src/legacy/core_plugins/vis_type_markdown/public/settings_options.tsx @@ -21,7 +21,7 @@ import React from 'react'; import { EuiPanel } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { VisOptionsProps } from 'src/legacy/core_plugins/vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { RangeOption, SwitchOption } from '../../vis_type_vislib/public'; import { MarkdownVisParams } from './types'; diff --git a/src/legacy/core_plugins/vis_type_metric/public/components/metric_vis_options.tsx b/src/legacy/core_plugins/vis_type_metric/public/components/metric_vis_options.tsx index 661f16d6497ba..5c3032511f09a 100644 --- a/src/legacy/core_plugins/vis_type_metric/public/components/metric_vis_options.tsx +++ b/src/legacy/core_plugins/vis_type_metric/public/components/metric_vis_options.tsx @@ -29,7 +29,7 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { VisOptionsProps } from 'src/legacy/core_plugins/vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { ColorModes, ColorRanges, diff --git a/src/legacy/core_plugins/vis_type_metric/public/metric_vis_fn.test.ts b/src/legacy/core_plugins/vis_type_metric/public/metric_vis_fn.test.ts index 22c32895d6803..4094cd4eff060 100644 --- a/src/legacy/core_plugins/vis_type_metric/public/metric_vis_fn.test.ts +++ b/src/legacy/core_plugins/vis_type_metric/public/metric_vis_fn.test.ts @@ -23,10 +23,6 @@ import { functionWrapper } from '../../../../plugins/expressions/common/expressi jest.mock('ui/new_platform'); -jest.mock('../../vis_default_editor/public', () => ({ - Schemas: class {}, -})); - describe('interpreter/functions#metric', () => { const fn = functionWrapper(createMetricVisFn()); const context = { diff --git a/src/legacy/core_plugins/vis_type_metric/public/metric_vis_type.test.ts b/src/legacy/core_plugins/vis_type_metric/public/metric_vis_type.test.ts index 459da47556307..706693eff1007 100644 --- a/src/legacy/core_plugins/vis_type_metric/public/metric_vis_type.test.ts +++ b/src/legacy/core_plugins/vis_type_metric/public/metric_vis_type.test.ts @@ -22,10 +22,6 @@ import { MetricVisComponent } from './components/metric_vis_component'; jest.mock('ui/new_platform'); -jest.mock('../../vis_default_editor/public', () => ({ - Schemas: class {}, -})); - describe('metric_vis - createMetricVisTypeDefinition', () => { it('has metric vis component set', () => { const def = createMetricVisTypeDefinition(); diff --git a/src/legacy/core_plugins/vis_type_table/public/components/table_vis_options.tsx b/src/legacy/core_plugins/vis_type_table/public/components/table_vis_options.tsx index 30a9526273166..d01ab31e0a843 100644 --- a/src/legacy/core_plugins/vis_type_table/public/components/table_vis_options.tsx +++ b/src/legacy/core_plugins/vis_type_table/public/components/table_vis_options.tsx @@ -23,7 +23,7 @@ import { EuiIconTip, EuiPanel } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { VisOptionsProps } from 'src/legacy/core_plugins/vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { search } from '../../../../../plugins/data/public'; import { NumberInputOption, SwitchOption, SelectOption } from '../../../vis_type_vislib/public'; import { TableVisParams } from '../types'; diff --git a/src/legacy/core_plugins/vis_type_tagcloud/public/components/tag_cloud_options.tsx b/src/legacy/core_plugins/vis_type_tagcloud/public/components/tag_cloud_options.tsx index a9e816f70cf53..80e4e1de7ddab 100644 --- a/src/legacy/core_plugins/vis_type_tagcloud/public/components/tag_cloud_options.tsx +++ b/src/legacy/core_plugins/vis_type_tagcloud/public/components/tag_cloud_options.tsx @@ -20,8 +20,8 @@ import React from 'react'; import { EuiPanel } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { ValidatedDualRange } from '../../../../../../src/plugins/kibana_react/public'; -import { VisOptionsProps } from '../../../vis_default_editor/public'; import { SelectOption, SwitchOption } from '../../../vis_type_vislib/public'; import { TagCloudVisParams } from '../types'; diff --git a/src/legacy/core_plugins/vis_type_timelion/public/timelion_options.tsx b/src/legacy/core_plugins/vis_type_timelion/public/timelion_options.tsx index b7c40e15c11fd..afffcf7ccaf7a 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/timelion_options.tsx +++ b/src/legacy/core_plugins/vis_type_timelion/public/timelion_options.tsx @@ -20,9 +20,9 @@ import React, { useCallback } from 'react'; import { EuiPanel } from '@elastic/eui'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { VisParams } from './timelion_vis_fn'; import { TimelionInterval, TimelionExpressionInput } from './components'; -import { VisOptionsProps } from '../../vis_default_editor/public'; function TimelionOptions({ stateParams, setValue, setValidity }: VisOptionsProps) { const setInterval = useCallback((value: VisParams['interval']) => setValue('interval', value), [ diff --git a/src/legacy/core_plugins/vis_type_vega/public/components/vega_vis_editor.tsx b/src/legacy/core_plugins/vis_type_vega/public/components/vega_vis_editor.tsx index 707a6830b5ba4..31144065d7b40 100644 --- a/src/legacy/core_plugins/vis_type_vega/public/components/vega_vis_editor.tsx +++ b/src/legacy/core_plugins/vis_type_vega/public/components/vega_vis_editor.tsx @@ -24,11 +24,11 @@ import compactStringify from 'json-stringify-pretty-compact'; import hjson from 'hjson'; import { i18n } from '@kbn/i18n'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { getNotifications } from '../services'; import { VisParams } from '../vega_fn'; import { VegaHelpMenu } from './vega_help_menu'; import { VegaActionsMenu } from './vega_actions_menu'; -import { VisOptionsProps } from '../../../vis_default_editor/public'; const aceOptions = { maxLines: Infinity, diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/common/basic_options.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/common/basic_options.tsx index 1138f66d21cfa..baf3e8ecd1b28 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/common/basic_options.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/common/basic_options.tsx @@ -20,7 +20,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; -import { VisOptionsProps } from '../../../../vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { SwitchOption } from './switch'; import { SelectOption } from './select'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/common/color_schema.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/common/color_schema.tsx index 06ce0a2b4af64..35d7f7b13235e 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/common/color_schema.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/common/color_schema.tsx @@ -22,7 +22,7 @@ import { i18n } from '@kbn/i18n'; import { EuiLink, EuiText } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; -import { VisOptionsProps } from '../../../../vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { SelectOption } from './select'; import { SwitchOption } from './switch'; import { ColorSchemaVislibParams } from '../../types'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/common/validation_wrapper.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/common/validation_wrapper.tsx index c069d4c935669..718056fd85492 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/common/validation_wrapper.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/common/validation_wrapper.tsx @@ -19,7 +19,7 @@ import React, { useEffect, useState, useCallback } from 'react'; -import { VisOptionsProps } from '../../../../vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; export interface ValidationVisOptionsProps extends VisOptionsProps { setMultipleValidity(paramName: string, isValid: boolean): void; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/gauge/index.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/gauge/index.tsx index 706035a7b814e..6109b548f9412 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/gauge/index.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/gauge/index.tsx @@ -20,7 +20,7 @@ import React, { useCallback } from 'react'; import { EuiSpacer } from '@elastic/eui'; -import { VisOptionsProps } from '../../../../../vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { GaugeVisParams } from '../../../gauge'; import { RangesPanel } from './ranges_panel'; import { StylePanel } from './style_panel'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/heatmap/index.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/heatmap/index.tsx index 452b9ed9bdbb1..715b5902b69da 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/heatmap/index.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/heatmap/index.tsx @@ -23,7 +23,7 @@ import { EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { VisOptionsProps } from '../../../../../vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { BasicOptions, ColorRanges, diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/heatmap/labels_panel.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/heatmap/labels_panel.tsx index c74f0ef765c8d..38811bd836459 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/heatmap/labels_panel.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/heatmap/labels_panel.tsx @@ -23,7 +23,7 @@ import { EuiColorPicker, EuiFormRow, EuiPanel, EuiSpacer, EuiTitle } from '@elas import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { VisOptionsProps } from '../../../../../vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { ValueAxis } from '../../../types'; import { HeatmapVisParams } from '../../../heatmap'; import { SwitchOption } from '../../common'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.tsx index 049df0cdd77be..915885388640c 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/category_axis_panel.tsx @@ -23,7 +23,7 @@ import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { VisOptionsProps } from 'src/legacy/core_plugins/vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { Axis } from '../../../types'; import { SelectOption, SwitchOption } from '../../common'; import { LabelOptions, SetAxisLabel } from './label_options'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/pie.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/pie.tsx index 2182edafb3ebf..4c0be456aad64 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/pie.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/pie.tsx @@ -22,7 +22,7 @@ import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { VisOptionsProps } from '../../../../vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { BasicOptions, TruncateLabelsOption, SwitchOption } from '../common'; import { PieVisParams } from '../../pie'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/grid_panel.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/grid_panel.tsx index db9acafac305c..bb2b3f8fddb49 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/grid_panel.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/point_series/grid_panel.tsx @@ -22,7 +22,7 @@ import { EuiPanel, EuiTitle, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { VisOptionsProps } from '../../../../../vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { SelectOption, SwitchOption } from '../../common'; import { BasicVislibParams, ValueAxis } from '../../../types'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/utils/common_config.tsx b/src/legacy/core_plugins/vis_type_vislib/public/utils/common_config.tsx index 6da40686a8b50..de867dc72bba7 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/utils/common_config.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/utils/common_config.tsx @@ -20,7 +20,7 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; -import { VisOptionsProps } from '../../../vis_default_editor/public'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { PointSeriesOptions, MetricsAxisOptions } from '../components/options'; import { ValidationWrapper } from '../components/common'; import { BasicVislibParams } from '../types'; diff --git a/src/plugins/vis_default_editor/public/components/controls/field.tsx b/src/plugins/vis_default_editor/public/components/controls/field.tsx index fc1cbb51b70a7..16a7446716b37 100644 --- a/src/plugins/vis_default_editor/public/components/controls/field.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/field.tsx @@ -98,6 +98,7 @@ function FieldParamEditor({ } else if (indexedField.options.length === 1) { setValue(indexedField.options[0].target); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, []); const onSearchChange = useCallback(searchValue => setIsDirty(Boolean(searchValue)), []); diff --git a/src/plugins/vis_default_editor/public/components/controls/order.tsx b/src/plugins/vis_default_editor/public/components/controls/order.tsx index 8f63662d928c1..e609bf9adf790 100644 --- a/src/plugins/vis_default_editor/public/components/controls/order.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/order.tsx @@ -39,7 +39,7 @@ function OrderParamEditor({ useEffect(() => { setValidity(isValid); - }, [isValid]); + }, [isValid, setValidity]); // @ts-ignore return ( diff --git a/src/plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx b/src/plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx index c64b079e4f802..8893ff5998fac 100644 --- a/src/plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx @@ -48,7 +48,7 @@ function RadiusRatioOptionControl({ editorStateParams, setStateParamValue }: Agg if (!editorStateParams.radiusRatio) { setStateParamValue(PARAM_NAME, DEFAULT_VALUE); } - }, []); + }, [editorStateParams.radiusRatio, setStateParamValue]); const onChange = useCallback( (e: React.ChangeEvent | React.MouseEvent) => diff --git a/test/plugin_functional/plugins/kbn_tp_custom_visualizations/public/self_changing_vis/self_changing_editor.tsx b/test/plugin_functional/plugins/kbn_tp_custom_visualizations/public/self_changing_vis/self_changing_editor.tsx index d3f66d708603c..6c430e34d5e29 100644 --- a/test/plugin_functional/plugins/kbn_tp_custom_visualizations/public/self_changing_vis/self_changing_editor.tsx +++ b/test/plugin_functional/plugins/kbn_tp_custom_visualizations/public/self_changing_vis/self_changing_editor.tsx @@ -20,7 +20,7 @@ import React from 'react'; import { EuiFieldNumber, EuiFormRow } from '@elastic/eui'; -import { VisOptionsProps } from '../../../../../../src/legacy/core_plugins/vis_default_editor/public/vis_options_props'; +import { VisOptionsProps } from 'src/plugins/vis_default_editor/public/vis_options_props'; interface CounterParams { counter: number; From bca5eab9b8ee8471ef459e72e7e440053a4a3aab Mon Sep 17 00:00:00 2001 From: sulemanof Date: Mon, 6 Apr 2020 13:02:19 +0300 Subject: [PATCH 05/15] Fix ip_ranges exhaustive-deps array --- .i18nrc.json | 2 +- .../controls/components/from_to_list.tsx | 72 +++++++++------- .../controls/components/input_list.tsx | 84 +++++++++++-------- .../controls/components/mask_list.tsx | 70 +++++++++------- .../public/components/controls/ip_ranges.tsx | 28 +++++-- 5 files changed, 147 insertions(+), 109 deletions(-) diff --git a/.i18nrc.json b/.i18nrc.json index c293b3103a39c..3b0b40b40792e 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -43,7 +43,7 @@ "tileMap": "src/legacy/core_plugins/tile_map", "timelion": ["src/legacy/core_plugins/timelion", "src/legacy/core_plugins/vis_type_timelion", "src/plugins/timelion"], "uiActions": "src/plugins/ui_actions", - "visDefaultEditor": "src/legacy/core_plugins/vis_default_editor", + "visDefaultEditor": "src/plugins/vis_default_editor", "visTypeMarkdown": "src/legacy/core_plugins/vis_type_markdown", "visTypeMetric": "src/legacy/core_plugins/vis_type_metric", "visTypeTable": "src/legacy/core_plugins/vis_type_table", diff --git a/src/plugins/vis_default_editor/public/components/controls/components/from_to_list.tsx b/src/plugins/vis_default_editor/public/components/controls/components/from_to_list.tsx index 05b3538d8afa7..b874459a8e7d3 100644 --- a/src/plugins/vis_default_editor/public/components/controls/components/from_to_list.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/components/from_to_list.tsx @@ -17,7 +17,7 @@ * under the License. */ -import React from 'react'; +import React, { useCallback } from 'react'; import { EuiFieldText, EuiFlexItem, EuiIcon } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; @@ -44,38 +44,42 @@ interface FromToListProps { setValidity(isValid: boolean): void; } -function FromToList({ showValidation, onBlur, ...rest }: FromToListProps) { - const fromToListConfig: InputListConfig = { - defaultValue: { - from: { value: '0.0.0.0', model: '0.0.0.0', isInvalid: false }, - to: { value: '255.255.255.255', model: '255.255.255.255', isInvalid: false }, +const defaultConfig = { + defaultValue: { + from: { value: '0.0.0.0', model: '0.0.0.0', isInvalid: false }, + to: { value: '255.255.255.255', model: '255.255.255.255', isInvalid: false }, + }, + validateClass: Ipv4Address, + getModelValue: (item: FromToObject = {}) => ({ + from: { + value: item.from || EMPTY_STRING, + model: item.from || EMPTY_STRING, + isInvalid: false, }, - validateClass: Ipv4Address, - getModelValue: (item: FromToObject = {}) => ({ - from: { - value: item.from || EMPTY_STRING, - model: item.from || EMPTY_STRING, - isInvalid: false, - }, - to: { value: item.to || EMPTY_STRING, model: item.to || EMPTY_STRING, isInvalid: false }, + to: { value: item.to || EMPTY_STRING, model: item.to || EMPTY_STRING, isInvalid: false }, + }), + getRemoveBtnAriaLabel: (item: FromToModel) => + i18n.translate('visDefaultEditor.controls.ipRanges.removeRangeAriaLabel', { + defaultMessage: 'Remove the range of {from} to {to}', + values: { from: item.from.value || '*', to: item.to.value || '*' }, }), - getRemoveBtnAriaLabel: (item: FromToModel) => - i18n.translate('visDefaultEditor.controls.ipRanges.removeRangeAriaLabel', { - defaultMessage: 'Remove the range of {from} to {to}', - values: { from: item.from.value || '*', to: item.to.value || '*' }, - }), - onChangeFn: ({ from, to }: FromToModel) => { - const result: FromToObject = {}; - if (from.model) { - result.from = from.model; - } - if (to.model) { - result.to = to.model; - } - return result; - }, - hasInvalidValuesFn: ({ from, to }: FromToModel) => from.isInvalid || to.isInvalid, - renderInputRow: (item: FromToModel, index, onChangeValue) => ( + onChangeFn: ({ from, to }: FromToModel) => { + const result: FromToObject = {}; + if (from.model) { + result.from = from.model; + } + if (to.model) { + result.to = to.model; + } + return result; + }, + hasInvalidValuesFn: ({ from, to }: FromToModel) => from.isInvalid || to.isInvalid, + modelNames: ['from', 'to'], +}; + +function FromToList({ showValidation, onBlur, ...rest }: FromToListProps) { + const renderInputRow = useCallback( + (item: FromToModel, index, onChangeValue) => ( <> ), - modelNames: ['from', 'to'], + [onBlur, showValidation] + ); + const fromToListConfig: InputListConfig = { + ...defaultConfig, + renderInputRow, }; return ; diff --git a/src/plugins/vis_default_editor/public/components/controls/components/input_list.tsx b/src/plugins/vis_default_editor/public/components/controls/components/input_list.tsx index f1a1b01810c7f..639b69cd3d33c 100644 --- a/src/plugins/vis_default_editor/public/components/controls/components/input_list.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/components/input_list.tsx @@ -70,7 +70,10 @@ interface InputListProps { } const generateId = htmlIdGenerator(); -const validateValue = (inputValue: string | undefined, config: InputListConfig) => { +const validateValue = ( + inputValue: string | undefined, + InputObject: InputListConfig['validateClass'] +) => { const result = { model: inputValue || '', isInvalid: false, @@ -80,7 +83,6 @@ const validateValue = (inputValue: string | undefined, config: InputListConfig) return result; } try { - const InputObject = config.validateClass; result.model = new InputObject(inputValue).toString(); result.isInvalid = false; return result; @@ -91,12 +93,13 @@ const validateValue = (inputValue: string | undefined, config: InputListConfig) }; function InputList({ config, list, onChange, setValidity }: InputListProps) { + const { defaultValue, getModelValue, modelNames, onChangeFn, validateClass } = config; const [models, setModels] = useState(() => list.map( item => ({ id: generateId(), - ...config.getModelValue(item), + ...getModelValue(item), } as InputModel) ) ); @@ -105,36 +108,45 @@ function InputList({ config, list, onChange, setValidity }: InputListProps) { const updateValues = useCallback( (modelList: InputModel[]) => { setModels(modelList); - onChange(modelList.map(config.onChangeFn)); + onChange(modelList.map(onChangeFn)); }, - [config.onChangeFn, onChange] + [onChangeFn, onChange] + ); + const onChangeValue = useCallback( + (index: number, value: string, modelName: string) => { + const { model, isInvalid } = validateValue(value, validateClass); + updateValues( + models.map((range, arrayIndex) => + arrayIndex === index + ? { + ...range, + [modelName]: { + value, + model, + isInvalid, + }, + } + : range + ) + ); + }, + [models, updateValues, validateClass] + ); + const onDelete = useCallback( + (id: string) => updateValues(models.filter(model => model.id !== id)), + [models, updateValues] + ); + const onAdd = useCallback( + () => + updateValues([ + ...models, + { + id: generateId(), + ...getModelValue(), + } as InputModel, + ]), + [getModelValue, models, updateValues] ); - const onChangeValue = (index: number, value: string, modelName: string) => { - const { model, isInvalid } = validateValue(value, config); - updateValues( - models.map((range, arrayIndex) => - arrayIndex === index - ? { - ...range, - [modelName]: { - value, - model, - isInvalid, - }, - } - : range - ) - ); - }; - const onDelete = (id: string) => updateValues(models.filter(model => model.id !== id)); - const onAdd = () => - updateValues([ - ...models, - { - id: generateId(), - ...config.getModelValue(), - } as InputModel, - ]); useEffect(() => { // resposible for setting up an initial value when there is no default value @@ -142,11 +154,11 @@ function InputList({ config, list, onChange, setValidity }: InputListProps) { updateValues([ { id: generateId(), - ...config.defaultValue, + ...defaultValue, } as InputModel, ]); } - }, [config.defaultValue, list.length, updateValues]); + }, [defaultValue, list.length, updateValues]); useEffect(() => { setValidity(!hasInvalidValues); @@ -158,7 +170,7 @@ function InputList({ config, list, onChange, setValidity }: InputListProps) { list.length !== models.length || list.some((item, index) => { // make model to be the same shape as stored value - const model: InputObject = mapValues(pick(models[index], config.modelNames), 'model'); + const model: InputObject = mapValues(pick(models[index], modelNames), 'model'); // we need to skip empty values since they are not stored in saved object return !isEqual(item, omit(model, isEmpty)); @@ -169,12 +181,12 @@ function InputList({ config, list, onChange, setValidity }: InputListProps) { item => ({ id: generateId(), - ...config.getModelValue(item), + ...getModelValue(item), } as InputModel) ) ); } - }, [config, list, models]); + }, [getModelValue, list, modelNames, models]); return ( <> diff --git a/src/plugins/vis_default_editor/public/components/controls/components/mask_list.tsx b/src/plugins/vis_default_editor/public/components/controls/components/mask_list.tsx index 930b614d0d919..560213fc08ff0 100644 --- a/src/plugins/vis_default_editor/public/components/controls/components/mask_list.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/components/mask_list.tsx @@ -17,7 +17,7 @@ * under the License. */ -import React from 'react'; +import React, { useCallback } from 'react'; import { EuiFieldText, EuiFlexItem } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; @@ -42,36 +42,40 @@ interface MaskListProps { setValidity(isValid: boolean): void; } -function MaskList({ showValidation, onBlur, ...rest }: MaskListProps) { - const maskListConfig: InputListConfig = { - defaultValue: { - mask: { model: '0.0.0.0/1', value: '0.0.0.0/1', isInvalid: false }, +const defaultConfig = { + defaultValue: { + mask: { model: '0.0.0.0/1', value: '0.0.0.0/1', isInvalid: false }, + }, + validateClass: search.aggs.CidrMask, + getModelValue: (item: MaskObject = {}) => ({ + mask: { + model: item.mask || EMPTY_STRING, + value: item.mask || EMPTY_STRING, + isInvalid: false, }, - validateClass: search.aggs.CidrMask, - getModelValue: (item: MaskObject = {}) => ({ - mask: { - model: item.mask || EMPTY_STRING, - value: item.mask || EMPTY_STRING, - isInvalid: false, - }, - }), - getRemoveBtnAriaLabel: (item: MaskModel) => - item.mask.value - ? i18n.translate('visDefaultEditor.controls.ipRanges.removeCidrMaskButtonAriaLabel', { - defaultMessage: 'Remove the CIDR mask value of {mask}', - values: { mask: item.mask.value }, - }) - : i18n.translate('visDefaultEditor.controls.ipRanges.removeEmptyCidrMaskButtonAriaLabel', { - defaultMessage: 'Remove the CIDR mask default value', - }), - onChangeFn: ({ mask }: MaskModel) => { - if (mask.model) { - return { mask: mask.model }; - } - return {}; - }, - hasInvalidValuesFn: ({ mask }) => mask.isInvalid, - renderInputRow: ({ mask }: MaskModel, index, onChangeValue) => ( + }), + getRemoveBtnAriaLabel: (item: MaskModel) => + item.mask.value + ? i18n.translate('visDefaultEditor.controls.ipRanges.removeCidrMaskButtonAriaLabel', { + defaultMessage: 'Remove the CIDR mask value of {mask}', + values: { mask: item.mask.value }, + }) + : i18n.translate('visDefaultEditor.controls.ipRanges.removeEmptyCidrMaskButtonAriaLabel', { + defaultMessage: 'Remove the CIDR mask default value', + }), + onChangeFn: ({ mask }: MaskModel) => { + if (mask.model) { + return { mask: mask.model }; + } + return {}; + }, + hasInvalidValuesFn: ({ mask }: MaskModel) => mask.isInvalid, + modelNames: 'mask', +}; + +function MaskList({ showValidation, onBlur, ...rest }: MaskListProps) { + const renderInputRow = useCallback( + ({ mask }: MaskModel, index, onChangeValue) => ( ), - modelNames: 'mask', + [onBlur, showValidation] + ); + const maskListConfig: InputListConfig = { + ...defaultConfig, + renderInputRow, }; return ; diff --git a/src/plugins/vis_default_editor/public/components/controls/ip_ranges.tsx b/src/plugins/vis_default_editor/public/components/controls/ip_ranges.tsx index c4b90649aaaae..5ffa8088a9546 100644 --- a/src/plugins/vis_default_editor/public/components/controls/ip_ranges.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/ip_ranges.tsx @@ -17,7 +17,7 @@ * under the License. */ -import React from 'react'; +import React, { useCallback } from 'react'; import { EuiFormRow } from '@elastic/eui'; import { FromToList, FromToObject } from './components/from_to_list'; @@ -38,12 +38,22 @@ function IpRangesParamEditor({ setValidity, showValidation, }: AggParamEditorProps) { - const handleChange = (modelName: IpRangeTypes, items: Array) => { - setValue({ - ...value, - [modelName]: items, - }); - }; + const handleMaskListChange = useCallback( + (items: MaskObject[]) => + setValue({ + ...value, + [IpRangeTypes.MASK]: items, + }), + [setValue, value] + ); + const handleFromToListChange = useCallback( + (items: FromToObject[]) => + setValue({ + ...value, + [IpRangeTypes.FROM_TO]: items, + }), + [setValue, value] + ); return ( @@ -52,7 +62,7 @@ function IpRangesParamEditor({ list={value.mask} showValidation={showValidation} onBlur={setTouched} - onChange={items => handleChange(IpRangeTypes.MASK, items)} + onChange={handleMaskListChange} setValidity={setValidity} /> ) : ( @@ -60,7 +70,7 @@ function IpRangesParamEditor({ list={value.fromTo} showValidation={showValidation} onBlur={setTouched} - onChange={items => handleChange(IpRangeTypes.FROM_TO, items)} + onChange={handleFromToListChange} setValidity={setValidity} /> )} From ccdf5a72500d6a2a8f08c2bfc7b5666c65dcd15e Mon Sep 17 00:00:00 2001 From: sulemanof Date: Mon, 6 Apr 2020 13:53:03 +0300 Subject: [PATCH 06/15] Fix filters and extend bounds --- .../public/components/controls/filters.tsx | 12 +++++++++--- .../components/controls/has_extended_bounds.tsx | 14 +++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/plugins/vis_default_editor/public/components/controls/filters.tsx b/src/plugins/vis_default_editor/public/components/controls/filters.tsx index 44ff14983cbd2..3d18f959eabe5 100644 --- a/src/plugins/vis_default_editor/public/components/controls/filters.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/filters.tsx @@ -17,7 +17,7 @@ * under the License. */ -import React, { useState, useEffect } from 'react'; +import React, { useState, useEffect, useRef } from 'react'; import { omit, isEqual } from 'lodash'; import { htmlIdGenerator, EuiButton, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; @@ -40,9 +40,15 @@ function FiltersParamEditor({ agg, value = [], setValue }: AggParamEditorProps ({ ...filter, id: generateId() })) ); + const firstRender = useRef(true); + useEffect(() => { - // set parsed values into model after initialization - setValue(filters.map(filter => omit({ ...filter, input: filter.input }, 'id'))); + if (firstRender.current) { + // set parsed values into model after initialization + firstRender.current = false; + + setValue(filters.map(filter => omit({ ...filter, input: filter.input }, 'id'))); + } }, [filters, setValue]); useEffect(() => { diff --git a/src/plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx b/src/plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx index 0cfcf43e96136..a316a087c8bcb 100644 --- a/src/plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/has_extended_bounds.tsx @@ -17,7 +17,7 @@ * under the License. */ -import React, { useEffect } from 'react'; +import React, { useEffect, useRef } from 'react'; import { i18n } from '@kbn/i18n'; import { search } from '../../../../data/public'; @@ -28,12 +28,21 @@ const { isType } = search.aggs; function HasExtendedBoundsParamEditor(props: AggParamEditorProps) { const { agg, setValue, value } = props; + const minDocCount = useRef(agg.params.min_doc_count); + useEffect(() => { - setValue(value && agg.params.min_doc_count); + if (minDocCount.current !== agg.params.min_doc_count) { + // The "Extend bounds" param is only enabled when "Show empty buckets" is turned on. + // So if "Show empty buckets" is changed, "Extend bounds" should reflect changes + minDocCount.current = agg.params.min_doc_count; + + setValue(value && agg.params.min_doc_count); + } }, [agg.params.min_doc_count, setValue, value]); return ( ) { !props.agg.params.min_doc_count || !(isType('number')(props.agg) || isType('date')(props.agg)) } - {...props} /> ); } From 90fe035217c4c4283d30c8b2bf07c2091f7099f5 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Mon, 6 Apr 2020 16:02:34 +0300 Subject: [PATCH 07/15] Other fixes --- .../public/components/controls/missing_bucket.tsx | 2 +- .../public/components/controls/order_by.tsx | 6 ++++-- .../public/components/controls/radius_ratio_option.tsx | 6 ++++-- .../public/components/controls/sub_agg.tsx | 3 +-- .../public/components/controls/sub_metric.tsx | 9 ++++++++- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/plugins/vis_default_editor/public/components/controls/missing_bucket.tsx b/src/plugins/vis_default_editor/public/components/controls/missing_bucket.tsx index d35ff7492876d..7d4d2230bd766 100644 --- a/src/plugins/vis_default_editor/public/components/controls/missing_bucket.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/missing_bucket.tsx @@ -36,6 +36,7 @@ function MissingBucketParamEditor(props: AggParamEditorProps) { return ( ) { } )} disabled={fieldTypeIsNotString} - {...props} /> ); } diff --git a/src/plugins/vis_default_editor/public/components/controls/order_by.tsx b/src/plugins/vis_default_editor/public/components/controls/order_by.tsx index 1274f2af811d4..6c2a3f1840cc2 100644 --- a/src/plugins/vis_default_editor/public/components/controls/order_by.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/order_by.tsx @@ -17,7 +17,7 @@ * under the License. */ -import React, { useEffect } from 'react'; +import React, { useEffect, useRef } from 'react'; import { EuiFormRow, EuiSelect } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; @@ -56,12 +56,14 @@ function OrderByParamEditor({ defaultMessage: 'Order by', }); const isValid = !!value; + const firstRender = useRef(true); useValidation(setValidity, isValid); useEffect(() => { // setup the initial value of orderBy - if (!value) { + if (firstRender.current && !value) { + firstRender.current = false; let respAgg = { id: DEFAULT_VALUE }; if (metricAggs) { diff --git a/src/plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx b/src/plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx index 8893ff5998fac..7d6b89b775f1c 100644 --- a/src/plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx @@ -17,7 +17,7 @@ * under the License. */ -import React, { useEffect, useCallback } from 'react'; +import React, { useEffect, useCallback, useRef } from 'react'; import { EuiFormRow, EuiIconTip, EuiRange, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; @@ -43,9 +43,11 @@ function RadiusRatioOptionControl({ editorStateParams, setStateParamValue }: Agg /> ); + const firstRender = useRef(true); useEffect(() => { - if (!editorStateParams.radiusRatio) { + if (firstRender.current && !editorStateParams.radiusRatio) { + firstRender.current = false; setStateParamValue(PARAM_NAME, DEFAULT_VALUE); } }, [editorStateParams.radiusRatio, setStateParamValue]); diff --git a/src/plugins/vis_default_editor/public/components/controls/sub_agg.tsx b/src/plugins/vis_default_editor/public/components/controls/sub_agg.tsx index 9a3c786651d7d..ee0fbd8532ce9 100644 --- a/src/plugins/vis_default_editor/public/components/controls/sub_agg.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/sub_agg.tsx @@ -29,7 +29,6 @@ function SubAggParamEditor({ agg, aggParam, formIsTouched, - value, metricAggs, state, setValue, @@ -44,7 +43,7 @@ function SubAggParamEditor({ } else if (!agg.params.customMetric) { setValue(aggParam.makeAgg(agg)); } - }, [value, metricAggs, agg, setValue, aggParam]); + }, [metricAggs, agg, setValue, aggParam]); const { onAggTypeChange, setAggParamValue } = useSubAggParamsHandlers( agg, diff --git a/src/plugins/vis_default_editor/public/components/controls/sub_metric.tsx b/src/plugins/vis_default_editor/public/components/controls/sub_metric.tsx index 5e655a24691e1..9f7c35fbaf0b6 100644 --- a/src/plugins/vis_default_editor/public/components/controls/sub_metric.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/sub_metric.tsx @@ -17,7 +17,7 @@ * under the License. */ -import React, { useEffect } from 'react'; +import React, { useEffect, useRef } from 'react'; import { EuiFormLabel, EuiSpacer } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; @@ -47,8 +47,15 @@ function SubMetricParamEditor({ const aggTitle = type === 'customMetric' ? metricTitle : bucketTitle; const aggGroup = type === 'customMetric' ? AggGroupNames.Metrics : AggGroupNames.Buckets; + const firstRender = useRef(true); useEffect(() => { + if (!firstRender.current) { + return; + } + + firstRender.current = false; + if (agg.params[type]) { setValue(agg.params[type]); } else { From 4de5a19ada7d153d0d3f903eb53663436b4b6fd4 Mon Sep 17 00:00:00 2001 From: sulemanof Date: Mon, 6 Apr 2020 18:54:39 +0300 Subject: [PATCH 08/15] Fix date_ranges tests --- .../public/components/controls/date_ranges.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugins/vis_default_editor/public/components/controls/date_ranges.tsx b/src/plugins/vis_default_editor/public/components/controls/date_ranges.tsx index 561c08f64ff52..541376ad41b41 100644 --- a/src/plugins/vis_default_editor/public/components/controls/date_ranges.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/date_ranges.tsx @@ -17,7 +17,7 @@ * under the License. */ -import React, { Fragment, useState, useEffect, useCallback } from 'react'; +import React, { Fragment, useState, useEffect, useCallback, useRef } from 'react'; import { htmlIdGenerator, EuiButtonIcon, @@ -67,6 +67,7 @@ function DateRangesParamEditor({ setValidity, }: AggParamEditorProps) { const { services } = useKibana(); + const firstRender = useRef(true); const [ranges, setRanges] = useState(() => value.map(range => ({ ...range, id: generateId() }))); const hasInvalidRange = value.some( ({ from, to }) => (!from && !to) || !validateDateMath(from) || !validateDateMath(to) @@ -88,7 +89,8 @@ function DateRangesParamEditor({ // set up an initial range when there is no default range useEffect(() => { - if (!value.length) { + if (firstRender.current && !value.length) { + firstRender.current = false; onAddRange(); } }, [onAddRange, value.length]); From 02c42b582adf834f13389a814c7ff4ffab0fb063 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Tue, 7 Apr 2020 17:50:53 +0200 Subject: [PATCH 09/15] move timelion vis to the new platform --- .eslintignore | 4 +- .i18nrc.json | 2 +- .../core_plugins/timelion/public/app.js | 2 +- .../directives/timelion_expression_input.js | 6 +-- .../public/panels/timechart/schema.ts | 14 ++++-- .../core_plugins/vis_type_timelion/index.ts | 44 ----------------- .../vis_type_timelion/package.json | 4 -- .../public/components/_index.scss | 2 - .../vis_type_timelion/public/index.scss | 5 -- .../vis_type_timelion/public/legacy.ts | 35 -------------- .../public/legacy_imports.ts | 21 -------- .../ui/public/new_platform/new_platform.ts | 2 + src/plugins/timelion/kibana.json | 8 ---- src/plugins/timelion/public/index.ts | 30 ------------ .../vis_type_timelion/README.md | 0 .../common/chain.peg | 0 .../common/lib/calculate_interval.test.ts | 0 .../common/lib/calculate_interval.ts | 0 .../common/lib/index.ts | 0 .../common/lib/to_milliseconds.ts | 0 .../common/types.ts | 0 .../{timelion => vis_type_timelion}/config.ts | 0 src/plugins/vis_type_timelion/kibana.json | 8 ++++ .../public/_generated_/chain.js | 0 .../public/_timelion_editor.scss | 0 .../public/_timelion_vis.scss | 0 .../public/components/_index.scss | 2 + .../public/components/_panel.scss | 0 .../_timelion_expression_input.scss | 0 .../public/components/chart.tsx | 0 .../public/components/index.ts | 0 .../public/components/panel.tsx | 4 +- .../components/timelion_expression_input.tsx | 7 +-- .../timelion_expression_input_helpers.test.ts | 2 +- .../timelion_expression_input_helpers.ts | 5 +- .../public/components/timelion_interval.tsx | 4 +- .../public/components/timelion_vis.tsx | 2 +- .../vis_type_timelion/public/flot.js | 14 +++--- .../public/helpers/arg_value_suggestions.ts | 7 +-- .../public/helpers/get_timezone.ts | 0 .../public/helpers/panel_utils.ts | 2 +- .../public/helpers/plugin_services.ts | 2 +- .../public/helpers/tick_formatters.test.ts | 0 .../public/helpers/tick_formatters.ts | 0 .../public/helpers/tick_generator.test.ts | 0 .../public/helpers/tick_generator.ts | 0 .../helpers/timelion_request_handler.ts | 4 +- .../public/helpers/xaxis_formatter.ts | 0 .../vis_type_timelion/public/index.scss | 11 +++++ .../vis_type_timelion/public/index.ts | 4 +- .../vis_type_timelion/public/plugin.ts | 47 ++++++++++++++---- .../public/timelion_options.tsx | 48 ++++++++++++------- .../public/timelion_vis_fn.ts | 0 .../public/timelion_vis_type.tsx | 6 +-- .../webpackShims/jquery.flot.axislabels.js | 0 .../webpackShims/jquery.flot.crosshair.js | 0 .../public/webpackShims/jquery.flot.js | 0 .../webpackShims/jquery.flot.selection.js | 0 .../public/webpackShims/jquery.flot.stack.js | 0 .../public/webpackShims/jquery.flot.symbol.js | 0 .../public/webpackShims/jquery.flot.time.js | 0 .../server/fit_functions/average.js | 0 .../server/fit_functions/average.test.js | 0 .../server/fit_functions/carry.js | 0 .../server/fit_functions/carry.test.js | 0 .../server/fit_functions/nearest.js | 0 .../server/fit_functions/none.js | 0 .../server/fit_functions/scale.js | 0 .../server/handlers/chain_runner.js | 0 .../server/handlers/lib/arg_type.js | 0 .../server/handlers/lib/index_arguments.js | 0 .../server/handlers/lib/parse_sheet.js | 0 .../server/handlers/lib/parse_sheet.test.js | 0 .../server/handlers/lib/preprocess_chain.js | 0 .../handlers/lib/reposition_arguments.js | 0 .../server/handlers/lib/tl_config.js | 0 .../server/handlers/lib/validate_arg.js | 0 .../server/handlers/lib/validate_time.js | 0 .../server/index.ts | 16 ++++--- .../server/lib/alter.js | 0 .../server/lib/as_sorted.js | 0 .../server/lib/build_target.js | 0 .../server/lib/classes/chainable.js | 0 .../server/lib/classes/datasource.js | 0 .../server/lib/classes/timelion_function.d.ts | 0 .../server/lib/classes/timelion_function.js | 0 .../server/lib/config_manager.ts | 0 .../server/lib/functions_md.js | 0 .../server/lib/get_namespaced_settings.js | 0 .../server/lib/load_functions.d.ts | 0 .../server/lib/load_functions.js | 0 .../server/lib/load_functions.test.js | 2 +- .../server/lib/offset_time.js | 0 .../server/lib/offset_time.test.js | 0 .../server/lib/process_function_definition.js | 0 .../server/lib/reduce.js | 0 .../server/lib/split_interval.js | 0 .../server/lib/unzip_pairs.js | 0 .../server/plugin.ts | 0 .../server/routes/functions.ts | 0 .../server/routes/run.ts | 0 .../server/routes/validate_es.ts | 0 .../server/series_functions/abs.js | 0 .../server/series_functions/abs.test.js | 0 .../aggregate/aggregate.test.js | 0 .../server/series_functions/aggregate/avg.js | 0 .../series_functions/aggregate/cardinality.js | 0 .../series_functions/aggregate/first.js | 0 .../series_functions/aggregate/index.js | 0 .../server/series_functions/aggregate/last.js | 0 .../server/series_functions/aggregate/max.js | 0 .../server/series_functions/aggregate/min.js | 0 .../server/series_functions/aggregate/sum.js | 0 .../server/series_functions/bars.js | 0 .../server/series_functions/bars.test.js | 0 .../server/series_functions/color.js | 0 .../server/series_functions/color.test.js | 0 .../server/series_functions/condition.js | 0 .../server/series_functions/condition.test.js | 0 .../server/series_functions/cusum.js | 0 .../server/series_functions/cusum.test.js | 0 .../server/series_functions/derivative.js | 0 .../series_functions/derivative.test.js | 0 .../server/series_functions/divide.js | 0 .../server/series_functions/divide.test.js | 0 .../server/series_functions/es/es.test.js | 0 .../server/series_functions/es/index.js | 0 .../series_functions/es/lib/agg_body.js | 0 .../es/lib/agg_response_to_series_list.js | 0 .../series_functions/es/lib/build_request.js | 0 .../es/lib/create_date_agg.js | 0 .../server/series_functions/first.js | 0 .../server/series_functions/first.test.js | 0 .../server/series_functions/fit.js | 0 .../server/series_functions/fit.test.js | 2 +- .../series_functions/fixtures/bucket_list.js | 0 .../series_functions/fixtures/es_response.js | 0 .../series_functions/fixtures/series_list.js | 0 .../series_functions/fixtures/tl_config.js | 0 .../server/series_functions/graphite.js | 0 .../server/series_functions/graphite.test.js | 0 .../series_functions/helpers/get_series.js | 0 .../helpers/get_series_list.js | 0 .../helpers/get_single_series_list.js | 0 .../helpers/invoke_series_fn.js | 0 .../server/series_functions/hide.js | 0 .../server/series_functions/hide.test.js | 0 .../server/series_functions/holt/index.js | 0 .../server/series_functions/holt/lib/des.js | 0 .../server/series_functions/holt/lib/ses.js | 0 .../server/series_functions/holt/lib/tes.js | 0 .../server/series_functions/label.js | 0 .../server/series_functions/label.test.js | 0 .../server/series_functions/legend.js | 0 .../server/series_functions/legend.test.js | 0 .../server/series_functions/lines.js | 0 .../server/series_functions/lines.test.js | 0 .../server/series_functions/log.js | 0 .../server/series_functions/log.test.js | 0 .../server/series_functions/max.js | 0 .../server/series_functions/max.test.js | 0 .../server/series_functions/min.js | 0 .../server/series_functions/min.test.js | 0 .../server/series_functions/movingaverage.js | 0 .../series_functions/movingaverage.test.js | 0 .../server/series_functions/movingstd.js | 0 .../server/series_functions/movingstd.test.js | 0 .../server/series_functions/multiply.js | 0 .../server/series_functions/multiply.test.js | 0 .../server/series_functions/points.js | 0 .../server/series_functions/points.test.js | 0 .../server/series_functions/precision.js | 0 .../server/series_functions/precision.test.js | 0 .../server/series_functions/props.js | 0 .../server/series_functions/quandl.js | 0 .../server/series_functions/quandl.test.js | 0 .../server/series_functions/range.js | 0 .../server/series_functions/range.test.js | 0 .../server/series_functions/scale_interval.js | 0 .../series_functions/scale_interval.test.js | 0 .../server/series_functions/static.js | 0 .../server/series_functions/static.test.js | 0 .../server/series_functions/subtract.js | 0 .../server/series_functions/subtract.test.js | 0 .../server/series_functions/sum.js | 0 .../server/series_functions/sum.test.js | 0 .../server/series_functions/title.js | 0 .../server/series_functions/title.test.js | 0 .../server/series_functions/trend/index.js | 0 .../series_functions/trend/lib/regress.js | 0 .../server/series_functions/trim.js | 0 .../server/series_functions/trim.test.js | 0 .../server/series_functions/worldbank.js | 0 .../series_functions/worldbank_indicators.js | 0 .../server/series_functions/yaxis.js | 0 .../server/series_functions/yaxis.test.js | 0 .../server/timelion.json | 0 .../server/types.ts | 0 tasks/config/peg.js | 4 +- x-pack/plugins/features/kibana.json | 2 +- x-pack/plugins/features/server/plugin.ts | 6 +-- 201 files changed, 153 insertions(+), 237 deletions(-) delete mode 100644 src/legacy/core_plugins/vis_type_timelion/index.ts delete mode 100644 src/legacy/core_plugins/vis_type_timelion/package.json delete mode 100644 src/legacy/core_plugins/vis_type_timelion/public/components/_index.scss delete mode 100644 src/legacy/core_plugins/vis_type_timelion/public/index.scss delete mode 100644 src/legacy/core_plugins/vis_type_timelion/public/legacy.ts delete mode 100644 src/legacy/core_plugins/vis_type_timelion/public/legacy_imports.ts delete mode 100644 src/plugins/timelion/kibana.json delete mode 100644 src/plugins/timelion/public/index.ts rename src/{legacy/core_plugins => plugins}/vis_type_timelion/README.md (100%) rename src/plugins/{timelion => vis_type_timelion}/common/chain.peg (100%) rename src/plugins/{timelion => vis_type_timelion}/common/lib/calculate_interval.test.ts (100%) rename src/plugins/{timelion => vis_type_timelion}/common/lib/calculate_interval.ts (100%) rename src/plugins/{timelion => vis_type_timelion}/common/lib/index.ts (100%) rename src/plugins/{timelion => vis_type_timelion}/common/lib/to_milliseconds.ts (100%) rename src/plugins/{timelion => vis_type_timelion}/common/types.ts (100%) rename src/plugins/{timelion => vis_type_timelion}/config.ts (100%) create mode 100644 src/plugins/vis_type_timelion/kibana.json rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/_generated_/chain.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/_timelion_editor.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/_timelion_vis.scss (100%) create mode 100644 src/plugins/vis_type_timelion/public/components/_index.scss rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/components/_panel.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/components/_timelion_expression_input.scss (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/components/chart.tsx (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/components/index.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/components/panel.tsx (98%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/components/timelion_expression_input.tsx (96%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/components/timelion_expression_input_helpers.test.ts (99%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/components/timelion_expression_input_helpers.ts (98%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/components/timelion_interval.tsx (96%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/components/timelion_vis.tsx (95%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/flot.js (72%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/helpers/arg_value_suggestions.ts (97%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/helpers/get_timezone.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/helpers/panel_utils.ts (98%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/helpers/plugin_services.ts (93%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/helpers/tick_formatters.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/helpers/tick_formatters.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/helpers/tick_generator.test.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/helpers/tick_generator.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/helpers/timelion_request_handler.ts (95%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/helpers/xaxis_formatter.ts (100%) create mode 100644 src/plugins/vis_type_timelion/public/index.scss rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/index.ts (90%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/plugin.ts (67%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/timelion_options.tsx (51%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/timelion_vis_fn.ts (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/timelion_vis_type.tsx (91%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/webpackShims/jquery.flot.axislabels.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/webpackShims/jquery.flot.crosshair.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/webpackShims/jquery.flot.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/webpackShims/jquery.flot.selection.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/webpackShims/jquery.flot.stack.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/webpackShims/jquery.flot.symbol.js (100%) rename src/{legacy/core_plugins => plugins}/vis_type_timelion/public/webpackShims/jquery.flot.time.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/fit_functions/average.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/fit_functions/average.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/fit_functions/carry.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/fit_functions/carry.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/fit_functions/nearest.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/fit_functions/none.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/fit_functions/scale.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/handlers/chain_runner.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/handlers/lib/arg_type.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/handlers/lib/index_arguments.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/handlers/lib/parse_sheet.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/handlers/lib/parse_sheet.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/handlers/lib/preprocess_chain.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/handlers/lib/reposition_arguments.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/handlers/lib/tl_config.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/handlers/lib/validate_arg.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/handlers/lib/validate_time.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/index.ts (64%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/alter.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/as_sorted.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/build_target.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/classes/chainable.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/classes/datasource.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/classes/timelion_function.d.ts (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/classes/timelion_function.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/config_manager.ts (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/functions_md.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/get_namespaced_settings.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/load_functions.d.ts (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/load_functions.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/load_functions.test.js (95%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/offset_time.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/offset_time.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/process_function_definition.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/reduce.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/split_interval.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/lib/unzip_pairs.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/plugin.ts (100%) rename src/plugins/{timelion => vis_type_timelion}/server/routes/functions.ts (100%) rename src/plugins/{timelion => vis_type_timelion}/server/routes/run.ts (100%) rename src/plugins/{timelion => vis_type_timelion}/server/routes/validate_es.ts (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/abs.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/abs.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/aggregate/aggregate.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/aggregate/avg.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/aggregate/cardinality.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/aggregate/first.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/aggregate/index.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/aggregate/last.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/aggregate/max.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/aggregate/min.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/aggregate/sum.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/bars.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/bars.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/color.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/color.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/condition.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/condition.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/cusum.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/cusum.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/derivative.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/derivative.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/divide.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/divide.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/es/es.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/es/index.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/es/lib/agg_body.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/es/lib/agg_response_to_series_list.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/es/lib/build_request.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/es/lib/create_date_agg.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/first.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/first.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/fit.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/fit.test.js (98%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/fixtures/bucket_list.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/fixtures/es_response.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/fixtures/series_list.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/fixtures/tl_config.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/graphite.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/graphite.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/helpers/get_series.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/helpers/get_series_list.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/helpers/get_single_series_list.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/helpers/invoke_series_fn.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/hide.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/hide.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/holt/index.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/holt/lib/des.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/holt/lib/ses.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/holt/lib/tes.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/label.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/label.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/legend.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/legend.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/lines.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/lines.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/log.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/log.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/max.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/max.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/min.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/min.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/movingaverage.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/movingaverage.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/movingstd.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/movingstd.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/multiply.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/multiply.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/points.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/points.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/precision.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/precision.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/props.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/quandl.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/quandl.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/range.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/range.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/scale_interval.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/scale_interval.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/static.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/static.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/subtract.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/subtract.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/sum.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/sum.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/title.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/title.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/trend/index.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/trend/lib/regress.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/trim.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/trim.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/worldbank.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/worldbank_indicators.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/yaxis.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/series_functions/yaxis.test.js (100%) rename src/plugins/{timelion => vis_type_timelion}/server/timelion.json (100%) rename src/plugins/{timelion => vis_type_timelion}/server/types.ts (100%) diff --git a/.eslintignore b/.eslintignore index 357d735e8044b..1f22b6074e76e 100644 --- a/.eslintignore +++ b/.eslintignore @@ -9,14 +9,14 @@ bower_components /built_assets /html_docs /src/plugins/data/common/es_query/kuery/ast/_generated_/** -/src/legacy/core_plugins/vis_type_timelion/public/_generated_/** +/src/plugins/vis_type_timelion/public/_generated_/** src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/lib/fixtures/mock_data /src/legacy/ui/public/flot-charts /test/fixtures/scenarios /src/legacy/core_plugins/console/public/webpackShims /src/legacy/core_plugins/console/public/tests/webpackShims /src/legacy/ui/public/utils/decode_geo_hash.js -/src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.* +/src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.* /src/core/lib/kbn_internal_native_observable /packages/*/target /packages/eslint-config-kibana diff --git a/.i18nrc.json b/.i18nrc.json index 3b0b40b40792e..f88fe5d27953f 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -41,7 +41,7 @@ "src/plugins/telemetry_management_section" ], "tileMap": "src/legacy/core_plugins/tile_map", - "timelion": ["src/legacy/core_plugins/timelion", "src/legacy/core_plugins/vis_type_timelion", "src/plugins/timelion"], + "timelion": ["src/legacy/core_plugins/timelion", "src/plugins/vis_type_timelion"], "uiActions": "src/plugins/ui_actions", "visDefaultEditor": "src/plugins/vis_default_editor", "visTypeMarkdown": "src/legacy/core_plugins/vis_type_markdown", diff --git a/src/legacy/core_plugins/timelion/public/app.js b/src/legacy/core_plugins/timelion/public/app.js index c15318d29e761..9cfa6a858ac88 100644 --- a/src/legacy/core_plugins/timelion/public/app.js +++ b/src/legacy/core_plugins/timelion/public/app.js @@ -27,7 +27,7 @@ import { fatalError, toastNotifications } from 'ui/notify'; import { timefilter } from 'ui/timefilter'; import { npStart } from 'ui/new_platform'; import { getSavedSheetBreadcrumbs, getCreateBreadcrumbs } from './breadcrumbs'; -import { getTimezone } from '../../vis_type_timelion/public'; +import { getTimezone } from '../../../../plugins/vis_type_timelion/public'; import 'uiExports/savedObjectTypes'; diff --git a/src/legacy/core_plugins/timelion/public/directives/timelion_expression_input.js b/src/legacy/core_plugins/timelion/public/directives/timelion_expression_input.js index 57262fda55e48..35ac883e5d99c 100644 --- a/src/legacy/core_plugins/timelion/public/directives/timelion_expression_input.js +++ b/src/legacy/core_plugins/timelion/public/directives/timelion_expression_input.js @@ -43,7 +43,7 @@ import _ from 'lodash'; import $ from 'jquery'; import PEG from 'pegjs'; -import grammar from 'raw-loader!../../../../../plugins/timelion/common/chain.peg'; +import grammar from 'raw-loader!../../../../../plugins/vis_type_timelion/common/chain.peg'; import timelionExpressionInputTemplate from './timelion_expression_input.html'; import { SUGGESTION_TYPE, @@ -52,7 +52,7 @@ import { insertAtLocation, } from './timelion_expression_input_helpers'; import { comboBoxKeyCodes } from '@elastic/eui'; -import { getArgValueSuggestions } from '../../../vis_type_timelion/public/helpers/arg_value_suggestions'; +import { npStart } from 'ui/new_platform'; const Parser = PEG.generate(grammar); @@ -68,7 +68,7 @@ export function TimelionExpInput($http, $timeout) { replace: true, template: timelionExpressionInputTemplate, link: function(scope, elem) { - const argValueSuggestions = getArgValueSuggestions(); + const argValueSuggestions = npStart.plugins.visTypeTimelion.getArgValueSuggestions(); const expressionInput = elem.find('[data-expression-input]'); const functionReference = {}; let suggestibleFunctionLocation = {}; diff --git a/src/legacy/core_plugins/timelion/public/panels/timechart/schema.ts b/src/legacy/core_plugins/timelion/public/panels/timechart/schema.ts index cd40cbfa89ffe..34b389f5ff4ce 100644 --- a/src/legacy/core_plugins/timelion/public/panels/timechart/schema.ts +++ b/src/legacy/core_plugins/timelion/public/panels/timechart/schema.ts @@ -17,7 +17,8 @@ * under the License. */ -import '../../../../vis_type_timelion/public/flot'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import '../../../../../../plugins/vis_type_timelion/public/flot'; import _ from 'lodash'; import $ from 'jquery'; import moment from 'moment-timezone'; @@ -28,11 +29,14 @@ import { calculateInterval, DEFAULT_TIME_FORMAT, // @ts-ignore -} from '../../../../../../plugins/timelion/common/lib'; -import { tickFormatters } from '../../../../vis_type_timelion/public/helpers/tick_formatters'; +} from '../../../../../../plugins/vis_type_timelion/common/lib'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { tickFormatters } from '../../../../../../plugins/vis_type_timelion/public/helpers/tick_formatters'; import { TimelionVisualizationDependencies } from '../../plugin'; -import { xaxisFormatterProvider } from '../../../../vis_type_timelion/public/helpers/xaxis_formatter'; -import { generateTicksProvider } from '../../../../vis_type_timelion/public/helpers/tick_generator'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { xaxisFormatterProvider } from '../../../../../../plugins/vis_type_timelion/public/helpers/xaxis_formatter'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { generateTicksProvider } from '../../../../../../plugins/vis_type_timelion/public/helpers/tick_generator'; const DEBOUNCE_DELAY = 50; diff --git a/src/legacy/core_plugins/vis_type_timelion/index.ts b/src/legacy/core_plugins/vis_type_timelion/index.ts deleted file mode 100644 index 7bca5154c84fd..0000000000000 --- a/src/legacy/core_plugins/vis_type_timelion/index.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { resolve } from 'path'; -import { Legacy } from 'kibana'; - -import { LegacyPluginApi, LegacyPluginInitializer } from '../../../../src/legacy/types'; - -const timelionVisPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) => - new Plugin({ - id: 'timelion_vis', - require: ['kibana', 'elasticsearch'], - publicDir: resolve(__dirname, 'public'), - uiExports: { - styleSheetPaths: resolve(__dirname, 'public/index.scss'), - hacks: [resolve(__dirname, 'public/legacy')], - injectDefaultVars: server => ({}), - }, - init: (server: Legacy.Server) => ({}), - config(Joi: any) { - return Joi.object({ - enabled: Joi.boolean().default(true), - }).default(); - }, - }); - -// eslint-disable-next-line import/no-default-export -export default timelionVisPluginInitializer; diff --git a/src/legacy/core_plugins/vis_type_timelion/package.json b/src/legacy/core_plugins/vis_type_timelion/package.json deleted file mode 100644 index 9b09f98ce6caf..0000000000000 --- a/src/legacy/core_plugins/vis_type_timelion/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "timelion_vis", - "version": "kibana" -} diff --git a/src/legacy/core_plugins/vis_type_timelion/public/components/_index.scss b/src/legacy/core_plugins/vis_type_timelion/public/components/_index.scss deleted file mode 100644 index 1d887f43ff9a1..0000000000000 --- a/src/legacy/core_plugins/vis_type_timelion/public/components/_index.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import './panel'; -@import './timelion_expression_input'; diff --git a/src/legacy/core_plugins/vis_type_timelion/public/index.scss b/src/legacy/core_plugins/vis_type_timelion/public/index.scss deleted file mode 100644 index 313f14a8acf69..0000000000000 --- a/src/legacy/core_plugins/vis_type_timelion/public/index.scss +++ /dev/null @@ -1,5 +0,0 @@ -@import 'src/legacy/ui/public/styles/styling_constants'; - -@import './timelion_vis'; -@import './timelion_editor'; -@import './components/index'; diff --git a/src/legacy/core_plugins/vis_type_timelion/public/legacy.ts b/src/legacy/core_plugins/vis_type_timelion/public/legacy.ts deleted file mode 100644 index f8de9f94dcedf..0000000000000 --- a/src/legacy/core_plugins/vis_type_timelion/public/legacy.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { PluginInitializerContext } from 'kibana/public'; - -import { npSetup, npStart } from './legacy_imports'; -import { TimelionVisSetupDependencies } from './plugin'; -import { plugin } from '.'; - -const setupPlugins: Readonly = { - expressions: npSetup.plugins.expressions, - data: npSetup.plugins.data, - visualizations: npSetup.plugins.visualizations, -}; - -const pluginInstance = plugin({} as PluginInitializerContext); - -export const setup = pluginInstance.setup(npSetup.core, setupPlugins); -export const start = pluginInstance.start(npStart.core, npStart.plugins); diff --git a/src/legacy/core_plugins/vis_type_timelion/public/legacy_imports.ts b/src/legacy/core_plugins/vis_type_timelion/public/legacy_imports.ts deleted file mode 100644 index e7612b288fb24..0000000000000 --- a/src/legacy/core_plugins/vis_type_timelion/public/legacy_imports.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -export { npSetup, npStart } from 'ui/new_platform'; -export { PluginsStart } from 'ui/new_platform/new_platform'; diff --git a/src/legacy/ui/public/new_platform/new_platform.ts b/src/legacy/ui/public/new_platform/new_platform.ts index b4b5099081759..b325f63eca9b5 100644 --- a/src/legacy/ui/public/new_platform/new_platform.ts +++ b/src/legacy/ui/public/new_platform/new_platform.ts @@ -64,6 +64,7 @@ import { VisualizationsSetup, VisualizationsStart, } from '../../../../plugins/visualizations/public'; +import { VisTypeTimelionPluginStart } from '../../../../plugins/vis_type_timelion/public'; export interface PluginsSetup { bfetch: BfetchPublicSetup; @@ -107,6 +108,7 @@ export interface PluginsStart { telemetry?: TelemetryPluginStart; dashboard: DashboardStart; savedObjectsManagement: SavedObjectsManagementPluginStart; + visTypeTimelion: VisTypeTimelionPluginStart; } export const npSetup = { diff --git a/src/plugins/timelion/kibana.json b/src/plugins/timelion/kibana.json deleted file mode 100644 index dddfd6c67e655..0000000000000 --- a/src/plugins/timelion/kibana.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "id": "timelion", - "version": "8.0.0", - "kibanaVersion": "kibana", - "configPath": ["timelion"], - "server": true, - "ui": true -} diff --git a/src/plugins/timelion/public/index.ts b/src/plugins/timelion/public/index.ts deleted file mode 100644 index b05c4f8a30b22..0000000000000 --- a/src/plugins/timelion/public/index.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import { CoreStart, PluginInitializerContext } from 'kibana/public'; -import { ConfigSchema } from '../config'; - -export const plugin = (initializerContext: PluginInitializerContext) => ({ - setup() {}, - start(core: CoreStart) { - if (initializerContext.config.get().ui.enabled === false) { - core.chrome.navLinks.update('timelion', { hidden: true }); - } - }, -}); diff --git a/src/legacy/core_plugins/vis_type_timelion/README.md b/src/plugins/vis_type_timelion/README.md similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/README.md rename to src/plugins/vis_type_timelion/README.md diff --git a/src/plugins/timelion/common/chain.peg b/src/plugins/vis_type_timelion/common/chain.peg similarity index 100% rename from src/plugins/timelion/common/chain.peg rename to src/plugins/vis_type_timelion/common/chain.peg diff --git a/src/plugins/timelion/common/lib/calculate_interval.test.ts b/src/plugins/vis_type_timelion/common/lib/calculate_interval.test.ts similarity index 100% rename from src/plugins/timelion/common/lib/calculate_interval.test.ts rename to src/plugins/vis_type_timelion/common/lib/calculate_interval.test.ts diff --git a/src/plugins/timelion/common/lib/calculate_interval.ts b/src/plugins/vis_type_timelion/common/lib/calculate_interval.ts similarity index 100% rename from src/plugins/timelion/common/lib/calculate_interval.ts rename to src/plugins/vis_type_timelion/common/lib/calculate_interval.ts diff --git a/src/plugins/timelion/common/lib/index.ts b/src/plugins/vis_type_timelion/common/lib/index.ts similarity index 100% rename from src/plugins/timelion/common/lib/index.ts rename to src/plugins/vis_type_timelion/common/lib/index.ts diff --git a/src/plugins/timelion/common/lib/to_milliseconds.ts b/src/plugins/vis_type_timelion/common/lib/to_milliseconds.ts similarity index 100% rename from src/plugins/timelion/common/lib/to_milliseconds.ts rename to src/plugins/vis_type_timelion/common/lib/to_milliseconds.ts diff --git a/src/plugins/timelion/common/types.ts b/src/plugins/vis_type_timelion/common/types.ts similarity index 100% rename from src/plugins/timelion/common/types.ts rename to src/plugins/vis_type_timelion/common/types.ts diff --git a/src/plugins/timelion/config.ts b/src/plugins/vis_type_timelion/config.ts similarity index 100% rename from src/plugins/timelion/config.ts rename to src/plugins/vis_type_timelion/config.ts diff --git a/src/plugins/vis_type_timelion/kibana.json b/src/plugins/vis_type_timelion/kibana.json new file mode 100644 index 0000000000000..85c282c51a2e7 --- /dev/null +++ b/src/plugins/vis_type_timelion/kibana.json @@ -0,0 +1,8 @@ +{ + "id": "visTypeTimelion", + "version": "8.0.0", + "kibanaVersion": "kibana", + "server": true, + "ui": true, + "requiredPlugins": ["visualizations", "data", "expressions"] +} diff --git a/src/legacy/core_plugins/vis_type_timelion/public/_generated_/chain.js b/src/plugins/vis_type_timelion/public/_generated_/chain.js similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/_generated_/chain.js rename to src/plugins/vis_type_timelion/public/_generated_/chain.js diff --git a/src/legacy/core_plugins/vis_type_timelion/public/_timelion_editor.scss b/src/plugins/vis_type_timelion/public/_timelion_editor.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/_timelion_editor.scss rename to src/plugins/vis_type_timelion/public/_timelion_editor.scss diff --git a/src/legacy/core_plugins/vis_type_timelion/public/_timelion_vis.scss b/src/plugins/vis_type_timelion/public/_timelion_vis.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/_timelion_vis.scss rename to src/plugins/vis_type_timelion/public/_timelion_vis.scss diff --git a/src/plugins/vis_type_timelion/public/components/_index.scss b/src/plugins/vis_type_timelion/public/components/_index.scss new file mode 100644 index 0000000000000..707c9dafebe2b --- /dev/null +++ b/src/plugins/vis_type_timelion/public/components/_index.scss @@ -0,0 +1,2 @@ +@import 'panel'; +@import 'timelion_expression_input'; diff --git a/src/legacy/core_plugins/vis_type_timelion/public/components/_panel.scss b/src/plugins/vis_type_timelion/public/components/_panel.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/components/_panel.scss rename to src/plugins/vis_type_timelion/public/components/_panel.scss diff --git a/src/legacy/core_plugins/vis_type_timelion/public/components/_timelion_expression_input.scss b/src/plugins/vis_type_timelion/public/components/_timelion_expression_input.scss similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/components/_timelion_expression_input.scss rename to src/plugins/vis_type_timelion/public/components/_timelion_expression_input.scss diff --git a/src/legacy/core_plugins/vis_type_timelion/public/components/chart.tsx b/src/plugins/vis_type_timelion/public/components/chart.tsx similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/components/chart.tsx rename to src/plugins/vis_type_timelion/public/components/chart.tsx diff --git a/src/legacy/core_plugins/vis_type_timelion/public/components/index.ts b/src/plugins/vis_type_timelion/public/components/index.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/components/index.ts rename to src/plugins/vis_type_timelion/public/components/index.ts diff --git a/src/legacy/core_plugins/vis_type_timelion/public/components/panel.tsx b/src/plugins/vis_type_timelion/public/components/panel.tsx similarity index 98% rename from src/legacy/core_plugins/vis_type_timelion/public/components/panel.tsx rename to src/plugins/vis_type_timelion/public/components/panel.tsx index 3b42fa7dfcbb8..8f796526e8520 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/components/panel.tsx +++ b/src/plugins/vis_type_timelion/public/components/panel.tsx @@ -22,9 +22,9 @@ import $ from 'jquery'; import moment from 'moment-timezone'; import { debounce, compact, get, each, cloneDeep, last, map } from 'lodash'; -import { useKibana } from '../../../../../plugins/kibana_react/public'; +import { useKibana } from '../../../kibana_react/public'; import '../flot'; -import { DEFAULT_TIME_FORMAT } from '../../../../../plugins/timelion/common/lib'; +import { DEFAULT_TIME_FORMAT } from '../../common/lib'; import { buildSeriesData, diff --git a/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_expression_input.tsx b/src/plugins/vis_type_timelion/public/components/timelion_expression_input.tsx similarity index 96% rename from src/legacy/core_plugins/vis_type_timelion/public/components/timelion_expression_input.tsx rename to src/plugins/vis_type_timelion/public/components/timelion_expression_input.tsx index c317451b8201e..999409ef35063 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_expression_input.tsx +++ b/src/plugins/vis_type_timelion/public/components/timelion_expression_input.tsx @@ -22,13 +22,10 @@ import { EuiFormLabel } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { monaco } from '@kbn/ui-shared-deps/monaco'; -import { CodeEditor, useKibana } from '../../../../../plugins/kibana_react/public'; +import { CodeEditor, useKibana } from '../../../kibana_react/public'; import { suggest, getSuggestion } from './timelion_expression_input_helpers'; import { getArgValueSuggestions } from '../helpers/arg_value_suggestions'; -import { - ITimelionFunction, - TimelionFunctionArgs, -} from '../../../../../plugins/timelion/common/types'; +import { ITimelionFunction, TimelionFunctionArgs } from '../../common/types'; const LANGUAGE_ID = 'timelion_expression'; monaco.languages.register({ id: LANGUAGE_ID }); diff --git a/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.test.ts b/src/plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.test.ts similarity index 99% rename from src/legacy/core_plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.test.ts rename to src/plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.test.ts index 2f99256e2a192..2ff6809d1c83d 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.test.ts +++ b/src/plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.test.ts @@ -22,7 +22,7 @@ import { getArgValueSuggestions } from '../helpers/arg_value_suggestions'; import { setIndexPatterns, setSavedObjectsClient } from '../helpers/plugin_services'; import { IndexPatternsContract } from 'src/plugins/data/public'; import { SavedObjectsClient } from 'kibana/public'; -import { ITimelionFunction } from '../../../../../plugins/timelion/common/types'; +import { ITimelionFunction } from '../../common/types'; describe('Timelion expression suggestions', () => { setIndexPatterns({} as IndexPatternsContract); diff --git a/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.ts b/src/plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.ts similarity index 98% rename from src/legacy/core_plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.ts rename to src/plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.ts index 6f23c864419eb..04cb54306c90e 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.ts +++ b/src/plugins/vis_type_timelion/public/components/timelion_expression_input_helpers.ts @@ -27,10 +27,7 @@ import { Parser } from 'pegjs'; import { parse } from '../_generated_/chain'; import { ArgValueSuggestions, FunctionArg, Location } from '../helpers/arg_value_suggestions'; -import { - ITimelionFunction, - TimelionFunctionArgs, -} from '../../../../../plugins/timelion/common/types'; +import { ITimelionFunction, TimelionFunctionArgs } from '../../common/types'; export enum SUGGESTION_TYPE { ARGUMENTS = 'arguments', diff --git a/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_interval.tsx b/src/plugins/vis_type_timelion/public/components/timelion_interval.tsx similarity index 96% rename from src/legacy/core_plugins/vis_type_timelion/public/components/timelion_interval.tsx rename to src/plugins/vis_type_timelion/public/components/timelion_interval.tsx index 8a8e1b22fb78d..985ecaeaf3e5a 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_interval.tsx +++ b/src/plugins/vis_type_timelion/public/components/timelion_interval.tsx @@ -21,9 +21,9 @@ import React, { useMemo, useCallback } from 'react'; import { EuiFormRow, EuiComboBox, EuiComboBoxOptionOption } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import { search } from '../../../../../plugins/data/public'; +import { search } from '../../../data/public'; const { isValidEsInterval } = search.aggs; -import { useValidation } from '../../../../../plugins/vis_default_editor/public'; +import { useValidation } from '../../../vis_default_editor/public'; const intervalOptions = [ { diff --git a/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_vis.tsx b/src/plugins/vis_type_timelion/public/components/timelion_vis.tsx similarity index 95% rename from src/legacy/core_plugins/vis_type_timelion/public/components/timelion_vis.tsx rename to src/plugins/vis_type_timelion/public/components/timelion_vis.tsx index 0fad0a164bf0b..4bb07fe74ee82 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_vis.tsx +++ b/src/plugins/vis_type_timelion/public/components/timelion_vis.tsx @@ -23,7 +23,7 @@ import { IUiSettingsClient } from 'kibana/public'; import { ChartComponent } from './chart'; import { VisParams } from '../timelion_vis_fn'; import { TimelionSuccessResponse } from '../helpers/timelion_request_handler'; -import { ExprVis } from '../../../../../plugins/visualizations/public'; +import { ExprVis } from '../../../visualizations/public'; export interface TimelionVisComponentProp { config: IUiSettingsClient; diff --git a/src/legacy/core_plugins/vis_type_timelion/public/flot.js b/src/plugins/vis_type_timelion/public/flot.js similarity index 72% rename from src/legacy/core_plugins/vis_type_timelion/public/flot.js rename to src/plugins/vis_type_timelion/public/flot.js index d6ca6d96c34ef..1ccb40c93a3d6 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/flot.js +++ b/src/plugins/vis_type_timelion/public/flot.js @@ -17,10 +17,10 @@ * under the License. */ -require('jquery.flot'); -require('jquery.flot.time'); -require('jquery.flot.symbol'); -require('jquery.flot.crosshair'); -require('jquery.flot.selection'); -require('jquery.flot.stack'); -require('jquery.flot.axislabels'); +import './webpackShims/jquery.flot'; +import './webpackShims/jquery.flot.time'; +import './webpackShims/jquery.flot.symbol'; +import './webpackShims/jquery.flot.crosshair'; +import './webpackShims/jquery.flot.selection'; +import './webpackShims/jquery.flot.stack'; +import './webpackShims/jquery.flot.axislabels'; diff --git a/src/legacy/core_plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts b/src/plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts similarity index 97% rename from src/legacy/core_plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts rename to src/plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts index ea9532964d6fe..76c25b9b9e8de 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts +++ b/src/plugins/vis_type_timelion/public/helpers/arg_value_suggestions.ts @@ -19,11 +19,8 @@ import { get } from 'lodash'; import { getIndexPatterns, getSavedObjectsClient } from './plugin_services'; -import { TimelionFunctionArgs } from '../../../../../plugins/timelion/common/types'; -import { - indexPatterns as indexPatternsUtils, - IndexPatternAttributes, -} from '../../../../../plugins/data/public'; +import { TimelionFunctionArgs } from '../../common/types'; +import { indexPatterns as indexPatternsUtils, IndexPatternAttributes } from '../../../data/public'; export interface Location { min: number; diff --git a/src/legacy/core_plugins/vis_type_timelion/public/helpers/get_timezone.ts b/src/plugins/vis_type_timelion/public/helpers/get_timezone.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/helpers/get_timezone.ts rename to src/plugins/vis_type_timelion/public/helpers/get_timezone.ts diff --git a/src/legacy/core_plugins/vis_type_timelion/public/helpers/panel_utils.ts b/src/plugins/vis_type_timelion/public/helpers/panel_utils.ts similarity index 98% rename from src/legacy/core_plugins/vis_type_timelion/public/helpers/panel_utils.ts rename to src/plugins/vis_type_timelion/public/helpers/panel_utils.ts index f932e5ee4b2f4..db29d9112be8e 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/helpers/panel_utils.ts +++ b/src/plugins/vis_type_timelion/public/helpers/panel_utils.ts @@ -23,7 +23,7 @@ import moment, { Moment } from 'moment-timezone'; import { TimefilterContract } from 'src/plugins/data/public'; import { IUiSettingsClient } from 'kibana/public'; -import { calculateInterval } from '../../../../../plugins/timelion/common/lib'; +import { calculateInterval } from '../../common/lib'; import { xaxisFormatterProvider } from './xaxis_formatter'; import { Series } from './timelion_request_handler'; diff --git a/src/legacy/core_plugins/vis_type_timelion/public/helpers/plugin_services.ts b/src/plugins/vis_type_timelion/public/helpers/plugin_services.ts similarity index 93% rename from src/legacy/core_plugins/vis_type_timelion/public/helpers/plugin_services.ts rename to src/plugins/vis_type_timelion/public/helpers/plugin_services.ts index 5ba4ee5e47983..b055626934eea 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/helpers/plugin_services.ts +++ b/src/plugins/vis_type_timelion/public/helpers/plugin_services.ts @@ -19,7 +19,7 @@ import { IndexPatternsContract } from 'src/plugins/data/public'; import { SavedObjectsClientContract } from 'kibana/public'; -import { createGetterSetter } from '../../../../../plugins/kibana_utils/public'; +import { createGetterSetter } from '../../../kibana_utils/public'; export const [getIndexPatterns, setIndexPatterns] = createGetterSetter( 'IndexPatterns' diff --git a/src/legacy/core_plugins/vis_type_timelion/public/helpers/tick_formatters.test.ts b/src/plugins/vis_type_timelion/public/helpers/tick_formatters.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/helpers/tick_formatters.test.ts rename to src/plugins/vis_type_timelion/public/helpers/tick_formatters.test.ts diff --git a/src/legacy/core_plugins/vis_type_timelion/public/helpers/tick_formatters.ts b/src/plugins/vis_type_timelion/public/helpers/tick_formatters.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/helpers/tick_formatters.ts rename to src/plugins/vis_type_timelion/public/helpers/tick_formatters.ts diff --git a/src/legacy/core_plugins/vis_type_timelion/public/helpers/tick_generator.test.ts b/src/plugins/vis_type_timelion/public/helpers/tick_generator.test.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/helpers/tick_generator.test.ts rename to src/plugins/vis_type_timelion/public/helpers/tick_generator.test.ts diff --git a/src/legacy/core_plugins/vis_type_timelion/public/helpers/tick_generator.ts b/src/plugins/vis_type_timelion/public/helpers/tick_generator.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/helpers/tick_generator.ts rename to src/plugins/vis_type_timelion/public/helpers/tick_generator.ts diff --git a/src/legacy/core_plugins/vis_type_timelion/public/helpers/timelion_request_handler.ts b/src/plugins/vis_type_timelion/public/helpers/timelion_request_handler.ts similarity index 95% rename from src/legacy/core_plugins/vis_type_timelion/public/helpers/timelion_request_handler.ts rename to src/plugins/vis_type_timelion/public/helpers/timelion_request_handler.ts index 61e31420f73ba..a654f7935af5f 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/helpers/timelion_request_handler.ts +++ b/src/plugins/vis_type_timelion/public/helpers/timelion_request_handler.ts @@ -19,8 +19,8 @@ import { i18n } from '@kbn/i18n'; import { KIBANA_CONTEXT_NAME } from 'src/plugins/expressions/public'; -import { VisParams } from '../../../../../plugins/visualizations/public'; -import { TimeRange, Filter, esQuery, Query } from '../../../../../plugins/data/public'; +import { VisParams } from '../../../visualizations/public'; +import { TimeRange, Filter, esQuery, Query } from '../../../data/public'; import { TimelionVisDependencies } from '../plugin'; import { getTimezone } from './get_timezone'; diff --git a/src/legacy/core_plugins/vis_type_timelion/public/helpers/xaxis_formatter.ts b/src/plugins/vis_type_timelion/public/helpers/xaxis_formatter.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/helpers/xaxis_formatter.ts rename to src/plugins/vis_type_timelion/public/helpers/xaxis_formatter.ts diff --git a/src/plugins/vis_type_timelion/public/index.scss b/src/plugins/vis_type_timelion/public/index.scss new file mode 100644 index 0000000000000..70aeabc100128 --- /dev/null +++ b/src/plugins/vis_type_timelion/public/index.scss @@ -0,0 +1,11 @@ +// EUI global scope + +@import '@elastic/eui/src/themes/eui/eui_colors_light'; + +@import '@elastic/eui/src/global_styling/functions/index'; +@import '@elastic/eui/src/global_styling/variables/index'; +@import '@elastic/eui/src/global_styling/mixins/index'; + +@import '../public/timelion_vis'; +@import '../public/timelion_editor'; +@import '../public/components/index'; diff --git a/src/legacy/core_plugins/vis_type_timelion/public/index.ts b/src/plugins/vis_type_timelion/public/index.ts similarity index 90% rename from src/legacy/core_plugins/vis_type_timelion/public/index.ts rename to src/plugins/vis_type_timelion/public/index.ts index 6292e2ad3eb08..0aa5f3a810033 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/index.ts +++ b/src/plugins/vis_type_timelion/public/index.ts @@ -17,7 +17,7 @@ * under the License. */ -import { PluginInitializerContext } from '../../../../core/public'; +import { PluginInitializerContext } from 'kibana/public'; import { TimelionVisPlugin as Plugin } from './plugin'; export function plugin(initializerContext: PluginInitializerContext) { @@ -25,3 +25,5 @@ export function plugin(initializerContext: PluginInitializerContext) { } export { getTimezone } from './helpers/get_timezone'; + +export { VisTypeTimelionPluginStart } from './plugin'; diff --git a/src/legacy/core_plugins/vis_type_timelion/public/plugin.ts b/src/plugins/vis_type_timelion/public/plugin.ts similarity index 67% rename from src/legacy/core_plugins/vis_type_timelion/public/plugin.ts rename to src/plugins/vis_type_timelion/public/plugin.ts index b5aa64db19aa4..060fec04deb3f 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/plugin.ts +++ b/src/plugins/vis_type_timelion/public/plugin.ts @@ -26,16 +26,21 @@ import { HttpSetup, } from 'kibana/public'; import { Plugin as ExpressionsPlugin } from 'src/plugins/expressions/public'; -import { DataPublicPluginSetup, TimefilterContract } from 'src/plugins/data/public'; +import { + DataPublicPluginSetup, + DataPublicPluginStart, + TimefilterContract, +} from 'src/plugins/data/public'; -import { PluginsStart } from './legacy_imports'; -import { VisualizationsSetup } from '../../../../plugins/visualizations/public'; +import { VisualizationsSetup } from '../../visualizations/public'; import { getTimelionVisualizationConfig } from './timelion_vis_fn'; import { getTimelionVisDefinition } from './timelion_vis_type'; import { setIndexPatterns, setSavedObjectsClient } from './helpers/plugin_services'; +import { ConfigSchema } from '../config'; -type TimelionVisCoreSetup = CoreSetup; +import './index.scss'; +import { getArgValueSuggestions } from './helpers/arg_value_suggestions'; /** @internal */ export interface TimelionVisDependencies extends Partial { @@ -52,11 +57,28 @@ export interface TimelionVisSetupDependencies { } /** @internal */ -export class TimelionVisPlugin implements Plugin { - constructor(public initializerContext: PluginInitializerContext) {} +export interface TimelionVisStartDependencies { + data: DataPublicPluginStart; +} + +/** @public */ +export interface VisTypeTimelionPluginStart { + getArgValueSuggestions: typeof getArgValueSuggestions; +} + +/** @internal */ +export class TimelionVisPlugin + implements + Plugin< + void, + VisTypeTimelionPluginStart, + TimelionVisSetupDependencies, + TimelionVisStartDependencies + > { + constructor(public initializerContext: PluginInitializerContext) {} - public async setup( - core: TimelionVisCoreSetup, + public setup( + core: CoreSetup, { expressions, visualizations, data }: TimelionVisSetupDependencies ) { const dependencies: TimelionVisDependencies = { @@ -69,8 +91,15 @@ export class TimelionVisPlugin implements Plugin { visualizations.createReactVisualization(getTimelionVisDefinition(dependencies)); } - public start(core: CoreStart, plugins: PluginsStart) { + public start(core: CoreStart, plugins: TimelionVisStartDependencies) { setIndexPatterns(plugins.data.indexPatterns); setSavedObjectsClient(core.savedObjects.client); + if (this.initializerContext.config.get().ui.enabled === false) { + core.chrome.navLinks.update('timelion', { hidden: true }); + } + + return { + getArgValueSuggestions, + }; } } diff --git a/src/legacy/core_plugins/vis_type_timelion/public/timelion_options.tsx b/src/plugins/vis_type_timelion/public/timelion_options.tsx similarity index 51% rename from src/legacy/core_plugins/vis_type_timelion/public/timelion_options.tsx rename to src/plugins/vis_type_timelion/public/timelion_options.tsx index afffcf7ccaf7a..82e458ba57e88 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/timelion_options.tsx +++ b/src/plugins/vis_type_timelion/public/timelion_options.tsx @@ -19,30 +19,42 @@ import React, { useCallback } from 'react'; import { EuiPanel } from '@elastic/eui'; +import { IUiSettingsClient } from 'kibana/public'; import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { VisParams } from './timelion_vis_fn'; import { TimelionInterval, TimelionExpressionInput } from './components'; +import { KibanaContextProvider } from '../../kibana_react/public'; -function TimelionOptions({ stateParams, setValue, setValidity }: VisOptionsProps) { - const setInterval = useCallback((value: VisParams['interval']) => setValue('interval', value), [ +const TimelionOptions = (uiSettings: IUiSettingsClient) => { + const TimelionOptionsComponent = ({ + stateParams, setValue, - ]); - const setExpressionInput = useCallback( - (value: VisParams['expression']) => setValue('expression', value), - [setValue] - ); + setValidity, + }: VisOptionsProps) => { + const setInterval = useCallback((value: VisParams['interval']) => setValue('interval', value), [ + setValue, + ]); + const setExpressionInput = useCallback( + (value: VisParams['expression']) => setValue('expression', value), + [setValue] + ); - return ( - - - - - ); -} + return ( + + + + + + + ); + }; + + return TimelionOptionsComponent; +}; export { TimelionOptions }; diff --git a/src/legacy/core_plugins/vis_type_timelion/public/timelion_vis_fn.ts b/src/plugins/vis_type_timelion/public/timelion_vis_fn.ts similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/timelion_vis_fn.ts rename to src/plugins/vis_type_timelion/public/timelion_vis_fn.ts diff --git a/src/legacy/core_plugins/vis_type_timelion/public/timelion_vis_type.tsx b/src/plugins/vis_type_timelion/public/timelion_vis_type.tsx similarity index 91% rename from src/legacy/core_plugins/vis_type_timelion/public/timelion_vis_type.tsx rename to src/plugins/vis_type_timelion/public/timelion_vis_type.tsx index 5be77b3e51a6a..ff96ce1ef54c8 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/timelion_vis_type.tsx +++ b/src/plugins/vis_type_timelion/public/timelion_vis_type.tsx @@ -20,8 +20,8 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; -import { KibanaContextProvider } from '../../../../plugins/kibana_react/public'; -import { DefaultEditorSize } from '../../../../plugins/vis_default_editor/public'; +import { KibanaContextProvider } from '../../kibana_react/public'; +import { DefaultEditorSize } from '../../vis_default_editor/public'; import { getTimelionRequestHandler } from './helpers/timelion_request_handler'; import { TimelionVisComponent, TimelionVisComponentProp } from './components'; import { TimelionOptions } from './timelion_options'; @@ -53,7 +53,7 @@ export function getTimelionVisDefinition(dependencies: TimelionVisDependencies) ), }, editorConfig: { - optionsTemplate: TimelionOptions, + optionsTemplate: TimelionOptions(dependencies.uiSettings), defaultSize: DefaultEditorSize.MEDIUM, }, requestHandler: timelionRequestHandler, diff --git a/src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.axislabels.js b/src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.axislabels.js similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.axislabels.js rename to src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.axislabels.js diff --git a/src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.crosshair.js b/src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.crosshair.js similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.crosshair.js rename to src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.crosshair.js diff --git a/src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.js b/src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.js similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.js rename to src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.js diff --git a/src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.selection.js b/src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.selection.js similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.selection.js rename to src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.selection.js diff --git a/src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.stack.js b/src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.stack.js similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.stack.js rename to src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.stack.js diff --git a/src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.symbol.js b/src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.symbol.js similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.symbol.js rename to src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.symbol.js diff --git a/src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.time.js b/src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.time.js similarity index 100% rename from src/legacy/core_plugins/vis_type_timelion/public/webpackShims/jquery.flot.time.js rename to src/plugins/vis_type_timelion/public/webpackShims/jquery.flot.time.js diff --git a/src/plugins/timelion/server/fit_functions/average.js b/src/plugins/vis_type_timelion/server/fit_functions/average.js similarity index 100% rename from src/plugins/timelion/server/fit_functions/average.js rename to src/plugins/vis_type_timelion/server/fit_functions/average.js diff --git a/src/plugins/timelion/server/fit_functions/average.test.js b/src/plugins/vis_type_timelion/server/fit_functions/average.test.js similarity index 100% rename from src/plugins/timelion/server/fit_functions/average.test.js rename to src/plugins/vis_type_timelion/server/fit_functions/average.test.js diff --git a/src/plugins/timelion/server/fit_functions/carry.js b/src/plugins/vis_type_timelion/server/fit_functions/carry.js similarity index 100% rename from src/plugins/timelion/server/fit_functions/carry.js rename to src/plugins/vis_type_timelion/server/fit_functions/carry.js diff --git a/src/plugins/timelion/server/fit_functions/carry.test.js b/src/plugins/vis_type_timelion/server/fit_functions/carry.test.js similarity index 100% rename from src/plugins/timelion/server/fit_functions/carry.test.js rename to src/plugins/vis_type_timelion/server/fit_functions/carry.test.js diff --git a/src/plugins/timelion/server/fit_functions/nearest.js b/src/plugins/vis_type_timelion/server/fit_functions/nearest.js similarity index 100% rename from src/plugins/timelion/server/fit_functions/nearest.js rename to src/plugins/vis_type_timelion/server/fit_functions/nearest.js diff --git a/src/plugins/timelion/server/fit_functions/none.js b/src/plugins/vis_type_timelion/server/fit_functions/none.js similarity index 100% rename from src/plugins/timelion/server/fit_functions/none.js rename to src/plugins/vis_type_timelion/server/fit_functions/none.js diff --git a/src/plugins/timelion/server/fit_functions/scale.js b/src/plugins/vis_type_timelion/server/fit_functions/scale.js similarity index 100% rename from src/plugins/timelion/server/fit_functions/scale.js rename to src/plugins/vis_type_timelion/server/fit_functions/scale.js diff --git a/src/plugins/timelion/server/handlers/chain_runner.js b/src/plugins/vis_type_timelion/server/handlers/chain_runner.js similarity index 100% rename from src/plugins/timelion/server/handlers/chain_runner.js rename to src/plugins/vis_type_timelion/server/handlers/chain_runner.js diff --git a/src/plugins/timelion/server/handlers/lib/arg_type.js b/src/plugins/vis_type_timelion/server/handlers/lib/arg_type.js similarity index 100% rename from src/plugins/timelion/server/handlers/lib/arg_type.js rename to src/plugins/vis_type_timelion/server/handlers/lib/arg_type.js diff --git a/src/plugins/timelion/server/handlers/lib/index_arguments.js b/src/plugins/vis_type_timelion/server/handlers/lib/index_arguments.js similarity index 100% rename from src/plugins/timelion/server/handlers/lib/index_arguments.js rename to src/plugins/vis_type_timelion/server/handlers/lib/index_arguments.js diff --git a/src/plugins/timelion/server/handlers/lib/parse_sheet.js b/src/plugins/vis_type_timelion/server/handlers/lib/parse_sheet.js similarity index 100% rename from src/plugins/timelion/server/handlers/lib/parse_sheet.js rename to src/plugins/vis_type_timelion/server/handlers/lib/parse_sheet.js diff --git a/src/plugins/timelion/server/handlers/lib/parse_sheet.test.js b/src/plugins/vis_type_timelion/server/handlers/lib/parse_sheet.test.js similarity index 100% rename from src/plugins/timelion/server/handlers/lib/parse_sheet.test.js rename to src/plugins/vis_type_timelion/server/handlers/lib/parse_sheet.test.js diff --git a/src/plugins/timelion/server/handlers/lib/preprocess_chain.js b/src/plugins/vis_type_timelion/server/handlers/lib/preprocess_chain.js similarity index 100% rename from src/plugins/timelion/server/handlers/lib/preprocess_chain.js rename to src/plugins/vis_type_timelion/server/handlers/lib/preprocess_chain.js diff --git a/src/plugins/timelion/server/handlers/lib/reposition_arguments.js b/src/plugins/vis_type_timelion/server/handlers/lib/reposition_arguments.js similarity index 100% rename from src/plugins/timelion/server/handlers/lib/reposition_arguments.js rename to src/plugins/vis_type_timelion/server/handlers/lib/reposition_arguments.js diff --git a/src/plugins/timelion/server/handlers/lib/tl_config.js b/src/plugins/vis_type_timelion/server/handlers/lib/tl_config.js similarity index 100% rename from src/plugins/timelion/server/handlers/lib/tl_config.js rename to src/plugins/vis_type_timelion/server/handlers/lib/tl_config.js diff --git a/src/plugins/timelion/server/handlers/lib/validate_arg.js b/src/plugins/vis_type_timelion/server/handlers/lib/validate_arg.js similarity index 100% rename from src/plugins/timelion/server/handlers/lib/validate_arg.js rename to src/plugins/vis_type_timelion/server/handlers/lib/validate_arg.js diff --git a/src/plugins/timelion/server/handlers/lib/validate_time.js b/src/plugins/vis_type_timelion/server/handlers/lib/validate_time.js similarity index 100% rename from src/plugins/timelion/server/handlers/lib/validate_time.js rename to src/plugins/vis_type_timelion/server/handlers/lib/validate_time.js diff --git a/src/plugins/timelion/server/index.ts b/src/plugins/vis_type_timelion/server/index.ts similarity index 64% rename from src/plugins/timelion/server/index.ts rename to src/plugins/vis_type_timelion/server/index.ts index 5d420327f961e..b40ab2af2b0d7 100644 --- a/src/plugins/timelion/server/index.ts +++ b/src/plugins/vis_type_timelion/server/index.ts @@ -17,19 +17,23 @@ * under the License. */ -import { PluginInitializerContext } from '../../../../src/core/server'; -import { configSchema } from '../config'; +import { PluginConfigDescriptor, PluginInitializerContext } from '../../../../src/core/server'; +import { configSchema, ConfigSchema } from '../config'; import { Plugin } from './plugin'; export { PluginSetupContract } from './plugin'; -export const config = { +export const config: PluginConfigDescriptor = { schema: configSchema, exposeToBrowser: { - ui: { - enabled: true, - }, + ui: true, }, + deprecations: ({ renameFromRoot }) => [ + renameFromRoot('timelion_vis.enabled', 'vis_type_timelion.enabled'), + renameFromRoot('timelion.enabled', 'vis_type_timelion.enabled'), + renameFromRoot('timelion.graphiteUrls', 'vis_type_timelion.graphiteUrls'), + renameFromRoot('timelion.ui.enabled', 'vis_type_timelion.ui.enabled'), + ], }; export const plugin = (initializerContext: PluginInitializerContext) => new Plugin(initializerContext); diff --git a/src/plugins/timelion/server/lib/alter.js b/src/plugins/vis_type_timelion/server/lib/alter.js similarity index 100% rename from src/plugins/timelion/server/lib/alter.js rename to src/plugins/vis_type_timelion/server/lib/alter.js diff --git a/src/plugins/timelion/server/lib/as_sorted.js b/src/plugins/vis_type_timelion/server/lib/as_sorted.js similarity index 100% rename from src/plugins/timelion/server/lib/as_sorted.js rename to src/plugins/vis_type_timelion/server/lib/as_sorted.js diff --git a/src/plugins/timelion/server/lib/build_target.js b/src/plugins/vis_type_timelion/server/lib/build_target.js similarity index 100% rename from src/plugins/timelion/server/lib/build_target.js rename to src/plugins/vis_type_timelion/server/lib/build_target.js diff --git a/src/plugins/timelion/server/lib/classes/chainable.js b/src/plugins/vis_type_timelion/server/lib/classes/chainable.js similarity index 100% rename from src/plugins/timelion/server/lib/classes/chainable.js rename to src/plugins/vis_type_timelion/server/lib/classes/chainable.js diff --git a/src/plugins/timelion/server/lib/classes/datasource.js b/src/plugins/vis_type_timelion/server/lib/classes/datasource.js similarity index 100% rename from src/plugins/timelion/server/lib/classes/datasource.js rename to src/plugins/vis_type_timelion/server/lib/classes/datasource.js diff --git a/src/plugins/timelion/server/lib/classes/timelion_function.d.ts b/src/plugins/vis_type_timelion/server/lib/classes/timelion_function.d.ts similarity index 100% rename from src/plugins/timelion/server/lib/classes/timelion_function.d.ts rename to src/plugins/vis_type_timelion/server/lib/classes/timelion_function.d.ts diff --git a/src/plugins/timelion/server/lib/classes/timelion_function.js b/src/plugins/vis_type_timelion/server/lib/classes/timelion_function.js similarity index 100% rename from src/plugins/timelion/server/lib/classes/timelion_function.js rename to src/plugins/vis_type_timelion/server/lib/classes/timelion_function.js diff --git a/src/plugins/timelion/server/lib/config_manager.ts b/src/plugins/vis_type_timelion/server/lib/config_manager.ts similarity index 100% rename from src/plugins/timelion/server/lib/config_manager.ts rename to src/plugins/vis_type_timelion/server/lib/config_manager.ts diff --git a/src/plugins/timelion/server/lib/functions_md.js b/src/plugins/vis_type_timelion/server/lib/functions_md.js similarity index 100% rename from src/plugins/timelion/server/lib/functions_md.js rename to src/plugins/vis_type_timelion/server/lib/functions_md.js diff --git a/src/plugins/timelion/server/lib/get_namespaced_settings.js b/src/plugins/vis_type_timelion/server/lib/get_namespaced_settings.js similarity index 100% rename from src/plugins/timelion/server/lib/get_namespaced_settings.js rename to src/plugins/vis_type_timelion/server/lib/get_namespaced_settings.js diff --git a/src/plugins/timelion/server/lib/load_functions.d.ts b/src/plugins/vis_type_timelion/server/lib/load_functions.d.ts similarity index 100% rename from src/plugins/timelion/server/lib/load_functions.d.ts rename to src/plugins/vis_type_timelion/server/lib/load_functions.d.ts diff --git a/src/plugins/timelion/server/lib/load_functions.js b/src/plugins/vis_type_timelion/server/lib/load_functions.js similarity index 100% rename from src/plugins/timelion/server/lib/load_functions.js rename to src/plugins/vis_type_timelion/server/lib/load_functions.js diff --git a/src/plugins/timelion/server/lib/load_functions.test.js b/src/plugins/vis_type_timelion/server/lib/load_functions.test.js similarity index 95% rename from src/plugins/timelion/server/lib/load_functions.test.js rename to src/plugins/vis_type_timelion/server/lib/load_functions.test.js index ebe1a04532e05..3eb221babfb1b 100644 --- a/src/plugins/timelion/server/lib/load_functions.test.js +++ b/src/plugins/vis_type_timelion/server/lib/load_functions.test.js @@ -17,7 +17,7 @@ * under the License. */ -const fn = require(`src/plugins/timelion/server/lib/load_functions`); +const fn = require(`src/plugins/vis_type_timelion`); const expect = require('chai').expect; diff --git a/src/plugins/timelion/server/lib/offset_time.js b/src/plugins/vis_type_timelion/server/lib/offset_time.js similarity index 100% rename from src/plugins/timelion/server/lib/offset_time.js rename to src/plugins/vis_type_timelion/server/lib/offset_time.js diff --git a/src/plugins/timelion/server/lib/offset_time.test.js b/src/plugins/vis_type_timelion/server/lib/offset_time.test.js similarity index 100% rename from src/plugins/timelion/server/lib/offset_time.test.js rename to src/plugins/vis_type_timelion/server/lib/offset_time.test.js diff --git a/src/plugins/timelion/server/lib/process_function_definition.js b/src/plugins/vis_type_timelion/server/lib/process_function_definition.js similarity index 100% rename from src/plugins/timelion/server/lib/process_function_definition.js rename to src/plugins/vis_type_timelion/server/lib/process_function_definition.js diff --git a/src/plugins/timelion/server/lib/reduce.js b/src/plugins/vis_type_timelion/server/lib/reduce.js similarity index 100% rename from src/plugins/timelion/server/lib/reduce.js rename to src/plugins/vis_type_timelion/server/lib/reduce.js diff --git a/src/plugins/timelion/server/lib/split_interval.js b/src/plugins/vis_type_timelion/server/lib/split_interval.js similarity index 100% rename from src/plugins/timelion/server/lib/split_interval.js rename to src/plugins/vis_type_timelion/server/lib/split_interval.js diff --git a/src/plugins/timelion/server/lib/unzip_pairs.js b/src/plugins/vis_type_timelion/server/lib/unzip_pairs.js similarity index 100% rename from src/plugins/timelion/server/lib/unzip_pairs.js rename to src/plugins/vis_type_timelion/server/lib/unzip_pairs.js diff --git a/src/plugins/timelion/server/plugin.ts b/src/plugins/vis_type_timelion/server/plugin.ts similarity index 100% rename from src/plugins/timelion/server/plugin.ts rename to src/plugins/vis_type_timelion/server/plugin.ts diff --git a/src/plugins/timelion/server/routes/functions.ts b/src/plugins/vis_type_timelion/server/routes/functions.ts similarity index 100% rename from src/plugins/timelion/server/routes/functions.ts rename to src/plugins/vis_type_timelion/server/routes/functions.ts diff --git a/src/plugins/timelion/server/routes/run.ts b/src/plugins/vis_type_timelion/server/routes/run.ts similarity index 100% rename from src/plugins/timelion/server/routes/run.ts rename to src/plugins/vis_type_timelion/server/routes/run.ts diff --git a/src/plugins/timelion/server/routes/validate_es.ts b/src/plugins/vis_type_timelion/server/routes/validate_es.ts similarity index 100% rename from src/plugins/timelion/server/routes/validate_es.ts rename to src/plugins/vis_type_timelion/server/routes/validate_es.ts diff --git a/src/plugins/timelion/server/series_functions/abs.js b/src/plugins/vis_type_timelion/server/series_functions/abs.js similarity index 100% rename from src/plugins/timelion/server/series_functions/abs.js rename to src/plugins/vis_type_timelion/server/series_functions/abs.js diff --git a/src/plugins/timelion/server/series_functions/abs.test.js b/src/plugins/vis_type_timelion/server/series_functions/abs.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/abs.test.js rename to src/plugins/vis_type_timelion/server/series_functions/abs.test.js diff --git a/src/plugins/timelion/server/series_functions/aggregate/aggregate.test.js b/src/plugins/vis_type_timelion/server/series_functions/aggregate/aggregate.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/aggregate/aggregate.test.js rename to src/plugins/vis_type_timelion/server/series_functions/aggregate/aggregate.test.js diff --git a/src/plugins/timelion/server/series_functions/aggregate/avg.js b/src/plugins/vis_type_timelion/server/series_functions/aggregate/avg.js similarity index 100% rename from src/plugins/timelion/server/series_functions/aggregate/avg.js rename to src/plugins/vis_type_timelion/server/series_functions/aggregate/avg.js diff --git a/src/plugins/timelion/server/series_functions/aggregate/cardinality.js b/src/plugins/vis_type_timelion/server/series_functions/aggregate/cardinality.js similarity index 100% rename from src/plugins/timelion/server/series_functions/aggregate/cardinality.js rename to src/plugins/vis_type_timelion/server/series_functions/aggregate/cardinality.js diff --git a/src/plugins/timelion/server/series_functions/aggregate/first.js b/src/plugins/vis_type_timelion/server/series_functions/aggregate/first.js similarity index 100% rename from src/plugins/timelion/server/series_functions/aggregate/first.js rename to src/plugins/vis_type_timelion/server/series_functions/aggregate/first.js diff --git a/src/plugins/timelion/server/series_functions/aggregate/index.js b/src/plugins/vis_type_timelion/server/series_functions/aggregate/index.js similarity index 100% rename from src/plugins/timelion/server/series_functions/aggregate/index.js rename to src/plugins/vis_type_timelion/server/series_functions/aggregate/index.js diff --git a/src/plugins/timelion/server/series_functions/aggregate/last.js b/src/plugins/vis_type_timelion/server/series_functions/aggregate/last.js similarity index 100% rename from src/plugins/timelion/server/series_functions/aggregate/last.js rename to src/plugins/vis_type_timelion/server/series_functions/aggregate/last.js diff --git a/src/plugins/timelion/server/series_functions/aggregate/max.js b/src/plugins/vis_type_timelion/server/series_functions/aggregate/max.js similarity index 100% rename from src/plugins/timelion/server/series_functions/aggregate/max.js rename to src/plugins/vis_type_timelion/server/series_functions/aggregate/max.js diff --git a/src/plugins/timelion/server/series_functions/aggregate/min.js b/src/plugins/vis_type_timelion/server/series_functions/aggregate/min.js similarity index 100% rename from src/plugins/timelion/server/series_functions/aggregate/min.js rename to src/plugins/vis_type_timelion/server/series_functions/aggregate/min.js diff --git a/src/plugins/timelion/server/series_functions/aggregate/sum.js b/src/plugins/vis_type_timelion/server/series_functions/aggregate/sum.js similarity index 100% rename from src/plugins/timelion/server/series_functions/aggregate/sum.js rename to src/plugins/vis_type_timelion/server/series_functions/aggregate/sum.js diff --git a/src/plugins/timelion/server/series_functions/bars.js b/src/plugins/vis_type_timelion/server/series_functions/bars.js similarity index 100% rename from src/plugins/timelion/server/series_functions/bars.js rename to src/plugins/vis_type_timelion/server/series_functions/bars.js diff --git a/src/plugins/timelion/server/series_functions/bars.test.js b/src/plugins/vis_type_timelion/server/series_functions/bars.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/bars.test.js rename to src/plugins/vis_type_timelion/server/series_functions/bars.test.js diff --git a/src/plugins/timelion/server/series_functions/color.js b/src/plugins/vis_type_timelion/server/series_functions/color.js similarity index 100% rename from src/plugins/timelion/server/series_functions/color.js rename to src/plugins/vis_type_timelion/server/series_functions/color.js diff --git a/src/plugins/timelion/server/series_functions/color.test.js b/src/plugins/vis_type_timelion/server/series_functions/color.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/color.test.js rename to src/plugins/vis_type_timelion/server/series_functions/color.test.js diff --git a/src/plugins/timelion/server/series_functions/condition.js b/src/plugins/vis_type_timelion/server/series_functions/condition.js similarity index 100% rename from src/plugins/timelion/server/series_functions/condition.js rename to src/plugins/vis_type_timelion/server/series_functions/condition.js diff --git a/src/plugins/timelion/server/series_functions/condition.test.js b/src/plugins/vis_type_timelion/server/series_functions/condition.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/condition.test.js rename to src/plugins/vis_type_timelion/server/series_functions/condition.test.js diff --git a/src/plugins/timelion/server/series_functions/cusum.js b/src/plugins/vis_type_timelion/server/series_functions/cusum.js similarity index 100% rename from src/plugins/timelion/server/series_functions/cusum.js rename to src/plugins/vis_type_timelion/server/series_functions/cusum.js diff --git a/src/plugins/timelion/server/series_functions/cusum.test.js b/src/plugins/vis_type_timelion/server/series_functions/cusum.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/cusum.test.js rename to src/plugins/vis_type_timelion/server/series_functions/cusum.test.js diff --git a/src/plugins/timelion/server/series_functions/derivative.js b/src/plugins/vis_type_timelion/server/series_functions/derivative.js similarity index 100% rename from src/plugins/timelion/server/series_functions/derivative.js rename to src/plugins/vis_type_timelion/server/series_functions/derivative.js diff --git a/src/plugins/timelion/server/series_functions/derivative.test.js b/src/plugins/vis_type_timelion/server/series_functions/derivative.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/derivative.test.js rename to src/plugins/vis_type_timelion/server/series_functions/derivative.test.js diff --git a/src/plugins/timelion/server/series_functions/divide.js b/src/plugins/vis_type_timelion/server/series_functions/divide.js similarity index 100% rename from src/plugins/timelion/server/series_functions/divide.js rename to src/plugins/vis_type_timelion/server/series_functions/divide.js diff --git a/src/plugins/timelion/server/series_functions/divide.test.js b/src/plugins/vis_type_timelion/server/series_functions/divide.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/divide.test.js rename to src/plugins/vis_type_timelion/server/series_functions/divide.test.js diff --git a/src/plugins/timelion/server/series_functions/es/es.test.js b/src/plugins/vis_type_timelion/server/series_functions/es/es.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/es/es.test.js rename to src/plugins/vis_type_timelion/server/series_functions/es/es.test.js diff --git a/src/plugins/timelion/server/series_functions/es/index.js b/src/plugins/vis_type_timelion/server/series_functions/es/index.js similarity index 100% rename from src/plugins/timelion/server/series_functions/es/index.js rename to src/plugins/vis_type_timelion/server/series_functions/es/index.js diff --git a/src/plugins/timelion/server/series_functions/es/lib/agg_body.js b/src/plugins/vis_type_timelion/server/series_functions/es/lib/agg_body.js similarity index 100% rename from src/plugins/timelion/server/series_functions/es/lib/agg_body.js rename to src/plugins/vis_type_timelion/server/series_functions/es/lib/agg_body.js diff --git a/src/plugins/timelion/server/series_functions/es/lib/agg_response_to_series_list.js b/src/plugins/vis_type_timelion/server/series_functions/es/lib/agg_response_to_series_list.js similarity index 100% rename from src/plugins/timelion/server/series_functions/es/lib/agg_response_to_series_list.js rename to src/plugins/vis_type_timelion/server/series_functions/es/lib/agg_response_to_series_list.js diff --git a/src/plugins/timelion/server/series_functions/es/lib/build_request.js b/src/plugins/vis_type_timelion/server/series_functions/es/lib/build_request.js similarity index 100% rename from src/plugins/timelion/server/series_functions/es/lib/build_request.js rename to src/plugins/vis_type_timelion/server/series_functions/es/lib/build_request.js diff --git a/src/plugins/timelion/server/series_functions/es/lib/create_date_agg.js b/src/plugins/vis_type_timelion/server/series_functions/es/lib/create_date_agg.js similarity index 100% rename from src/plugins/timelion/server/series_functions/es/lib/create_date_agg.js rename to src/plugins/vis_type_timelion/server/series_functions/es/lib/create_date_agg.js diff --git a/src/plugins/timelion/server/series_functions/first.js b/src/plugins/vis_type_timelion/server/series_functions/first.js similarity index 100% rename from src/plugins/timelion/server/series_functions/first.js rename to src/plugins/vis_type_timelion/server/series_functions/first.js diff --git a/src/plugins/timelion/server/series_functions/first.test.js b/src/plugins/vis_type_timelion/server/series_functions/first.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/first.test.js rename to src/plugins/vis_type_timelion/server/series_functions/first.test.js diff --git a/src/plugins/timelion/server/series_functions/fit.js b/src/plugins/vis_type_timelion/server/series_functions/fit.js similarity index 100% rename from src/plugins/timelion/server/series_functions/fit.js rename to src/plugins/vis_type_timelion/server/series_functions/fit.js diff --git a/src/plugins/timelion/server/series_functions/fit.test.js b/src/plugins/vis_type_timelion/server/series_functions/fit.test.js similarity index 98% rename from src/plugins/timelion/server/series_functions/fit.test.js rename to src/plugins/vis_type_timelion/server/series_functions/fit.test.js index 75eaa2a50ea72..9d2d45589d050 100644 --- a/src/plugins/timelion/server/series_functions/fit.test.js +++ b/src/plugins/vis_type_timelion/server/series_functions/fit.test.js @@ -17,7 +17,7 @@ * under the License. */ -const fn = require(`src/plugins/timelion/server/series_functions/fit`); +const fn = require(`src/plugins/vis_type_timelion`); import moment from 'moment'; const expect = require('chai').expect; import invoke from './helpers/invoke_series_fn.js'; diff --git a/src/plugins/timelion/server/series_functions/fixtures/bucket_list.js b/src/plugins/vis_type_timelion/server/series_functions/fixtures/bucket_list.js similarity index 100% rename from src/plugins/timelion/server/series_functions/fixtures/bucket_list.js rename to src/plugins/vis_type_timelion/server/series_functions/fixtures/bucket_list.js diff --git a/src/plugins/timelion/server/series_functions/fixtures/es_response.js b/src/plugins/vis_type_timelion/server/series_functions/fixtures/es_response.js similarity index 100% rename from src/plugins/timelion/server/series_functions/fixtures/es_response.js rename to src/plugins/vis_type_timelion/server/series_functions/fixtures/es_response.js diff --git a/src/plugins/timelion/server/series_functions/fixtures/series_list.js b/src/plugins/vis_type_timelion/server/series_functions/fixtures/series_list.js similarity index 100% rename from src/plugins/timelion/server/series_functions/fixtures/series_list.js rename to src/plugins/vis_type_timelion/server/series_functions/fixtures/series_list.js diff --git a/src/plugins/timelion/server/series_functions/fixtures/tl_config.js b/src/plugins/vis_type_timelion/server/series_functions/fixtures/tl_config.js similarity index 100% rename from src/plugins/timelion/server/series_functions/fixtures/tl_config.js rename to src/plugins/vis_type_timelion/server/series_functions/fixtures/tl_config.js diff --git a/src/plugins/timelion/server/series_functions/graphite.js b/src/plugins/vis_type_timelion/server/series_functions/graphite.js similarity index 100% rename from src/plugins/timelion/server/series_functions/graphite.js rename to src/plugins/vis_type_timelion/server/series_functions/graphite.js diff --git a/src/plugins/timelion/server/series_functions/graphite.test.js b/src/plugins/vis_type_timelion/server/series_functions/graphite.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/graphite.test.js rename to src/plugins/vis_type_timelion/server/series_functions/graphite.test.js diff --git a/src/plugins/timelion/server/series_functions/helpers/get_series.js b/src/plugins/vis_type_timelion/server/series_functions/helpers/get_series.js similarity index 100% rename from src/plugins/timelion/server/series_functions/helpers/get_series.js rename to src/plugins/vis_type_timelion/server/series_functions/helpers/get_series.js diff --git a/src/plugins/timelion/server/series_functions/helpers/get_series_list.js b/src/plugins/vis_type_timelion/server/series_functions/helpers/get_series_list.js similarity index 100% rename from src/plugins/timelion/server/series_functions/helpers/get_series_list.js rename to src/plugins/vis_type_timelion/server/series_functions/helpers/get_series_list.js diff --git a/src/plugins/timelion/server/series_functions/helpers/get_single_series_list.js b/src/plugins/vis_type_timelion/server/series_functions/helpers/get_single_series_list.js similarity index 100% rename from src/plugins/timelion/server/series_functions/helpers/get_single_series_list.js rename to src/plugins/vis_type_timelion/server/series_functions/helpers/get_single_series_list.js diff --git a/src/plugins/timelion/server/series_functions/helpers/invoke_series_fn.js b/src/plugins/vis_type_timelion/server/series_functions/helpers/invoke_series_fn.js similarity index 100% rename from src/plugins/timelion/server/series_functions/helpers/invoke_series_fn.js rename to src/plugins/vis_type_timelion/server/series_functions/helpers/invoke_series_fn.js diff --git a/src/plugins/timelion/server/series_functions/hide.js b/src/plugins/vis_type_timelion/server/series_functions/hide.js similarity index 100% rename from src/plugins/timelion/server/series_functions/hide.js rename to src/plugins/vis_type_timelion/server/series_functions/hide.js diff --git a/src/plugins/timelion/server/series_functions/hide.test.js b/src/plugins/vis_type_timelion/server/series_functions/hide.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/hide.test.js rename to src/plugins/vis_type_timelion/server/series_functions/hide.test.js diff --git a/src/plugins/timelion/server/series_functions/holt/index.js b/src/plugins/vis_type_timelion/server/series_functions/holt/index.js similarity index 100% rename from src/plugins/timelion/server/series_functions/holt/index.js rename to src/plugins/vis_type_timelion/server/series_functions/holt/index.js diff --git a/src/plugins/timelion/server/series_functions/holt/lib/des.js b/src/plugins/vis_type_timelion/server/series_functions/holt/lib/des.js similarity index 100% rename from src/plugins/timelion/server/series_functions/holt/lib/des.js rename to src/plugins/vis_type_timelion/server/series_functions/holt/lib/des.js diff --git a/src/plugins/timelion/server/series_functions/holt/lib/ses.js b/src/plugins/vis_type_timelion/server/series_functions/holt/lib/ses.js similarity index 100% rename from src/plugins/timelion/server/series_functions/holt/lib/ses.js rename to src/plugins/vis_type_timelion/server/series_functions/holt/lib/ses.js diff --git a/src/plugins/timelion/server/series_functions/holt/lib/tes.js b/src/plugins/vis_type_timelion/server/series_functions/holt/lib/tes.js similarity index 100% rename from src/plugins/timelion/server/series_functions/holt/lib/tes.js rename to src/plugins/vis_type_timelion/server/series_functions/holt/lib/tes.js diff --git a/src/plugins/timelion/server/series_functions/label.js b/src/plugins/vis_type_timelion/server/series_functions/label.js similarity index 100% rename from src/plugins/timelion/server/series_functions/label.js rename to src/plugins/vis_type_timelion/server/series_functions/label.js diff --git a/src/plugins/timelion/server/series_functions/label.test.js b/src/plugins/vis_type_timelion/server/series_functions/label.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/label.test.js rename to src/plugins/vis_type_timelion/server/series_functions/label.test.js diff --git a/src/plugins/timelion/server/series_functions/legend.js b/src/plugins/vis_type_timelion/server/series_functions/legend.js similarity index 100% rename from src/plugins/timelion/server/series_functions/legend.js rename to src/plugins/vis_type_timelion/server/series_functions/legend.js diff --git a/src/plugins/timelion/server/series_functions/legend.test.js b/src/plugins/vis_type_timelion/server/series_functions/legend.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/legend.test.js rename to src/plugins/vis_type_timelion/server/series_functions/legend.test.js diff --git a/src/plugins/timelion/server/series_functions/lines.js b/src/plugins/vis_type_timelion/server/series_functions/lines.js similarity index 100% rename from src/plugins/timelion/server/series_functions/lines.js rename to src/plugins/vis_type_timelion/server/series_functions/lines.js diff --git a/src/plugins/timelion/server/series_functions/lines.test.js b/src/plugins/vis_type_timelion/server/series_functions/lines.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/lines.test.js rename to src/plugins/vis_type_timelion/server/series_functions/lines.test.js diff --git a/src/plugins/timelion/server/series_functions/log.js b/src/plugins/vis_type_timelion/server/series_functions/log.js similarity index 100% rename from src/plugins/timelion/server/series_functions/log.js rename to src/plugins/vis_type_timelion/server/series_functions/log.js diff --git a/src/plugins/timelion/server/series_functions/log.test.js b/src/plugins/vis_type_timelion/server/series_functions/log.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/log.test.js rename to src/plugins/vis_type_timelion/server/series_functions/log.test.js diff --git a/src/plugins/timelion/server/series_functions/max.js b/src/plugins/vis_type_timelion/server/series_functions/max.js similarity index 100% rename from src/plugins/timelion/server/series_functions/max.js rename to src/plugins/vis_type_timelion/server/series_functions/max.js diff --git a/src/plugins/timelion/server/series_functions/max.test.js b/src/plugins/vis_type_timelion/server/series_functions/max.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/max.test.js rename to src/plugins/vis_type_timelion/server/series_functions/max.test.js diff --git a/src/plugins/timelion/server/series_functions/min.js b/src/plugins/vis_type_timelion/server/series_functions/min.js similarity index 100% rename from src/plugins/timelion/server/series_functions/min.js rename to src/plugins/vis_type_timelion/server/series_functions/min.js diff --git a/src/plugins/timelion/server/series_functions/min.test.js b/src/plugins/vis_type_timelion/server/series_functions/min.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/min.test.js rename to src/plugins/vis_type_timelion/server/series_functions/min.test.js diff --git a/src/plugins/timelion/server/series_functions/movingaverage.js b/src/plugins/vis_type_timelion/server/series_functions/movingaverage.js similarity index 100% rename from src/plugins/timelion/server/series_functions/movingaverage.js rename to src/plugins/vis_type_timelion/server/series_functions/movingaverage.js diff --git a/src/plugins/timelion/server/series_functions/movingaverage.test.js b/src/plugins/vis_type_timelion/server/series_functions/movingaverage.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/movingaverage.test.js rename to src/plugins/vis_type_timelion/server/series_functions/movingaverage.test.js diff --git a/src/plugins/timelion/server/series_functions/movingstd.js b/src/plugins/vis_type_timelion/server/series_functions/movingstd.js similarity index 100% rename from src/plugins/timelion/server/series_functions/movingstd.js rename to src/plugins/vis_type_timelion/server/series_functions/movingstd.js diff --git a/src/plugins/timelion/server/series_functions/movingstd.test.js b/src/plugins/vis_type_timelion/server/series_functions/movingstd.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/movingstd.test.js rename to src/plugins/vis_type_timelion/server/series_functions/movingstd.test.js diff --git a/src/plugins/timelion/server/series_functions/multiply.js b/src/plugins/vis_type_timelion/server/series_functions/multiply.js similarity index 100% rename from src/plugins/timelion/server/series_functions/multiply.js rename to src/plugins/vis_type_timelion/server/series_functions/multiply.js diff --git a/src/plugins/timelion/server/series_functions/multiply.test.js b/src/plugins/vis_type_timelion/server/series_functions/multiply.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/multiply.test.js rename to src/plugins/vis_type_timelion/server/series_functions/multiply.test.js diff --git a/src/plugins/timelion/server/series_functions/points.js b/src/plugins/vis_type_timelion/server/series_functions/points.js similarity index 100% rename from src/plugins/timelion/server/series_functions/points.js rename to src/plugins/vis_type_timelion/server/series_functions/points.js diff --git a/src/plugins/timelion/server/series_functions/points.test.js b/src/plugins/vis_type_timelion/server/series_functions/points.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/points.test.js rename to src/plugins/vis_type_timelion/server/series_functions/points.test.js diff --git a/src/plugins/timelion/server/series_functions/precision.js b/src/plugins/vis_type_timelion/server/series_functions/precision.js similarity index 100% rename from src/plugins/timelion/server/series_functions/precision.js rename to src/plugins/vis_type_timelion/server/series_functions/precision.js diff --git a/src/plugins/timelion/server/series_functions/precision.test.js b/src/plugins/vis_type_timelion/server/series_functions/precision.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/precision.test.js rename to src/plugins/vis_type_timelion/server/series_functions/precision.test.js diff --git a/src/plugins/timelion/server/series_functions/props.js b/src/plugins/vis_type_timelion/server/series_functions/props.js similarity index 100% rename from src/plugins/timelion/server/series_functions/props.js rename to src/plugins/vis_type_timelion/server/series_functions/props.js diff --git a/src/plugins/timelion/server/series_functions/quandl.js b/src/plugins/vis_type_timelion/server/series_functions/quandl.js similarity index 100% rename from src/plugins/timelion/server/series_functions/quandl.js rename to src/plugins/vis_type_timelion/server/series_functions/quandl.js diff --git a/src/plugins/timelion/server/series_functions/quandl.test.js b/src/plugins/vis_type_timelion/server/series_functions/quandl.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/quandl.test.js rename to src/plugins/vis_type_timelion/server/series_functions/quandl.test.js diff --git a/src/plugins/timelion/server/series_functions/range.js b/src/plugins/vis_type_timelion/server/series_functions/range.js similarity index 100% rename from src/plugins/timelion/server/series_functions/range.js rename to src/plugins/vis_type_timelion/server/series_functions/range.js diff --git a/src/plugins/timelion/server/series_functions/range.test.js b/src/plugins/vis_type_timelion/server/series_functions/range.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/range.test.js rename to src/plugins/vis_type_timelion/server/series_functions/range.test.js diff --git a/src/plugins/timelion/server/series_functions/scale_interval.js b/src/plugins/vis_type_timelion/server/series_functions/scale_interval.js similarity index 100% rename from src/plugins/timelion/server/series_functions/scale_interval.js rename to src/plugins/vis_type_timelion/server/series_functions/scale_interval.js diff --git a/src/plugins/timelion/server/series_functions/scale_interval.test.js b/src/plugins/vis_type_timelion/server/series_functions/scale_interval.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/scale_interval.test.js rename to src/plugins/vis_type_timelion/server/series_functions/scale_interval.test.js diff --git a/src/plugins/timelion/server/series_functions/static.js b/src/plugins/vis_type_timelion/server/series_functions/static.js similarity index 100% rename from src/plugins/timelion/server/series_functions/static.js rename to src/plugins/vis_type_timelion/server/series_functions/static.js diff --git a/src/plugins/timelion/server/series_functions/static.test.js b/src/plugins/vis_type_timelion/server/series_functions/static.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/static.test.js rename to src/plugins/vis_type_timelion/server/series_functions/static.test.js diff --git a/src/plugins/timelion/server/series_functions/subtract.js b/src/plugins/vis_type_timelion/server/series_functions/subtract.js similarity index 100% rename from src/plugins/timelion/server/series_functions/subtract.js rename to src/plugins/vis_type_timelion/server/series_functions/subtract.js diff --git a/src/plugins/timelion/server/series_functions/subtract.test.js b/src/plugins/vis_type_timelion/server/series_functions/subtract.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/subtract.test.js rename to src/plugins/vis_type_timelion/server/series_functions/subtract.test.js diff --git a/src/plugins/timelion/server/series_functions/sum.js b/src/plugins/vis_type_timelion/server/series_functions/sum.js similarity index 100% rename from src/plugins/timelion/server/series_functions/sum.js rename to src/plugins/vis_type_timelion/server/series_functions/sum.js diff --git a/src/plugins/timelion/server/series_functions/sum.test.js b/src/plugins/vis_type_timelion/server/series_functions/sum.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/sum.test.js rename to src/plugins/vis_type_timelion/server/series_functions/sum.test.js diff --git a/src/plugins/timelion/server/series_functions/title.js b/src/plugins/vis_type_timelion/server/series_functions/title.js similarity index 100% rename from src/plugins/timelion/server/series_functions/title.js rename to src/plugins/vis_type_timelion/server/series_functions/title.js diff --git a/src/plugins/timelion/server/series_functions/title.test.js b/src/plugins/vis_type_timelion/server/series_functions/title.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/title.test.js rename to src/plugins/vis_type_timelion/server/series_functions/title.test.js diff --git a/src/plugins/timelion/server/series_functions/trend/index.js b/src/plugins/vis_type_timelion/server/series_functions/trend/index.js similarity index 100% rename from src/plugins/timelion/server/series_functions/trend/index.js rename to src/plugins/vis_type_timelion/server/series_functions/trend/index.js diff --git a/src/plugins/timelion/server/series_functions/trend/lib/regress.js b/src/plugins/vis_type_timelion/server/series_functions/trend/lib/regress.js similarity index 100% rename from src/plugins/timelion/server/series_functions/trend/lib/regress.js rename to src/plugins/vis_type_timelion/server/series_functions/trend/lib/regress.js diff --git a/src/plugins/timelion/server/series_functions/trim.js b/src/plugins/vis_type_timelion/server/series_functions/trim.js similarity index 100% rename from src/plugins/timelion/server/series_functions/trim.js rename to src/plugins/vis_type_timelion/server/series_functions/trim.js diff --git a/src/plugins/timelion/server/series_functions/trim.test.js b/src/plugins/vis_type_timelion/server/series_functions/trim.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/trim.test.js rename to src/plugins/vis_type_timelion/server/series_functions/trim.test.js diff --git a/src/plugins/timelion/server/series_functions/worldbank.js b/src/plugins/vis_type_timelion/server/series_functions/worldbank.js similarity index 100% rename from src/plugins/timelion/server/series_functions/worldbank.js rename to src/plugins/vis_type_timelion/server/series_functions/worldbank.js diff --git a/src/plugins/timelion/server/series_functions/worldbank_indicators.js b/src/plugins/vis_type_timelion/server/series_functions/worldbank_indicators.js similarity index 100% rename from src/plugins/timelion/server/series_functions/worldbank_indicators.js rename to src/plugins/vis_type_timelion/server/series_functions/worldbank_indicators.js diff --git a/src/plugins/timelion/server/series_functions/yaxis.js b/src/plugins/vis_type_timelion/server/series_functions/yaxis.js similarity index 100% rename from src/plugins/timelion/server/series_functions/yaxis.js rename to src/plugins/vis_type_timelion/server/series_functions/yaxis.js diff --git a/src/plugins/timelion/server/series_functions/yaxis.test.js b/src/plugins/vis_type_timelion/server/series_functions/yaxis.test.js similarity index 100% rename from src/plugins/timelion/server/series_functions/yaxis.test.js rename to src/plugins/vis_type_timelion/server/series_functions/yaxis.test.js diff --git a/src/plugins/timelion/server/timelion.json b/src/plugins/vis_type_timelion/server/timelion.json similarity index 100% rename from src/plugins/timelion/server/timelion.json rename to src/plugins/vis_type_timelion/server/timelion.json diff --git a/src/plugins/timelion/server/types.ts b/src/plugins/vis_type_timelion/server/types.ts similarity index 100% rename from src/plugins/timelion/server/types.ts rename to src/plugins/vis_type_timelion/server/types.ts diff --git a/tasks/config/peg.js b/tasks/config/peg.js index 1d8667840faba..2de6ff4b5cff9 100644 --- a/tasks/config/peg.js +++ b/tasks/config/peg.js @@ -26,7 +26,7 @@ module.exports = { }, }, timelion_chain: { - src: 'src/legacy/core_plugins/vis_type_timelion/public/chain.peg', - dest: 'src/legacy/core_plugins/vis_type_timelion/public/_generated_/chain.js', + src: 'src/plugins/vis_type_timelion/public/chain.peg', + dest: 'src/plugins/vis_type_timelion/public/_generated_/chain.js', }, }; diff --git a/x-pack/plugins/features/kibana.json b/x-pack/plugins/features/kibana.json index 325e5a0407493..6e51f3b650710 100644 --- a/x-pack/plugins/features/kibana.json +++ b/x-pack/plugins/features/kibana.json @@ -2,7 +2,7 @@ "id": "features", "version": "8.0.0", "kibanaVersion": "kibana", - "optionalPlugins": ["timelion"], + "optionalPlugins": ["visTypeTimelion"], "configPath": ["xpack", "features"], "server": true, "ui": true diff --git a/x-pack/plugins/features/server/plugin.ts b/x-pack/plugins/features/server/plugin.ts index cebf67243fb28..83cc9e1eb7cc8 100644 --- a/x-pack/plugins/features/server/plugin.ts +++ b/x-pack/plugins/features/server/plugin.ts @@ -13,7 +13,7 @@ import { import { Capabilities as UICapabilities } from '../../../../src/core/server'; import { deepFreeze } from '../../../../src/core/utils'; import { XPackInfo } from '../../../legacy/plugins/xpack_main/server/lib/xpack_info'; -import { PluginSetupContract as TimelionSetupContract } from '../../../../src/plugins/timelion/server'; +import { PluginSetupContract as TimelionSetupContract } from '../../../../src/plugins/vis_type_timelion/server'; import { FeatureRegistry } from './feature_registry'; import { Feature, FeatureConfig } from '../common/feature'; import { uiCapabilitiesForFeatures } from './ui_capabilities_for_features'; @@ -65,7 +65,7 @@ export class Plugin { public async setup( core: CoreSetup, - { timelion }: { timelion?: TimelionSetupContract } + { visTypeTimelion }: { visTypeTimelion?: TimelionSetupContract } ): Promise> { defineRoutes({ router: core.http.createRouter(), @@ -84,7 +84,7 @@ export class Plugin { // Register OSS features. for (const feature of buildOSSFeatures({ savedObjectTypes: this.legacyAPI.savedObjectTypes, - includeTimelion: timelion !== undefined && timelion.uiEnabled, + includeTimelion: visTypeTimelion !== undefined && visTypeTimelion.uiEnabled, })) { this.featureRegistry.register(feature); } From 5e96a627c5c1358cf1d38025b274cf2a25a0dd01 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Wed, 8 Apr 2020 15:07:30 +0200 Subject: [PATCH 10/15] fix path --- .../vis_type_timelion/public/components/timelion_interval.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/vis_type_timelion/public/components/timelion_interval.tsx b/src/plugins/vis_type_timelion/public/components/timelion_interval.tsx index 941d11dfd3a3d..985ecaeaf3e5a 100644 --- a/src/plugins/vis_type_timelion/public/components/timelion_interval.tsx +++ b/src/plugins/vis_type_timelion/public/components/timelion_interval.tsx @@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n'; import { search } from '../../../data/public'; const { isValidEsInterval } = search.aggs; -import { useValidation } from '../../../../../plugins/vis_default_editor/public'; +import { useValidation } from '../../../vis_default_editor/public'; const intervalOptions = [ { From 4c9397e8b306087a063405d26ef7d43456077e6c Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Wed, 8 Apr 2020 15:17:13 +0200 Subject: [PATCH 11/15] revert merge mistakes and pass in all services --- .../public/components/controls/order_by.tsx | 13 ++++++++----- .../components/controls/radius_ratio_option.tsx | 1 + .../vis_type_timelion/public/timelion_options.tsx | 6 +++--- .../vis_type_timelion/public/timelion_vis_type.tsx | 2 +- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/plugins/vis_default_editor/public/components/controls/order_by.tsx b/src/plugins/vis_default_editor/public/components/controls/order_by.tsx index 036a769423a5b..47b12f4340d42 100644 --- a/src/plugins/vis_default_editor/public/components/controls/order_by.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/order_by.tsx @@ -60,13 +60,16 @@ function OrderByParamEditor({ useValidation(setValidity, isValid); useMount(() => { - let respAgg = { id: DEFAULT_VALUE }; + // setup the initial value of orderBy + if (!value) { + let respAgg = { id: DEFAULT_VALUE }; - if (metricAggs) { - respAgg = metricAggs.filter(isCompatibleAgg)[0] || respAgg; - } + if (metricAggs) { + respAgg = metricAggs.filter(isCompatibleAgg)[0] || respAgg; + } - setValue(respAgg.id); + setValue(respAgg.id); + } }); useFallbackMetric(setValue, termsAggFilter, metricAggs, value, DEFAULT_VALUE); diff --git a/src/plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx b/src/plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx index f9b8379eafb77..86c4431b6d5ed 100644 --- a/src/plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx +++ b/src/plugins/vis_default_editor/public/components/controls/radius_ratio_option.tsx @@ -44,6 +44,7 @@ function RadiusRatioOptionControl({ editorStateParams, setStateParamValue }: Agg /> ); + useMount(() => { if (!editorStateParams.radiusRatio) { setStateParamValue(PARAM_NAME, DEFAULT_VALUE); diff --git a/src/plugins/vis_type_timelion/public/timelion_options.tsx b/src/plugins/vis_type_timelion/public/timelion_options.tsx index 82e458ba57e88..58f3f0c2b5696 100644 --- a/src/plugins/vis_type_timelion/public/timelion_options.tsx +++ b/src/plugins/vis_type_timelion/public/timelion_options.tsx @@ -19,14 +19,14 @@ import React, { useCallback } from 'react'; import { EuiPanel } from '@elastic/eui'; -import { IUiSettingsClient } from 'kibana/public'; import { VisOptionsProps } from 'src/plugins/vis_default_editor/public'; import { VisParams } from './timelion_vis_fn'; import { TimelionInterval, TimelionExpressionInput } from './components'; import { KibanaContextProvider } from '../../kibana_react/public'; +import { TimelionVisDependencies } from './plugin'; -const TimelionOptions = (uiSettings: IUiSettingsClient) => { +const TimelionOptions = (dependencies: TimelionVisDependencies) => { const TimelionOptionsComponent = ({ stateParams, setValue, @@ -41,7 +41,7 @@ const TimelionOptions = (uiSettings: IUiSettingsClient) => { ); return ( - + Date: Wed, 8 Apr 2020 18:00:31 +0200 Subject: [PATCH 12/15] fix tsconfig files --- .../plugins/kbn_tp_embeddable_explorer/tsconfig.json | 5 +++-- test/tsconfig.json | 3 ++- x-pack/test/tsconfig.json | 3 ++- x-pack/tsconfig.json | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/tsconfig.json b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/tsconfig.json index d8096d9aab27a..544c27241f5cb 100644 --- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/tsconfig.json +++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/tsconfig.json @@ -6,7 +6,8 @@ "types": [ "node", "jest", - "react" + "react", + "flot" ] }, "include": [ @@ -16,4 +17,4 @@ "../../../../typings/**/*", ], "exclude": [] -} \ No newline at end of file +} diff --git a/test/tsconfig.json b/test/tsconfig.json index 285d3db64a874..5a3716e620fed 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -3,7 +3,8 @@ "compilerOptions": { "types": [ "node", - "mocha" + "mocha", + "flot" ], "lib": [ "esnext", diff --git a/x-pack/test/tsconfig.json b/x-pack/test/tsconfig.json index e9aab9b47535f..df1d7e789507b 100644 --- a/x-pack/test/tsconfig.json +++ b/x-pack/test/tsconfig.json @@ -3,7 +3,8 @@ "compilerOptions": { "types": [ "mocha", - "node" + "node", + "flot" ] }, "include": [ diff --git a/x-pack/tsconfig.json b/x-pack/tsconfig.json index a6c94ff74620e..55f697fb4f5ec 100644 --- a/x-pack/tsconfig.json +++ b/x-pack/tsconfig.json @@ -40,7 +40,8 @@ }, "types": [ "node", - "jest" + "jest", + "flot" ] } } From 7bf065f720219a5c27b65e5254898e6f3b5e15eb Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Thu, 9 Apr 2020 09:27:49 +0200 Subject: [PATCH 13/15] fix timelion test --- src/plugins/vis_type_timelion/server/lib/load_functions.test.js | 2 +- .../vis_type_timelion/server/series_functions/fit.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/vis_type_timelion/server/lib/load_functions.test.js b/src/plugins/vis_type_timelion/server/lib/load_functions.test.js index 3eb221babfb1b..b4f83611a7773 100644 --- a/src/plugins/vis_type_timelion/server/lib/load_functions.test.js +++ b/src/plugins/vis_type_timelion/server/lib/load_functions.test.js @@ -17,7 +17,7 @@ * under the License. */ -const fn = require(`src/plugins/vis_type_timelion`); +const fn = require(`src/plugins/vis_type_timelion/server/lib/load_functions`); const expect = require('chai').expect; diff --git a/src/plugins/vis_type_timelion/server/series_functions/fit.test.js b/src/plugins/vis_type_timelion/server/series_functions/fit.test.js index 9d2d45589d050..6622259a1fd87 100644 --- a/src/plugins/vis_type_timelion/server/series_functions/fit.test.js +++ b/src/plugins/vis_type_timelion/server/series_functions/fit.test.js @@ -17,7 +17,7 @@ * under the License. */ -const fn = require(`src/plugins/vis_type_timelion`); +const fn = require(`src/plugins/vis_type_timelion/server/series_functions/fit`); import moment from 'moment'; const expect = require('chai').expect; import invoke from './helpers/invoke_series_fn.js'; From 9b0e44183b23c36955100460c6f43e69f0950eda Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Wed, 15 Apr 2020 17:49:10 +0200 Subject: [PATCH 14/15] remove unnecssary scss imports and adjust codeowner file --- .github/CODEOWNERS | 2 +- src/plugins/vis_type_timelion/public/index.scss | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8a8a79e7c5f65..6a5a323ab95c0 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -15,7 +15,7 @@ /src/legacy/core_plugins/vis_type_vislib/ @elastic/kibana-app /src/plugins/vis_type_xy/ @elastic/kibana-app /src/plugins/kibana_legacy/ @elastic/kibana-app -/src/plugins/timelion/ @elastic/kibana-app +/src/plugins/vis_type_timelion/ @elastic/kibana-app /src/plugins/dashboard/ @elastic/kibana-app /src/plugins/discover/ @elastic/kibana-app /src/plugins/vis_type_timeseries/ @elastic/kibana-app diff --git a/src/plugins/vis_type_timelion/public/index.scss b/src/plugins/vis_type_timelion/public/index.scss index 70aeabc100128..7203e51c6536f 100644 --- a/src/plugins/vis_type_timelion/public/index.scss +++ b/src/plugins/vis_type_timelion/public/index.scss @@ -1,11 +1,3 @@ -// EUI global scope - -@import '@elastic/eui/src/themes/eui/eui_colors_light'; - -@import '@elastic/eui/src/global_styling/functions/index'; -@import '@elastic/eui/src/global_styling/variables/index'; -@import '@elastic/eui/src/global_styling/mixins/index'; - @import '../public/timelion_vis'; @import '../public/timelion_editor'; @import '../public/components/index'; From 9750e369bd97998e680d5e10066c18361ce64af7 Mon Sep 17 00:00:00 2001 From: Joe Reuter Date: Thu, 16 Apr 2020 17:42:43 +0200 Subject: [PATCH 15/15] fix timelion app i18n and simplify stylesheet --- src/legacy/core_plugins/timelion/public/app.js | 3 ++- src/plugins/vis_type_timelion/public/index.scss | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/legacy/core_plugins/timelion/public/app.js b/src/legacy/core_plugins/timelion/public/app.js index 9cfa6a858ac88..7f5c7d4664af8 100644 --- a/src/legacy/core_plugins/timelion/public/app.js +++ b/src/legacy/core_plugins/timelion/public/app.js @@ -31,6 +31,7 @@ import { getTimezone } from '../../../../plugins/vis_type_timelion/public'; import 'uiExports/savedObjectTypes'; +require('ui/i18n'); require('ui/autoload/all'); // TODO: remove ui imports completely (move to plugins) @@ -57,7 +58,7 @@ require('plugins/timelion/directives/timelion_options_sheet'); document.title = 'Timelion - Kibana'; -const app = require('ui/modules').get('apps/timelion', []); +const app = require('ui/modules').get('apps/timelion', ['i18n', 'ngSanitize']); require('ui/routes').enable(); diff --git a/src/plugins/vis_type_timelion/public/index.scss b/src/plugins/vis_type_timelion/public/index.scss index 7203e51c6536f..00e9a88520961 100644 --- a/src/plugins/vis_type_timelion/public/index.scss +++ b/src/plugins/vis_type_timelion/public/index.scss @@ -1,3 +1,3 @@ -@import '../public/timelion_vis'; -@import '../public/timelion_editor'; -@import '../public/components/index'; +@import './timelion_vis'; +@import './timelion_editor'; +@import './components/index';