From 82e560bad17213c50325667257a33ab72358c9db Mon Sep 17 00:00:00 2001 From: Aaron Caldwell Date: Fri, 21 Dec 2018 07:22:25 -0700 Subject: [PATCH] Confirm GIS app enabled and wait until license info enabled before passing license info through to maps app (#27607) # Conflicts: # x-pack/plugins/gis/server/routes.js --- x-pack/plugins/gis/index.js | 44 ++++++++++++++--------------- x-pack/plugins/gis/server/routes.js | 3 -- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/x-pack/plugins/gis/index.js b/x-pack/plugins/gis/index.js index 566782793664e..64b5fc24005b8 100644 --- a/x-pack/plugins/gis/index.js +++ b/x-pack/plugins/gis/index.js @@ -42,31 +42,31 @@ export function gis(kibana) { }, init(server) { - const thisPlugin = this; - const xpackMainPlugin = server.plugins.xpack_main; + const gisEnabled = server.config().get('xpack.gis.enabled'); - watchStatusAndLicenseToInitialize(xpackMainPlugin, thisPlugin, - async license => { - if (license) { - if (license.gis) { - // TODO: Replace with content to 'activate' app on license verify - console.info('Valid GIS License'); - } else { - console.warn('No GIS for YOU!'); + if (gisEnabled) { + const thisPlugin = this; + const xpackMainPlugin = server.plugins.xpack_main; + + watchStatusAndLicenseToInitialize(xpackMainPlugin, thisPlugin, + async license => { + if (license && license.gis) { + initRoutes(server); } - return license; - } - }); - xpackMainPlugin.info - .feature(thisPlugin.id) - .registerLicenseCheckResultsGenerator(checkLicense); + }); - initRoutes(server); - server.registerSampleDataset(kySaltTrucksSpecProvider); - server.addSavedObjectsToSampleDataset('logs', webLogsSavedObjects); - server.injectUiAppVars('gis', async () => { - return await server.getInjectedUiAppVars('kibana'); - }); + xpackMainPlugin.info + .feature(thisPlugin.id) + .registerLicenseCheckResultsGenerator(checkLicense); + + server.registerSampleDataset(kySaltTrucksSpecProvider); + server.addSavedObjectsToSampleDataset('logs', webLogsSavedObjects); + server.injectUiAppVars('gis', async () => { + return await server.getInjectedUiAppVars('kibana'); + }); + } else { + server.log(['info', 'maps'], 'Maps app disabled by configuration'); + } } }); } diff --git a/x-pack/plugins/gis/server/routes.js b/x-pack/plugins/gis/server/routes.js index e2e2cc41c0bed..508c60be5e05c 100644 --- a/x-pack/plugins/gis/server/routes.js +++ b/x-pack/plugins/gis/server/routes.js @@ -114,6 +114,3 @@ export function initRoutes(server) { return { fileLayers, tmsServices }; } } - - -