Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ILM] Delete phase redesign (rework) #90291

Merged
merged 6 commits into from
Feb 9, 2021

Conversation

yuliacech
Copy link
Contributor

@yuliacech yuliacech commented Feb 4, 2021

Summary

This PR is a rework of closed #89451 and continuation of phases redesign in #88671.

Added design changes:

  • Vertical timeline with checkbox icons for active phases
  • Phase settings are hidden in an accordion
  • A button group to enabled/disabled delete phase
  • Delete phase style

Screenshots

Hot - warm - cold phases Screenshot 2021-02-08 at 15 44 47
Delete phase Screenshot 2021-02-08 at 15 44 55
Phases video
Feb-08-2021.15-46-19.mp4

Checklist

Delete any items that are not applicable to this PR.

@yuliacech yuliacech added Feature:ILM release_note:enhancement Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.12.0 v8.0.0 labels Feb 4, 2021
@yuliacech yuliacech changed the title [ILM] Delte phase redesign (rework) [ILM] Delete phase redesign (rework) Feb 4, 2021
@yuliacech yuliacech added release_note:skip Skip the PR/issue when compiling release notes and removed release_note:enhancement labels Feb 4, 2021
@yuliacech yuliacech marked this pull request as ready for review February 4, 2021 18:08
@yuliacech yuliacech requested review from a team as code owners February 4, 2021 18:08
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

@cjcenizal
Copy link
Contributor

This is looking great! @mdefazio About the phase bottom blocks adding empty space to the bottom of the panel -- I'm curious about the benefits here. What's the intention behind that? Same with the gray background of the delete panel. Do users need this additional treatment? Are we concerned that they'll be confused without it, or is there another problem we're trying to solve?

Copy link
Contributor

@snide snide left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just passing through. Very minor sass changes I noticed. Looks great. Thanks for the screenshots / video!

Comment on lines 2 to 3
width: 32px;
height: 32px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
width: 32px;
height: 32px;
width: $euiSizeXL;
height: $euiSizeXL;

Comment on lines 5 to 6
background-color: $euiColorEmptyShade;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
background-color: $euiColorEmptyShade;
background-color: $euiColorEmptyShade;

Comment on lines 10 to 11
background-color: $euiColorLightestShade;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
background-color: $euiColorLightestShade;
background-color: $euiColorLightestShade;

@jloleysens jloleysens self-requested a review February 5, 2021 10:18
Copy link
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @yuliacech ! Thanks for refactoring to use the EUI comment component, I think we are getting really close barring some final UI/UX decisions we should make regarding management of vertical space.

I'd like to provide some feedback in the meantime:

UI/UX

As we discussed, the min age input should not remain editable once a phase is disabled. I would say it can be hidden, but we should probably follow the designs for the specific look.

Screenshot 2021-02-05 at 12 48 30

As discussed, I think we can move the searchable snapshot action in cold phase back to the top-level (i.e., outside of advanced settings).

Code

I left some suggestions in the code, only the one regarding the PhaseTimingConfiguration I'd really like to get your thoughts on!


if (phaseConfiguration === 'disabled' || phaseConfiguration === 'enabled') {
return (
<EuiPanel className={'ilmPhaseFooter'} hasShadow={false}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit; here and elsewhere. the convention for fixed string-literal props is:

className="ilmPhaseFooter" // without curly braces, with double quotes

I think this is perhaps webstorm specific behaviour as I recall running into it there. If you're using webstorm I managed to disable auto-bracket insertion for JSX by following this issue: https://youtrack.jetbrains.com/issue/WEB-31288?_ga=2.14889842.555971730.1612525382-1881428346.1584373905

import { FormInternal } from '../types';
import { UseField } from './index';

export type PhaseTimingConfiguration = 'forever' | 'last' | 'disabled' | 'enabled';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this approach may be tying too much overlapping state into one value. For instance; if a phase is forever that implies that it is also last and enabled - which does not really sit well with the individual union of types.

I propose we extract the enabled | disabled state from the last | forever. I iterated on this a little bit and came up with the following:

diff of proposed changes
diff --git i/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_footer/phase_footer.tsx w/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_footer/phase_footer.tsx
index 880a354b4b0..0bc97e8f250 100644
--- i/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_footer/phase_footer.tsx
+++ w/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/phase_footer/phase_footer.tsx
@@ -23,11 +23,13 @@ interface Props {
 }
 
 export const PhaseFooter: FunctionComponent<Props> = ({ phase }) => {
-  const phaseTimings = usePhaseTimings();
-  const phaseConfiguration = phaseTimings[phase];
-  const setValue = phaseTimings.setDeletePhaseEnabled;
+  const {
+    isDeletePhaseEnabled,
+    setDeletePhaseEnabled,
+    [phase]: phaseConfiguration,
+  } = usePhaseTimings();
 
-  if (phaseConfiguration === 'disabled' || phaseConfiguration === 'enabled') {
+  if (!phaseConfiguration.isFinalDataPhase) {
     return (
       <EuiPanel className={'ilmPhaseFooter'} hasShadow={false}>
         <EuiText size={'s'}>&nbsp;</EuiText>
@@ -35,7 +37,7 @@ export const PhaseFooter: FunctionComponent<Props> = ({ phase }) => {
     );
   }
 
-  if (phaseConfiguration === 'forever') {
+  if (!isDeletePhaseEnabled) {
     return (
       <EuiPanel color={'subdued'} className={'ilmPhaseFooter'} hasShadow={false}>
         <InfinityIcon size={'s'} />{' '}
@@ -44,7 +46,10 @@ export const PhaseFooter: FunctionComponent<Props> = ({ phase }) => {
             id="xpack.indexLifecycleMgmt.editPolicy.phaseTiming.foreverTimingDescription"
             defaultMessage="Data will remain in this phase forever."
           />{' '}
-          <EuiLink onClick={() => setValue(true)} data-test-subj={'enableDeletePhaseLink'}>
+          <EuiLink
+            onClick={() => setDeletePhaseEnabled(true)}
+            data-test-subj={'enableDeletePhaseLink'}
+          >
             <FormattedMessage
               id="xpack.indexLifecycleMgmt.editPolicy.deletePhase.enablePhaseButtonLabel"
               defaultMessage="Set delete age"
@@ -63,7 +68,10 @@ export const PhaseFooter: FunctionComponent<Props> = ({ phase }) => {
           id="xpack.indexLifecycleMgmt.editPolicy.phaseTiming.beforeDeleteDescription"
           defaultMessage="Data will be deleted after this phase."
         />{' '}
-        <EuiLink onClick={() => setValue(false)} data-test-subj={'disableDeletePhaseLink'}>
+        <EuiLink
+          onClick={() => setDeletePhaseEnabled(false)}
+          data-test-subj={'disableDeletePhaseLink'}
+        >
           <FormattedMessage
             id="xpack.indexLifecycleMgmt.editPolicy.deletePhase.disablePhaseButtonLabel"
             defaultMessage="Keep data"
diff --git i/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/phase_timings_context.tsx w/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/phase_timings_context.tsx
index 796cab1b404..fdfaec35e5b 100644
--- i/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/phase_timings_context.tsx
+++ w/x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/phase_timings_context.tsx
@@ -5,12 +5,19 @@
  * 2.0.
  */
 
-import React, { createContext, FunctionComponent, useContext } from 'react';
+import React, { createContext, FunctionComponent, useContext, useCallback } from 'react';
 import { useFormData } from '../../../../shared_imports';
 import { FormInternal } from '../types';
 import { UseField } from './index';
 
-export type PhaseTimingConfiguration = 'forever' | 'last' | 'disabled' | 'enabled';
+// export type PhaseTimingConfiguration = 'forever' | 'last' | 'disabled' | 'enabled';
+
+export interface PhaseTimingConfiguration {
+  /**
+   * Whether this is the final, non-delete, phase.
+   */
+  isFinalDataPhase: boolean;
+}
 
 const getPhaseTimingConfiguration = (
   formData: FormInternal
@@ -21,23 +28,23 @@ const getPhaseTimingConfiguration = (
 } => {
   const isWarmPhaseEnabled = formData?._meta?.warm?.enabled;
   const isColdPhaseEnabled = formData?._meta?.cold?.enabled;
-  if (formData?._meta?.delete?.enabled) {
-    return {
-      hot: !isWarmPhaseEnabled && !isColdPhaseEnabled ? 'last' : 'enabled',
-      warm: isWarmPhaseEnabled ? (isColdPhaseEnabled ? 'enabled' : 'last') : 'disabled',
-      cold: isColdPhaseEnabled ? 'last' : 'disabled',
-    };
-  }
   return {
-    hot: !isWarmPhaseEnabled && !isColdPhaseEnabled ? 'forever' : 'enabled',
-    warm: isWarmPhaseEnabled ? (isColdPhaseEnabled ? 'enabled' : 'forever') : 'disabled',
-    cold: isColdPhaseEnabled ? 'forever' : 'disabled',
+    hot: {
+      isFinalDataPhase: !isWarmPhaseEnabled && !isColdPhaseEnabled,
+    },
+    warm: {
+      isFinalDataPhase: isWarmPhaseEnabled && !isColdPhaseEnabled,
+    },
+    cold: {
+      isFinalDataPhase: isColdPhaseEnabled,
+    },
   };
 };
 export interface PhaseTimings {
   hot: PhaseTimingConfiguration;
   warm: PhaseTimingConfiguration;
   cold: PhaseTimingConfiguration;
+  isDeletePhaseEnabled: boolean;
   setDeletePhaseEnabled: (enabled: boolean) => void;
 }
 
@@ -49,12 +56,13 @@ export const PhaseTimingsProvider: FunctionComponent = ({ children }) => {
   });
 
   return (
-    <UseField path="_meta.delete.enabled">
+    <UseField<boolean> path="_meta.delete.enabled">
       {(field) => {
         return (
           <PhaseTimingsContext.Provider
             value={{
               ...getPhaseTimingConfiguration(formData),
+              isDeletePhaseEnabled: !!field.value,
               setDeletePhaseEnabled: field.setValue,
             }}
           >

Let me know what you think!

});

return (
<UseField path="_meta.delete.enabled">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really creative use of UseField inside a context component! I had not thought of doing this before.

@yuliacech
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested again locally, these changes are in really good shape!

We will address surfacing the searchable snapshot field in a follow up PR 👍

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
indexLifecycleManagement 177 204 +27

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
indexLifecycleManagement 228.3KB 244.4KB +16.1KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
indexLifecycleManagement 63.9KB 63.9KB +1.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@mdefazio mdefazio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome! Really nice work!

yuliacech added a commit to yuliacech/kibana that referenced this pull request Feb 9, 2021
* Phases redesign

* Fixed scss file

* Fixed errors

* Added changes for phase blocks

* Added styles adjustments

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
yuliacech added a commit that referenced this pull request Feb 9, 2021
* Phases redesign

* Fixed scss file

* Fixed errors

* Added changes for phase blocks

* Added styles adjustments

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
jloleysens added a commit to jloleysens/kibana that referenced this pull request Feb 9, 2021
…timeline-and-rollover-info

* 'master' of github.com:elastic/kibana: (47 commits)
  [Fleet] Use TS project references (elastic#87574)
  before/beforeEach clean up (elastic#90663)
  [Vega] user should be able to set a specific tilemap service using the mapStyle property (elastic#88440)
  [Security Solution][Case] ServiceNow SIR Connector (elastic#88655)
  [Search Sessions] Enable extend from management (elastic#90558)
  [ILM] Delete phase redesign (rework) (elastic#90291)
  [APM-UI][E2E] use withGithubStatus step (elastic#90651)
  Add folding in kb-monaco and update some viewers (elastic#90152)
  [Grok Debugger] Changed test to wait for grok debugger container to exist to fix test flakiness (elastic#90543)
  Strongly typed EUI theme for styled-components (elastic#90106)
  Fix vega renovate label (elastic#90591)
  [Uptime] Migrate to TypeScript project references (elastic#90510)
  [Monitoring] Migrate data source for legacy alerts to monitoring data directly (elastic#87377)
  [Upgrade Assistant] Add A11y Tests (elastic#90265)
  [Time to Visualize] Adds functional tests for linking/unlinking panel from embeddable library (elastic#89612)
  [dev-utils/ship-ci-stats] fail when CI stats is down (elastic#90678)
  chore(NA): remove write permissions on Bazel remote cache for PRs (elastic#90652)
  chore(NA): move bazel workspace status from bash script into nodejs executable (elastic#90560)
  Use default ES distribution for functional tests (elastic#88737)
  [Alerts] Jira: Disallow labels with spaces (elastic#90548)
  ...

# Conflicts:
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/components/timeline/timeline.tsx
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/lib/absolute_timing_to_relative_timing.test.ts
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/lib/absolute_timing_to_relative_timing.ts
@yuliacech yuliacech mentioned this pull request Feb 11, 2021
1 task
@yuliacech yuliacech deleted the ilm_delete_phase branch February 24, 2021 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:ILM release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.12.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants