From ac13f1467470c6ec8c4d3bd6a3724c484440cfe6 Mon Sep 17 00:00:00 2001 From: Yulia Cech Date: Tue, 17 Sep 2024 17:53:37 +0200 Subject: [PATCH] [ILM] Fix type check issues --- .../public/application/constants/policy.ts | 1 - .../phases/shared_fields/index_priority_field.tsx | 4 +--- .../components/phases/shared_fields/replicas_field.tsx | 2 +- .../sections/edit_policy/form/deserializer.ts | 1 - .../application/sections/edit_policy/form/schema.ts | 9 +-------- .../public/application/sections/edit_policy/types.ts | 2 +- 6 files changed, 4 insertions(+), 15 deletions(-) diff --git a/x-pack/plugins/index_lifecycle_management/public/application/constants/policy.ts b/x-pack/plugins/index_lifecycle_management/public/application/constants/policy.ts index 293e232e349df..2c025761fd940 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/constants/policy.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/constants/policy.ts @@ -11,7 +11,6 @@ export const defaultIndexPriority = { hot: '100', warm: '50', cold: '0', - frozen: '0', }; export const defaultRolloverAction: RolloverAction = { diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/index_priority_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/index_priority_field.tsx index e0989adf44e4f..55f559de3ba89 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/index_priority_field.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/index_priority_field.tsx @@ -10,8 +10,6 @@ import React, { FunctionComponent, useMemo } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; import { EuiSpacer, EuiTextColor } from '@elastic/eui'; -import { PhaseExceptDelete } from '../../../../../../../common/types'; - import { NumericField } from '../../../../../../shared_imports'; import { useEditPolicyContext } from '../../../edit_policy_context'; @@ -20,7 +18,7 @@ import { LearnMoreLink, DescribedFormRow } from '../..'; import { useKibana } from '../../../../../../shared_imports'; interface Props { - phase: PhaseExceptDelete; + phase: 'hot' | 'warm' | 'cold'; } export const IndexPriorityField: FunctionComponent = ({ phase }) => { diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/replicas_field.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/replicas_field.tsx index ee59deed0041c..94e44a433e0e8 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/replicas_field.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/replicas_field.tsx @@ -17,7 +17,7 @@ import { i18nTexts } from '../../../i18n_texts'; import { DescribedFormRow } from '../../described_form_row'; interface Props { - phase: 'warm' | 'cold' | 'frozen'; + phase: 'warm' | 'cold'; } export const ReplicasField: FunctionComponent = ({ phase }) => { diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/deserializer.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/deserializer.ts index 6a0dae8d3deaf..dec1dce0eaffe 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/deserializer.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/deserializer.ts @@ -67,7 +67,6 @@ export const createDeserializer = }, frozen: { enabled: Boolean(frozen), - dataTierAllocationType: determineDataTierAllocationType(frozen?.actions), minAgeToMilliSeconds: -1, }, delete: { diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/schema.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/schema.ts index bc365eba61b39..5d13f4f2bd29b 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/schema.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/schema.ts @@ -8,7 +8,6 @@ import { i18n } from '@kbn/i18n'; import { - PhaseExceptDelete, PhaseWithDownsample, PhaseWithTiming, } from '../../../../../common/types'; @@ -129,7 +128,7 @@ const allowWriteAfterShrinkField = { defaultValue: false, }; -const getPriorityField = (phase: PhaseExceptDelete) => ({ +const getPriorityField = (phase: 'hot' | 'warm' | 'cold') => ({ defaultValue: defaultIndexPriority[phase], label: i18nTexts.editPolicy.indexPriorityFieldLabel, validations: [ @@ -495,12 +494,6 @@ export const getSchema = (isCloudEnabled: boolean): FormSchema => ({ frozen: { min_age: getMinAgeField('frozen'), actions: { - allocate: { - number_of_replicas: numberOfReplicasField, - }, - set_priority: { - priority: getPriorityField('frozen'), - }, searchable_snapshot: searchableSnapshotFields, }, }, diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/types.ts b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/types.ts index 5dd5477cae2c2..4d4d561eedb96 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/types.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/types.ts @@ -78,7 +78,7 @@ interface ColdPhaseMetaFields extends DataAllocationMetaFields, MinAgeField, Dow readonlyEnabled: boolean; } -interface FrozenPhaseMetaFields extends DataAllocationMetaFields, MinAgeField { +interface FrozenPhaseMetaFields extends MinAgeField { enabled: boolean; }