From 2a52da3cc104e0be3aac7ca693ffe3e4c89b1a8e Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Wed, 28 Nov 2018 15:25:23 -0700 Subject: [PATCH] Fix: Run with reporting disabled (#25829) * fix: relative link instead of static * fix: handle missing reporting config value * chore: refactor reportingBrowserType check * fix: core interpreter reportingBrowserType the code was duplicated from canvas, so it's equally as broken, this duplicates the fix --- src/core_plugins/interpreter/init.js | 6 +++++- x-pack/plugins/canvas/init.js | 6 +++++- .../canvas/public/components/workpad_export/index.js | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/core_plugins/interpreter/init.js b/src/core_plugins/interpreter/init.js index c48c60ec4bd07d..74d07d60b480af 100644 --- a/src/core_plugins/interpreter/init.js +++ b/src/core_plugins/interpreter/init.js @@ -25,7 +25,11 @@ export default async function (server /*options*/) { server.injectUiAppVars('canvas', () => { const config = server.config(); const basePath = config.get('server.basePath'); - const reportingBrowserType = config.get('xpack.reporting.capture.browser.type'); + const reportingBrowserType = (() => { + const configKey = 'xpack.reporting.capture.browser.type'; + if (!config.has(configKey)) return null; + return config.get(configKey); + })(); return { kbnIndex: config.get('kibana.index'), diff --git a/x-pack/plugins/canvas/init.js b/x-pack/plugins/canvas/init.js index 4ce65ff6830243..3e1f40697ed8c3 100644 --- a/x-pack/plugins/canvas/init.js +++ b/x-pack/plugins/canvas/init.js @@ -15,7 +15,11 @@ export default async function(server /*options*/) { server.injectUiAppVars('canvas', () => { const config = server.config(); const basePath = config.get('server.basePath'); - const reportingBrowserType = config.get('xpack.reporting.capture.browser.type'); + const reportingBrowserType = (() => { + const configKey = 'xpack.reporting.capture.browser.type'; + if (!config.has(configKey)) return null; + return config.get(configKey); + })(); return { kbnIndex: config.get('kibana.index'), diff --git a/x-pack/plugins/canvas/public/components/workpad_export/index.js b/x-pack/plugins/canvas/public/components/workpad_export/index.js index 3e1a1dce705585..eaa4691b718392 100644 --- a/x-pack/plugins/canvas/public/components/workpad_export/index.js +++ b/x-pack/plugins/canvas/public/components/workpad_export/index.js @@ -6,9 +6,9 @@ /* eslint import/no-unresolved: 1 */ // TODO: remove eslint rule when updating to use the linked kibana resolve package -import { jobCompletionNotifications } from 'plugins/reporting/lib/job_completion_notifications'; import { connect } from 'react-redux'; import { compose, withProps } from 'recompose'; +import { jobCompletionNotifications } from '../../../../reporting/public/lib/job_completion_notifications'; import { getWorkpad, getPages } from '../../state/selectors/workpad'; import { getReportingBrowserType } from '../../state/selectors/app'; import { notify } from '../../lib/notify';