Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maps] Add missing license to requests in maps embeddables #59207

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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