diff --git a/x-pack/plugins/index_lifecycle_management/public/application/constants/index.ts b/x-pack/plugins/index_lifecycle_management/public/application/constants/index.ts index a631a38fbcb7e..6319fc0d68543 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/constants/index.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/constants/index.ts @@ -37,6 +37,8 @@ export const PHASE_PRIMARY_SHARD_COUNT: string = 'selectedPrimaryShardCount'; export const PHASE_REPLICA_COUNT: string = 'selectedReplicaCount'; export const PHASE_INDEX_PRIORITY: string = 'phaseIndexPriority'; +export const PHASE_WAIT_FOR_SNAPSHOT_POLICY = 'waitForSnapshotPolicy'; + export const PHASE_ATTRIBUTES_THAT_ARE_NUMBERS_VALIDATE: string[] = [ PHASE_ROLLOVER_MINIMUM_AGE, PHASE_FORCE_MERGE_SEGMENTS, diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.js b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.js index 3b3e489d38f7d..299bf28778ab4 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.js +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/delete_phase/delete_phase.js @@ -7,10 +7,16 @@ import React, { PureComponent, Fragment } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from '@kbn/i18n/react'; -import { EuiDescribedFormGroup, EuiSwitch } from '@elastic/eui'; +import { + EuiDescribedFormGroup, + EuiSwitch, + EuiFieldText, + EuiTextColor, + EuiFormRow, +} from '@elastic/eui'; -import { PHASE_DELETE, PHASE_ENABLED } from '../../../../constants'; -import { ActiveBadge, PhaseErrorMessage } from '../../../components'; +import { PHASE_DELETE, PHASE_ENABLED, PHASE_WAIT_FOR_SNAPSHOT_POLICY } from '../../../../constants'; +import { ActiveBadge, LearnMoreLink, OptionalLabel, PhaseErrorMessage } from '../../../components'; import { MinAgeInput } from '../min_age_input'; export class DeletePhase extends PureComponent { @@ -85,6 +91,48 @@ export class DeletePhase extends PureComponent {
)} + {phaseData[PHASE_ENABLED] ? ( + + + + } + description={ + + {' '} + + + } + titleSize="xs" + fullWidth + > + + + + + } + > + setPhaseData(PHASE_WAIT_FOR_SNAPSHOT_POLICY, e.target.value)} + /> + + + ) : null}
); } diff --git a/x-pack/plugins/index_lifecycle_management/public/application/store/defaults/index.d.ts b/x-pack/plugins/index_lifecycle_management/public/application/store/defaults/index.d.ts index 889e038f9e2c4..abf6db416c7f4 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/store/defaults/index.d.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/store/defaults/index.d.ts @@ -4,6 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ +export declare const defaultDeletePhase: any; export declare const defaultColdPhase: any; export declare const defaultWarmPhase: any; export declare const defaultHotPhase: any; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/store/selectors/policies.js b/x-pack/plugins/index_lifecycle_management/public/application/store/selectors/policies.js index a3aef8679817d..32c6d93383c22 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/store/selectors/policies.js +++ b/x-pack/plugins/index_lifecycle_management/public/application/store/selectors/policies.js @@ -31,6 +31,7 @@ import { PHASE_FREEZE_ENABLED, PHASE_INDEX_PRIORITY, PHASE_ROLLOVER_MAX_DOCUMENTS, + PHASE_WAIT_FOR_SNAPSHOT_POLICY, } from '../../constants'; import { filterItems, sortTable } from '../../services'; @@ -194,6 +195,9 @@ const phaseFromES = (phase, phaseName, defaultEmptyPolicy) => { if (actions.set_priority) { policy[PHASE_INDEX_PRIORITY] = actions.set_priority.priority; } + if (actions.wait_for_snapshot) { + policy[PHASE_WAIT_FOR_SNAPSHOT_POLICY] = actions.wait_for_snapshot.policy; + } } return policy; }; @@ -308,5 +312,13 @@ export const phaseToES = (phase, originalEsPhase) => { priority: phase[PHASE_INDEX_PRIORITY], }; } + + if (phase[PHASE_WAIT_FOR_SNAPSHOT_POLICY]) { + esPhase.actions.wait_for_snapshot = { + policy: phase[PHASE_WAIT_FOR_SNAPSHOT_POLICY], + }; + } else { + delete esPhase.actions.wait_for_snapshot; + } return esPhase; };