Skip to content

Commit

Permalink
[Upgrade Assistant] Removed "closed index" warning from reindex flyout (
Browse files Browse the repository at this point in the history
elastic#114861)

* [Upgrade Assistant] Removed "closed index" warning that reindexing might take longer than usual, which is not the case

* [Upgrade Assistant] Also deleted i18n strings that are not needed anymore
  • Loading branch information
yuliacech authored and sabarasaba committed Oct 26, 2021
1 parent 3589dde commit bed98ef
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 78 deletions.
4 changes: 0 additions & 4 deletions x-pack/plugins/translations/translations/ja-JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -25186,10 +25186,6 @@
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.readonlyStepTitle": "古いインデックスを読み込み専用に設定中",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.reindexingDocumentsStepTitle": "ドキュメントを再インデックス中",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklistTitle": "プロセスを再インデックス中",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutDetails": "このインデックスは現在閉じています。アップグレードアシスタントが開き、再インデックスを実行してからインデックスを閉じます。 {reindexingMayTakeLongerEmph}。詳細については {docs} をご覧ください。",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutDetails.reindexingTakesLongerEmphasis": "再インデックスには通常よりも時間がかかることがあります",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutTitle": "インデックスが閉じました",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.openAndCloseDocumentation": "ドキュメンテーション",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.customTypeNameWarningDetail": "マッピングタイプは8.0ではサポートされていません。アプリケーションコードまたはスクリプトが{mappingType}に依存していないことを確認してください。",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.customTypeNameWarningTitle": "マッピングタイプ{mappingType}を{defaultType}で置き換えます",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.deprecatedIndexSettingsWarningDetail": "次の廃止予定のインデックス設定が検出されました。",
Expand Down
4 changes: 0 additions & 4 deletions x-pack/plugins/translations/translations/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -25615,10 +25615,6 @@
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.readonlyStepTitle": "正在将旧索引设置为只读",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklist.reindexingDocumentsStepTitle": "正在重新索引文档",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.checklistStep.reindexingChecklistTitle": "重新索引过程",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutDetails": "此索引当前已关闭。升级助手将打开索引,重新索引,然后关闭索引。{reindexingMayTakeLongerEmph}。请参阅文档{docs}以了解更多信息。",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutDetails.reindexingTakesLongerEmphasis": "重新索引可能比通常花费更多的时间",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutTitle": "索引已关闭",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.openAndCloseDocumentation": "文档",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.customTypeNameWarningDetail": "映射类型在 8.0 中不再受支持。确保没有应用程序代码或脚本依赖 {mappingType}。",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.customTypeNameWarningTitle": "将映射类型 {mappingType} 替换为 {defaultType}",
"xpack.upgradeAssistant.checkupTab.reindexing.flyout.warningsStep.deprecatedIndexSettingsWarningDetail": "检测到以下弃用的索引设置:",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,11 @@ const buttonLabel = (status?: ReindexStatus) => {
* Displays a flyout that shows the current reindexing status for a given index.
*/
export const ChecklistFlyoutStep: React.FunctionComponent<{
renderGlobalCallouts: () => React.ReactNode;
closeFlyout: () => void;
reindexState: ReindexState;
startReindex: () => void;
cancelReindex: () => void;
}> = ({ closeFlyout, reindexState, startReindex, cancelReindex, renderGlobalCallouts }) => {
}> = ({ closeFlyout, reindexState, startReindex, cancelReindex }) => {
const { loadingState, status, hasRequiredPrivileges } = reindexState;
const loading = loadingState === LoadingState.Loading || status === ReindexStatus.inProgress;
const isCompleted = status === ReindexStatus.completed;
Expand Down Expand Up @@ -116,7 +115,6 @@ export const ChecklistFlyoutStep: React.FunctionComponent<{
</EuiCallOut>
</>
)}
{renderGlobalCallouts()}
<EuiCallOut
title={
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,10 @@
*/

import React, { useState } from 'react';
import { DocLinksStart } from 'kibana/public';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiCallOut, EuiFlyoutHeader, EuiLink, EuiSpacer, EuiTitle } from '@elastic/eui';
import { EuiFlyoutHeader, EuiSpacer, EuiTitle } from '@elastic/eui';

import {
EnrichedDeprecationInfo,
ReindexAction,
ReindexStatus,
} from '../../../../../../../common/types';
import { useAppContext } from '../../../../../app_context';
import { EnrichedDeprecationInfo, ReindexStatus } from '../../../../../../../common/types';

import type { ReindexStateContext } from '../context';
import { ChecklistFlyoutStep } from './checklist_step';
Expand All @@ -33,47 +26,6 @@ export interface ReindexFlyoutProps extends ReindexStateContext {
closeFlyout: () => void;
}

const getOpenAndCloseIndexDocLink = (docLinks: DocLinksStart) => (
<EuiLink target="_blank" href={`${docLinks.links.apis.openIndex}`}>
{i18n.translate(
'xpack.upgradeAssistant.checkupTab.reindexing.flyout.openAndCloseDocumentation',
{ defaultMessage: 'documentation' }
)}
</EuiLink>
);

const getIndexClosedCallout = (docLinks: DocLinksStart) => (
<>
<EuiCallOut
title={i18n.translate(
'xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutTitle',
{ defaultMessage: 'Index closed' }
)}
color="warning"
iconType="alert"
>
<p>
<FormattedMessage
id="xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutDetails"
defaultMessage="This index is currently closed. The Upgrade Assistant will open, reindex and then close the index. {reindexingMayTakeLongerEmph}. Please see the {docs} for more information."
values={{
docs: getOpenAndCloseIndexDocLink(docLinks),
reindexingMayTakeLongerEmph: (
<b>
{i18n.translate(
'xpack.upgradeAssistant.checkupTab.reindexing.flyout.indexClosedCallout.calloutDetails.reindexingTakesLongerEmphasis',
{ defaultMessage: 'Reindexing may take longer than usual' }
)}
</b>
),
}}
/>
</p>
</EuiCallOut>
<EuiSpacer size="m" />
</>
);

export const ReindexFlyout: React.FunctionComponent<ReindexFlyoutProps> = ({
reindexState,
startReindex,
Expand All @@ -82,12 +34,8 @@ export const ReindexFlyout: React.FunctionComponent<ReindexFlyoutProps> = ({
deprecation,
}) => {
const { status, reindexWarnings } = reindexState;
const { index, correctiveAction } = deprecation;
const {
services: {
core: { docLinks },
},
} = useAppContext();
const { index } = deprecation;

// If there are any warnings and we haven't started reindexing, show the warnings step first.
const [currentFlyoutStep, setCurrentFlyoutStep] = useState<ReindexFlyoutStep>(
reindexWarnings && reindexWarnings.length > 0 && status === undefined
Expand All @@ -97,16 +45,10 @@ export const ReindexFlyout: React.FunctionComponent<ReindexFlyoutProps> = ({

let flyoutContents: React.ReactNode;

const globalCallout =
(correctiveAction as ReindexAction).blockerForReindexing === 'index-closed' &&
reindexState.status !== ReindexStatus.completed
? getIndexClosedCallout(docLinks)
: undefined;
switch (currentFlyoutStep) {
case ReindexFlyoutStep.reindexWarnings:
flyoutContents = (
<WarningsFlyoutStep
renderGlobalCallouts={() => globalCallout}
closeFlyout={closeFlyout}
warnings={reindexState.reindexWarnings!}
advanceNextStep={() => setCurrentFlyoutStep(ReindexFlyoutStep.checklist)}
Expand All @@ -116,7 +58,6 @@ export const ReindexFlyout: React.FunctionComponent<ReindexFlyoutProps> = ({
case ReindexFlyoutStep.checklist:
flyoutContents = (
<ChecklistFlyoutStep
renderGlobalCallouts={() => globalCallout}
closeFlyout={closeFlyout}
reindexState={reindexState}
startReindex={startReindex}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ const warningToComponentMap: {

export const idForWarning = (id: number) => `reindexWarning-${id}`;
interface WarningsConfirmationFlyoutProps {
renderGlobalCallouts: () => React.ReactNode;
closeFlyout: () => void;
warnings: ReindexWarning[];
advanceNextStep: () => void;
Expand All @@ -53,7 +52,6 @@ interface WarningsConfirmationFlyoutProps {
*/
export const WarningsFlyoutStep: React.FunctionComponent<WarningsConfirmationFlyoutProps> = ({
warnings,
renderGlobalCallouts,
closeFlyout,
advanceNextStep,
}) => {
Expand Down Expand Up @@ -88,8 +86,6 @@ export const WarningsFlyoutStep: React.FunctionComponent<WarningsConfirmationFly
return (
<>
<EuiFlyoutBody>
{renderGlobalCallouts()}

<EuiCallOut
title={
<FormattedMessage
Expand Down

0 comments on commit bed98ef

Please sign in to comment.