From 4f5f554095e4a73382708304ad7622025ccc331c Mon Sep 17 00:00:00 2001 From: Jean-Louis Leysens Date: Thu, 25 Feb 2021 12:00:19 +0100 Subject: [PATCH] remove logic that disables SS action in cold if no rollover and always show replicas field --- .../edit_policy/edit_policy.helpers.tsx | 2 -- .../edit_policy/edit_policy.test.ts | 1 - .../phases/cold_phase/cold_phase.tsx | 16 +-------------- .../searchable_snapshot_field.tsx | 20 ++----------------- .../phases/warm_phase/warm_phase.tsx | 14 ++++++------- .../translations/translations/ja-JP.json | 1 - .../translations/translations/zh-CN.json | 1 - 7 files changed, 10 insertions(+), 45 deletions(-) diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx index a9845c23156049..b692d7fe69cd48 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.helpers.tsx @@ -222,12 +222,10 @@ export const setup = async (arg?: { const createSearchableSnapshotActions = (phase: Phases) => { const fieldSelector = `searchableSnapshotField-${phase}`; const licenseCalloutSelector = `${fieldSelector}.searchableSnapshotDisabledDueToLicense`; - const rolloverCalloutSelector = `${fieldSelector}.searchableSnapshotFieldsNoRolloverCallout`; const toggleSelector = `${fieldSelector}.searchableSnapshotToggle`; const toggleSearchableSnapshot = createFormToggleAction(toggleSelector); return { - searchableSnapshotDisabledDueToRollover: () => exists(rolloverCalloutSelector), searchableSnapshotDisabled: () => exists(licenseCalloutSelector) && find(licenseCalloutSelector).props().disabled === true, searchableSnapshotsExists: () => exists(fieldSelector), diff --git a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.test.ts b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.test.ts index 7fe5c6f50d046b..76708ea4c96478 100644 --- a/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.test.ts +++ b/x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/edit_policy.test.ts @@ -851,7 +851,6 @@ describe('', () => { await actions.cold.enable(true); expect(actions.hot.searchableSnapshotsExists()).toBeFalsy(); - expect(actions.cold.searchableSnapshotDisabledDueToRollover()).toBeTruthy(); }); test('hiding rollover tip on minimum age', async () => { diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/cold_phase/cold_phase.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/cold_phase/cold_phase.tsx index 27aacef1a368bd..1dbc30674eaa58 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/cold_phase/cold_phase.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/cold_phase/cold_phase.tsx @@ -8,12 +8,9 @@ import React, { FunctionComponent } from 'react'; import { FormattedMessage } from '@kbn/i18n/react'; import { i18n } from '@kbn/i18n'; -import { get } from 'lodash'; import { EuiTextColor } from '@elastic/eui'; -import { useFormData } from '../../../../../../shared_imports'; - import { useConfigurationIssues } from '../../../form'; import { LearnMoreLink, ToggleFieldWithDescribedFormRow } from '../../'; @@ -36,23 +33,12 @@ const i18nTexts = { }, }; -const formFieldPaths = { - enabled: '_meta.cold.enabled', - searchableSnapshot: 'phases.cold.actions.searchable_snapshot.snapshot_repository', -}; - export const ColdPhase: FunctionComponent = () => { const { isUsingSearchableSnapshotInHotPhase } = useConfigurationIssues(); - const [formData] = useFormData({ - watch: [formFieldPaths.searchableSnapshot], - }); - - const showReplicasField = get(formData, formFieldPaths.searchableSnapshot) == null; - return ( }> - {showReplicasField && } + {/* Freeze section */} {!isUsingSearchableSnapshotInHotPhase && ( diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/searchable_snapshot_field/searchable_snapshot_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/searchable_snapshot_field/searchable_snapshot_field.tsx index 97e7d0bcc27de9..1a78149521e63c 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/searchable_snapshot_field/searchable_snapshot_field.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/searchable_snapshot_field/searchable_snapshot_field.tsx @@ -52,7 +52,7 @@ export const SearchableSnapshotField: FunctionComponent = ({ phase }) => services: { cloud }, } = useKibana(); const { getUrlForApp, policy, license, isNewPolicy } = useEditPolicyContext(); - const { isUsingSearchableSnapshotInHotPhase, isUsingRollover } = useConfigurationIssues(); + const { isUsingSearchableSnapshotInHotPhase } = useConfigurationIssues(); const searchableSnapshotPath = `phases.${phase}.actions.searchable_snapshot.snapshot_repository`; @@ -62,10 +62,8 @@ export const SearchableSnapshotField: FunctionComponent = ({ phase }) => const isColdPhase = phase === 'cold'; const isDisabledDueToLicense = !license.canUseSearchableSnapshot(); const isDisabledInColdDueToHotPhase = isColdPhase && isUsingSearchableSnapshotInHotPhase; - const isDisabledInColdDueToRollover = isColdPhase && !isUsingRollover; - const isDisabled = - isDisabledDueToLicense || isDisabledInColdDueToHotPhase || isDisabledInColdDueToRollover; + const isDisabled = isDisabledDueToLicense || isDisabledInColdDueToHotPhase; const [isFieldToggleChecked, setIsFieldToggleChecked] = useState(() => Boolean( @@ -294,20 +292,6 @@ export const SearchableSnapshotField: FunctionComponent = ({ phase }) => )} /> ); - } else if (isDisabledInColdDueToRollover) { - infoCallout = ( - - ); } return infoCallout ? ( diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/warm_phase/warm_phase.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/warm_phase/warm_phase.tsx index e5bf34890a4a77..577dab6804147c 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/warm_phase/warm_phase.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/warm_phase/warm_phase.tsx @@ -33,22 +33,22 @@ export const WarmPhase: FunctionComponent = () => { const { isUsingSearchableSnapshotInHotPhase } = useConfigurationIssues(); return ( - - + + - {!isUsingSearchableSnapshotInHotPhase && } + {!isUsingSearchableSnapshotInHotPhase && } - {!isUsingSearchableSnapshotInHotPhase && } + {!isUsingSearchableSnapshotInHotPhase && } - + {/* Data tier allocation section */} - + ); }; diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 5e553e3cfe7a17..42552d756313bd 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -9459,7 +9459,6 @@ "xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotFieldTitle": "検索可能スナップショット", "xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotLicenseCalloutBody": "検索可能なスナップショットを作成するには、エンタープライズライセンスが必要です。", "xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotLicenseCalloutTitle": "エンタープライズライセンスが必要です", - "xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotNoRolloverCalloutBody": "ロールオーバーがホットフェーズで無効な時には、検索可能なスナップショットを作成できません。", "xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotRepoRequiredError": "スナップショットリポジトリ名が必要です。", "xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotsToggleLabel": "検索可能スナップショットを作成", "xpack.indexLifecycleMgmt.editPolicy.showPolicyJsonButto": "リクエストを表示", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index e5c57dc0e2ec67..ee9f1aefeae9bc 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -9483,7 +9483,6 @@ "xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotFieldTitle": "可搜索快照", "xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotLicenseCalloutBody": "要创建可搜索快照,需要企业许可证。", "xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotLicenseCalloutTitle": "需要企业许可证", - "xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotNoRolloverCalloutBody": "在热阶段禁用滚动更新后,无法创建可搜索快照。", "xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotRepoRequiredError": "快照存储库名称必填。", "xpack.indexLifecycleMgmt.editPolicy.searchableSnapshotsToggleLabel": "创建可搜索快照", "xpack.indexLifecycleMgmt.editPolicy.showPolicyJsonButto": "显示请求",