mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* adding set priority action support to ILM UI * removing unnecessary check for PHASE_ENABLED * fixing i18n check failure
This commit is contained in:
parent
979bd7a69b
commit
cfcf4ba146
12 changed files with 371 additions and 214 deletions
|
@ -97,6 +97,11 @@ const setPhaseAfter = (rendered, phase, after) => {
|
|||
afterInput.simulate('change', { target: { value: after } });
|
||||
rendered.update();
|
||||
};
|
||||
const setPhaseIndexPriority = (rendered, phase, priority) => {
|
||||
const priorityInput = rendered.find(`input#${phase}-phaseIndexPriority`);
|
||||
priorityInput.simulate('change', { target: { value: priority } });
|
||||
rendered.update();
|
||||
};
|
||||
const save = rendered => {
|
||||
const saveButton = findTestSubject(rendered, 'savePolicyButton');
|
||||
saveButton.simulate('click');
|
||||
|
@ -217,6 +222,14 @@ describe('edit policy', () => {
|
|||
save(rendered);
|
||||
expectedErrorMessages(rendered, [positiveNumbersAboveZeroErrorMessage]);
|
||||
});
|
||||
test('should show positive number required error when trying to save with -1 for index priority', () => {
|
||||
const rendered = mountWithIntl(component);
|
||||
noRollover(rendered);
|
||||
setPolicyName(rendered, 'mypolicy');
|
||||
setPhaseIndexPriority(rendered, 'hot', -1);
|
||||
save(rendered);
|
||||
expectedErrorMessages(rendered, [positiveNumberRequiredMessage]);
|
||||
});
|
||||
});
|
||||
describe('warm phase', () => {
|
||||
test('should show number required error when trying to save empty warm phase', () => {
|
||||
|
@ -245,6 +258,16 @@ describe('edit policy', () => {
|
|||
save(rendered);
|
||||
expectedErrorMessages(rendered, [positiveNumberRequiredMessage]);
|
||||
});
|
||||
test('should show positive number required error when trying to save warm phase with -1 for index priority', () => {
|
||||
const rendered = mountWithIntl(component);
|
||||
noRollover(rendered);
|
||||
setPolicyName(rendered, 'mypolicy');
|
||||
activatePhase(rendered, 'warm');
|
||||
setPhaseAfter(rendered, 'warm', 1);
|
||||
setPhaseIndexPriority(rendered, 'warm', -1);
|
||||
save(rendered);
|
||||
expectedErrorMessages(rendered, [positiveNumberRequiredMessage]);
|
||||
});
|
||||
test('should show positive number required above zero error when trying to save warm phase with 0 for shrink', () => {
|
||||
const rendered = mountWithIntl(component);
|
||||
noRollover(rendered);
|
||||
|
@ -423,6 +446,16 @@ describe('edit policy', () => {
|
|||
rendered.update();
|
||||
expect(rendered.find('.euiFlyout').exists()).toBeTruthy();
|
||||
});
|
||||
test('should show positive number required error when trying to save with -1 for index priority', () => {
|
||||
const rendered = mountWithIntl(component);
|
||||
noRollover(rendered);
|
||||
setPolicyName(rendered, 'mypolicy');
|
||||
activatePhase(rendered, 'cold');
|
||||
setPhaseAfter(rendered, 'cold', 1);
|
||||
setPhaseIndexPriority(rendered, 'cold', -1);
|
||||
save(rendered);
|
||||
expectedErrorMessages(rendered, [positiveNumberRequiredMessage]);
|
||||
});
|
||||
});
|
||||
describe('delete phase', () => {
|
||||
test('should show positive number required error when trying to save delete phase with 0 for after', () => {
|
||||
|
|
|
@ -32,6 +32,7 @@ import { ErrableFormRow } from '../../form_errors';
|
|||
import { MinAgeInput } from '../min_age_input';
|
||||
import { LearnMoreLink, ActiveBadge, PhaseErrorMessage, OptionalLabel } from '../../../components';
|
||||
import { NodeAllocation } from '../node_allocation';
|
||||
import { SetPriorityInput } from '../set_priority_input';
|
||||
|
||||
class ColdPhaseUi extends PureComponent {
|
||||
static propTypes = {
|
||||
|
@ -183,38 +184,47 @@ class ColdPhaseUi extends PureComponent {
|
|||
</div>
|
||||
</EuiDescribedFormGroup>
|
||||
{phaseData[PHASE_ENABLED] ? (
|
||||
<EuiDescribedFormGroup
|
||||
title={
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.coldPhase.freezeText"
|
||||
defaultMessage="Freeze"
|
||||
/>
|
||||
</p>
|
||||
}
|
||||
description={
|
||||
<EuiTextColor color="subdued">
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.coldPhase.freezeIndexExplanationText"
|
||||
defaultMessage="A frozen index has little overhead on the cluster and is blocked for write operations.
|
||||
<Fragment>
|
||||
<EuiDescribedFormGroup
|
||||
title={
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.coldPhase.freezeText"
|
||||
defaultMessage="Freeze"
|
||||
/>
|
||||
</p>
|
||||
}
|
||||
description={
|
||||
<EuiTextColor color="subdued">
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.coldPhase.freezeIndexExplanationText"
|
||||
defaultMessage="A frozen index has little overhead on the cluster and is blocked for write operations.
|
||||
You can search a frozen index, but expect queries to be slower."
|
||||
/>{' '}
|
||||
<LearnMoreLink docPath="frozen-indices.html" />
|
||||
</EuiTextColor>
|
||||
}
|
||||
fullWidth
|
||||
titleSize="xs"
|
||||
>
|
||||
<EuiSwitch
|
||||
data-test-subj="freezeSwitch"
|
||||
checked={phaseData[PHASE_FREEZE_ENABLED]}
|
||||
onChange={async e => {
|
||||
await setPhaseData(PHASE_FREEZE_ENABLED, e.target.checked);
|
||||
}}
|
||||
label={freezeLabel}
|
||||
aria-label={freezeLabel}
|
||||
/>{' '}
|
||||
<LearnMoreLink docPath="frozen-indices.html" />
|
||||
</EuiTextColor>
|
||||
}
|
||||
fullWidth
|
||||
titleSize="xs"
|
||||
>
|
||||
<EuiSwitch
|
||||
data-test-subj="freezeSwitch"
|
||||
checked={phaseData[PHASE_FREEZE_ENABLED]}
|
||||
onChange={async e => {
|
||||
await setPhaseData(PHASE_FREEZE_ENABLED, e.target.checked);
|
||||
}}
|
||||
label={freezeLabel}
|
||||
aria-label={freezeLabel}
|
||||
/>
|
||||
</EuiDescribedFormGroup>
|
||||
<SetPriorityInput
|
||||
errors={errors}
|
||||
phaseData={phaseData}
|
||||
phase={PHASE_COLD}
|
||||
isShowingErrors={isShowingErrors}
|
||||
setPhaseData={setPhaseData}
|
||||
/>
|
||||
</EuiDescribedFormGroup>
|
||||
</Fragment>
|
||||
) : null }
|
||||
</Fragment>
|
||||
);
|
||||
|
|
|
@ -29,6 +29,7 @@ import {
|
|||
PHASE_ROLLOVER_ENABLED,
|
||||
MAX_SIZE_TYPE_DOCUMENT
|
||||
} from '../../../../store/constants';
|
||||
import { SetPriorityInput } from '../set_priority_input';
|
||||
|
||||
import { ErrableFormRow } from '../../form_errors';
|
||||
|
||||
|
@ -64,194 +65,203 @@ class HotPhaseUi extends PureComponent {
|
|||
} = this.props;
|
||||
|
||||
return (
|
||||
<EuiDescribedFormGroup
|
||||
title={
|
||||
<div>
|
||||
<span className="eui-displayInlineBlock eui-alignMiddle">
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.hotPhase.hotPhaseLabel"
|
||||
defaultMessage="Hot phase"
|
||||
/>
|
||||
</span>{' '}
|
||||
{isShowingErrors ? null : <ActiveBadge />}
|
||||
<PhaseErrorMessage isShowingErrors={isShowingErrors} />
|
||||
</div>
|
||||
}
|
||||
titleSize="s"
|
||||
description={
|
||||
<Fragment>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.hotPhase.hotPhaseDescriptionMessage"
|
||||
defaultMessage="This phase is required. You are actively querying and writing to your
|
||||
index. For faster updates, you can roll over the index when it gets too big or too old."
|
||||
/>
|
||||
</p>
|
||||
</Fragment>
|
||||
}
|
||||
fullWidth
|
||||
>
|
||||
<EuiFormRow
|
||||
id="rolloverFormRow"
|
||||
hasEmptyLabelSpace
|
||||
helpText={
|
||||
<Fragment>
|
||||
<EuiDescribedFormGroup
|
||||
title={
|
||||
<div>
|
||||
<span className="eui-displayInlineBlock eui-alignMiddle">
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.hotPhase.hotPhaseLabel"
|
||||
defaultMessage="Hot phase"
|
||||
/>
|
||||
</span>{' '}
|
||||
{isShowingErrors ? null : <ActiveBadge />}
|
||||
<PhaseErrorMessage isShowingErrors={isShowingErrors} />
|
||||
</div>
|
||||
}
|
||||
titleSize="s"
|
||||
description={
|
||||
<Fragment>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.hotPhase.rolloverDescriptionMessage"
|
||||
defaultMessage="The new index created by rollover is added
|
||||
to the index alias and designated as the write index."
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.hotPhase.hotPhaseDescriptionMessage"
|
||||
defaultMessage="This phase is required. You are actively querying and
|
||||
writing to your index. For faster updates, you can roll over the index when it gets too big or too old."
|
||||
/>
|
||||
</p>
|
||||
<LearnMoreLink
|
||||
text={
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.hotPhase.learnAboutRolloverLinkText"
|
||||
defaultMessage="Learn about rollover"
|
||||
/>
|
||||
}
|
||||
docPath="indices-rollover-index.html"
|
||||
/>
|
||||
<EuiSpacer size="m"/>
|
||||
</Fragment>
|
||||
}
|
||||
fullWidth
|
||||
>
|
||||
<EuiSwitch
|
||||
data-test-subj="rolloverSwitch"
|
||||
checked={phaseData[PHASE_ROLLOVER_ENABLED]}
|
||||
onChange={async e => {
|
||||
const { checked } = e.target;
|
||||
setPhaseData(PHASE_ROLLOVER_ENABLED, checked);
|
||||
setWarmPhaseOnRollover(checked);
|
||||
}}
|
||||
label={intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.enableRolloverLabel',
|
||||
defaultMessage: 'Enable rollover'
|
||||
})}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
{phaseData[PHASE_ROLLOVER_ENABLED] ? (
|
||||
<Fragment>
|
||||
<EuiSpacer size="m" />
|
||||
<EuiFlexGroup>
|
||||
<EuiFlexItem style={{ maxWidth: 188 }}>
|
||||
<ErrableFormRow
|
||||
id={`${PHASE_HOT}-${PHASE_ROLLOVER_MAX_SIZE_STORED}`}
|
||||
label={intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.maximumIndexSizeLabel',
|
||||
defaultMessage: 'Maximum index size'
|
||||
})}
|
||||
errorKey={PHASE_ROLLOVER_MAX_SIZE_STORED}
|
||||
isShowingErrors={isShowingErrors}
|
||||
errors={errors}
|
||||
>
|
||||
<EuiFieldNumber
|
||||
<EuiFormRow
|
||||
id="rolloverFormRow"
|
||||
hasEmptyLabelSpace
|
||||
helpText={
|
||||
<Fragment>
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.hotPhase.rolloverDescriptionMessage"
|
||||
defaultMessage="The new index created by rollover is added
|
||||
to the index alias and designated as the write index."
|
||||
/>
|
||||
</p>
|
||||
<LearnMoreLink
|
||||
text={
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.hotPhase.learnAboutRolloverLinkText"
|
||||
defaultMessage="Learn about rollover"
|
||||
/>
|
||||
}
|
||||
docPath="indices-rollover-index.html"
|
||||
/>
|
||||
<EuiSpacer size="m"/>
|
||||
</Fragment>
|
||||
}
|
||||
>
|
||||
<EuiSwitch
|
||||
data-test-subj="rolloverSwitch"
|
||||
checked={phaseData[PHASE_ROLLOVER_ENABLED]}
|
||||
onChange={async e => {
|
||||
const { checked } = e.target;
|
||||
setPhaseData(PHASE_ROLLOVER_ENABLED, checked);
|
||||
setWarmPhaseOnRollover(checked);
|
||||
}}
|
||||
label={intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.enableRolloverLabel',
|
||||
defaultMessage: 'Enable rollover'
|
||||
})}
|
||||
/>
|
||||
</EuiFormRow>
|
||||
{phaseData[PHASE_ROLLOVER_ENABLED] ? (
|
||||
<Fragment>
|
||||
<EuiSpacer size="m" />
|
||||
<EuiFlexGroup>
|
||||
<EuiFlexItem style={{ maxWidth: 188 }}>
|
||||
<ErrableFormRow
|
||||
id={`${PHASE_HOT}-${PHASE_ROLLOVER_MAX_SIZE_STORED}`}
|
||||
value={phaseData[PHASE_ROLLOVER_MAX_SIZE_STORED]}
|
||||
onChange={async e => {
|
||||
await setPhaseData(
|
||||
PHASE_ROLLOVER_MAX_SIZE_STORED,
|
||||
e.target.value
|
||||
);
|
||||
}}
|
||||
min={1}
|
||||
/>
|
||||
</ErrableFormRow>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem style={{ maxWidth: 188 }}>
|
||||
<ErrableFormRow
|
||||
id={`${PHASE_HOT}-${PHASE_ROLLOVER_MAX_SIZE_STORED_UNITS}`}
|
||||
hasEmptyLabelSpace
|
||||
errorKey={PHASE_ROLLOVER_MAX_SIZE_STORED_UNITS}
|
||||
isShowingErrors={isShowingErrors}
|
||||
errors={errors}
|
||||
>
|
||||
<EuiSelect
|
||||
aria-label={intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.maximumIndexSizeUnitsAriaLabel',
|
||||
defaultMessage: 'Maximum index size units'
|
||||
label={intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.maximumIndexSizeLabel',
|
||||
defaultMessage: 'Maximum index size'
|
||||
})}
|
||||
value={phaseData[PHASE_ROLLOVER_MAX_SIZE_STORED_UNITS]}
|
||||
onChange={async e => {
|
||||
await setPhaseData(
|
||||
PHASE_ROLLOVER_MAX_SIZE_STORED_UNITS,
|
||||
e.target.value
|
||||
);
|
||||
}}
|
||||
options={[
|
||||
{ value: 'gb', text: intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.gigabytesLabel',
|
||||
defaultMessage: 'gigabytes'
|
||||
}) },
|
||||
{ value: MAX_SIZE_TYPE_DOCUMENT, text: intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.documentsLabel',
|
||||
defaultMessage: 'documents'
|
||||
}) }
|
||||
]}
|
||||
/>
|
||||
</ErrableFormRow>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
<EuiSpacer />
|
||||
<EuiFlexGroup>
|
||||
<EuiFlexItem style={{ maxWidth: 188 }}>
|
||||
<ErrableFormRow
|
||||
id={`${PHASE_HOT}-${PHASE_ROLLOVER_MAX_AGE}`}
|
||||
label={intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.maximumAgeLabel',
|
||||
defaultMessage: 'Maximum age'
|
||||
})}
|
||||
errorKey={`${PHASE_ROLLOVER_MAX_AGE}`}
|
||||
isShowingErrors={isShowingErrors}
|
||||
errors={errors}
|
||||
>
|
||||
<EuiFieldNumber
|
||||
errorKey={PHASE_ROLLOVER_MAX_SIZE_STORED}
|
||||
isShowingErrors={isShowingErrors}
|
||||
errors={errors}
|
||||
>
|
||||
<EuiFieldNumber
|
||||
id={`${PHASE_HOT}-${PHASE_ROLLOVER_MAX_SIZE_STORED}`}
|
||||
value={phaseData[PHASE_ROLLOVER_MAX_SIZE_STORED]}
|
||||
onChange={async e => {
|
||||
await setPhaseData(
|
||||
PHASE_ROLLOVER_MAX_SIZE_STORED,
|
||||
e.target.value
|
||||
);
|
||||
}}
|
||||
min={1}
|
||||
/>
|
||||
</ErrableFormRow>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem style={{ maxWidth: 188 }}>
|
||||
<ErrableFormRow
|
||||
id={`${PHASE_HOT}-${PHASE_ROLLOVER_MAX_SIZE_STORED_UNITS}`}
|
||||
hasEmptyLabelSpace
|
||||
errorKey={PHASE_ROLLOVER_MAX_SIZE_STORED_UNITS}
|
||||
isShowingErrors={isShowingErrors}
|
||||
errors={errors}
|
||||
>
|
||||
<EuiSelect
|
||||
aria-label={intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.maximumIndexSizeUnitsAriaLabel',
|
||||
defaultMessage: 'Maximum index size units'
|
||||
})}
|
||||
value={phaseData[PHASE_ROLLOVER_MAX_SIZE_STORED_UNITS]}
|
||||
onChange={async e => {
|
||||
await setPhaseData(
|
||||
PHASE_ROLLOVER_MAX_SIZE_STORED_UNITS,
|
||||
e.target.value
|
||||
);
|
||||
}}
|
||||
options={[
|
||||
{ value: 'gb', text: intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.gigabytesLabel',
|
||||
defaultMessage: 'gigabytes'
|
||||
}) },
|
||||
{ value: MAX_SIZE_TYPE_DOCUMENT, text: intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.documentsLabel',
|
||||
defaultMessage: 'documents'
|
||||
}) }
|
||||
]}
|
||||
/>
|
||||
</ErrableFormRow>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
<EuiSpacer />
|
||||
<EuiFlexGroup>
|
||||
<EuiFlexItem style={{ maxWidth: 188 }}>
|
||||
<ErrableFormRow
|
||||
id={`${PHASE_HOT}-${PHASE_ROLLOVER_MAX_AGE}`}
|
||||
value={phaseData[PHASE_ROLLOVER_MAX_AGE]}
|
||||
onChange={async e => {
|
||||
await setPhaseData(PHASE_ROLLOVER_MAX_AGE, e.target.value);
|
||||
}}
|
||||
min={1}
|
||||
/>
|
||||
</ErrableFormRow>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem style={{ maxWidth: 188 }}>
|
||||
<ErrableFormRow
|
||||
id={`${PHASE_HOT}-${PHASE_ROLLOVER_MAX_AGE_UNITS}`}
|
||||
hasEmptyLabelSpace
|
||||
errorKey={PHASE_ROLLOVER_MAX_AGE_UNITS}
|
||||
isShowingErrors={isShowingErrors}
|
||||
errors={errors}
|
||||
>
|
||||
<EuiSelect
|
||||
aria-label={intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.maximumAgeUnitsAriaLabel',
|
||||
defaultMessage: 'Maximum age units'
|
||||
label={intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.maximumAgeLabel',
|
||||
defaultMessage: 'Maximum age'
|
||||
})}
|
||||
value={phaseData[PHASE_ROLLOVER_MAX_AGE_UNITS]}
|
||||
onChange={async e => {
|
||||
await setPhaseData(
|
||||
PHASE_ROLLOVER_MAX_AGE_UNITS,
|
||||
e.target.value
|
||||
);
|
||||
}}
|
||||
options={[
|
||||
{ value: 'd', text: intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.daysLabel',
|
||||
defaultMessage: 'days'
|
||||
}) },
|
||||
{ value: 'h', text: intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.hoursLabel',
|
||||
defaultMessage: 'hours'
|
||||
}) },
|
||||
]}
|
||||
/>
|
||||
</ErrableFormRow>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
</Fragment>
|
||||
) : null}
|
||||
</EuiDescribedFormGroup>
|
||||
errorKey={`${PHASE_ROLLOVER_MAX_AGE}`}
|
||||
isShowingErrors={isShowingErrors}
|
||||
errors={errors}
|
||||
>
|
||||
<EuiFieldNumber
|
||||
id={`${PHASE_HOT}-${PHASE_ROLLOVER_MAX_AGE}`}
|
||||
value={phaseData[PHASE_ROLLOVER_MAX_AGE]}
|
||||
onChange={async e => {
|
||||
await setPhaseData(PHASE_ROLLOVER_MAX_AGE, e.target.value);
|
||||
}}
|
||||
min={1}
|
||||
/>
|
||||
</ErrableFormRow>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem style={{ maxWidth: 188 }}>
|
||||
<ErrableFormRow
|
||||
id={`${PHASE_HOT}-${PHASE_ROLLOVER_MAX_AGE_UNITS}`}
|
||||
hasEmptyLabelSpace
|
||||
errorKey={PHASE_ROLLOVER_MAX_AGE_UNITS}
|
||||
isShowingErrors={isShowingErrors}
|
||||
errors={errors}
|
||||
>
|
||||
<EuiSelect
|
||||
aria-label={intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.maximumAgeUnitsAriaLabel',
|
||||
defaultMessage: 'Maximum age units'
|
||||
})}
|
||||
value={phaseData[PHASE_ROLLOVER_MAX_AGE_UNITS]}
|
||||
onChange={async e => {
|
||||
await setPhaseData(
|
||||
PHASE_ROLLOVER_MAX_AGE_UNITS,
|
||||
e.target.value
|
||||
);
|
||||
}}
|
||||
options={[
|
||||
{ value: 'd', text: intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.daysLabel',
|
||||
defaultMessage: 'days'
|
||||
}) },
|
||||
{ value: 'h', text: intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.hoursLabel',
|
||||
defaultMessage: 'hours'
|
||||
}) },
|
||||
]}
|
||||
/>
|
||||
</ErrableFormRow>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
</Fragment>
|
||||
) : null}
|
||||
</EuiDescribedFormGroup>
|
||||
<SetPriorityInput
|
||||
errors={errors}
|
||||
phaseData={phaseData}
|
||||
phase={PHASE_HOT}
|
||||
isShowingErrors={isShowingErrors}
|
||||
setPhaseData={setPhaseData}
|
||||
/>
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import React, { Fragment } from 'react';
|
||||
import { LearnMoreLink, OptionalLabel } from '../../components';
|
||||
import {
|
||||
EuiFieldNumber,
|
||||
EuiTextColor,
|
||||
EuiDescribedFormGroup
|
||||
} from '@elastic/eui';
|
||||
import {
|
||||
PHASE_INDEX_PRIORITY,
|
||||
} from '../../../store/constants';
|
||||
import { ErrableFormRow } from '../form_errors';
|
||||
import { FormattedMessage } from '@kbn/i18n/react';
|
||||
export const SetPriorityInput = props => {
|
||||
const { errors, phaseData, phase, setPhaseData, isShowingErrors } = props;
|
||||
|
||||
return (
|
||||
<EuiDescribedFormGroup
|
||||
title={
|
||||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.indexPriorityText"
|
||||
defaultMessage="Index priority"
|
||||
/>
|
||||
</p>
|
||||
}
|
||||
description={
|
||||
<EuiTextColor color="subdued">
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.warmPhase.indexPriorityExplanationText"
|
||||
defaultMessage="Determine the order in which your indices are recovered.
|
||||
Indices with higher values for index priority are recovered before indices with lower values."
|
||||
/>{' '}
|
||||
<LearnMoreLink docPath="recovery-prioritization.html" />
|
||||
</EuiTextColor>
|
||||
}
|
||||
titleSize="xs"
|
||||
fullWidth
|
||||
>
|
||||
<ErrableFormRow
|
||||
id={`${phase}-${PHASE_INDEX_PRIORITY}`}
|
||||
label={
|
||||
<Fragment>
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.indexPriorityLabel"
|
||||
defaultMessage="Index priority"
|
||||
/>
|
||||
<OptionalLabel />
|
||||
</Fragment>
|
||||
}
|
||||
errorKey={PHASE_INDEX_PRIORITY}
|
||||
isShowingErrors={isShowingErrors}
|
||||
errors={errors}
|
||||
>
|
||||
<EuiFieldNumber
|
||||
id={`${phase}-${PHASE_INDEX_PRIORITY}`}
|
||||
value={phaseData[PHASE_INDEX_PRIORITY]}
|
||||
onChange={async e => {
|
||||
await setPhaseData(PHASE_INDEX_PRIORITY, e.target.value);
|
||||
}}
|
||||
min={0}
|
||||
/>
|
||||
</ErrableFormRow>
|
||||
</EuiDescribedFormGroup>
|
||||
);
|
||||
};
|
|
@ -32,6 +32,7 @@ import {
|
|||
PHASE_ROLLOVER_MINIMUM_AGE_UNITS,
|
||||
PHASE_SHRINK_ENABLED,
|
||||
} from '../../../../store/constants';
|
||||
import { SetPriorityInput } from '../set_priority_input';
|
||||
import { NodeAllocation } from '../node_allocation';
|
||||
import { ErrableFormRow } from '../../form_errors';
|
||||
import { LearnMoreLink, ActiveBadge, PhaseErrorMessage, OptionalLabel } from '../../../components';
|
||||
|
@ -344,6 +345,13 @@ class WarmPhaseUi extends PureComponent {
|
|||
) : null}
|
||||
</div>
|
||||
</EuiDescribedFormGroup>
|
||||
<SetPriorityInput
|
||||
errors={errors}
|
||||
phaseData={phaseData}
|
||||
phase={PHASE_WARM}
|
||||
isShowingErrors={isShowingErrors}
|
||||
setPhaseData={setPhaseData}
|
||||
/>
|
||||
</Fragment>
|
||||
) : null}
|
||||
</Fragment>
|
||||
|
|
|
@ -103,9 +103,10 @@ class EditPolicyUi extends Component {
|
|||
defaultMessage: 'Please fix the errors on this page.',
|
||||
})
|
||||
);
|
||||
const element = document.getElementById(`${firstError}-row`);
|
||||
const errorRowId = `${firstError.replace('.', '-')}-row`;
|
||||
const element = document.getElementById(errorRowId);
|
||||
if (element) {
|
||||
element.scrollIntoView();
|
||||
element.scrollIntoView({ block: "center", inline: "nearest" });
|
||||
}
|
||||
} else {
|
||||
const success = await saveLifecyclePolicy(lifecycle, saveAsNewPolicy);
|
||||
|
|
|
@ -34,12 +34,14 @@ export const PHASE_SHRINK_ENABLED = 'shrinkEnabled';
|
|||
export const PHASE_NODE_ATTRS = 'selectedNodeAttrs';
|
||||
export const PHASE_PRIMARY_SHARD_COUNT = 'selectedPrimaryShardCount';
|
||||
export const PHASE_REPLICA_COUNT = 'selectedReplicaCount';
|
||||
export const PHASE_INDEX_PRIORITY = 'phaseIndexPriority';
|
||||
|
||||
export const PHASE_ATTRIBUTES_THAT_ARE_NUMBERS_VALIDATE = [
|
||||
PHASE_ROLLOVER_MINIMUM_AGE,
|
||||
PHASE_FORCE_MERGE_SEGMENTS,
|
||||
PHASE_PRIMARY_SHARD_COUNT,
|
||||
PHASE_REPLICA_COUNT,
|
||||
PHASE_INDEX_PRIORITY,
|
||||
];
|
||||
export const PHASE_ATTRIBUTES_THAT_ARE_NUMBERS = [
|
||||
...PHASE_ATTRIBUTES_THAT_ARE_NUMBERS_VALIDATE,
|
||||
|
@ -69,6 +71,7 @@ export const ERROR_STRUCTURE = {
|
|||
[PHASE_ROLLOVER_MAX_AGE_UNITS]: [],
|
||||
[PHASE_ROLLOVER_MAX_SIZE_STORED]: [],
|
||||
[PHASE_ROLLOVER_MAX_SIZE_STORED_UNITS]: [],
|
||||
[PHASE_INDEX_PRIORITY]: []
|
||||
},
|
||||
[PHASE_WARM]: {
|
||||
[PHASE_ROLLOVER_ALIAS]: [],
|
||||
|
@ -78,6 +81,7 @@ export const ERROR_STRUCTURE = {
|
|||
[PHASE_PRIMARY_SHARD_COUNT]: [],
|
||||
[PHASE_REPLICA_COUNT]: [],
|
||||
[PHASE_FORCE_MERGE_SEGMENTS]: [],
|
||||
[PHASE_INDEX_PRIORITY]: []
|
||||
},
|
||||
[PHASE_COLD]: {
|
||||
[PHASE_ROLLOVER_ALIAS]: [],
|
||||
|
@ -85,6 +89,7 @@ export const ERROR_STRUCTURE = {
|
|||
[PHASE_ROLLOVER_MINIMUM_AGE_UNITS]: [],
|
||||
[PHASE_NODE_ATTRS]: [],
|
||||
[PHASE_REPLICA_COUNT]: [],
|
||||
[PHASE_INDEX_PRIORITY]: []
|
||||
},
|
||||
[PHASE_DELETE]: {
|
||||
[PHASE_ROLLOVER_ALIAS]: [],
|
||||
|
|
|
@ -11,6 +11,7 @@ import {
|
|||
PHASE_ROLLOVER_MINIMUM_AGE_UNITS,
|
||||
PHASE_ROLLOVER_ALIAS,
|
||||
PHASE_FREEZE_ENABLED,
|
||||
PHASE_INDEX_PRIORITY,
|
||||
} from '../constants';
|
||||
|
||||
export const defaultColdPhase = {
|
||||
|
@ -20,5 +21,6 @@ export const defaultColdPhase = {
|
|||
[PHASE_ROLLOVER_MINIMUM_AGE_UNITS]: 'd',
|
||||
[PHASE_NODE_ATTRS]: '',
|
||||
[PHASE_REPLICA_COUNT]: '',
|
||||
[PHASE_FREEZE_ENABLED]: false
|
||||
[PHASE_FREEZE_ENABLED]: false,
|
||||
[PHASE_INDEX_PRIORITY]: 0
|
||||
};
|
|
@ -11,6 +11,7 @@ import {
|
|||
PHASE_ROLLOVER_MAX_SIZE_STORED,
|
||||
PHASE_ROLLOVER_MAX_SIZE_STORED_UNITS,
|
||||
PHASE_ROLLOVER_ALIAS,
|
||||
PHASE_INDEX_PRIORITY
|
||||
} from '../constants';
|
||||
|
||||
export const defaultHotPhase = {
|
||||
|
@ -21,4 +22,5 @@ export const defaultHotPhase = {
|
|||
[PHASE_ROLLOVER_MAX_AGE_UNITS]: 'd',
|
||||
[PHASE_ROLLOVER_MAX_SIZE_STORED]: 50,
|
||||
[PHASE_ROLLOVER_MAX_SIZE_STORED_UNITS]: 'gb',
|
||||
[PHASE_INDEX_PRIORITY]: 100
|
||||
};
|
|
@ -14,7 +14,8 @@ import {
|
|||
PHASE_ROLLOVER_MINIMUM_AGE_UNITS,
|
||||
PHASE_ROLLOVER_ALIAS,
|
||||
PHASE_SHRINK_ENABLED,
|
||||
WARM_PHASE_ON_ROLLOVER
|
||||
WARM_PHASE_ON_ROLLOVER,
|
||||
PHASE_INDEX_PRIORITY
|
||||
} from '../constants';
|
||||
|
||||
export const defaultWarmPhase = {
|
||||
|
@ -28,5 +29,6 @@ export const defaultWarmPhase = {
|
|||
[PHASE_SHRINK_ENABLED]: false,
|
||||
[PHASE_PRIMARY_SHARD_COUNT]: '',
|
||||
[PHASE_REPLICA_COUNT]: '',
|
||||
[WARM_PHASE_ON_ROLLOVER]: true
|
||||
[WARM_PHASE_ON_ROLLOVER]: true,
|
||||
[PHASE_INDEX_PRIORITY]: 50
|
||||
};
|
|
@ -22,7 +22,8 @@ import {
|
|||
PHASE_FORCE_MERGE_ENABLED,
|
||||
PHASE_FORCE_MERGE_SEGMENTS,
|
||||
PHASE_REPLICA_COUNT,
|
||||
WARM_PHASE_ON_ROLLOVER
|
||||
WARM_PHASE_ON_ROLLOVER,
|
||||
PHASE_INDEX_PRIORITY
|
||||
} from '../constants';
|
||||
import {
|
||||
getPhase,
|
||||
|
@ -74,10 +75,14 @@ export const validatePhase = (type, phase, errors) => {
|
|||
if (numberedAttribute === PHASE_FORCE_MERGE_SEGMENTS && !phase[PHASE_FORCE_MERGE_ENABLED]) {
|
||||
continue;
|
||||
}
|
||||
// PHASE_REPLICA_COUNT is optional
|
||||
// PHASE_REPLICA_COUNT is optional and can be zero
|
||||
if (numberedAttribute === PHASE_REPLICA_COUNT && !phase[numberedAttribute]) {
|
||||
continue;
|
||||
}
|
||||
// PHASE_INDEX_PRIORITY is optional and can be zero
|
||||
if (numberedAttribute === PHASE_INDEX_PRIORITY && !phase[numberedAttribute]) {
|
||||
continue;
|
||||
}
|
||||
if (!isNumber(phase[numberedAttribute])) {
|
||||
phaseErrors[numberedAttribute] = [numberRequiredMessage];
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ import {
|
|||
MAX_SIZE_TYPE_DOCUMENT,
|
||||
WARM_PHASE_ON_ROLLOVER,
|
||||
PHASE_SHRINK_ENABLED,
|
||||
PHASE_FREEZE_ENABLED
|
||||
PHASE_FREEZE_ENABLED,
|
||||
PHASE_INDEX_PRIORITY
|
||||
} from '../constants';
|
||||
import { filterItems, sortTable } from '../../services';
|
||||
|
||||
|
@ -198,6 +199,9 @@ export const phaseFromES = (phase, phaseName, defaultPolicy) => {
|
|||
if (actions.freeze) {
|
||||
policy[PHASE_FREEZE_ENABLED] = true;
|
||||
}
|
||||
if (actions.set_priority) {
|
||||
policy[PHASE_INDEX_PRIORITY] = actions.set_priority.priority;
|
||||
}
|
||||
}
|
||||
return policy;
|
||||
};
|
||||
|
@ -286,5 +290,10 @@ export const phaseToES = (phase, originalEsPhase) => {
|
|||
} else {
|
||||
delete esPhase.actions.freeze;
|
||||
}
|
||||
if (isNumber(phase[PHASE_INDEX_PRIORITY])) {
|
||||
esPhase.actions.set_priority = {
|
||||
priority: phase[PHASE_INDEX_PRIORITY]
|
||||
};
|
||||
}
|
||||
return esPhase;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue