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] Hide rollover controls in advanced #84198

Closed

Conversation

jloleysens
Copy link
Contributor

Summary

Improve the ILM form by moving rollover to an advanced section in the hot phase. Also refactor the description fields to have their enable toggles on the right under their descriptions.

Note all copy is temporary and still needs to be reviewed!

Gif

rollover-hidden

Screenshots

moved form field toggles to the right under their descriptions:

Screenshot 2020-11-24 at 12 53 46

How to test

This change is (mostly) aesthetic. ILM policy creation should work exactly as before. To test, create a new policy editing all fields and check the JSON in the show request flyout.

Also, load an existing policy in the UI and check that everything is as expected.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@jloleysens jloleysens added release_note:enhancement Feature:ILM v8.0.0 Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.11.0 labels Nov 24, 2020
@jloleysens jloleysens requested a review from mdefazio November 24, 2020 11:59
@jloleysens jloleysens requested review from a team as code owners November 24, 2020 11:59
@elasticmachine
Copy link
Contributor

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

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
indexLifecycleManagement 112 123 +11

Async chunks

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

id before after diff
indexLifecycleManagement 212.4KB 221.4KB +9.0KB

Distributable file count

id before after diff
default 43025 43026 +1

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

Copy link
Contributor

@yuliacech yuliacech left a comment

Choose a reason for hiding this comment

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

Hi @jloleysens , nice work improving ILM interface! I really like having less controls in the form, that would make this form much easier to navigate 👍
For rollover controls, I would like to see default values filled out visually in the form to understand better (though they are written down in the description). Also, I assumed that disabling customize option will save rollover as enabled with default values (basically resetting anything I changed on the right side), but the form 'remembered' that I disabled rollover toggle even after the toggle disappeared.
For switches you are probably waiting on design review, so one UI suggestion to consider could be to move the switch on the same line as the row title (screenshot attached). I think that duplicating 'Force merge' in the title and 'Force merge data' in the switch is a bit superfluous.
There are some comments I left directly in the code. Let me know what you think! :)
Screenshot 2020-12-01 at 15 23 56

export const isUsingDefaultRolloverConfig = (hotPhase?: SerializedHotPhase) =>
Boolean(
hotPhase?.actions.rollover?.max_size === '50gb' &&
hotPhase.actions.rollover.max_age === '50d' &&
Copy link
Contributor

Choose a reason for hiding this comment

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

The default value for max_age on line 12 is 30d whereas this function checks for 50d. Wouldn't it be less error prune to compare with const? For example: hotPhase?.actions.rollover?.max_age === ROLLOVER_DEFAULT.max_age

return (
<EuiAccordion
id="advancedSettingsRollover"
buttonContent={showAdvancedSettings ? 'Hide advanced settings' : 'Show advanced settings'}
Copy link
Contributor

Choose a reason for hiding this comment

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

There is missing 'i18n' here

}
switchProps={{
path: hasConfiguredRolloverPath,
label: 'Customize rollover',
Copy link
Contributor

Choose a reason for hiding this comment

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

'i18n' missing here too, also line 50 (title prop) and line 51 (description prop).

);
if (showErrorCallout !== showEmptyRolloverFieldsError) {
setShowEmptyRolloverFieldsError(showErrorCallout);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If I understand correctly, this hook sets the value of showEmptyRolloverFieldsError state if there is ROLLOVER_EMPTY_VALIDATION error. I think the comparison on line 116 is not needed, as the setter would handle the same value automatically, right? So it could be something like:

const hasEmptyRolloverError = field.errors.some(
    (e) => e.validationType === ROLLOVER_EMPTY_VALIDATION
);
setShowEmptyRolloverFieldsError(hasEmptyRolloverError);

WDYT?

interface SwitchProps extends Omit<EuiSwitchProps, 'checked' | 'onChange'> {
initialValue?: boolean;
path?: string;
keepChildrenMounted?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe the prop keepChildrenMounted is duplicated and the one in Props type is actually used in the code.

onChange={(e) => {
const nextValue = e.target.checked;
if (typeof controlledValue !== 'boolean') {
setUncontrolledValue(nextValue);
Copy link
Contributor

Choose a reason for hiding this comment

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

controlledValue should be undefined since we don't have path (line 53 and line 41), so my guess is that we don't need the typeof check.

@jloleysens
Copy link
Contributor Author

@yuliacech Thanks for reviewing the code!

This was actually not yet ready for review by ES-UI, which is why I did not explicitly add a reviewer, but I did want to get early design review. In future I will make the PR a draft 👍

@mdefazio
Copy link
Contributor

mdefazio commented Dec 3, 2020

I think this is looking good. Just a few points:

  • Can we align the gray box on the left--> there seems to be some extra padding there pushing it in
  • When I turn on 'Customize rollover', the switch on the right should be enabled since that is the default setting.
  • I know you mentioned the copy is temporary, so I'll let someone else provide final copy. We had discussed using a phrase like 'Use recommended defaults' in place of 'Customize rollover' which I think makes more sense if we are going the 'double-switch' route.
  • Maybe these are out-of-scope points, but it might make sense to have the 'Learn about rollover' link beneath the main Rollover description. And then the 'The new index created by rollover...' could just live behind a questionInCircle icon + tooltip alongside the 'Enable rollover' switch. I think this will help clean up the rollover form some.

@jloleysens
Copy link
Contributor Author

After merging SS field (#83783) and moving toggles to right (#85143) I think it will be simpler to create a fresh new PR for these changes.

@jloleysens jloleysens closed this Dec 10, 2020
@jloleysens jloleysens mentioned this pull request Dec 10, 2020
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:ILM release_note:enhancement Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants