diff --git a/.i18nrc.json b/.i18nrc.json index 42b7f6119eda1..c293b3103a39c 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -52,10 +52,7 @@ "visTypeVega": "src/legacy/core_plugins/vis_type_vega", "visTypeVislib": "src/legacy/core_plugins/vis_type_vislib", "visTypeXy": "src/legacy/core_plugins/vis_type_xy", - "visualizations": [ - "src/plugins/visualizations", - "src/legacy/core_plugins/visualizations" - ] + "visualizations": "src/plugins/visualizations" }, "exclude": [ "src/legacy/ui/ui_render/ui_render_mixin.js" diff --git a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.search.md b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.search.md index 7e65ef85c8bec..afb6ea88f9fad 100644 --- a/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.search.md +++ b/docs/development/plugins/data/public/kibana-plugin-plugins-data-public.search.md @@ -10,7 +10,7 @@ search: { aggs: { AggConfigs: typeof AggConfigs; - aggGroupNamesMap: () => Record<"buckets" | "metrics", string>; + aggGroupNamesMap: () => Record<"metrics" | "buckets", string>; aggTypeFilters: import("./search/aggs/filter/agg_type_filters").AggTypeFilters; CidrMask: typeof CidrMask; convertDateRangeToString: typeof convertDateRangeToString; diff --git a/src/core/MIGRATION.md b/src/core/MIGRATION.md index 26637fc01c0b7..5d7b467052029 100644 --- a/src/core/MIGRATION.md +++ b/src/core/MIGRATION.md @@ -1153,12 +1153,12 @@ _See also: [Public's CoreStart API Docs](/docs/development/core/public/kibana-pl ##### Plugins for shared application services -In client code, we have a series of plugins which house shared application services that are being built in the shape of the new platform, but for the time being, are only available in legacy. So if your plugin depends on any of the APIs below, you'll need build your plugin as a legacy plugin that shims the new platform. Once these API's have been moved to the new platform you can migrate your plugin and declare a dependency on the plugin that owns the API's you require. +In client code, we have a series of plugins which house shared application services which are not technically part of `core`, but are often used in Kibana plugins. -The contracts for these plugins are exposed for you to consume in your own plugin; we have created dedicated exports for the `setup` and `start` contracts in a file called `legacy`. By passing these contracts to your plugin's `setup` and `start` methods, you can mimic the functionality that will eventually be provided in the new platform. +This table maps some of the most commonly used legacy items to their new platform locations. ```ts -import { setup, start } from '../core_plugins/visualizations/public/legacy'; +import { npStart: { plugins } } from 'ui/new_platform'; ``` | Legacy Platform | New Platform | Notes | diff --git a/src/legacy/core_plugins/input_control_vis/index.ts b/src/legacy/core_plugins/input_control_vis/index.ts index d67472ac4b95f..0529aa24dffd7 100644 --- a/src/legacy/core_plugins/input_control_vis/index.ts +++ b/src/legacy/core_plugins/input_control_vis/index.ts @@ -25,7 +25,7 @@ import { LegacyPluginApi, LegacyPluginInitializer } from '../../../../src/legacy const inputControlVisPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) => new Plugin({ id: 'input_control_vis', - require: ['kibana', 'elasticsearch', 'visualizations', 'interpreter'], + require: ['kibana', 'elasticsearch', 'interpreter'], publicDir: resolve(__dirname, 'public'), uiExports: { styleSheetPaths: resolve(__dirname, 'public/index.scss'), diff --git a/src/legacy/core_plugins/input_control_vis/public/components/editor/controls_tab.test.tsx b/src/legacy/core_plugins/input_control_vis/public/components/editor/controls_tab.test.tsx index d7a62e07b26f3..db2af742c70bc 100644 --- a/src/legacy/core_plugins/input_control_vis/public/components/editor/controls_tab.test.tsx +++ b/src/legacy/core_plugins/input_control_vis/public/components/editor/controls_tab.test.tsx @@ -23,7 +23,7 @@ import { shallowWithIntl, mountWithIntl } from 'test_utils/enzyme_helpers'; import { findTestSubject } from '@elastic/eui/lib/test'; import { getDepsMock, getIndexPatternMock } from '../../test_utils'; import { ControlsTab, ControlsTabUiProps } from './controls_tab'; -import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { Vis } from '../../../../../../plugins/visualizations/public'; const indexPatternsMock = { get: getIndexPatternMock, diff --git a/src/legacy/core_plugins/input_control_vis/public/components/editor/options_tab.test.tsx b/src/legacy/core_plugins/input_control_vis/public/components/editor/options_tab.test.tsx index 8c77f1b7c4b4f..639e3d2f68c75 100644 --- a/src/legacy/core_plugins/input_control_vis/public/components/editor/options_tab.test.tsx +++ b/src/legacy/core_plugins/input_control_vis/public/components/editor/options_tab.test.tsx @@ -21,7 +21,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; -import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { Vis } from '../../../../../../plugins/visualizations/public'; import { OptionsTab, OptionsTabProps } from './options_tab'; describe('OptionsTab', () => { diff --git a/src/legacy/core_plugins/input_control_vis/public/legacy.ts b/src/legacy/core_plugins/input_control_vis/public/legacy.ts index 438cdffdb323a..67299068819e8 100644 --- a/src/legacy/core_plugins/input_control_vis/public/legacy.ts +++ b/src/legacy/core_plugins/input_control_vis/public/legacy.ts @@ -26,21 +26,17 @@ import { InputControlVisPluginSetupDependencies, InputControlVisPluginStartDependencies, } from './plugin'; -import { - setup as visualizationsSetup, - start as visualizationsStart, -} from '../../visualizations/public/np_ready/public/legacy'; const setupPlugins: Readonly = { expressions: npSetup.plugins.expressions, data: npSetup.plugins.data, - visualizations: visualizationsSetup, + visualizations: npSetup.plugins.visualizations, }; const startPlugins: Readonly = { expressions: npStart.plugins.expressions, data: npStart.plugins.data, - visualizations: visualizationsStart, + visualizations: npStart.plugins.visualizations, }; const pluginInstance = plugin({} as PluginInitializerContext); 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 c45e0d17872ec..b743468065430 100644 --- a/src/legacy/core_plugins/input_control_vis/public/plugin.ts +++ b/src/legacy/core_plugins/input_control_vis/public/plugin.ts @@ -20,7 +20,10 @@ import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from 'kibana/p import { DataPublicPluginSetup, DataPublicPluginStart } from 'src/plugins/data/public'; import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public'; -import { VisualizationsSetup, VisualizationsStart } from '../../visualizations/public'; +import { + VisualizationsSetup, + VisualizationsStart, +} from '../../../../plugins/visualizations/public'; import { createInputControlVisFn } from './input_control_fn'; import { createInputControlVisTypeDefinition } from './input_control_vis_type'; diff --git a/src/legacy/core_plugins/input_control_vis/public/vis_controller.tsx b/src/legacy/core_plugins/input_control_vis/public/vis_controller.tsx index c0ab235c1b9d1..c4a7d286850e3 100644 --- a/src/legacy/core_plugins/input_control_vis/public/vis_controller.tsx +++ b/src/legacy/core_plugins/input_control_vis/public/vis_controller.tsx @@ -31,7 +31,7 @@ import { RangeControl } from './control/range_control_factory'; import { ListControl } from './control/list_control_factory'; import { InputControlVisDependencies } from './plugin'; import { FilterManager, Filter } from '../../../../plugins/data/public'; -import { VisParams, Vis } from '../../visualizations/public'; +import { VisParams, Vis } from '../../../../plugins/visualizations/public'; export const createInputControlVisController = (deps: InputControlVisDependencies) => { return class InputControlVisController { diff --git a/src/legacy/core_plugins/kibana/public/discover/build_services.ts b/src/legacy/core_plugins/kibana/public/discover/build_services.ts index f881eb96e4e81..180ff13cdddc0 100644 --- a/src/legacy/core_plugins/kibana/public/discover/build_services.ts +++ b/src/legacy/core_plugins/kibana/public/discover/build_services.ts @@ -36,7 +36,7 @@ import { import { DiscoverStartPlugins } from './plugin'; import { SharePluginStart } from '../../../../../plugins/share/public'; import { ChartsPluginStart } from '../../../../../plugins/charts/public'; -import { VisualizationsStart } from '../../../visualizations/public'; +import { VisualizationsStart } from '../../../../../plugins/visualizations/public'; import { createSavedSearchesLoader, DocViewerComponent, diff --git a/src/legacy/core_plugins/kibana/public/discover/legacy.ts b/src/legacy/core_plugins/kibana/public/discover/legacy.ts index a1ef646f4fe85..f08fd22c71850 100644 --- a/src/legacy/core_plugins/kibana/public/discover/legacy.ts +++ b/src/legacy/core_plugins/kibana/public/discover/legacy.ts @@ -20,18 +20,8 @@ import { PluginInitializerContext } from 'kibana/public'; import { npSetup, npStart } from 'ui/new_platform'; import { plugin } from './index'; -import { - setup as visualizationsSetup, - start as visualizationsStart, -} from '../../../../core_plugins/visualizations/public/np_ready/public/legacy'; // Legacy compatibility part - to be removed at cutover, replaced by a kibana.json file export const pluginInstance = plugin({} as PluginInitializerContext); -export const setup = pluginInstance.setup(npSetup.core, { - ...npSetup.plugins, - visualizations: visualizationsSetup, -}); -export const start = pluginInstance.start(npStart.core, { - ...npStart.plugins, - visualizations: visualizationsStart, -}); +export const setup = pluginInstance.setup(npSetup.core, npSetup.plugins); +export const start = pluginInstance.start(npStart.core, npStart.plugins); diff --git a/src/legacy/core_plugins/kibana/public/discover/plugin.ts b/src/legacy/core_plugins/kibana/public/discover/plugin.ts index 2bcf3a8081f82..fcac7aa74f54a 100644 --- a/src/legacy/core_plugins/kibana/public/discover/plugin.ts +++ b/src/legacy/core_plugins/kibana/public/discover/plugin.ts @@ -45,7 +45,7 @@ import { HomePublicPluginSetup } from '../../../../../plugins/home/public'; import { VisualizationsStart, VisualizationsSetup, -} from '../../../visualizations/public/np_ready/public'; +} from '../../../../../plugins/visualizations/public'; import { createKbnUrlTracker } from '../../../../../plugins/kibana_utils/public'; export interface DiscoverSetupPlugins { 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 f3a37e2b7348f..7261b2ba03372 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 @@ -21,7 +21,6 @@ import _ from 'lodash'; import { i18n } from '@kbn/i18n'; import { npStart } from 'ui/new_platform'; import { SavedObjectLoader } from '../../../../../plugins/saved_objects/public'; -import { start as visualizations } from '../../../visualizations/public/np_ready/public/legacy'; import { createSavedSearchesLoader } from '../../../../../plugins/discover/public'; /** @@ -63,7 +62,7 @@ const services = { savedObjectManagementRegistry.register({ id: 'savedVisualizations', - service: visualizations.savedVisualizationsLoader, + service: npStart.plugins.visualizations.savedVisualizationsLoader, title: 'visualizations', }); 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 7e96d7bde6e13..f29f07ba4b20b 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/kibana_services.ts +++ b/src/legacy/core_plugins/kibana/public/visualize/kibana_services.ts @@ -32,7 +32,7 @@ import { Storage } from '../../../../../plugins/kibana_utils/public'; import { EmbeddableStart } from '../../../../../plugins/embeddable/public'; import { SharePluginStart } from '../../../../../plugins/share/public'; import { DataPublicPluginStart, IndexPatternsContract } from '../../../../../plugins/data/public'; -import { VisualizationsStart } from '../../../visualizations/public'; +import { VisualizationsStart } from '../../../../../plugins/visualizations/public'; import { SavedVisualizations } from './np_ready/types'; import { UsageCollectionSetup } from '../../../../../plugins/usage_collection/public'; import { KibanaLegacyStart } from '../../../../../plugins/kibana_legacy/public'; diff --git a/src/legacy/core_plugins/kibana/public/visualize/legacy.ts b/src/legacy/core_plugins/kibana/public/visualize/legacy.ts index fbbc7ab944daf..4ef2c93689714 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/legacy.ts +++ b/src/legacy/core_plugins/kibana/public/visualize/legacy.ts @@ -19,14 +19,10 @@ import { PluginInitializerContext } from 'kibana/public'; import { npSetup, npStart } from 'ui/new_platform'; -import { start as visualizations } from '../../../visualizations/public/np_ready/public/legacy'; import { plugin } from './index'; const instance = plugin({ env: npSetup.plugins.kibanaLegacy.env, } as PluginInitializerContext); instance.setup(npSetup.core, npSetup.plugins); -instance.start(npStart.core, { - ...npStart.plugins, - visualizations, -}); +instance.start(npStart.core, npStart.plugins); diff --git a/src/legacy/core_plugins/kibana/public/visualize/legacy_imports.ts b/src/legacy/core_plugins/kibana/public/visualize/legacy_imports.ts index a2e2ba3543104..a6774e2dd47e8 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/legacy_imports.ts +++ b/src/legacy/core_plugins/kibana/public/visualize/legacy_imports.ts @@ -28,7 +28,10 @@ export { absoluteToParsedUrl } from 'ui/url/absolute_to_parsed_url'; export { KibanaParsedUrl } from 'ui/url/kibana_parsed_url'; export { wrapInI18nContext } from 'ui/i18n'; export { DashboardConstants } from '../dashboard/np_ready/dashboard_constants'; -export { VisSavedObject, VISUALIZE_EMBEDDABLE_TYPE } from '../../../visualizations/public/'; +export { + VisSavedObject, + VISUALIZE_EMBEDDABLE_TYPE, +} from '../../../../../plugins/visualizations/public/'; export { configureAppAngularModule, migrateLegacyQuery, diff --git a/src/legacy/core_plugins/kibana/public/visualize/np_ready/types.d.ts b/src/legacy/core_plugins/kibana/public/visualize/np_ready/types.d.ts index 246a031f05769..e376b4f2bbacf 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/np_ready/types.d.ts +++ b/src/legacy/core_plugins/kibana/public/visualize/np_ready/types.d.ts @@ -27,9 +27,8 @@ import { import { EmbeddableStart } from 'src/plugins/embeddable/public'; import { PersistedState } from 'src/plugins/visualizations/public'; import { LegacyCoreStart } from 'kibana/public'; -import { Vis } from 'src/legacy/core_plugins/visualizations/public'; import { VisSavedObject } from '../legacy_imports'; -import { SavedVisState } from '../../../../visualizations/public/np_ready/public/types'; +import { SavedVisState } from '../../../../../../plugins/visualizations/public'; import { SavedSearch } from '../../../../../../plugins/discover/public'; export type PureVisState = SavedVisState; diff --git a/src/legacy/core_plugins/kibana/public/visualize/plugin.ts b/src/legacy/core_plugins/kibana/public/visualize/plugin.ts index 9d88152c59aa7..59b814c98dd08 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/plugin.ts +++ b/src/legacy/core_plugins/kibana/public/visualize/plugin.ts @@ -43,7 +43,7 @@ import { KibanaLegacySetup, AngularRenderedAppUpdater, } from '../../../../../plugins/kibana_legacy/public'; -import { VisualizationsStart } from '../../../visualizations/public'; +import { VisualizationsStart } from '../../../../../plugins/visualizations/public'; import { VisualizeConstants } from './np_ready/visualize_constants'; import { setServices, VisualizeKibanaServices } from './kibana_services'; import { diff --git a/src/legacy/core_plugins/management/public/legacy.ts b/src/legacy/core_plugins/management/public/legacy.ts index 4481bad79c47d..96d2c74398a0e 100644 --- a/src/legacy/core_plugins/management/public/legacy.ts +++ b/src/legacy/core_plugins/management/public/legacy.ts @@ -29,7 +29,7 @@ * simply delete this shim file. * * We are also calling `setup/start` here and exporting our public contract so that - * other legacy plugins are able to import from '../core_plugins/visualizations/legacy' + * other legacy plugins are able to import from '../core_plugins/management/legacy' * and receive the response value of the `setup/start` contract, mimicking the * data that will eventually be injected by the new platform. */ 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 23ca99791e92e..3880f42d52561 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 @@ -37,11 +37,13 @@ import afterdatachangePng from './afterdatachange.png'; import afterdatachangeandresizePng from './afterdatachangeandresize.png'; import aftercolorchangePng from './aftercolorchange.png'; import changestartupPng from './changestartup.png'; -import { setup as visualizationsSetup } from '../../../visualizations/public/np_ready/public/legacy'; import { createRegionMapVisualization } from '../region_map_visualization'; import { createRegionMapTypeDefinition } from '../region_map_type'; -import { ExprVis } from '../../../visualizations/public/np_ready/public/expressions/vis'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { ExprVis } from '../../../../../plugins/visualizations/public/expressions/vis'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { BaseVisType } from '../../../../../plugins/visualizations/public/vis_types/base_vis_type'; const THRESHOLD = 0.45; const PIXEL_DIFF = 96; @@ -50,6 +52,7 @@ describe('RegionMapsVisualizationTests', function() { let domNode; let RegionMapsVisualization; let vis; + let regionMapVisType; let dependencies; let imageComparator; @@ -84,8 +87,6 @@ describe('RegionMapsVisualizationTests', function() { ], }; - let visRegComplete = false; - beforeEach(ngMock.module('kibana')); let getManifestStub; @@ -105,11 +106,7 @@ describe('RegionMapsVisualizationTests', function() { uiSettings, }; - if (!visRegComplete) { - visRegComplete = true; - visualizationsSetup.createBaseVisualization(createRegionMapTypeDefinition(dependencies)); - } - + regionMapVisType = new BaseVisType(createRegionMapTypeDefinition(dependencies)); RegionMapsVisualization = createRegionMapVisualization(dependencies); ChoroplethLayer.prototype._makeJsonAjaxCall = async function() { @@ -154,7 +151,7 @@ describe('RegionMapsVisualizationTests', function() { imageComparator = new ImageComparator(); vis = new ExprVis({ - type: 'region_map', + type: regionMapVisType, }); vis.params.bucket = { diff --git a/src/legacy/core_plugins/region_map/public/legacy.ts b/src/legacy/core_plugins/region_map/public/legacy.ts index 495e558e29dd7..08615946affa2 100644 --- a/src/legacy/core_plugins/region_map/public/legacy.ts +++ b/src/legacy/core_plugins/region_map/public/legacy.ts @@ -20,7 +20,6 @@ import { PluginInitializerContext } from 'kibana/public'; import { npSetup, npStart } from 'ui/new_platform'; -import { setup as visualizationsSetup } from '../../visualizations/public/np_ready/public/legacy'; import { RegionMapPluginSetupDependencies, RegionMapsConfig } from './plugin'; import { LegacyDependenciesPlugin } from './shim'; import { plugin } from '.'; @@ -31,7 +30,7 @@ const regionmapsConfig = npSetup.core.injectedMetadata.getInjectedVar( const plugins: Readonly = { expressions: npSetup.plugins.expressions, - visualizations: visualizationsSetup, + visualizations: npSetup.plugins.visualizations, // Temporary solution // It will be removed when all dependent services are migrated to the new platform. diff --git a/src/legacy/core_plugins/region_map/public/plugin.ts b/src/legacy/core_plugins/region_map/public/plugin.ts index 98fb5604c3d65..cae569f8fd26d 100644 --- a/src/legacy/core_plugins/region_map/public/plugin.ts +++ b/src/legacy/core_plugins/region_map/public/plugin.ts @@ -24,7 +24,7 @@ import { IUiSettingsClient, } from '../../../../core/public'; import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public'; -import { VisualizationsSetup } from '../../visualizations/public'; +import { VisualizationsSetup } from '../../../../plugins/visualizations/public'; import { LegacyDependenciesPlugin, LegacyDependenciesPluginSetup } from './shim'; 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 3b8a7dfbed313..2c142b19d9096 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 @@ -31,11 +31,13 @@ import EMS_TILES from '../../../../ui/public/vis/__tests__/map/ems_mocks/sample_ import EMS_STYLE_ROAD_MAP_BRIGHT from '../../../../ui/public/vis/__tests__/map/ems_mocks/sample_style_bright'; import EMS_STYLE_ROAD_MAP_DESATURATED from '../../../../ui/public/vis/__tests__/map/ems_mocks/sample_style_desaturated'; import EMS_STYLE_DARK_MAP from '../../../../ui/public/vis/__tests__/map/ems_mocks/sample_style_dark'; -import { setup as visualizationsSetup } from '../../../visualizations/public/np_ready/public/legacy'; import { createTileMapVisualization } from '../tile_map_visualization'; import { createTileMapTypeDefinition } from '../tile_map_type'; -import { ExprVis } from '../../../visualizations/public/np_ready/public/expressions/vis'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { ExprVis } from '../../../../../plugins/visualizations/public/expressions/vis'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { BaseVisType } from '../../../../../plugins/visualizations/public/vis_types/base_vis_type'; function mockRawData() { const stack = [dummyESResponse]; @@ -59,13 +61,13 @@ mockRawData(); const THRESHOLD = 0.45; const PIXEL_DIFF = 64; -let visRegComplete = false; describe('CoordinateMapsVisualizationTest', function() { let domNode; let CoordinateMapsVisualization; let vis; let dependencies; + let visType; let imageComparator; @@ -82,10 +84,7 @@ describe('CoordinateMapsVisualizationTest', function() { $injector, }; - if (!visRegComplete) { - visRegComplete = true; - visualizationsSetup.createBaseVisualization(createTileMapTypeDefinition(dependencies)); - } + visType = new BaseVisType(createTileMapTypeDefinition(dependencies)); CoordinateMapsVisualization = createTileMapVisualization(dependencies); @@ -120,7 +119,7 @@ describe('CoordinateMapsVisualizationTest', function() { imageComparator = new ImageComparator(); vis = new ExprVis({ - type: 'tile_map', + type: visType, }); vis.params = { mapType: 'Scaled Circle Markers', diff --git a/src/legacy/core_plugins/tile_map/public/components/wms_options.tsx b/src/legacy/core_plugins/tile_map/public/components/wms_options.tsx index 204ad5efa9b40..27127b781cd4d 100644 --- a/src/legacy/core_plugins/tile_map/public/components/wms_options.tsx +++ b/src/legacy/core_plugins/tile_map/public/components/wms_options.tsx @@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import { TmsLayer } from 'ui/vis/map/service_settings'; -import { Vis } from '../../../visualizations/public'; +import { Vis } from '../../../../../plugins/visualizations/public'; import { RegionMapVisParams } from '../../../region_map/public/types'; import { SelectOption, SwitchOption } from '../../../vis_type_vislib/public'; import { WmsInternalOptions } from './wms_internal_options'; diff --git a/src/legacy/core_plugins/tile_map/public/legacy.ts b/src/legacy/core_plugins/tile_map/public/legacy.ts index 74be8482bfd30..7b1f916076f61 100644 --- a/src/legacy/core_plugins/tile_map/public/legacy.ts +++ b/src/legacy/core_plugins/tile_map/public/legacy.ts @@ -20,14 +20,13 @@ import { PluginInitializerContext } from 'kibana/public'; import { npSetup, npStart } from 'ui/new_platform'; -import { setup as visualizationsSetup } from '../../visualizations/public/np_ready/public/legacy'; import { TileMapPluginSetupDependencies } from './plugin'; import { LegacyDependenciesPlugin } from './shim'; import { plugin } from '.'; const plugins: Readonly = { expressions: npSetup.plugins.expressions, - visualizations: visualizationsSetup, + visualizations: npSetup.plugins.visualizations, // Temporary solution // It will be removed when all dependent services are migrated to the new platform. diff --git a/src/legacy/core_plugins/tile_map/public/plugin.ts b/src/legacy/core_plugins/tile_map/public/plugin.ts index a12c2753cc525..f2addbe3ab872 100644 --- a/src/legacy/core_plugins/tile_map/public/plugin.ts +++ b/src/legacy/core_plugins/tile_map/public/plugin.ts @@ -24,7 +24,7 @@ import { IUiSettingsClient, } from '../../../../core/public'; import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public'; -import { VisualizationsSetup } from '../../visualizations/public'; +import { VisualizationsSetup } from '../../../../plugins/visualizations/public'; import { LegacyDependenciesPlugin, LegacyDependenciesPluginSetup } from './shim'; diff --git a/src/legacy/core_plugins/timelion/public/app.js b/src/legacy/core_plugins/timelion/public/app.js index a50f8a2cd3e8d..c15318d29e761 100644 --- a/src/legacy/core_plugins/timelion/public/app.js +++ b/src/legacy/core_plugins/timelion/public/app.js @@ -41,7 +41,6 @@ import './directives/saved_object_save_as_checkbox'; import './services/saved_sheet_register'; import rootTemplate from 'plugins/timelion/index.html'; -import { start as visualizations } from '../../visualizations/public/np_ready/public/legacy'; import { loadKbnTopNavDirectives } from '../../../../plugins/kibana_legacy/public'; loadKbnTopNavDirectives(npStart.plugins.navigation.ui); @@ -125,7 +124,7 @@ app.controller('timelion', function( timefilter.enableAutoRefreshSelector(); timefilter.enableTimeRangeSelector(); - const savedVisualizations = visualizations.savedVisualizationsLoader; + const savedVisualizations = npStart.plugins.visualizations.savedVisualizationsLoader; const timezone = getTimezone(config); const defaultExpression = '.es(*)'; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/agg_common_props.ts b/src/legacy/core_plugins/vis_default_editor/public/components/agg_common_props.ts index 3aae10879138a..0c130a96230b4 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/agg_common_props.ts +++ b/src/legacy/core_plugins/vis_default_editor/public/components/agg_common_props.ts @@ -17,7 +17,7 @@ * under the License. */ -import { VisParams } from 'src/legacy/core_plugins/visualizations/public'; +import { VisParams } from 'src/plugins/visualizations/public'; import { IAggType, IAggConfig, IAggGroupNames } from 'src/plugins/data/public'; import { Schema } from '../schemas'; import { EditorVisState } from './sidebar/state/reducers'; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/controls/agg_control_props.tsx b/src/legacy/core_plugins/vis_default_editor/public/components/controls/agg_control_props.tsx index 98540d3414f2d..329704ca106db 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/controls/agg_control_props.tsx +++ b/src/legacy/core_plugins/vis_default_editor/public/components/controls/agg_control_props.tsx @@ -17,7 +17,7 @@ * under the License. */ -import { VisParams } from 'src/legacy/core_plugins/visualizations/public'; +import { VisParams } from 'src/plugins/visualizations/public'; import { IAggConfig } from 'src/plugins/data/public'; import { DefaultEditorAggCommonProps } from '../agg_common_props'; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/controls.tsx b/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/controls.tsx index 55d5bc2426e92..18b445b4a26db 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/controls.tsx +++ b/src/legacy/core_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 'src/legacy/core_plugins/visualizations/public'; +import { Vis } from '../../../../../../plugins/visualizations/public'; import { discardChanges, EditorAction } from './state'; interface DefaultEditorControlsProps { diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar.tsx b/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar.tsx index 04c931f593e5a..29039715066be 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar.tsx +++ b/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar.tsx @@ -23,7 +23,7 @@ import { i18n } from '@kbn/i18n'; import { keyCodes, EuiButtonIcon, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; import { EventEmitter } from 'events'; -import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { Vis } from 'src/plugins/visualizations/public'; import { DefaultEditorNavBar, OptionTab } from './navbar'; import { DefaultEditorControls } from './controls'; import { setStateParamValue, useEditorReducer, useEditorFormState, discardChanges } from './state'; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar_title.tsx b/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar_title.tsx index 575ad5ae2a95c..fb63a598a4fae 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar_title.tsx +++ b/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/sidebar_title.tsx @@ -35,7 +35,7 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { Vis } from '../../../../../../plugins/visualizations/public'; import { SavedSearch } from '../../../../../../plugins/discover/public'; interface LinkedSearchProps { diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/actions.ts b/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/actions.ts index e3577218b7e25..16c3632bed697 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/actions.ts +++ b/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/actions.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Vis, VisParams } from 'src/legacy/core_plugins/visualizations/public'; +import { Vis, VisParams } from 'src/plugins/visualizations/public'; import { IAggConfig } from 'src/plugins/data/public'; import { EditorStateActionTypes } from './constants'; import { Schema } from '../../../schemas'; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/index.ts b/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/index.ts index 11cbc3f93e9d3..d39d6d07b32d2 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/index.ts +++ b/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/index.ts @@ -20,7 +20,7 @@ import { useReducer, useCallback } from 'react'; import { EventEmitter } from 'events'; -import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { Vis } from 'src/plugins/visualizations/public'; import { createEditorStateReducer, initEditorState, EditorVisState } from './reducers'; import { EditorStateActionTypes } from './constants'; import { EditorAction } from './actions'; diff --git a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/reducers.ts b/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/reducers.ts index 6e5bec7c69c90..b9f89cebd8bf3 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/reducers.ts +++ b/src/legacy/core_plugins/vis_default_editor/public/components/sidebar/state/reducers.ts @@ -19,7 +19,7 @@ import { cloneDeep } from 'lodash'; -import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { Vis } from 'src/plugins/visualizations/public'; import { AggGroupNames, DataPublicPluginStart } from '../../../../../../../plugins/data/public'; import { EditorStateActionTypes } from './constants'; import { getEnabledMetricAggsCount } from '../../agg_group_helper'; diff --git a/src/legacy/core_plugins/vis_default_editor/public/default_editor_controller.tsx b/src/legacy/core_plugins/vis_default_editor/public/default_editor_controller.tsx index 13fcabd799959..0b6d4e5982a00 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/default_editor_controller.tsx +++ b/src/legacy/core_plugins/vis_default_editor/public/default_editor_controller.tsx @@ -24,19 +24,18 @@ import { I18nProvider } from '@kbn/i18n/react'; import { EventEmitter } from 'events'; import { EditorRenderProps } from 'src/legacy/core_plugins/kibana/public/visualize/np_ready/types'; -import { Vis } from 'src/legacy/core_plugins/visualizations/public/'; +import { Vis, VisualizeEmbeddableContract } from '../../../../plugins/visualizations/public'; import { Storage } from '../../../../plugins/kibana_utils/public'; import { KibanaContextProvider } from '../../../../plugins/kibana_react/public'; import { DefaultEditor } from './default_editor'; import { DefaultEditorDataTab, OptionTab } from './components/sidebar'; -import { VisualizeEmbeddable } from '../../visualizations/public/np_ready/public/embeddable'; const localStorage = new Storage(window.localStorage); export interface DefaultEditorControllerState { vis: Vis; eventEmitter: EventEmitter; - embeddableHandler: VisualizeEmbeddable; + embeddableHandler: VisualizeEmbeddableContract; optionTabs: OptionTab[]; } diff --git a/src/legacy/core_plugins/vis_default_editor/public/vis_options_props.tsx b/src/legacy/core_plugins/vis_default_editor/public/vis_options_props.tsx index 3239e871a2465..a9b20ec0f00da 100644 --- a/src/legacy/core_plugins/vis_default_editor/public/vis_options_props.tsx +++ b/src/legacy/core_plugins/vis_default_editor/public/vis_options_props.tsx @@ -17,9 +17,8 @@ * under the License. */ -import { PersistedState } from 'src/plugins/visualizations/public'; +import { Vis, PersistedState } from 'src/plugins/visualizations/public'; import { IAggConfigs } from 'src/plugins/data/public'; -import { Vis } from '../../visualizations/public'; export interface VisOptionsProps { aggs: IAggConfigs; diff --git a/src/legacy/core_plugins/vis_type_markdown/public/legacy.ts b/src/legacy/core_plugins/vis_type_markdown/public/legacy.ts index d4a5290df865c..1cfc583f6e005 100644 --- a/src/legacy/core_plugins/vis_type_markdown/public/legacy.ts +++ b/src/legacy/core_plugins/vis_type_markdown/public/legacy.ts @@ -19,14 +19,12 @@ import { PluginInitializerContext } from 'kibana/public'; import { npSetup, npStart } from 'ui/new_platform'; - -import { setup as visualizationsSetup } from '../../visualizations/public/np_ready/public/legacy'; import { MarkdownPluginSetupDependencies } from './plugin'; import { plugin } from '.'; const plugins: Readonly = { expressions: npSetup.plugins.expressions, - visualizations: visualizationsSetup, + visualizations: npSetup.plugins.visualizations, }; const pluginInstance = plugin({} as PluginInitializerContext); 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 71d6c1c69ef2d..0445d270c9330 100644 --- a/src/legacy/core_plugins/vis_type_markdown/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_markdown/public/plugin.ts @@ -19,7 +19,7 @@ import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '../../../../core/public'; import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public'; -import { VisualizationsSetup } from '../../visualizations/public'; +import { VisualizationsSetup } from '../../../../plugins/visualizations/public'; import { markdownVisDefinition } from './markdown_vis'; import { createMarkdownVisFn } from './markdown_fn'; diff --git a/src/legacy/core_plugins/vis_type_metric/public/components/metric_vis_component.test.tsx b/src/legacy/core_plugins/vis_type_metric/public/components/metric_vis_component.test.tsx index 00e8df2f0f936..2bd423656b0f0 100644 --- a/src/legacy/core_plugins/vis_type_metric/public/components/metric_vis_component.test.tsx +++ b/src/legacy/core_plugins/vis_type_metric/public/components/metric_vis_component.test.tsx @@ -21,7 +21,7 @@ import React from 'react'; import { shallow } from 'enzyme'; import { MetricVisComponent, MetricVisComponentProps } from './metric_vis_component'; -import { ExprVis } from '../../../visualizations/public/np_ready/public/expressions/vis'; +import { ExprVis } from '../../../../../plugins/visualizations/public'; jest.mock('../services', () => ({ getFormatService: () => ({ diff --git a/src/legacy/core_plugins/vis_type_metric/public/components/metric_vis_component.tsx b/src/legacy/core_plugins/vis_type_metric/public/components/metric_vis_component.tsx index 3fca1df92eacb..de2cc66a99c79 100644 --- a/src/legacy/core_plugins/vis_type_metric/public/components/metric_vis_component.tsx +++ b/src/legacy/core_plugins/vis_type_metric/public/components/metric_vis_component.tsx @@ -27,8 +27,7 @@ import { KibanaDatatable } from '../../../../../plugins/expressions/public'; import { getHeatmapColors } from '../../../../../plugins/charts/public'; import { VisParams, MetricVisMetric } from '../types'; import { getFormatService } from '../services'; -import { SchemaConfig } from '../../../visualizations/public'; -import { ExprVis } from '../../../visualizations/public/np_ready/public/expressions/vis'; +import { SchemaConfig, ExprVis } from '../../../../../plugins/visualizations/public'; export interface MetricVisComponentProps { visParams: VisParams; diff --git a/src/legacy/core_plugins/vis_type_metric/public/legacy.ts b/src/legacy/core_plugins/vis_type_metric/public/legacy.ts index 5fc2e48609d4b..ba883601e5d65 100644 --- a/src/legacy/core_plugins/vis_type_metric/public/legacy.ts +++ b/src/legacy/core_plugins/vis_type_metric/public/legacy.ts @@ -19,14 +19,12 @@ import { PluginInitializerContext } from 'kibana/public'; import { npSetup, npStart } from 'ui/new_platform'; - -import { setup as visualizationsSetup } from '../../visualizations/public/np_ready/public/legacy'; import { MetricVisPluginSetupDependencies } from './plugin'; import { plugin } from '.'; const plugins: Readonly = { expressions: npSetup.plugins.expressions, - visualizations: visualizationsSetup, + visualizations: npSetup.plugins.visualizations, charts: npSetup.plugins.charts, }; 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 2a5478f23e850..459da47556307 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 @@ -17,112 +17,19 @@ * under the License. */ -import $ from 'jquery'; - -// TODO This is an integration test and thus requires a running platform. When moving to the new platform, -// this test has to be migrated to a real unit test. -// @ts-ignore -import getStubIndexPattern from 'fixtures/stubbed_logstash_index_pattern'; - -import { Vis } from '../../visualizations/public'; -import { - setup as visualizationsSetup, - start as visualizationsStart, -} from '../../visualizations/public/np_ready/public/legacy'; import { createMetricVisTypeDefinition } from './metric_vis_type'; +import { MetricVisComponent } from './components/metric_vis_component'; jest.mock('ui/new_platform'); -jest.mock('./services', () => ({ - getFormatService: () => ({ - deserialize: () => { - return { - convert: (x: unknown) => `ip[${x}]`, - }; - }, - }), -})); - jest.mock('../../vis_default_editor/public', () => ({ Schemas: class {}, })); describe('metric_vis - createMetricVisTypeDefinition', () => { - let vis: Vis; - - beforeAll(() => { - visualizationsSetup.createReactVisualization(createMetricVisTypeDefinition()); - }); - - const setup = () => { - const stubIndexPattern = getStubIndexPattern(); - - stubIndexPattern.stubSetFieldFormat('ip', 'url', { - urlTemplate: 'http://ip.info?address={{value}}', - labelTemplate: 'ip[{{value}}]', - }); - - const searchSource = { - getField: (name: string) => { - if (name === 'index') { - return stubIndexPattern; - } - }, - }; - - // TODO: remove when Vis is converted to typescript. Only importing Vis as type - // @ts-ignore - vis = visualizationsStart.createVis('metric', { - type: 'metric', - data: { - searchSource, - aggs: [{ id: '1', type: 'top_hits', schema: 'metric', params: { field: 'ip' } }], - }, - }); - - vis.params.dimensions = { - metrics: [ - { - accessor: 0, - format: { - id: 'url', - params: { - urlTemplate: 'http://ip.info?address={{value}}', - labelTemplate: 'ip[{{value}}]', - }, - }, - }, - ], - }; - - const el = document.createElement('div'); - const metricVisType = visualizationsStart.get('metric'); - const Controller = metricVisType.visualization; - const controller = new Controller(el, vis); - const render = (esResponse: any) => { - controller.render(esResponse, vis.params); - }; - - return { el, render }; - }; - - it('renders html value from field formatter', () => { - const { el, render } = setup(); - - const ip = '235.195.237.208'; - render({ - columns: [{ id: 'col-0', name: 'ip' }], - rows: [{ 'col-0': ip }], - }); - - const links = $(el) - .find('a[href]') - .filter(function() { - // @ts-ignore - return this.href.includes('ip.info'); - }); + it('has metric vis component set', () => { + const def = createMetricVisTypeDefinition(); - expect(links.length).toBe(1); - expect(links.text()).toBe(`ip[${ip}]`); + expect(def.visConfig.component).toBe(MetricVisComponent); }); }); 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 1c3e1568f4de2..cb65d5cafbdd2 100644 --- a/src/legacy/core_plugins/vis_type_metric/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_metric/public/plugin.ts @@ -19,7 +19,7 @@ import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '../../../../core/public'; import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public'; -import { VisualizationsSetup } from '../../visualizations/public'; +import { VisualizationsSetup } from '../../../../plugins/visualizations/public'; import { createMetricVisFn } from './metric_vis_fn'; import { createMetricVisTypeDefinition } from './metric_vis_type'; diff --git a/src/legacy/core_plugins/vis_type_metric/public/types.ts b/src/legacy/core_plugins/vis_type_metric/public/types.ts index 298eebf23027d..cae18dd8a2ab1 100644 --- a/src/legacy/core_plugins/vis_type_metric/public/types.ts +++ b/src/legacy/core_plugins/vis_type_metric/public/types.ts @@ -18,7 +18,7 @@ */ import { Range } from '../../../../plugins/expressions/public'; -import { SchemaConfig } from '../../visualizations/public'; +import { SchemaConfig } from '../../../../plugins/visualizations/public'; import { ColorModes, Labels, Style } from '../../vis_type_vislib/public'; import { ColorSchemas } from '../../../../plugins/charts/public'; 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 211b79e915038..a23407a599ae2 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 @@ -21,105 +21,17 @@ import $ from 'jquery'; import moment from 'moment'; import ngMock from 'ng_mock'; import expect from '@kbn/expect'; -import { - metricOnly, - threeTermBuckets, - oneTermOneHistogramBucketWithTwoMetricsOneTopHitOneDerivative, -} from 'fixtures/fake_hierarchical_data'; import sinon from 'sinon'; import { npStart } from '../../legacy_imports'; -import { search } from '../../../../../../plugins/data/public'; -import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; import { round } from 'lodash'; -import { tableVisTypeDefinition } from '../../table_vis_type'; -import { - setup as visualizationsSetup, - start as visualizationsStart, -} from '../../../../visualizations/public/np_ready/public/legacy'; import { getAngularModule } from '../../get_inner_angular'; import { initTableVisLegacyModule } from '../../table_vis_legacy_module'; -import { tableVisResponseHandler } from '../../table_vis_response_handler'; - -const { tabifyAggResponse } = search; +import { tabifiedData } from './tabified_data'; describe('Table Vis - AggTable Directive', function() { let $rootScope; let $compile; - let indexPattern; let settings; - const tabifiedData = {}; - - const init = () => { - const searchSource = { - getField: name => { - if (name === 'index') { - return indexPattern; - } - }, - }; - const vis1 = visualizationsStart.createVis('table', { - type: 'table', - data: { searchSource, aggs: [] }, - }); - tabifiedData.metricOnly = tabifyAggResponse(vis1.data.aggs, metricOnly); - - const vis2 = visualizationsStart.createVis('table', { - type: 'table', - params: { - showMetricsAtAllLevels: true, - }, - data: { - aggs: [ - { type: 'avg', schema: 'metric', params: { field: 'bytes' } }, - { type: 'terms', schema: 'bucket', params: { field: 'extension' } }, - { type: 'terms', schema: 'bucket', params: { field: 'geo.src' } }, - { type: 'terms', schema: 'bucket', params: { field: 'machine.os' } }, - ], - searchSource, - }, - }); - vis2.data.aggs.aggs.forEach(function(agg, i) { - agg.id = 'agg_' + (i + 1); - }); - tabifiedData.threeTermBuckets = tabifyAggResponse(vis2.data.aggs, threeTermBuckets, { - metricsAtAllLevels: true, - }); - - const vis3 = visualizationsStart.createVis('table', { - type: 'table', - data: { - aggs: [ - { type: 'avg', schema: 'metric', params: { field: 'bytes' } }, - { type: 'min', schema: 'metric', params: { field: '@timestamp' } }, - { type: 'terms', schema: 'bucket', params: { field: 'extension' } }, - { - type: 'date_histogram', - schema: 'bucket', - params: { field: '@timestamp', interval: 'd' }, - }, - { - type: 'derivative', - schema: 'metric', - params: { metricAgg: 'custom', customMetric: { id: '5-orderAgg', type: 'count' } }, - }, - { - type: 'top_hits', - schema: 'metric', - params: { field: 'bytes', aggregate: { val: 'min' }, size: 1 }, - }, - ], - searchSource, - }, - }); - vis3.data.aggs.aggs.forEach(function(agg, i) { - agg.id = 'agg_' + (i + 1); - }); - - tabifiedData.oneTermOneHistogramBucketWithTwoMetricsOneTopHitOneDerivative = tabifyAggResponse( - vis3.data.aggs, - oneTermOneHistogramBucketWithTwoMetricsOneTopHitOneDerivative - ); - }; const initLocalAngular = () => { const tableVisModule = getAngularModule('kibana/table_vis', npStart.core); @@ -128,20 +40,13 @@ describe('Table Vis - AggTable Directive', function() { beforeEach(initLocalAngular); - ngMock.inject(function() { - visualizationsSetup.createBaseVisualization(tableVisTypeDefinition); - }); - beforeEach(ngMock.module('kibana/table_vis')); beforeEach( - ngMock.inject(function($injector, Private, config) { - indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); + ngMock.inject(function($injector, config) { settings = config; $rootScope = $injector.get('$rootScope'); $compile = $injector.get('$compile'); - - init(); }) ); @@ -158,7 +63,7 @@ describe('Table Vis - AggTable Directive', function() { metrics: [{ accessor: 0, format: { id: 'number' }, params: {} }], buckets: [], }; - $scope.table = tableVisResponseHandler(tabifiedData.metricOnly, $scope.dimensions).tables[0]; + $scope.table = tabifiedData.metricOnly.tables[0]; const $el = $compile('')( $scope @@ -194,10 +99,7 @@ describe('Table Vis - AggTable Directive', function() { { accessor: 5, params: {} }, ], }; - $scope.table = tableVisResponseHandler( - tabifiedData.threeTermBuckets, - $scope.dimensions - ).tables[0]; + $scope.table = tabifiedData.threeTermBuckets.tables[0]; const $el = $(''); $compile($el)($scope); $scope.$digest(); @@ -261,11 +163,8 @@ describe('Table Vis - AggTable Directive', function() { { accessor: 5, format: { id: 'number' } }, ], }; - const response = tableVisResponseHandler( - tabifiedData.oneTermOneHistogramBucketWithTwoMetricsOneTopHitOneDerivative, - $scope.dimensions - ); - $scope.table = response.tables[0]; + $scope.table = + tabifiedData.oneTermOneHistogramBucketWithTwoMetricsOneTopHitOneDerivative.tables[0]; $scope.showTotal = true; $scope.totalFunc = totalFunc; const $el = $(`')( $scope @@ -419,10 +315,7 @@ describe('Table Vis - AggTable Directive', function() { { accessor: 5, params: {} }, ], }; - $scope.table = tableVisResponseHandler( - tabifiedData.threeTermBuckets, - $scope.dimensions - ).tables[0]; + $scope.table = tabifiedData.threeTermBuckets.tables[0]; const $el = $compile('')( $scope @@ -481,11 +374,8 @@ describe('Table Vis - AggTable Directive', function() { { accessor: 5, format: { id: 'number' } }, ], }; - const response = tableVisResponseHandler( - tabifiedData.oneTermOneHistogramBucketWithTwoMetricsOneTopHitOneDerivative, - $scope.dimensions - ); - $scope.table = response.tables[0]; + $scope.table = + tabifiedData.oneTermOneHistogramBucketWithTwoMetricsOneTopHitOneDerivative.tables[0]; $scope.percentageCol = 'Average bytes'; const $el = $(` { - const searchSource = { - getField: name => { - if (name === 'index') { - return indexPattern; - } - }, - }; - const vis1 = visualizationsStart.createVis('table', { - type: 'table', - data: { searchSource, aggs: [] }, - }); - tabifiedData.metricOnly = tabifyAggResponse(vis1.data.aggs, metricOnly); - - const vis2 = visualizationsStart.createVis('pie', { - type: 'pie', - data: { - aggs: [ - { type: 'avg', schema: 'metric', params: { field: 'bytes' } }, - { type: 'terms', schema: 'split', params: { field: 'extension' } }, - { type: 'terms', schema: 'segment', params: { field: 'geo.src' } }, - { type: 'terms', schema: 'segment', params: { field: 'machine.os' } }, - ], - searchSource, - }, - }); - vis2.data.aggs.aggs.forEach(function(agg, i) { - agg.id = 'agg_' + (i + 1); - }); - tabifiedData.threeTermBuckets = tabifyAggResponse(vis2.data.aggs, threeTermBuckets); - }; const initLocalAngular = () => { const tableVisModule = getAngularModule('kibana/table_vis', npStart.core); @@ -78,23 +38,9 @@ describe('Table Vis - AggTableGroup Directive', function() { beforeEach(ngMock.module('kibana/table_vis')); beforeEach( - ngMock.inject(function($injector, Private) { - // this is provided in table_vis_controller.js - // tech debt that will be resolved through further deangularization and moving tests to jest - /* - legacyDependencies = { - // eslint-disable-next-line new-cap - createAngularVisualization: VisFactoryProvider(Private).createAngularVisualization, - }; - - visualizationsSetup.types.registerVisualization(() => createTableVisTypeDefinition(legacyDependencies)); - */ - - indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); + ngMock.inject(function($injector) { $rootScope = $injector.get('$rootScope'); $compile = $injector.get('$compile'); - - init(); }) ); @@ -111,7 +57,7 @@ describe('Table Vis - AggTableGroup Directive', function() { metrics: [{ accessor: 0, format: { id: 'number' }, params: {} }], buckets: [], }; - $scope.group = tableVisResponseHandler(tabifiedData.metricOnly, $scope.dimensions); + $scope.group = tabifiedData.metricOnly; $scope.sort = { columnIndex: null, direction: null, @@ -156,10 +102,7 @@ describe('Table Vis - AggTableGroup Directive', function() { { accessor: 5, params: {} }, ], }; - const group = ($scope.group = tableVisResponseHandler( - tabifiedData.threeTermBuckets, - $scope.dimensions - )); + const group = ($scope.group = tabifiedData.threeTermBucketsWithSplit); const $el = $( '' ); diff --git a/src/legacy/core_plugins/vis_type_table/public/agg_table/__tests__/tabified_data.js b/src/legacy/core_plugins/vis_type_table/public/agg_table/__tests__/tabified_data.js new file mode 100644 index 0000000000000..857b0ea8662cd --- /dev/null +++ b/src/legacy/core_plugins/vis_type_table/public/agg_table/__tests__/tabified_data.js @@ -0,0 +1,795 @@ +/* + * 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 const tabifiedData = { + metricOnly: { + tables: [ + { + columns: [ + { + id: 'col-0-1', + name: 'Count', + }, + ], + rows: [ + { + 'col-0-1': 1000, + }, + ], + }, + ], + }, + threeTermBuckets: { + tables: [ + { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'machine.os: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + ], + }, + threeTermBucketsWithSplit: { + tables: [ + { + title: 'png: extension: Descending', + name: 'extension: Descending', + key: 'png', + column: 0, + row: 0, + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-2-agg_4', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'IT', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'IT', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'linux', + 'col-3-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 3029, + }, + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'MX', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'MX', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'linux', + 'col-3-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 3029, + }, + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'CN', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'CN', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'FR', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'FR', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 3029, + }, + ], + }, + tables: [ + { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-2-agg_4', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'IT', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'IT', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'linux', + 'col-3-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 3029, + }, + ], + }, + ], + }, + { + title: 'css: extension: Descending', + name: 'extension: Descending', + key: 'css', + column: 0, + row: 4, + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-2-agg_4', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'IT', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'IT', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'linux', + 'col-3-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 3029, + }, + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'MX', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'MX', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'linux', + 'col-3-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 3029, + }, + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'CN', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'CN', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'FR', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'FR', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 3029, + }, + ], + }, + tables: [ + { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-2-agg_4', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'MX', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'MX', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'linux', + 'col-3-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 3029, + }, + ], + }, + ], + }, + { + title: 'html: extension: Descending', + name: 'extension: Descending', + key: 'html', + column: 0, + row: 8, + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-2-agg_4', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'IT', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'IT', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'linux', + 'col-3-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 3029, + }, + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'MX', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'MX', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'linux', + 'col-3-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-1-agg_3': 'US', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 3029, + }, + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'CN', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'CN', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'FR', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'FR', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 3029, + }, + ], + }, + tables: [ + { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-2-agg_4', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'CN', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'CN', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'FR', + 'col-2-agg_4': 'win', + 'col-3-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-1-agg_3': 'FR', + 'col-2-agg_4': 'mac', + 'col-3-agg_1': 3029, + }, + ], + }, + ], + }, + ], + direction: 'row', + }, + oneTermOneHistogramBucketWithTwoMetricsOneTopHitOneDerivative: { + tables: [ + { + columns: [ + { + id: 'col-0-agg_3', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_4', + name: '@timestamp per day', + }, + { + id: 'col-2-agg_1', + name: 'Average bytes', + }, + { + id: 'col-3-agg_2', + name: 'Min @timestamp', + }, + { + id: 'col-4-agg_5', + name: 'Derivative of Count', + }, + { + id: 'col-5-agg_6', + name: 'Last bytes', + }, + ], + rows: [ + { + 'col-0-agg_3': 'png', + 'col-1-agg_4': 1411862400000, + 'col-2-agg_1': 9283, + 'col-3-agg_2': 1411862400000, + 'col-5-agg_6': 23, + }, + { + 'col-0-agg_3': 'png', + 'col-1-agg_4': 1411948800000, + 'col-2-agg_1': 28349, + 'col-3-agg_2': 1411948800000, + 'col-4-agg_5': 203, + 'col-5-agg_6': 39, + }, + { + 'col-0-agg_3': 'png', + 'col-1-agg_4': 1412035200000, + 'col-2-agg_1': 84330, + 'col-3-agg_2': 1412035200000, + 'col-4-agg_5': 200, + 'col-5-agg_6': 329, + }, + { + 'col-0-agg_3': 'png', + 'col-1-agg_4': 1412121600000, + 'col-2-agg_1': 34992, + 'col-3-agg_2': 1412121600000, + 'col-4-agg_5': 103, + 'col-5-agg_6': 22, + }, + { + 'col-0-agg_3': 'png', + 'col-1-agg_4': 1412208000000, + 'col-2-agg_1': 145432, + 'col-3-agg_2': 1412208000000, + 'col-4-agg_5': 153, + 'col-5-agg_6': 93, + }, + { + 'col-0-agg_3': 'png', + 'col-1-agg_4': 1412294400000, + 'col-2-agg_1': 220943, + 'col-3-agg_2': 1412294400000, + 'col-4-agg_5': 239, + 'col-5-agg_6': 72, + }, + { + 'col-0-agg_3': 'css', + 'col-1-agg_4': 1411862400000, + 'col-2-agg_1': 9283, + 'col-3-agg_2': 1411862400000, + 'col-5-agg_6': 75, + }, + { + 'col-0-agg_3': 'css', + 'col-1-agg_4': 1411948800000, + 'col-2-agg_1': 28349, + 'col-3-agg_2': 1411948800000, + 'col-4-agg_5': 10, + 'col-5-agg_6': 11, + }, + { + 'col-0-agg_3': 'css', + 'col-1-agg_4': 1412035200000, + 'col-2-agg_1': 84330, + 'col-3-agg_2': 1412035200000, + 'col-4-agg_5': 24, + 'col-5-agg_6': 238, + }, + { + 'col-0-agg_3': 'css', + 'col-1-agg_4': 1412121600000, + 'col-2-agg_1': 34992, + 'col-3-agg_2': 1412121600000, + 'col-4-agg_5': 49, + 'col-5-agg_6': 343, + }, + { + 'col-0-agg_3': 'css', + 'col-1-agg_4': 1412208000000, + 'col-2-agg_1': 145432, + 'col-3-agg_2': 1412208000000, + 'col-4-agg_5': 100, + 'col-5-agg_6': 837, + }, + { + 'col-0-agg_3': 'css', + 'col-1-agg_4': 1412294400000, + 'col-2-agg_1': 220943, + 'col-3-agg_2': 1412294400000, + 'col-4-agg_5': 23, + 'col-5-agg_6': 302, + }, + { + 'col-0-agg_3': 'html', + 'col-1-agg_4': 1411862400000, + 'col-2-agg_1': 9283, + 'col-3-agg_2': 1411862400000, + 'col-5-agg_6': 30, + }, + { + 'col-0-agg_3': 'html', + 'col-1-agg_4': 1411948800000, + 'col-2-agg_1': 28349, + 'col-3-agg_2': 1411948800000, + 'col-4-agg_5': 1, + 'col-5-agg_6': 43, + }, + { + 'col-0-agg_3': 'html', + 'col-1-agg_4': 1412035200000, + 'col-2-agg_1': 84330, + 'col-3-agg_2': 1412035200000, + 'col-4-agg_5': 5, + 'col-5-agg_6': 88, + }, + { + 'col-0-agg_3': 'html', + 'col-1-agg_4': 1412121600000, + 'col-2-agg_1': 34992, + 'col-3-agg_2': 1412121600000, + 'col-4-agg_5': 10, + 'col-5-agg_6': 91, + }, + { + 'col-0-agg_3': 'html', + 'col-1-agg_4': 1412208000000, + 'col-2-agg_1': 145432, + 'col-3-agg_2': 1412208000000, + 'col-4-agg_5': 43, + 'col-5-agg_6': 534, + }, + { + 'col-0-agg_3': 'html', + 'col-1-agg_4': 1412294400000, + 'col-2-agg_1': 220943, + 'col-3-agg_2': 1412294400000, + 'col-4-agg_5': 1, + 'col-5-agg_6': 553, + }, + ], + }, + ], + }, +}; diff --git a/src/legacy/core_plugins/vis_type_table/public/legacy.ts b/src/legacy/core_plugins/vis_type_table/public/legacy.ts index 30403139d212d..3d5f8c1b3efe9 100644 --- a/src/legacy/core_plugins/vis_type_table/public/legacy.ts +++ b/src/legacy/core_plugins/vis_type_table/public/legacy.ts @@ -22,11 +22,10 @@ import { npSetup, npStart } from './legacy_imports'; import { plugin } from '.'; import { TablePluginSetupDependencies } from './plugin'; -import { setup as visualizationsSetup } from '../../visualizations/public/np_ready/public/legacy'; const plugins: Readonly = { expressions: npSetup.plugins.expressions, - visualizations: visualizationsSetup, + visualizations: npSetup.plugins.visualizations, }; const pluginInstance = plugin({} as PluginInitializerContext); 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 42bd36c83e28c..ea12a5320a14d 100644 --- a/src/legacy/core_plugins/vis_type_table/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_table/public/plugin.ts @@ -17,7 +17,7 @@ * under the License. */ import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public'; -import { VisualizationsSetup } from '../../visualizations/public'; +import { VisualizationsSetup } from '../../../../plugins/visualizations/public'; import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '../../../../core/public'; diff --git a/src/legacy/core_plugins/vis_type_table/public/table_vis_controller.test.ts b/src/legacy/core_plugins/vis_type_table/public/table_vis_controller.test.ts index ad56607e9296c..8d6f88bf8dd4a 100644 --- a/src/legacy/core_plugins/vis_type_table/public/table_vis_controller.test.ts +++ b/src/legacy/core_plugins/vis_type_table/public/table_vis_controller.test.ts @@ -27,7 +27,7 @@ import StubIndexPattern from 'test_utils/stub_index_pattern'; import { getAngularModule } from './get_inner_angular'; import { initTableVisLegacyModule } from './table_vis_legacy_module'; import { tableVisTypeDefinition } from './table_vis_type'; -import { Vis } from '../../visualizations/public'; +import { Vis } from '../../../../plugins/visualizations/public'; // eslint-disable-next-line import { stubFields } from '../../../../plugins/data/public/stubs'; // eslint-disable-next-line 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 e70b09904253f..d26e860e51272 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 @@ -20,7 +20,7 @@ import { i18n } from '@kbn/i18n'; import { AggGroupNames } from '../../../../plugins/data/public'; import { Schemas } from '../../vis_default_editor/public'; -import { Vis } from '../../visualizations/public'; +import { Vis } from '../../../../plugins/visualizations/public'; import { tableVisResponseHandler } from './table_vis_response_handler'; // @ts-ignore import tableVisTemplate from './table_vis.html'; diff --git a/src/legacy/core_plugins/vis_type_table/public/types.ts b/src/legacy/core_plugins/vis_type_table/public/types.ts index 39023d1305cb6..c6de14b9f050c 100644 --- a/src/legacy/core_plugins/vis_type_table/public/types.ts +++ b/src/legacy/core_plugins/vis_type_table/public/types.ts @@ -17,7 +17,7 @@ * under the License. */ -import { SchemaConfig } from '../../visualizations/public'; +import { SchemaConfig } from '../../../../plugins/visualizations/public'; export enum AggTypes { SUM = 'sum', diff --git a/src/legacy/core_plugins/vis_type_table/public/vis_controller.ts b/src/legacy/core_plugins/vis_type_table/public/vis_controller.ts index 2feaad9f4e6b6..5bb730d2f9b10 100644 --- a/src/legacy/core_plugins/vis_type_table/public/vis_controller.ts +++ b/src/legacy/core_plugins/vis_type_table/public/vis_controller.ts @@ -20,11 +20,10 @@ import angular, { IModule, auto, IRootScopeService, IScope, ICompileService } from 'angular'; import $ from 'jquery'; -import { VisParams } from '../../visualizations/public'; +import { VisParams, ExprVis } from '../../../../plugins/visualizations/public'; import { npStart } from './legacy_imports'; import { getAngularModule } from './get_inner_angular'; import { initTableVisLegacyModule } from './table_vis_legacy_module'; -import { ExprVis } from '../../visualizations/public/np_ready/public/expressions/vis'; const innerAngularName = 'kibana/table_vis'; 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 6f54744a2f508..9e611861417cd 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 @@ -19,20 +19,23 @@ import expect from '@kbn/expect'; import ngMock from 'ng_mock'; -import { start as visualizationsStart } from '../../../../../core_plugins/visualizations/public/np_ready/public/legacy'; import { ImageComparator } from 'test_utils/image_comparator'; import { createTagCloudVisualization } from '../tag_cloud_visualization'; import basicdrawPng from './basicdraw.png'; import afterresizePng from './afterresize.png'; import afterparamChange from './afterparamchange.png'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { ExprVis } from '../../../../../../plugins/visualizations/public/expressions/vis'; // Replace with mock when converting to jest tests // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { seedColors } from '../../../../../../plugins/charts/public/services/colors/seed_colors'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { BaseVisType } from '../../../../../../plugins/visualizations/public/vis_types/base_vis_type'; +import { createTagCloudVisTypeDefinition } from '../../tag_cloud_type'; const THRESHOLD = 0.65; const PIXEL_DIFF = 64; - describe('TagCloudVisualizationTest', function() { let domNode; let vis; @@ -67,10 +70,11 @@ describe('TagCloudVisualizationTest', function() { describe('TagCloudVisualization - basics', function() { beforeEach(async function() { + const visType = new BaseVisType(createTagCloudVisTypeDefinition({ colors: seedColors })); setupDOM('512px', '512px'); imageComparator = new ImageComparator(); - vis = visualizationsStart.createVis('tagcloud', { - type: 'tagcloud', + vis = new ExprVis({ + type: visType, params: { bucket: { accessor: 0, format: {} }, metric: { accessor: 0, format: {} }, diff --git a/src/legacy/core_plugins/vis_type_tagcloud/public/legacy.ts b/src/legacy/core_plugins/vis_type_tagcloud/public/legacy.ts index 96073caf20515..f70789edc66ba 100644 --- a/src/legacy/core_plugins/vis_type_tagcloud/public/legacy.ts +++ b/src/legacy/core_plugins/vis_type_tagcloud/public/legacy.ts @@ -19,14 +19,12 @@ import { PluginInitializerContext } from 'kibana/public'; import { npSetup, npStart } from 'ui/new_platform'; - -import { setup as visualizationsSetup } from '../../visualizations/public/np_ready/public/legacy'; import { TagCloudPluginSetupDependencies } from './plugin'; import { plugin } from '.'; const plugins: Readonly = { expressions: npSetup.plugins.expressions, - visualizations: visualizationsSetup, + visualizations: npSetup.plugins.visualizations, charts: npSetup.plugins.charts, }; 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 c9dd4943519be..1061271aa315b 100644 --- a/src/legacy/core_plugins/vis_type_tagcloud/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_tagcloud/public/plugin.ts @@ -19,7 +19,7 @@ import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '../../../../core/public'; import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public'; -import { VisualizationsSetup } from '../../visualizations/public'; +import { VisualizationsSetup } from '../../../../plugins/visualizations/public'; import { ChartsPluginSetup } from '../../../../plugins/charts/public'; import { createTagCloudFn } from './tag_cloud_fn'; diff --git a/src/legacy/core_plugins/vis_type_tagcloud/public/services.ts b/src/legacy/core_plugins/vis_type_tagcloud/public/services.ts index 30fd185be877d..fef46282eb8dd 100644 --- a/src/legacy/core_plugins/vis_type_tagcloud/public/services.ts +++ b/src/legacy/core_plugins/vis_type_tagcloud/public/services.ts @@ -23,3 +23,5 @@ import { DataPublicPluginStart } from '../../../../plugins/data/public'; export const [getFormatService, setFormatService] = createGetterSetter< DataPublicPluginStart['fieldFormats'] >('data.fieldFormats'); + +export { npStart } from 'ui/new_platform'; diff --git a/src/legacy/core_plugins/vis_type_timelion/index.ts b/src/legacy/core_plugins/vis_type_timelion/index.ts index 6c1e3f452959e..7bca5154c84fd 100644 --- a/src/legacy/core_plugins/vis_type_timelion/index.ts +++ b/src/legacy/core_plugins/vis_type_timelion/index.ts @@ -25,7 +25,7 @@ import { LegacyPluginApi, LegacyPluginInitializer } from '../../../../src/legacy const timelionVisPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) => new Plugin({ id: 'timelion_vis', - require: ['kibana', 'elasticsearch', 'visualizations'], + require: ['kibana', 'elasticsearch'], publicDir: resolve(__dirname, 'public'), uiExports: { styleSheetPaths: resolve(__dirname, 'public/index.scss'), diff --git a/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_vis.tsx b/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_vis.tsx index f55d1602ea342..0fad0a164bf0b 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/components/timelion_vis.tsx +++ b/src/legacy/core_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 '../../../visualizations/public/np_ready/public/expressions/vis'; +import { ExprVis } from '../../../../../plugins/visualizations/public'; export interface TimelionVisComponentProp { config: IUiSettingsClient; diff --git a/src/legacy/core_plugins/vis_type_timelion/public/helpers/timelion_request_handler.ts b/src/legacy/core_plugins/vis_type_timelion/public/helpers/timelion_request_handler.ts index 47bfed6340e93..61e31420f73ba 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/helpers/timelion_request_handler.ts +++ b/src/legacy/core_plugins/vis_type_timelion/public/helpers/timelion_request_handler.ts @@ -19,7 +19,7 @@ import { i18n } from '@kbn/i18n'; import { KIBANA_CONTEXT_NAME } from 'src/plugins/expressions/public'; -import { VisParams } from 'src/legacy/core_plugins/visualizations/public'; +import { VisParams } from '../../../../../plugins/visualizations/public'; import { TimeRange, Filter, esQuery, Query } from '../../../../../plugins/data/public'; import { TimelionVisDependencies } from '../plugin'; import { getTimezone } from './get_timezone'; diff --git a/src/legacy/core_plugins/vis_type_timelion/public/legacy.ts b/src/legacy/core_plugins/vis_type_timelion/public/legacy.ts index 9935f3d92f6bd..f8de9f94dcedf 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/legacy.ts +++ b/src/legacy/core_plugins/vis_type_timelion/public/legacy.ts @@ -20,15 +20,13 @@ import { PluginInitializerContext } from 'kibana/public'; import { npSetup, npStart } from './legacy_imports'; - -import { setup as visualizationsSetup } from '../../visualizations/public/np_ready/public/legacy'; import { TimelionVisSetupDependencies } from './plugin'; import { plugin } from '.'; const setupPlugins: Readonly = { expressions: npSetup.plugins.expressions, data: npSetup.plugins.data, - visualizations: visualizationsSetup, + visualizations: npSetup.plugins.visualizations, }; const pluginInstance = plugin({} as PluginInitializerContext); 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 8d067369fef70..b5aa64db19aa4 100644 --- a/src/legacy/core_plugins/vis_type_timelion/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_timelion/public/plugin.ts @@ -29,7 +29,7 @@ import { Plugin as ExpressionsPlugin } from 'src/plugins/expressions/public'; import { DataPublicPluginSetup, TimefilterContract } from 'src/plugins/data/public'; import { PluginsStart } from './legacy_imports'; -import { VisualizationsSetup } from '../../visualizations/public/np_ready/public'; +import { VisualizationsSetup } from '../../../../plugins/visualizations/public'; import { getTimelionVisualizationConfig } from './timelion_vis_fn'; import { getTimelionVisDefinition } from './timelion_vis_type'; diff --git a/src/legacy/core_plugins/vis_type_timeseries/public/legacy.ts b/src/legacy/core_plugins/vis_type_timeseries/public/legacy.ts index fb22bbd4146e2..42f116701be51 100644 --- a/src/legacy/core_plugins/vis_type_timeseries/public/legacy.ts +++ b/src/legacy/core_plugins/vis_type_timeseries/public/legacy.ts @@ -19,14 +19,12 @@ import { PluginInitializerContext } from 'kibana/public'; import { npSetup, npStart } from 'ui/new_platform'; - -import { setup as visualizationsSetup } from '../../visualizations/public/np_ready/public/legacy'; import { MetricsPluginSetupDependencies } from './plugin'; import { plugin } from '.'; const plugins: Readonly = { expressions: npSetup.plugins.expressions, - visualizations: visualizationsSetup, + visualizations: npSetup.plugins.visualizations, }; const pluginInstance = plugin({} as PluginInitializerContext); 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 441b1f05ea78c..0310ecf6cfd87 100644 --- a/src/legacy/core_plugins/vis_type_timeseries/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_timeseries/public/plugin.ts @@ -18,7 +18,7 @@ */ import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from 'kibana/public'; import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public'; -import { VisualizationsSetup } from '../../visualizations/public'; +import { VisualizationsSetup } from '../../../../plugins/visualizations/public'; import { createMetricsFn } from './metrics_fn'; import { metricsVisDefinition } from './metrics_type'; 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 0db3e6cefa724..c7fbc0815b07c 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 @@ -39,15 +39,15 @@ import vegaMapImage256 from './vega_map_image_256.png'; import { VegaParser } from '../data_model/vega_parser'; import { SearchCache } from '../data_model/search_cache'; -import { - setup as visualizationsSetup, - start as visualizationsStart, -} from '../../../visualizations/public/np_ready/public/legacy'; import { createVegaTypeDefinition } from '../vega_type'; // TODO This is an integration test and thus requires a running platform. When moving to the new platform, // this test has to be migrated to the newly created integration test environment. // eslint-disable-next-line @kbn/eslint/no-restricted-paths import { npStart } from 'ui/new_platform'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { BaseVisType } from '../../../../../plugins/visualizations/public/vis_types/base_vis_type'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { ExprVis } from '../../../../../plugins/visualizations/public/expressions/vis'; import { setInjectedVars } from '../services'; const THRESHOLD = 0.1; @@ -59,7 +59,7 @@ describe('VegaVisualizations', () => { let vis; let imageComparator; let vegaVisualizationDependencies; - let visRegComplete = false; + let vegaVisType; setInjectedVars({ emsTileLayerId: {}, @@ -89,13 +89,7 @@ describe('VegaVisualizations', () => { }, }; - if (!visRegComplete) { - visRegComplete = true; - visualizationsSetup.createBaseVisualization( - createVegaTypeDefinition(vegaVisualizationDependencies) - ); - } - + vegaVisType = new BaseVisType(createVegaTypeDefinition(vegaVisualizationDependencies)); VegaVisualization = createVegaVisualization(vegaVisualizationDependencies); }) ); @@ -105,7 +99,9 @@ describe('VegaVisualizations', () => { setupDOM('512px', '512px'); imageComparator = new ImageComparator(); - vis = visualizationsStart.createVis('vega', { type: 'vega' }); + vis = new ExprVis({ + type: vegaVisType, + }); }); afterEach(function() { diff --git a/src/legacy/core_plugins/vis_type_vega/public/legacy.ts b/src/legacy/core_plugins/vis_type_vega/public/legacy.ts index 38ce706ed13ef..b2c73894d978d 100644 --- a/src/legacy/core_plugins/vis_type_vega/public/legacy.ts +++ b/src/legacy/core_plugins/vis_type_vega/public/legacy.ts @@ -19,15 +19,13 @@ import { PluginInitializerContext } from 'kibana/public'; import { npSetup, npStart } from 'ui/new_platform'; - -import { setup as visualizationsSetup } from '../../visualizations/public/np_ready/public/legacy'; import { VegaPluginSetupDependencies, VegaPluginStartDependencies } from './plugin'; import { LegacyDependenciesPlugin } from './shim'; import { plugin } from '.'; const setupPlugins: Readonly = { ...npSetup.plugins, - visualizations: visualizationsSetup, + visualizations: npSetup.plugins.visualizations, // Temporary solution // It will be removed when all dependent services are migrated to the new platform. 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 3b01d9ceca5a6..38b92a40cd99a 100644 --- a/src/legacy/core_plugins/vis_type_vega/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_vega/public/plugin.ts @@ -20,7 +20,7 @@ import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '../../.. import { LegacyDependenciesPlugin, LegacyDependenciesPluginSetup } from './shim'; import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public'; import { Plugin as DataPublicPlugin } from '../../../../plugins/data/public'; -import { VisualizationsSetup } from '../../visualizations/public'; +import { VisualizationsSetup } from '../../../../plugins/visualizations/public'; import { setNotifications, setData, diff --git a/src/legacy/core_plugins/vis_type_vislib/index.ts b/src/legacy/core_plugins/vis_type_vislib/index.ts index 1f75aea31ba0b..da9476285a9b2 100644 --- a/src/legacy/core_plugins/vis_type_vislib/index.ts +++ b/src/legacy/core_plugins/vis_type_vislib/index.ts @@ -25,7 +25,7 @@ import { LegacyPluginApi, LegacyPluginInitializer } from '../../types'; const visTypeVislibPluginInitializer: LegacyPluginInitializer = ({ Plugin }: LegacyPluginApi) => new Plugin({ id: 'vis_type_vislib', - require: ['kibana', 'elasticsearch', 'visualizations', 'interpreter'], + require: ['kibana', 'elasticsearch', 'interpreter'], publicDir: resolve(__dirname, 'public'), styleSheetPaths: resolve(__dirname, 'public/index.scss'), uiExports: { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.tsx index bc12e04e29468..ec7a325ba43d1 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/chart_options.tsx @@ -22,7 +22,7 @@ import React, { useMemo, useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; -import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { Vis } from '../../../../../../../plugins/visualizations/public'; import { SeriesParam, ValueAxis } from '../../../types'; import { ChartTypes } from '../../../utils/collections'; import { SelectOption } from '../../common'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.tsx index a53d21b121f7d..01a69a6fac70b 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/line_options.tsx @@ -22,7 +22,7 @@ import React, { useCallback } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; -import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { Vis } from '../../../../../../../plugins/visualizations/public'; import { SeriesParam } from '../../../types'; import { NumberInputOption, SelectOption, SwitchOption } from '../../common'; import { SetChart } from './chart_options'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/mocks.ts b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/mocks.ts index 58c75629f1fa1..0d9fa8c25a4f7 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/mocks.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/mocks.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { Vis } from '../../../../../../../plugins/visualizations/public'; import { Axis, ValueAxis, SeriesParam, Style } from '../../../types'; import { ChartTypes, diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/series_panel.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/series_panel.tsx index 44e7a4cfb0088..22a726b53363b 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/series_panel.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/series_panel.tsx @@ -23,7 +23,7 @@ import { EuiPanel, EuiTitle, EuiSpacer, EuiAccordion } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { Vis } from '../../../../../../../plugins/visualizations/public'; import { ValueAxis, SeriesParam } from '../../../types'; import { ChartOptions } from './chart_options'; import { SetParamByIndex, ChangeValueAxis } from './'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.tsx index 30d80ed595fe7..912c3b904b110 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axes_panel.tsx @@ -31,7 +31,7 @@ import { import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { Vis } from '../../../../../../../plugins/visualizations/public'; import { SeriesParam, ValueAxis } from '../../../types'; import { ValueAxisOptions } from './value_axis_options'; import { SetParamByIndex } from './'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.tsx b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.tsx index 0e78bf2f31ef6..8f0327e78c7ab 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/components/options/metrics_axes/value_axis_options.tsx @@ -21,7 +21,7 @@ import React, { useCallback, useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import { EuiSpacer, EuiAccordion, EuiHorizontalRule } from '@elastic/eui'; -import { Vis } from 'src/legacy/core_plugins/visualizations/public'; +import { Vis } from '../../../../../../../plugins/visualizations/public'; import { ValueAxis } from '../../../types'; import { Positions } from '../../../utils/collections'; import { SelectOption, SwitchOption, TextInputOption } from '../../common'; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/legacy.ts b/src/legacy/core_plugins/vis_type_vislib/public/legacy.ts index ef7277222e5fd..aa11e0ef41fba 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/legacy.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/legacy.ts @@ -25,11 +25,10 @@ import { VisTypeVislibPluginSetupDependencies, VisTypeVislibPluginStartDependencies, } from './plugin'; -import { setup as visualizationsSetup } from '../../visualizations/public/np_ready/public/legacy'; const setupPlugins: Readonly = { expressions: npSetup.plugins.expressions, - visualizations: visualizationsSetup, + visualizations: npSetup.plugins.visualizations, charts: npSetup.plugins.charts, }; diff --git a/src/legacy/core_plugins/vis_type_vislib/public/legacy_imports.ts b/src/legacy/core_plugins/vis_type_vislib/public/legacy_imports.ts index 9f7b8cbeea11e..da16a38deba9f 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/legacy_imports.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/legacy_imports.ts @@ -19,6 +19,7 @@ import { search } from '../../../../plugins/data/public'; export const { tabifyAggResponse, tabifyGetColumns } = search; + // @ts-ignore export { buildHierarchicalData } from 'ui/agg_response/hierarchical/build_hierarchical_data'; // @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 8b4510050802e..2731fb6f5fbe6 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_vislib/public/plugin.ts @@ -25,7 +25,7 @@ import { } from 'kibana/public'; import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public'; -import { VisualizationsSetup } from '../../visualizations/public'; +import { VisualizationsSetup } from '../../../../plugins/visualizations/public'; import { createVisTypeVislibVisFn } from './vis_type_vislib_vis_fn'; import { createPieVisFn } from './pie_fn'; import { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vis_controller.tsx b/src/legacy/core_plugins/vis_type_vislib/public/vis_controller.tsx index 010b61a0900b0..ec091e5d29cfd 100644 --- a/src/legacy/core_plugins/vis_type_vislib/public/vis_controller.tsx +++ b/src/legacy/core_plugins/vis_type_vislib/public/vis_controller.tsx @@ -26,8 +26,7 @@ import { Positions } from './utils/collections'; import { VisTypeVislibDependencies } from './plugin'; import { mountReactNode } from '../../../../core/public/utils'; import { VisLegend, CUSTOM_LEGEND_VIS_TYPES } from './vislib/components/legend'; -import { VisParams } from '../../visualizations/public'; -import { ExprVis } from '../../visualizations/public/np_ready/public/expressions/vis'; +import { VisParams, ExprVis } from '../../../../plugins/visualizations/public'; const legendClassName = { top: 'visLib--legend-top', 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 21f4e60e4bc6e..caafb2c636271 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 @@ -22,91 +22,8 @@ import _ from 'lodash'; import $ from 'jquery'; import expect from '@kbn/expect'; -import { threeTermBuckets } from 'fixtures/fake_hierarchical_data'; -import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; - -import { start as visualizationsStart } from '../../../../../visualizations/public/np_ready/public/legacy'; import { getVis, getMockUiState } from '../lib/fixtures/_vis_fixture'; -import { tabifyAggResponse } from '../../../legacy_imports'; -import { vislibSlicesResponseHandler } from '../../response_handler'; - -const rowAgg = [ - { type: 'avg', schema: 'metric', params: { field: 'bytes' } }, - { type: 'terms', schema: 'split', params: { field: 'extension', rows: true } }, - { type: 'terms', schema: 'segment', params: { field: 'machine.os' } }, - { type: 'terms', schema: 'segment', params: { field: 'geo.src' } }, -]; - -const rowAggDimensions = { - splitRow: [ - { - accessor: 0, - }, - ], - buckets: [ - { - accessor: 2, - }, - { - accessor: 4, - }, - ], - metric: { - accessor: 5, - }, -}; - -const colAgg = [ - { type: 'avg', schema: 'metric', params: { field: 'bytes' } }, - { type: 'terms', schema: 'split', params: { field: 'extension', row: false } }, - { type: 'terms', schema: 'segment', params: { field: 'machine.os' } }, - { type: 'terms', schema: 'segment', params: { field: 'geo.src' } }, -]; - -const colAggDimensions = { - splitColumn: [ - { - accessor: 0, - }, - ], - buckets: [ - { - accessor: 2, - }, - { - accessor: 4, - }, - ], - metric: { - accessor: 5, - }, -}; - -const sliceAgg = [ - { type: 'avg', schema: 'metric', params: { field: 'bytes' } }, - { type: 'terms', schema: 'segment', params: { field: 'machine.os' } }, - { type: 'terms', schema: 'segment', params: { field: 'geo.src' } }, -]; - -const sliceAggDimensions = { - buckets: [ - { - accessor: 0, - }, - { - accessor: 2, - }, - ], - metric: { - accessor: 3, - }, -}; - -const aggArray = [ - [rowAgg, rowAggDimensions], - [colAgg, colAggDimensions], - [sliceAgg, sliceAggDimensions], -]; +import { pieChartMockData } from './pie_chart_mock_data'; const names = ['rows', 'columns', 'slices']; @@ -121,47 +38,14 @@ describe('No global chart settings', function() { }; let chart1; let mockUiState; - let indexPattern; - let responseHandler; - let data1; - let stubVis1; beforeEach(() => { chart1 = getVis(visLibParams1); mockUiState = getMockUiState(); - indexPattern = new FixturesStubbedLogstashIndexPatternProvider(); - responseHandler = vislibSlicesResponseHandler; - - let id1 = 1; - stubVis1 = visualizationsStart.createVis('pie', { - type: 'pie', - data: { - aggs: rowAgg, - searchSource: { - getField: name => { - if (name === 'index') { - return indexPattern; - } - }, - }, - }, - }); - - stubVis1.isHierarchical = () => true; - - // We need to set the aggs to a known value. - _.each(stubVis1.data.aggs.aggs, function(agg) { - agg.id = 'agg_' + id1++; - }); }); beforeEach(async () => { - const table1 = tabifyAggResponse(stubVis1.data.aggs, threeTermBuckets, { - metricsAtAllLevels: true, - }); - data1 = await responseHandler(table1, rowAggDimensions); - - chart1.render(data1, mockUiState); + chart1.render(pieChartMockData.rowData, mockUiState); }); afterEach(function() { @@ -209,55 +93,21 @@ describe('No global chart settings', function() { }); describe('Vislib PieChart Class Test Suite', function() { - aggArray.forEach(function(aggItem, i) { - const [dataAgg, dataDimensions] = aggItem; + ['rowData', 'columnData', 'sliceData'].forEach(function(aggItem, i) { describe('Vislib PieChart Class Test Suite for ' + names[i] + ' data', function() { + const mockPieData = pieChartMockData[aggItem]; + const visLibParams = { type: 'pie', addLegend: true, addTooltip: true, }; let vis; - let mockUiState; - let indexPattern; - let data; - let stubVis; - let responseHandler; - - beforeEach(() => { - vis = getVis(visLibParams); - mockUiState = getMockUiState(); - indexPattern = new FixturesStubbedLogstashIndexPatternProvider(); - responseHandler = vislibSlicesResponseHandler; - - let id = 1; - stubVis = visualizationsStart.createVis('pie', { - type: 'pie', - data: { - aggs: dataAgg, - searchSource: { - getField: name => { - if (name === 'index') { - return indexPattern; - } - }, - }, - }, - }); - - // We need to set the aggs to a known value. - _.each(stubVis.data.aggs.aggs, function(agg) { - agg.id = 'agg_' + id++; - }); - }); beforeEach(async () => { - const table = tabifyAggResponse(stubVis.data.aggs, threeTermBuckets, { - metricsAtAllLevels: true, - }); - data = await responseHandler(table, dataDimensions); - - vis.render(data, mockUiState); + vis = getVis(visLibParams); + const mockUiState = getMockUiState(); + vis.render(mockPieData, mockUiState); }); afterEach(function() { diff --git a/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/pie_chart_mock_data.js b/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/pie_chart_mock_data.js new file mode 100644 index 0000000000000..188cd51759e51 --- /dev/null +++ b/src/legacy/core_plugins/vis_type_vislib/public/vislib/__tests__/visualizations/pie_chart_mock_data.js @@ -0,0 +1,3742 @@ +/* + * 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 const pieChartMockData = { + rowData: { + rows: [ + { + hits: 4, + raw: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + names: ['IT', 'win', 'mac', 'US', 'linux'], + slices: { + children: [ + { + name: 'IT', + size: 9299, + children: [ + { + name: 'win', + size: 0, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 0, + column: 4, + value: 'win', + }, + }, + { + name: 'mac', + size: 9299, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 1, + column: 4, + value: 'mac', + }, + }, + ], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 0, + column: 2, + value: 'IT', + }, + }, + { + name: 'US', + size: 8293, + children: [ + { + name: 'linux', + size: 3992, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 2, + column: 4, + value: 'linux', + }, + }, + { + name: 'mac', + size: 3029, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 3, + column: 4, + value: 'mac', + }, + }, + ], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 2, + column: 2, + value: 'US', + }, + }, + ], + }, + label: 'png: extension: Descending', + }, + { + hits: 4, + raw: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + names: ['MX', 'win', 'mac', 'US', 'linux'], + slices: { + children: [ + { + name: 'MX', + size: 9299, + children: [ + { + name: 'win', + size: 4992, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 0, + column: 4, + value: 'win', + }, + }, + { + name: 'mac', + size: 5892, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 1, + column: 4, + value: 'mac', + }, + }, + ], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 0, + column: 2, + value: 'MX', + }, + }, + { + name: 'US', + size: 8293, + children: [ + { + name: 'linux', + size: 3992, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 2, + column: 4, + value: 'linux', + }, + }, + { + name: 'mac', + size: 3029, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 3, + column: 4, + value: 'mac', + }, + }, + ], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 2, + column: 2, + value: 'US', + }, + }, + ], + }, + label: 'css: extension: Descending', + }, + { + hits: 4, + raw: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + names: ['CN', 'win', 'mac', 'FR'], + slices: { + children: [ + { + name: 'CN', + size: 9299, + children: [ + { + name: 'win', + size: 4992, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 0, + column: 4, + value: 'win', + }, + }, + { + name: 'mac', + size: 5892, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 1, + column: 4, + value: 'mac', + }, + }, + ], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 0, + column: 2, + value: 'CN', + }, + }, + { + name: 'FR', + size: 8293, + children: [ + { + name: 'win', + size: 3992, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 2, + column: 4, + value: 'win', + }, + }, + { + name: 'mac', + size: 3029, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 3, + column: 4, + value: 'mac', + }, + }, + ], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 2, + column: 2, + value: 'FR', + }, + }, + ], + }, + label: 'html: extension: Descending', + }, + ], + hits: 12, + }, + columnData: { + columns: [ + { + hits: 4, + raw: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + names: ['IT', 'win', 'mac', 'US', 'linux'], + slices: { + children: [ + { + name: 'IT', + size: 9299, + children: [ + { + name: 'win', + size: 0, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 0, + column: 4, + value: 'win', + }, + }, + { + name: 'mac', + size: 9299, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 1, + column: 4, + value: 'mac', + }, + }, + ], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 0, + column: 2, + value: 'IT', + }, + }, + { + name: 'US', + size: 8293, + children: [ + { + name: 'linux', + size: 3992, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 2, + column: 4, + value: 'linux', + }, + }, + { + name: 'mac', + size: 3029, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 3, + column: 4, + value: 'mac', + }, + }, + ], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 0, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 2, + column: 2, + value: 'US', + }, + }, + ], + }, + label: 'png: extension: Descending', + }, + { + hits: 4, + raw: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + names: ['MX', 'win', 'mac', 'US', 'linux'], + slices: { + children: [ + { + name: 'MX', + size: 9299, + children: [ + { + name: 'win', + size: 4992, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 0, + column: 4, + value: 'win', + }, + }, + { + name: 'mac', + size: 5892, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 1, + column: 4, + value: 'mac', + }, + }, + ], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 0, + column: 2, + value: 'MX', + }, + }, + { + name: 'US', + size: 8293, + children: [ + { + name: 'linux', + size: 3992, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 2, + column: 4, + value: 'linux', + }, + }, + { + name: 'mac', + size: 3029, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 3, + column: 4, + value: 'mac', + }, + }, + ], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'linux', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 2, + column: 2, + value: 'US', + }, + }, + ], + }, + label: 'css: extension: Descending', + }, + { + hits: 4, + raw: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + names: ['CN', 'win', 'mac', 'FR'], + slices: { + children: [ + { + name: 'CN', + size: 9299, + children: [ + { + name: 'win', + size: 4992, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 0, + column: 4, + value: 'win', + }, + }, + { + name: 'mac', + size: 5892, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 1, + column: 4, + value: 'mac', + }, + }, + ], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 0, + column: 2, + value: 'CN', + }, + }, + { + name: 'FR', + size: 8293, + children: [ + { + name: 'win', + size: 3992, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 2, + column: 4, + value: 'win', + }, + }, + { + name: 'mac', + size: 3029, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 3, + column: 4, + value: 'mac', + }, + }, + ], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'extension: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'machine.os: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + { + id: 'col-4-agg_4', + name: 'geo.src: Descending', + }, + { + id: 'col-5-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 4992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + 'col-5-agg_1': 5892, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'win', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3992, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-4-agg_4': 'mac', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + 'col-5-agg_1': 3029, + }, + ], + }, + row: 2, + column: 2, + value: 'FR', + }, + }, + ], + }, + label: 'html: extension: Descending', + }, + ], + hits: 12, + }, + sliceData: { + hits: 6, + raw: { + columns: [ + { + id: 'col-0-agg_2', + name: 'machine.os: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + ], + }, + names: ['png', 'IT', 'US', 'css', 'MX', 'html', 'CN', 'FR'], + slices: { + children: [ + { + name: 'png', + size: 412032, + children: [ + { + name: 'IT', + size: 9299, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'machine.os: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + ], + }, + row: 0, + column: 2, + value: 'IT', + }, + }, + { + name: 'US', + size: 8293, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'machine.os: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + ], + }, + row: 1, + column: 2, + value: 'US', + }, + }, + ], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'machine.os: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + ], + }, + row: 0, + column: 0, + value: 'png', + }, + }, + { + name: 'css', + size: 412032, + children: [ + { + name: 'MX', + size: 9299, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'machine.os: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + ], + }, + row: 2, + column: 2, + value: 'MX', + }, + }, + { + name: 'US', + size: 8293, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'machine.os: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + ], + }, + row: 3, + column: 2, + value: 'US', + }, + }, + ], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'machine.os: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + ], + }, + row: 2, + column: 0, + value: 'css', + }, + }, + { + name: 'html', + size: 412032, + children: [ + { + name: 'CN', + size: 9299, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'machine.os: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + ], + }, + row: 4, + column: 2, + value: 'CN', + }, + }, + { + name: 'FR', + size: 8293, + children: [], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'machine.os: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + ], + }, + row: 5, + column: 2, + value: 'FR', + }, + }, + ], + rawData: { + table: { + columns: [ + { + id: 'col-0-agg_2', + name: 'machine.os: Descending', + }, + { + id: 'col-1-agg_1', + name: 'Average bytes', + }, + { + id: 'col-2-agg_3', + name: 'geo.src: Descending', + }, + { + id: 'col-3-agg_1', + name: 'Average bytes', + }, + ], + rows: [ + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'IT', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'png', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'MX', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'css', + 'col-2-agg_3': 'US', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'CN', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 9299, + }, + { + 'col-0-agg_2': 'html', + 'col-2-agg_3': 'FR', + 'col-1-agg_1': 412032, + 'col-3-agg_1': 8293, + }, + ], + }, + row: 4, + column: 0, + value: 'html', + }, + }, + ], + }, + }, +}; diff --git a/src/legacy/core_plugins/vis_type_xy/public/legacy.ts b/src/legacy/core_plugins/vis_type_xy/public/legacy.ts index e1cee9c30804a..740ceeaac6a7d 100644 --- a/src/legacy/core_plugins/vis_type_xy/public/legacy.ts +++ b/src/legacy/core_plugins/vis_type_xy/public/legacy.ts @@ -22,20 +22,16 @@ import { PluginInitializerContext } from 'kibana/public'; import { plugin } from '.'; import { VisTypeXyPluginSetupDependencies, VisTypeXyPluginStartDependencies } from './plugin'; -import { - setup as visualizationsSetup, - start as visualizationsStart, -} from '../../visualizations/public/np_ready/public/legacy'; const setupPlugins: Readonly = { expressions: npSetup.plugins.expressions, - visualizations: visualizationsSetup, + visualizations: npSetup.plugins.visualizations, charts: npSetup.plugins.charts, }; const startPlugins: Readonly = { expressions: npStart.plugins.expressions, - visualizations: visualizationsStart, + visualizations: npStart.plugins.visualizations, }; const pluginInstance = plugin({} as PluginInitializerContext); 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 0884cdf6a5e18..ab01b6b3153fb 100644 --- a/src/legacy/core_plugins/vis_type_xy/public/plugin.ts +++ b/src/legacy/core_plugins/vis_type_xy/public/plugin.ts @@ -26,7 +26,10 @@ import { } from 'kibana/public'; import { Plugin as ExpressionsPublicPlugin } from '../../../../plugins/expressions/public'; -import { VisualizationsSetup, VisualizationsStart } from '../../visualizations/public'; +import { + VisualizationsSetup, + VisualizationsStart, +} from '../../../../plugins/visualizations/public'; import { ChartsPluginSetup } from '../../../../plugins/charts/public'; export interface VisTypeXyDependencies { diff --git a/src/legacy/core_plugins/visualizations/index.ts b/src/legacy/core_plugins/visualizations/index.ts deleted file mode 100644 index a2779cfe4346d..0000000000000 --- a/src/legacy/core_plugins/visualizations/index.ts +++ /dev/null @@ -1,34 +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 { LegacyPluginInitializer } from '../../../../src/legacy/types'; - -export const visualizations: LegacyPluginInitializer = kibana => - new kibana.Plugin({ - id: 'visualizations', - publicDir: resolve(__dirname, 'public'), - require: [], - uiExports: { - styleSheetPaths: resolve(__dirname, 'public/index.scss'), - }, - }); - -// eslint-disable-next-line import/no-default-export -export default visualizations; diff --git a/src/legacy/core_plugins/visualizations/package.json b/src/legacy/core_plugins/visualizations/package.json deleted file mode 100644 index 5b436f0c2fef2..0000000000000 --- a/src/legacy/core_plugins/visualizations/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "visualizations", - "version": "kibana" -} diff --git a/src/legacy/core_plugins/visualizations/public/index.scss b/src/legacy/core_plugins/visualizations/public/index.scss deleted file mode 100644 index 238f58fbfa295..0000000000000 --- a/src/legacy/core_plugins/visualizations/public/index.scss +++ /dev/null @@ -1,2 +0,0 @@ -@import 'src/legacy/ui/public/styles/styling_constants'; -@import './np_ready/public/index'; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/kibana.json b/src/legacy/core_plugins/visualizations/public/np_ready/kibana.json deleted file mode 100644 index f8637a71b2d35..0000000000000 --- a/src/legacy/core_plugins/visualizations/public/np_ready/kibana.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "id": "visualizations", - "version": "kibana", - "server": false, - "ui": true, - "requiredPlugins": ["data", "expressions", "uiActions", "embeddable", "usageCollection"] -} 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 deleted file mode 100644 index 078cc4a3f4035..0000000000000 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/index.ts +++ /dev/null @@ -1,52 +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. - */ - -/** - * Visualizations Plugin - public - * - * This is the entry point for the entire client-side public contract of the plugin. - * If something is not explicitly exported here, you can safely assume it is private - * to the plugin and not considered stable. - * - * All stateful contracts will be injected by the platform at runtime, and are defined - * in the setup/start interfaces in `plugin.ts`. The remaining items exported here are - * either types, or static code. - */ - -import { PublicContract } from '@kbn/utility-types'; -import { PluginInitializerContext } from '../../../../../../core/public'; -import { VisualizationsPlugin, VisualizationsSetup, VisualizationsStart } from './plugin'; - -/** @public */ -export { VisualizationsSetup, VisualizationsStart }; - -/** @public types */ -export { VisTypeAlias, VisType } from './vis_types'; -export { VisSavedObject } from './types'; -export { Vis, VisParams, SerializedVis, SerializedVisData, VisData } from './vis'; -import { VisualizeEmbeddableFactory, VisualizeEmbeddable } from './embeddable'; -export type VisualizeEmbeddableFactoryContract = PublicContract; -export type VisualizeEmbeddableContract = PublicContract; -export { TypesService } from './vis_types/types_service'; -export { VISUALIZE_EMBEDDABLE_TYPE, VisualizeInput } from './embeddable'; -export { SchemaConfig } from './legacy/build_pipeline'; - -export function plugin(initializerContext: PluginInitializerContext) { - return new VisualizationsPlugin(initializerContext); -} 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 deleted file mode 100644 index deb345a77cdb6..0000000000000 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/__tests__/_vis.js +++ /dev/null @@ -1,107 +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 _ from 'lodash'; -import ngMock from 'ng_mock'; -import expect from '@kbn/expect'; -import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern'; -import { start as visualizations } from '../../legacy'; - -describe('Vis Class', function() { - let indexPattern; - let visTypes; - - let vis; - const stateFixture = { - type: 'pie', - aggs: [ - { type: 'avg', schema: 'metric', params: { field: 'bytes' } }, - { type: 'terms', schema: 'segment', params: { field: 'machine.os' } }, - { type: 'terms', schema: 'segment', params: { field: 'geo.src' } }, - ], - params: { isDonut: true }, - listeners: { click: _.noop }, - }; - - beforeEach(ngMock.module('kibana')); - beforeEach( - ngMock.inject(function(Private) { - indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider); - visTypes = visualizations; - }) - ); - - beforeEach(function() { - vis = visualizations.createVis(indexPattern, stateFixture); - }); - - const verifyVis = function(vis) { - expect(vis).to.have.property('aggs'); - expect(vis.aggs.aggs).to.have.length(3); - - expect(vis).to.have.property('type'); - expect(vis.type).to.eql(visTypes.get('pie')); - - expect(vis).to.have.property('params'); - expect(vis.params).to.have.property('isDonut', true); - expect(vis).to.have.property('indexPattern', indexPattern); - }; - - describe('initialization', function() { - it('should set the state', function() { - verifyVis(vis); - }); - }); - - describe('getState()', function() { - it('should get a state that represents the... er... state', function() { - const state = vis.getEnabledState(); - expect(state).to.have.property('type', 'pie'); - - expect(state).to.have.property('params'); - expect(state.params).to.have.property('isDonut', true); - - expect(state).to.have.property('aggs'); - expect(state.aggs).to.have.length(3); - }); - }); - - describe('setState()', function() { - it('should set the state to defaults', function() { - 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'); - expect(vis.aggs.aggs).to.have.length(1); - expect(vis).to.have.property('params'); - expect(vis.params).to.have.property('addLegend', true); - expect(vis.params).to.have.property('addTooltip', true); - }); - }); - - describe('isHierarchical()', function() { - it('should return true for hierarchical vis (like pie)', function() { - expect(vis.isHierarchical()).to.be(true); - }); - it('should return false for non-hierarchical vis (like histogram)', function() { - const vis = visualizations.createVis(indexPattern); - expect(vis.isHierarchical()).to.be(false); - }); - }); -}); diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/__tests__/vis_types/base_vis_type.js b/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/__tests__/vis_types/base_vis_type.js deleted file mode 100644 index 9c1dfd9780255..0000000000000 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/__tests__/vis_types/base_vis_type.js +++ /dev/null @@ -1,60 +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 expect from '@kbn/expect'; -import ngMock from 'ng_mock'; -import { BaseVisType } from '../../../vis_types/base_vis_type'; - -describe('Base Vis Type', function() { - beforeEach(ngMock.module('kibana')); - - describe('initialization', () => { - it('should throw if mandatory properties are missing', () => { - expect(() => { - new BaseVisType({}); - }).to.throwError('vis_type must define its name'); - - expect(() => { - new BaseVisType({ name: 'test' }); - }).to.throwError('vis_type must define its title'); - - expect(() => { - new BaseVisType({ name: 'test', title: 'test' }); - }).to.throwError('vis_type must define its description'); - - expect(() => { - new BaseVisType({ name: 'test', title: 'test', description: 'test' }); - }).to.throwError('vis_type must define its icon or image'); - - expect(() => { - new BaseVisType({ name: 'test', title: 'test', description: 'test', icon: 'test' }); - }).to.throwError('vis_type must define visualization controller'); - - expect(() => { - new BaseVisType({ - name: 'test', - title: 'test', - description: 'test', - icon: 'test', - visualization: {}, - }); - }).to.not.throwError(); - }); - }); -}); 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 deleted file mode 100644 index 17f777e4e80e1..0000000000000 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/mocks.ts +++ /dev/null @@ -1,75 +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 '../../../../../../core/public'; -import { VisualizationsSetup, VisualizationsStart } from './'; -import { VisualizationsPlugin } from './plugin'; -import { coreMock } from '../../../../../../core/public/mocks'; -import { embeddablePluginMock } from '../../../../../../plugins/embeddable/public/mocks'; -import { expressionsPluginMock } from '../../../../../../plugins/expressions/public/mocks'; -import { dataPluginMock } from '../../../../../../plugins/data/public/mocks'; -import { usageCollectionPluginMock } from '../../../../../../plugins/usage_collection/public/mocks'; -import { uiActionsPluginMock } from '../../../../../../plugins/ui_actions/public/mocks'; - -const createSetupContract = (): VisualizationsSetup => ({ - createBaseVisualization: jest.fn(), - createReactVisualization: jest.fn(), - registerAlias: jest.fn(), - hideTypes: jest.fn(), -}); - -const createStartContract = (): VisualizationsStart => ({ - get: jest.fn(), - all: jest.fn(), - getAliases: jest.fn(), - savedVisualizationsLoader: {} as any, - showNewVisModal: jest.fn(), - createVis: jest.fn(), - convertFromSerializedVis: jest.fn(), - convertToSerializedVis: jest.fn(), -}); - -const createInstance = async () => { - const plugin = new VisualizationsPlugin({} as PluginInitializerContext); - - const setup = plugin.setup(coreMock.createSetup(), { - data: dataPluginMock.createSetupContract(), - expressions: expressionsPluginMock.createSetupContract(), - embeddable: embeddablePluginMock.createSetupContract(), - usageCollection: usageCollectionPluginMock.createSetupContract(), - }); - const doStart = () => - plugin.start(coreMock.createStart(), { - data: dataPluginMock.createStartContract(), - expressions: expressionsPluginMock.createStartContract(), - uiActions: uiActionsPluginMock.createStartContract(), - }); - - return { - plugin, - setup, - doStart, - }; -}; - -export const visualizationsPluginMock = { - createSetupContract, - createStartContract, - createInstance, -}; 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 deleted file mode 100644 index 3ade6cee0d4d2..0000000000000 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/plugin.ts +++ /dev/null @@ -1,176 +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, - CoreSetup, - CoreStart, - Plugin, -} from '../../../../../../core/public'; -import { TypesService, TypesSetup, TypesStart } from './vis_types'; -import { - setUISettings, - setTypes, - setI18n, - setCapabilities, - setHttp, - setIndexPatterns, - setSavedObjects, - setUsageCollector, - setFilterManager, - setExpressions, - setUiActions, - setSavedVisualizationsLoader, - setTimeFilter, - setAggs, - setChrome, - setOverlays, -} from './services'; -import { VISUALIZE_EMBEDDABLE_TYPE, VisualizeEmbeddableFactory } from './embeddable'; -import { ExpressionsSetup, ExpressionsStart } from '../../../../../../plugins/expressions/public'; -import { EmbeddableSetup } from '../../../../../../plugins/embeddable/public'; -import { visualization as visualizationFunction } from './expressions/visualization_function'; -import { visualization as visualizationRenderer } from './expressions/visualization_renderer'; -import { - DataPublicPluginSetup, - DataPublicPluginStart, -} from '../../../../../../plugins/data/public'; -import { UsageCollectionSetup } from '../../../../../../plugins/usage_collection/public'; -import { createSavedVisLoader, SavedVisualizationsLoader } from './saved_visualizations'; -import { SerializedVis, Vis } from './vis'; -import { showNewVisModal } from './wizard'; -import { UiActionsStart } from '../../../../../../plugins/ui_actions/public'; -import { - convertFromSerializedVis, - convertToSerializedVis, -} from './saved_visualizations/_saved_vis'; - -/** - * Interface for this plugin's returned setup/start contracts. - * - * @public - */ - -export type VisualizationsSetup = TypesSetup; - -export interface VisualizationsStart extends TypesStart { - savedVisualizationsLoader: SavedVisualizationsLoader; - createVis: (visType: string, visState?: SerializedVis) => Vis; - convertToSerializedVis: typeof convertToSerializedVis; - convertFromSerializedVis: typeof convertFromSerializedVis; - showNewVisModal: typeof showNewVisModal; -} - -export interface VisualizationsSetupDeps { - expressions: ExpressionsSetup; - embeddable: EmbeddableSetup; - usageCollection: UsageCollectionSetup; - data: DataPublicPluginSetup; -} - -export interface VisualizationsStartDeps { - data: DataPublicPluginStart; - expressions: ExpressionsStart; - uiActions: UiActionsStart; -} - -/** - * Visualizations Plugin - public - * - * This plugin's stateful contracts are returned from the `setup` and `start` methods - * below. The interfaces for these contracts are provided above. - * - * @internal - */ -export class VisualizationsPlugin - implements - Plugin< - VisualizationsSetup, - VisualizationsStart, - VisualizationsSetupDeps, - VisualizationsStartDeps - > { - private readonly types: TypesService = new TypesService(); - - constructor(initializerContext: PluginInitializerContext) {} - - public setup( - core: CoreSetup, - { expressions, embeddable, usageCollection, data }: VisualizationsSetupDeps - ): VisualizationsSetup { - setUISettings(core.uiSettings); - setUsageCollector(usageCollection); - - expressions.registerFunction(visualizationFunction); - expressions.registerRenderer(visualizationRenderer); - - const embeddableFactory = new VisualizeEmbeddableFactory(); - embeddable.registerEmbeddableFactory(VISUALIZE_EMBEDDABLE_TYPE, embeddableFactory); - - return { - ...this.types.setup(), - }; - } - - public start( - core: CoreStart, - { data, expressions, uiActions }: VisualizationsStartDeps - ): VisualizationsStart { - const types = this.types.start(); - setI18n(core.i18n); - setTypes(types); - setCapabilities(core.application.capabilities); - setHttp(core.http); - setSavedObjects(core.savedObjects); - setIndexPatterns(data.indexPatterns); - setFilterManager(data.query.filterManager); - setExpressions(expressions); - setUiActions(uiActions); - setTimeFilter(data.query.timefilter.timefilter); - setAggs(data.search.aggs); - setOverlays(core.overlays); - setChrome(core.chrome); - const savedVisualizationsLoader = createSavedVisLoader({ - savedObjectsClient: core.savedObjects.client, - indexPatterns: data.indexPatterns, - chrome: core.chrome, - overlays: core.overlays, - visualizationTypes: types, - }); - setSavedVisualizationsLoader(savedVisualizationsLoader); - - return { - ...types, - showNewVisModal, - /** - * creates new instance of Vis - * @param {IIndexPattern} indexPattern - index pattern to use - * @param {VisState} visState - visualization configuration - */ - createVis: (visType: string, visState?: SerializedVis) => new Vis(visType, visState), - convertToSerializedVis, - convertFromSerializedVis, - savedVisualizationsLoader, - }; - } - - public stop() { - this.types.stop(); - } -} diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/types.ts b/src/legacy/core_plugins/visualizations/public/np_ready/public/types.ts deleted file mode 100644 index 8f93a179af3bc..0000000000000 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/types.ts +++ /dev/null @@ -1,50 +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 { SavedObject } from '../../../../../../plugins/saved_objects/public'; -import { ISearchSource, AggConfigOptions } from '../../../../../../plugins/data/public'; -import { SerializedVis, Vis, VisParams } from './vis'; - -export { Vis, SerializedVis, VisParams }; - -export interface VisualizationController { - render(visData: any, visParams: any): Promise; - destroy(): void; - isLoaded?(): Promise | void; -} - -export interface SavedVisState { - type: string; - params: VisParams; - aggs: AggConfigOptions[]; -} - -export interface ISavedVis { - id: string; - title: string; - description?: string; - visState: SavedVisState; - searchSource?: ISearchSource; - uiStateJSON?: string; - savedSearchRefName?: string; - savedSearchId?: string; -} - -// @ts-ignore-next-line -export interface VisSavedObject extends SavedObject, ISavedVis {} diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/base_vis_type.js b/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/base_vis_type.js deleted file mode 100644 index 50ff74cfe9dd3..0000000000000 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/base_vis_type.js +++ /dev/null @@ -1,80 +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 _ from 'lodash'; - -export class BaseVisType { - constructor(opts = {}) { - if (!opts.name) { - throw 'vis_type must define its name'; - } - if (!opts.title) { - throw 'vis_type must define its title'; - } - if (!opts.description) { - throw 'vis_type must define its description'; - } - if (!opts.icon && !opts.image) { - throw 'vis_type must define its icon or image'; - } - if (!opts.visualization) { - throw 'vis_type must define visualization controller'; - } - - const _defaults = { - // name, title, description, icon, image - visualization: null, // must be a class with render/resize/destroy methods - visConfig: { - defaults: {}, // default configuration - }, - requestHandler: 'courier', // select one from registry or pass a function - responseHandler: 'none', - editor: null, // no default is provided - editorConfig: { - collections: {}, // collections used for configuration (list of positions, ...) - }, - options: { - // controls the visualize editor - showTimePicker: true, - showQueryBar: true, - showFilterBar: true, - showIndexSelection: true, - hierarchicalData: false, // we should get rid of this i guess ? - }, - stage: 'production', - feedbackMessage: '', - hidden: false, - }; - - _.defaultsDeep(this, opts, _defaults); - - this.requiresSearch = this.requestHandler !== 'none'; - } - - shouldMarkAsExperimentalInUI() { - return this.stage === 'experimental'; - } - - get schemas() { - if (this.editorConfig && this.editorConfig.schemas) { - return this.editorConfig.schemas; - } - return []; - } -} diff --git a/src/legacy/ui/public/new_platform/__mocks__/helpers.ts b/src/legacy/ui/public/new_platform/__mocks__/helpers.ts index 35d6e070ae8f7..f9f4494929014 100644 --- a/src/legacy/ui/public/new_platform/__mocks__/helpers.ts +++ b/src/legacy/ui/public/new_platform/__mocks__/helpers.ts @@ -31,6 +31,7 @@ import { kibanaLegacyPluginMock } from '../../../../../plugins/kibana_legacy/pub import { chartPluginMock } from '../../../../../plugins/charts/public/mocks'; import { advancedSettingsMock } from '../../../../../plugins/advanced_settings/public/mocks'; import { savedObjectsManagementPluginMock } from '../../../../../plugins/saved_objects_management/public/mocks'; +import { visualizationsPluginMock } from '../../../../../plugins/visualizations/public/mocks'; /* eslint-enable @kbn/eslint/no-restricted-paths */ export const pluginsMock = { @@ -44,6 +45,7 @@ export const pluginsMock = { uiActions: uiActionsPluginMock.createSetupContract(), usageCollection: usageCollectionPluginMock.createSetupContract(), advancedSettings: advancedSettingsMock.createSetupContract(), + visualizations: visualizationsPluginMock.createSetupContract(), kibanaLegacy: kibanaLegacyPluginMock.createSetupContract(), savedObjectsManagement: savedObjectsManagementPluginMock.createSetupContract(), }), @@ -57,6 +59,7 @@ export const pluginsMock = { uiActions: uiActionsPluginMock.createStartContract(), management: managementPluginMock.createStartContract(), advancedSettings: advancedSettingsMock.createStartContract(), + visualizations: visualizationsPluginMock.createStartContract(), kibanaLegacy: kibanaLegacyPluginMock.createStartContract(), savedObjectsManagement: savedObjectsManagementPluginMock.createStartContract(), }), diff --git a/src/legacy/ui/public/new_platform/new_platform.karma_mock.js b/src/legacy/ui/public/new_platform/new_platform.karma_mock.js index 10d2818df2799..25647e4a08897 100644 --- a/src/legacy/ui/public/new_platform/new_platform.karma_mock.js +++ b/src/legacy/ui/public/new_platform/new_platform.karma_mock.js @@ -20,20 +20,7 @@ import sinon from 'sinon'; import { getFieldFormatsRegistry } from '../../../../test_utils/public/stub_field_formats'; import { METRIC_TYPE } from '@kbn/analytics'; -import { - setFieldFormats, - setIndexPatterns, - setInjectedMetadata, - setHttp, - setNotifications, - setOverlays, - setQueryService, - setSearchService, - setUiSettings, - // eslint-disable-next-line @kbn/eslint/no-restricted-paths -} from '../../../../plugins/data/public/services'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import { setAggs } from '../../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/services'; +import { setSetupServices, setStartServices } from './set_services'; import { AggTypesRegistry, getAggTypes, @@ -76,14 +63,37 @@ export const mockUiSettings = { 'format:defaultTypeMap': {}, }; -const mockCore = { +const mockCoreSetup = { chrome: {}, + http: { + basePath: { + get: sinon.fake.returns(''), + }, + }, + injectedMetadata: {}, uiSettings: mockUiSettings, +}; + +const mockCoreStart = { + application: { + capabilities: {}, + }, + chrome: { + overlays: { + openModal: sinon.fake(), + }, + }, http: { basePath: { get: sinon.fake.returns(''), }, }, + i18n: {}, + overlays: {}, + savedObjects: { + client: {}, + }, + uiSettings: mockUiSettings, }; const querySetup = { @@ -153,8 +163,8 @@ const mockAggTypesRegistry = () => { const registry = new AggTypesRegistry(); const registrySetup = registry.setup(); const aggTypes = getAggTypes({ - uiSettings: mockCore.uiSettings, - notifications: mockCore.notifications, + uiSettings: mockCoreSetup.uiSettings, + notifications: mockCoreStart.notifications, query: querySetup, }); aggTypes.buckets.forEach(type => registrySetup.registerBucket(type)); @@ -166,7 +176,7 @@ const mockAggTypesRegistry = () => { const aggTypesRegistry = mockAggTypesRegistry(); export const npSetup = { - core: mockCore, + core: mockCoreSetup, plugins: { advancedSettings: { component: { @@ -216,7 +226,7 @@ export const npSetup = { }, }, }, - fieldFormats: getFieldFormatsRegistry(mockCore), + fieldFormats: getFieldFormatsRegistry(mockCoreSetup), }, share: { register: () => {}, @@ -283,17 +293,17 @@ export const npSetup = { visTypeVega: { config: sinon.fake(), }, + visualizations: { + createBaseVisualization: sinon.fake(), + createReactVisualization: sinon.fake(), + registerAlias: sinon.fake(), + hideTypes: sinon.fake(), + }, }, }; export const npStart = { - core: { - chrome: { - overlays: { - openModal: sinon.fake(), - }, - }, - }, + core: mockCoreStart, plugins: { management: { legacy: { @@ -437,7 +447,7 @@ export const npStart = { }, }, }, - fieldFormats: getFieldFormatsRegistry(mockCore), + fieldFormats: getFieldFormatsRegistry(mockCoreStart), }, share: { toggleShareContextMenu: () => {}, @@ -459,6 +469,16 @@ export const npStart = { getTriggerActions: sinon.fake(), getTriggerCompatibleActions: sinon.fake(), }, + visualizations: { + get: sinon.fake(), + all: sinon.fake(), + getAliases: sinon.fake(), + savedVisualizationsLoader: {}, + showNewVisModal: sinon.fake(), + createVis: sinon.fake(), + convertFromSerializedVis: sinon.fake(), + convertToSerializedVis: sinon.fake(), + }, navigation: { ui: { TopNavMenu: mockComponent, @@ -485,23 +505,15 @@ export function __setup__(coreSetup) { // bootstrap an LP plugin outside of tests) npSetup.core.application.register = () => {}; - // Services that need to be set in the legacy platform since the legacy data plugin - // which previously provided them has been removed. - setInjectedMetadata(npSetup.core.injectedMetadata); + // Services that need to be set in the legacy platform since the legacy data + // & vis plugins which previously provided them have been removed. + setSetupServices(npSetup); } export function __start__(coreStart) { npStart.core = coreStart; - // Services that need to be set in the legacy platform since the legacy data plugin - // which previously provided them has been removed. - setHttp(npStart.core.http); - setNotifications(npStart.core.notifications); - setOverlays(npStart.core.overlays); - setUiSettings(npStart.core.uiSettings); - setFieldFormats(npStart.plugins.data.fieldFormats); - setIndexPatterns(npStart.plugins.data.indexPatterns); - setQueryService(npStart.plugins.data.query); - setSearchService(npStart.plugins.data.search); - setAggs(npStart.plugins.data.search.aggs); + // Services that need to be set in the legacy platform since the legacy data + // & vis plugins which previously provided them have been removed. + setStartServices(npStart); } diff --git a/src/legacy/ui/public/new_platform/new_platform.test.ts b/src/legacy/ui/public/new_platform/new_platform.test.ts index dd41093f3a1f0..1629aac588a61 100644 --- a/src/legacy/ui/public/new_platform/new_platform.test.ts +++ b/src/legacy/ui/public/new_platform/new_platform.test.ts @@ -20,19 +20,8 @@ jest.mock('history'); import { setRootControllerMock, historyMock } from './new_platform.test.mocks'; -import { - legacyAppRegister, - __reset__, - __setup__, - __start__, - PluginsSetup, - PluginsStart, -} from './new_platform'; -// eslint-disable-next-line @kbn/eslint/no-restricted-paths -import * as dataServices from '../../../../plugins/data/public/services'; -import { LegacyCoreSetup, LegacyCoreStart } from '../../../../core/public'; +import { legacyAppRegister, __reset__, __setup__, __start__ } from './new_platform'; import { coreMock } from '../../../../core/public/mocks'; -import { npSetup, npStart } from './__mocks__'; describe('ui/new_platform', () => { describe('legacyAppRegister', () => { @@ -119,25 +108,4 @@ describe('ui/new_platform', () => { expect(unmountMock).toHaveBeenCalled(); }); }); - - describe('service getters', () => { - const services: Record = dataServices; - const getters = Object.keys(services).filter(k => k.substring(0, 3) === 'get'); - - getters.forEach(g => { - it(`sets a value for ${g}`, () => { - __reset__(); - __setup__( - (coreMock.createSetup() as unknown) as LegacyCoreSetup, - (npSetup.plugins as unknown) as PluginsSetup - ); - __start__( - (coreMock.createStart() as unknown) as LegacyCoreStart, - (npStart.plugins as unknown) as PluginsStart - ); - - expect(services[g]()).toBeDefined(); - }); - }); - }); }); diff --git a/src/legacy/ui/public/new_platform/new_platform.ts b/src/legacy/ui/public/new_platform/new_platform.ts index 4fa368af313b4..b4b5099081759 100644 --- a/src/legacy/ui/public/new_platform/new_platform.ts +++ b/src/legacy/ui/public/new_platform/new_platform.ts @@ -23,6 +23,7 @@ import { UiActionsStart, UiActionsSetup } from 'src/plugins/ui_actions/public'; import { EmbeddableStart, EmbeddableSetup } from 'src/plugins/embeddable/public'; import { createBrowserHistory } from 'history'; import { DashboardStart } from '../../../../plugins/dashboard/public'; +import { setSetupServices, setStartServices } from './set_services'; import { LegacyCoreSetup, LegacyCoreStart, @@ -31,18 +32,6 @@ import { ScopedHistory, } from '../../../../core/public'; import { Plugin as DataPlugin } from '../../../../plugins/data/public'; -import { - setFieldFormats, - setIndexPatterns, - setInjectedMetadata, - setHttp, - setNotifications, - setOverlays, - setQueryService, - setSearchService, - setUiSettings, - // eslint-disable-next-line @kbn/eslint/no-restricted-paths -} from '../../../../plugins/data/public/services'; import { Plugin as ExpressionsPlugin } from '../../../../plugins/expressions/public'; import { Setup as InspectorSetup, @@ -71,6 +60,10 @@ import { SavedObjectsManagementPluginSetup, SavedObjectsManagementPluginStart, } from '../../../../plugins/saved_objects_management/public'; +import { + VisualizationsSetup, + VisualizationsStart, +} from '../../../../plugins/visualizations/public'; export interface PluginsSetup { bfetch: BfetchPublicSetup; @@ -90,6 +83,7 @@ export interface PluginsSetup { management: ManagementSetup; visTypeVega: VisTypeVegaSetup; discover: DiscoverSetup; + visualizations: VisualizationsSetup; telemetry?: TelemetryPluginSetup; savedObjectsManagement: SavedObjectsManagementPluginSetup; } @@ -109,6 +103,7 @@ export interface PluginsStart { management: ManagementStart; advancedSettings: AdvancedSettingsStart; discover: DiscoverStart; + visualizations: VisualizationsStart; telemetry?: TelemetryPluginStart; dashboard: DashboardStart; savedObjectsManagement: SavedObjectsManagementPluginStart; @@ -143,25 +138,18 @@ export function __setup__(coreSetup: LegacyCoreSetup, plugins: PluginsSetup) { // Setup compatibility layer for AppService in legacy platform npSetup.core.application.register = legacyAppRegister; - // Services that need to be set in the legacy platform since the legacy data plugin - // which previously provided them has been removed. - setInjectedMetadata(npSetup.core.injectedMetadata); + // Services that need to be set in the legacy platform since the legacy data + // & vis plugins which previously provided them have been removed. + setSetupServices(npSetup); } export function __start__(coreStart: LegacyCoreStart, plugins: PluginsStart) { npStart.core = coreStart; npStart.plugins = plugins; - // Services that need to be set in the legacy platform since the legacy data plugin - // which previously provided them has been removed. - setHttp(npStart.core.http); - setNotifications(npStart.core.notifications); - setOverlays(npStart.core.overlays); - setUiSettings(npStart.core.uiSettings); - setFieldFormats(npStart.plugins.data.fieldFormats); - setIndexPatterns(npStart.plugins.data.indexPatterns); - setQueryService(npStart.plugins.data.query); - setSearchService(npStart.plugins.data.search); + // Services that need to be set in the legacy platform since the legacy data + // & vis plugins which previously provided them have been removed. + setStartServices(npStart); } /** Flag used to ensure `legacyAppRegister` is only called once. */ diff --git a/src/legacy/ui/public/new_platform/set_services.test.ts b/src/legacy/ui/public/new_platform/set_services.test.ts new file mode 100644 index 0000000000000..25a4524925169 --- /dev/null +++ b/src/legacy/ui/public/new_platform/set_services.test.ts @@ -0,0 +1,53 @@ +/* + * 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 { __reset__, __setup__, __start__, PluginsSetup, PluginsStart } from './new_platform'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import * as dataServices from '../../../../plugins/data/public/services'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import * as visualizationsServices from '../../../../plugins/visualizations/public/services'; +import { LegacyCoreSetup, LegacyCoreStart } from '../../../../core/public'; +import { coreMock } from '../../../../core/public/mocks'; +import { npSetup, npStart } from './__mocks__'; + +describe('ui/new_platform', () => { + describe('set service getters', () => { + const testServiceGetters = (name: string, services: Record) => { + const getters = Object.keys(services).filter(k => k.substring(0, 3) === 'get'); + getters.forEach(g => { + it(`ui/new_platform sets a value for ${name} getter ${g}`, () => { + __reset__(); + __setup__( + (coreMock.createSetup() as unknown) as LegacyCoreSetup, + (npSetup.plugins as unknown) as PluginsSetup + ); + __start__( + (coreMock.createStart() as unknown) as LegacyCoreStart, + (npStart.plugins as unknown) as PluginsStart + ); + + expect(services[g]()).toBeDefined(); + }); + }); + }; + + testServiceGetters('data', dataServices); + testServiceGetters('visualizations', visualizationsServices); + }); +}); diff --git a/src/legacy/ui/public/new_platform/set_services.ts b/src/legacy/ui/public/new_platform/set_services.ts new file mode 100644 index 0000000000000..8cf015d5dff5c --- /dev/null +++ b/src/legacy/ui/public/new_platform/set_services.ts @@ -0,0 +1,83 @@ +/* + * 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 { pick } from 'lodash'; + +import { PluginsSetup, PluginsStart } from './new_platform'; +import { LegacyCoreSetup, LegacyCoreStart } from '../../../../core/public'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import * as dataServices from '../../../../plugins/data/public/services'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import * as visualizationsServices from '../../../../plugins/visualizations/public/services'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { createSavedVisLoader } from '../../../../plugins/visualizations/public/saved_visualizations/saved_visualizations'; + +interface NpSetup { + core: LegacyCoreSetup; + plugins: PluginsSetup; +} + +interface NpStart { + core: LegacyCoreStart; + plugins: PluginsStart; +} + +export function setSetupServices(npSetup: NpSetup) { + // Services that need to be set in the legacy platform since the legacy data plugin + // which previously provided them has been removed. + dataServices.setInjectedMetadata(npSetup.core.injectedMetadata); + visualizationsServices.setUISettings(npSetup.core.uiSettings); + visualizationsServices.setUsageCollector(npSetup.plugins.usageCollection); +} + +export function setStartServices(npStart: NpStart) { + // Services that need to be set in the legacy platform since the legacy data plugin + // which previously provided them has been removed. + dataServices.setHttp(npStart.core.http); + dataServices.setNotifications(npStart.core.notifications); + dataServices.setOverlays(npStart.core.overlays); + dataServices.setUiSettings(npStart.core.uiSettings); + dataServices.setFieldFormats(npStart.plugins.data.fieldFormats); + dataServices.setIndexPatterns(npStart.plugins.data.indexPatterns); + dataServices.setQueryService(npStart.plugins.data.query); + dataServices.setSearchService(npStart.plugins.data.search); + visualizationsServices.setI18n(npStart.core.i18n); + visualizationsServices.setTypes( + pick(npStart.plugins.visualizations, ['get', 'all', 'getAliases']) + ); + visualizationsServices.setCapabilities(npStart.core.application.capabilities); + visualizationsServices.setHttp(npStart.core.http); + visualizationsServices.setSavedObjects(npStart.core.savedObjects); + visualizationsServices.setIndexPatterns(npStart.plugins.data.indexPatterns); + visualizationsServices.setFilterManager(npStart.plugins.data.query.filterManager); + visualizationsServices.setExpressions(npStart.plugins.expressions); + visualizationsServices.setUiActions(npStart.plugins.uiActions); + visualizationsServices.setTimeFilter(npStart.plugins.data.query.timefilter.timefilter); + visualizationsServices.setAggs(npStart.plugins.data.search.aggs); + visualizationsServices.setOverlays(npStart.core.overlays); + visualizationsServices.setChrome(npStart.core.chrome); + const savedVisualizationsLoader = createSavedVisLoader({ + savedObjectsClient: npStart.core.savedObjects.client, + indexPatterns: npStart.plugins.data.indexPatterns, + chrome: npStart.core.chrome, + overlays: npStart.core.overlays, + visualizationTypes: visualizationsServices.getTypes(), + }); + visualizationsServices.setSavedVisualizationsLoader(savedVisualizationsLoader); +} diff --git a/src/legacy/ui/public/visualize/_index.scss b/src/legacy/ui/public/visualize/_index.scss index c528c1e37b412..d9761f741353b 100644 --- a/src/legacy/ui/public/visualize/_index.scss +++ b/src/legacy/ui/public/visualize/_index.scss @@ -1 +1 @@ -@import '../../../core_plugins/visualizations/public/np_ready/public/components/index'; +@import '../../../../plugins/visualizations/public/components/index'; diff --git a/src/legacy/ui/public/visualize/loader/pipeline_helpers/index.ts b/src/legacy/ui/public/visualize/loader/pipeline_helpers/index.ts index f19940726ef2d..fe7f239fbea3b 100644 --- a/src/legacy/ui/public/visualize/loader/pipeline_helpers/index.ts +++ b/src/legacy/ui/public/visualize/loader/pipeline_helpers/index.ts @@ -17,4 +17,4 @@ * under the License. */ -export { buildPipeline } from '../../../../../core_plugins/visualizations/public/np_ready/public/legacy/build_pipeline'; +export { buildPipeline } from '../../../../../../plugins/visualizations/public/legacy/build_pipeline'; diff --git a/src/plugins/data/public/public.api.md b/src/plugins/data/public/public.api.md index dae5c72338d2b..2d6b9ae778197 100644 --- a/src/plugins/data/public/public.api.md +++ b/src/plugins/data/public/public.api.md @@ -1534,7 +1534,7 @@ export type SavedQueryTimeFilter = TimeRange & { export const search: { aggs: { AggConfigs: typeof AggConfigs; - aggGroupNamesMap: () => Record<"buckets" | "metrics", string>; + aggGroupNamesMap: () => Record<"metrics" | "buckets", string>; aggTypeFilters: import("./search/aggs/filter/agg_type_filters").AggTypeFilters; CidrMask: typeof CidrMask; convertDateRangeToString: typeof convertDateRangeToString; diff --git a/src/plugins/saved_objects/kibana.json b/src/plugins/saved_objects/kibana.json index 4081c9a4b21b9..0792955b7c5f1 100644 --- a/src/plugins/saved_objects/kibana.json +++ b/src/plugins/saved_objects/kibana.json @@ -3,5 +3,5 @@ "version": "kibana", "server": false, "ui": true, - "requiredPlugins": [] + "requiredPlugins": ["data"] } diff --git a/src/plugins/saved_objects/public/plugin.ts b/src/plugins/saved_objects/public/plugin.ts index 5092f7a0b7b33..0f5773c00283e 100644 --- a/src/plugins/saved_objects/public/plugin.ts +++ b/src/plugins/saved_objects/public/plugin.ts @@ -17,11 +17,31 @@ * under the License. */ -import { Plugin } from 'src/core/public'; +import { CoreStart, Plugin } from 'src/core/public'; import './index.scss'; +import { createSavedObjectClass } from './saved_object'; +import { DataPublicPluginStart } from '../../data/public'; -export class SavedObjectsPublicPlugin implements Plugin { +export interface SavedObjectsStart { + SavedObjectClass: any; +} + +export interface SavedObjectsStartDeps { + data: DataPublicPluginStart; +} + +export class SavedObjectsPublicPlugin + implements Plugin { public setup() {} - public start() {} + public start(core: CoreStart, { data }: SavedObjectsStartDeps) { + return { + SavedObjectClass: createSavedObjectClass({ + indexPatterns: data.indexPatterns, + savedObjectsClient: core.savedObjects.client, + chrome: core.chrome, + overlays: core.overlays, + }), + }; + } } diff --git a/src/plugins/visualizations/kibana.json b/src/plugins/visualizations/kibana.json index 8e63ea7833327..cd22b1375ae1b 100644 --- a/src/plugins/visualizations/kibana.json +++ b/src/plugins/visualizations/kibana.json @@ -3,7 +3,5 @@ "version": "kibana", "server": true, "ui": true, - "requiredPlugins": [ - "expressions" - ] + "requiredPlugins": ["data", "expressions", "uiActions", "embeddable", "usageCollection"] } diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/__snapshots__/visualization_noresults.test.js.snap b/src/plugins/visualizations/public/components/__snapshots__/visualization_noresults.test.js.snap similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/components/__snapshots__/visualization_noresults.test.js.snap rename to src/plugins/visualizations/public/components/__snapshots__/visualization_noresults.test.js.snap diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/__snapshots__/visualization_requesterror.test.js.snap b/src/plugins/visualizations/public/components/__snapshots__/visualization_requesterror.test.js.snap similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/components/__snapshots__/visualization_requesterror.test.js.snap rename to src/plugins/visualizations/public/components/__snapshots__/visualization_requesterror.test.js.snap diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/_index.scss b/src/plugins/visualizations/public/components/_index.scss similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/components/_index.scss rename to src/plugins/visualizations/public/components/_index.scss diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/_visualization.scss b/src/plugins/visualizations/public/components/_visualization.scss similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/components/_visualization.scss rename to src/plugins/visualizations/public/components/_visualization.scss diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/index.ts b/src/plugins/visualizations/public/components/index.ts similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/components/index.ts rename to src/plugins/visualizations/public/components/index.ts diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization.test.js b/src/plugins/visualizations/public/components/visualization.test.js similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization.test.js rename to src/plugins/visualizations/public/components/visualization.test.js diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization.tsx b/src/plugins/visualizations/public/components/visualization.tsx similarity index 96% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization.tsx rename to src/plugins/visualizations/public/components/visualization.tsx index 5296de365daec..c17e088d7635b 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization.tsx +++ b/src/plugins/visualizations/public/components/visualization.tsx @@ -19,7 +19,7 @@ import { get } from 'lodash'; import React from 'react'; -import { PersistedState } from '../../../../../../../plugins/visualizations/public'; +import { PersistedState } from '../../../../plugins/visualizations/public'; import { memoizeLast } from '../legacy/memoize'; import { VisualizationChart } from './visualization_chart'; import { VisualizationNoResults } from './visualization_noresults'; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization_chart.test.js b/src/plugins/visualizations/public/components/visualization_chart.test.js similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization_chart.test.js rename to src/plugins/visualizations/public/components/visualization_chart.test.js diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization_chart.tsx b/src/plugins/visualizations/public/components/visualization_chart.tsx similarity index 96% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization_chart.tsx rename to src/plugins/visualizations/public/components/visualization_chart.tsx index fcfbc8445952c..7d163d2067ee5 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization_chart.tsx +++ b/src/plugins/visualizations/public/components/visualization_chart.tsx @@ -20,9 +20,9 @@ import React from 'react'; import * as Rx from 'rxjs'; import { debounceTime, filter, share, switchMap } from 'rxjs/operators'; -import { PersistedState } from '../../../../../../../plugins/visualizations/public'; +import { PersistedState } from '../../../../plugins/visualizations/public'; import { VisualizationController } from '../types'; -import { ResizeChecker } from '../../../../../../../plugins/kibana_utils/public'; +import { ResizeChecker } from '../../../../plugins/kibana_utils/public'; import { ExprVis } from '../expressions/vis'; interface VisualizationChartProps { diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization_noresults.test.js b/src/plugins/visualizations/public/components/visualization_noresults.test.js similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization_noresults.test.js rename to src/plugins/visualizations/public/components/visualization_noresults.test.js diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization_noresults.tsx b/src/plugins/visualizations/public/components/visualization_noresults.tsx similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization_noresults.tsx rename to src/plugins/visualizations/public/components/visualization_noresults.tsx diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization_requesterror.test.js b/src/plugins/visualizations/public/components/visualization_requesterror.test.js similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization_requesterror.test.js rename to src/plugins/visualizations/public/components/visualization_requesterror.test.js diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization_requesterror.tsx b/src/plugins/visualizations/public/components/visualization_requesterror.tsx similarity index 96% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization_requesterror.tsx rename to src/plugins/visualizations/public/components/visualization_requesterror.tsx index 406f24741c911..3e677e609ad9a 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/components/visualization_requesterror.tsx +++ b/src/plugins/visualizations/public/components/visualization_requesterror.tsx @@ -19,7 +19,7 @@ import { EuiIcon, EuiSpacer, EuiText } from '@elastic/eui'; import React from 'react'; -import { SearchError } from '../../../../../../../plugins/data/public'; +import { SearchError } from '../../../../plugins/data/public'; interface VisualizationRequestErrorProps { onInit?: () => void; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/_embeddables.scss b/src/plugins/visualizations/public/embeddable/_embeddables.scss similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/_embeddables.scss rename to src/plugins/visualizations/public/embeddable/_embeddables.scss diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/_index.scss b/src/plugins/visualizations/public/embeddable/_index.scss similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/_index.scss rename to src/plugins/visualizations/public/embeddable/_index.scss diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/_visualize_lab_disabled.scss b/src/plugins/visualizations/public/embeddable/_visualize_lab_disabled.scss similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/_visualize_lab_disabled.scss rename to src/plugins/visualizations/public/embeddable/_visualize_lab_disabled.scss diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/constants.ts b/src/plugins/visualizations/public/embeddable/constants.ts similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/constants.ts rename to src/plugins/visualizations/public/embeddable/constants.ts diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/disabled_lab_embeddable.tsx b/src/plugins/visualizations/public/embeddable/disabled_lab_embeddable.tsx similarity index 94% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/disabled_lab_embeddable.tsx rename to src/plugins/visualizations/public/embeddable/disabled_lab_embeddable.tsx index fbb2eba3afe79..af8121d8bf033 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/disabled_lab_embeddable.tsx +++ b/src/plugins/visualizations/public/embeddable/disabled_lab_embeddable.tsx @@ -19,7 +19,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { Embeddable, EmbeddableOutput } from '../../../../../../../plugins/embeddable/public'; +import { Embeddable, EmbeddableOutput } from '../../../../plugins/embeddable/public'; import { DisabledLabVisualization } from './disabled_lab_visualization'; import { VisualizeInput } from './visualize_embeddable'; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/disabled_lab_visualization.tsx b/src/plugins/visualizations/public/embeddable/disabled_lab_visualization.tsx similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/disabled_lab_visualization.tsx rename to src/plugins/visualizations/public/embeddable/disabled_lab_visualization.tsx diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/events.ts b/src/plugins/visualizations/public/embeddable/events.ts similarity index 90% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/events.ts rename to src/plugins/visualizations/public/embeddable/events.ts index 53d04bf6eb04a..0957895a21403 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/events.ts +++ b/src/plugins/visualizations/public/embeddable/events.ts @@ -17,10 +17,7 @@ * under the License. */ -import { - SELECT_RANGE_TRIGGER, - VALUE_CLICK_TRIGGER, -} from '../../../../../../../plugins/ui_actions/public'; +import { SELECT_RANGE_TRIGGER, VALUE_CLICK_TRIGGER } from '../../../../plugins/ui_actions/public'; export interface VisEventToTrigger { ['brush']: typeof SELECT_RANGE_TRIGGER; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/get_index_pattern.ts b/src/plugins/visualizations/public/embeddable/get_index_pattern.ts similarity index 97% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/get_index_pattern.ts rename to src/plugins/visualizations/public/embeddable/get_index_pattern.ts index 05ce68221eaf0..c12c95145fe44 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/get_index_pattern.ts +++ b/src/plugins/visualizations/public/embeddable/get_index_pattern.ts @@ -22,7 +22,7 @@ import { indexPatterns, IIndexPattern, IndexPatternAttributes, -} from '../../../../../../../plugins/data/public'; +} from '../../../../plugins/data/public'; import { getUISettings, getSavedObjects } from '../services'; export async function getIndexPattern( diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/index.ts b/src/plugins/visualizations/public/embeddable/index.ts similarity index 95% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/index.ts rename to src/plugins/visualizations/public/embeddable/index.ts index a1cd31eebef20..78f9827ffde3e 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/index.ts +++ b/src/plugins/visualizations/public/embeddable/index.ts @@ -20,3 +20,4 @@ export { DisabledLabEmbeddable } from './disabled_lab_embeddable'; export { VisualizeEmbeddable, VisualizeInput } from './visualize_embeddable'; export { VisualizeEmbeddableFactory } from './visualize_embeddable_factory'; export { VISUALIZE_EMBEDDABLE_TYPE } from './constants'; +export { VIS_EVENT_TO_TRIGGER } from './events'; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/visualize_embeddable.ts b/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts similarity index 97% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/visualize_embeddable.ts rename to src/plugins/visualizations/public/embeddable/visualize_embeddable.ts index bcca4bdf67dcf..0c7e732f0b185 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/visualize_embeddable.ts +++ b/src/plugins/visualizations/public/embeddable/visualize_embeddable.ts @@ -28,19 +28,16 @@ import { esFilters, Filter, TimefilterContract, -} from '../../../../../../../plugins/data/public'; +} from '../../../../plugins/data/public'; import { EmbeddableInput, EmbeddableOutput, Embeddable, Container, EmbeddableVisTriggerContext, -} from '../../../../../../../plugins/embeddable/public'; -import { dispatchRenderComplete } from '../../../../../../../plugins/kibana_utils/public'; -import { - IExpressionLoaderParams, - ExpressionsStart, -} from '../../../../../../../plugins/expressions/public'; +} from '../../../../plugins/embeddable/public'; +import { dispatchRenderComplete } from '../../../../plugins/kibana_utils/public'; +import { IExpressionLoaderParams, ExpressionsStart } from '../../../../plugins/expressions/public'; import { buildPipeline } from '../legacy/build_pipeline'; import { Vis } from '../vis'; import { getExpressions, getUiActions } from '../services'; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/visualize_embeddable_factory.tsx b/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx similarity index 97% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/visualize_embeddable_factory.tsx rename to src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx index 36d3d8bb07d29..428f1865e6566 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/visualize_embeddable_factory.tsx +++ b/src/plugins/visualizations/public/embeddable/visualize_embeddable_factory.tsx @@ -18,13 +18,13 @@ */ import { i18n } from '@kbn/i18n'; -import { SavedObjectAttributes } from '../../../../../../../core/public'; +import { SavedObjectAttributes } from '../../../../core/public'; import { Container, EmbeddableFactory, EmbeddableOutput, ErrorEmbeddable, -} from '../../../../../../../plugins/embeddable/public'; +} from '../../../../plugins/embeddable/public'; import { DisabledLabEmbeddable } from './disabled_lab_embeddable'; import { VisualizeEmbeddable, VisualizeInput, VisualizeOutput } from './visualize_embeddable'; import { Vis } from '../types'; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/expressions/vis.ts b/src/plugins/visualizations/public/expressions/vis.ts similarity index 95% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/expressions/vis.ts rename to src/plugins/visualizations/public/expressions/vis.ts index 3b0458a6c8dcc..a7d4a28070620 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/expressions/vis.ts +++ b/src/plugins/visualizations/public/expressions/vis.ts @@ -29,11 +29,10 @@ import { EventEmitter } from 'events'; import _ from 'lodash'; -import { PersistedState } from '../../../../../../../plugins/visualizations/public'; +import { VisParams, PersistedState } from '../../../../plugins/visualizations/public'; import { getTypes } from '../services'; import { VisType } from '../vis_types'; -import { VisParams } from '../types'; export interface ExprVisState { title?: string; @@ -82,10 +81,11 @@ export class ExprVis extends EventEmitter { private getType(type: string | VisType) { if (_.isString(type)) { - return getTypes().get(type); - if (!this.type) { + const newType = getTypes().get(type); + if (!newType) { throw new Error(`Invalid type "${type}"`); } + return newType; } else { return type; } diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/expressions/visualization_function.ts b/src/plugins/visualizations/public/expressions/visualization_function.ts similarity index 95% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/expressions/visualization_function.ts rename to src/plugins/visualizations/public/expressions/visualization_function.ts index d98eda4c50ef9..52177f6ec381a 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/expressions/visualization_function.ts +++ b/src/plugins/visualizations/public/expressions/visualization_function.ts @@ -19,14 +19,8 @@ import { get } from 'lodash'; import { i18n } from '@kbn/i18n'; -import { - VisResponseValue, - PersistedState, -} from '../../../../../../../plugins/visualizations/public'; -import { - ExpressionFunctionDefinition, - Render, -} from '../../../../../../../plugins/expressions/public'; +import { VisResponseValue, PersistedState } from '../../../../plugins/visualizations/public'; +import { ExpressionFunctionDefinition, Render } from '../../../../plugins/expressions/public'; import { getTypes, getIndexPatterns, getFilterManager } from '../services'; interface Arguments { diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/expressions/visualization_renderer.tsx b/src/plugins/visualizations/public/expressions/visualization_renderer.tsx similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/expressions/visualization_renderer.tsx rename to src/plugins/visualizations/public/expressions/visualization_renderer.tsx diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/_index.scss b/src/plugins/visualizations/public/index.scss similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/_index.scss rename to src/plugins/visualizations/public/index.scss diff --git a/src/plugins/visualizations/public/index.ts b/src/plugins/visualizations/public/index.ts index c08dbf890b8da..7df420e7ba585 100644 --- a/src/plugins/visualizations/public/index.ts +++ b/src/plugins/visualizations/public/index.ts @@ -17,15 +17,37 @@ * under the License. */ -import { PluginInitializerContext } from '../../../core/public'; -import { VisualizationsPublicPlugin } from './plugin'; +import './index.scss'; + +import { PublicContract } from '@kbn/utility-types'; +import { PluginInitializerContext } from 'src/core/public'; +import { VisualizationsPlugin, VisualizationsSetup, VisualizationsStart } from './plugin'; +import { VisualizeEmbeddableFactory, VisualizeEmbeddable } from './embeddable'; +import { ExprVis as ExprVisClass } from './expressions/vis'; export function plugin(initializerContext: PluginInitializerContext) { - return new VisualizationsPublicPlugin(initializerContext); + return new VisualizationsPlugin(initializerContext); } -export { VisualizationsPublicPlugin as Plugin }; -export * from './plugin'; -export * from './types'; +/** @public static code */ +export { Vis } from './vis'; +export { TypesService } from './vis_types/types_service'; +export { VISUALIZE_EMBEDDABLE_TYPE, VIS_EVENT_TO_TRIGGER } from './embeddable'; +/** @public types */ +export { VisualizationsSetup, VisualizationsStart }; +export { VisTypeAlias, VisType } from './vis_types'; +export { VisParams, SerializedVis, SerializedVisData, VisData } from './vis'; +export type VisualizeEmbeddableFactoryContract = PublicContract; +export type VisualizeEmbeddableContract = PublicContract; +export { VisualizeInput } from './embeddable'; +export type ExprVis = ExprVisClass; +export { SchemaConfig } from './legacy/build_pipeline'; export { PersistedState } from './persisted_state'; +export { + VisualizationController, + SavedVisState, + ISavedVis, + VisSavedObject, + VisResponseValue, +} from './types'; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/__snapshots__/build_pipeline.test.ts.snap b/src/plugins/visualizations/public/legacy/__snapshots__/build_pipeline.test.ts.snap similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/__snapshots__/build_pipeline.test.ts.snap rename to src/plugins/visualizations/public/legacy/__snapshots__/build_pipeline.test.ts.snap diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/__tests__/vis_update_objs/gauge_objs.js b/src/plugins/visualizations/public/legacy/__tests__/vis_update_objs/gauge_objs.js similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/__tests__/vis_update_objs/gauge_objs.js rename to src/plugins/visualizations/public/legacy/__tests__/vis_update_objs/gauge_objs.js diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/build_pipeline.test.ts b/src/plugins/visualizations/public/legacy/build_pipeline.test.ts similarity index 98% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/build_pipeline.test.ts rename to src/plugins/visualizations/public/legacy/build_pipeline.test.ts index d5c532b53a53e..5476ce6df0390 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/build_pipeline.test.ts +++ b/src/plugins/visualizations/public/legacy/build_pipeline.test.ts @@ -27,10 +27,8 @@ import { Schemas, } from './build_pipeline'; import { Vis } from '..'; -import { dataPluginMock } from '../../../../../../../plugins/data/public/mocks'; -import { IAggConfig } from '../../../../../../../plugins/data/public'; - -jest.mock('ui/new_platform'); +import { dataPluginMock } from '../../../../plugins/data/public/mocks'; +import { IAggConfig } from '../../../../plugins/data/public'; describe('visualize loader pipeline helpers: build pipeline', () => { describe('prepareJson', () => { diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/build_pipeline.ts b/src/plugins/visualizations/public/legacy/build_pipeline.ts similarity index 99% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/build_pipeline.ts rename to src/plugins/visualizations/public/legacy/build_pipeline.ts index 05ae26892b9bd..18af94c919247 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/build_pipeline.ts +++ b/src/plugins/visualizations/public/legacy/build_pipeline.ts @@ -19,13 +19,13 @@ import { get } from 'lodash'; import moment from 'moment'; -import { SerializedFieldFormat } from '../../../../../../../plugins/expressions/public'; +import { SerializedFieldFormat } from '../../../../plugins/expressions/public'; import { IAggConfig, fieldFormats, search, TimefilterContract, -} from '../../../../../../../plugins/data/public'; +} from '../../../../plugins/data/public'; import { Vis, VisParams } from '../types'; const { isDateHistogramBucketAggConfig } = search.aggs; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/memoize.test.ts b/src/plugins/visualizations/public/legacy/memoize.test.ts similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/memoize.test.ts rename to src/plugins/visualizations/public/legacy/memoize.test.ts diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/memoize.ts b/src/plugins/visualizations/public/legacy/memoize.ts similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/memoize.ts rename to src/plugins/visualizations/public/legacy/memoize.ts diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/vis_update.js b/src/plugins/visualizations/public/legacy/vis_update.js similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/vis_update.js rename to src/plugins/visualizations/public/legacy/vis_update.js diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/vis_update_state.js b/src/plugins/visualizations/public/legacy/vis_update_state.js similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/vis_update_state.js rename to src/plugins/visualizations/public/legacy/vis_update_state.js diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/vis_update_state.test.js b/src/plugins/visualizations/public/legacy/vis_update_state.test.js similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/vis_update_state.test.js rename to src/plugins/visualizations/public/legacy/vis_update_state.test.js diff --git a/src/plugins/visualizations/public/mocks.ts b/src/plugins/visualizations/public/mocks.ts index af7688d019f65..f4983a4313c4d 100644 --- a/src/plugins/visualizations/public/mocks.ts +++ b/src/plugins/visualizations/public/mocks.ts @@ -16,22 +16,60 @@ * specific language governing permissions and limitations * under the License. */ -import { VisualizationsSetup, VisualizationsStart } from '.'; -export type Setup = jest.Mocked; -export type Start = jest.Mocked; +import { PluginInitializerContext } from '../../../core/public'; +import { VisualizationsSetup, VisualizationsStart } from './'; +import { VisualizationsPlugin } from './plugin'; +import { coreMock } from '../../../core/public/mocks'; +import { embeddablePluginMock } from '../../../plugins/embeddable/public/mocks'; +import { expressionsPluginMock } from '../../../plugins/expressions/public/mocks'; +import { dataPluginMock } from '../../../plugins/data/public/mocks'; +import { usageCollectionPluginMock } from '../../../plugins/usage_collection/public/mocks'; +import { uiActionsPluginMock } from '../../../plugins/ui_actions/public/mocks'; -const createSetupContract = (): Setup => { - const setupContract: Setup = undefined; - return setupContract; -}; +const createSetupContract = (): VisualizationsSetup => ({ + createBaseVisualization: jest.fn(), + createReactVisualization: jest.fn(), + registerAlias: jest.fn(), + hideTypes: jest.fn(), +}); + +const createStartContract = (): VisualizationsStart => ({ + get: jest.fn(), + all: jest.fn(), + getAliases: jest.fn(), + savedVisualizationsLoader: {} as any, + showNewVisModal: jest.fn(), + createVis: jest.fn(), + convertFromSerializedVis: jest.fn(), + convertToSerializedVis: jest.fn(), +}); + +const createInstance = async () => { + const plugin = new VisualizationsPlugin({} as PluginInitializerContext); + + const setup = plugin.setup(coreMock.createSetup(), { + data: dataPluginMock.createSetupContract(), + expressions: expressionsPluginMock.createSetupContract(), + embeddable: embeddablePluginMock.createSetupContract(), + usageCollection: usageCollectionPluginMock.createSetupContract(), + }); + const doStart = () => + plugin.start(coreMock.createStart(), { + data: dataPluginMock.createStartContract(), + expressions: expressionsPluginMock.createStartContract(), + uiActions: uiActionsPluginMock.createStartContract(), + }); -const createStartContract = (): Start => { - const startContract: Start = undefined; - return startContract; + return { + plugin, + setup, + doStart, + }; }; -export const expressionsPluginMock = { +export const visualizationsPluginMock = { createSetupContract, createStartContract, + createInstance, }; diff --git a/src/plugins/visualizations/public/plugin.ts b/src/plugins/visualizations/public/plugin.ts index cceb63122820d..d3e7b759a4416 100644 --- a/src/plugins/visualizations/public/plugin.ts +++ b/src/plugins/visualizations/public/plugin.ts @@ -18,23 +18,81 @@ */ import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '../../../core/public'; -import { ExpressionsSetup, ExpressionsStart } from '../../expressions/public'; +import { TypesService, TypesSetup, TypesStart } from './vis_types'; +import { + setUISettings, + setTypes, + setI18n, + setCapabilities, + setHttp, + setIndexPatterns, + setSavedObjects, + setUsageCollector, + setFilterManager, + setExpressions, + setUiActions, + setSavedVisualizationsLoader, + setTimeFilter, + setAggs, + setChrome, + setOverlays, +} from './services'; +import { VISUALIZE_EMBEDDABLE_TYPE, VisualizeEmbeddableFactory } from './embeddable'; +import { ExpressionsSetup, ExpressionsStart } from '../../../plugins/expressions/public'; +import { EmbeddableSetup } from '../../../plugins/embeddable/public'; +import { visualization as visualizationFunction } from './expressions/visualization_function'; +import { visualization as visualizationRenderer } from './expressions/visualization_renderer'; import { range as rangeExpressionFunction } from './expression_functions/range'; import { visDimension as visDimensionExpressionFunction } from './expression_functions/vis_dimension'; +import { DataPublicPluginSetup, DataPublicPluginStart } from '../../../plugins/data/public'; +import { UsageCollectionSetup } from '../../../plugins/usage_collection/public'; +import { createSavedVisLoader, SavedVisualizationsLoader } from './saved_visualizations'; +import { SerializedVis, Vis } from './vis'; +import { showNewVisModal } from './wizard'; +import { UiActionsStart } from '../../../plugins/ui_actions/public'; +import { + convertFromSerializedVis, + convertToSerializedVis, +} from './saved_visualizations/_saved_vis'; + +/** + * Interface for this plugin's returned setup/start contracts. + * + * @public + */ + +export type VisualizationsSetup = TypesSetup; + +export interface VisualizationsStart extends TypesStart { + savedVisualizationsLoader: SavedVisualizationsLoader; + createVis: (visType: string, visState?: SerializedVis) => Vis; + convertToSerializedVis: typeof convertToSerializedVis; + convertFromSerializedVis: typeof convertFromSerializedVis; + showNewVisModal: typeof showNewVisModal; +} export interface VisualizationsSetupDeps { expressions: ExpressionsSetup; + embeddable: EmbeddableSetup; + usageCollection: UsageCollectionSetup; + data: DataPublicPluginSetup; } export interface VisualizationsStartDeps { + data: DataPublicPluginStart; expressions: ExpressionsStart; + uiActions: UiActionsStart; } -export type VisualizationsSetup = void; - -export type VisualizationsStart = void; - -export class VisualizationsPublicPlugin +/** + * Visualizations Plugin - public + * + * This plugin's stateful contracts are returned from the `setup` and `start` methods + * below. The interfaces for these contracts are provided above. + * + * @internal + */ +export class VisualizationsPlugin implements Plugin< VisualizationsSetup, @@ -42,18 +100,73 @@ export class VisualizationsPublicPlugin VisualizationsSetupDeps, VisualizationsStartDeps > { + private readonly types: TypesService = new TypesService(); + constructor(initializerContext: PluginInitializerContext) {} - public setup(core: CoreSetup, { expressions }: VisualizationsSetupDeps): VisualizationsSetup { + public setup( + core: CoreSetup, + { expressions, embeddable, usageCollection, data }: VisualizationsSetupDeps + ): VisualizationsSetup { + setUISettings(core.uiSettings); + setUsageCollector(usageCollection); + + expressions.registerFunction(visualizationFunction); + expressions.registerRenderer(visualizationRenderer); expressions.registerFunction(rangeExpressionFunction); expressions.registerFunction(visDimensionExpressionFunction); - return undefined; + const embeddableFactory = new VisualizeEmbeddableFactory(); + embeddable.registerEmbeddableFactory(VISUALIZE_EMBEDDABLE_TYPE, embeddableFactory); + + return { + ...this.types.setup(), + }; } - public start(core: CoreStart, { expressions }: VisualizationsStartDeps): VisualizationsStart { - return undefined; + public start( + core: CoreStart, + { data, expressions, uiActions }: VisualizationsStartDeps + ): VisualizationsStart { + const types = this.types.start(); + setI18n(core.i18n); + setTypes(types); + setCapabilities(core.application.capabilities); + setHttp(core.http); + setSavedObjects(core.savedObjects); + setIndexPatterns(data.indexPatterns); + setFilterManager(data.query.filterManager); + setExpressions(expressions); + setUiActions(uiActions); + setTimeFilter(data.query.timefilter.timefilter); + setAggs(data.search.aggs); + setOverlays(core.overlays); + setChrome(core.chrome); + const savedVisualizationsLoader = createSavedVisLoader({ + savedObjectsClient: core.savedObjects.client, + indexPatterns: data.indexPatterns, + chrome: core.chrome, + overlays: core.overlays, + visualizationTypes: types, + }); + setSavedVisualizationsLoader(savedVisualizationsLoader); + + return { + ...types, + showNewVisModal, + /** + * creates new instance of Vis + * @param {IIndexPattern} indexPattern - index pattern to use + * @param {VisState} visState - visualization configuration + */ + createVis: (visType: string, visState?: SerializedVis) => new Vis(visType, visState), + convertToSerializedVis, + convertFromSerializedVis, + savedVisualizationsLoader, + }; } - public stop() {} + public stop() { + this.types.stop(); + } } diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/_saved_vis.ts b/src/plugins/visualizations/public/saved_visualizations/_saved_vis.ts similarity index 94% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/_saved_vis.ts rename to src/plugins/visualizations/public/saved_visualizations/_saved_vis.ts index c9906428ccb31..bc96e08f4b9da 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/_saved_vis.ts +++ b/src/plugins/visualizations/public/saved_visualizations/_saved_vis.ts @@ -28,17 +28,13 @@ import { createSavedObjectClass, SavedObject, SavedObjectKibanaServices, -} from '../../../../../../../plugins/saved_objects/public'; +} from '../../../../plugins/saved_objects/public'; // @ts-ignore import { updateOldState } from '../legacy/vis_update_state'; import { extractReferences, injectReferences } from './saved_visualization_references'; -import { - IIndexPattern, - ISearchSource, - SearchSource, -} from '../../../../../../../plugins/data/public'; +import { IIndexPattern, ISearchSource, SearchSource } from '../../../../plugins/data/public'; import { ISavedVis, SerializedVis } from '../types'; -import { createSavedSearchesLoader } from '../../../../../../../plugins/discover/public'; +import { createSavedSearchesLoader } from '../../../../plugins/discover/public'; import { getChrome, getOverlays, getIndexPatterns, getSavedObjects } from '../services'; export const convertToSerializedVis = async (savedVis: ISavedVis): Promise => { @@ -159,5 +155,5 @@ export function createSavedVisClass(services: SavedObjectKibanaServices) { } } - return SavedVis; + return SavedVis as new (opts: Record | string) => SavedObject; } diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/find_list_items.test.ts b/src/plugins/visualizations/public/saved_visualizations/find_list_items.test.ts similarity index 97% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/find_list_items.test.ts rename to src/plugins/visualizations/public/saved_visualizations/find_list_items.test.ts index d1def09978dbb..4a50590e26251 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/find_list_items.test.ts +++ b/src/plugins/visualizations/public/saved_visualizations/find_list_items.test.ts @@ -18,8 +18,8 @@ */ import { findListItems } from './find_list_items'; -import { coreMock } from '../../../../../../../core/public/mocks'; -import { SavedObjectsClientContract } from '../../../../../../../core/public'; +import { coreMock } from '../../../../core/public/mocks'; +import { SavedObjectsClientContract } from '../../../../core/public'; import { VisTypeAlias } from '../vis_types'; describe('saved_visualizations', () => { diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/find_list_items.ts b/src/plugins/visualizations/public/saved_visualizations/find_list_items.ts similarity index 92% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/find_list_items.ts rename to src/plugins/visualizations/public/saved_visualizations/find_list_items.ts index 02db90a762e89..c0203a7441a61 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/find_list_items.ts +++ b/src/plugins/visualizations/public/saved_visualizations/find_list_items.ts @@ -18,11 +18,8 @@ */ import _ from 'lodash'; -import { - SavedObjectAttributes, - SavedObjectsClientContract, -} from '../../../../../../../core/public'; -import { SavedObjectLoader } from '../../../../../../../plugins/saved_objects/public'; +import { SavedObjectAttributes, SavedObjectsClientContract } from '../../../../core/public'; +import { SavedObjectLoader } from '../../../../plugins/saved_objects/public'; import { VisTypeAlias } from '../vis_types'; import { VisualizationsAppExtension } from '../vis_types/vis_type_alias_registry'; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/index.ts b/src/plugins/visualizations/public/saved_visualizations/index.ts similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/index.ts rename to src/plugins/visualizations/public/saved_visualizations/index.ts diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/saved_visualization_references.test.ts b/src/plugins/visualizations/public/saved_visualizations/saved_visualization_references.test.ts similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/saved_visualization_references.test.ts rename to src/plugins/visualizations/public/saved_visualizations/saved_visualization_references.test.ts diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/saved_visualization_references.ts b/src/plugins/visualizations/public/saved_visualizations/saved_visualization_references.ts similarity index 99% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/saved_visualization_references.ts rename to src/plugins/visualizations/public/saved_visualizations/saved_visualization_references.ts index b995d340d44d9..a14595524100b 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/saved_visualization_references.ts +++ b/src/plugins/visualizations/public/saved_visualizations/saved_visualization_references.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { SavedObjectAttributes, SavedObjectReference } from '../../../../../../../core/public'; +import { SavedObjectAttributes, SavedObjectReference } from '../../../../core/public'; import { VisSavedObject } from '../types'; export function extractReferences({ diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/saved_visualizations.ts b/src/plugins/visualizations/public/saved_visualizations/saved_visualizations.ts similarity index 92% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/saved_visualizations.ts rename to src/plugins/visualizations/public/saved_visualizations/saved_visualizations.ts index fc0f77d54059c..e5d0c41712a91 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/saved_visualizations.ts +++ b/src/plugins/visualizations/public/saved_visualizations/saved_visualizations.ts @@ -19,7 +19,7 @@ import { SavedObjectLoader, SavedObjectKibanaServices, -} from '../../../../../../../plugins/saved_objects/public'; +} from '../../../../plugins/saved_objects/public'; import { findListItems } from './find_list_items'; import { createSavedVisClass } from './_saved_vis'; import { TypesStart } from '../vis_types'; @@ -76,5 +76,9 @@ export function createSavedVisLoader(services: SavedObjectKibanaServicesWithVisu } } const SavedVis = createSavedVisClass(services); - return new SavedObjectLoaderVisualize(SavedVis, savedObjectsClient, services.chrome); + return new SavedObjectLoaderVisualize( + SavedVis, + savedObjectsClient, + services.chrome + ) as SavedObjectLoader & { findListItems: (search: string, size: number) => any }; } diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/services.ts b/src/plugins/visualizations/public/services.ts similarity index 83% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/services.ts rename to src/plugins/visualizations/public/services.ts index 23cdeae7d15ff..c4668fa4b0c79 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/services.ts +++ b/src/plugins/visualizations/public/services.ts @@ -18,7 +18,6 @@ */ import { - ApplicationStart, Capabilities, ChromeStart, HttpStart, @@ -26,18 +25,18 @@ import { IUiSettingsClient, OverlayStart, SavedObjectsStart, -} from '../../../../../../core/public'; +} from '../../../core/public'; import { TypesStart } from './vis_types'; -import { createGetterSetter } from '../../../../../../plugins/kibana_utils/public'; +import { createGetterSetter } from '../../../plugins/kibana_utils/public'; import { DataPublicPluginStart, FilterManager, IndexPatternsContract, TimefilterContract, -} from '../../../../../../plugins/data/public'; -import { UsageCollectionSetup } from '../../../../../../plugins/usage_collection/public'; -import { ExpressionsStart } from '../../../../../../plugins/expressions/public'; -import { UiActionsStart } from '../../../../../../plugins/ui_actions/public'; +} from '../../../plugins/data/public'; +import { UsageCollectionSetup } from '../../../plugins/usage_collection/public'; +import { ExpressionsStart } from '../../../plugins/expressions/public'; +import { UiActionsStart } from '../../../plugins/ui_actions/public'; import { SavedVisualizationsLoader } from './saved_visualizations'; export const [getUISettings, setUISettings] = createGetterSetter('UISettings'); @@ -83,5 +82,3 @@ export const [getAggs, setAggs] = createGetterSetter('Overlays'); export const [getChrome, setChrome] = createGetterSetter('Chrome'); - -export const [getApplication, setApplication] = createGetterSetter('Application'); diff --git a/src/plugins/visualizations/public/types.ts b/src/plugins/visualizations/public/types.ts index 6487266956119..54528a33414c3 100644 --- a/src/plugins/visualizations/public/types.ts +++ b/src/plugins/visualizations/public/types.ts @@ -17,6 +17,42 @@ * under the License. */ +import { SavedObject } from '../../../plugins/saved_objects/public'; +import { ISearchSource, AggConfigOptions } from '../../../plugins/data/public'; +import { SerializedVis, Vis, VisParams } from './vis'; + +export { Vis, SerializedVis, VisParams }; + +export interface VisualizationController { + render(visData: any, visParams: any): Promise; + destroy(): void; + isLoaded?(): Promise | void; +} + +export type VisualizationControllerConstructor = new ( + el: HTMLElement, + vis: Vis +) => VisualizationController; + +export interface SavedVisState { + type: string; + params: VisParams; + aggs: AggConfigOptions[]; +} + +export interface ISavedVis { + id?: string; + title: string; + description?: string; + visState: SavedVisState; + searchSource?: ISearchSource; + uiStateJSON?: string; + savedSearchRefName?: string; + savedSearchId?: string; +} + +export interface VisSavedObject extends SavedObject, ISavedVis {} + export interface VisResponseValue { visType: string; visData: object; diff --git a/src/plugins/visualizations/public/vis.test.ts b/src/plugins/visualizations/public/vis.test.ts new file mode 100644 index 0000000000000..fc9327903fc90 --- /dev/null +++ b/src/plugins/visualizations/public/vis.test.ts @@ -0,0 +1,124 @@ +/* + * 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 { Vis } from './vis'; +// @ts-ignore +import fixturesStubbedLogstashIndexPatternProvider from '../../../fixtures/stubbed_logstash_index_pattern'; + +jest.mock('./services', () => { + class MockVisualizationController { + constructor() {} + + render(): Promise { + return new Promise(resolve => { + resolve(); + }); + } + + destroy() {} + } + + // eslint-disable-next-line + const { BaseVisType } = require('./vis_types/base_vis_type'); + + const visType = new BaseVisType({ + name: 'pie', + title: 'pie', + icon: 'pie-icon', + visualization: MockVisualizationController, + }); + + return { + getTypes: () => ({ get: () => visType }), + getAggs: () => ({ + createAggConfigs: (indexPattern: any, cfg: any) => ({ + aggs: cfg.map((aggConfig: any) => ({ ...aggConfig, toJSON: () => aggConfig })), + }), + }), + }; +}); + +describe('Vis Class', function() { + let vis: Vis; + const stateFixture = { + type: 'pie', + title: 'pie', + data: { + aggs: [ + { type: 'avg' as any, schema: 'metric', params: { field: 'bytes' } }, + { type: 'terms' as any, schema: 'segment', params: { field: 'machine.os' } }, + { type: 'terms' as any, schema: 'segment', params: { field: 'geo.src' } }, + ], + searchSource: { + getField: (name: string) => { + if (name === 'index') { + return fixturesStubbedLogstashIndexPatternProvider(); + } + }, + createCopy: jest.fn(), + }, + }, + params: { isDonut: true }, + }; + + beforeEach(function() { + vis = new Vis('test', stateFixture as any); + }); + + const verifyVis = function(visToVerify: Vis) { + expect(visToVerify).toHaveProperty('data'); + expect(visToVerify.data).toHaveProperty('aggs'); + expect(visToVerify.data.aggs!.aggs).toHaveLength(3); + + expect(visToVerify).toHaveProperty('type'); + + expect(visToVerify).toHaveProperty('params'); + expect(visToVerify.params).toHaveProperty('isDonut', true); + }; + + describe('initialization', function() { + it('should set the state', function() { + verifyVis(vis); + }); + }); + + describe('getState()', function() { + it('should get a state that represents the... er... state', function() { + const state = vis.serialize(); + expect(state).toHaveProperty('type', 'pie'); + + expect(state).toHaveProperty('params'); + expect(state.params).toHaveProperty('isDonut', true); + + expect(state.data).toHaveProperty('aggs'); + expect(state.data.aggs).toHaveLength(3); + }); + }); + + describe('isHierarchical()', function() { + it('should return false for non-hierarchical vis (like histogram)', function() { + expect(vis.isHierarchical()).toBe(false); + }); + + it('should return true for hierarchical vis (like pie)', function() { + vis.type.hierarchicalData = true; + expect(vis.isHierarchical()).toBe(true); + }); + }); +}); diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis.ts b/src/plugins/visualizations/public/vis.ts similarity index 97% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/vis.ts rename to src/plugins/visualizations/public/vis.ts index 91b6a2368f5ef..3cab4faf2a27f 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis.ts +++ b/src/plugins/visualizations/public/vis.ts @@ -28,7 +28,7 @@ */ import { isFunction, defaults, cloneDeep } from 'lodash'; -import { PersistedState } from '../../../../../../../src/plugins/visualizations/public'; +import { PersistedState } from './persisted_state'; // @ts-ignore import { updateVisualizationConfig } from './legacy/vis_update'; import { getTypes, getAggs } from './services'; @@ -38,7 +38,7 @@ import { IndexPattern, ISearchSource, AggConfigOptions, -} from '../../../../../../plugins/data/public'; +} from '../../../plugins/data/public'; export interface SerializedVisData { expression?: string; @@ -49,7 +49,7 @@ export interface SerializedVisData { } export interface SerializedVis { - id: string; + id?: string; title: string; description?: string; type: string; @@ -72,7 +72,7 @@ export interface VisParams { export class Vis { public readonly type: VisType; - public readonly id: string; + public readonly id?: string; public title: string = ''; public description: string = ''; public params: VisParams = {}; diff --git a/src/legacy/core_plugins/visualizations/public/index.ts b/src/plugins/visualizations/public/vis_types/base_vis_type.test.ts similarity index 67% rename from src/legacy/core_plugins/visualizations/public/index.ts rename to src/plugins/visualizations/public/vis_types/base_vis_type.test.ts index f5590c745b3f9..ac1242b2a1321 100644 --- a/src/legacy/core_plugins/visualizations/public/index.ts +++ b/src/plugins/visualizations/public/vis_types/base_vis_type.test.ts @@ -17,10 +17,19 @@ * under the License. */ -/** - * Static np-ready code, re-exported here so consumers can import from - * `src/legacy/core_plugins/visualizations/public` - * - * @public - */ -export * from './np_ready/public'; +import { BaseVisType } from './base_vis_type'; + +describe('BaseVisType', () => { + describe('constructor', () => { + test('should throw if image and icon are missing', () => { + expect(() => { + new BaseVisType({ + name: 'test', + title: 'test', + description: 'test', + visualization: {} as any, + }); + }).toThrow(); + }); + }); +}); diff --git a/src/plugins/visualizations/public/vis_types/base_vis_type.ts b/src/plugins/visualizations/public/vis_types/base_vis_type.ts new file mode 100644 index 0000000000000..2464bb72d2695 --- /dev/null +++ b/src/plugins/visualizations/public/vis_types/base_vis_type.ts @@ -0,0 +1,110 @@ +/* + * 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 _ from 'lodash'; +import { VisualizationControllerConstructor } from '../types'; + +export interface BaseVisTypeOptions { + name: string; + title: string; + description?: string; + icon?: string; + image?: string; + stage?: 'experimental' | 'beta' | 'production'; + feedbackMessage?: string; + options?: Record; + visualization: VisualizationControllerConstructor; + visConfig?: Record; + editor?: any; + editorConfig?: Record; + hidden?: boolean; + requestHandler?: string | unknown; + responseHandler?: string | unknown; + hierarchicalData?: boolean | unknown; + setup?: unknown; + useCustomNoDataScreen?: boolean; +} + +export class BaseVisType { + name: string; + title: string; + description: string; + icon?: string; + image?: string; + stage: 'experimental' | 'beta' | 'production'; + feedbackMessage: string; + options: Record; + visualization: VisualizationControllerConstructor; + visConfig: Record; + editor: any; + editorConfig: Record; + hidden: boolean; + requiresSearch: boolean; + requestHandler: string | unknown; + responseHandler: string | unknown; + hierarchicalData: boolean | unknown; + setup?: unknown; + useCustomNoDataScreen: boolean; + + constructor(opts: BaseVisTypeOptions) { + if (!opts.icon && !opts.image) { + throw new Error('vis_type must define its icon or image'); + } + + const defaultOptions = { + // controls the visualize editor + showTimePicker: true, + showQueryBar: true, + showFilterBar: true, + showIndexSelection: true, + hierarchicalData: false, // we should get rid of this i guess ? + }; + + this.name = opts.name; + this.description = opts.description || ''; + this.title = opts.title; + this.icon = opts.icon; + this.image = opts.image; + this.visualization = opts.visualization; + this.visConfig = _.defaultsDeep({}, opts.visConfig, { defaults: {} }); + this.editor = opts.editor; + this.editorConfig = _.defaultsDeep({}, opts.editorConfig, { collections: {} }); + this.options = _.defaultsDeep({}, opts.options, defaultOptions); + this.stage = opts.stage || 'production'; + this.feedbackMessage = opts.feedbackMessage || ''; + this.hidden = opts.hidden || false; + this.requestHandler = opts.requestHandler || 'courier'; + this.responseHandler = opts.responseHandler || 'none'; + this.setup = opts.setup; + this.requiresSearch = this.requestHandler !== 'none'; + this.hierarchicalData = opts.hierarchicalData || false; + this.useCustomNoDataScreen = opts.useCustomNoDataScreen || false; + } + + shouldMarkAsExperimentalInUI() { + return this.stage === 'experimental'; + } + + public get schemas() { + if (this.editorConfig && this.editorConfig.schemas) { + return this.editorConfig.schemas; + } + return []; + } +} diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/index.ts b/src/plugins/visualizations/public/vis_types/index.ts similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/index.ts rename to src/plugins/visualizations/public/vis_types/index.ts diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/react_vis_type.js b/src/plugins/visualizations/public/vis_types/react_vis_controller.tsx similarity index 74% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/react_vis_type.js rename to src/plugins/visualizations/public/vis_types/react_vis_controller.tsx index e2789ee612cd5..643e6ffcb730b 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/react_vis_type.js +++ b/src/plugins/visualizations/public/vis_types/react_vis_controller.tsx @@ -19,18 +19,19 @@ import React from 'react'; import { render, unmountComponentAtNode } from 'react-dom'; -import { getUISettings, getI18n } from '../services'; -import { BaseVisType } from './base_vis_type'; +import { Vis, VisualizationController } from '../types'; +import { getI18n, getUISettings } from '../services'; -class ReactVisController { - constructor(element, vis) { +export class ReactVisController implements VisualizationController { + private el: HTMLElement; + private vis: Vis; + + constructor(element: HTMLElement, vis: Vis) { this.el = element; this.vis = vis; } - render(visData, visParams, updateStatus) { - this.visData = visData; - + public render(visData: any, visParams: any): Promise { const I18nContext = getI18n().Context; return new Promise((resolve, reject) => { @@ -48,7 +49,6 @@ class ReactVisController { visData={visData} visParams={visParams} renderComplete={resolve} - updateStatus={updateStatus} /> , this.el @@ -56,20 +56,7 @@ class ReactVisController { }); } - destroy() { + public destroy() { unmountComponentAtNode(this.el); } } - -export class ReactVisType extends BaseVisType { - constructor(opts) { - super({ - ...opts, - visualization: ReactVisController, - }); - - if (!this.visConfig.component) { - throw new Error('Missing component for ReactVisType'); - } - } -} diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/__tests__/vis_types/react_vis_type.js b/src/plugins/visualizations/public/vis_types/react_vis_type.test.ts similarity index 55% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/__tests__/vis_types/react_vis_type.js rename to src/plugins/visualizations/public/vis_types/react_vis_type.test.ts index 2474a58870424..134106bb3d42a 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy/__tests__/vis_types/react_vis_type.js +++ b/src/plugins/visualizations/public/vis_types/react_vis_type.test.ts @@ -17,57 +17,30 @@ * under the License. */ -import expect from '@kbn/expect'; -import ngMock from 'ng_mock'; -import { ReactVisType } from '../../../vis_types/react_vis_type'; +import { cloneDeep } from 'lodash'; +import { ReactVisType } from './react_vis_type'; -describe('React Vis Type', function() { +describe('React Vis Type', () => { const visConfig = { name: 'test', title: 'test', description: 'test', icon: 'test', visConfig: { component: 'test' }, - type: { visConfig: { component: 'test' } }, }; - beforeEach(ngMock.module('kibana')); - describe('initialization', () => { it('should throw if component is not set', () => { expect(() => { - new ReactVisType({}); - }).to.throwError(); + const missingConfig = cloneDeep(visConfig); + delete missingConfig.visConfig.component; + new ReactVisType(missingConfig); + }).toThrow(); }); it('creates react controller', () => { const visType = new ReactVisType(visConfig); - expect(visType.visualization).to.not.be.an('undefined'); - }); - }); - - describe('controller render method', () => { - let vis; - beforeEach(() => { - const visType = new ReactVisType(visConfig); - const Vis = visType.visualization; - - vis = new Vis(window.document.body, {}); - }); - - it('rejects if data is not provided', () => { - vis - .render() - .then(() => { - expect('promise was not rejected').to.equal(false); - }) - .catch(() => {}); - }); - - it('renders the component', () => { - expect(() => { - vis.render({}); - }).to.not.throwError(); + expect(visType.visualization).not.toBeUndefined(); }); }); }); diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy.ts b/src/plugins/visualizations/public/vis_types/react_vis_type.ts similarity index 65% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/legacy.ts rename to src/plugins/visualizations/public/vis_types/react_vis_type.ts index 216e523b07141..68979abe52a3c 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/legacy.ts +++ b/src/plugins/visualizations/public/vis_types/react_vis_type.ts @@ -17,12 +17,18 @@ * under the License. */ -// eslint-disable-next-line -import { npSetup, npStart } from 'ui/new_platform'; -import { PluginInitializerContext } from '../../../../../../core/public'; -import { plugin } from '.'; +import { BaseVisType, BaseVisTypeOptions } from './base_vis_type'; +import { ReactVisController } from './react_vis_controller'; -const pluginInstance = plugin({} as PluginInitializerContext); +export class ReactVisType extends BaseVisType { + constructor(opts: Omit) { + super({ + ...opts, + visualization: ReactVisController, + }); -export const setup = pluginInstance.setup(npSetup.core, npSetup.plugins); -export const start = pluginInstance.start(npStart.core, npStart.plugins); + if (!this.visConfig.component) { + throw new Error('Missing component for ReactVisType'); + } + } +} diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/types_service.ts b/src/plugins/visualizations/public/vis_types/types_service.ts similarity index 98% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/types_service.ts rename to src/plugins/visualizations/public/vis_types/types_service.ts index 6bcaa9a3e1dac..321f96180fd68 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/types_service.ts +++ b/src/plugins/visualizations/public/vis_types/types_service.ts @@ -30,8 +30,8 @@ export interface VisType { description?: string; visualization: any; isAccessible?: boolean; - requestHandler: string; - responseHandler: string; + requestHandler: string | unknown; + responseHandler: string | unknown; icon?: IconType; image?: string; stage: 'experimental' | 'beta' | 'production'; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/vis_type_alias_registry.ts b/src/plugins/visualizations/public/vis_types/vis_type_alias_registry.ts similarity index 98% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/vis_type_alias_registry.ts rename to src/plugins/visualizations/public/vis_types/vis_type_alias_registry.ts index 12b02ee9e6b32..040fa22352a3a 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types/vis_type_alias_registry.ts +++ b/src/plugins/visualizations/public/vis_types/vis_type_alias_registry.ts @@ -17,7 +17,7 @@ * under the License. */ -interface VisualizationListItem { +export interface VisualizationListItem { editUrl: string; icon: string; id: string; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/__snapshots__/new_vis_modal.test.tsx.snap b/src/plugins/visualizations/public/wizard/__snapshots__/new_vis_modal.test.tsx.snap similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/__snapshots__/new_vis_modal.test.tsx.snap rename to src/plugins/visualizations/public/wizard/__snapshots__/new_vis_modal.test.tsx.snap diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/_dialog.scss b/src/plugins/visualizations/public/wizard/_dialog.scss similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/_dialog.scss rename to src/plugins/visualizations/public/wizard/_dialog.scss diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/_index.scss b/src/plugins/visualizations/public/wizard/_index.scss similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/_index.scss rename to src/plugins/visualizations/public/wizard/_index.scss diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/index.ts b/src/plugins/visualizations/public/wizard/index.ts similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/index.ts rename to src/plugins/visualizations/public/wizard/index.ts diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/new_vis_modal.test.tsx b/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx similarity index 99% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/new_vis_modal.test.tsx rename to src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx index 2712019e42609..5637aeafc6f14 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/new_vis_modal.test.tsx +++ b/src/plugins/visualizations/public/wizard/new_vis_modal.test.tsx @@ -21,7 +21,7 @@ import React from 'react'; import { mountWithIntl } from 'test_utils/enzyme_helpers'; import { TypesStart, VisType } from '../vis_types'; import { NewVisModal } from './new_vis_modal'; -import { SavedObjectsStart } from '../../../../../../../core/public'; +import { SavedObjectsStart } from '../../../../core/public'; describe('NewVisModal', () => { const { location } = window; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/new_vis_modal.tsx b/src/plugins/visualizations/public/wizard/new_vis_modal.tsx similarity index 97% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/new_vis_modal.tsx rename to src/plugins/visualizations/public/wizard/new_vis_modal.tsx index 7c10001eddb50..448077819bb8d 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/new_vis_modal.tsx +++ b/src/plugins/visualizations/public/wizard/new_vis_modal.tsx @@ -23,11 +23,11 @@ import { EuiModal, EuiOverlayMask } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { METRIC_TYPE, UiStatsMetricType } from '@kbn/analytics'; -import { IUiSettingsClient, SavedObjectsStart } from '../../../../../../../core/public'; +import { IUiSettingsClient, SavedObjectsStart } from '../../../../core/public'; import { SearchSelection } from './search_selection'; import { TypeSelection } from './type_selection'; import { TypesStart, VisType, VisTypeAlias } from '../vis_types'; -import { UsageCollectionSetup } from '../../../../../../../plugins/usage_collection/public'; +import { UsageCollectionSetup } from '../../../../plugins/usage_collection/public'; interface TypeSelectionProps { isOpen: boolean; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/search_selection/index.ts b/src/plugins/visualizations/public/wizard/search_selection/index.ts similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/search_selection/index.ts rename to src/plugins/visualizations/public/wizard/search_selection/index.ts diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/search_selection/search_selection.tsx b/src/plugins/visualizations/public/wizard/search_selection/search_selection.tsx similarity index 96% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/search_selection/search_selection.tsx rename to src/plugins/visualizations/public/wizard/search_selection/search_selection.tsx index f8eb191dd5f92..c9fb592d1f936 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/search_selection/search_selection.tsx +++ b/src/plugins/visualizations/public/wizard/search_selection/search_selection.tsx @@ -21,9 +21,9 @@ import { EuiModalBody, EuiModalHeader, EuiModalHeaderTitle } from '@elastic/eui' import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; -import { IUiSettingsClient, SavedObjectsStart } from '../../../../../../../../core/public'; +import { IUiSettingsClient, SavedObjectsStart } from '../../../../../core/public'; -import { SavedObjectFinderUi } from '../../../../../../../../plugins/saved_objects/public'; +import { SavedObjectFinderUi } from '../../../../../plugins/saved_objects/public'; import { VisType } from '../../vis_types'; interface SearchSelectionProps { diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/show_new_vis.tsx b/src/plugins/visualizations/public/wizard/show_new_vis.tsx similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/show_new_vis.tsx rename to src/plugins/visualizations/public/wizard/show_new_vis.tsx diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/type_selection/index.ts b/src/plugins/visualizations/public/wizard/type_selection/index.ts similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/type_selection/index.ts rename to src/plugins/visualizations/public/wizard/type_selection/index.ts diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/type_selection/new_vis_help.test.tsx b/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/type_selection/new_vis_help.test.tsx rename to src/plugins/visualizations/public/wizard/type_selection/new_vis_help.test.tsx diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/type_selection/new_vis_help.tsx b/src/plugins/visualizations/public/wizard/type_selection/new_vis_help.tsx similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/type_selection/new_vis_help.tsx rename to src/plugins/visualizations/public/wizard/type_selection/new_vis_help.tsx diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/type_selection/type_selection.tsx b/src/plugins/visualizations/public/wizard/type_selection/type_selection.tsx similarity index 98% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/type_selection/type_selection.tsx rename to src/plugins/visualizations/public/wizard/type_selection/type_selection.tsx index 81dcecfee2613..bb5037545cc82 100644 --- a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/type_selection/type_selection.tsx +++ b/src/plugins/visualizations/public/wizard/type_selection/type_selection.tsx @@ -35,8 +35,8 @@ import { EuiTitle, } from '@elastic/eui'; -import { memoizeLast } from '../../../../../../visualizations/public/np_ready/public/legacy/memoize'; -import { VisTypeAlias } from '../../../../../../visualizations/public'; +import { memoizeLast } from '../../legacy/memoize'; +import { VisTypeAlias } from '../../vis_types/vis_type_alias_registry'; import { NewVisHelp } from './new_vis_help'; import { VisHelpText } from './vis_help_text'; import { VisTypeIcon } from './vis_type_icon'; diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/type_selection/vis_help_text.tsx b/src/plugins/visualizations/public/wizard/type_selection/vis_help_text.tsx similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/type_selection/vis_help_text.tsx rename to src/plugins/visualizations/public/wizard/type_selection/vis_help_text.tsx diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/type_selection/vis_type_icon.tsx b/src/plugins/visualizations/public/wizard/type_selection/vis_type_icon.tsx similarity index 100% rename from src/legacy/core_plugins/visualizations/public/np_ready/public/wizard/type_selection/vis_type_icon.tsx rename to src/plugins/visualizations/public/wizard/type_selection/vis_type_icon.tsx 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 643d15c982792..7aa12ea7a1130 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 @@ -20,9 +20,9 @@ import { SelfChangingEditor } from './self_changing_editor'; import { SelfChangingComponent } from './self_changing_components'; -import { setup as visualizations } from '../../../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/legacy'; +import { npSetup } from '../../../../../../src/legacy/ui/public/new_platform'; -visualizations.createReactVisualization({ +npSetup.plugins.visualizations.createReactVisualization({ name: 'self_changing_vis', title: 'Self Changing Vis', icon: 'controlsHorizontal', diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/expression_types/embeddable_types.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/expression_types/embeddable_types.ts index 6bc4b5ec1c840..f5836fe91e040 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/expression_types/embeddable_types.ts +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/expression_types/embeddable_types.ts @@ -5,7 +5,7 @@ */ import { MAP_SAVED_OBJECT_TYPE } from '../../../../../plugins/maps/public'; -import { VISUALIZE_EMBEDDABLE_TYPE } from '../../../../../../src/legacy/core_plugins/visualizations/public'; +import { VISUALIZE_EMBEDDABLE_TYPE } from '../../../../../../src/plugins/visualizations/public'; import { LENS_EMBEDDABLE_TYPE } from '../../../../../plugins/lens/common/constants'; import { SEARCH_EMBEDDABLE_TYPE } from '../../../../../../src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/constants'; diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/saved_visualization.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/saved_visualization.ts index e6603c3d0d997..26243980ee07a 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/saved_visualization.ts +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/saved_visualization.ts @@ -5,7 +5,7 @@ */ import { ExpressionFunctionDefinition } from 'src/plugins/expressions'; -import { VisualizeInput } from 'src/legacy/core_plugins/visualizations/public'; +import { VisualizeInput } from 'src/plugins/visualizations/public'; import { EmbeddableTypes, EmbeddableExpressionType, diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/renderers/embeddable/input_type_to_expression/visualization.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/renderers/embeddable/input_type_to_expression/visualization.ts index be0dd6a79292f..4c8de2afd81ad 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/renderers/embeddable/input_type_to_expression/visualization.ts +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/renderers/embeddable/input_type_to_expression/visualization.ts @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { VisualizeInput } from 'src/legacy/core_plugins/visualizations/public'; +import { VisualizeInput } from 'src/plugins/visualizations/public'; export function toExpression(input: VisualizeInput): string { const expressionParts = [] as string[]; diff --git a/x-pack/legacy/plugins/lens/public/editor_frame_service/embeddable/embeddable.tsx b/x-pack/legacy/plugins/lens/public/editor_frame_service/embeddable/embeddable.tsx index d18174baacdb9..c2ab1c72af545 100644 --- a/x-pack/legacy/plugins/lens/public/editor_frame_service/embeddable/embeddable.tsx +++ b/x-pack/legacy/plugins/lens/public/editor_frame_service/embeddable/embeddable.tsx @@ -17,7 +17,7 @@ import { import { Subscription } from 'rxjs'; import { ReactExpressionRendererType } from '../../../../../../../src/plugins/expressions/public'; -import { VIS_EVENT_TO_TRIGGER } from '../../../../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/events'; +import { VIS_EVENT_TO_TRIGGER } from '../../../../../../../src/plugins/visualizations/public'; import { Embeddable as AbstractEmbeddable, diff --git a/x-pack/legacy/plugins/lens/public/legacy_imports.ts b/x-pack/legacy/plugins/lens/public/legacy_imports.ts index d53842d209e2b..5c5afc1a87df0 100644 --- a/x-pack/legacy/plugins/lens/public/legacy_imports.ts +++ b/x-pack/legacy/plugins/lens/public/legacy_imports.ts @@ -4,5 +4,6 @@ * you may not use this file except in compliance with the Elastic License. */ -export { setup as visualizations } from '../../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/legacy'; -export { VisualizationsSetup } from '../../../../../src/legacy/core_plugins/visualizations/public'; +import { npSetup } from 'ui/new_platform'; +export const { visualizations } = npSetup.plugins; +export { VisualizationsSetup } from '../../../../../src/plugins/visualizations/public'; diff --git a/x-pack/legacy/plugins/lens/public/vis_type_alias.ts b/x-pack/legacy/plugins/lens/public/vis_type_alias.ts index c4e0a20110c81..123b994e6ccce 100644 --- a/x-pack/legacy/plugins/lens/public/vis_type_alias.ts +++ b/x-pack/legacy/plugins/lens/public/vis_type_alias.ts @@ -5,8 +5,8 @@ */ import { i18n } from '@kbn/i18n'; +import { VisTypeAlias } from 'src/plugins/visualizations/public'; import { getBasePath, getEditPath } from '../../../../plugins/lens/common'; -import { VisTypeAlias } from '../../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/vis_types'; export const getLensAliasConfig = (): VisTypeAlias => ({ aliasUrl: getBasePath(), diff --git a/x-pack/legacy/plugins/lens/public/xy_visualization/xy_expression.tsx b/x-pack/legacy/plugins/lens/public/xy_visualization/xy_expression.tsx index e059cb2ab5ad5..a7d4b2a217f37 100644 --- a/x-pack/legacy/plugins/lens/public/xy_visualization/xy_expression.tsx +++ b/x-pack/legacy/plugins/lens/public/xy_visualization/xy_expression.tsx @@ -29,7 +29,7 @@ import { EuiIcon, EuiText, IconType, EuiSpacer } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; import { EmbeddableVisTriggerContext } from '../../../../../../src/plugins/embeddable/public'; -import { VIS_EVENT_TO_TRIGGER } from '../../../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/embeddable/events'; +import { VIS_EVENT_TO_TRIGGER } from '../../../../../../src/plugins/visualizations/public'; import { LensMultiTable, FormatFactory } from '../types'; import { XYArgs, SeriesType, visualizationTypes } from './types'; import { VisualizationContainer } from '../visualization_container'; 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 4d87b6a055802..64a42173098ee 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 @@ -5,7 +5,7 @@ */ import chrome from 'ui/chrome'; -import { setup as visualizationsSetup } from '../../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/legacy'; +import { npSetup } from '../../../../../src/legacy/ui/public/new_platform'; import { i18n } from '@kbn/i18n'; import { APP_ID, APP_ICON, MAP_BASE_URL } from '../common/constants'; @@ -23,7 +23,7 @@ The Maps app offers more functionality and is easier to use.`, } ); -visualizationsSetup.registerAlias({ +npSetup.plugins.visualizations.registerAlias({ aliasUrl: MAP_BASE_URL, name: APP_ID, title: i18n.translate('xpack.maps.visTypeAlias.title', { @@ -37,5 +37,5 @@ visualizationsSetup.registerAlias({ }); if (!showMapVisualizationTypes) { - visualizationsSetup.hideTypes(['region_map', 'tile_map']); + npSetup.plugins.visualizations.hideTypes(['region_map', 'tile_map']); }