From 180a0c76b8f1618970f512505b2114a61efb578c Mon Sep 17 00:00:00 2001 From: Yulia Cech Date: Thu, 4 Feb 2021 12:14:34 +0100 Subject: [PATCH] Added new design --- .../components/phase_footer/phase_footer.tsx | 6 +- .../components/phase_icon/index.ts | 7 + .../components/phase_icon/phase_icon.scss | 28 ++++ .../components/phase_icon/phase_icon.tsx | 31 ++++ .../phases/delete_phase/delete_phase.scss | 17 +- .../phases/delete_phase/delete_phase.tsx | 63 ++++---- .../edit_policy/components/phases/phase.scss | 18 ++- .../edit_policy/components/phases/phase.tsx | 151 +++++++----------- .../sections/edit_policy/edit_policy.tsx | 16 +- 9 files changed, 198 insertions(+), 139 deletions(-) create mode 100644 x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_icon/index.ts create mode 100644 x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_icon/phase_icon.scss create mode 100644 x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_icon/phase_icon.tsx diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_footer/phase_footer.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_footer/phase_footer.tsx index b7d71120928ac0..876da65a1bfb11 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_footer/phase_footer.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_footer/phase_footer.tsx @@ -27,7 +27,7 @@ export const PhaseFooter: FunctionComponent = ({ phase }) => { if (phaseConfiguration === 'disabled' || phaseConfiguration === 'enabled') { return ( - +   ); @@ -35,7 +35,7 @@ export const PhaseFooter: FunctionComponent = ({ phase }) => { if (phaseConfiguration === 'forever') { return ( - + {' '} = ({ phase }) => { } return ( - + {' '} = ({ enabled, phase }) => { + return ( +
+ {enabled ? ( + + ) : ( + + )} +
+ ); +}; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/delete_phase/delete_phase.scss b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/delete_phase/delete_phase.scss index 90c057d2512c81..aa92ce5dd839b4 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/delete_phase/delete_phase.scss +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/delete_phase/delete_phase.scss @@ -1,4 +1,15 @@ -.euiPanel.ilmDeletePhase { - // border is only shown in v7 to compensate for panels not having background color - border-color: $euiColorDanger; +.ilmDeletePhase { + .euiCommentEvent { + &__header { + padding: $euiSize; + background-color: $euiColorEmptyShade; + + } + &__body { + padding: $euiSize; + background-color: $euiColorLightestShade; + + } + + } } diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/delete_phase/delete_phase.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/delete_phase/delete_phase.tsx index 58c5eb9bd7f1d2..7ab9679a961d34 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/delete_phase/delete_phase.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/delete_phase/delete_phase.tsx @@ -7,13 +7,13 @@ import React, { FunctionComponent } from 'react'; import { get } from 'lodash'; import { - EuiPanel, EuiFlexItem, EuiFlexGroup, EuiTitle, EuiButtonEmpty, EuiSpacer, EuiText, + EuiComment, } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; @@ -26,6 +26,7 @@ import { usePhaseTimings } from '../../../form'; import { MinAgeField, SnapshotPoliciesField } from '../shared_fields'; import './delete_phase.scss'; +import { PhaseIcon } from '../../phase_icon'; const formFieldPaths = { enabled: '_meta.delete.enabled', @@ -42,44 +43,40 @@ export const DeletePhase: FunctionComponent = () => { if (!enabled) { return null; } + const phaseTitle = ( + + + +

{i18nTexts.editPolicy.titles.delete}

+
+
+ + + setDeletePhaseEnabled(false)} + data-test-subj={'disableDeletePhaseButton'} + > + + + +
+ ); return ( - - - - -

{i18nTexts.editPolicy.titles.delete}

-
-
- - - - - - - setDeletePhaseEnabled(false)} - iconType={'cross'} - color={'danger'} - size="xs" - iconSide="left" - data-test-subj={'disableDeletePhaseButton'} - > - - - - - -
- + } + className="ilmDeletePhase" + timelineIcon={} + > {i18nTexts.editPolicy.descriptions.delete} -
+ ); }; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/phase.scss b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/phase.scss index 89555eb246c88c..033dd145f539c8 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/phase.scss +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/phase.scss @@ -1,6 +1,18 @@ -.ilmPhasePanel { - padding: 0; - .ilmPhasePanel__inner { +.ilmPhase { + .euiCommentEvent { + &__header { + padding: $euiSize; + background-color: $euiColorEmptyShade; + } + &__body { + padding: 0; + } + + } + &__inner { padding: $euiSize; } + .ilmSettingsButton { + color: $euiColorPrimary; + } } diff --git a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/phase.tsx b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/phase.tsx index 7391e5388ecd90..8fda097e5f1712 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/phase.tsx +++ b/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phases/phase.tsx @@ -4,16 +4,16 @@ * you may not use this file except in compliance with the Elastic License. */ -import React, { FunctionComponent, useState } from 'react'; +import React, { FunctionComponent } from 'react'; import { EuiFlexGroup, EuiFlexItem, - EuiPanel, EuiTitle, - EuiSpacer, EuiText, - EuiButtonEmpty, + EuiComment, + EuiAccordion, + EuiSpacer, } from '@elastic/eui'; import { get } from 'lodash'; import { FormattedMessage } from '@kbn/i18n/react'; @@ -22,12 +22,11 @@ import { ToggleField, UseField, useFormData } from '../../../../../shared_import import { i18nTexts } from '../../i18n_texts'; import { FormInternal } from '../../types'; -import { ActiveHighlight } from '../active_highlight'; import { MinAgeField } from './shared_fields'; -import { PhaseFooter } from '../phase_footer'; - import './phase.scss'; +import { PhaseIcon } from '../phase_icon'; +import { PhaseFooter } from '../phase_footer'; interface Props { phase: 'hot' | 'warm' | 'cold'; @@ -42,90 +41,64 @@ export const Phase: FunctionComponent = ({ children, phase }) => { // hot phase is always enabled const enabled = get(formData, enabledPath) || phase === 'hot'; - const [isShowingSettings, setShowingSettings] = useState(false); - return ( - + const phaseTitle = ( + + {phase !== 'hot' && ( + + + + )} - - - - -
- - - - {phase !== 'hot' && ( - - - - )} - - -

{i18nTexts.editPolicy.titles[phase]}

-
-
-
-
- {enabled && ( - - - - {phase !== 'hot' && } - - - { - setShowingSettings(!isShowingSettings); - }} - size="xs" - iconType="controlsVertical" - iconSide="left" - aria-controls={`${phase}-phaseContent`} - > - - - - - - )} -
- - - {i18nTexts.editPolicy.descriptions[phase]} - - - {enabled && ( -
- - {children} -
- )} -
- -
+ +

{i18nTexts.editPolicy.titles[phase]}

+
); + + const minAge = phase !== 'hot' ? : null; + + return ( + } + className={'ilmPhase'} + > +
+ + {i18nTexts.editPolicy.descriptions[phase]} + + + {enabled && ( + <> + + + } + buttonClassName="ilmSettingsButton" + > + + {children} + + + )} +
+ +
+ ); }; 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 b1cf41773de3c5..16da2c872186e4 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 @@ -237,19 +237,19 @@ export const EditPolicy: React.FunctionComponent = ({ history }) => { - +
+ - + - + - + - + - - - + +