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/DFA: Refactor list action buttons so modals won't unmount after button click. #70555

Merged
merged 14 commits into from
Jul 8, 2020

Conversation

walterra
Copy link
Contributor

@walterra walterra commented Jul 2, 2020

Related to #70383 and #63455.

Refactors the action buttons of the transform and data frame analytics jobs list:

Previously custom actions included state and JSX for e.g. confirmation modals. Problem with that: If the actions list popover hides, the modal would unmount too. Since EUI's behaviour will change with the release/merge of #70383, we needed a refactor that solves that issue right now.

With this PR, state management for UI behaviour that follows after a button click like the confirmation modals was moved to a custom hook which is part of the outer level of the buttons itself. The modal now also gets mounted on the outer level. This way we won't loose the modals state and DOM rendering when the action button hides.

Note that this PR doesn't fix the nested buttons issue (#63455) yet. For that we need EUI issue #70383 to be in Kibana which will arrive with EUI v26.3.0 via #70243. So there will be one follow up to that which will focus on getting rid of the nested button structure.

Todos

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@walterra walterra added :ml Feature:Transforms ML transforms Feature:Data Frame Analytics ML data frame analytics features labels Jul 2, 2020
@walterra walterra self-assigned this Jul 2, 2020
@walterra walterra force-pushed the ml-fix-list-action-buttons branch from 9a98e59 to 9033dbf Compare July 2, 2020 14:41
@walterra walterra force-pushed the ml-fix-list-action-buttons branch from dd42b81 to 996e151 Compare July 3, 2020 09:59
@walterra walterra added refactoring release_note:skip Skip the PR/issue when compiling release notes v7.9.0 v8.0.0 labels Jul 3, 2020
@walterra walterra marked this pull request as ready for review July 3, 2020 10:07
@walterra walterra requested a review from a team as a code owner July 3, 2020 10:07
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui (:ml)

@walterra walterra requested a review from thompsongl July 3, 2020 10:10
@walterra
Copy link
Contributor Author

walterra commented Jul 3, 2020

@thompsongl This PR resolves #70383 in preparation for the EUI update in #70243. No need for you to review the full PR, added you as a reviewer for visibility.


return (
<>
{isModalVisible && (
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess it would be cleaner if a parent component will be responsible for hiding the modal

Copy link
Contributor Author

@walterra walterra Jul 6, 2020

Choose a reason for hiding this comment

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

Updated in 4382fee

? i18n.translate(
'xpack.ml.dataframe.analyticsList.deleteActionDisabledToolTipContent',
{
defaultMessage: 'Stop the data frame analytics in order to delete it.',
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 would read better with the word job in it - Stop the data frame analytics job in order to delete it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in f4186e7.

})}
data-test-subj="mlAnalyticsJobViewButton"
>
{i18n.translate('xpack.ml.dataframe.analyticsList.viewActionName', {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can be replaced with FormattedMessage

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 and LGTM

@walterra walterra requested a review from darnautov July 6, 2020 09:53
@walterra
Copy link
Contributor Author

walterra commented Jul 7, 2020

@alvarezmelissa87 I re-merged master into this PR and refactored the recently introduced editing feature for DFA to match the updated code structure introduced in this PR. Also added you as a reviewer since you did the editing feature.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

@kbn/optimizer bundle module count

id value diff baseline
ml 386 -2 388

History

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

@walterra
Copy link
Contributor Author

walterra commented Jul 7, 2020

@darnautov addressed your comments, and all tests finally passed 🥳 please have another look 👁️

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.

Gave this a test - 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.

LGTM

@walterra walterra merged commit bb96f5d into elastic:master Jul 8, 2020
@walterra walterra deleted the ml-fix-list-action-buttons branch July 8, 2020 08:10
walterra added a commit to walterra/kibana that referenced this pull request Jul 8, 2020
…ount after button click. (elastic#70555)

Related to elastic#70383 and elastic#63455.

Refactors the action buttons of the transform and data frame analytics jobs list:

Previously custom actions included state and JSX for e.g. confirmation modals. Problem with that: If the actions list popover hides, the modal would unmount too. Since EUI's behaviour will change with the release/merge of elastic#70383, we needed a refactor that solves that issue right now.

With this PR, state management for UI behaviour that follows after a button click like the confirmation modals was moved to a custom hook which is part of the outer level of the buttons itself. The modal now also gets mounted on the outer level. This way we won't loose the modals state and DOM rendering when the action button hides.

Note that this PR doesn't fix the nested buttons issue (elastic#63455) yet. For that we need EUI issue elastic#70383 to be in Kibana which will arrive with EUI v26.3.0 via elastic#70243. So there will be one follow up to that which will focus on getting rid of the nested button structure.
@walterra walterra mentioned this pull request Jul 8, 2020
walterra added a commit that referenced this pull request Jul 8, 2020
…ount after button click. (#70555) (#71050)

Related to #70383 and #63455.

Refactors the action buttons of the transform and data frame analytics jobs list:

Previously custom actions included state and JSX for e.g. confirmation modals. Problem with that: If the actions list popover hides, the modal would unmount too. Since EUI's behaviour will change with the release/merge of #70383, we needed a refactor that solves that issue right now.

With this PR, state management for UI behaviour that follows after a button click like the confirmation modals was moved to a custom hook which is part of the outer level of the buttons itself. The modal now also gets mounted on the outer level. This way we won't loose the modals state and DOM rendering when the action button hides.

Note that this PR doesn't fix the nested buttons issue (#63455) yet. For that we need EUI issue #70383 to be in Kibana which will arrive with EUI v26.3.0 via #70243. So there will be one follow up to that which will focus on getting rid of the nested button structure.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jul 9, 2020
* master:
  [RUM Dashboard] New rum services api to replace usage of get services API (elastic#70746)
  fix: remove only consecutive ticks in TSVB (elastic#70981)
  [Functional test] Increase the timeout on opening a saved visualization (elastic#70952)
  [ML] Transforms/DFA: Refactor list action buttons so modals won't unmount after button click. (elastic#70555)
  [Functional test] Add retry for dashboard save (elastic#70950)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Data Frame Analytics ML data frame analytics features Feature:Transforms ML transforms :ml refactoring release_note:skip Skip the PR/issue when compiling release notes v7.9.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants