Skip to content

Commit

Permalink
Removed visualizations from index.ts and call setup directly from leg…
Browse files Browse the repository at this point in the history
…acy.ts
  • Loading branch information
sainthkh committed Sep 4, 2019
1 parent e9d8d6e commit 2d879d9
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { SavedObjectsClientProvider } from 'ui/saved_objects';
import { VisualizeListingTable } from './visualize_listing_table';
import { NewVisModal } from '../wizard/new_vis_modal';
import { VisualizeConstants } from '../visualize_constants';
import { visualizations } from '../../../../visualizations/public/np_ready/public';
import { setup } from '../../../../visualizations/public/np_ready/public/legacy';
import { i18n } from '@kbn/i18n';

const app = uiModules.get('app/visualize', ['ngRoute', 'react']);
Expand All @@ -46,7 +46,7 @@ export function VisualizeListingController($injector, createNewVis) {
const savedObjectClient = Private(SavedObjectsClientProvider);

this.visTypeRegistry = Private(VisTypesRegistryProvider);
this.visTypeAliases = visualizations.types.visTypeAliasRegistry.get();
this.visTypeAliases = setup.types.visTypeAliasRegistry.get();

timefilter.disableAutoRefreshSelector();
timefilter.disableTimeRangeSelector();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { VisTypesRegistryProvider } from 'ui/registry/vis_types';
import { uiModules } from 'ui/modules';
import { SavedObjectLoader, SavedObjectsClientProvider } from 'ui/saved_objects';
import { savedObjectManagementRegistry } from '../../management/saved_object_registry';
import { visualizations } from '../../../../visualizations/public/np_ready/public';
import { setup } from '../../../../visualizations/public/np_ready/public/legacy';
import { createVisualizeEditUrl } from '../visualize_constants';
import { findListItems } from './find_list_items';

Expand Down Expand Up @@ -86,7 +86,7 @@ app.service('savedVisualizations', function (SavedVis, Private, kbnUrl, chrome)
size,
mapSavedObjectApiHits: this.mapSavedObjectApiHits.bind(this),
savedObjectsClient: this.savedObjectsClient,
visTypes: visualizations.types.visTypeAliasRegistry.get(),
visTypes: setup.types.visTypeAliasRegistry.get(),
});
};

Expand Down
4 changes: 2 additions & 2 deletions src/legacy/core_plugins/metrics/public/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import { PluginInitializerContext } from 'kibana/public';
import { npSetup, npStart } from 'ui/new_platform';

import { visualizations } from '../../visualizations/public/np_ready/public';
import { setup as setupVisualizations } from '../../visualizations/public/np_ready/public/legacy';
import { MetricsPluginSetupDependencies } from './plugin';
import { plugin } from '.';

const plugins: Readonly<MetricsPluginSetupDependencies> = {
visualizations,
visualizations: setupVisualizations,
data: npSetup.plugins.data,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import afterdatachangePng from './afterdatachange.png';
import afterdatachangeandresizePng from './afterdatachangeandresize.png';
import aftercolorchangePng from './aftercolorchange.png';
import changestartupPng from './changestartup.png';
import { visualizations } from '../../../visualizations/public/np_ready/public';
import { setup } from '../../../visualizations/public/np_ready/public/legacy';

import { createRegionMapVisualization } from '../region_map_visualization';
import { createRegionMapTypeDefinition } from '../region_map_type';
Expand Down Expand Up @@ -106,7 +106,7 @@ describe('RegionMapsVisualizationTests', function () {
uiSettings,
};

visualizations.types.registerVisualization(() => createRegionMapTypeDefinition(dependencies));
setup.types.registerVisualization(() => createRegionMapTypeDefinition(dependencies));

Vis = Private(visModule.VisProvider);
RegionMapsVisualization = createRegionMapVisualization(dependencies);
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/core_plugins/region_map/public/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { PluginInitializerContext } from 'kibana/public';
import { npSetup, npStart } from 'ui/new_platform';

import { visualizations } from '../../visualizations/public/np_ready/public';
import { setup as setupVisualizations } from '../../visualizations/public/np_ready/public/legacy';
import { RegionMapPluginSetupDependencies, RegionMapsConfig } from './plugin';
import { LegacyDependenciesPlugin } from './shim';
import { plugin } from '.';
Expand All @@ -30,7 +30,7 @@ const regionmapsConfig = npSetup.core.injectedMetadata.getInjectedVar(
) as RegionMapsConfig;

const plugins: Readonly<RegionMapPluginSetupDependencies> = {
visualizations,
visualizations: setupVisualizations,
data: npSetup.plugins.data,

// Temporary solution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ 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 { visualizations } from '../../../visualizations/public/np_ready/public';
import { setup } from '../../../visualizations/public/np_ready/public/legacy';

import { createTileMapVisualization } from '../tile_map_visualization';
import { createTileMapTypeDefinition } from '../tile_map_type';
Expand Down Expand Up @@ -84,7 +84,7 @@ describe('CoordinateMapsVisualizationTest', function () {
$injector,
};

visualizations.types.registerVisualization(() => createTileMapTypeDefinition(dependencies));
setup.types.registerVisualization(() => createTileMapTypeDefinition(dependencies));

Vis = Private(visModule.VisProvider);
CoordinateMapsVisualization = createTileMapVisualization(dependencies);
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/core_plugins/tile_map/public/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
import { PluginInitializerContext } from 'kibana/public';
import { npSetup, npStart } from 'ui/new_platform';

import { visualizations } from '../../visualizations/public/np_ready/public';
import { setup as setupVisualizations } from '../../visualizations/public/np_ready/public/legacy';
import { TileMapPluginSetupDependencies } from './plugin';
import { LegacyDependenciesPlugin } from './shim';
import { plugin } from '.';

const plugins: Readonly<TileMapPluginSetupDependencies> = {
visualizations,
visualizations: setupVisualizations,
data: npSetup.plugins.data,

// Temporary solution
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/core_plugins/vis_type_markdown/public/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import { PluginInitializerContext } from 'kibana/public';
import { npSetup, npStart } from 'ui/new_platform';

import { visualizations } from '../../visualizations/public/np_ready/public';
import { setup as setupVisualizations } from '../../visualizations/public/np_ready/public/legacy';
import { MarkdownPluginSetupDependencies } from './plugin';
import { plugin } from '.';

const plugins: Readonly<MarkdownPluginSetupDependencies> = {
visualizations,
visualizations: setupVisualizations,
data: npSetup.plugins.data,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import expect from '@kbn/expect';
import { VisProvider } from 'ui/vis';
import LogstashIndexPatternStubProvider from 'fixtures/stubbed_logstash_index_pattern';

import { visualizations } from '../../../visualizations/public/np_ready/public';
import { setup as setupVisualizations } from '../../../visualizations/public/np_ready/public/legacy';
import { createMetricVisTypeDefinition } from '../metric_vis_type';

describe('metric_vis - createMetricVisTypeDefinition', () => {
Expand All @@ -38,7 +38,7 @@ describe('metric_vis - createMetricVisTypeDefinition', () => {
const Vis = Private(VisProvider);
const metricVisType = createMetricVisTypeDefinition();

visualizations.types.registerVisualization(() => metricVisType);
setupVisualizations.types.registerVisualization(() => metricVisType);

const indexPattern = Private(LogstashIndexPatternStubProvider);

Expand Down
4 changes: 2 additions & 2 deletions src/legacy/core_plugins/vis_type_metric/public/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
import { PluginInitializerContext } from 'kibana/public';
import { npSetup, npStart } from 'ui/new_platform';

import { visualizations } from '../../visualizations/public/np_ready/public';
import { setup as setupVisualizations } from '../../visualizations/public/np_ready/public/legacy';
import { MetricVisPluginSetupDependencies } from './plugin';
import { LegacyDependenciesPlugin } from './shim';
import { plugin } from '.';

const plugins: Readonly<MetricVisPluginSetupDependencies> = {
visualizations,
visualizations: setupVisualizations,
data: npSetup.plugins.data,

// Temporary solution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { AppStateProvider } from 'ui/state_management/app_state';
import { tabifyAggResponse } from 'ui/agg_response/tabify';

import { createTableVisTypeDefinition } from '../table_vis_type';
import { visualizations } from '../../../visualizations/public/np_ready/public';
import { setup as setupVisualizations } from '../../../visualizations/public/np_ready/public/legacy';

describe('Table Vis - Controller', async function () {
let $rootScope;
Expand All @@ -52,7 +52,7 @@ describe('Table Vis - Controller', async function () {
createAngularVisualization: VisFactoryProvider(Private).createAngularVisualization,
};

visualizations.types.registerVisualization(() =>
setupVisualizations.types.registerVisualization(() =>
createTableVisTypeDefinition(legacyDependencies)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { round } from 'lodash';

import { VisFactoryProvider } from 'ui/vis/vis_factory';
import { createTableVisTypeDefinition } from '../../table_vis_type';
import { visualizations } from '../../../../visualizations/public/np_ready/public';
import { setup } from '../../../../visualizations/public/np_ready/public/legacy';

describe('Table Vis - AggTable Directive', function () {
let $rootScope;
Expand Down Expand Up @@ -107,9 +107,7 @@ describe('Table Vis - AggTable Directive', function () {
createAngularVisualization: VisFactoryProvider(Private).createAngularVisualization,
};

visualizations.types.registerVisualization(() =>
createTableVisTypeDefinition(legacyDependencies)
);
setup.types.registerVisualization(() => createTableVisTypeDefinition(legacyDependencies));

tableAggResponse = legacyResponseHandlerProvider().handler;
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { tabifyAggResponse } from 'ui/agg_response/tabify';

import { VisFactoryProvider } from 'ui/vis/vis_factory';
import { createTableVisTypeDefinition } from '../../table_vis_type';
import { visualizations } from '../../../../visualizations/public/np_ready/public';
import { setup } from '../../../../visualizations/public/np_ready/public/legacy';

describe('Table Vis - AggTableGroup Directive', function () {
let $rootScope;
Expand Down Expand Up @@ -66,9 +66,7 @@ describe('Table Vis - AggTableGroup Directive', function () {
createAngularVisualization: VisFactoryProvider(Private).createAngularVisualization,
};

visualizations.types.registerVisualization(() =>
createTableVisTypeDefinition(legacyDependencies)
);
setup.types.registerVisualization(() => createTableVisTypeDefinition(legacyDependencies));

tableAggResponse = legacyResponseHandlerProvider().handler;
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/core_plugins/vis_type_table/public/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import { npSetup, npStart } from 'ui/new_platform';
import { plugin } from '.';

import { TablePluginSetupDependencies } from './plugin';
import { visualizations } from '../../visualizations/public/np_ready/public';
import { setup as setupVisualizations } from '../../visualizations/public/np_ready/public/legacy';
import { LegacyDependenciesPlugin } from './shim';

const plugins: Readonly<TablePluginSetupDependencies> = {
visualizations,
visualizations: setupVisualizations,
data: npSetup.plugins.data,

// Temporary solution
Expand Down
4 changes: 2 additions & 2 deletions src/legacy/core_plugins/vis_type_tagcloud/public/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import { PluginInitializerContext } from 'kibana/public';
import { npSetup, npStart } from 'ui/new_platform';

import { visualizations } from '../../visualizations/public/np_ready/public';
import { setup as setupVisualizations } from '../../visualizations/public/np_ready/public/legacy';
import { TagCloudPluginSetupDependencies } from './plugin';
import { plugin } from '.';

const plugins: Readonly<TagCloudPluginSetupDependencies> = {
visualizations,
visualizations: setupVisualizations,
data: npSetup.plugins.data,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import vegaMapImage256 from './vega_map_image_256.png';
import { VegaParser } from '../data_model/vega_parser';
import { SearchCache } from '../data_model/search_cache';

import { visualizations } from '../../../visualizations/public/np_ready/public';
import { setup } from '../../../visualizations/public/np_ready/public/legacy';
import { createVegaTypeDefinition } from '../vega_type';

const THRESHOLD = 0.1;
Expand All @@ -65,7 +65,7 @@ describe('VegaVisualizations', () => {
uiSettings: $injector.get('config'),
};

visualizations.types.registerVisualization(() =>
setup.types.registerVisualization(() =>
createVegaTypeDefinition(vegaVisualizationDependencies)
);

Expand Down
4 changes: 2 additions & 2 deletions src/legacy/core_plugins/vis_type_vega/public/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
import { PluginInitializerContext } from 'kibana/public';
import { npSetup, npStart } from 'ui/new_platform';

import { visualizations } from '../../visualizations/public/np_ready/public';
import { setup as setupVisualizations } from '../../visualizations/public/np_ready/public/legacy';
import { VegaPluginSetupDependencies } from './plugin';
import { LegacyDependenciesPlugin } from './shim';
import { plugin } from '.';

const plugins: Readonly<VegaPluginSetupDependencies> = {
visualizations,
visualizations: setupVisualizations,
data: npSetup.plugins.data,

// Temporary solution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,6 @@

import { PluginInitializerContext } from 'src/core/public';
import { VisualizationsPublicPlugin, Setup } from './plugin';
import { setup } from './legacy';

/**
* We export visualizations here so that users importing from 'plugins/visualizations'
* will automatically receive the response value of the `setup` contract, mimicking
* the data that will eventually be injected by the new platform.
*/
export const visualizations = setup;

/** @public */
export type VisualizationsSetup = Setup;
Expand Down
4 changes: 2 additions & 2 deletions x-pack/legacy/plugins/maps/public/register_vis_type_alias.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { visualizations } from '../../../../../src/legacy/core_plugins/visualizations/public/np_ready/public';
import { setup } from '../../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/legacy';
import { i18n } from '@kbn/i18n';
import { APP_ID, APP_ICON, MAP_BASE_URL } from '../common/constants';

visualizations.types.visTypeAliasRegistry.add({
setup.types.visTypeAliasRegistry.add({
aliasUrl: MAP_BASE_URL,
name: APP_ID,
title: i18n.translate('xpack.maps.visTypeAlias.title', {
Expand Down

0 comments on commit 2d879d9

Please sign in to comment.