Skip to content

Commit

Permalink
Use NP data query service
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Caldwell committed Apr 28, 2020
1 parent 0d6e078 commit 99efbbf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/legacy/core_plugins/tile_map/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { createTileMapFn } from './tile_map_fn';
import { createTileMapTypeDefinition } from './tile_map_type';
import { getBaseMapsVis, MapsLegacyPluginSetup } from '../../../../plugins/maps_legacy/public';
import { DataPublicPluginStart } from '../../../../plugins/data/public';
import { setFormatService } from './services';
import { setFormatService, setQueryService } from './services';

/** @private */
interface TileMapVisualizationDependencies {
Expand Down Expand Up @@ -83,5 +83,6 @@ export class TileMapPlugin implements Plugin<Promise<void>, void> {

public start(core: CoreStart, { data }: TileMapPluginStartDependencies) {
setFormatService(data.fieldFormats);
setQueryService(data.query);
}
}
4 changes: 4 additions & 0 deletions src/legacy/core_plugins/tile_map/public/services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ import { DataPublicPluginStart } from '../../../../plugins/data/public';
export const [getFormatService, setFormatService] = createGetterSetter<
DataPublicPluginStart['fieldFormats']
>('vislib data.fieldFormats');

export const [getQueryService, setQueryService] = createGetterSetter<
DataPublicPluginStart['query']
>('Query');
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@

import { get } from 'lodash';
import { GeohashLayer } from './geohash_layer';
import { npStart } from 'ui/new_platform';
import { getFormatService } from './services';
import { getFormatService, getQueryService } from './services';
import {
scaleBounds,
geoContains,
Expand Down Expand Up @@ -215,7 +214,7 @@ export const createTileMapVisualization = dependencies => {
filter[filterName] = { ignore_unmapped: true };
filter[filterName][field] = filterData;

const { filterManager } = npStart.plugins.data.query;
const { filterManager } = getQueryService();
filterManager.addFilters([filter]);

this.vis.updateState();
Expand Down

0 comments on commit 99efbbf

Please sign in to comment.