diff --git a/x-pack/plugins/maps/index.js b/x-pack/plugins/maps/index.js index a6342975b797..1c6ecf951bf2 100644 --- a/x-pack/plugins/maps/index.js +++ b/x-pack/plugins/maps/index.js @@ -34,7 +34,8 @@ export function maps(kibana) { const serverConfig = server.config(); const mapConfig = serverConfig.get('map'); return { - isEmsEnabled: mapConfig.includeElasticMapsService + showMapsInspectorAdapter: serverConfig.get('xpack.maps.showMapsInspectorAdapter'), + isEmsEnabled: mapConfig.includeElasticMapsService, }; }, inspectorViews: [ @@ -52,6 +53,7 @@ export function maps(kibana) { config(Joi) { return Joi.object({ enabled: Joi.boolean().default(true), + showMapsInspectorAdapter: Joi.boolean().default(false), }).default(); }, diff --git a/x-pack/plugins/maps/public/components/map/mb/view.js b/x-pack/plugins/maps/public/components/map/mb/view.js index 3f44ca726c7c..238eb5887d89 100644 --- a/x-pack/plugins/maps/public/components/map/mb/view.js +++ b/x-pack/plugins/maps/public/components/map/mb/view.js @@ -215,7 +215,7 @@ export class MBMapContainer extends React.Component { }; _syncMbMapWithInspector = () => { - if (!this.props.isMapReady) { + if (!this.props.isMapReady || !inspectorAdapters.map) { return; } diff --git a/x-pack/plugins/maps/public/kibana_services.js b/x-pack/plugins/maps/public/kibana_services.js index 474db9263e77..30c0080e70ed 100644 --- a/x-pack/plugins/maps/public/kibana_services.js +++ b/x-pack/plugins/maps/public/kibana_services.js @@ -4,6 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ +import chrome from 'ui/chrome'; import { uiModules } from 'ui/modules'; import { SearchSourceProvider } from 'ui/courier'; import { RequestAdapter } from 'ui/inspector/adapters'; @@ -15,10 +16,13 @@ export const timeService = timefilter; export let indexPatternService; export let SearchSource; export let emsServiceSettings; + export const inspectorAdapters = { requests: new RequestAdapter(), - map: new MapAdapter(), }; +if (chrome.getInjected('showMapsInspectorAdapter', false)) { + inspectorAdapters.map = new MapAdapter(); +} export async function fetchSearchSourceAndRecordWithInspector({ searchSource, requestId, requestName, requestDesc }) { const inspectorRequest = inspectorAdapters.requests.start( diff --git a/x-pack/test/functional/config.js b/x-pack/test/functional/config.js index 005a030a33c0..30d7da16d193 100644 --- a/x-pack/test/functional/config.js +++ b/x-pack/test/functional/config.js @@ -159,6 +159,7 @@ export default async function ({ readConfigFile }) { '--status.allowAnonymous=true', '--server.uuid=5b2de169-2785-441b-ae8c-186a1936b17d', '--xpack.xpack_main.telemetry.enabled=false', + '--xpack.maps.showMapsInspectorAdapter=true', '--xpack.security.encryptionKey="wuGNaIhoMpk5sO4UBxgr3NyW1sFcLgIf"', // server restarts should not invalidate active sessions ], },