From e0dc9a113cfa7551cabc02f279f8a4259e4cc81b Mon Sep 17 00:00:00 2001 From: Aaron Caldwell Date: Tue, 14 Apr 2020 16:23:38 -0600 Subject: [PATCH] Remove unused server-side licensing logic and old index --- x-pack/plugins/maps_legacy_licensing/index.js | 31 ---------------- .../update_tilemap_settings.js | 16 --------- .../server/lib/__tests__/inspect_settings.js | 36 ------------------- .../server/lib/inspect_settings.js | 32 ----------------- 4 files changed, 115 deletions(-) delete mode 100644 x-pack/plugins/maps_legacy_licensing/index.js delete mode 100644 x-pack/plugins/maps_legacy_licensing/public/vis_type_enhancers/update_tilemap_settings.js delete mode 100644 x-pack/plugins/maps_legacy_licensing/server/lib/__tests__/inspect_settings.js delete mode 100644 x-pack/plugins/maps_legacy_licensing/server/lib/inspect_settings.js diff --git a/x-pack/plugins/maps_legacy_licensing/index.js b/x-pack/plugins/maps_legacy_licensing/index.js deleted file mode 100644 index d4105519ee0a77..00000000000000 --- a/x-pack/plugins/maps_legacy_licensing/index.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 { mirrorPluginStatus } from '../../server/lib/mirror_plugin_status'; -import { inspectSettings } from './server/lib/inspect_settings'; -import { resolve } from 'path'; - -export const tilemap = kibana => { - return new kibana.Plugin({ - id: 'tilemap', - configPrefix: 'xpack.tilemap', - require: ['xpack_main', 'vis_type_vislib'], - publicDir: resolve(__dirname, 'public'), - uiExports: { - hacks: ['plugins/tilemap/vis_type_enhancers/update_tilemap_settings'], - }, - init: function(server) { - const thisPlugin = this; - const xpackMainPlugin = server.plugins.xpack_main; - mirrorPluginStatus(xpackMainPlugin, thisPlugin); - xpackMainPlugin.status.once('green', () => { - xpackMainPlugin.info - .feature(thisPlugin.id) - .registerLicenseCheckResultsGenerator(inspectSettings); - }); - }, - }); -}; diff --git a/x-pack/plugins/maps_legacy_licensing/public/vis_type_enhancers/update_tilemap_settings.js b/x-pack/plugins/maps_legacy_licensing/public/vis_type_enhancers/update_tilemap_settings.js deleted file mode 100644 index 294bc31e3893e9..00000000000000 --- a/x-pack/plugins/maps_legacy_licensing/public/vis_type_enhancers/update_tilemap_settings.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * 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 { xpackInfo } from 'plugins/xpack_main/services/xpack_info'; -import { npSetup } from 'ui/new_platform'; - -const tileMapPluginInfo = xpackInfo.get('features.tilemap'); - -if (tileMapPluginInfo && (tileMapPluginInfo.license.active || tileMapPluginInfo.license.valid)) { - const { serviceSettings } = npSetup.plugins.mapsLegacy; - serviceSettings.addQueryParams({ license: tileMapPluginInfo.license.uid }); - serviceSettings.disableZoomMessage(); -} diff --git a/x-pack/plugins/maps_legacy_licensing/server/lib/__tests__/inspect_settings.js b/x-pack/plugins/maps_legacy_licensing/server/lib/__tests__/inspect_settings.js deleted file mode 100644 index ce7987ee396b8d..00000000000000 --- a/x-pack/plugins/maps_legacy_licensing/server/lib/__tests__/inspect_settings.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 expect from '@kbn/expect'; -import { inspectSettings } from '../../../server/lib/inspect_settings'; - -describe('inspectSettings', function() { - it('should propagate x-pack info', function() { - const mockSettings = { - isAvailable: () => true, - license: { - getUid: () => 'foobar', - isActive: () => true, - isOneOf: () => true, - }, - }; - - const licenseInfo = inspectSettings(mockSettings); - expect(licenseInfo.license.uid).to.equal('foobar'); - expect(licenseInfo.license.active).to.equal(true); - expect(licenseInfo.license.valid).to.equal(true); - }); - - it('should break when unavailable info', function() { - const mockSettings = { - isAvailable: () => false, - }; - - const licenseInfo = inspectSettings(mockSettings); - expect(licenseInfo).to.have.property('message'); - expect(typeof licenseInfo.message === 'string').to.be.ok(); - }); -}); diff --git a/x-pack/plugins/maps_legacy_licensing/server/lib/inspect_settings.js b/x-pack/plugins/maps_legacy_licensing/server/lib/inspect_settings.js deleted file mode 100644 index cd6fb8bd8c1100..00000000000000 --- a/x-pack/plugins/maps_legacy_licensing/server/lib/inspect_settings.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - */ - -export function inspectSettings(xpackInfo) { - if (!xpackInfo || !xpackInfo.isAvailable()) { - return { - message: - 'You cannot use the Tilemap Plugin because license information is not available at this time.', - }; - } - - /** - *Propagate these settings to the client - */ - return { - license: { - uid: xpackInfo.license.getUid(), - active: xpackInfo.license.isActive(), - valid: xpackInfo.license.isOneOf([ - 'trial', - 'standard', - 'basic', - 'gold', - 'platinum', - 'enterprise', - ]), - }, - }; -}