Skip to content

Commit

Permalink
[Upgrade Assistant] Swapped reindexing flyouts order (elastic#115046)
Browse files Browse the repository at this point in the history
* [Upgrade Assistant] Changed reindexing steps order, replaced a warning callout with a text element

* [Upgrade Assistant] Fixed reindex flyout test and changed warning callout from danger color to warning color

* [Upgrade Assistant] Fixed the correct status to show warnings

* [Upgrade Assistant] Fixed i18n strings

* [Upgrade Assistant] Moved reindex with warnings logic into a function

* [Upgrade Assistant] Updated reindex flyout copy

* [Upgrade Assistant] Also added a trailing period to the reindex step 3

* [Upgrade Assistant] Fixed i18n strings and step 3 wording

* [Upgrade Assistant] Added docs changes

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
2 people authored and sabarasaba committed Oct 20, 2021
1 parent bcc9578 commit d3b0596
Show file tree
Hide file tree
Showing 14 changed files with 257 additions and 229 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ readonly links: {
readonly upgradeAssistant: {
readonly overview: string;
readonly batchReindex: string;
readonly remoteReindex: string;
};
readonly rollupJobs: string;
readonly elasticsearch: Record<string, string>;
Expand Down
2 changes: 2 additions & 0 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ export class DocLinksService {
upgradeAssistant: {
overview: `${KIBANA_DOCS}upgrade-assistant.html`,
batchReindex: `${KIBANA_DOCS}batch-start-resume-reindex.html`,
remoteReindex: `${ELASTICSEARCH_DOCS}docs-reindex.html#reindex-from-remote`,
},
rollupJobs: `${KIBANA_DOCS}data-rollups.html`,
elasticsearch: {
Expand Down Expand Up @@ -646,6 +647,7 @@ export interface DocLinksStart {
readonly upgradeAssistant: {
readonly overview: string;
readonly batchReindex: string;
readonly remoteReindex: string;
};
readonly rollupJobs: string;
readonly elasticsearch: Record<string, string>;
Expand Down
1 change: 1 addition & 0 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,7 @@ export interface DocLinksStart {
readonly upgradeAssistant: {
readonly overview: string;
readonly batchReindex: string;
readonly remoteReindex: string;
};
readonly rollupJobs: string;
readonly elasticsearch: Record<string, string>;
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -25347,8 +25347,6 @@
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.continueButtonLabel": "再インデックスを続ける",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.insufficientPrivilegeCallout.calloutTitle": "このインデックスを再インデックスするための権限がありません",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.backgroundResumeDetail": "再インデックスはバックグラウンドで継続しますが、Kibana がシャットダウンまたは再起動した場合、このページに戻り再インデックスを再開させる必要があります。",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.calloutTitle": "インデックスは再インデックス中にドキュメントを投入、更新、または削除できません",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.cantStopDetail": "ドキュメントの更新を停止できない場合、または新しいクラスターに再インデックスする必要がある場合は、異なるアップグレード方法をお勧めします。",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.reindexingLabel": "再インデックス中…",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.resumeLabel": "再開",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.runReindexLabel": "再インデックスを実行",
Expand Down
2 changes: 0 additions & 2 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -25779,8 +25779,6 @@
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.continueButtonLabel": "继续重新索引",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.insufficientPrivilegeCallout.calloutTitle": "您没有足够的权限来重新索引此索引",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.backgroundResumeDetail": "重新索引将在后台继续,但如果 Kibana 关闭或重新启动,您将需要返回此页,才能恢复重新索引。",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.calloutTitle": "在重新索引时,索引无法采集、更新或删除文档",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.cantStopDetail": "如果您无法停止文档更新或需要重新索引到新的集群中,请考虑使用不同的升级策略。",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.reindexingLabel": "正在重新索引……",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.resumeLabel": "恢复",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.runReindexLabel": "运行重新索引",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,24 @@ import { LoadingState } from '../../../../types';
import type { ReindexState } from '../use_reindex_state';
import { ChecklistFlyoutStep } from './checklist_step';

jest.mock('../../../../../app_context', () => {
const { docLinksServiceMock } = jest.requireActual(
'../../../../../../../../../../src/core/public/doc_links/doc_links_service.mock'
);

return {
useAppContext: () => {
return {
services: {
core: {
docLinks: docLinksServiceMock.createStartContract(),
},
},
};
},
};
});

describe('ChecklistFlyout', () => {
const defaultProps = {
indexName: 'myIndex',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import React, { Fragment, useCallback } from 'react';
import React, { Fragment } from 'react';

import {
EuiButton,
Expand All @@ -15,20 +15,18 @@ import {
EuiFlexItem,
EuiFlyoutBody,
EuiFlyoutFooter,
EuiLink,
EuiSpacer,
EuiText,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n/react';
import { METRIC_TYPE } from '@kbn/analytics';
import { i18n } from '@kbn/i18n';

import { ReindexStatus } from '../../../../../../../common/types';
import {
uiMetricService,
UIM_REINDEX_START_CLICK,
UIM_REINDEX_STOP_CLICK,
} from '../../../../../lib/ui_metric';
import { LoadingState } from '../../../../types';
import type { ReindexState } from '../use_reindex_state';
import { ReindexProgress } from './progress';
import { useAppContext } from '../../../../../app_context';

const buttonLabel = (status?: ReindexStatus) => {
switch (status) {
Expand All @@ -50,21 +48,21 @@ const buttonLabel = (status?: ReindexStatus) => {
return (
<FormattedMessage
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.resumeLabel"
defaultMessage="Resume"
defaultMessage="Resume reindexing"
/>
);
case ReindexStatus.cancelled:
return (
<FormattedMessage
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.restartLabel"
defaultMessage="Restart reindex"
defaultMessage="Restart reindexing"
/>
);
default:
return (
<FormattedMessage
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexButton.runReindexLabel"
defaultMessage="Run reindex"
defaultMessage="Start reindexing"
/>
);
}
Expand All @@ -79,22 +77,18 @@ export const ChecklistFlyoutStep: React.FunctionComponent<{
startReindex: () => void;
cancelReindex: () => void;
}> = ({ closeFlyout, reindexState, startReindex, cancelReindex }) => {
const {
services: {
core: { docLinks },
},
} = useAppContext();

const { loadingState, status, hasRequiredPrivileges } = reindexState;
const loading = loadingState === LoadingState.Loading || status === ReindexStatus.inProgress;
const isCompleted = status === ReindexStatus.completed;
const hasFetchFailed = status === ReindexStatus.fetchFailed;
const hasReindexingFailed = status === ReindexStatus.failed;

const onStartReindex = useCallback(() => {
uiMetricService.trackUiMetric(METRIC_TYPE.CLICK, UIM_REINDEX_START_CLICK);
startReindex();
}, [startReindex]);

const onStopReindex = useCallback(() => {
uiMetricService.trackUiMetric(METRIC_TYPE.CLICK, UIM_REINDEX_STOP_CLICK);
cancelReindex();
}, [cancelReindex]);

return (
<Fragment>
<EuiFlyoutBody>
Expand Down Expand Up @@ -138,33 +132,34 @@ export const ChecklistFlyoutStep: React.FunctionComponent<{
</EuiCallOut>
</>
)}
<EuiCallOut
title={
<FormattedMessage
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.calloutTitle"
defaultMessage="Index is unable to ingest, update, or delete documents while reindexing"
/>
}
color="warning"
iconType="alert"
>
<EuiText>
<p>
<FormattedMessage
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.cantStopDetail"
defaultMessage="If you can’t stop document updates or need to reindex into a new cluster,
consider using a different upgrade strategy."
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexDescription"
defaultMessage="The index will be read-only during reindexing. You won't be able to add, update, or delete documents until reindexing is complete. If you need to reindex to a new cluster, use the reindex API. {docsLink}"
values={{
docsLink: (
<EuiLink target="_blank" href={docLinks.links.upgradeAssistant.remoteReindex}>
{i18n.translate(
'xpack.upgradeAssistant.checkupTab.reindexing.flyout.learnMoreLinkLabel',
{
defaultMessage: 'Learn more',
}
)}
</EuiLink>
),
}}
/>
</p>
<p>
<FormattedMessage
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.readonlyCallout.backgroundResumeDetail"
defaultMessage="Reindexing will continue in the background, but if Kibana shuts down or restarts you will
need to return to this page to resume reindexing."
defaultMessage="Reindexing is performed in the background. You can return to the Upgrade Assistant to view progress or resume reindexing after a Kibana restart."
/>
</p>
</EuiCallOut>
</EuiText>
<EuiSpacer />
<ReindexProgress reindexState={reindexState} cancelReindex={onStopReindex} />
<ReindexProgress reindexState={reindexState} cancelReindex={cancelReindex} />
</EuiFlyoutBody>
<EuiFlyoutFooter>
<EuiFlexGroup justifyContent="spaceBetween">
Expand All @@ -182,7 +177,7 @@ export const ChecklistFlyoutStep: React.FunctionComponent<{
fill
color={status === ReindexStatus.paused ? 'warning' : 'primary'}
iconType={status === ReindexStatus.paused ? 'play' : undefined}
onClick={onStartReindex}
onClick={startReindex}
isLoading={loading}
disabled={loading || !hasRequiredPrivileges}
data-test-subj="startReindexingButton"
Expand Down
Loading

0 comments on commit d3b0596

Please sign in to comment.