Skip to content

Commit

Permalink
Kibana should allow a min_age setting of 0ms in ILM policy phases
Browse files Browse the repository at this point in the history
  • Loading branch information
jkelastic committed Dec 20, 2019
1 parent fc999e5 commit 809b32f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export const MinAgeInput = props => {
onChange={async e => {
setPhaseData(PHASE_ROLLOVER_MINIMUM_AGE, e.target.value);
}}
min={1}
min={0}
/>
</ErrableFormRow>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ export const positiveNumbersAboveZeroErrorMessage = i18n.translate(
}
);

export const positiveNumbersEqualAboveZeroErrorMessage =
i18n.translate('xpack.indexLifecycleMgmt.editPolicy.positiveNumberAboveZeroRequiredError', {
defaultMessage: 'Only numbers equal to or above 0 are allowed.'
});

export const validatePhase = (type, phase, errors) => {
const phaseErrors = {};

Expand Down Expand Up @@ -123,11 +128,12 @@ export const validatePhase = (type, phase, errors) => {
} else if (
(numberedAttribute === PHASE_ROLLOVER_MINIMUM_AGE ||
numberedAttribute === PHASE_PRIMARY_SHARD_COUNT) &&
phase[numberedAttribute] < 1
phase[numberedAttribute] < 0
) {
phaseErrors[numberedAttribute] = [positiveNumbersAboveZeroErrorMessage];
phaseErrors[numberedAttribute] = [positiveNumbersEqualAboveZeroErrorMessage];
}
}

}
if (phase[PHASE_ROLLOVER_ENABLED]) {
if (
Expand Down Expand Up @@ -161,6 +167,7 @@ export const validatePhase = (type, phase, errors) => {
}

if (phase[PHASE_FORCE_MERGE_ENABLED]) {

if (!isNumber(phase[PHASE_FORCE_MERGE_SEGMENTS])) {
phaseErrors[PHASE_FORCE_MERGE_SEGMENTS] = [numberRequiredMessage];
} else if (phase[PHASE_FORCE_MERGE_SEGMENTS] < 1) {
Expand Down

0 comments on commit 809b32f

Please sign in to comment.