-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Conversation
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
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? |
There was a problem hiding this 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!
width: 32px; | ||
height: 32px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
width: 32px; | |
height: 32px; | |
width: $euiSizeXL; | |
height: $euiSizeXL; |
background-color: $euiColorEmptyShade; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
background-color: $euiColorEmptyShade; | |
background-color: $euiColorEmptyShade; |
background-color: $euiColorLightestShade; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
background-color: $euiColorLightestShade; | |
background-color: $euiColorLightestShade; |
There was a problem hiding this 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.
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}> |
There was a problem hiding this comment.
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'; |
There was a problem hiding this comment.
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'}> </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"> |
There was a problem hiding this comment.
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.
@elasticmachine merge upstream |
There was a problem hiding this 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 👍
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Page load bundle
History
To update your PR or re-run it, just comment with: |
There was a problem hiding this 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!
* 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>
* 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>
…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
Summary
This PR is a rework of closed #89451 and continuation of phases redesign in #88671.
Added design changes:
Screenshots
Hot - warm - cold phases
Delete phase
Phases video
Feb-08-2021.15-46-19.mp4
Checklist
Delete any items that are not applicable to this PR.