Skip to content

Commit

Permalink
Update flow for initializing indexPatternServices while in this file
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Caldwell committed Dec 13, 2019
1 parent 0d90459 commit 022f7dd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 5 additions & 2 deletions x-pack/legacy/plugins/maps/public/kibana_services.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@

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

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

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

export let indexPatternService;
export const initServicesAndConstants = ({ indexPatterns }) => {
indexPatternService = indexPatterns;
};

export async function fetchSearchSourceAndRecordWithInspector({
searchSource,
requestId,
Expand Down
8 changes: 6 additions & 2 deletions x-pack/legacy/plugins/maps/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { wrapInI18nContext } from 'ui/i18n';
// @ts-ignore
import { MapListing } from './components/map_listing';
// @ts-ignore
import { setLicenseId } from './kibana_services';
import { setLicenseId, initServicesAndConstants } from './kibana_services';

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

public start(core: CoreStart, plugins: any) {}
public start(core: CoreStart, plugins: any) {
initServicesAndConstants({
indexPatterns: plugins.np.data.indexPatterns,
});
}
}

0 comments on commit 022f7dd

Please sign in to comment.