Skip to content

Commit

Permalink
[Maps] Add missing license to requests in maps embeddables (elastic#5…
Browse files Browse the repository at this point in the history
…9207)

* Pull core service init out into separate function

* Call bind function from embeddable factory constructor

* Move inspector init back to start method. Remove old license check file

* Add TS types
  • Loading branch information
Aaron Caldwell committed Mar 4, 2020
1 parent 4f672d5 commit 77ca0a8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 42 deletions.
38 changes: 0 additions & 38 deletions x-pack/legacy/plugins/maps/check_license.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { getInitialLayers } from '../angular/get_initial_layers';
import { mergeInputWithSavedMap } from './merge_input_with_saved_map';
import '../angular/services/gis_map_saved_object_loader';
import 'ui/vis/map/service_settings';
import { bindSetupCoreAndPlugins } from '../plugin';
import { npSetup } from 'ui/new_platform';

export class MapEmbeddableFactory extends EmbeddableFactory {
type = MAP_SAVED_OBJECT_TYPE;
Expand All @@ -38,6 +40,7 @@ export class MapEmbeddableFactory extends EmbeddableFactory {
getIconForSavedObject: () => APP_ICON,
},
});
bindSetupCoreAndPlugins(npSetup.core, npSetup.plugins);
}
isEditable() {
return capabilities.get().maps.save;
Expand Down
15 changes: 11 additions & 4 deletions x-pack/legacy/plugins/maps/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { Plugin, CoreStart } from 'src/core/public';
import { Plugin, CoreStart, CoreSetup } from 'src/core/public';
// @ts-ignore
import { wrapInI18nContext } from 'ui/i18n';
// @ts-ignore
Expand All @@ -20,6 +20,13 @@ import { setLicenseId } from './kibana_services';
export type MapsPluginSetup = ReturnType<MapsPlugin['setup']>;
export type MapsPluginStart = ReturnType<MapsPlugin['start']>;

export const bindSetupCoreAndPlugins = (core: CoreSetup, plugins: any) => {
const { licensing } = plugins;
if (licensing) {
licensing.license$.subscribe(({ uid }: { uid: string }) => setLicenseId(uid));
}
};

/** @internal */
export class MapsPlugin implements Plugin<MapsPluginSetup, MapsPluginStart> {
public setup(core: any, plugins: any) {
Expand All @@ -34,9 +41,9 @@ export class MapsPlugin implements Plugin<MapsPluginSetup, MapsPluginStart> {
return reactDirective(wrapInI18nContext(MapListing));
});

if (licensing) {
licensing.license$.subscribe(({ uid }: { uid: string }) => setLicenseId(uid));
}
bindSetupCoreAndPlugins(core, np);

np.home.featureCatalogue.register(featureCatalogueEntry);
}

public start(core: CoreStart, plugins: any) {}
Expand Down

0 comments on commit 77ca0a8

Please sign in to comment.