diff --git a/src/core/MIGRATION.md b/src/core/MIGRATION.md index 4dd6bedfa4f0c..c5e649f7d9d5c 100644 --- a/src/core/MIGRATION.md +++ b/src/core/MIGRATION.md @@ -1178,10 +1178,10 @@ import { setup, start } from '../core_plugins/visualizations/public/legacy'; | `ui/index_patterns` | `data.indexPatterns` | still in progress | | `ui/registry/field_formats` | `data.fieldFormats` | | | `ui/registry/feature_catalogue` | `home.featureCatalogue.register` | Must add `home` as a dependency in your kibana.json. | -| `ui/registry/vis_types` | `visualizations.types` | -- | -| `ui/vis` | `visualizations.types` | -- | +| `ui/registry/vis_types` | `visualizations` | -- | +| `ui/vis` | `visualizations` | -- | | `ui/share` | `share` | `showShareContextMenu` is now called `toggleShareContextMenu`, `ShareContextMenuExtensionsRegistryProvider` is now called `register` | -| `ui/vis/vis_factory` | `visualizations.types` | -- | +| `ui/vis/vis_factory` | `visualizations` | -- | | `ui/vis/vis_filters` | `visualizations.filters` | -- | | `ui/utils/parse_es_interval` | `import { parseEsInterval } from '../data/public'` | `parseEsInterval`, `ParsedInterval`, `InvalidEsCalendarIntervalError`, `InvalidEsIntervalFormatError` items were moved to the `Data Plugin` as a static code | diff --git a/src/legacy/core_plugins/data/public/search/expressions/esaggs.ts b/src/legacy/core_plugins/data/public/search/expressions/esaggs.ts index 24dd1c4944bfb..bb954cb887ef3 100644 --- a/src/legacy/core_plugins/data/public/search/expressions/esaggs.ts +++ b/src/legacy/core_plugins/data/public/search/expressions/esaggs.ts @@ -38,7 +38,7 @@ import { } from '../../../../../../plugins/data/public'; import { buildTabularInspectorData } from './build_tabular_inspector_data'; -import { calculateObjectHash } from '../../../../visualizations/public'; +import { calculateObjectHash } from '../../../../../../plugins/kibana_utils/common'; import { tabifyAggResponse } from '../../../../../core_plugins/data/public'; import { PersistedState } from '../../../../../../plugins/visualizations/public'; import { Adapters } from '../../../../../../plugins/inspector/public'; diff --git a/src/legacy/core_plugins/input_control_vis/public/input_control_vis_type.ts b/src/legacy/core_plugins/input_control_vis/public/input_control_vis_type.ts index 1bdff06b3a59f..dae6c9abb625e 100644 --- a/src/legacy/core_plugins/input_control_vis/public/input_control_vis_type.ts +++ b/src/legacy/core_plugins/input_control_vis/public/input_control_vis_type.ts @@ -22,8 +22,9 @@ import { i18n } from '@kbn/i18n'; import { createInputControlVisController } from './vis_controller'; import { getControlsTab } from './components/editor/controls_tab'; import { OptionsTab } from './components/editor/options_tab'; -import { Status, defaultFeedbackMessage } from '../../visualizations/public'; +import { Status } from '../../visualizations/public'; import { InputControlVisDependencies } from './plugin'; +import { defaultFeedbackMessage } from '../../../../plugins/kibana_utils/common'; export function createInputControlVisTypeDefinition(deps: InputControlVisDependencies) { const InputControlVisController = createInputControlVisController(deps); diff --git a/src/legacy/core_plugins/input_control_vis/public/plugin.ts b/src/legacy/core_plugins/input_control_vis/public/plugin.ts index e9ffad8b35f21..e85ccd94f9e6a 100644 --- a/src/legacy/core_plugins/input_control_vis/public/plugin.ts +++ b/src/legacy/core_plugins/input_control_vis/public/plugin.ts @@ -59,7 +59,7 @@ export class InputControlVisPlugin implements Plugin, void> { }; expressions.registerFunction(createInputControlVisFn); - visualizations.types.createBaseVisualization( + visualizations.createBaseVisualization( createInputControlVisTypeDefinition(visualizationDependencies) ); } diff --git a/src/legacy/core_plugins/kibana/public/discover/kibana_services.ts b/src/legacy/core_plugins/kibana/public/discover/kibana_services.ts index 91b5c7f13dc95..7fa5183a4f54b 100644 --- a/src/legacy/core_plugins/kibana/public/discover/kibana_services.ts +++ b/src/legacy/core_plugins/kibana/public/discover/kibana_services.ts @@ -50,7 +50,6 @@ export function setServices(newServices: any) { // EXPORT legacy static dependencies, should be migrated when available in a new version; export { angular }; export { wrapInI18nContext } from 'ui/i18n'; -export { buildVislibDimensions } from '../../../visualizations/public'; export { getRequestInspectorStats, getResponseInspectorStats } from '../../../data/public'; // @ts-ignore export { intervalOptions } from 'ui/agg_types'; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js index fb4158a6e3e03..81c10798936f5 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/angular/discover.js @@ -45,7 +45,6 @@ import { getPainlessError } from './get_painless_error'; import { discoverResponseHandler } from './response_handler'; import { angular, - buildVislibDimensions, getRequestInspectorStats, getResponseInspectorStats, getServices, @@ -76,6 +75,7 @@ const { import { getRootBreadcrumbs, getSavedSearchBreadcrumbs } from '../helpers/breadcrumbs'; import { esFilters, + fieldFormats, indexPatterns as indexPatternsUtils, } from '../../../../../../../plugins/data/public'; import { getIndexPatternId } from '../helpers/get_index_pattern_id'; @@ -812,21 +812,45 @@ function discoverController( $fetchObservable.next(); }; + function getDimensions(aggs, timeRange) { + const [metric, agg] = aggs; + agg.params.timeRange = timeRange; + const bounds = agg.params.timeRange ? timefilter.calculateBounds(agg.params.timeRange) : null; + agg.buckets.setBounds(bounds); + + const { esUnit, esValue } = agg.buckets.getInterval(); + return { + x: { + accessor: 0, + label: agg.makeLabel(), + format: fieldFormats.serialize(agg), + params: { + date: true, + interval: moment.duration(esValue, esUnit), + intervalESValue: esValue, + intervalESUnit: esUnit, + format: agg.buckets.getScaledDateFormat(), + bounds: agg.buckets.getBounds(), + }, + }, + y: { + accessor: 1, + format: fieldFormats.serialize(metric), + label: metric.makeLabel(), + }, + }; + } + function onResults(resp) { logInspectorResponse(resp); if ($scope.opts.timefield) { const tabifiedData = tabifyAggResponse($scope.vis.aggs, resp); $scope.searchSource.rawResponse = resp; - Promise.resolve( - buildVislibDimensions($scope.vis, { - timefilter, - timeRange: $scope.timeRange, - searchSource: $scope.searchSource, - }) - ).then(resp => { - $scope.histogramData = discoverResponseHandler(tabifiedData, resp); - }); + $scope.histogramData = discoverResponseHandler( + tabifiedData, + getDimensions($scope.vis.aggs.aggs, $scope.timeRange) + ); } $scope.hits = resp.hits.total; @@ -993,7 +1017,7 @@ function discoverController( }, }; - $scope.vis = new visualizations.Vis( + $scope.vis = visualizations.createVis( $scope.searchSource.getField('index'), visSavedObject.visState ); diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/field_chooser/lib/visualize_url_utils.ts b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/field_chooser/lib/visualize_url_utils.ts index 8dbf3cd79ccb1..7ea1863693e0d 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/components/field_chooser/lib/visualize_url_utils.ts +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/components/field_chooser/lib/visualize_url_utils.ts @@ -29,7 +29,7 @@ import { getServices } from '../../../../kibana_services'; function getMapsAppBaseUrl() { const mapsAppVisAlias = getServices() - .visualizations.types.getAliases() + .visualizations.getAliases() .find(({ name }) => { return name === 'maps'; }); @@ -38,7 +38,7 @@ function getMapsAppBaseUrl() { export function isMapsAppRegistered() { return getServices() - .visualizations.types.getAliases() + .visualizations.getAliases() .some(({ name }) => { return name === 'maps'; }); diff --git a/src/legacy/core_plugins/kibana/public/management/saved_object_registry.ts b/src/legacy/core_plugins/kibana/public/management/saved_object_registry.ts index 604575a6e6220..8e73a09480c41 100644 --- a/src/legacy/core_plugins/kibana/public/management/saved_object_registry.ts +++ b/src/legacy/core_plugins/kibana/public/management/saved_object_registry.ts @@ -22,7 +22,7 @@ import { i18n } from '@kbn/i18n'; import { npStart } from 'ui/new_platform'; import { SavedObjectLoader } from '../../../../../plugins/saved_objects/public'; import { createSavedDashboardLoader } from '../dashboard'; -import { TypesService, createSavedVisLoader } from '../../../visualizations/public'; +import { start as visualizations } from '../../../visualizations/public/np_ready/public/legacy'; import { createSavedSearchesLoader } from '../../../../../plugins/discover/public'; /** @@ -58,10 +58,7 @@ const services = { savedObjectManagementRegistry.register({ id: 'savedVisualizations', - service: createSavedVisLoader({ - ...services, - ...{ visualizationTypes: new TypesService().start() }, - }), + service: visualizations.savedVisualizationsLoader, title: 'visualizations', }); diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/legacy_app.js b/src/legacy/core_plugins/kibana/public/visualize/np_ready/legacy_app.js index 7079023e5bfa3..b9409445166bc 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/np_ready/legacy_app.js +++ b/src/legacy/core_plugins/kibana/public/visualize/np_ready/legacy_app.js @@ -102,7 +102,7 @@ export function initVisualizeApp(app, deps) { resolve: { savedVis: function(redirectWhenMissing, $route, $rootScope, kbnUrl) { const { core, data, savedVisualizations, visualizations } = deps; - const visTypes = visualizations.types.all(); + const visTypes = visualizations.all(); const visType = find(visTypes, { name: $route.current.params.type }); const shouldHaveIndex = visType.requiresSearch && visType.options.showIndexSelection; const hasIndex = diff --git a/src/legacy/core_plugins/region_map/public/__tests__/region_map_visualization.js b/src/legacy/core_plugins/region_map/public/__tests__/region_map_visualization.js index f11aab9b9db88..6bdb5d00e67d8 100644 --- a/src/legacy/core_plugins/region_map/public/__tests__/region_map_visualization.js +++ b/src/legacy/core_plugins/region_map/public/__tests__/region_map_visualization.js @@ -111,9 +111,7 @@ describe('RegionMapsVisualizationTests', function() { if (!visRegComplete) { visRegComplete = true; - visualizationsSetup.types.createBaseVisualization( - createRegionMapTypeDefinition(dependencies) - ); + visualizationsSetup.createBaseVisualization(createRegionMapTypeDefinition(dependencies)); } RegionMapsVisualization = createRegionMapVisualization(dependencies); @@ -160,7 +158,7 @@ describe('RegionMapsVisualizationTests', function() { imageComparator = new ImageComparator(); - vis = new visualizationsStart.Vis(indexPattern, { + vis = visualizationsStart.createVis(indexPattern, { type: 'region_map', }); diff --git a/src/legacy/core_plugins/region_map/public/plugin.ts b/src/legacy/core_plugins/region_map/public/plugin.ts index aaf0a8a308aea..98fb5604c3d65 100644 --- a/src/legacy/core_plugins/region_map/public/plugin.ts +++ b/src/legacy/core_plugins/region_map/public/plugin.ts @@ -70,7 +70,7 @@ export class RegionMapPlugin implements Plugin, void> { expressions.registerFunction(createRegionMapFn); - visualizations.types.createBaseVisualization( + visualizations.createBaseVisualization( createRegionMapTypeDefinition(visualizationDependencies) ); } diff --git a/src/legacy/core_plugins/tile_map/public/__tests__/coordinate_maps_visualization.js b/src/legacy/core_plugins/tile_map/public/__tests__/coordinate_maps_visualization.js index 27e9459c7e06c..6a08405b5b6a5 100644 --- a/src/legacy/core_plugins/tile_map/public/__tests__/coordinate_maps_visualization.js +++ b/src/legacy/core_plugins/tile_map/public/__tests__/coordinate_maps_visualization.js @@ -88,9 +88,7 @@ describe('CoordinateMapsVisualizationTest', function() { if (!visRegComplete) { visRegComplete = true; - visualizationsSetup.types.createBaseVisualization( - createTileMapTypeDefinition(dependencies) - ); + visualizationsSetup.createBaseVisualization(createTileMapTypeDefinition(dependencies)); } CoordinateMapsVisualization = createTileMapVisualization(dependencies); @@ -126,7 +124,7 @@ describe('CoordinateMapsVisualizationTest', function() { setupDOM('512px', '512px'); imageComparator = new ImageComparator(); - vis = new visualizationsStart.Vis(indexPattern, { + vis = visualizationsStart.createVis(indexPattern, { type: 'tile_map', }); vis.params = { diff --git a/src/legacy/core_plugins/tile_map/public/plugin.ts b/src/legacy/core_plugins/tile_map/public/plugin.ts index 52acaf51b39b1..a12c2753cc525 100644 --- a/src/legacy/core_plugins/tile_map/public/plugin.ts +++ b/src/legacy/core_plugins/tile_map/public/plugin.ts @@ -64,9 +64,7 @@ export class TileMapPlugin implements Plugin, void> { expressions.registerFunction(() => createTileMapFn(visualizationDependencies)); - visualizations.types.createBaseVisualization( - createTileMapTypeDefinition(visualizationDependencies) - ); + visualizations.createBaseVisualization(createTileMapTypeDefinition(visualizationDependencies)); } public start(core: CoreStart) { diff --git a/src/legacy/core_plugins/timelion/public/app.js b/src/legacy/core_plugins/timelion/public/app.js index e4a48c09db832..a9d678cfea79c 100644 --- a/src/legacy/core_plugins/timelion/public/app.js +++ b/src/legacy/core_plugins/timelion/public/app.js @@ -42,7 +42,7 @@ import '../../data/public/legacy'; import './services/saved_sheet_register'; import rootTemplate from 'plugins/timelion/index.html'; -import { createSavedVisLoader, TypesService } from '../../visualizations/public'; +import { start as visualizations } from '../../visualizations/public/np_ready/public/legacy'; import { loadKbnTopNavDirectives } from '../../../../plugins/kibana_legacy/public'; loadKbnTopNavDirectives(npStart.plugins.navigation.ui); @@ -127,13 +127,7 @@ app.controller('timelion', function( timefilter.enableAutoRefreshSelector(); timefilter.enableTimeRangeSelector(); - const savedVisualizations = createSavedVisLoader({ - savedObjectsClient: npStart.core.savedObjects.client, - indexPatterns: npStart.plugins.data.indexPatterns, - chrome: npStart.core.chrome, - overlays: npStart.core.overlays, - visualizationTypes: new TypesService().start(), - }); + const savedVisualizations = visualizations.savedVisualizationsLoader; const timezone = Private(timezoneProvider)(); const defaultExpression = '.es(*)'; diff --git a/src/legacy/core_plugins/vis_type_markdown/public/plugin.ts b/src/legacy/core_plugins/vis_type_markdown/public/plugin.ts index f131664756202..71d6c1c69ef2d 100644 --- a/src/legacy/core_plugins/vis_type_markdown/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_markdown/public/plugin.ts @@ -39,7 +39,7 @@ export class MarkdownPlugin implements Plugin { } public setup(core: CoreSetup, { expressions, visualizations }: MarkdownPluginSetupDependencies) { - visualizations.types.createReactVisualization(markdownVisDefinition); + visualizations.createReactVisualization(markdownVisDefinition); expressions.registerFunction(createMarkdownVisFn); } 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 67b5d018f4638..5dbd59f3f1709 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 @@ -40,7 +40,7 @@ describe('metric_vis - createMetricVisTypeDefinition', () => { let vis: Vis; beforeAll(() => { - visualizationsSetup.types.createReactVisualization(createMetricVisTypeDefinition()); + visualizationsSetup.createReactVisualization(createMetricVisTypeDefinition()); (npStart.plugins.data.fieldFormats.getType as jest.Mock).mockImplementation(() => { return fieldFormats.UrlFormat; }); @@ -59,7 +59,7 @@ describe('metric_vis - createMetricVisTypeDefinition', () => { // TODO: remove when Vis is converted to typescript. Only importing Vis as type // @ts-ignore - vis = new visualizationsStart.Vis(stubIndexPattern, { + vis = visualizationsStart.createVis(stubIndexPattern, { type: 'metric', aggs: [{ id: '1', type: 'top_hits', schema: 'metric', params: { field: 'ip' } }], }); @@ -80,7 +80,7 @@ describe('metric_vis - createMetricVisTypeDefinition', () => { }; const el = document.createElement('div'); - const metricVisType = visualizationsStart.types.get('metric'); + const metricVisType = visualizationsStart.get('metric'); const Controller = metricVisType.visualization; const controller = new Controller(el, vis); const render = (esResponse: any) => { diff --git a/src/legacy/core_plugins/vis_type_metric/public/plugin.ts b/src/legacy/core_plugins/vis_type_metric/public/plugin.ts index 082fab47e573c..28b435cbc7980 100644 --- a/src/legacy/core_plugins/vis_type_metric/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_metric/public/plugin.ts @@ -45,7 +45,7 @@ export class MetricVisPlugin implements Plugin { { expressions, visualizations, charts }: MetricVisPluginSetupDependencies ) { expressions.registerFunction(createMetricVisFn); - visualizations.types.createReactVisualization(createMetricVisTypeDefinition()); + visualizations.createReactVisualization(createMetricVisTypeDefinition()); } public start(core: CoreStart) { diff --git a/src/legacy/core_plugins/vis_type_table/public/agg_table/__tests__/agg_table.js b/src/legacy/core_plugins/vis_type_table/public/agg_table/__tests__/agg_table.js index 9fe7920588cd2..91581923b05cb 100644 --- a/src/legacy/core_plugins/vis_type_table/public/agg_table/__tests__/agg_table.js +++ b/src/legacy/core_plugins/vis_type_table/public/agg_table/__tests__/agg_table.js @@ -47,10 +47,10 @@ describe('Table Vis - AggTable Directive', function() { const tabifiedData = {}; const init = () => { - const vis1 = new visualizationsStart.Vis(indexPattern, 'table'); + const vis1 = visualizationsStart.createVis(indexPattern, 'table'); tabifiedData.metricOnly = tabifyAggResponse(vis1.aggs, metricOnly); - const vis2 = new visualizationsStart.Vis(indexPattern, { + const vis2 = visualizationsStart.createVis(indexPattern, { type: 'table', params: { showMetricsAtAllLevels: true, @@ -69,7 +69,7 @@ describe('Table Vis - AggTable Directive', function() { metricsAtAllLevels: true, }); - const vis3 = new visualizationsStart.Vis(indexPattern, { + const vis3 = visualizationsStart.createVis(indexPattern, { type: 'table', aggs: [ { type: 'avg', schema: 'metric', params: { field: 'bytes' } }, @@ -110,7 +110,7 @@ describe('Table Vis - AggTable Directive', function() { beforeEach(initLocalAngular); ngMock.inject(function() { - visualizationsSetup.types.createBaseVisualization(tableVisTypeDefinition); + visualizationsSetup.createBaseVisualization(tableVisTypeDefinition); }); beforeEach(ngMock.module('kibana/table_vis')); diff --git a/src/legacy/core_plugins/vis_type_table/public/agg_table/__tests__/agg_table_group.js b/src/legacy/core_plugins/vis_type_table/public/agg_table/__tests__/agg_table_group.js index 79d4d7c40d355..4d62551dcf396 100644 --- a/src/legacy/core_plugins/vis_type_table/public/agg_table/__tests__/agg_table_group.js +++ b/src/legacy/core_plugins/vis_type_table/public/agg_table/__tests__/agg_table_group.js @@ -35,10 +35,10 @@ describe('Table Vis - AggTableGroup Directive', function() { const tabifiedData = {}; const init = () => { - const vis1 = new visualizationsStart.Vis(indexPattern, 'table'); + const vis1 = visualizationsStart.createVis(indexPattern, 'table'); tabifiedData.metricOnly = tabifyAggResponse(vis1.aggs, metricOnly); - const vis2 = new visualizationsStart.Vis(indexPattern, { + const vis2 = visualizationsStart.createVis(indexPattern, { type: 'pie', aggs: [ { type: 'avg', schema: 'metric', params: { field: 'bytes' } }, diff --git a/src/legacy/core_plugins/vis_type_table/public/plugin.ts b/src/legacy/core_plugins/vis_type_table/public/plugin.ts index 17c50b0567b67..519a56da23ac9 100644 --- a/src/legacy/core_plugins/vis_type_table/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_table/public/plugin.ts @@ -44,7 +44,7 @@ export class TableVisPlugin implements Plugin, void> { ) { expressions.registerFunction(createTableVisFn); - visualizations.types.createBaseVisualization(tableVisTypeDefinition); + visualizations.createBaseVisualization(tableVisTypeDefinition); } public start(core: CoreStart) { diff --git a/src/legacy/core_plugins/vis_type_tagcloud/public/components/__tests__/tag_cloud_visualization.js b/src/legacy/core_plugins/vis_type_tagcloud/public/components/__tests__/tag_cloud_visualization.js index 55ecf98f994d2..3091b3340cd6d 100644 --- a/src/legacy/core_plugins/vis_type_tagcloud/public/components/__tests__/tag_cloud_visualization.js +++ b/src/legacy/core_plugins/vis_type_tagcloud/public/components/__tests__/tag_cloud_visualization.js @@ -76,7 +76,7 @@ describe('TagCloudVisualizationTest', function() { beforeEach(async function() { setupDOM('512px', '512px'); imageComparator = new ImageComparator(); - vis = new visualizationsStart.Vis(indexPattern, { + vis = visualizationsStart.createVis(indexPattern, { type: 'tagcloud', params: { bucket: { accessor: 0, format: {} }, diff --git a/src/legacy/core_plugins/vis_type_tagcloud/public/plugin.ts b/src/legacy/core_plugins/vis_type_tagcloud/public/plugin.ts index 9e5940eca1598..8244cba38edc3 100644 --- a/src/legacy/core_plugins/vis_type_tagcloud/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_tagcloud/public/plugin.ts @@ -53,7 +53,7 @@ export class TagCloudPlugin implements Plugin { colors: charts.colors, }; expressions.registerFunction(createTagCloudFn); - visualizations.types.createBaseVisualization( + visualizations.createBaseVisualization( createTagCloudVisTypeDefinition(visualizationDependencies) ); } diff --git a/src/legacy/core_plugins/vis_type_timelion/public/plugin.ts b/src/legacy/core_plugins/vis_type_timelion/public/plugin.ts index 69a2ad3c1351a..9d69c312b48f4 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_timelion/public/plugin.ts @@ -66,7 +66,7 @@ export class TimelionVisPlugin implements Plugin { }; expressions.registerFunction(() => getTimelionVisualizationConfig(dependencies)); - visualizations.types.createReactVisualization(getTimelionVisDefinition(dependencies)); + visualizations.createReactVisualization(getTimelionVisDefinition(dependencies)); } public start(core: CoreStart, plugins: PluginsStart) { diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/metrics_type.ts b/src/legacy/core_plugins/vis_type_timeseries/public/metrics_type.ts index 135cc1e181432..30c62d778933b 100644 --- a/src/legacy/core_plugins/vis_type_timeseries/public/metrics_type.ts +++ b/src/legacy/core_plugins/vis_type_timeseries/public/metrics_type.ts @@ -25,7 +25,7 @@ import { metricsRequestHandler } from './request_handler'; import { EditorController } from './editor_controller'; // @ts-ignore import { PANEL_TYPES } from '../../../../plugins/vis_type_timeseries/common/panel_types'; -import { defaultFeedbackMessage } from '../../visualizations/public'; +import { defaultFeedbackMessage } from '../../../../plugins/kibana_utils/common'; export const metricsVisDefinition = { name: 'metrics', diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/plugin.ts b/src/legacy/core_plugins/vis_type_timeseries/public/plugin.ts index 38a9c68487854..441b1f05ea78c 100644 --- a/src/legacy/core_plugins/vis_type_timeseries/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_timeseries/public/plugin.ts @@ -57,7 +57,7 @@ export class MetricsPlugin implements Plugin, void> { ) { expressions.registerFunction(createMetricsFn); setUISettings(core.uiSettings); - visualizations.types.createReactVisualization(metricsVisDefinition); + visualizations.createReactVisualization(metricsVisDefinition); } public start(core: CoreStart, { data }: MetricsPluginStartDependencies) { diff --git a/src/legacy/core_plugins/vis_type_vega/public/__tests__/vega_visualization.js b/src/legacy/core_plugins/vis_type_vega/public/__tests__/vega_visualization.js index 378590af29d3a..5befc09b24544 100644 --- a/src/legacy/core_plugins/vis_type_vega/public/__tests__/vega_visualization.js +++ b/src/legacy/core_plugins/vis_type_vega/public/__tests__/vega_visualization.js @@ -93,7 +93,7 @@ describe('VegaVisualizations', () => { if (!visRegComplete) { visRegComplete = true; - visualizationsSetup.types.createBaseVisualization( + visualizationsSetup.createBaseVisualization( createVegaTypeDefinition(vegaVisualizationDependencies) ); } @@ -108,7 +108,7 @@ describe('VegaVisualizations', () => { setupDOM('512px', '512px'); imageComparator = new ImageComparator(); - vis = new visualizationsStart.Vis(indexPattern, { type: 'vega' }); + vis = visualizationsStart.createVis(indexPattern, { type: 'vega' }); }); afterEach(function() { diff --git a/src/legacy/core_plugins/vis_type_vega/public/plugin.ts b/src/legacy/core_plugins/vis_type_vega/public/plugin.ts index b354433330caf..3b01d9ceca5a6 100644 --- a/src/legacy/core_plugins/vis_type_vega/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_vega/public/plugin.ts @@ -84,9 +84,7 @@ export class VegaPlugin implements Plugin, void> { expressions.registerFunction(() => createVegaFn(visualizationDependencies)); - visualizations.types.createBaseVisualization( - createVegaTypeDefinition(visualizationDependencies) - ); + visualizations.createBaseVisualization(createVegaTypeDefinition(visualizationDependencies)); } public start(core: CoreStart, { data }: VegaPluginStartDependencies) { 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 a84948f725e0a..78f9c170ab62d 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 @@ -19,10 +19,11 @@ import { i18n } from '@kbn/i18n'; // @ts-ignore -import { Status, defaultFeedbackMessage } from '../../visualizations/public'; +import { Status } from '../../visualizations/public'; import { DefaultEditorSize } from '../../vis_default_editor/public'; import { VegaVisualizationDependencies } from './plugin'; import { VegaVisEditor } from './components'; +import { defaultFeedbackMessage } from '../../../../plugins/kibana_utils/common'; import { createVegaRequestHandler } from './vega_request_handler'; // @ts-ignore diff --git a/src/legacy/core_plugins/vis_type_vislib/public/plugin.ts b/src/legacy/core_plugins/vis_type_vislib/public/plugin.ts index 8a7196a61ecec..a71892cc47b05 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/plugin.ts @@ -97,14 +97,14 @@ export class VisTypeVislibPlugin implements Plugin, void> { // Register legacy vislib types that have been converted convertedFns.forEach(expressions.registerFunction); convertedTypes.forEach(vis => - visualizations.types.createBaseVisualization(vis(visualizationDependencies)) + visualizations.createBaseVisualization(vis(visualizationDependencies)) ); } // Register non-converted types vislibFns.forEach(expressions.registerFunction); vislibTypes.forEach(vis => - visualizations.types.createBaseVisualization(vis(visualizationDependencies)) + visualizations.createBaseVisualization(vis(visualizationDependencies)) ); } diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/pie_chart.js b/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/pie_chart.js index 9c9c5a84f046c..43e3b987f1962 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/pie_chart.js +++ b/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/pie_chart.js @@ -133,7 +133,7 @@ describe('No global chart settings', function() { responseHandler = vislibSlicesResponseHandler; let id1 = 1; - stubVis1 = new visualizationsStart.Vis(indexPattern, { + stubVis1 = visualizationsStart.createVis(indexPattern, { type: 'pie', aggs: rowAgg, }); @@ -222,7 +222,7 @@ describe('Vislib PieChart Class Test Suite', function() { responseHandler = vislibSlicesResponseHandler; let id = 1; - stubVis = new visualizationsStart.Vis(indexPattern, { + stubVis = visualizationsStart.createVis(indexPattern, { type: 'pie', aggs: dataAgg, }); diff --git a/src/legacy/core_plugins/vis_type_xy/public/plugin.ts b/src/legacy/core_plugins/vis_type_xy/public/plugin.ts index 59bb64b337256..35abb04fd8732 100644 --- a/src/legacy/core_plugins/vis_type_xy/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_xy/public/plugin.ts @@ -72,7 +72,7 @@ export class VisTypeXyPlugin implements Plugin, void> { visFunctions.forEach((fn: any) => expressions.registerFunction(fn)); visTypeDefinitions.forEach((vis: any) => - visualizations.types.createBaseVisualization(vis(visualizationDependencies)) + visualizations.createBaseVisualization(vis(visualizationDependencies)) ); } diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/index.ts b/src/legacy/core_plugins/visualizations/public/np_ready/public/index.ts index 7688a7769cf79..b59eb2277411c 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/index.ts +++ b/src/legacy/core_plugins/visualizations/public/np_ready/public/index.ts @@ -43,20 +43,11 @@ export { Vis, VisParams, VisState } from './vis'; import { VisualizeEmbeddableFactory, VisualizeEmbeddable } from './embeddable'; export type VisualizeEmbeddableFactoryContract = PublicContract; export type VisualizeEmbeddableContract = PublicContract; +export { TypesService } from './vis_types/types_service'; +export { Status } from './legacy/update_status'; // should remove +export { VISUALIZE_EMBEDDABLE_TYPE, VisualizeInput } from './embeddable'; +export { SchemaConfig } from './legacy/build_pipeline'; export function plugin(initializerContext: PluginInitializerContext) { return new VisualizationsPlugin(initializerContext); } - -/** @public static code */ -export { TypesService } from './vis_types/types_service'; -export { VISUALIZE_EMBEDDABLE_TYPE, VisualizeInput } from './embeddable'; - -export { Status } from './legacy/update_status'; -export { buildPipeline, buildVislibDimensions, SchemaConfig } from './legacy/build_pipeline'; - -// @ts-ignore -export { updateOldState } from './legacy/vis_update_state'; -export { calculateObjectHash } from './legacy/calculate_object_hash'; -export { createSavedVisLoader } from './saved_visualizations/saved_visualizations'; -export { defaultFeedbackMessage } from './misc/default_feedback_message'; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/__tests__/_vis.js b/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/__tests__/_vis.js index 8c75ba24051b0..deb345a77cdb6 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/__tests__/_vis.js +++ b/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/__tests__/_vis.js @@ -43,12 +43,12 @@ describe('Vis Class', function() { beforeEach( ngMock.inject(function(Private) { indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); - visTypes = visualizations.types; + visTypes = visualizations; }) ); beforeEach(function() { - vis = new visualizations.Vis(indexPattern, stateFixture); + vis = visualizations.createVis(indexPattern, stateFixture); }); const verifyVis = function(vis) { @@ -84,7 +84,7 @@ describe('Vis Class', function() { describe('setState()', function() { it('should set the state to defaults', function() { - const vis = new visualizations.Vis(indexPattern); + const vis = visualizations.createVis(indexPattern); expect(vis).to.have.property('type'); expect(vis.type).to.eql(visTypes.get('histogram')); expect(vis).to.have.property('aggs'); @@ -100,7 +100,7 @@ describe('Vis Class', function() { expect(vis.isHierarchical()).to.be(true); }); it('should return false for non-hierarchical vis (like histogram)', function() { - const vis = new visualizations.Vis(indexPattern); + const vis = visualizations.createVis(indexPattern); expect(vis.isHierarchical()).to.be(false); }); }); diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/calculate_object_hash.d.ts b/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/calculate_object_hash.d.ts deleted file mode 100644 index d2d11c14a3e5f..0000000000000 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/calculate_object_hash.d.ts +++ /dev/null @@ -1,20 +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 function calculateObjectHash(obj: object): string; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/update_status.ts b/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/update_status.ts index d9af5122eadec..92a9ce8366f4f 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/update_status.ts +++ b/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/update_status.ts @@ -18,7 +18,7 @@ */ import { PersistedState } from '../../../../../../../plugins/visualizations/public'; -import { calculateObjectHash } from './calculate_object_hash'; +import { calculateObjectHash } from '../../../../../../../plugins/kibana_utils/common'; import { Vis } from '../vis'; enum Status { diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/mocks.ts b/src/legacy/core_plugins/visualizations/public/np_ready/public/mocks.ts index 8d7407b6191d6..9e8eac08c33ea 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/mocks.ts +++ b/src/legacy/core_plugins/visualizations/public/np_ready/public/mocks.ts @@ -28,23 +28,19 @@ import { usageCollectionPluginMock } from '../../../../../../plugins/usage_colle import { uiActionsPluginMock } from '../../../../../../plugins/ui_actions/public/mocks'; const createSetupContract = (): VisualizationsSetup => ({ - types: { - createBaseVisualization: jest.fn(), - createReactVisualization: jest.fn(), - registerAlias: jest.fn(), - hideTypes: jest.fn(), - }, + createBaseVisualization: jest.fn(), + createReactVisualization: jest.fn(), + registerAlias: jest.fn(), + hideTypes: jest.fn(), }); const createStartContract = (): VisualizationsStart => ({ - types: { - get: jest.fn(), - all: jest.fn(), - getAliases: jest.fn(), - }, + get: jest.fn(), + all: jest.fn(), + getAliases: jest.fn(), savedVisualizationsLoader: {} as any, showNewVisModal: jest.fn(), - Vis: jest.fn(), + createVis: jest.fn(), }); const createInstance = async () => { diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/plugin.ts b/src/legacy/core_plugins/visualizations/public/np_ready/public/plugin.ts index 10797a1a04df4..b8db611f30815 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/plugin.ts +++ b/src/legacy/core_plugins/visualizations/public/np_ready/public/plugin.ts @@ -48,27 +48,27 @@ import { visualization as visualizationRenderer } from './expressions/visualizat import { DataPublicPluginSetup, DataPublicPluginStart, + IIndexPattern, } from '../../../../../../plugins/data/public'; import { UsageCollectionSetup } from '../../../../../../plugins/usage_collection/public'; import { createSavedVisLoader, SavedVisualizationsLoader } from './saved_visualizations'; -import { VisImpl, VisImplConstructor } from './vis_impl'; +import { VisImpl } from './vis_impl'; import { showNewVisModal } from './wizard'; import { UiActionsStart } from '../../../../../../plugins/ui_actions/public'; import { DataStart as LegacyDataStart } from '../../../../data/public'; +import { VisState } from './types'; /** * Interface for this plugin's returned setup/start contracts. * * @public */ -export interface VisualizationsSetup { - types: TypesSetup; -} -export interface VisualizationsStart { - types: TypesStart; +export type VisualizationsSetup = TypesSetup; + +export interface VisualizationsStart extends TypesStart { savedVisualizationsLoader: SavedVisualizationsLoader; - Vis: VisImplConstructor; + createVis: (indexPattern: IIndexPattern, visState?: VisState) => VisImpl; showNewVisModal: typeof showNewVisModal; } @@ -122,7 +122,7 @@ export class VisualizationsPlugin embeddable.registerEmbeddableFactory(VISUALIZE_EMBEDDABLE_TYPE, embeddableFactory); return { - types: this.types.setup(), + ...this.types.setup(), }; } @@ -152,9 +152,15 @@ export class VisualizationsPlugin setSavedVisualizationsLoader(savedVisualizationsLoader); return { - types, + ...types, showNewVisModal, - Vis: VisImpl, + /** + * creates new instance of Vis + * @param {IIndexPattern} indexPattern - index pattern to use + * @param {VisState} visState - visualization configuration + */ + createVis: (indexPattern: IIndexPattern, visState?: VisState) => + new VisImpl(indexPattern, visState), savedVisualizationsLoader, }; } diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/_saved_vis.ts b/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/_saved_vis.ts index 2458ed5008ddd..e381a01edef8b 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/_saved_vis.ts +++ b/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/_saved_vis.ts @@ -29,7 +29,8 @@ import { SavedObject, SavedObjectKibanaServices, } from '../../../../../../../plugins/saved_objects/public'; -import { updateOldState } from '../../../index'; +// @ts-ignore +import { updateOldState } from '../legacy/vis_update_state'; import { extractReferences, injectReferences } from './saved_visualization_references'; import { IIndexPattern } from '../../../../../../../plugins/data/public'; import { VisSavedObject } from '../types'; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/types_service.ts b/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/types_service.ts index 0cae83afb7861..6bcaa9a3e1dac 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/types_service.ts +++ b/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/types_service.ts @@ -67,15 +67,32 @@ export class TypesService { this.types[visDefinition.name] = visDefinition; }; return { + /** + * registers a visualization type + * @param {VisType} config - visualization type definition + */ createBaseVisualization: (config: any) => { const vis = new BaseVisType(config); registerVisualization(() => vis); }, + /** + * registers a visualization which uses react for rendering + * @param {VisType} config - visualization type definition + */ createReactVisualization: (config: any) => { const vis = new ReactVisType(config); registerVisualization(() => vis); }, + /** + * registers a visualization alias + * alias is a visualization type without implementation, it just redirects somewhere in kibana + * @param {VisTypeAlias} config - visualization alias definition + */ registerAlias: visTypeAliasRegistry.add, + /** + * allows to hide specific visualization types from create visualization dialog + * @param {string[]} typeNames - list of type ids to hide + */ hideTypes: (typeNames: string[]) => { typeNames.forEach((name: string) => { if (this.types[name]) { @@ -90,12 +107,22 @@ export class TypesService { public start() { return { + /** + * returns specific visualization or undefined if not found + * @param {string} visualization - id of visualization to return + */ get: (visualization: string) => { return this.types[visualization]; }, + /** + * returns all registered visualization types + */ all: () => { return [...Object.values(this.types)]; }, + /** + * returns all registered aliases + */ getAliases: visTypeAliasRegistry.get, }; } diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/show_new_vis.tsx b/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/show_new_vis.tsx index a79c6ad98edf6..6b37845f03db1 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/show_new_vis.tsx +++ b/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/show_new_vis.tsx @@ -29,6 +29,11 @@ export interface ShowNewVisModalParams { onClose?: () => void; } +/** + * shows modal dialog that allows you to create new visualization + * @param {string[]} editorParams + * @param {function} onClose - function that will be called when dialog is closed + */ export function showNewVisModal({ editorParams = [], onClose }: ShowNewVisModalParams = {}) { const container = document.createElement('div'); let isClosed = false; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/calculate_object_hash.js b/src/plugins/kibana_utils/common/calculate_object_hash.ts similarity index 80% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/calculate_object_hash.js rename to src/plugins/kibana_utils/common/calculate_object_hash.ts index 0b6f3dc4e0826..26062636d624c 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/calculate_object_hash.js +++ b/src/plugins/kibana_utils/common/calculate_object_hash.ts @@ -19,14 +19,14 @@ // adopted form https://github.com/bevacqua/hash-sum -function pad(hash, len) { +function pad(hash: string, len: number): string { while (hash.length < len) { hash = '0' + hash; } return hash; } -function fold(hash, text) { +function fold(hash: number, text: string): number { let i; let chr; let len; @@ -35,22 +35,25 @@ function fold(hash, text) { } for (i = 0, len = text.length; i < len; i++) { chr = text.charCodeAt(i); + // eslint-disable-next-line no-bitwise hash = (hash << 5) - hash + chr; + // eslint-disable-next-line no-bitwise hash |= 0; } return hash < 0 ? hash * -2 : hash; } -function foldObject(hash, o, seen) { +function foldObject(hash: number, o: any, seen: any[]) { + function foldKey(h: number, key: string): number { + return foldValue(h, o[key], key, seen); + } + return Object.keys(o) .sort() .reduce(foldKey, hash); - function foldKey(hash, key) { - return foldValue(hash, o[key], key, seen); - } } -function foldValue(input, value, key, seen) { +function foldValue(input: number, value: any, key: string, seen: any[]) { const hash = fold(fold(fold(input, key), toString(value)), typeof value); if (value === null) { return fold(hash, 'null'); @@ -72,11 +75,11 @@ function foldValue(input, value, key, seen) { return fold(hash, value.toString()); } -function toString(o) { +function toString(o: object): string { return Object.prototype.toString.call(o); } -function sum(o) { +function sum(o: object): string { return pad(foldValue(0, o, '', []).toString(16), 8); } diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/misc/default_feedback_message.test.ts b/src/plugins/kibana_utils/common/default_feedback_message.test.ts similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/misc/default_feedback_message.test.ts rename to src/plugins/kibana_utils/common/default_feedback_message.test.ts diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/misc/default_feedback_message.ts b/src/plugins/kibana_utils/common/default_feedback_message.ts similarity index 91% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/misc/default_feedback_message.ts rename to src/plugins/kibana_utils/common/default_feedback_message.ts index 2871437614231..f61f36bc8810c 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/misc/default_feedback_message.ts +++ b/src/plugins/kibana_utils/common/default_feedback_message.ts @@ -19,7 +19,7 @@ import { i18n } from '@kbn/i18n'; -export const defaultFeedbackMessage = i18n.translate('visualizations.defaultFeedbackMessage', { +export const defaultFeedbackMessage = i18n.translate('kibana_utils.defaultFeedbackMessage', { defaultMessage: 'Have feedback? Please create an issue in {link}.', values: { link: diff --git a/src/plugins/kibana_utils/common/index.ts b/src/plugins/kibana_utils/common/index.ts index 50120edc0c056..87b625ef9a64f 100644 --- a/src/plugins/kibana_utils/common/index.ts +++ b/src/plugins/kibana_utils/common/index.ts @@ -26,3 +26,5 @@ export { createGetterSetter, Get, Set } from './create_getter_setter'; export { distinctUntilChangedWithInitialValue } from './distinct_until_changed_with_initial_value'; export { url } from './url'; export { now } from './now'; +export { calculateObjectHash } from './calculate_object_hash'; +export { defaultFeedbackMessage } from './default_feedback_message'; diff --git a/test/plugin_functional/plugins/kbn_tp_custom_visualizations/public/self_changing_vis/self_changing_vis.js b/test/plugin_functional/plugins/kbn_tp_custom_visualizations/public/self_changing_vis/self_changing_vis.js index 2976a6cd98e30..643d15c982792 100644 --- a/test/plugin_functional/plugins/kbn_tp_custom_visualizations/public/self_changing_vis/self_changing_vis.js +++ b/test/plugin_functional/plugins/kbn_tp_custom_visualizations/public/self_changing_vis/self_changing_vis.js @@ -22,7 +22,7 @@ import { SelfChangingComponent } from './self_changing_components'; import { setup as visualizations } from '../../../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/legacy'; -visualizations.types.createReactVisualization({ +visualizations.createReactVisualization({ name: 'self_changing_vis', title: 'Self Changing Vis', icon: 'controlsHorizontal', diff --git a/x-pack/legacy/plugins/lens/public/plugin.tsx b/x-pack/legacy/plugins/lens/public/plugin.tsx index 7f96268fc2e8c..7afe6d7abedc0 100644 --- a/x-pack/legacy/plugins/lens/public/plugin.tsx +++ b/x-pack/legacy/plugins/lens/public/plugin.tsx @@ -103,7 +103,7 @@ export class LensPlugin { this.datatableVisualization.setup(core, dependencies); this.metricVisualization.setup(core, dependencies); - visualizations.types.registerAlias(getLensAliasConfig()); + visualizations.registerAlias(getLensAliasConfig()); kibanaLegacy.registerLegacyApp({ id: 'lens', diff --git a/x-pack/legacy/plugins/maps/public/register_vis_type_alias.js b/x-pack/legacy/plugins/maps/public/register_vis_type_alias.js index b0e62d37fbf1c..4d87b6a055802 100644 --- a/x-pack/legacy/plugins/maps/public/register_vis_type_alias.js +++ b/x-pack/legacy/plugins/maps/public/register_vis_type_alias.js @@ -23,7 +23,7 @@ The Maps app offers more functionality and is easier to use.`, } ); -visualizationsSetup.types.registerAlias({ +visualizationsSetup.registerAlias({ aliasUrl: MAP_BASE_URL, name: APP_ID, title: i18n.translate('xpack.maps.visTypeAlias.title', { @@ -37,5 +37,5 @@ visualizationsSetup.types.registerAlias({ }); if (!showMapVisualizationTypes) { - visualizationsSetup.types.hideTypes(['region_map', 'tile_map']); + visualizationsSetup.hideTypes(['region_map', 'tile_map']); } diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 568108aff7503..5635bb19b7e83 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -2849,7 +2849,6 @@ "timelion.vis.intervalLabel": "間隔", "uiActions.actionPanel.title": "オプション", "uiActions.errors.incompatibleAction": "操作に互換性がありません", - "visualizations.defaultFeedbackMessage": "フィードバックがありますか?{link} で問題を報告してください。", "visualizations.newVisWizard.betaDescription": "このビジュアライゼーションはベータ段階で、変更される可能性があります。デザインとコードはオフィシャル GA 機能よりも完成度が低く、現状のまま保証なしで提供されています。ベータ機能にはオフィシャル GA 機能の SLA が適用されません", "visualizations.newVisWizard.betaTitle": "ベータ", "visualizations.newVisWizard.chooseSourceTitle": "ソースの選択", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index a91f55960e34f..0523021046167 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -2850,7 +2850,6 @@ "timelion.vis.intervalLabel": "时间间隔", "uiActions.actionPanel.title": "选项", "uiActions.errors.incompatibleAction": "操作不兼容", - "visualizations.defaultFeedbackMessage": "想反馈?请在“{link}中创建问题。", "visualizations.newVisWizard.betaDescription": "此可视化为公测版,可能会进行更改。设计和代码相对于正式发行版功能还不够成熟,将按原样提供,且不提供任何保证。公测版功能不受正式发行版功能支持 SLA 的约束", "visualizations.newVisWizard.betaTitle": "公测版", "visualizations.newVisWizard.chooseSourceTitle": "选择源",