From 7d940a1e0169f267ba969b65dfd67637114881e5 Mon Sep 17 00:00:00 2001 From: Poff Poffenberger Date: Thu, 2 Jan 2020 12:36:33 -0600 Subject: [PATCH 01/12] Remove Angular from Canvas --- .../canvas/public/angular/config/index.js | 8 --- .../angular/config/location_provider.ts | 21 -------- .../public/angular/config/state_management.js | 13 ----- .../public/angular/controllers/canvas.tsx | 54 ------------------- .../public/angular/controllers/index.ts | 7 --- .../canvas/public/angular/services/index.js | 7 --- .../canvas/public/angular/services/store.js | 31 ----------- .../canvas/public/application/canvas.tsx | 36 +++++++++++++ x-pack/legacy/plugins/canvas/public/legacy.ts | 3 -- .../legacy/plugins/canvas/public/plugin.tsx | 44 ++++++++++----- x-pack/legacy/plugins/canvas/public/store.ts | 33 ++++++++++++ x-pack/legacy/plugins/canvas/types/state.ts | 1 - 12 files changed, 100 insertions(+), 158 deletions(-) delete mode 100644 x-pack/legacy/plugins/canvas/public/angular/config/index.js delete mode 100644 x-pack/legacy/plugins/canvas/public/angular/config/location_provider.ts delete mode 100644 x-pack/legacy/plugins/canvas/public/angular/config/state_management.js delete mode 100644 x-pack/legacy/plugins/canvas/public/angular/controllers/canvas.tsx delete mode 100644 x-pack/legacy/plugins/canvas/public/angular/controllers/index.ts delete mode 100755 x-pack/legacy/plugins/canvas/public/angular/services/index.js delete mode 100644 x-pack/legacy/plugins/canvas/public/angular/services/store.js create mode 100644 x-pack/legacy/plugins/canvas/public/application/canvas.tsx create mode 100644 x-pack/legacy/plugins/canvas/public/store.ts diff --git a/x-pack/legacy/plugins/canvas/public/angular/config/index.js b/x-pack/legacy/plugins/canvas/public/angular/config/index.js deleted file mode 100644 index 020bcf1f7686e..0000000000000 --- a/x-pack/legacy/plugins/canvas/public/angular/config/index.js +++ /dev/null @@ -1,8 +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 * from './state_management'; // Requires 6.2.0+ -export * from './location_provider'; diff --git a/x-pack/legacy/plugins/canvas/public/angular/config/location_provider.ts b/x-pack/legacy/plugins/canvas/public/angular/config/location_provider.ts deleted file mode 100644 index 547e354d7fde9..0000000000000 --- a/x-pack/legacy/plugins/canvas/public/angular/config/location_provider.ts +++ /dev/null @@ -1,21 +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 { ILocationProvider } from 'angular'; -import { CoreStart, CanvasStartDeps } from '../../plugin'; - -export function initLocationProvider(coreStart: CoreStart, plugins: CanvasStartDeps) { - // disable angular's location provider - const app = plugins.__LEGACY.uiModules.get('apps/canvas'); - - app.config(($locationProvider: ILocationProvider) => { - $locationProvider.html5Mode({ - enabled: false, - requireBase: false, - rewriteLinks: false, - }); - }); -} diff --git a/x-pack/legacy/plugins/canvas/public/angular/config/state_management.js b/x-pack/legacy/plugins/canvas/public/angular/config/state_management.js deleted file mode 100644 index 4347765748c5d..0000000000000 --- a/x-pack/legacy/plugins/canvas/public/angular/config/state_management.js +++ /dev/null @@ -1,13 +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 initStateManagement(coreStart, plugins) { - // disable the kibana state management - const app = plugins.__LEGACY.uiModules.get('apps/canvas'); - app.config(stateManagementConfigProvider => { - stateManagementConfigProvider.disable(); - }); -} diff --git a/x-pack/legacy/plugins/canvas/public/angular/controllers/canvas.tsx b/x-pack/legacy/plugins/canvas/public/angular/controllers/canvas.tsx deleted file mode 100644 index 0dfa1ceecdbc5..0000000000000 --- a/x-pack/legacy/plugins/canvas/public/angular/controllers/canvas.tsx +++ /dev/null @@ -1,54 +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 React from 'react'; -import { render, unmountComponentAtNode } from 'react-dom'; -import { I18nProvider } from '@kbn/i18n/react'; -import { Provider } from 'react-redux'; -import { Store } from 'redux'; -import { CanvasStartDeps, CoreStart } from '../../plugin'; -import { KibanaContextProvider } from '../../../../../../../src/plugins/kibana_react/public'; - -// @ts-ignore Untyped local -import { App } from '../../components/app'; -import { AngularStrings } from '../../../i18n'; - -const { CanvasRootController: strings } = AngularStrings; - -export function CanvasRootControllerFactory(coreStart: CoreStart, plugins: CanvasStartDeps) { - return function CanvasRootController( - canvasStore: Store, - $scope: any, // Untyped in Kibana - $element: any // Untyped in Kibana - ) { - const domNode = $element[0]; - - // set the read-only badge when appropriate - coreStart.chrome.setBadge( - coreStart.application.capabilities.canvas.save - ? undefined - : { - text: strings.getReadOnlyBadgeText(), - tooltip: strings.getReadOnlyBadgeTooltip(), - iconType: 'glasses', - } - ); - - render( - - - - - - - , - domNode - ); - - $scope.$on('$destroy', () => { - unmountComponentAtNode(domNode); - }); - }; -} diff --git a/x-pack/legacy/plugins/canvas/public/angular/controllers/index.ts b/x-pack/legacy/plugins/canvas/public/angular/controllers/index.ts deleted file mode 100644 index 01fe3dda9c971..0000000000000 --- a/x-pack/legacy/plugins/canvas/public/angular/controllers/index.ts +++ /dev/null @@ -1,7 +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 { CanvasRootControllerFactory } from './canvas'; diff --git a/x-pack/legacy/plugins/canvas/public/angular/services/index.js b/x-pack/legacy/plugins/canvas/public/angular/services/index.js deleted file mode 100755 index b472b9bbac993..0000000000000 --- a/x-pack/legacy/plugins/canvas/public/angular/services/index.js +++ /dev/null @@ -1,7 +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 * from './store'; diff --git a/x-pack/legacy/plugins/canvas/public/angular/services/store.js b/x-pack/legacy/plugins/canvas/public/angular/services/store.js deleted file mode 100644 index f6f9d8922b99e..0000000000000 --- a/x-pack/legacy/plugins/canvas/public/angular/services/store.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 { createStore } from '../../state/store'; -import { getInitialState } from '../../state/initial_state'; - -export function initStore(coreStart, plugins) { - const app = plugins.__LEGACY.uiModules.get('apps/canvas'); - app.service('canvasStore', (kbnVersion, basePath, reportingBrowserType, serverFunctions) => { - const initialState = getInitialState(); - - // Set the defaults from Kibana plugin - initialState.app = { - kbnVersion, - basePath, - reportingBrowserType, - serverFunctions, - ready: false, - }; - - const store = createStore(initialState); - - // TODO: debugging, remove this - window.canvasStore = store; - - return store; - }); -} diff --git a/x-pack/legacy/plugins/canvas/public/application/canvas.tsx b/x-pack/legacy/plugins/canvas/public/application/canvas.tsx new file mode 100644 index 0000000000000..6828574d66716 --- /dev/null +++ b/x-pack/legacy/plugins/canvas/public/application/canvas.tsx @@ -0,0 +1,36 @@ +/* + * 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 React from 'react'; +import { Store } from 'redux'; +import ReactDOM from 'react-dom'; +import { I18nProvider } from '@kbn/i18n/react'; +import { Provider } from 'react-redux'; + +import { AppMountParameters, CoreStart } from 'kibana/public'; + +// @ts-ignore Untyped local +import { App } from '../components/app'; +import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; + +export const renderApp = ( + coreStart: CoreStart, + plugins: object, + { element }: AppMountParameters, + canvasStore: Store +) => { + ReactDOM.render( + + + + + + + , + element + ); + return () => ReactDOM.unmountComponentAtNode(element); +}; diff --git a/x-pack/legacy/plugins/canvas/public/legacy.ts b/x-pack/legacy/plugins/canvas/public/legacy.ts index 61e12893b3e02..7a0aa898eba56 100644 --- a/x-pack/legacy/plugins/canvas/public/legacy.ts +++ b/x-pack/legacy/plugins/canvas/public/legacy.ts @@ -9,8 +9,6 @@ import { CanvasStartDeps } from './plugin'; // eslint-disable-line import/order // @ts-ignore Untyped Kibana Lib import chrome, { loadingCount } from 'ui/chrome'; // eslint-disable-line import/order -// @ts-ignore Untyped Module -import { uiModules } from 'ui/modules'; // eslint-disable-line import/order import { absoluteToParsedUrl } from 'ui/url/absolute_to_parsed_url'; // eslint-disable-line import/order import { Storage } from '../../../../../src/plugins/kibana_utils/public'; // eslint-disable-line import/order // @ts-ignore Untyped Kibana Lib @@ -38,7 +36,6 @@ const shimStartPlugins: CanvasStartDeps = { storage: Storage, // ToDo: Won't be a part of New Platform. Will need to handle internally trackSubUrlForApp: chrome.trackSubUrlForApp, - uiModules, }, }; diff --git a/x-pack/legacy/plugins/canvas/public/plugin.tsx b/x-pack/legacy/plugins/canvas/public/plugin.tsx index 155eef99632a0..465818aa03420 100644 --- a/x-pack/legacy/plugins/canvas/public/plugin.tsx +++ b/x-pack/legacy/plugins/canvas/public/plugin.tsx @@ -7,15 +7,15 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { Chrome } from 'ui/chrome'; -import { IModule } from 'angular'; import { i18n } from '@kbn/i18n'; import { Storage } from '../../../../../src/plugins/kibana_utils/public'; import { CoreSetup, CoreStart, Plugin } from '../../../../../src/core/public'; // @ts-ignore: Untyped Local -import { initStateManagement, initLocationProvider } from './angular/config'; -import { CanvasRootControllerFactory } from './angular/controllers'; -// @ts-ignore: Untypled Local -import { initStore } from './angular/services'; +import { AngularStrings } from '../i18n'; +const { CanvasRootController: strings } = AngularStrings; + +import { createStore } from './store'; + // @ts-ignore: untyped local component import { HelpMenu } from './components/help_menu/help_menu'; // @ts-ignore: untyped local @@ -43,9 +43,6 @@ export interface CanvasStartDeps { setRootController: Chrome['setRootController']; storage: typeof Storage; trackSubUrlForApp: Chrome['trackSubUrlForApp']; - uiModules: { - get: (module: string) => IModule; - }; }; } @@ -67,6 +64,22 @@ export class CanvasPlugin // Things like registering functions to the interpreter that need // to be available everywhere, not just in Canvas + core.application.register({ + id: 'canvas', + title: 'Canvas App', + async mount(context, params) { + // Load application bundle + const { renderApp } = await import('./application/canvas'); + + // Setup our store + const canvasStore = await createStore(core); + + // Get start services + const [coreStart, depsStart] = await core.getStartServices(); + + return renderApp(coreStart, depsStart, params, canvasStore); + }, + }); return {}; } @@ -74,14 +87,19 @@ export class CanvasPlugin loadExpressionTypes(); loadTransitions(); - initStateManagement(core, plugins); - initLocationProvider(core, plugins); - initStore(core, plugins); initClipboard(plugins.__LEGACY.storage); initLoadingIndicator(core.http.addLoadingCountSource); - const CanvasRootController = CanvasRootControllerFactory(core, plugins); - plugins.__LEGACY.setRootController('canvas', CanvasRootController); + core.chrome.setBadge( + core.application.capabilities.canvas.save + ? undefined + : { + text: strings.getReadOnlyBadgeText(), + tooltip: strings.getReadOnlyBadgeTooltip(), + iconType: 'glasses', + } + ); + core.chrome.setHelpExtension({ appName: i18n.translate('xpack.canvas.helpMenu.appName', { defaultMessage: 'Canvas', diff --git a/x-pack/legacy/plugins/canvas/public/store.ts b/x-pack/legacy/plugins/canvas/public/store.ts new file mode 100644 index 0000000000000..d2bc3714838fe --- /dev/null +++ b/x-pack/legacy/plugins/canvas/public/store.ts @@ -0,0 +1,33 @@ +/* + * 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. + */ + +// @ts-ignore Untyped local +import { createStore as createReduxStore } from './state/store'; +// @ts-ignore Untyped local +import { getInitialState } from './state/initial_state'; + +import { FUNCTIONS_URL } from '../../../../../src/legacy/core_plugins/interpreter/public/canvas/consts'; +import { CoreSetup } from '../../../../../src/core/public'; + +export async function createStore(core: CoreSetup) { + const initialState = getInitialState(); + + const basePath = core.http.basePath.get(); + const reportingBrowserType = core.injectedMetadata.getInjectedVar('reportingBrowserType'); + + // Retrieve server functions + const serverFunctionsResponse = await core.http.get(FUNCTIONS_URL); + const serverFunctions = Object.values(serverFunctionsResponse); + + initialState.app = { + basePath, + reportingBrowserType, + serverFunctions, + ready: false, + }; + + return createReduxStore(initialState); +} diff --git a/x-pack/legacy/plugins/canvas/types/state.ts b/x-pack/legacy/plugins/canvas/types/state.ts index 3aca3003f9dc5..8ac5fac0d413c 100644 --- a/x-pack/legacy/plugins/canvas/types/state.ts +++ b/x-pack/legacy/plugins/canvas/types/state.ts @@ -32,7 +32,6 @@ export interface AppState { } interface StoreAppState { - kbnVersion: string; basePath: string; reportingBrowserType: string; // TODO: These server functions are actually missing the fn because they are serialized from the server From 6b65d75c4cf2f63a344d57214853f60e28819b88 Mon Sep 17 00:00:00 2001 From: Poff Poffenberger Date: Mon, 6 Jan 2020 15:06:33 -0600 Subject: [PATCH 02/12] Updates i18n string names --- .../plugins/canvas/i18n/{angular.ts => capabilities.ts} | 8 ++++---- x-pack/legacy/plugins/canvas/i18n/index.ts | 2 +- x-pack/legacy/plugins/canvas/public/plugin.tsx | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) rename x-pack/legacy/plugins/canvas/i18n/{angular.ts => capabilities.ts} (83%) diff --git a/x-pack/legacy/plugins/canvas/i18n/angular.ts b/x-pack/legacy/plugins/canvas/i18n/capabilities.ts similarity index 83% rename from x-pack/legacy/plugins/canvas/i18n/angular.ts rename to x-pack/legacy/plugins/canvas/i18n/capabilities.ts index 74e5ceb7d6bb7..a4c2d1d3a1be7 100644 --- a/x-pack/legacy/plugins/canvas/i18n/angular.ts +++ b/x-pack/legacy/plugins/canvas/i18n/capabilities.ts @@ -7,13 +7,13 @@ import { i18n } from '@kbn/i18n'; import { CANVAS as canvas } from './constants'; -export const AngularStrings = { - CanvasRootController: { - getReadOnlyBadgeText: () => +export const CapabilitiesStrings = { + ReadOnlyBadge: { + getText: () => i18n.translate('xpack.canvas.badge.readOnly.text', { defaultMessage: 'Read only', }), - getReadOnlyBadgeTooltip: () => + getTooltip: () => i18n.translate('xpack.canvas.badge.readOnly.tooltip', { defaultMessage: 'Unable to save {canvas} workpads', values: { diff --git a/x-pack/legacy/plugins/canvas/i18n/index.ts b/x-pack/legacy/plugins/canvas/i18n/index.ts index 3be5eb89415b0..a671d0ccdb49f 100644 --- a/x-pack/legacy/plugins/canvas/i18n/index.ts +++ b/x-pack/legacy/plugins/canvas/i18n/index.ts @@ -6,7 +6,7 @@ import { i18n } from '@kbn/i18n'; -export * from './angular'; +export * from './capabilities'; export * from './components'; export * from './constants'; export * from './errors'; diff --git a/x-pack/legacy/plugins/canvas/public/plugin.tsx b/x-pack/legacy/plugins/canvas/public/plugin.tsx index 465818aa03420..94854ee82598f 100644 --- a/x-pack/legacy/plugins/canvas/public/plugin.tsx +++ b/x-pack/legacy/plugins/canvas/public/plugin.tsx @@ -12,7 +12,7 @@ import { Storage } from '../../../../../src/plugins/kibana_utils/public'; import { CoreSetup, CoreStart, Plugin } from '../../../../../src/core/public'; // @ts-ignore: Untyped Local import { AngularStrings } from '../i18n'; -const { CanvasRootController: strings } = AngularStrings; +const { ReadOnlyBadge: strings } = CapabilitiesStrings; import { createStore } from './store'; @@ -94,8 +94,8 @@ export class CanvasPlugin core.application.capabilities.canvas.save ? undefined : { - text: strings.getReadOnlyBadgeText(), - tooltip: strings.getReadOnlyBadgeTooltip(), + text: strings.getText(), + tooltip: strings.getTooltip(), iconType: 'glasses', } ); From 88c74e91a12fe51e3b14247e452ba0939991b3fc Mon Sep 17 00:00:00 2001 From: Poff Poffenberger Date: Mon, 6 Jan 2020 15:15:26 -0600 Subject: [PATCH 03/12] Updates path --- .../canvas/public/{application => applications}/canvas.tsx | 0 x-pack/legacy/plugins/canvas/public/plugin.tsx | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename x-pack/legacy/plugins/canvas/public/{application => applications}/canvas.tsx (100%) diff --git a/x-pack/legacy/plugins/canvas/public/application/canvas.tsx b/x-pack/legacy/plugins/canvas/public/applications/canvas.tsx similarity index 100% rename from x-pack/legacy/plugins/canvas/public/application/canvas.tsx rename to x-pack/legacy/plugins/canvas/public/applications/canvas.tsx diff --git a/x-pack/legacy/plugins/canvas/public/plugin.tsx b/x-pack/legacy/plugins/canvas/public/plugin.tsx index 94854ee82598f..15701623c64da 100644 --- a/x-pack/legacy/plugins/canvas/public/plugin.tsx +++ b/x-pack/legacy/plugins/canvas/public/plugin.tsx @@ -69,7 +69,7 @@ export class CanvasPlugin title: 'Canvas App', async mount(context, params) { // Load application bundle - const { renderApp } = await import('./application/canvas'); + const { renderApp } = await import('./applications/canvas'); // Setup our store const canvasStore = await createStore(core); From cd25d91f29e0841536821d5a546329a1e578e21a Mon Sep 17 00:00:00 2001 From: Poff Poffenberger Date: Mon, 6 Jan 2020 15:17:34 -0600 Subject: [PATCH 04/12] Another fix --- x-pack/legacy/plugins/canvas/public/plugin.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/legacy/plugins/canvas/public/plugin.tsx b/x-pack/legacy/plugins/canvas/public/plugin.tsx index 15701623c64da..f3d567bc9075c 100644 --- a/x-pack/legacy/plugins/canvas/public/plugin.tsx +++ b/x-pack/legacy/plugins/canvas/public/plugin.tsx @@ -11,7 +11,7 @@ import { i18n } from '@kbn/i18n'; import { Storage } from '../../../../../src/plugins/kibana_utils/public'; import { CoreSetup, CoreStart, Plugin } from '../../../../../src/core/public'; // @ts-ignore: Untyped Local -import { AngularStrings } from '../i18n'; +import { CapabilitiesStrings } from '../i18n'; const { ReadOnlyBadge: strings } = CapabilitiesStrings; import { createStore } from './store'; From 23b28b50b828831fb5e736e09e10b03b6ad83311 Mon Sep 17 00:00:00 2001 From: Poff Poffenberger Date: Tue, 7 Jan 2020 14:49:01 -0600 Subject: [PATCH 05/12] Modifying save check for canvas plugin --- x-pack/legacy/plugins/canvas/public/plugin.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/legacy/plugins/canvas/public/plugin.tsx b/x-pack/legacy/plugins/canvas/public/plugin.tsx index f3d567bc9075c..a5334cabb4ae7 100644 --- a/x-pack/legacy/plugins/canvas/public/plugin.tsx +++ b/x-pack/legacy/plugins/canvas/public/plugin.tsx @@ -91,7 +91,7 @@ export class CanvasPlugin initLoadingIndicator(core.http.addLoadingCountSource); core.chrome.setBadge( - core.application.capabilities.canvas.save + core.application.capabilities.canvas && core.application.capabilities.canvas.save ? undefined : { text: strings.getText(), From 7de5b897c11c2747bdd7cb29a9879e08fb48831a Mon Sep 17 00:00:00 2001 From: Poff Poffenberger Date: Wed, 22 Jan 2020 22:17:10 +0000 Subject: [PATCH 06/12] PR feedback and adjusting reporting config --- .../{applications/canvas.tsx => application.tsx} | 4 ++-- .../components/workpad_header/workpad_export/index.ts | 4 ++-- x-pack/legacy/plugins/canvas/public/legacy.ts | 5 ++++- x-pack/legacy/plugins/canvas/public/plugin.tsx | 9 ++++++--- .../plugins/canvas/public/state/selectors/app.ts | 4 ++-- x-pack/legacy/plugins/canvas/public/store.ts | 10 +++++----- x-pack/legacy/plugins/canvas/server/plugin.ts | 6 +----- x-pack/legacy/plugins/canvas/types/state.ts | 2 +- 8 files changed, 23 insertions(+), 21 deletions(-) rename x-pack/legacy/plugins/canvas/public/{applications/canvas.tsx => application.tsx} (87%) diff --git a/x-pack/legacy/plugins/canvas/public/applications/canvas.tsx b/x-pack/legacy/plugins/canvas/public/application.tsx similarity index 87% rename from x-pack/legacy/plugins/canvas/public/applications/canvas.tsx rename to x-pack/legacy/plugins/canvas/public/application.tsx index 6828574d66716..ff22d68772efe 100644 --- a/x-pack/legacy/plugins/canvas/public/applications/canvas.tsx +++ b/x-pack/legacy/plugins/canvas/public/application.tsx @@ -13,8 +13,8 @@ import { Provider } from 'react-redux'; import { AppMountParameters, CoreStart } from 'kibana/public'; // @ts-ignore Untyped local -import { App } from '../components/app'; -import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public'; +import { App } from './components/app'; +import { KibanaContextProvider } from '../../../../../src/plugins/kibana_react/public'; export const renderApp = ( coreStart: CoreStart, diff --git a/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/index.ts b/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/index.ts index 2b2a582fb4526..72f013df443c8 100644 --- a/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/index.ts +++ b/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/index.ts @@ -10,7 +10,7 @@ import { jobCompletionNotifications } from '../../../../../reporting/public/lib/ // @ts-ignore Untyped local import { getWorkpad, getPages } from '../../../state/selectors/workpad'; // @ts-ignore Untyped local -import { getReportingBrowserType } from '../../../state/selectors/app'; +import { getHasReporting } from '../../../state/selectors/app'; // @ts-ignore Untyped local import { notify } from '../../../lib/notify'; import { getWindow } from '../../../lib/get_window'; @@ -34,7 +34,7 @@ const { WorkpadHeaderWorkpadExport: strings } = ComponentStrings; const mapStateToProps = (state: State) => ({ workpad: getWorkpad(state), pageCount: getPages(state).length, - enabled: getReportingBrowserType(state) === 'chromium', + enabled: getHasReporting(state), }); const getAbsoluteUrl = (path: string) => { diff --git a/x-pack/legacy/plugins/canvas/public/legacy.ts b/x-pack/legacy/plugins/canvas/public/legacy.ts index 7a0aa898eba56..2afb47f0c1602 100644 --- a/x-pack/legacy/plugins/canvas/public/legacy.ts +++ b/x-pack/legacy/plugins/canvas/public/legacy.ts @@ -22,7 +22,10 @@ const shimCoreSetup = { const shimCoreStart = { ...npStart.core, }; -const shimSetupPlugins = {}; +const shimSetupPlugins = { + reporting: npSetup.core.injectedMetadata.getInjectedVar('reportingBrowserType') ? {} : undefined, +}; + const shimStartPlugins: CanvasStartDeps = { ...npStart.plugins, __LEGACY: { diff --git a/x-pack/legacy/plugins/canvas/public/plugin.tsx b/x-pack/legacy/plugins/canvas/public/plugin.tsx index a5334cabb4ae7..d9395a94b32e1 100644 --- a/x-pack/legacy/plugins/canvas/public/plugin.tsx +++ b/x-pack/legacy/plugins/canvas/public/plugin.tsx @@ -34,8 +34,11 @@ export { CoreStart }; * @internal */ // This interface will be built out as we require other plugins for setup -export interface CanvasSetupDeps {} // eslint-disable-line @typescript-eslint/no-empty-interface +export interface CanvasSetupDeps { + reporting?: {}; +} export interface CanvasStartDeps { + reporting?: {}; __LEGACY: { absoluteToParsedUrl: (url: string, basePath: string) => any; formatMsg: any; @@ -69,10 +72,10 @@ export class CanvasPlugin title: 'Canvas App', async mount(context, params) { // Load application bundle - const { renderApp } = await import('./applications/canvas'); + const { renderApp } = await import('./application'); // Setup our store - const canvasStore = await createStore(core); + const canvasStore = await createStore(core, plugins); // Get start services const [coreStart, depsStart] = await core.getStartServices(); diff --git a/x-pack/legacy/plugins/canvas/public/state/selectors/app.ts b/x-pack/legacy/plugins/canvas/public/state/selectors/app.ts index 255d45cf558fc..fb28d87d46256 100644 --- a/x-pack/legacy/plugins/canvas/public/state/selectors/app.ts +++ b/x-pack/legacy/plugins/canvas/public/state/selectors/app.ts @@ -32,8 +32,8 @@ export function getBasePath(state: State): State['app']['basePath'] { return state.app.basePath; } -export function getReportingBrowserType(state: State): State['app']['reportingBrowserType'] { - return state.app.reportingBrowserType; +export function getHasReporting(state: State): State['app']['hasReporting'] { + return state.app.hasReporting; } // return true only when the required parameters are in the state diff --git a/x-pack/legacy/plugins/canvas/public/store.ts b/x-pack/legacy/plugins/canvas/public/store.ts index d2bc3714838fe..3b02a98aa5bbe 100644 --- a/x-pack/legacy/plugins/canvas/public/store.ts +++ b/x-pack/legacy/plugins/canvas/public/store.ts @@ -9,22 +9,22 @@ import { createStore as createReduxStore } from './state/store'; // @ts-ignore Untyped local import { getInitialState } from './state/initial_state'; -import { FUNCTIONS_URL } from '../../../../../src/legacy/core_plugins/interpreter/public/canvas/consts'; import { CoreSetup } from '../../../../../src/core/public'; +import { CanvasSetupDeps } from './plugin'; -export async function createStore(core: CoreSetup) { +export async function createStore(core: CoreSetup, plugins: CanvasSetupDeps) { const initialState = getInitialState(); const basePath = core.http.basePath.get(); - const reportingBrowserType = core.injectedMetadata.getInjectedVar('reportingBrowserType'); + const hasReporting = !!plugins.reporting; // Retrieve server functions - const serverFunctionsResponse = await core.http.get(FUNCTIONS_URL); + const serverFunctionsResponse = await core.http.get(`/api/interpreter/fns`); const serverFunctions = Object.values(serverFunctionsResponse); initialState.app = { basePath, - reportingBrowserType, + hasReporting, serverFunctions, ready: false, }; diff --git a/x-pack/legacy/plugins/canvas/server/plugin.ts b/x-pack/legacy/plugins/canvas/server/plugin.ts index 07f4b7d9ac6db..cd06e02a1280a 100644 --- a/x-pack/legacy/plugins/canvas/server/plugin.ts +++ b/x-pack/legacy/plugins/canvas/server/plugin.ts @@ -13,11 +13,10 @@ export class Plugin { public setup(core: CoreSetup, plugins: PluginsSetup) { routes(core); - const { serverFunctions } = plugins.interpreter.register({ serverFunctions: functions }); + plugins.interpreter.register({ serverFunctions: functions }); core.injectUiAppVars('canvas', async () => { const config = core.getServerConfig(); - const basePath = config.get('server.basePath'); const reportingBrowserType = (() => { const configKey = 'xpack.reporting.capture.browser.type'; if (!config.has(configKey)) { @@ -28,9 +27,6 @@ export class Plugin { return { ...plugins.kibana.injectedUiAppVars, - kbnIndex: config.get('kibana.index'), - serverFunctions: serverFunctions.toArray(), - basePath, reportingBrowserType, }; }); diff --git a/x-pack/legacy/plugins/canvas/types/state.ts b/x-pack/legacy/plugins/canvas/types/state.ts index 8ac5fac0d413c..4b783b61cff7d 100644 --- a/x-pack/legacy/plugins/canvas/types/state.ts +++ b/x-pack/legacy/plugins/canvas/types/state.ts @@ -33,7 +33,7 @@ export interface AppState { interface StoreAppState { basePath: string; - reportingBrowserType: string; + hasReporting: boolean; // TODO: These server functions are actually missing the fn because they are serialized from the server serverFunctions: CanvasFunction[]; ready: boolean; From 7f97c7ff41cd7f1b79c85a3c04c9b082636b0b8c Mon Sep 17 00:00:00 2001 From: Poff Poffenberger Date: Wed, 22 Jan 2020 22:20:08 +0000 Subject: [PATCH 07/12] Adding clarifying comment and removing root controller --- x-pack/legacy/plugins/canvas/public/legacy.ts | 5 +++-- x-pack/legacy/plugins/canvas/public/plugin.tsx | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/legacy/plugins/canvas/public/legacy.ts b/x-pack/legacy/plugins/canvas/public/legacy.ts index 2afb47f0c1602..15f7c0a1530ec 100644 --- a/x-pack/legacy/plugins/canvas/public/legacy.ts +++ b/x-pack/legacy/plugins/canvas/public/legacy.ts @@ -23,6 +23,9 @@ const shimCoreStart = { ...npStart.core, }; const shimSetupPlugins = { + // When the frontend Canvas plugin is moved to NP, we can declare reporting as an optional dependency + // and enable exports based on existence of the plugin. + // For now, use an injected config to mimic this behavior in the meantime. reporting: npSetup.core.injectedMetadata.getInjectedVar('reportingBrowserType') ? {} : undefined, }; @@ -34,8 +37,6 @@ const shimStartPlugins: CanvasStartDeps = { // ToDo: Copy directly into canvas formatMsg, QueryString, - // ToDo: Remove in favor of core.application.register - setRootController: chrome.setRootController, storage: Storage, // ToDo: Won't be a part of New Platform. Will need to handle internally trackSubUrlForApp: chrome.trackSubUrlForApp, diff --git a/x-pack/legacy/plugins/canvas/public/plugin.tsx b/x-pack/legacy/plugins/canvas/public/plugin.tsx index d9395a94b32e1..81482bb8db645 100644 --- a/x-pack/legacy/plugins/canvas/public/plugin.tsx +++ b/x-pack/legacy/plugins/canvas/public/plugin.tsx @@ -43,7 +43,6 @@ export interface CanvasStartDeps { absoluteToParsedUrl: (url: string, basePath: string) => any; formatMsg: any; QueryString: any; - setRootController: Chrome['setRootController']; storage: typeof Storage; trackSubUrlForApp: Chrome['trackSubUrlForApp']; }; From 25b464611b0185cb2121522521116a5be26cb05c Mon Sep 17 00:00:00 2001 From: Poff Poffenberger Date: Thu, 23 Jan 2020 15:45:05 +0000 Subject: [PATCH 08/12] test fix --- x-pack/legacy/plugins/canvas/public/legacy.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/x-pack/legacy/plugins/canvas/public/legacy.ts b/x-pack/legacy/plugins/canvas/public/legacy.ts index 15f7c0a1530ec..e399cc10ee95a 100644 --- a/x-pack/legacy/plugins/canvas/public/legacy.ts +++ b/x-pack/legacy/plugins/canvas/public/legacy.ts @@ -26,7 +26,10 @@ const shimSetupPlugins = { // When the frontend Canvas plugin is moved to NP, we can declare reporting as an optional dependency // and enable exports based on existence of the plugin. // For now, use an injected config to mimic this behavior in the meantime. - reporting: npSetup.core.injectedMetadata.getInjectedVar('reportingBrowserType') ? {} : undefined, + reporting: + npSetup.core && npSetup.core.injectedMetadata.getInjectedVar('reportingBrowserType') + ? {} + : undefined, }; const shimStartPlugins: CanvasStartDeps = { From ad153696bb218acd5c464a53fd786dd685e14c17 Mon Sep 17 00:00:00 2001 From: Poff Poffenberger Date: Fri, 24 Jan 2020 14:22:34 -0600 Subject: [PATCH 09/12] Remove reporting config behavior from Canvas since it's no longer needed --- .../workpad_export/disabled_panel.tsx | 50 ------------------- .../workpad_header/workpad_export/index.ts | 7 +-- .../workpad_export/workpad_export.tsx | 22 +------- x-pack/legacy/plugins/canvas/public/legacy.ts | 10 +--- .../legacy/plugins/canvas/public/plugin.tsx | 5 +- .../canvas/public/state/selectors/app.ts | 4 -- x-pack/legacy/plugins/canvas/public/store.ts | 2 - x-pack/legacy/plugins/canvas/server/plugin.ts | 10 ---- x-pack/legacy/plugins/canvas/types/state.ts | 1 - 9 files changed, 5 insertions(+), 106 deletions(-) delete mode 100644 x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/disabled_panel.tsx diff --git a/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/disabled_panel.tsx b/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/disabled_panel.tsx deleted file mode 100644 index 85d1174f50bbd..0000000000000 --- a/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/disabled_panel.tsx +++ /dev/null @@ -1,50 +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 React from 'react'; -import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiText, EuiSpacer, EuiCodeBlock, EuiCode } from '@elastic/eui'; -import { Clipboard } from '../../clipboard'; - -const REPORTING_CONFIG = `xpack.reporting: - enabled: true - capture.browser.type: chromium`; - -interface Props { - /** Handler to invoke when the Kibana configuration is copied. */ - onCopy: () => void; -} - -/** - * A panel to display within the Export menu when reporting is disabled. - */ -export const DisabledPanel = ({ onCopy }: Props) => ( -
- -

- kibana.yml, - }} - /> -

-
- - - - {REPORTING_CONFIG} - - -
-); diff --git a/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/index.ts b/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/index.ts index 72f013df443c8..39611dd6c2994 100644 --- a/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/index.ts +++ b/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/index.ts @@ -10,8 +10,6 @@ import { jobCompletionNotifications } from '../../../../../reporting/public/lib/ // @ts-ignore Untyped local import { getWorkpad, getPages } from '../../../state/selectors/workpad'; // @ts-ignore Untyped local -import { getHasReporting } from '../../../state/selectors/app'; -// @ts-ignore Untyped local import { notify } from '../../../lib/notify'; import { getWindow } from '../../../lib/get_window'; // @ts-ignore Untyped local @@ -34,7 +32,6 @@ const { WorkpadHeaderWorkpadExport: strings } = ComponentStrings; const mapStateToProps = (state: State) => ({ workpad: getWorkpad(state), pageCount: getPages(state).length, - enabled: getHasReporting(state), }); const getAbsoluteUrl = (path: string) => { @@ -51,15 +48,13 @@ const getAbsoluteUrl = (path: string) => { interface Props { workpad: CanvasWorkpad; pageCount: number; - enabled: boolean; } export const WorkpadExport = compose( connect(mapStateToProps), withKibana, withProps( - ({ workpad, pageCount, enabled, kibana }: Props & WithKibanaProps): ComponentProps => ({ - enabled, + ({ workpad, pageCount, kibana }: Props & WithKibanaProps): ComponentProps => ({ getExportUrl: type => { if (type === 'pdf') { const pdfUrl = getPdfUrl(workpad, { pageCount }, kibana.services.http.basePath.prepend); diff --git a/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/workpad_export.tsx b/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/workpad_export.tsx index 0558652fb6029..522be043ec457 100644 --- a/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/workpad_export.tsx +++ b/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/workpad_export.tsx @@ -9,7 +9,6 @@ import PropTypes from 'prop-types'; import { EuiButtonIcon, EuiContextMenu, EuiIcon } from '@elastic/eui'; // @ts-ignore Untyped local import { Popover } from '../../popover'; -import { DisabledPanel } from './disabled_panel'; import { PDFPanel } from './pdf_panel'; import { ShareWebsiteFlyout } from './flyout'; @@ -29,8 +28,6 @@ export type OnCloseFn = (type: CloseTypes) => void; export type GetExportUrlFn = (type: ExportUrlTypes) => string; export interface Props { - /** True if exporting is enabled, false otherwise. */ - enabled: boolean; /** Handler to invoke when an export URL is copied to the clipboard. */ onCopy: OnCopyFn; /** Handler to invoke when an end product is exported. */ @@ -42,12 +39,7 @@ export interface Props { /** * The Menu for Exporting a Workpad from Canvas. */ -export const WorkpadExport: FunctionComponent = ({ - enabled, - onCopy, - onExport, - getExportUrl, -}) => { +export const WorkpadExport: FunctionComponent = ({ onCopy, onExport, getExportUrl }) => { const [showFlyout, setShowFlyout] = useState(false); const onClose = () => { @@ -106,16 +98,7 @@ export const WorkpadExport: FunctionComponent = ({ panel: { id: 1, title: strings.getShareDownloadPDFTitle(), - content: enabled ? ( - getPDFPanel(closePopover) - ) : ( - { - onCopy('reportingConfig'); - closePopover(); - }} - /> - ), + content: getPDFPanel(closePopover), }, }, { @@ -160,7 +143,6 @@ export const WorkpadExport: FunctionComponent = ({ }; WorkpadExport.propTypes = { - enabled: PropTypes.bool.isRequired, onCopy: PropTypes.func.isRequired, onExport: PropTypes.func.isRequired, getExportUrl: PropTypes.func.isRequired, diff --git a/x-pack/legacy/plugins/canvas/public/legacy.ts b/x-pack/legacy/plugins/canvas/public/legacy.ts index e399cc10ee95a..254fba0f23ad2 100644 --- a/x-pack/legacy/plugins/canvas/public/legacy.ts +++ b/x-pack/legacy/plugins/canvas/public/legacy.ts @@ -22,15 +22,7 @@ const shimCoreSetup = { const shimCoreStart = { ...npStart.core, }; -const shimSetupPlugins = { - // When the frontend Canvas plugin is moved to NP, we can declare reporting as an optional dependency - // and enable exports based on existence of the plugin. - // For now, use an injected config to mimic this behavior in the meantime. - reporting: - npSetup.core && npSetup.core.injectedMetadata.getInjectedVar('reportingBrowserType') - ? {} - : undefined, -}; +const shimSetupPlugins = {}; const shimStartPlugins: CanvasStartDeps = { ...npStart.plugins, diff --git a/x-pack/legacy/plugins/canvas/public/plugin.tsx b/x-pack/legacy/plugins/canvas/public/plugin.tsx index 81482bb8db645..7928d46067908 100644 --- a/x-pack/legacy/plugins/canvas/public/plugin.tsx +++ b/x-pack/legacy/plugins/canvas/public/plugin.tsx @@ -34,11 +34,8 @@ export { CoreStart }; * @internal */ // This interface will be built out as we require other plugins for setup -export interface CanvasSetupDeps { - reporting?: {}; -} +export interface CanvasSetupDeps {} // eslint-disable-line @typescript-eslint/no-empty-interface export interface CanvasStartDeps { - reporting?: {}; __LEGACY: { absoluteToParsedUrl: (url: string, basePath: string) => any; formatMsg: any; diff --git a/x-pack/legacy/plugins/canvas/public/state/selectors/app.ts b/x-pack/legacy/plugins/canvas/public/state/selectors/app.ts index fb28d87d46256..d68702a30d645 100644 --- a/x-pack/legacy/plugins/canvas/public/state/selectors/app.ts +++ b/x-pack/legacy/plugins/canvas/public/state/selectors/app.ts @@ -32,10 +32,6 @@ export function getBasePath(state: State): State['app']['basePath'] { return state.app.basePath; } -export function getHasReporting(state: State): State['app']['hasReporting'] { - return state.app.hasReporting; -} - // return true only when the required parameters are in the state export function isAppReady(state: State): boolean { const appReady = getAppReady(state); diff --git a/x-pack/legacy/plugins/canvas/public/store.ts b/x-pack/legacy/plugins/canvas/public/store.ts index 3b02a98aa5bbe..0a378979f6ad9 100644 --- a/x-pack/legacy/plugins/canvas/public/store.ts +++ b/x-pack/legacy/plugins/canvas/public/store.ts @@ -16,7 +16,6 @@ export async function createStore(core: CoreSetup, plugins: CanvasSetupDeps) { const initialState = getInitialState(); const basePath = core.http.basePath.get(); - const hasReporting = !!plugins.reporting; // Retrieve server functions const serverFunctionsResponse = await core.http.get(`/api/interpreter/fns`); @@ -24,7 +23,6 @@ export async function createStore(core: CoreSetup, plugins: CanvasSetupDeps) { initialState.app = { basePath, - hasReporting, serverFunctions, ready: false, }; diff --git a/x-pack/legacy/plugins/canvas/server/plugin.ts b/x-pack/legacy/plugins/canvas/server/plugin.ts index cd06e02a1280a..ac3edbabce930 100644 --- a/x-pack/legacy/plugins/canvas/server/plugin.ts +++ b/x-pack/legacy/plugins/canvas/server/plugin.ts @@ -16,18 +16,8 @@ export class Plugin { plugins.interpreter.register({ serverFunctions: functions }); core.injectUiAppVars('canvas', async () => { - const config = core.getServerConfig(); - const reportingBrowserType = (() => { - const configKey = 'xpack.reporting.capture.browser.type'; - if (!config.has(configKey)) { - return null; - } - return config.get(configKey); - })(); - return { ...plugins.kibana.injectedUiAppVars, - reportingBrowserType, }; }); diff --git a/x-pack/legacy/plugins/canvas/types/state.ts b/x-pack/legacy/plugins/canvas/types/state.ts index 4b783b61cff7d..171c5515fbb2a 100644 --- a/x-pack/legacy/plugins/canvas/types/state.ts +++ b/x-pack/legacy/plugins/canvas/types/state.ts @@ -33,7 +33,6 @@ export interface AppState { interface StoreAppState { basePath: string; - hasReporting: boolean; // TODO: These server functions are actually missing the fn because they are serialized from the server serverFunctions: CanvasFunction[]; ready: boolean; From fad8e850d2bb6a8edd8925408782719cf8aa58fb Mon Sep 17 00:00:00 2001 From: Poff Poffenberger Date: Fri, 24 Jan 2020 16:02:59 -0600 Subject: [PATCH 10/12] Remove disabled panel tests --- .../canvas/.storybook/storyshots.test.js | 8 ----- .../__examples__/disabled_panel.stories.tsx | 31 ------------------- 2 files changed, 39 deletions(-) delete mode 100644 x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/__examples__/disabled_panel.stories.tsx diff --git a/x-pack/legacy/plugins/canvas/.storybook/storyshots.test.js b/x-pack/legacy/plugins/canvas/.storybook/storyshots.test.js index 76240d212da15..10842f4268fd3 100644 --- a/x-pack/legacy/plugins/canvas/.storybook/storyshots.test.js +++ b/x-pack/legacy/plugins/canvas/.storybook/storyshots.test.js @@ -50,14 +50,6 @@ jest.mock('@elastic/eui/packages/react-datepicker', () => { jest.mock('plugins/interpreter/registries', () => ({})); -// Disabling this test due to https://github.com/elastic/eui/issues/2242 -jest.mock( - '../public/components/workpad_header/workpad_export/__examples__/disabled_panel.stories', - () => { - return 'Disabled Panel'; - } -); - // Disabling this test due to https://github.com/elastic/eui/issues/2242 jest.mock( '../public/components/workpad_header/workpad_export/flyout/__examples__/share_website_flyout.stories', diff --git a/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/__examples__/disabled_panel.stories.tsx b/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/__examples__/disabled_panel.stories.tsx deleted file mode 100644 index 2164fdd4ac470..0000000000000 --- a/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/__examples__/disabled_panel.stories.tsx +++ /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 { storiesOf } from '@storybook/react'; -import { action } from '@storybook/addon-actions'; -import React from 'react'; -import { DisabledPanel } from '../disabled_panel'; - -storiesOf('components/Export/DisabledPanel', module) - .addParameters({ - info: { - inline: true, - styles: { - infoBody: { - margin: 20, - }, - infoStory: { - margin: '20px 30px', - width: '290px', - }, - }, - }, - }) - .add('default', () => ( -
- -
- )); From 4a896370871743924085eddc2797d0ade089c4ea Mon Sep 17 00:00:00 2001 From: Poff Poffenberger Date: Fri, 24 Jan 2020 16:43:00 -0600 Subject: [PATCH 11/12] Fix workpad export snapshot --- .../workpad_export.examples.storyshot | 45 ------------------- .../__examples__/workpad_export.examples.tsx | 33 +++++--------- 2 files changed, 10 insertions(+), 68 deletions(-) diff --git a/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/__examples__/__snapshots__/workpad_export.examples.storyshot b/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/__examples__/__snapshots__/workpad_export.examples.storyshot index 9c7fca6d78190..a598438564130 100644 --- a/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/__examples__/__snapshots__/workpad_export.examples.storyshot +++ b/x-pack/legacy/plugins/canvas/public/components/workpad_header/workpad_export/__examples__/__snapshots__/workpad_export.examples.storyshot @@ -1,50 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Storyshots components/Export/WorkpadExport disabled 1`] = ` -
-
-
- - - -
-
-
-`; - exports[`Storyshots components/Export/WorkpadExport enabled 1`] = `
( - { - action(`getExportUrl('${type}')`); - return type; - }} - /> - )) - .add('disabled', () => ( - { - action(`getExportUrl('${type}')`); - return type; - }} - /> - )); +storiesOf('components/Export/WorkpadExport', module).add('enabled', () => ( + { + action(`getExportUrl('${type}')`); + return type; + }} + /> +)); From 37c6eb5158eb8dd15ac90ba613f8702e45fbc57b Mon Sep 17 00:00:00 2001 From: Poff Poffenberger Date: Fri, 24 Jan 2020 17:49:13 -0600 Subject: [PATCH 12/12] Update unused i18n --- x-pack/plugins/translations/translations/ja-JP.json | 1 - x-pack/plugins/translations/translations/zh-CN.json | 1 - 2 files changed, 2 deletions(-) diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 07deb1870aa12..9c17207c0d482 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -5272,7 +5272,6 @@ "xpack.canvas.workpadHeaderWorkpadExport.pdfPanelCopyAriaLabel": "この {URL} を使用してスクリプトから、または Watcher で {PDF} を生成することもできます。{URL} をクリップボードにコピーするにはエンターキーを押してください。", "xpack.canvas.workpadHeaderWorkpadExport.pdfPanelCopyButtonLabel": "{POST} {URL} をコピー", "xpack.canvas.workpadHeaderWorkpadExport.pdfPanelCopyDescription": "{POST} {URL} をコピーして {KIBANA} 外または ウォッチャー から生成することもできます。", - "xpack.canvas.workpadHeaderWorkpadExport.pdfPanelDisabledDescription": "PDF へのエクスポートは無効になっています。Chromium ブラウザを使用するにはレポートの構成が必要です。これを {fileName} ファイルに追加します。", "xpack.canvas.workpadHeaderWorkpadExport.pdfPanelGenerateButtonLabel": "{PDF} を生成", "xpack.canvas.workpadHeaderWorkpadExport.pdfPanelGenerateDescription": "ワークパッドのサイズによって、{PDF} の生成には数分かかる場合があります。", "xpack.canvas.workpadHeaderWorkpadExport.shareDownloadJSONTitle": "{JSON} をダウンロード", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 6ebba29e59480..c1dff0bca24cf 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -5271,7 +5271,6 @@ "xpack.canvas.workpadHeaderWorkpadExport.pdfPanelCopyAriaLabel": "或者,也可以从脚本或使用 {URL} 通过 Watcher 生成 {PDF}。按 Enter 键可将 {URL} 复制到剪贴板。", "xpack.canvas.workpadHeaderWorkpadExport.pdfPanelCopyButtonLabel": "复制 {POST} {URL}", "xpack.canvas.workpadHeaderWorkpadExport.pdfPanelCopyDescription": "或者,复制此 {POST} {URL} 以从 {KIBANA} 外部或从 Watcher 调用生成。", - "xpack.canvas.workpadHeaderWorkpadExport.pdfPanelDisabledDescription": "导出到 PDF 已禁用。必须配置报告,才能使用 Chromium 浏览器。将其添加到您的 {fileName} 文件中。", "xpack.canvas.workpadHeaderWorkpadExport.pdfPanelGenerateButtonLabel": "生成 {PDF}", "xpack.canvas.workpadHeaderWorkpadExport.pdfPanelGenerateDescription": "{PDF} 可能会花费 1 或 2 分钟生成,取决于 Workpad 的大小。", "xpack.canvas.workpadHeaderWorkpadExport.shareDownloadJSONTitle": "下载为 {JSON}",