Skip to content

Commit 022f7dd

Browse files
author
Aaron Caldwell
committed
Update flow for initializing indexPatternServices while in this file
1 parent 0d90459 commit 022f7dd

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

x-pack/legacy/plugins/maps/public/kibana_services.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@
66

77
import { getRequestInspectorStats, getResponseInspectorStats } from '../../../../../src/legacy/ui/public/courier';
88
import { esFilters } from '../../../../../src/plugins/data/public';
9-
import { npStart } from 'ui/new_platform';
109

1110
export const SPATIAL_FILTER_TYPE = esFilters.FILTERS.SPATIAL_FILTER;
1211
export { SearchSource } from '../../../../../src/legacy/ui/public/courier';
13-
export const indexPatternService = npStart.plugins.data.indexPatterns;
1412

1513
export const license = {};
1614
export const setLicenseId = latestLicenseId => license.id = latestLicenseId;
1715

16+
export let indexPatternService;
17+
export const initServicesAndConstants = ({ indexPatterns }) => {
18+
indexPatternService = indexPatterns;
19+
};
20+
1821
export async function fetchSearchSourceAndRecordWithInspector({
1922
searchSource,
2023
requestId,

x-pack/legacy/plugins/maps/public/plugin.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { wrapInI18nContext } from 'ui/i18n';
1010
// @ts-ignore
1111
import { MapListing } from './components/map_listing';
1212
// @ts-ignore
13-
import { setLicenseId } from './kibana_services';
13+
import { setLicenseId, initServicesAndConstants } from './kibana_services';
1414

1515
/**
1616
* These are the interfaces with your public contracts. You should export these
@@ -30,5 +30,9 @@ export class MapsPlugin implements Plugin<MapsPluginSetup, MapsPluginStart> {
3030
plugins.np.licensing.license$.subscribe(({ uid }: { uid: string }) => setLicenseId(uid));
3131
}
3232

33-
public start(core: CoreStart, plugins: any) {}
33+
public start(core: CoreStart, plugins: any) {
34+
initServicesAndConstants({
35+
indexPatterns: plugins.np.data.indexPatterns,
36+
});
37+
}
3438
}

0 commit comments

Comments
 (0)