Skip to content

Commit 364855c

Browse files
committed
Update ILM form
1 parent 24f0e4a commit 364855c

File tree

5 files changed

+25
-9
lines changed

5 files changed

+25
-9
lines changed

x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/cold_phase.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import React, { FunctionComponent, Fragment } from 'react';
88
import { FormattedMessage } from '@kbn/i18n/react';
99
import { i18n } from '@kbn/i18n';
10+
import { get } from 'lodash';
1011

1112
import { EuiFieldNumber, EuiDescribedFormGroup, EuiSwitch, EuiTextColor } from '@elastic/eui';
1213

@@ -56,10 +57,12 @@ export const ColdPhase: FunctionComponent<Props> = ({
5657
errors,
5758
isShowingErrors,
5859
}) => {
59-
const [{ [useRolloverPath]: hotPhaseRolloverEnabled }] = useFormData({
60+
const [formData] = useFormData({
6061
watch: [useRolloverPath],
6162
});
6263

64+
const hotPhaseRolloverEnabled = get(formData, useRolloverPath);
65+
6366
return (
6467
<div id="coldPhaseContent" aria-live="polite" role="region">
6568
<>

x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/delete_phase.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import React, { FunctionComponent, Fragment } from 'react';
8+
import { get } from 'lodash';
89
import { FormattedMessage } from '@kbn/i18n/react';
910
import { EuiDescribedFormGroup, EuiSwitch, EuiTextColor, EuiFormRow } from '@elastic/eui';
1011

@@ -48,10 +49,12 @@ export const DeletePhase: FunctionComponent<Props> = ({
4849
isShowingErrors,
4950
getUrlForApp,
5051
}) => {
51-
const [{ [useRolloverPath]: hotPhaseRolloverEnabled }] = useFormData({
52-
watch: [useRolloverPath],
52+
const [formData] = useFormData({
53+
watch: useRolloverPath,
5354
});
5455

56+
const hotPhaseRolloverEnabled = get(formData, useRolloverPath);
57+
5558
return (
5659
<div id="deletePhaseContent" aria-live="polite" role="region">
5760
<EuiDescribedFormGroup

x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/hot_phase/hot_phase.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import React, { Fragment, FunctionComponent, useEffect, useState } from 'react';
8+
import { get } from 'lodash';
89
import { FormattedMessage } from '@kbn/i18n/react';
910
import { i18n } from '@kbn/i18n';
1011
import {
@@ -45,8 +46,11 @@ const hotProperty: keyof Phases = 'hot';
4546
export const HotPhase: FunctionComponent<{ setWarmPhaseOnRollover: (v: boolean) => void }> = ({
4647
setWarmPhaseOnRollover,
4748
}) => {
48-
const [{ [useRolloverPath]: isRolloverEnabled }] = useFormData({ watch: [useRolloverPath] });
4949
const form = useFormContext();
50+
const [formData] = useFormData({
51+
watch: useRolloverPath,
52+
});
53+
const isRolloverEnabled = get(formData, useRolloverPath);
5054

5155
const isShowingErrors = form.isValid === false;
5256
const [showEmptyRolloverFieldsError, setShowEmptyRolloverFieldsError] = useState(false);

x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/shared/forcemerge_field.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6-
6+
import { get } from 'lodash';
77
import { FormattedMessage } from '@kbn/i18n/react';
88
import { EuiDescribedFormGroup, EuiSpacer, EuiTextColor } from '@elastic/eui';
99
import React from 'react';
@@ -23,9 +23,11 @@ interface Props {
2323
const forceMergeEnabledPath = '_meta.hot.forceMergeEnabled';
2424

2525
export const Forcemerge: React.FunctionComponent<Props> = ({ phase }) => {
26-
const [{ [forceMergeEnabledPath]: forceMergeEnabled }] = useFormData({
27-
watch: [forceMergeEnabledPath],
26+
const [formData] = useFormData({
27+
watch: forceMergeEnabledPath,
2828
});
29+
const forceMergeEnabled = get(formData, forceMergeEnabledPath);
30+
2931
return (
3032
<EuiDescribedFormGroup
3133
title={

x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/warm_phase.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
import React, { Fragment, FunctionComponent } from 'react';
8+
import { get } from 'lodash';
89
import { FormattedMessage } from '@kbn/i18n/react';
910
import { i18n } from '@kbn/i18n';
1011
import {
@@ -73,9 +74,12 @@ export const WarmPhase: FunctionComponent<Props> = ({
7374
errors,
7475
isShowingErrors,
7576
}) => {
76-
const [{ [useRolloverPath]: hotPhaseRolloverEnabled }] = useFormData({
77-
watch: [useRolloverPath],
77+
const [formData] = useFormData({
78+
watch: useRolloverPath,
7879
});
80+
81+
const hotPhaseRolloverEnabled = get(formData, useRolloverPath);
82+
7983
return (
8084
<div id="warmPhaseContent" aria-live="polite" role="region" aria-relevant="additions">
8185
<>

0 commit comments

Comments
 (0)