More ilm fixes (#27153)
* fixing issues with index lifecycle summary * correcting action / action time headers * adding placeholder for optional replica fields and removing set to same link * removing include/exclude from policy definitions * changing wording to linked indices * updating test snapshots * changing index alias to index rollover alias * changing minimum age select and label to make timing clearer * adding description of valid policy name * adding link to docs for timing * adding defaults for hot and warm phase * fixing tests and React warnings * fixing spacing issues with min age component * making actions button empty * fixing invalid prop for empty button * setting timzone to utc to fix snapshot tests * copy edits * addressing PR feedback
This commit is contained in:
parent
15ee6deaa9
commit
f2b1ed1772
|
@ -330,73 +330,6 @@ exports[`ilm summary extension should return extension when index has lifecycle
|
|||
className="euiSpacer euiSpacer--s"
|
||||
/>
|
||||
</EuiSpacer>
|
||||
<EuiPopover
|
||||
anchorPosition="downCenter"
|
||||
button={
|
||||
<EuiButtonEmpty
|
||||
color="primary"
|
||||
iconSide="left"
|
||||
onClick={[Function]}
|
||||
type="button"
|
||||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="Stack trace"
|
||||
id="xpack.idxMgmt.indexLifecycleMgmtSummary.stackTraceButton"
|
||||
values={Object {}}
|
||||
/>
|
||||
</EuiButtonEmpty>
|
||||
}
|
||||
closePopover={[Function]}
|
||||
hasArrow={true}
|
||||
id="stackPopover"
|
||||
isOpen={false}
|
||||
ownFocus={false}
|
||||
panelPaddingSize="m"
|
||||
>
|
||||
<EuiOutsideClickDetector
|
||||
onOutsideClick={[Function]}
|
||||
>
|
||||
<div
|
||||
className="euiPopover euiPopover--anchorDownCenter"
|
||||
id="stackPopover"
|
||||
onClick={[Function]}
|
||||
onKeyDown={[Function]}
|
||||
>
|
||||
<div
|
||||
className="euiPopover__anchor"
|
||||
>
|
||||
<EuiButtonEmpty
|
||||
color="primary"
|
||||
iconSide="left"
|
||||
onClick={[Function]}
|
||||
type="button"
|
||||
>
|
||||
<button
|
||||
className="euiButtonEmpty euiButtonEmpty--primary"
|
||||
onClick={[Function]}
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
className="euiButtonEmpty__content"
|
||||
>
|
||||
<span
|
||||
className="euiButtonEmpty__text"
|
||||
>
|
||||
<FormattedMessage
|
||||
defaultMessage="Stack trace"
|
||||
id="xpack.idxMgmt.indexLifecycleMgmtSummary.stackTraceButton"
|
||||
values={Object {}}
|
||||
>
|
||||
Stack trace
|
||||
</FormattedMessage>
|
||||
</span>
|
||||
</span>
|
||||
</button>
|
||||
</EuiButtonEmpty>
|
||||
</div>
|
||||
</div>
|
||||
</EuiOutsideClickDetector>
|
||||
</EuiPopover>
|
||||
</div>
|
||||
</EuiText>
|
||||
</div>
|
||||
|
@ -474,7 +407,7 @@ exports[`ilm summary extension should return extension when index has lifecycle
|
|||
className="euiDescriptionList__title"
|
||||
>
|
||||
<strong>
|
||||
Next action
|
||||
Current action
|
||||
</strong>
|
||||
</dt>
|
||||
</EuiDescriptionListTitle>
|
||||
|
@ -554,7 +487,7 @@ exports[`ilm summary extension should return extension when index has lifecycle
|
|||
className="euiDescriptionList__title"
|
||||
>
|
||||
<strong>
|
||||
Next action time
|
||||
Current action time
|
||||
</strong>
|
||||
</dt>
|
||||
</EuiDescriptionListTitle>
|
||||
|
@ -564,7 +497,7 @@ exports[`ilm summary extension should return extension when index has lifecycle
|
|||
<dd
|
||||
className="euiDescriptionList__description"
|
||||
>
|
||||
1544187775891
|
||||
2018-12-07 13:02:55
|
||||
</dd>
|
||||
</EuiDescriptionListDescription>
|
||||
<EuiPopover
|
||||
|
@ -836,7 +769,7 @@ exports[`ilm summary extension should return extension when index has lifecycle
|
|||
className="euiDescriptionList__title"
|
||||
>
|
||||
<strong>
|
||||
Next action
|
||||
Current action
|
||||
</strong>
|
||||
</dt>
|
||||
</EuiDescriptionListTitle>
|
||||
|
@ -916,7 +849,7 @@ exports[`ilm summary extension should return extension when index has lifecycle
|
|||
className="euiDescriptionList__title"
|
||||
>
|
||||
<strong>
|
||||
Next action time
|
||||
Current action time
|
||||
</strong>
|
||||
</dt>
|
||||
</EuiDescriptionListTitle>
|
||||
|
@ -926,7 +859,7 @@ exports[`ilm summary extension should return extension when index has lifecycle
|
|||
<dd
|
||||
className="euiDescriptionList__description"
|
||||
>
|
||||
1544187775867
|
||||
2018-12-07 13:02:55
|
||||
</dd>
|
||||
</EuiDescriptionListDescription>
|
||||
</dl>
|
||||
|
|
|
@ -153,7 +153,7 @@ exports[`policy table should show empty state when there are not any policies 1`
|
|||
</div>
|
||||
`;
|
||||
|
||||
exports[`policy table should sort when covered indices header is clicked 1`] = `
|
||||
exports[`policy table should sort when linked indices header is clicked 1`] = `
|
||||
Array [
|
||||
"testy1",
|
||||
"testy3",
|
||||
|
@ -168,7 +168,7 @@ Array [
|
|||
]
|
||||
`;
|
||||
|
||||
exports[`policy table should sort when covered indices header is clicked 2`] = `
|
||||
exports[`policy table should sort when linked indices header is clicked 2`] = `
|
||||
Array [
|
||||
"testy104",
|
||||
"testy102",
|
||||
|
|
|
@ -52,7 +52,7 @@ for (let i = 0; i < 105; i++) {
|
|||
modified_date: moment()
|
||||
.subtract(i, 'days')
|
||||
.valueOf(),
|
||||
coveredIndices: i % 2 === 0 ? [`index${i}`] : null,
|
||||
linkedIndices: i % 2 === 0 ? [`index${i}`] : null,
|
||||
name: `testy${i}`,
|
||||
policy: {
|
||||
...policy
|
||||
|
@ -124,8 +124,6 @@ describe('edit policy', () => {
|
|||
save(rendered);
|
||||
expectedErrorMessages(rendered, [
|
||||
policyNameRequiredMessage,
|
||||
maximumSizeRequiredMessage,
|
||||
maximumAgeRequiredMessage,
|
||||
]);
|
||||
});
|
||||
test('should show error when trying to save policy name with space', () => {
|
||||
|
@ -175,6 +173,11 @@ describe('edit policy', () => {
|
|||
test('should show errors when trying to save with no max size and no max age', () => {
|
||||
const rendered = mountWithIntl(component);
|
||||
setPolicyName(rendered, 'mypolicy');
|
||||
const maxSizeInput = rendered.find(`input#hot-selectedMaxSizeStored`);
|
||||
maxSizeInput.simulate('change', { target: { value: '' } });
|
||||
const maxAgeInput = rendered.find(`input#hot-selectedMaxAge`);
|
||||
maxAgeInput.simulate('change', { target: { value: '' } });
|
||||
rendered.update();
|
||||
save(rendered);
|
||||
expectedErrorMessages(rendered, [maximumSizeRequiredMessage, maximumAgeRequiredMessage]);
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@ for (let i = 0; i < 105; i++) {
|
|||
policies.push({
|
||||
version: i,
|
||||
modified_date: moment().subtract(i, 'days').valueOf(),
|
||||
coveredIndices: i % 2 === 0 ? [`index${i}`] : null,
|
||||
linkedIndices: i % 2 === 0 ? [`index${i}`] : null,
|
||||
name: `testy${i}`
|
||||
});
|
||||
}
|
||||
|
@ -135,10 +135,10 @@ describe('policy table', () => {
|
|||
test('should sort when modified date header is clicked', () => {
|
||||
testSort('modified_date');
|
||||
});
|
||||
test('should sort when covered indices header is clicked', () => {
|
||||
testSort('coveredIndices');
|
||||
test('should sort when linked indices header is clicked', () => {
|
||||
testSort('linkedIndices');
|
||||
});
|
||||
test('should have proper actions in context menu when there are covered indices', () => {
|
||||
test('should have proper actions in context menu when there are linked indices', () => {
|
||||
const rendered = openContextMenu(0);
|
||||
const buttons = rendered.find('button.euiContextMenuItem');
|
||||
expect(buttons.length).toBe(3);
|
||||
|
@ -147,7 +147,7 @@ describe('policy table', () => {
|
|||
expect(buttons.at(2).text()).toBe('Delete policy');
|
||||
expect(buttons.at(2).getDOMNode().disabled).toBeTruthy();
|
||||
});
|
||||
test('should have proper actions in context menu when there are not covered indices', () => {
|
||||
test('should have proper actions in context menu when there are not linked indices', () => {
|
||||
const rendered = openContextMenu(1);
|
||||
const buttons = rendered.find('button.euiContextMenuItem');
|
||||
expect(buttons.length).toBe(2);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
import { mountWithIntl } from '../../../test_utils/enzyme_helpers';
|
||||
import moment from 'moment-timezone';
|
||||
import {
|
||||
retryLifecycleActionExtension,
|
||||
removeLifecyclePolicyActionExtension,
|
||||
|
@ -92,6 +93,7 @@ const indexWithLifecycleError = {
|
|||
},
|
||||
},
|
||||
};
|
||||
moment.tz.setDefault('utc');
|
||||
describe('retry lifecycle action extension', () => {
|
||||
test('should return null when no indices have index lifecycle policy', () => {
|
||||
const extension = retryLifecycleActionExtension([indexWithoutLifecyclePolicy]);
|
||||
|
|
|
@ -129,7 +129,7 @@ export class AddLifecyclePolicyConfirmModal extends Component {
|
|||
label={
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.indexManagementTable.addLifecyclePolicyConfirmModal.chooseAliasLabel"
|
||||
defaultMessage="Index alias"
|
||||
defaultMessage="Index rollover alias"
|
||||
/>
|
||||
}
|
||||
>
|
||||
|
|
|
@ -31,11 +31,11 @@ const getHeaders = () => {
|
|||
phase: i18n.translate('xpack.idxMgmt.indexLifecycleMgmtSummary.headers.currentPhaseHeader', {
|
||||
defaultMessage: 'Current phase',
|
||||
}),
|
||||
action: i18n.translate('xpack.idxMgmt.indexLifecycleMgmtSummary.headers.nextActionHeader', {
|
||||
defaultMessage: 'Next action',
|
||||
action: i18n.translate('xpack.idxMgmt.indexLifecycleMgmtSummary.headers.currentActionHeader', {
|
||||
defaultMessage: 'Current action',
|
||||
}),
|
||||
action_time_millis: i18n.translate('xpack.idxMgmt.indexLifecycleMgmtSummary.headers.nextActionTimeHeader', {
|
||||
defaultMessage: 'Next action time',
|
||||
action_time_millis: i18n.translate('xpack.idxMgmt.indexLifecycleMgmtSummary.headers.currentActionTimeHeader', {
|
||||
defaultMessage: 'Current action time',
|
||||
}),
|
||||
failed_step: i18n.translate('xpack.idxMgmt.indexLifecycleMgmtSummary.headers.failedStepHeader', {
|
||||
defaultMessage: 'Failed step',
|
||||
|
@ -63,6 +63,9 @@ export class IndexLifecycleSummary extends Component {
|
|||
this.setState({ showPhaseExecutionPopover: false });
|
||||
}
|
||||
renderStackPopoverButton(ilm) {
|
||||
if (!ilm.stack_trace) {
|
||||
return null;
|
||||
}
|
||||
const button = (
|
||||
<EuiButtonEmpty onClick={this.toggleStackPopover}>
|
||||
<FormattedMessage
|
||||
|
@ -127,7 +130,7 @@ export class IndexLifecycleSummary extends Component {
|
|||
Object.keys(headers).forEach((fieldName, arrayIndex) => {
|
||||
const value = ilm[fieldName];
|
||||
let content;
|
||||
if (fieldName === 'action_time') {
|
||||
if (fieldName === 'action_time_millis') {
|
||||
content = moment(value).format('YYYY-MM-DD HH:mm:ss');
|
||||
} else if (fieldName === 'policy') {
|
||||
content = (<EuiLink href={getPolicyPath(value)}>{value}</EuiLink>);
|
||||
|
@ -169,7 +172,7 @@ export class IndexLifecycleSummary extends Component {
|
|||
/>
|
||||
</h3>
|
||||
</EuiTitle>
|
||||
{ ilm.step_info && ilm.step_info.type && ilm.step_info.stack_trace ? (
|
||||
{ ilm.step_info && ilm.step_info.type ? (
|
||||
<Fragment>
|
||||
<EuiSpacer size="s"/>
|
||||
<EuiCallOut
|
||||
|
|
|
@ -11,19 +11,19 @@ import { connect } from 'react-redux';
|
|||
import { ColdPhase as PresentationComponent } from './cold_phase';
|
||||
import {
|
||||
getPhase,
|
||||
getPhaseData
|
||||
} from '../../../../store/selectors';
|
||||
import { setPhaseData } from '../../../../store/actions';
|
||||
import {
|
||||
PHASE_COLD,
|
||||
PHASE_WARM,
|
||||
PHASE_REPLICA_COUNT
|
||||
PHASE_HOT,
|
||||
PHASE_ROLLOVER_ENABLED
|
||||
} from '../../../../store/constants';
|
||||
|
||||
export const ColdPhase = connect(
|
||||
(state) => ({
|
||||
phaseData: getPhase(state, PHASE_COLD),
|
||||
warmPhaseReplicaCount: getPhaseData(state, PHASE_WARM, PHASE_REPLICA_COUNT)
|
||||
hotPhaseRolloverEnabled: getPhase(state, PHASE_HOT)[PHASE_ROLLOVER_ENABLED],
|
||||
|
||||
}),
|
||||
{
|
||||
setPhaseData: (key, value) => setPhaseData(PHASE_COLD, key, value),
|
||||
|
|
|
@ -12,9 +12,7 @@ import {
|
|||
EuiFlexGroup,
|
||||
EuiFlexItem,
|
||||
EuiSpacer,
|
||||
EuiFormRow,
|
||||
EuiFieldNumber,
|
||||
EuiButtonEmpty,
|
||||
EuiDescribedFormGroup,
|
||||
EuiButton,
|
||||
} from '@elastic/eui';
|
||||
|
@ -48,16 +46,16 @@ class ColdPhaseUi extends PureComponent {
|
|||
[PHASE_NODE_ATTRS]: PropTypes.string.isRequired,
|
||||
[PHASE_REPLICA_COUNT]: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
||||
}).isRequired,
|
||||
warmPhaseReplicaCount: PropTypes.number.isRequired,
|
||||
};
|
||||
render() {
|
||||
const {
|
||||
setPhaseData,
|
||||
showNodeDetailsFlyout,
|
||||
phaseData,
|
||||
warmPhaseReplicaCount,
|
||||
errors,
|
||||
isShowingErrors,
|
||||
intl,
|
||||
hotPhaseRolloverEnabled
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
|
@ -125,6 +123,7 @@ class ColdPhaseUi extends PureComponent {
|
|||
phase={PHASE_COLD}
|
||||
isShowingErrors={isShowingErrors}
|
||||
setPhaseData={setPhaseData}
|
||||
rolloverEnabled={hotPhaseRolloverEnabled}
|
||||
/>
|
||||
<EuiSpacer />
|
||||
|
||||
|
@ -153,6 +152,12 @@ class ColdPhaseUi extends PureComponent {
|
|||
errorKey={PHASE_REPLICA_COUNT}
|
||||
isShowingErrors={isShowingErrors}
|
||||
errors={errors}
|
||||
helpText={
|
||||
intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.coldPhase.replicaCountHelpText',
|
||||
defaultMessage: 'By default, the number of replicas remains the same.'
|
||||
})
|
||||
}
|
||||
>
|
||||
<EuiFieldNumber
|
||||
id={`${PHASE_COLD}-${PHASE_REPLICA_COUNT}`}
|
||||
|
@ -164,16 +169,6 @@ class ColdPhaseUi extends PureComponent {
|
|||
/>
|
||||
</ErrableFormRow>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem grow={false}>
|
||||
<EuiFormRow hasEmptyLabelSpace>
|
||||
<EuiButtonEmpty
|
||||
flush="left"
|
||||
onClick={() => setPhaseData(PHASE_REPLICA_COUNT, warmPhaseReplicaCount)}
|
||||
>
|
||||
Set to same number as warm phase
|
||||
</EuiButtonEmpty>
|
||||
</EuiFormRow>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
</Fragment>
|
||||
) : <div />}
|
||||
|
|
|
@ -8,11 +8,13 @@ import { connect } from 'react-redux';
|
|||
import { DeletePhase as PresentationComponent } from './delete_phase';
|
||||
import { getPhase } from '../../../../store/selectors';
|
||||
import { setPhaseData } from '../../../../store/actions';
|
||||
import { PHASE_DELETE } from '../../../../store/constants';
|
||||
import { PHASE_DELETE, PHASE_HOT, PHASE_ROLLOVER_ENABLED } from '../../../../store/constants';
|
||||
|
||||
export const DeletePhase = connect(
|
||||
state => ({
|
||||
phaseData: getPhase(state, PHASE_DELETE)
|
||||
phaseData: getPhase(state, PHASE_DELETE),
|
||||
hotPhaseRolloverEnabled: getPhase(state, PHASE_HOT)[PHASE_ROLLOVER_ENABLED],
|
||||
|
||||
}),
|
||||
{
|
||||
setPhaseData: (key, value) => setPhaseData(PHASE_DELETE, key, value)
|
||||
|
|
|
@ -45,6 +45,7 @@ export class DeletePhase extends PureComponent {
|
|||
phaseData,
|
||||
errors,
|
||||
isShowingErrors,
|
||||
hotPhaseRolloverEnabled
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
|
@ -112,6 +113,7 @@ export class DeletePhase extends PureComponent {
|
|||
phase={PHASE_DELETE}
|
||||
isShowingErrors={isShowingErrors}
|
||||
setPhaseData={setPhaseData}
|
||||
rolloverEnabled={hotPhaseRolloverEnabled}
|
||||
/>
|
||||
) : <div />}
|
||||
</div>
|
||||
|
|
|
@ -11,13 +11,14 @@ import { connect } from 'react-redux';
|
|||
import { HotPhase as PresentationComponent } from './hot_phase';
|
||||
import { getPhase } from '../../../../store/selectors';
|
||||
import { setPhaseData } from '../../../../store/actions';
|
||||
import { PHASE_HOT } from '../../../../store/constants';
|
||||
import { PHASE_HOT, PHASE_WARM, WARM_PHASE_ON_ROLLOVER } from '../../../../store/constants';
|
||||
|
||||
export const HotPhase = connect(
|
||||
state => ({
|
||||
phaseData: getPhase(state, PHASE_HOT)
|
||||
}),
|
||||
{
|
||||
setPhaseData: (key, value) => setPhaseData(PHASE_HOT, key, value)
|
||||
setPhaseData: (key, value) => setPhaseData(PHASE_HOT, key, value),
|
||||
setWarmPhaseOnRollover: (value) => setPhaseData(PHASE_WARM, WARM_PHASE_ON_ROLLOVER, value)
|
||||
},
|
||||
)(PresentationComponent);
|
||||
|
|
|
@ -59,7 +59,8 @@ class HotPhaseUi extends PureComponent {
|
|||
phaseData,
|
||||
isShowingErrors,
|
||||
errors,
|
||||
intl
|
||||
intl,
|
||||
setWarmPhaseOnRollover
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
|
@ -119,7 +120,9 @@ class HotPhaseUi extends PureComponent {
|
|||
data-test-subj="rolloverSwitch"
|
||||
checked={phaseData[PHASE_ROLLOVER_ENABLED]}
|
||||
onChange={async e => {
|
||||
await setPhaseData(PHASE_ROLLOVER_ENABLED, e.target.checked);
|
||||
const { checked } = e.target;
|
||||
setPhaseData(PHASE_ROLLOVER_ENABLED, checked);
|
||||
setWarmPhaseOnRollover(checked);
|
||||
}}
|
||||
label={intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.hotPhase.enableRolloverLabel',
|
||||
|
|
|
@ -4,27 +4,59 @@
|
|||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import { EuiFieldNumber, EuiFlexGroup, EuiFlexItem, EuiFormRow, EuiSelect } from '@elastic/eui';
|
||||
import { LearnMoreLink } from '../../components';
|
||||
import {
|
||||
EuiFieldNumber,
|
||||
EuiFlexGroup,
|
||||
EuiFlexItem,
|
||||
EuiFormRow,
|
||||
EuiSelect,
|
||||
} from '@elastic/eui';
|
||||
import {
|
||||
PHASE_ROLLOVER_MINIMUM_AGE,
|
||||
PHASE_ROLLOVER_MINIMUM_AGE_UNITS,
|
||||
} from '../../../store/constants';
|
||||
import { ErrableFormRow } from '../form_errors';
|
||||
import { injectI18n } from '@kbn/i18n/react';
|
||||
import { injectI18n, FormattedMessage } from '@kbn/i18n/react';
|
||||
const MinAgeInputUi = props => {
|
||||
const { errors, phaseData, phase, setPhaseData, isShowingErrors, intl } = props;
|
||||
const { rolloverEnabled, errors, phaseData, phase, setPhaseData, isShowingErrors, intl } = props;
|
||||
const fromMessage = rolloverEnabled
|
||||
? intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.editPolicy.fromRolloverMessage',
|
||||
defaultMessage: 'from rollover',
|
||||
})
|
||||
: intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.editPolicy.fromIndexCreationMessage',
|
||||
defaultMessage: 'from index creation',
|
||||
});
|
||||
return (
|
||||
<EuiFlexGroup>
|
||||
<EuiFlexItem style={{ maxWidth: 188 }}>
|
||||
<ErrableFormRow
|
||||
id={`${phase}-${PHASE_ROLLOVER_MINIMUM_AGE}`}
|
||||
label={intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.editPolicy.minimimAgeLabel',
|
||||
defaultMessage: 'Move to {phase} phase after',
|
||||
}, { phase })}
|
||||
label={
|
||||
intl.formatMessage(
|
||||
{
|
||||
id: 'xpack.indexLifecycleMgmt.editPolicy.minimimAgeLabel',
|
||||
defaultMessage: 'Timing for {phase} phase',
|
||||
},
|
||||
{ phase }
|
||||
)
|
||||
}
|
||||
errorKey={PHASE_ROLLOVER_MINIMUM_AGE}
|
||||
isShowingErrors={isShowingErrors}
|
||||
errors={errors}
|
||||
helpText={
|
||||
<LearnMoreLink
|
||||
docPath="_timing.html"
|
||||
text={
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.learnAboutTimingText"
|
||||
defaultMessage="Learn about timing"
|
||||
/>
|
||||
}
|
||||
/>
|
||||
}
|
||||
>
|
||||
<EuiFieldNumber
|
||||
id={`${phase}-${PHASE_ROLLOVER_MINIMUM_AGE}`}
|
||||
|
@ -36,29 +68,42 @@ const MinAgeInputUi = props => {
|
|||
/>
|
||||
</ErrableFormRow>
|
||||
</EuiFlexItem>
|
||||
<EuiFlexItem style={{ maxWidth: 188 }}>
|
||||
<EuiFormRow hasEmptyLabelSpace>
|
||||
<EuiFlexItem style={{ maxWidth: 220 }}>
|
||||
<EuiFormRow hasEmptyLabelSpace >
|
||||
<EuiSelect
|
||||
aria-label={intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.editPolicy.minimimAgeUnitsAriaLabel',
|
||||
defaultMessage: '{phaseUpper} phase after units',
|
||||
}, { phaseUpper: `${phase.charAt(0).toUpperCase()}${phase.slice(1)}` })}
|
||||
aria-label={intl.formatMessage(
|
||||
{
|
||||
id: 'xpack.indexLifecycleMgmt.editPolicy.minimimAgeUnitsAriaLabel',
|
||||
defaultMessage: '{phaseUpper} phase after units',
|
||||
},
|
||||
{ phaseUpper: `${phase.charAt(0).toUpperCase()}${phase.slice(1)}` }
|
||||
)}
|
||||
value={phaseData[PHASE_ROLLOVER_MINIMUM_AGE_UNITS]}
|
||||
onChange={e => setPhaseData(PHASE_ROLLOVER_MINIMUM_AGE_UNITS, e.target.value)}
|
||||
options={[
|
||||
{
|
||||
value: 'd',
|
||||
text: intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.editPolicy.daysLabel',
|
||||
defaultMessage: 'days',
|
||||
}),
|
||||
text: intl.formatMessage(
|
||||
{
|
||||
id: 'xpack.indexLifecycleMgmt.editPolicy.daysLabel',
|
||||
defaultMessage: 'days {fromMessage}',
|
||||
},
|
||||
{
|
||||
fromMessage,
|
||||
}
|
||||
),
|
||||
},
|
||||
{
|
||||
value: 'h',
|
||||
text: intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.editPolicy.hoursLabel',
|
||||
defaultMessage: 'hours',
|
||||
}),
|
||||
text: intl.formatMessage(
|
||||
{
|
||||
id: 'xpack.indexLifecycleMgmt.editPolicy.hoursLabel',
|
||||
defaultMessage: 'hours {fromMessage}',
|
||||
},
|
||||
{
|
||||
fromMessage,
|
||||
}
|
||||
),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
|
|
@ -164,6 +164,7 @@ class WarmPhaseUi extends PureComponent {
|
|||
phase={PHASE_WARM}
|
||||
isShowingErrors={isShowingErrors}
|
||||
setPhaseData={setPhaseData}
|
||||
rolloverEnabled={hotPhaseRolloverEnabled}
|
||||
/>
|
||||
) : null}
|
||||
|
||||
|
@ -194,6 +195,12 @@ class WarmPhaseUi extends PureComponent {
|
|||
errorKey={PHASE_REPLICA_COUNT}
|
||||
isShowingErrors={isShowingErrors}
|
||||
errors={errors}
|
||||
helpText={
|
||||
intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.warmPhase.replicaCountHelpText',
|
||||
defaultMessage: 'By default, the number of replicas remains the same.'
|
||||
})
|
||||
}
|
||||
>
|
||||
<EuiFieldNumber
|
||||
id={`${PHASE_WARM}-${PHASE_REPLICA_COUNT}`}
|
||||
|
|
|
@ -175,7 +175,7 @@ class EditPolicyUi extends Component {
|
|||
text={
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.learnAboutIndexLifecycleManagementLinkText"
|
||||
defaultMessage="Learn about the index lifecycle"
|
||||
defaultMessage="Learn about the index lifecycle."
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
@ -248,6 +248,12 @@ class EditPolicyUi extends Component {
|
|||
errorKey={STRUCTURE_POLICY_NAME}
|
||||
isShowingErrors={isShowingErrors}
|
||||
errors={errors}
|
||||
helpText={
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.editPolicy.validPolicyNameMessage"
|
||||
defaultMessage="A policy name cannot start with an underscore and cannot contain a question mark or a space."
|
||||
/>
|
||||
}
|
||||
>
|
||||
<EuiFieldText
|
||||
data-test-subj="policyNameField"
|
||||
|
|
|
@ -16,6 +16,7 @@ import { RIGHT_ALIGNMENT } from '@elastic/eui/lib/services';
|
|||
import {
|
||||
EuiBetaBadge,
|
||||
EuiButton,
|
||||
EuiButtonEmpty,
|
||||
EuiLink,
|
||||
EuiEmptyPrompt,
|
||||
EuiFieldSearch,
|
||||
|
@ -48,9 +49,9 @@ const COLUMNS = {
|
|||
defaultMessage: 'Name',
|
||||
}),
|
||||
},
|
||||
coveredIndices: {
|
||||
label: i18n.translate('xpack.indexLifecycleMgmt.policyTable.headers.coveredIndicesHeader', {
|
||||
defaultMessage: 'Covered indices',
|
||||
linkedIndices: {
|
||||
label: i18n.translate('xpack.indexLifecycleMgmt.policyTable.headers.linkedIndicesHeader', {
|
||||
defaultMessage: 'Linked indices',
|
||||
}),
|
||||
width: 120,
|
||||
},
|
||||
|
@ -180,7 +181,7 @@ export class PolicyTableUi extends Component {
|
|||
{value}
|
||||
</EuiLink>
|
||||
);
|
||||
} else if (fieldName === 'coveredIndices') {
|
||||
} else if (fieldName === 'linkedIndices') {
|
||||
return (
|
||||
<EuiText>
|
||||
<b>{value ? value.length : '0'}</b>
|
||||
|
@ -216,7 +217,7 @@ export class PolicyTableUi extends Component {
|
|||
}
|
||||
buildActionPanelTree(policy) {
|
||||
const { intl } = this.props;
|
||||
const hasCoveredIndices = Boolean(policy.coveredIndices && policy.coveredIndices.length);
|
||||
const hasLinkedIndices = Boolean(policy.linkedIndices && policy.linkedIndices.length);
|
||||
|
||||
const viewIndicesLabel = intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.policyTable.viewIndicesButtonText',
|
||||
|
@ -230,14 +231,14 @@ export class PolicyTableUi extends Component {
|
|||
id: 'xpack.indexLifecycleMgmt.policyTable.deletePolicyButtonText',
|
||||
defaultMessage: 'Delete policy',
|
||||
});
|
||||
const deletePolicyTooltip = hasCoveredIndices
|
||||
const deletePolicyTooltip = hasLinkedIndices
|
||||
? intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.policyTable.deletePolicyButtonDisabledTooltip',
|
||||
defaultMessage: 'You cannot delete a policy that is being used by an index',
|
||||
})
|
||||
: null;
|
||||
const items = [];
|
||||
if (hasCoveredIndices) {
|
||||
if (hasLinkedIndices) {
|
||||
items.push({
|
||||
name: viewIndicesLabel,
|
||||
icon: 'list',
|
||||
|
@ -257,7 +258,7 @@ export class PolicyTableUi extends Component {
|
|||
});
|
||||
items.push({
|
||||
name: deletePolicyLabel,
|
||||
disabled: hasCoveredIndices,
|
||||
disabled: hasLinkedIndices,
|
||||
icon: 'trash',
|
||||
toolTipContent: deletePolicyTooltip,
|
||||
onClick: () =>
|
||||
|
@ -312,19 +313,17 @@ export class PolicyTableUi extends Component {
|
|||
);
|
||||
});
|
||||
const button = (
|
||||
<EuiButton
|
||||
<EuiButtonEmpty
|
||||
data-test-subj="policyActionsContextMenuButton"
|
||||
iconSide="left"
|
||||
aria-label="Policy options"
|
||||
onClick={() => this.togglePolicyPopover(policy)}
|
||||
iconType="arrowDown"
|
||||
fill
|
||||
color="primary"
|
||||
>
|
||||
{intl.formatMessage({
|
||||
id: 'xpack.indexLifecycleMgmt.policyTable.actionsButtonText',
|
||||
defaultMessage: 'Actions',
|
||||
})}
|
||||
</EuiButton>
|
||||
</EuiButtonEmpty>
|
||||
);
|
||||
cells.push(
|
||||
<EuiTableRowCell
|
||||
|
@ -477,7 +476,8 @@ export class PolicyTableUi extends Component {
|
|||
<p>
|
||||
<FormattedMessage
|
||||
id="xpack.indexLifecycleMgmt.policyTable.sectionDescription"
|
||||
defaultMessage="Create, update, and delete your index lifecycle policies."
|
||||
defaultMessage="Manage your indices as they age. Attach a policy to automate
|
||||
when and how to transition an index through its lifecycle."
|
||||
/>
|
||||
</p>
|
||||
</EuiText>
|
||||
|
|
|
@ -12,7 +12,7 @@ const arraySort = (fieldName) => (item) => (item[fieldName] || []).length;
|
|||
const sorters = {
|
||||
version: stringSort('version'),
|
||||
name: stringSort('name'),
|
||||
coveredIndices: arraySort('coveredIndices'),
|
||||
linkedIndices: arraySort('linkedIndices'),
|
||||
modified_date: stringSort('modified_date')
|
||||
|
||||
};
|
||||
|
|
|
@ -17,8 +17,8 @@ export const defaultHotPhase = {
|
|||
[PHASE_ENABLED]: true,
|
||||
[PHASE_ROLLOVER_ENABLED]: true,
|
||||
[PHASE_ROLLOVER_ALIAS]: '',
|
||||
[PHASE_ROLLOVER_MAX_AGE]: '',
|
||||
[PHASE_ROLLOVER_MAX_AGE]: 30,
|
||||
[PHASE_ROLLOVER_MAX_AGE_UNITS]: 'd',
|
||||
[PHASE_ROLLOVER_MAX_SIZE_STORED]: '',
|
||||
[PHASE_ROLLOVER_MAX_SIZE_STORED]: 50,
|
||||
[PHASE_ROLLOVER_MAX_SIZE_STORED_UNITS]: 'gb',
|
||||
};
|
|
@ -28,5 +28,5 @@ export const defaultWarmPhase = {
|
|||
[PHASE_SHRINK_ENABLED]: false,
|
||||
[PHASE_PRIMARY_SHARD_COUNT]: '',
|
||||
[PHASE_REPLICA_COUNT]: '',
|
||||
[WARM_PHASE_ON_ROLLOVER]: false
|
||||
[WARM_PHASE_ON_ROLLOVER]: true
|
||||
};
|
|
@ -245,8 +245,6 @@ export const phaseToES = (state, phase) => {
|
|||
if (phase[PHASE_NODE_ATTRS]) {
|
||||
const [ name, value, ] = phase[PHASE_NODE_ATTRS].split(':');
|
||||
esPhase.actions.allocate = {
|
||||
include: {},
|
||||
exclude: {},
|
||||
require: {
|
||||
[name]: value
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ async function fetchPolicies(callWithRequest) {
|
|||
|
||||
return await callWithRequest('transport.request', params);
|
||||
}
|
||||
async function addCoveredIndices(policiesMap, callWithRequest) {
|
||||
async function addLinkedIndices(policiesMap, callWithRequest) {
|
||||
if (policiesMap.status === 404) {
|
||||
return policiesMap;
|
||||
}
|
||||
|
@ -46,9 +46,9 @@ async function addCoveredIndices(policiesMap, callWithRequest) {
|
|||
|
||||
const policyExplanation = await callWithRequest('transport.request', params);
|
||||
Object.entries(policyExplanation.indices).forEach(([indexName, { policy }]) => {
|
||||
if (policy) {
|
||||
policiesMap[policy].coveredIndices = policiesMap[policy].coveredIndices || [];
|
||||
policiesMap[policy].coveredIndices.push(indexName);
|
||||
if (policy && policiesMap[policy]) {
|
||||
policiesMap[policy].linkedIndices = policiesMap[policy].linkedIndices || [];
|
||||
policiesMap[policy].linkedIndices.push(indexName);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ export function registerFetchRoute(server) {
|
|||
try {
|
||||
const policiesMap = await fetchPolicies(callWithRequest);
|
||||
if (withIndices) {
|
||||
await addCoveredIndices(policiesMap, callWithRequest);
|
||||
await addLinkedIndices(policiesMap, callWithRequest);
|
||||
}
|
||||
return formatPolicies(policiesMap);
|
||||
} catch (err) {
|
||||
|
|
Loading…
Reference in a new issue