-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ILM] Add shrink field to hot phase (#84087)
* moved shrink field to shared_fields and added it to the hot phase * updated test * update legacy jest test * removed configuration context for now * remove unused i18n and remove duplicated isRolloverEnabled check; * fixed shrink field to use new described field component * added test for removing shrink field in serialization and re-ordered fields in hot phase advanced
- Loading branch information
1 parent
8cdcae2
commit dbd14ad
Showing
15 changed files
with
140 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
.../public/application/sections/edit_policy/components/phases/shared_fields/shrink_field.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* 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 { FormattedMessage } from '@kbn/i18n/react'; | ||
import { EuiFlexGroup, EuiFlexItem, EuiSpacer, EuiTextColor } from '@elastic/eui'; | ||
import React, { FunctionComponent } from 'react'; | ||
|
||
import { UseField, NumericField } from '../../../../../../shared_imports'; | ||
|
||
import { useEditPolicyContext } from '../../../edit_policy_context'; | ||
import { i18nTexts } from '../../../i18n_texts'; | ||
|
||
import { LearnMoreLink, DescribedFormRow } from '../../'; | ||
|
||
interface Props { | ||
phase: 'hot' | 'warm'; | ||
} | ||
|
||
export const ShrinkField: FunctionComponent<Props> = ({ phase }) => { | ||
const path = `phases.${phase}.actions.shrink.number_of_shards`; | ||
const { policy } = useEditPolicyContext(); | ||
return ( | ||
<DescribedFormRow | ||
title={ | ||
<h3> | ||
<FormattedMessage | ||
id="xpack.indexLifecycleMgmt.editPolicy.shrinkText" | ||
defaultMessage="Shrink" | ||
/> | ||
</h3> | ||
} | ||
description={ | ||
<EuiTextColor color="subdued"> | ||
<FormattedMessage | ||
id="xpack.indexLifecycleMgmt.editPolicy.shrinkIndexExplanationText" | ||
defaultMessage="Shrink the index into a new index with fewer primary shards." | ||
/>{' '} | ||
<LearnMoreLink docPath="indices-shrink-index.html#indices-shrink-index" /> | ||
</EuiTextColor> | ||
} | ||
titleSize="xs" | ||
switchProps={{ | ||
'aria-controls': 'shrinkContent', | ||
'data-test-subj': `${phase}-shrinkSwitch`, | ||
label: i18nTexts.editPolicy.shrinkLabel, | ||
'aria-label': i18nTexts.editPolicy.shrinkLabel, | ||
initialValue: Boolean(policy.phases[phase]?.actions?.shrink), | ||
}} | ||
fullWidth | ||
> | ||
<div id="shrinkContent" aria-live="polite" role="region"> | ||
<EuiFlexGroup> | ||
<EuiFlexItem> | ||
<UseField | ||
path={path} | ||
component={NumericField} | ||
componentProps={{ | ||
fullWidth: false, | ||
euiFieldProps: { | ||
'data-test-subj': `${phase}-selectedPrimaryShardCount`, | ||
min: 1, | ||
}, | ||
}} | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
<EuiSpacer /> | ||
</div> | ||
</DescribedFormRow> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.