diff --git a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/button.tsx b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/button.tsx index c1117b64c008b9..6addd3dae642ab 100644 --- a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/button.tsx +++ b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/button.tsx @@ -9,6 +9,7 @@ import React, { Fragment, ReactNode } from 'react'; import { Subscription } from 'rxjs'; import { EuiButton, EuiLoadingSpinner } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; import { kfetch } from 'ui/kfetch'; import { ReindexStatus, UIReindexOption } from '../../../../../../common/types'; import { LoadingState } from '../../../../types'; @@ -63,11 +64,21 @@ export class ReindexButton extends React.Component + ); if (reindexState.loadingState === LoadingState.Loading) { buttonProps.disabled = true; - buttonContent = 'Loading…'; + buttonContent = ( + + ); } else { switch (reindexState.status) { case ReindexStatus.inProgress: @@ -81,24 +92,44 @@ export class ReindexButton extends React.Component + ); break; case ReindexStatus.failed: buttonProps.color = 'danger'; buttonProps.iconSide = 'left'; buttonProps.iconType = 'cross'; - buttonContent = 'Failed'; + buttonContent = ( + + ); break; case ReindexStatus.paused: buttonProps.color = 'warning'; buttonProps.iconSide = 'left'; buttonProps.iconType = 'pause'; - buttonContent = 'Paused'; + buttonContent = ( + + ); case ReindexStatus.cancelled: buttonProps.color = 'danger'; buttonProps.iconSide = 'left'; buttonProps.iconType = 'cross'; - buttonContent = 'Cancelled'; + buttonContent = ( + + ); break; } } diff --git a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap index b1372cc9d985c8..77098392aeb831 100644 --- a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap +++ b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/__snapshots__/checklist_step.test.tsx.snap @@ -7,13 +7,29 @@ exports[`ChecklistFlyout renders 1`] = ` color="warning" iconType="alert" size="m" - title="Index is unable to ingest, update, or delete documents while reindexing" + title={ + + } >

- If you can’t stop document updates or need to reindex into a new cluster, consider using a different upgrade strategy. +

- Reindexing will continue in the background, but if Kibana shuts down or restarts you will need to return to this page to resume reindexing. +

- Reindexing process +

- Close + - Run reindex + diff --git a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/__snapshots__/warning_step.test.tsx.snap b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/__snapshots__/warning_step.test.tsx.snap index c1e7e58813425c..2059e351d5e8c1 100644 --- a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/__snapshots__/warning_step.test.tsx.snap +++ b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/__snapshots__/warning_step.test.tsx.snap @@ -7,129 +7,114 @@ exports[`WarningsFlyoutStep renders 1`] = ` color="danger" iconType="alert" size="m" - title="This index requires destructive changes that can't be undone" + title={ + + } >

- Back up your index, then proceed with the reindex by accepting each breaking change. +

- - - - _all - - field will be removed - + -

- The - - _all - - meta field is no longer supported in 7.0. Reindexing removes the - - _all - - field in the new index. Ensure that no application code or scripts reply on this field. -
- - Documentation - -

-
- + _all + , + } + } + /> + } + documentationUrl="https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_the_literal__all_literal_meta_field_is_now_disabled_by_default" + label={ + + _all + , + } + } + /> + } + onChange={[Function]} + warning={0} /> - - - Boolean data in - - _source - - might change - + -

- If a documents contain a boolean field that is neither - - true - - or - - - false - - (for example, - - "yes" - - , - - - "on" - - , - - 1 - - ), reindexing converts these fields to - - true - - or - - false - - . Ensure that no application code or scripts rely on boolean fields in the deprecated format. -
- - Documentation - -

-
- + false + , + "on": + "on" + , + "one": + 1 + , + "true": + true + , + "yes": + "yes" + , + } + } + /> + } + documentationUrl="https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_field" + label={ + + _source + , + } + } + /> + } + onChange={[Function]} + warning={1} /> @@ -154,7 +139,11 @@ exports[`WarningsFlyoutStep renders 1`] = ` onClick={[MockFunction]} type="button" > - Cancel + - Continue with reindex + diff --git a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/checklist_step.tsx b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/checklist_step.tsx index 7d4ce595f03a7e..631258dd496f3d 100644 --- a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/checklist_step.tsx +++ b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/checklist_step.tsx @@ -17,6 +17,8 @@ import { EuiSpacer, EuiTitle, } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; + import { ReindexStatus } from '../../../../../../../common/types'; import { LoadingState } from '../../../../../types'; import { ReindexState } from '../polling_service'; @@ -25,15 +27,40 @@ import { ReindexProgress } from './progress'; const buttonLabel = (status?: ReindexStatus) => { switch (status) { case ReindexStatus.failed: - return 'Try again'; + return ( + + ); case ReindexStatus.inProgress: - return 'Reindexing…'; + return ( + + ); case ReindexStatus.completed: - return 'Done!'; + return ( + + ); case ReindexStatus.paused: - return 'Resume'; + return ( + + ); default: - return 'Run reindex'; + return ( + + ); } }; @@ -53,24 +80,40 @@ export const ChecklistFlyoutStep: React.StatelessComponent<{ + } color="warning" iconType="alert" >

- If you can’t stop document updates or need to reindex into a new cluster, consider using - a different upgrade strategy. +

- Reindexing will continue in the background, but if Kibana shuts down or restarts you - will need to return to this page to resume reindexing. +

{!hasRequiredPrivileges && ( + } color="danger" iconType="alert" /> @@ -78,7 +121,12 @@ export const ChecklistFlyoutStep: React.StatelessComponent<{ )} -

Reindexing process

+

+ +

@@ -86,7 +134,10 @@ export const ChecklistFlyoutStep: React.StatelessComponent<{ - Close + diff --git a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/container.tsx b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/container.tsx index 97c3eb778d4581..fa619140bcd160 100644 --- a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/container.tsx +++ b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/container.tsx @@ -7,6 +7,7 @@ import React from 'react'; import { EuiFlyout, EuiFlyoutHeader, EuiPortal, EuiTitle } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; import { ReindexState } from '../polling_service'; import { ChecklistFlyoutStep } from './checklist_step'; @@ -80,7 +81,13 @@ export class ReindexFlyout extends React.Component -

Reindex {indexName}

+

+ +

{flyoutContents} diff --git a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/progress.test.tsx b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/progress.test.tsx index a51e6e42da4a0b..a279ffa0981232 100644 --- a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/progress.test.tsx +++ b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/progress.test.tsx @@ -33,19 +33,35 @@ describe('ReindexProgress', () => { Array [ Object { "status": "incomplete", - "title": "Setting old index to read-only", + "title": , }, Object { "status": "incomplete", - "title": "Creating new index", + "title": , }, Object { "status": "incomplete", - "title": "Reindexing documents", + "title": , }, Object { "status": "incomplete", - "title": "Swapping original index with alias", + "title": , }, ] } @@ -116,27 +132,51 @@ describe('ReindexProgress', () => { Array [ Object { "status": "inProgress", - "title": "Pausing Machine Learning jobs", + "title": , }, Object { "status": "incomplete", - "title": "Setting old index to read-only", + "title": , }, Object { "status": "incomplete", - "title": "Creating new index", + "title": , }, Object { "status": "incomplete", - "title": "Reindexing documents", + "title": , }, Object { "status": "incomplete", - "title": "Swapping original index with alias", + "title": , }, Object { "status": "incomplete", - "title": "Resuming Machine Learning jobs", + "title": , }, ] } diff --git a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/progress.tsx b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/progress.tsx index c5b43bf04d8ca4..108df51904ee1b 100644 --- a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/progress.tsx +++ b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/progress.tsx @@ -14,6 +14,7 @@ import { EuiProgress, EuiText, } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; import { IndexGroup, ReindexStatus, ReindexStep } from '../../../../../../../common/types'; import { LoadingState } from '../../../../../types'; @@ -50,19 +51,40 @@ const ReindexProgressBar: React.StatelessComponent<{ ); - let cancelText: string; + let cancelText: React.ReactNode; switch (cancelLoadingState) { case LoadingState.Loading: - cancelText = 'Cancelling…'; + cancelText = ( + + ); break; case LoadingState.Success: - cancelText = 'Cancelled'; + cancelText = ( + + ); break; case LoadingState.Error: cancelText = 'Could not cancel'; + cancelText = ( + + ); break; default: - cancelText = 'Cancel'; + cancelText = ( + + ); } return ( @@ -130,7 +152,15 @@ export const ReindexProgress: React.StatelessComponent<{ // The reindexing step is special because it combines the starting and complete statuses into a single UI // with a progress bar. - const reindexingDocsStep = { title: 'Reindexing documents' } as StepProgressStep; + const reindexingDocsStep = { + title: ( + + ), + } as StepProgressStep; + if ( status === ReindexStatus.failed && (lastCompletedStep === ReindexStep.newIndexCreated || @@ -165,16 +195,31 @@ export const ReindexProgress: React.StatelessComponent<{ const steps = [ { - title: 'Setting old index to read-only', + title: ( + + ), ...stepDetails(ReindexStep.readonly), }, { - title: 'Creating new index', + title: ( + + ), ...stepDetails(ReindexStep.newIndexCreated), }, reindexingDocsStep, { - title: 'Swapping original index with alias', + title: ( + + ), ...stepDetails(ReindexStep.aliasCreated), }, ]; @@ -182,20 +227,40 @@ export const ReindexProgress: React.StatelessComponent<{ // If this index is part of an index group, add the approriate group services steps. if (indexGroup === IndexGroup.ml) { steps.unshift({ - title: 'Pausing Machine Learning jobs', + title: ( + + ), ...stepDetails(ReindexStep.indexGroupServicesStopped), }); steps.push({ - title: 'Resuming Machine Learning jobs', + title: ( + + ), ...stepDetails(ReindexStep.indexGroupServicesStarted), }); } else if (indexGroup === IndexGroup.watcher) { steps.unshift({ - title: 'Stopping Watcher', + title: ( + + ), ...stepDetails(ReindexStep.indexGroupServicesStopped), }); steps.push({ - title: 'Resuming Watcher', + title: ( + + ), ...stepDetails(ReindexStep.indexGroupServicesStarted), }); } diff --git a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/step_progress.tsx b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/step_progress.tsx index 5e44b5f58e351e..78537b16cc9c60 100644 --- a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/step_progress.tsx +++ b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/step_progress.tsx @@ -71,7 +71,7 @@ const Step: React.StatelessComponent = ({ }; export interface StepProgressStep { - title: string; + title: React.ReactNode; status: STATUS; children?: ReactNode; } @@ -84,8 +84,9 @@ export const StepProgress: React.StatelessComponent<{ }> = ({ steps }) => { return (
+ {/* Use the index as the key only works here because these values do not change order after mounting. */} {steps.map((step, idx) => ( - + ))}
); diff --git a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/warning_step.test.tsx b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/warning_step.test.tsx index 230878a2fd31b3..0ba13fc630c6ed 100644 --- a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/warning_step.test.tsx +++ b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/warning_step.test.tsx @@ -4,6 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ +import { I18nProvider } from '@kbn/i18n/react'; import { mount, shallow } from 'enzyme'; import React from 'react'; @@ -22,7 +23,11 @@ describe('WarningsFlyoutStep', () => { }); it('does not allow proceeding until all are checked', () => { - const wrapper = mount(); + const wrapper = mount( + + + + ); const button = wrapper.find('EuiButton'); button.simulate('click'); diff --git a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/warnings_step.tsx b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/warnings_step.tsx index d14248b90064be..d4602b99c94b2c 100644 --- a/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/warnings_step.tsx +++ b/x-pack/plugins/upgrade_assistant/public/components/tabs/checkup/deprecations/reindex/flyout/warnings_step.tsx @@ -20,10 +20,47 @@ import { EuiSpacer, EuiText, } from '@elastic/eui'; +import { FormattedMessage } from '@kbn/i18n/react'; import { ReindexWarning } from '../../../../../../../common/types'; +interface CheckedIds { + [id: string]: boolean; +} + export const idForWarning = (warning: ReindexWarning) => `reindexWarning-${warning}`; +const WarningCheckbox: React.StatelessComponent<{ + checkedIds: CheckedIds; + warning: ReindexWarning; + label: React.ReactNode; + description: React.ReactNode; + documentationUrl: string; + onChange: (event: React.ChangeEvent) => void; +}> = ({ checkedIds, warning, label, onChange, description, documentationUrl }) => ( + + + {label}} + checked={checkedIds[idForWarning(warning)]} + onChange={onChange} + /> +

+ {description} +
+ + + +

+
+ + +
+); + interface WarningsConfirmationFlyoutProps { closeFlyout: () => void; warnings: ReindexWarning[]; @@ -31,7 +68,7 @@ interface WarningsConfirmationFlyoutProps { } interface WarningsConfirmationFlyoutState { - checkedIds: { [id: string]: boolean }; + checkedIds: CheckedIds; } /** @@ -67,117 +104,123 @@ export class WarningsFlyoutStep extends React.Component< + } color="danger" iconType="alert" >

- Back up your index, then proceed with the reindex by accepting each breaking change. +

{warnings.includes(ReindexWarning.allField) && ( - - - - _all field will be removed - - } - checked={checkedIds[idForWarning(ReindexWarning.allField)]} - onChange={this.onChange} + _all, + }} + /> + } + description={ + _all, + }} /> -

- The _all meta field is no longer supported in 7.0. Reindexing - removes the _all field in the new index. Ensure that no - application code or scripts reply on this field. -
- - Documentation - -

-
- - -
+ } + documentationUrl="https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_the_literal__all_literal_meta_field_is_now_disabled_by_default" + /> )} {warnings.includes(ReindexWarning.apmReindex) && ( - - - This index will be converted to ECS format} - checked={checkedIds[idForWarning(ReindexWarning.apmReindex)]} - onChange={this.onChange} + -

- Starting in version 7.0.0, APM data will be represented in the Elastic Common - Schema. Historical APM data will not visible until it's reindexed. -
- - Documentation - -

-
- - -
+ } + description={ + + } + documentationUrl="https://www.elastic.co/guide/en/apm/get-started/master/apm-release-notes.html" + /> )} {warnings.includes(ReindexWarning.booleanFields) && ( - - - - Boolean data in _source might change - - } - checked={checkedIds[idForWarning(ReindexWarning.booleanFields)]} - onChange={this.onChange} + _source }} + /> + } + description={ + true, + false: false, + yes: "yes", + on: "on", + one: 1, + }} /> -

- If a documents contain a boolean field that is neither true or{' '} - false (for example, "yes",{' '} - "on", 1), reindexing converts these fields - to true or false. Ensure that no application - code or scripts rely on boolean fields in the deprecated format. -
- - Documentation - -

-
- - -
+ } + documentationUrl="https://www.elastic.co/guide/en/elasticsearch/reference/6.0/breaking_60_mappings_changes.html#_coercion_of_boolean_field" + /> )}
- Cancel + - Continue with reindex +