Skip to content

Commit

Permalink
Set license in maps_legacy via new plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Caldwell committed Apr 14, 2020
1 parent e0dc9a1 commit 71c76cc
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/plugins/maps_legacy/public/map/service_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ export class ServiceSettings {
return origin === ORIGIN.EMS && this._showZoomMessage;
}

enableZoomMessage() {
this._showZoomMessage = true;
}

disableZoomMessage() {
this._showZoomMessage = false;
}
Expand Down
2 changes: 0 additions & 2 deletions x-pack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { graph } from './legacy/plugins/graph';
import { monitoring } from './legacy/plugins/monitoring';
import { reporting } from './legacy/plugins/reporting';
import { security } from './legacy/plugins/security';
import { tilemap } from './legacy/plugins/tilemap';
import { dashboardMode } from './legacy/plugins/dashboard_mode';
import { logstash } from './legacy/plugins/logstash';
import { beats } from './legacy/plugins/beats_management';
Expand Down Expand Up @@ -41,7 +40,6 @@ module.exports = function(kibana) {
reporting(kibana),
spaces(kibana),
security(kibana),
tilemap(kibana),
dashboardMode(kibana),
logstash(kibana),
beats(kibana),
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/maps_legacy_licensing/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "mapsLegacyLicensing",
"version": "8.0.0",
"kibanaVersion": "kibana",
"server": true,
"server": false,
"ui": true,
"requiredPlugins": ["licensing", "maps_legacy"]
"requiredPlugins": ["licensing", "mapsLegacy"]
}
20 changes: 18 additions & 2 deletions x-pack/plugins/maps_legacy_licensing/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

// @ts-ignore
import { CoreSetup, CoreStart, Plugin } from 'kibana/server';
import { CoreSetup, CoreStart, Plugin } from 'kibana/public';

/**
* These are the interfaces with your public contracts. You should export these
Expand All @@ -23,7 +23,23 @@ export type MapsLegacyLicensingStart = ReturnType<MapsLegacyLicensing['start']>;

export class MapsLegacyLicensing
implements Plugin<MapsLegacyLicensingSetup, MapsLegacyLicensingStart> {
public setup(core: CoreSetup, plugins: MapsLegacyLicensingSetupDependencies) {}
public setup(core: CoreSetup, plugins: MapsLegacyLicensingSetupDependencies) {
const {
licensing,
mapsLegacy: { serviceSettings },
} = plugins;
if (licensing) {
licensing.license$.subscribe(({ uid, isActive }: { uid: string; isActive: boolean }) => {
if (isActive) {
serviceSettings.addQueryParams({ license: uid });
serviceSettings.disableZoomMessage();
} else {
serviceSettings.addQueryParams({ license: undefined });
serviceSettings.enableZoomMessage();
}
});
}
}

public start(core: CoreStart, plugins: MapsLegacyLicensingStartDependencies) {}
}

0 comments on commit 71c76cc

Please sign in to comment.