Skip to content

Commit 3e4f1ed

Browse files
authored
[ILM] Fix data allocation field (#176292)
Fixes #173764 ## Summary This PR fixes the "Custom" data allocation field in the edit IL policy form by adding a default value for the field. Before, there was no default value, so no value would be added to the request until the user changes the initial selection to another option. This explains the bug described from #173764 (in v7.17) where there is only one option and the user is not able to change it to something else so the value of the only option cannot be added to the request. Now with these changes, if the user doesn't make any changes to the initially selected option, the default value would be added to the request. **How to test:** 1. Start Es with `yarn es snapshot` and Kibana with `yarn start`. 2. Go to Stack Management -> Index Lifecycle Policies and start creating a new policy. 3. Type in some name for the policy. Enable the Warm (or Cold) phase and type in some number in the "Move data into phase when" field. Click on "Advanced settings". 4. In the "Data allocation" field, select the "Custom" option. 5. Click on "Show request" and verify that the request correctly shows the `allocation` field (the "Any data node" option doesn't add anything to the request). 6. Select another option for the node attribution field and verify it is displayed in the request. Test the field on cloud by accessing the [CI cloud deployment](https://kibana-pr-176292.kb.us-west2.gcp.elastic-cloud.com:9243/) from this PR or by changing the if-condition in line 65 in `x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/components/node_allocation.tsx` to `if (false)`. Now the "Any data node" option is not available. Follow the test instructions above and verify that the initially selected node attribute option is added to the request.
1 parent 8709754 commit 3e4f1ed

File tree

1 file changed

+3
-0
lines changed
  • x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/components

1 file changed

+3
-0
lines changed

x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared_fields/data_tier_allocation_field/components/node_allocation.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ export const NodeAllocation: FunctionComponent<SharedProps> = ({
100100
<UseField
101101
path={`_meta.${phase}.allocationNodeAttribute`}
102102
component={SelectField}
103+
config={{
104+
defaultValue: nodeAllocationOptions.length ? nodeAllocationOptions[0].value : '',
105+
}}
103106
componentProps={{
104107
helpText: !!selectedAllocationNodeAttribute ? (
105108
<EuiButtonEmpty

0 commit comments

Comments
 (0)