From fe7b69b6372bbc021581af6f401d7d5fed306425 Mon Sep 17 00:00:00 2001 From: Joe Fleming Date: Thu, 29 Nov 2018 09:23:27 -0700 Subject: [PATCH] Fix: Run with reporting disabled (#25829) (#26382) * 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 --- x-pack/plugins/canvas/init.js | 6 +++++- .../canvas/public/components/workpad_export/index.js | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/canvas/init.js b/x-pack/plugins/canvas/init.js index 315a1d7e7f6dd..78f94a1e3fa0e 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 3e1a1dce70558..eaa4691b71839 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';