Skip to content

Commit

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

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

* 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

* Fix remaining merge issues
  • Loading branch information
Aaron Caldwell authored Mar 4, 2020
1 parent 0522b39 commit a967cbc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 43 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: 10 additions & 5 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,12 +20,19 @@ 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) {
const {
__LEGACY: { uiModules },
np: { licensing },
np,
} = plugins;

uiModules
Expand All @@ -34,9 +41,7 @@ export class MapsPlugin implements Plugin<MapsPluginSetup, MapsPluginStart> {
return reactDirective(wrapInI18nContext(MapListing));
});

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

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

0 comments on commit a967cbc

Please sign in to comment.