Skip to content

Commit

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

* 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 authored Mar 4, 2020
1 parent 20eeea2 commit 7f6ce76
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 47 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 @@ -23,6 +23,8 @@ import { getQueryableUniqueIndexPatternIds } from '../selectors/map_selectors';
import { getInitialLayers } from '../angular/get_initial_layers';
import { mergeInputWithSavedMap } from './merge_input_with_saved_map';
import '../angular/services/gis_map_saved_object_loader';
import { bindSetupCoreAndPlugins } from '../plugin';
import { npSetup } from 'ui/new_platform';

export class MapEmbeddableFactory extends EmbeddableFactory {
type = MAP_SAVED_OBJECT_TYPE;
Expand All @@ -37,6 +39,7 @@ export class MapEmbeddableFactory extends EmbeddableFactory {
getIconForSavedObject: () => APP_ICON,
},
});
bindSetupCoreAndPlugins(npSetup.core, npSetup.plugins);
}
isEditable() {
return capabilities.get().maps.save;
Expand Down
20 changes: 11 additions & 9 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 @@ -31,23 +31,25 @@ interface MapsPluginSetupDependencies {
};
}

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,
{ __LEGACY: { uiModules }, np: { licensing, home } }: MapsPluginSetupDependencies
) {
public setup(core: CoreSetup, { __LEGACY: { uiModules }, np }: MapsPluginSetupDependencies) {
uiModules
.get('app/maps', ['ngRoute', 'react'])
.directive('mapListing', function(reactDirective: any) {
return reactDirective(wrapInI18nContext(MapListing));
});

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

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

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

0 comments on commit 7f6ce76

Please sign in to comment.