({
+ watch: [enabledPath],
+ });
+
+ const isHotPhase = phase === 'hot';
+ const isDeletePhase = phase === 'delete';
+ const { setDeletePhaseEnabled } = usePhaseTimings();
+ // hot phase is always enabled
+ const enabled = get(formData, enabledPath) || isHotPhase;
+
+ const { errors } = useFormErrorsContext();
+ const hasErrors = Object.keys(errors[phase]).length > 0;
+
+ return (
+
+
+
+ {!isHotPhase && !isDeletePhase && (
+
+
+
+ )}
+
+
+ {i18nTexts.editPolicy.titles[phase]}
+
+
+ {isHotPhase && (
+
+
+
+
+
+ )}
+ {isDeletePhase && (
+
+ setDeletePhaseEnabled(false)}
+ data-test-subj={'disableDeletePhaseButton'}
+ >
+
+
+
+ )}
+ {hasErrors && (
+
+
+ }
+ />
+
+ )}
+
+
+ {!isHotPhase && enabled && (
+
+
+
+ )}
+
+ );
+};
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.scss b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.scss
new file mode 100644
index 0000000000000..9263db386d012
--- /dev/null
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.scss
@@ -0,0 +1,7 @@
+// offset the vertical line and the phase icons to align with the phase toggle
+.ilmPhases [class*='euiTimelineItemIcon-top'] {
+ padding-top: $euiSize;
+}
+.ilmPhases [class*='euiTimelineItemIcon-top']::before {
+ top: $euiSizeL;
+}
diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.tsx
index e7042e4a26223..b63f0b595a540 100644
--- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.tsx
+++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/edit_policy.tsx
@@ -12,6 +12,8 @@ import { get } from 'lodash';
import { useHistory } from 'react-router-dom';
+import './edit_policy.scss';
+
import {
EuiButton,
EuiButtonEmpty,
@@ -22,6 +24,7 @@ import {
EuiSpacer,
EuiSwitch,
EuiPageHeader,
+ EuiTimeline,
} from '@elastic/eui';
import { TextField, useForm, useFormData, useKibana } from '../../../shared_imports';
@@ -235,27 +238,17 @@ export const EditPolicy: React.FunctionComponent = () => {
-
+
-
-
- {isAllowedByLicense && (
- <>
-
-
- >
- )}
+ {isAllowedByLicense && }
- {/* We can't add the here as it breaks the layout
- and makes the connecting line go further that it needs to.
- There is an issue in EUI to fix this (https://github.com/elastic/eui/issues/4492) */}
-
+