Skip to content

Commit

Permalink
Use common service settings instance
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Caldwell committed Apr 27, 2020
1 parent ec10395 commit cc828ba
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/legacy/core_plugins/region_map/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class RegionMapPlugin implements Plugin<Promise<void>, void> {
uiSettings: core.uiSettings,
regionmapsConfig: core.injectedMetadata.getInjectedVar('regionmap') as RegionMapsConfig,
serviceSettings: mapsLegacy.serviceSettings,
BaseMapsVisualization: getBaseMapsVis(core),
BaseMapsVisualization: getBaseMapsVis(core, mapsLegacy.serviceSettings),
...(await __LEGACY.setup()),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import {
import { ServiceSettings } from '../../../../../plugins/maps_legacy/public/map/service_settings';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { setInjectedVarFunc } from '../../../../../plugins/maps_legacy/public/kibana_services';
import { getBaseMapsVis } from '../../../../../plugins/maps_legacy/public';

function mockRawData() {
const stack = [dummyESResponse];
Expand Down Expand Up @@ -114,15 +115,27 @@ describe('CoordinateMapsVisualizationTest', function() {
return 'not found';
}
});

const coreSetupMock = {
notifications: {
toasts: {},
},
uiSettings: {},
injectedMetadata: {
getInjectedVar: () => {},
},
};
const serviceSettings = new ServiceSettings();
const BaseMapsVisualization = getBaseMapsVis(coreSetupMock, serviceSettings);
const uiSettings = $injector.get('config');

dependencies = {
serviceSettings,
uiSettings,
$injector,
getPrecision,
getZoomPrecision,
getPrecision,
BaseMapsVisualization,
uiSettings,
serviceSettings,
};

visType = new BaseVisType(createTileMapTypeDefinition(dependencies));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import scaledCircleMarkersPng from './scaledCircleMarkers.png';
// import shadedCircleMarkersPng from './shadedCircleMarkers.png';
import { ImageComparator } from 'test_utils/image_comparator';
import GeoHashSampleData from './dummy_es_response.json';
import { KibanaMap } from '../../../../../plugins/maps_legacy/public';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { KibanaMap } from '../../../../../plugins/maps_legacy/public/map/kibana_map';

describe('geohash_layer', function() {
let domNode;
Expand Down
2 changes: 1 addition & 1 deletion src/legacy/core_plugins/tile_map/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class TileMapPlugin implements Plugin<Promise<void>, void> {
const visualizationDependencies: Readonly<TileMapVisualizationDependencies> = {
getZoomPrecision,
getPrecision,
BaseMapsVisualization: getBaseMapsVis(core),
BaseMapsVisualization: getBaseMapsVis(core, mapsLegacy.serviceSettings),
uiSettings: core.uiSettings,
...(await __LEGACY.setup()),
};
Expand Down
5 changes: 1 addition & 4 deletions src/plugins/maps_legacy/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ import {
TmsLayer,
IServiceSettings,
} from './map/service_settings';
// @ts-ignore
import { ServiceSettings } from './map/service_settings';

export function plugin() {
return new MapsLegacyPlugin();
Expand Down Expand Up @@ -69,9 +67,8 @@ export function getKibanaMapFactoryProvider(core: CoreSetup) {
return (...args: any) => new KibanaMap(...args);
}

export function getBaseMapsVis(core: CoreSetup) {
export function getBaseMapsVis(core: CoreSetup, serviceSettings: IServiceSettings) {
const getKibanaMap = getKibanaMapFactoryProvider(core);
const serviceSettings = new ServiceSettings();
return new BaseMapsVisualizationProvider(getKibanaMap, serviceSettings);
}

Expand Down

0 comments on commit cc828ba

Please sign in to comment.