From f25a184be30cbd6f0ea1480f7573b5f0b99c96be Mon Sep 17 00:00:00 2001 From: Alison Goryachev Date: Wed, 11 Sep 2019 13:42:43 -0400 Subject: [PATCH 1/2] delete min_age field if warm phase on rollover is selected --- .../public/sections/edit_policy/edit_policy.js | 2 +- .../public/store/selectors/policies.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/x-pack/legacy/plugins/index_lifecycle_management/public/sections/edit_policy/edit_policy.js b/x-pack/legacy/plugins/index_lifecycle_management/public/sections/edit_policy/edit_policy.js index 5cf5c47ec6ac3..2b07e9615030f 100644 --- a/x-pack/legacy/plugins/index_lifecycle_management/public/sections/edit_policy/edit_policy.js +++ b/x-pack/legacy/plugins/index_lifecycle_management/public/sections/edit_policy/edit_policy.js @@ -111,7 +111,7 @@ export class EditPolicy extends Component { if (firstError) { toastNotifications.addDanger( i18n.translate('xpack.indexLifecycleMgmt.editPolicy.formErrorsMessage', { - defaultMessage: 'Please fix the errors on this page.' + defaultMessage: 'Please fix the errors on this page.' }) ); const errorRowId = `${firstError.replace('.', '-')}-row`; diff --git a/x-pack/legacy/plugins/index_lifecycle_management/public/store/selectors/policies.js b/x-pack/legacy/plugins/index_lifecycle_management/public/store/selectors/policies.js index 2a824471586f2..8ab5ae279ec35 100644 --- a/x-pack/legacy/plugins/index_lifecycle_management/public/store/selectors/policies.js +++ b/x-pack/legacy/plugins/index_lifecycle_management/public/store/selectors/policies.js @@ -239,7 +239,14 @@ export const phaseToES = (phase, originalEsPhase) => { esPhase.min_age = `${phase[PHASE_ROLLOVER_MINIMUM_AGE]}${phase[PHASE_ROLLOVER_MINIMUM_AGE_UNITS]}`; } - esPhase.actions = esPhase.actions || {}; + // If warm phase on rollover is enabled, delete min age field + // An index lifecycle switches to warm phase when rollover occurs, so you cannot specify a warm phase time + // They are mutually exclusive + if (phase[WARM_PHASE_ON_ROLLOVER]) { + delete esPhase.min_age; + } + + {esPhase.actions = esPhase.actions || {};} if (phase[PHASE_ROLLOVER_ENABLED]) { esPhase.actions.rollover = {}; From c7466cff156bf619b042cc2496ead8726bc9c22e Mon Sep 17 00:00:00 2001 From: Alison Goryachev Date: Thu, 12 Sep 2019 08:49:37 -0400 Subject: [PATCH 2/2] address review feedback --- .../public/store/selectors/policies.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/legacy/plugins/index_lifecycle_management/public/store/selectors/policies.js b/x-pack/legacy/plugins/index_lifecycle_management/public/store/selectors/policies.js index 8ab5ae279ec35..e01f94c326ff3 100644 --- a/x-pack/legacy/plugins/index_lifecycle_management/public/store/selectors/policies.js +++ b/x-pack/legacy/plugins/index_lifecycle_management/public/store/selectors/policies.js @@ -246,7 +246,7 @@ export const phaseToES = (phase, originalEsPhase) => { delete esPhase.min_age; } - {esPhase.actions = esPhase.actions || {};} + esPhase.actions = esPhase.actions || {}; if (phase[PHASE_ROLLOVER_ENABLED]) { esPhase.actions.rollover = {};