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

[ML] Transforms: Single Column Wizard. #64436

Merged

Conversation

walterra
Copy link
Contributor

@walterra walterra commented Apr 24, 2020

Summary

  • Rearranges the layout of the transform wizard pivot configuration step into a single-column. This allows us to have the data grids for source index and pivot preview having the full width. The advanced editors for source query and pivot configuration also cover a wider width.
  • Originally all the code was in a single component <StepDefineForm />. The code has been rearranged into individual components and hooks. Some optimizations have been added, for example React.memo() including a custom props compare function avoid a rerender on unrelated changes to the data grids. This optimization is also now available on the analytics results pages.

wizard-single-column

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@walterra walterra self-assigned this Apr 24, 2020
@walterra walterra marked this pull request as ready for review April 29, 2020 17:38
@walterra walterra requested a review from a team as a code owner April 29, 2020 17:38
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Overall looks good! Really like the new layout. Just left a couple of comments.

<EuiFormRow hasEmptyLabelSpace>
<EuiFlexGroup alignItems="center" justifyContent="spaceBetween">
<EuiFlexItem grow={false}>
<AdvancedPivotEditorSwitch {...stepDefineForm} />
Copy link
Contributor

@peteharverson peteharverson Apr 30, 2020

Choose a reason for hiding this comment

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

Could the switch be moved to the top of this section? Currently it is aligned with the 'Group by' control which gives the impression it is only for editing the group_by part of the pivot.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed, I'll leave it as is for now, moving it up looks misaligned (see screenshot), moving it even further up would result in additional vertical whitespace
image

Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 left a comment

Choose a reason for hiding this comment

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

Code LGTM ⚡

Comment on lines 59 to 68
return aggListNameSplit.some(aggListNamePart => {
aggListNameCheck =
aggListNameCheck === undefined ? aggListNamePart : `${aggListNameCheck}.${aggListNamePart}`;
if (aggListNameCheck === aggName) {
conflicts.push(
i18n.translate('xpack.transform.stepDefineForm.nestedAggListConflictErrorMessage', {
defaultMessage: `Couldn't add configuration '{aggName}' because of a nesting conflict with '{aggListName}'.`,
values: { aggName, aggListName },
})
);
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think it's a good practice when some method contains a side effect, in this case, push to the collection. Consider using for..of with break statement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good find, this was some older code I copied, changed it in 9d6f488.

Copy link
Contributor

Choose a reason for hiding this comment

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

just checked, please use loop label names, check https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/break for examples

Comment on lines 83 to 93
return groupByListNameSplit.some(groupByListNamePart => {
groupByListNameCheck =
groupByListNameCheck === undefined
? groupByListNamePart
: `${groupByListNameCheck}.${groupByListNamePart}`;
if (groupByListNameCheck === aggName) {
conflicts.push(
i18n.translate('xpack.transform.stepDefineForm.nestedGroupByListConflictErrorMessage', {
defaultMessage: `Couldn't add configuration '{aggName}' because of a nesting conflict with '{groupByListName}'.`,
values: { aggName, groupByListName },
})
Copy link
Contributor

Choose a reason for hiding this comment

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

same as the comment above

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Tested latest edits and LGTM

@alvarezmelissa87
Copy link
Contributor

Latest changes LGTM ⚡

Copy link
Contributor

@darnautov darnautov left a comment

Choose a reason for hiding this comment

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

Latest changes LGTM! 👍

@walterra
Copy link
Contributor Author

walterra commented May 4, 2020

@elasticmachine merge upstream

@spalger
Copy link
Contributor

spalger commented May 4, 2020

@elasticmachine merge upstream

@walterra
Copy link
Contributor Author

walterra commented May 5, 2020

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@walterra walterra merged commit 4f66dfd into elastic:master May 5, 2020
@walterra walterra deleted the ml-transforms-wizard-vertical-layout branch May 5, 2020 08:20
walterra added a commit that referenced this pull request May 5, 2020
Rearranges the layout of the transform wizard pivot configuration step into a single-column. This allows us to have the data grids for source index and pivot preview having the full width. The advanced editors for source query and pivot configuration also cover a wider width.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants