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

Migrate legacy maps licensing (x-pack/tilemap) to NP #63539

Merged
merged 12 commits into from
Apr 17, 2020
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
31 changes: 0 additions & 31 deletions x-pack/legacy/plugins/tilemap/index.js

This file was deleted.

This file was deleted.

This file was deleted.

32 changes: 0 additions & 32 deletions x-pack/legacy/plugins/tilemap/server/lib/inspect_settings.js

This file was deleted.

8 changes: 8 additions & 0 deletions x-pack/plugins/maps_legacy_licensing/kibana.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "mapsLegacyLicensing",
"version": "8.0.0",
"kibanaVersion": "kibana",
"server": false,
"ui": true,
"requiredPlugins": ["licensing", "mapsLegacy"]
}
11 changes: 11 additions & 0 deletions x-pack/plugins/maps_legacy_licensing/public/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { MapsLegacyLicensing } from './plugin';

export function plugin() {
return new MapsLegacyLicensing();
}
45 changes: 45 additions & 0 deletions x-pack/plugins/maps_legacy_licensing/public/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

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

/**
* These are the interfaces with your public contracts. You should export these
* for other plugins to use in _their_ `SetupDeps`/`StartDeps` interfaces.
* @public
*/

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface MapsLegacyLicensingSetupDependencies {}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface MapsLegacyLicensingStartDependencies {}

export type MapsLegacyLicensingSetup = ReturnType<MapsLegacyLicensing['setup']>;
export type MapsLegacyLicensingStart = ReturnType<MapsLegacyLicensing['start']>;

export class MapsLegacyLicensing
implements Plugin<MapsLegacyLicensingSetup, MapsLegacyLicensingStart> {
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();
kindsun marked this conversation as resolved.
Show resolved Hide resolved
}
});
}
}

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