From 1da5fcf4440890a7e706a7b6587a48a777db6782 Mon Sep 17 00:00:00 2001 From: Spencer Date: Thu, 31 Dec 2020 12:16:33 -0700 Subject: [PATCH 1/4] [logstash] remove "upgrade" functionality now that .logstash is a system index (#87056) Co-authored-by: spalger --- .../upgrade_failure.test.js.snap | 1138 ----------------- .../upgrade_failure_actions.test.js.snap | 32 - .../upgrade_failure_title.test.js.snap | 23 - .../components/upgrade_failure/constants.js | 34 - .../components/upgrade_failure/index.js | 7 - .../upgrade_failure/upgrade_failure.js | 43 - .../upgrade_failure/upgrade_failure.test.js | 55 - .../upgrade_failure_actions.js | 36 - .../upgrade_failure_actions.test.js | 42 - .../upgrade_failure/upgrade_failure_title.js | 28 - .../upgrade_failure_title.test.js | 21 - .../logstash/public/application/index.tsx | 4 - .../public/application/pipeline_edit_view.tsx | 37 +- .../plugins/logstash/public/services/index.js | 1 - .../logstash/public/services/upgrade/index.js | 7 - .../services/upgrade/upgrade_service.js | 22 - .../plugins/logstash/server/routes/index.ts | 3 - .../logstash/server/routes/upgrade/index.ts | 7 - .../logstash/server/routes/upgrade/upgrade.ts | 46 - .../translations/translations/ja-JP.json | 7 - .../translations/translations/zh-CN.json | 7 - 21 files changed, 1 insertion(+), 1599 deletions(-) delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure.test.js.snap delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_actions.test.js.snap delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_title.test.js.snap delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/constants.js delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/index.js delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.js delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.test.js delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.js delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.test.js delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.js delete mode 100644 x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.test.js delete mode 100755 x-pack/plugins/logstash/public/services/upgrade/index.js delete mode 100755 x-pack/plugins/logstash/public/services/upgrade/upgrade_service.js delete mode 100644 x-pack/plugins/logstash/server/routes/upgrade/index.ts delete mode 100644 x-pack/plugins/logstash/server/routes/upgrade/upgrade.ts diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure.test.js.snap b/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure.test.js.snap deleted file mode 100644 index 63bb0c84d67110..00000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure.test.js.snap +++ /dev/null @@ -1,1138 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`UpgradeFailure component passes expected text for new pipeline 1`] = ` - -
- - -
- - } - body={ -

- Before you can add a pipeline, we need to upgrade your configuration. -

- } - title={ - - } - > -
- - - - - -
- -
- - - -
-
- -
- -

- Upgrade failed -

-
-
-
-
-
-
-
- -
- - -
-

- Before you can add a pipeline, we need to upgrade your configuration. -

-
-
- - - -
- - -
- - - -
- -
- - - - - -
-
- -
- - - -
-
-
-
-
-
- -
- - -
- -`; - -exports[`UpgradeFailure component passes expected text for not manual upgrade 1`] = ` - -
- - -
- - } - body={ -

- Before you can add a pipeline, we need to upgrade your configuration. -

- } - title={ - - } - > -
- - - - - -
- -
- - - -
-
- -
- -

- Time for an upgrade! -

-
-
-
-
-
-
-
- -
- - -
-

- Before you can add a pipeline, we need to upgrade your configuration. -

-
-
- - - -
- - -
- - - -
- -
- - - - - -
-
- -
- - - -
-
-
-
-
-
- -
- - -
- -`; - -exports[`UpgradeFailure component passes expected text for not new pipeline 1`] = ` - -
- - -
- - } - body={ -

- Before you can edit this pipeline, we need to upgrade your configuration. -

- } - title={ - - } - > -
- - - - - -
- -
- - - -
-
- -
- -

- Upgrade failed -

-
-
-
-
-
-
-
- -
- - -
-

- Before you can edit this pipeline, we need to upgrade your configuration. -

-
-
- - - -
- - -
- - - -
- -
- - - - - -
-
- -
- - - -
-
-
-
-
-
- -
- - -
- -`; - -exports[`UpgradeFailure component renders component as expected 1`] = ` -
- - - } - body={ -

- Before you can add a pipeline, we need to upgrade your configuration. -

- } - title={ - - } - /> -
-
-`; diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_actions.test.js.snap b/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_actions.test.js.snap deleted file mode 100644 index 2be92ef29e71bd..00000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_actions.test.js.snap +++ /dev/null @@ -1,32 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`UpgradeFailureActions component renders component as expected 1`] = ` - - - - upgrade button text - - - - - - - - -`; diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_title.test.js.snap b/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_title.test.js.snap deleted file mode 100644 index df4503b34c964c..00000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/__snapshots__/upgrade_failure_title.test.js.snap +++ /dev/null @@ -1,23 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`UpgradeFailureTitle component renders component as expected 1`] = ` - - - - - - -

- the Title -

-
-
-
-`; diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/constants.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/constants.js deleted file mode 100644 index 99c727b3ad96aa..00000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/constants.js +++ /dev/null @@ -1,34 +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 { i18n } from '@kbn/i18n'; - -export const UPGRADE_FAILURE = { - TITLE: { - IS_MANUAL_UPGRADE: i18n.translate('xpack.logstash.upgradeFailedTitle', { - defaultMessage: 'Upgrade failed', - }), - NOT_MANUAL_UPGRADE: i18n.translate('xpack.logstash.notManualUpgradeTitle', { - defaultMessage: 'Time for an upgrade!', - }), - }, - MESSAGE: { - IS_NEW_PIPELINE: i18n.translate('xpack.logstash.newPipelineMessage', { - defaultMessage: 'Before you can add a pipeline, we need to upgrade your configuration.', - }), - NOT_NEW_PIPELINE: i18n.translate('xpack.logstash.notNewPipelineMessage', { - defaultMessage: 'Before you can edit this pipeline, we need to upgrade your configuration.', - }), - }, - UPGRADE_BUTTON_TEXT: { - IS_MANUAL_UPGRADE: i18n.translate('xpack.logstash.manualUpgradeButtonLabel', { - defaultMessage: 'Try again', - }), - NOT_MANUAL_UPGRADE: i18n.translate('xpack.logstash.notManualUpgradeButtonLabel', { - defaultMessage: 'Upgrade', - }), - }, -}; diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/index.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/index.js deleted file mode 100644 index 0aa757bca52369..00000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/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 { UpgradeFailure } from './upgrade_failure'; diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.js deleted file mode 100644 index 52eefe490d2eeb..00000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.js +++ /dev/null @@ -1,43 +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 { EuiEmptyPrompt, EuiPageContent } from '@elastic/eui'; -import { UpgradeFailureTitle } from './upgrade_failure_title'; -import { UpgradeFailureActions } from './upgrade_failure_actions'; -import { UPGRADE_FAILURE } from './constants'; - -export function UpgradeFailure({ isNewPipeline, isManualUpgrade, onClose, onRetry }) { - const titleText = isManualUpgrade - ? UPGRADE_FAILURE.TITLE.IS_MANUAL_UPGRADE - : UPGRADE_FAILURE.TITLE.NOT_MANUAL_UPGRADE; - - const messageText = isNewPipeline - ? UPGRADE_FAILURE.MESSAGE.IS_NEW_PIPELINE - : UPGRADE_FAILURE.MESSAGE.NOT_NEW_PIPELINE; - - const upgradeButtonText = isManualUpgrade - ? UPGRADE_FAILURE.UPGRADE_BUTTON_TEXT.IS_MANUAL_UPGRADE - : UPGRADE_FAILURE.UPGRADE_BUTTON_TEXT.NOT_MANUAL_UPGRADE; - - return ( -
- - - } - title={} - body={

{messageText}

} - /> -
-
- ); -} diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.test.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.test.js deleted file mode 100644 index fe93ddb22077c1..00000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure.test.js +++ /dev/null @@ -1,55 +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 { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; -import { UpgradeFailure } from './upgrade_failure'; - -describe('UpgradeFailure component', () => { - let props; - let onClose; - let onRetry; - - beforeEach(() => { - onClose = jest.fn(); - onRetry = jest.fn(); - - props = { - isManualUpgrade: true, - isNewPipeline: true, - onClose, - onRetry, - }; - }); - - it('renders component as expected', () => { - const wrapper = shallowWithIntl(); - expect(wrapper).toMatchSnapshot(); - }); - - it('passes expected text for new pipeline', () => { - const wrapper = mountWithIntl(); - expect(wrapper).toMatchSnapshot(); - }); - - it('passes expected text for not new pipeline', () => { - props.isNewPipeline = false; - const wrapper = mountWithIntl(); - expect(wrapper).toMatchSnapshot(); - }); - - it('passes expected text for not manual upgrade', () => { - props.isManualUpgrade = false; - const wrapper = mountWithIntl(); - expect(wrapper).toMatchSnapshot(); - }); - - it('propogates onClose and onRetry functions to child', () => { - const wrapper = mountWithIntl(); - expect(wrapper.find('UpgradeFailureActions').props().onClose).toEqual(onClose); - expect(wrapper.find('UpgradeFailureActions').props().onRetry).toEqual(onRetry); - }); -}); diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.js deleted file mode 100644 index 7a3eaef45bb5bf..00000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.js +++ /dev/null @@ -1,36 +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 PropTypes from 'prop-types'; -import { EuiButton, EuiButtonEmpty, EuiFlexGroup, EuiFlexItem } from '@elastic/eui'; -import { FormattedMessage } from '@kbn/i18n/react'; - -export function UpgradeFailureActions({ onClose, onRetry, upgradeButtonText }) { - return ( - - - - {upgradeButtonText} - - - - - - - - - ); -} - -UpgradeFailureActions.propTypes = { - onClose: PropTypes.func.isRequired, - onRetry: PropTypes.func.isRequired, - upgradeButtonText: PropTypes.string.isRequired, -}; diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.test.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.test.js deleted file mode 100644 index 603ab0ff543b8d..00000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_actions.test.js +++ /dev/null @@ -1,42 +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 { shallowWithIntl, mountWithIntl } from '@kbn/test/jest'; -import { UpgradeFailureActions } from './upgrade_failure_actions'; - -describe('UpgradeFailureActions component', () => { - let props; - let onClose; - let onRetry; - - beforeEach(() => { - onClose = jest.fn(); - onRetry = jest.fn(); - props = { - onClose, - onRetry, - upgradeButtonText: 'upgrade button text', - }; - }); - - it('renders component as expected', () => { - const wrapper = shallowWithIntl(); - expect(wrapper).toMatchSnapshot(); - }); - - it('calls onRetry on update click', () => { - const wrapper = mountWithIntl(); - wrapper.find('EuiButton').simulate('click'); - expect(onRetry).toHaveBeenCalledTimes(1); - }); - - it('calls onClose on "Go back" click', () => { - const wrapper = mountWithIntl(); - wrapper.find('EuiButtonEmpty').simulate('click'); - expect(onClose).toHaveBeenCalledTimes(1); - }); -}); diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.js deleted file mode 100644 index 749c49ea2257e4..00000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.js +++ /dev/null @@ -1,28 +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 PropTypes from 'prop-types'; -import { EuiFlexGroup, EuiFlexItem, EuiIcon, EuiTitle } from '@elastic/eui'; - -export function UpgradeFailureTitle({ titleText }) { - return ( - - - - - - -

{titleText}

-
-
-
- ); -} - -UpgradeFailureTitle.propTypes = { - titleText: PropTypes.string.isRequired, -}; diff --git a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.test.js b/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.test.js deleted file mode 100644 index 7fd5ad8f732b2b..00000000000000 --- a/x-pack/plugins/logstash/public/application/components/upgrade_failure/upgrade_failure_title.test.js +++ /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 React from 'react'; -import { shallow } from 'enzyme'; -import { UpgradeFailureTitle } from './upgrade_failure_title'; - -describe('UpgradeFailureTitle component', () => { - let props; - beforeEach(() => { - props = { titleText: 'the Title' }; - }); - - it('renders component as expected', () => { - const wrapper = shallow(); - expect(wrapper).toMatchSnapshot(); - }); -}); diff --git a/x-pack/plugins/logstash/public/application/index.tsx b/x-pack/plugins/logstash/public/application/index.tsx index 8d515ad6b3932d..2cf1b0aaebd9ff 100644 --- a/x-pack/plugins/logstash/public/application/index.tsx +++ b/x-pack/plugins/logstash/public/application/index.tsx @@ -17,7 +17,6 @@ import { MonitoringService, PipelineService, PipelinesService, - UpgradeService, // @ts-ignore } from '../services'; // @ts-ignore @@ -39,7 +38,6 @@ export const renderApp = async ( const monitoringService = new MonitoringService(core.http, isMonitoringEnabled, clusterService); const pipelinesService = new PipelinesService(core.http, monitoringService); const pipelineService = new PipelineService(core.http, pipelinesService); - const upgradeService = new UpgradeService(core.http); ReactDOM.render( @@ -77,7 +75,6 @@ export const renderApp = async ( logstashLicenseService={logstashLicenseService} pipelineService={pipelineService} toasts={core.notifications.toasts} - upgradeService={upgradeService} /> )} /> @@ -96,7 +93,6 @@ export const renderApp = async ( logstashLicenseService={logstashLicenseService} pipelineService={pipelineService} toasts={core.notifications.toasts} - upgradeService={upgradeService} id={match.params.id} /> )} diff --git a/x-pack/plugins/logstash/public/application/pipeline_edit_view.tsx b/x-pack/plugins/logstash/public/application/pipeline_edit_view.tsx index a36ef394f33277..3ad8927bcdafa1 100644 --- a/x-pack/plugins/logstash/public/application/pipeline_edit_view.tsx +++ b/x-pack/plugins/logstash/public/application/pipeline_edit_view.tsx @@ -11,8 +11,6 @@ import { History } from 'history'; import { i18n } from '@kbn/i18n'; import { ToastsStart } from 'src/core/public'; -// @ts-ignore -import { UpgradeFailure } from './components/upgrade_failure'; // @ts-ignore import { PipelineEditor } from './components/pipeline_editor'; // @ts-ignore @@ -59,23 +57,9 @@ const usePipeline = ( return pipeline; }; -const useIsUpgraded = (upgradeService: any) => { - const [isUpgraded, setIsUpgraded] = useState(null); - const mounted = usePromise(); - - useLayoutEffect(() => { - mounted(upgradeService.executeUpgrade() as Promise).then((result) => - setIsUpgraded(result) - ); - }, [mounted, upgradeService]); - - return isUpgraded; -}; - interface EditProps { pipelineService: any; logstashLicenseService: any; - upgradeService: any; toasts: ToastsStart; history: History; setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs']; @@ -87,24 +71,16 @@ interface EditProps { export const PipelineEditView: React.FC = ({ pipelineService, logstashLicenseService, - upgradeService, toasts, history, setBreadcrumbs, id, }) => { const params = new URLSearchParams(history.location.search); - const shouldRetry = params.get('retry') === 'true'; const shouldClone = params.get('clone') === ''; const pipeline = usePipeline(pipelineService, logstashLicenseService, toasts, shouldClone, id); - const isUpgraded = useIsUpgraded(upgradeService); - const onRetry = useCallback(() => { - const newParams = new URLSearchParams(history.location.search); - newParams.set('retry', 'true'); - history.replace({ search: newParams.toString() }); - }, [history]); const close = useCallback(() => { history.push('/'); }, [history]); @@ -115,7 +91,7 @@ export const PipelineEditView: React.FC = ({ [history] ); - if (!pipeline || isUpgraded === null) { + if (!pipeline) { return null; } @@ -126,17 +102,6 @@ export const PipelineEditView: React.FC = ({ : Breadcrumbs.getPipelineEditBreadcrumbs(pipeline.id) ); - if (!isUpgraded) { - return ( - - ); - } - return ( response.is_upgraded) - .catch((e) => { - throw e.message; - }); - } -} diff --git a/x-pack/plugins/logstash/server/routes/index.ts b/x-pack/plugins/logstash/server/routes/index.ts index 0c7183b4090551..422afbf7d411e1 100644 --- a/x-pack/plugins/logstash/server/routes/index.ts +++ b/x-pack/plugins/logstash/server/routes/index.ts @@ -12,7 +12,6 @@ import { registerPipelineSaveRoute, } from './pipeline'; import { registerPipelinesListRoute, registerPipelinesDeleteRoute } from './pipelines'; -import { registerUpgradeRoute } from './upgrade'; export function registerRoutes(router: IRouter, security?: SecurityPluginSetup) { registerClusterLoadRoute(router); @@ -23,6 +22,4 @@ export function registerRoutes(router: IRouter, security?: SecurityPluginSetup) registerPipelinesListRoute(router); registerPipelinesDeleteRoute(router); - - registerUpgradeRoute(router); } diff --git a/x-pack/plugins/logstash/server/routes/upgrade/index.ts b/x-pack/plugins/logstash/server/routes/upgrade/index.ts deleted file mode 100644 index 3a5b0868b446b5..00000000000000 --- a/x-pack/plugins/logstash/server/routes/upgrade/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 { registerUpgradeRoute } from './upgrade'; diff --git a/x-pack/plugins/logstash/server/routes/upgrade/upgrade.ts b/x-pack/plugins/logstash/server/routes/upgrade/upgrade.ts deleted file mode 100644 index 2bd2c0f89e190f..00000000000000 --- a/x-pack/plugins/logstash/server/routes/upgrade/upgrade.ts +++ /dev/null @@ -1,46 +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 { IRouter } from 'src/core/server'; -import { wrapRouteWithLicenseCheck } from '../../../../licensing/server'; - -import { INDEX_NAMES } from '../../../common/constants'; -import { checkLicense } from '../../lib/check_license'; - -export function registerUpgradeRoute(router: IRouter) { - router.post( - { - path: '/api/logstash/upgrade', - validate: false, - }, - wrapRouteWithLicenseCheck( - checkLicense, - router.handleLegacyErrors(async (context, request, response) => { - const client = context.logstash!.esClient; - - const doesIndexExist = await client.callAsCurrentUser('indices.exists', { - index: INDEX_NAMES.PIPELINES, - }); - - // If index doesn't exist yet, there is no mapping to upgrade - if (doesIndexExist) { - await client.callAsCurrentUser('indices.putMapping', { - index: INDEX_NAMES.PIPELINES, - body: { - properties: { - pipeline_settings: { - dynamic: false, - type: 'object', - }, - }, - }, - }); - } - - return response.ok({ body: { is_upgraded: true } }); - }) - ) - ); -} diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 1dbd6858815c40..116a81361699f3 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -10907,11 +10907,6 @@ "xpack.logstash.managementSection.notPossibleToManagePipelinesMessage": "現在ライセンス情報が利用できないため Logstash パイプラインを使用できません。", "xpack.logstash.managementSection.pipelineCrudOperationsNotAllowedDescription": "ご使用の {licenseType} ライセンスは期限切れのため、Logstash パイプラインの編集、作成、削除ができません。", "xpack.logstash.managementSection.pipelinesTitle": "Logstashパイプライン", - "xpack.logstash.manualUpgradeButtonLabel": "再試行", - "xpack.logstash.newPipelineMessage": "パイプラインを追加する前に、構成をアップグレードする必要があります。", - "xpack.logstash.notManualUpgradeButtonLabel": "アップグレード", - "xpack.logstash.notManualUpgradeTitle": "アップグレードの時がやってきました!", - "xpack.logstash.notNewPipelineMessage": "このパイプラインを編集する前に、構成をアップグレードする必要があります。", "xpack.logstash.pipelineBatchDelayTooltip": "パイプラインイベントバッチを作成する際、それぞれのイベントでパイプラインワーカーにサイズの小さなバッチを送る前に何ミリ秒間待つかです。\n\nデフォルト値:50ms", "xpack.logstash.pipelineBatchSizeTooltip": "フィルターとアウトプットをを実行する前に各ワーカースレッドがインプットから収集するイベントの最低数です。基本的にバッチサイズが大きくなるほど効率が上がりますが、メモリーオーバーヘッドも大きくなります。このオプションを効率的に使用するには、LS_HEAP_SIZE 変数を設定して JVM のヒープサイズを増やす必要があるかもしれません。\n\nデフォルト値:125", "xpack.logstash.pipelineEditor.cancelButtonLabel": "キャンセル", @@ -10970,8 +10965,6 @@ "xpack.logstash.units.megabytesLabel": "メガバイト", "xpack.logstash.units.petabytesLabel": "ペタバイト", "xpack.logstash.units.terabytesLabel": "テラバイト", - "xpack.logstash.upgradeFailedTitle": "アップグレード失敗", - "xpack.logstash.upgradeFailureActions.goBackButtonLabel": "戻る", "xpack.logstash.upstreamPipelineArgumentMustContainAnIdPropertyErrorMessage": "upstreamPipeline 引数には id プロパティを含める必要があります", "xpack.logstash.workersTooltip": "パイプラインのフィルターとアウトプットステージを同時に実行するワーカーの数です。イベントが詰まってしまう場合や CPU が飽和状態ではない場合は、マシンの処理能力をより有効に活用するため、この数字を上げてみてください。\n\nデフォルト値:ホストの CPU コア数です", "xpack.maps.actionSelect.label": "アクション", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index 216f8a36948f5a..f03b720c8a77f1 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -10920,11 +10920,6 @@ "xpack.logstash.managementSection.notPossibleToManagePipelinesMessage": "您不能管理 Logstash 管道,因为许可信息当前不可用。", "xpack.logstash.managementSection.pipelineCrudOperationsNotAllowedDescription": "您不能编辑、创建或删除您的 Logstash 管道,因为您的{licenseType}许可已过期。", "xpack.logstash.managementSection.pipelinesTitle": "Logstash 管道", - "xpack.logstash.manualUpgradeButtonLabel": "重试", - "xpack.logstash.newPipelineMessage": "在您可以添加管道之前,我们需要升级您的配置。", - "xpack.logstash.notManualUpgradeButtonLabel": "升级", - "xpack.logstash.notManualUpgradeTitle": "是时候升级了!", - "xpack.logstash.notNewPipelineMessage": "在您可以编辑此管道之前,我们需要升级您的配置。", "xpack.logstash.pipelineBatchDelayTooltip": "创建管道事件批时,将过小的批分派给管道工作线程之前要等候每个事件的时长(毫秒)。\n\n默认值:50ms", "xpack.logstash.pipelineBatchSizeTooltip": "单个工作线程在尝试执行其筛选和输出之前可以从输入收集的最大事件数目。较大的批大小通常更有效,但代价是内存开销也较大。您可能需要通过设置 LS_HEAP_SIZE 变量来增大 JVM 堆大小,从而有效利用该选项。\n\n默认值:125", "xpack.logstash.pipelineEditor.cancelButtonLabel": "取消", @@ -10983,8 +10978,6 @@ "xpack.logstash.units.megabytesLabel": "兆字节", "xpack.logstash.units.petabytesLabel": "万兆字节", "xpack.logstash.units.terabytesLabel": "兆兆字节", - "xpack.logstash.upgradeFailedTitle": "升级失败", - "xpack.logstash.upgradeFailureActions.goBackButtonLabel": "返回", "xpack.logstash.upstreamPipelineArgumentMustContainAnIdPropertyErrorMessage": "upstreamPipeline 参数必须包含 id 属性", "xpack.logstash.workersTooltip": "并行执行管道的筛选和输出阶段的工作线程数目。如果您发现事件出现积压或 CPU 未饱和,请考虑增大此数值,以更好地利用机器处理能力。\n\n默认值:主机的 CPU 核心数", "xpack.maps.actionSelect.label": "操作", From 0ec7689249ba531cf8949b015ffca0674829628c Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 1 Jan 2021 01:26:53 -0700 Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=8D=BE=20update=20notice=20text=20for?= =?UTF-8?q?=202021?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NOTICE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NOTICE.txt b/NOTICE.txt index bf3cb4aa4ac87f..2341a478cbda90 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,5 +1,5 @@ Kibana source code with Kibana X-Pack source code -Copyright 2012-2020 Elasticsearch B.V. +Copyright 2012-2021 Elasticsearch B.V. --- Pretty handling of logarithmic axes. From 308827a67c70709b056c9ded38ddc50ef9cd06ad Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Fri, 1 Jan 2021 11:22:10 -0600 Subject: [PATCH 3/4] skip "should schedule actions on legacy alerts" #87010 --- .../security_and_spaces/tests/alerting/rbac_legacy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/rbac_legacy.ts b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/rbac_legacy.ts index 2b25c82cc92e5b..992d9210b9761b 100644 --- a/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/rbac_legacy.ts +++ b/x-pack/test/alerting_api_integration/security_and_spaces/tests/alerting/rbac_legacy.ts @@ -62,7 +62,7 @@ export default function alertTests({ getService }: FtrProviderContext) { }); }); - it('should schedule actions on legacy alerts', async () => { + it.skip('should schedule actions on legacy alerts', async () => { const reference = `alert:migrated-to-7.10:${user.username}`; const migratedAlertId = MIGRATED_ALERT_ID[user.username]; From 8d2e51d8fa4c0928eeccb03570c106983320e18f Mon Sep 17 00:00:00 2001 From: Maja Grubic Date: Mon, 4 Jan 2021 07:41:10 +0000 Subject: [PATCH 4/4] [Discover] Deangularize navbar in context app (#86353) * [Discover] Deangualrize navbar in context * Remove directive * Updating a unit test * Updating a unit test * Add cleanup in FilterItem component Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- .../data/public/ui/filter_bar/filter_item.tsx | 14 ++++-- .../application/angular/context_app.html | 13 +---- .../public/application/angular/context_app.js | 3 +- .../context_app/__mocks__/top_nav_menu.tsx | 22 +++++++++ .../context_app/context_app_legacy.test.tsx | 17 +++++++ .../context_app/context_app_legacy.tsx | 47 +++++++++++++------ .../context_app_legacy_directive.ts | 1 + .../discover/public/get_inner_angular.ts | 11 ----- src/plugins/navigation/public/index.ts | 2 +- 9 files changed, 88 insertions(+), 42 deletions(-) create mode 100644 src/plugins/discover/public/application/components/context_app/__mocks__/top_nav_menu.tsx diff --git a/src/plugins/data/public/ui/filter_bar/filter_item.tsx b/src/plugins/data/public/ui/filter_bar/filter_item.tsx index 5e6fd5323c0b70..7b65805a482ddb 100644 --- a/src/plugins/data/public/ui/filter_bar/filter_item.tsx +++ b/src/plugins/data/public/ui/filter_bar/filter_item.tsx @@ -71,19 +71,27 @@ export function FilterItem(props: Props) { useEffect(() => { const index = props.filter.meta.index; + let isSubscribed = true; if (index) { getIndexPatterns() .get(index) .then((indexPattern) => { - setIndexPatternExists(!!indexPattern); + if (isSubscribed) { + setIndexPatternExists(!!indexPattern); + } }) .catch(() => { - setIndexPatternExists(false); + if (isSubscribed) { + setIndexPatternExists(false); + } }); - } else { + } else if (isSubscribed) { // Allow filters without an index pattern and don't validate them. setIndexPatternExists(true); } + return () => { + isSubscribed = false; + }; }, [props.filter.meta.index]); function handleBadgeClick(e: MouseEvent) { diff --git a/src/plugins/discover/public/application/angular/context_app.html b/src/plugins/discover/public/application/angular/context_app.html index d20b1ca999af92..8dc3e5c87e5045 100644 --- a/src/plugins/discover/public/application/angular/context_app.html +++ b/src/plugins/discover/public/application/angular/context_app.html @@ -1,15 +1,3 @@ - - - diff --git a/src/plugins/discover/public/application/angular/context_app.js b/src/plugins/discover/public/application/angular/context_app.js index 145d3afe232243..d9e2452eb8bd6d 100644 --- a/src/plugins/discover/public/application/angular/context_app.js +++ b/src/plugins/discover/public/application/angular/context_app.js @@ -56,13 +56,14 @@ getAngularModule().directive('contextApp', function ContextApp() { }); function ContextAppController($scope, Private) { - const { filterManager, indexPatterns, uiSettings } = getServices(); + const { filterManager, indexPatterns, uiSettings, navigation } = getServices(); const queryParameterActions = getQueryParameterActions(filterManager, indexPatterns); const queryActions = Private(QueryActionsProvider); this.state = createInitialState( parseInt(uiSettings.get(CONTEXT_STEP_SETTING), 10), getFirstSortableField(this.indexPattern, uiSettings.get(CONTEXT_TIE_BREAKER_FIELDS_SETTING)) ); + this.topNavMenu = navigation.ui.TopNavMenu; this.actions = _.mapValues( { diff --git a/src/plugins/discover/public/application/components/context_app/__mocks__/top_nav_menu.tsx b/src/plugins/discover/public/application/components/context_app/__mocks__/top_nav_menu.tsx new file mode 100644 index 00000000000000..be02fd7bc46d2d --- /dev/null +++ b/src/plugins/discover/public/application/components/context_app/__mocks__/top_nav_menu.tsx @@ -0,0 +1,22 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; + +export const TopNavMenuMock = () =>
Hello World
; diff --git a/src/plugins/discover/public/application/components/context_app/context_app_legacy.test.tsx b/src/plugins/discover/public/application/components/context_app/context_app_legacy.test.tsx index f76e0178e98b06..cf6dc70e92d038 100644 --- a/src/plugins/discover/public/application/components/context_app/context_app_legacy.test.tsx +++ b/src/plugins/discover/public/application/components/context_app/context_app_legacy.test.tsx @@ -25,6 +25,7 @@ import { DocTableLegacy } from '../../angular/doc_table/create_doc_table_react'; import { findTestSubject } from '@elastic/eui/lib/test'; import { ActionBar } from '../../angular/context/components/action_bar/action_bar'; import { ContextErrorMessage } from '../context_error_message'; +import { TopNavMenuMock } from './__mocks__/top_nav_menu'; describe('ContextAppLegacy test', () => { const hit = { @@ -64,6 +65,17 @@ describe('ContextAppLegacy test', () => { onChangeSuccessorCount: jest.fn(), predecessorStatus: 'loaded', successorStatus: 'loaded', + topNavMenu: TopNavMenuMock, + }; + const topNavProps = { + appName: 'context', + showSearchBar: true, + showQueryBar: false, + showFilterBar: true, + showSaveQuery: false, + showDatePicker: false, + indexPatterns: [indexPattern], + useDefaultBehaviors: true, }; it('renders correctly', () => { @@ -72,6 +84,9 @@ describe('ContextAppLegacy test', () => { const loadingIndicator = findTestSubject(component, 'contextApp_loadingIndicator'); expect(loadingIndicator.length).toBe(0); expect(component.find(ActionBar).length).toBe(2); + const topNavMenu = component.find(TopNavMenuMock); + expect(topNavMenu.length).toBe(1); + expect(topNavMenu.props()).toStrictEqual(topNavProps); }); it('renders loading indicator', () => { @@ -82,6 +97,7 @@ describe('ContextAppLegacy test', () => { const loadingIndicator = findTestSubject(component, 'contextApp_loadingIndicator'); expect(loadingIndicator.length).toBe(1); expect(component.find(ActionBar).length).toBe(2); + expect(component.find(TopNavMenuMock).length).toBe(1); }); it('renders error message', () => { @@ -90,6 +106,7 @@ describe('ContextAppLegacy test', () => { props.reason = 'something went wrong'; const component = mountWithIntl(); expect(component.find(DocTableLegacy).length).toBe(0); + expect(component.find(TopNavMenuMock).length).toBe(0); const errorMessage = component.find(ContextErrorMessage); expect(errorMessage.length).toBe(1); }); diff --git a/src/plugins/discover/public/application/components/context_app/context_app_legacy.tsx b/src/plugins/discover/public/application/components/context_app/context_app_legacy.tsx index af99c995c60eb2..f519df8a0b80db 100644 --- a/src/plugins/discover/public/application/components/context_app/context_app_legacy.tsx +++ b/src/plugins/discover/public/application/components/context_app/context_app_legacy.tsx @@ -27,8 +27,10 @@ import { import { IIndexPattern, IndexPatternField } from '../../../../../data/common/index_patterns'; import { LOADING_STATUS } from './constants'; import { ActionBar, ActionBarProps } from '../../angular/context/components/action_bar/action_bar'; +import { TopNavMenuProps } from '../../../../../navigation/public'; export interface ContextAppProps { + topNavMenu: React.ComponentType; columns: string[]; hits: Array>; indexPattern: IIndexPattern; @@ -96,6 +98,20 @@ export function ContextAppLegacy(renderProps: ContextAppProps) { } as DocTableLegacyProps; }; + const TopNavMenu = renderProps.topNavMenu; + const getNavBarProps = () => { + return { + appName: 'context', + showSearchBar: true, + showQueryBar: false, + showFilterBar: true, + showSaveQuery: false, + showDatePicker: false, + indexPatterns: [renderProps.indexPattern], + useDefaultBehaviors: true, + }; + }; + const loadingFeedback = () => { if (status === LOADING_STATUS.UNINITIALIZED || status === LOADING_STATUS.LOADING) { return ( @@ -112,20 +128,23 @@ export function ContextAppLegacy(renderProps: ContextAppProps) { {isFailed ? ( ) : ( - - - - {loadingFeedback()} - - {isLoaded ? ( -
- -
- ) : null} - - -
-
+
+ + + + + {loadingFeedback()} + + {isLoaded ? ( +
+ +
+ ) : null} + + +
+
+
)} ); diff --git a/src/plugins/discover/public/application/components/context_app/context_app_legacy_directive.ts b/src/plugins/discover/public/application/components/context_app/context_app_legacy_directive.ts index bc4b7c4babd21e..dfb5d90c2befe7 100644 --- a/src/plugins/discover/public/application/components/context_app/context_app_legacy_directive.ts +++ b/src/plugins/discover/public/application/components/context_app/context_app_legacy_directive.ts @@ -37,5 +37,6 @@ export function createContextAppLegacy(reactDirective: any) { ['successorAvailable', { watchDepth: 'reference' }], ['successorStatus', { watchDepth: 'reference' }], ['onChangeSuccessorCount', { watchDepth: 'reference' }], + ['topNavMenu', { watchDepth: 'reference' }], ]); } diff --git a/src/plugins/discover/public/get_inner_angular.ts b/src/plugins/discover/public/get_inner_angular.ts index 2ace65c31cc036..c32cf3023a25e5 100644 --- a/src/plugins/discover/public/get_inner_angular.ts +++ b/src/plugins/discover/public/get_inner_angular.ts @@ -50,8 +50,6 @@ import { PromiseServiceCreator, registerListenEventListener, watchMultiDecorator, - createTopNavDirective, - createTopNavHelper, } from '../../kibana_legacy/public'; import { DiscoverStartPlugins } from './plugin'; import { getScopedHistory } from './kibana_services'; @@ -98,7 +96,6 @@ export function initializeInnerAngularModule( createLocalI18nModule(); createLocalPrivateModule(); createLocalPromiseModule(); - createLocalTopNavModule(navigation); createLocalStorageModule(); createPagerFactoryModule(); createDocTableModule(); @@ -131,7 +128,6 @@ export function initializeInnerAngularModule( 'discoverI18n', 'discoverPrivate', 'discoverPromise', - 'discoverTopNav', 'discoverLocalStorageProvider', 'discoverDocTable', 'discoverPagerFactory', @@ -151,13 +147,6 @@ function createLocalPrivateModule() { angular.module('discoverPrivate', []).provider('Private', PrivateProvider); } -function createLocalTopNavModule(navigation: NavigationStart) { - angular - .module('discoverTopNav', ['react']) - .directive('kbnTopNav', createTopNavDirective) - .directive('kbnTopNavHelper', createTopNavHelper(navigation.ui)); -} - function createLocalI18nModule() { angular .module('discoverI18n', []) diff --git a/src/plugins/navigation/public/index.ts b/src/plugins/navigation/public/index.ts index 5afc91c4445e8a..a1b72eac756d3c 100644 --- a/src/plugins/navigation/public/index.ts +++ b/src/plugins/navigation/public/index.ts @@ -24,7 +24,7 @@ export function plugin(initializerContext: PluginInitializerContext) { return new NavigationPublicPlugin(initializerContext); } -export { TopNavMenuData, TopNavMenu } from './top_nav_menu'; +export { TopNavMenuData, TopNavMenu, TopNavMenuProps } from './top_nav_menu'; export { NavigationPublicPluginSetup, NavigationPublicPluginStart } from './types';