Skip to content

[ML] Transforms/DF Analytics: Fix data grid column sorting.#80618

Merged
peteharverson merged 4 commits intoelastic:masterfrom
walterra:ml-data-grid-fix-sorting
Oct 16, 2020
Merged

[ML] Transforms/DF Analytics: Fix data grid column sorting.#80618
peteharverson merged 4 commits intoelastic:masterfrom
walterra:ml-data-grid-fix-sorting

Conversation

@walterra
Copy link
Copy Markdown
Contributor

Summary

Part of #66381.

Partially fixes an issue with sorting columns in data grids.

Root cause analysis of the bug:

EuiDataGrid resets a user's custom sorting in the data grid's popover menu setting when the overall columns passed in to data grid change. Even if the columns "visibly" don't change in our implementation, because of the applied data for the histogram charts, on a re-render the columns information isn't a reference but a new object and so EuiDataGrid resets the the sorting of columns.

Because EuiDataGrid doesn't have a callback that exposes the full information of the sorting/visiblity popover (only the sorting of enabled columns) for now we can only make a partial fix.

This PR does the partial fix by applying the sorting order of visibleColumns to all columns. A user can now successfully reorder at least visible columns.

datagrid-sorting-issue

Checklist

@walterra walterra added bug Fixes for quality problems that affect the customer experience regression release_note:fix :ml v8.0.0 Feature:Transforms Transforms Feature:Data Frame Analytics ML data frame analytics features v7.10.0 v7.11.0 labels Oct 15, 2020
@walterra walterra requested a review from a team as a code owner October 15, 2020 07:59
@walterra walterra self-assigned this Oct 15, 2020
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/ml-ui (:ml)

@walterra
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

@peteharverson
Copy link
Copy Markdown
Contributor

Found what seems like odd behavior when moving the order of a column which you first make visible. Here the sorting popover order works with the first field I make visible, but then doesn't work for the second income field I make visible.

sorting_order

@walterra
Copy link
Copy Markdown
Contributor Author

@peteharverson I tweaked the sorting behavior. Because of the underlying behavior where we never know the true order visible in the popover because it isn't exposed from the EUI component there will be some limitations, I added some comments to the code about it. The sorting now will always move all visible columns to the top of the list in the popover when an update is triggered.

One glitch is that if you enable an invisible column further down, it will jump up to the already enabled items. It's something we have to live with for now. This way we can guarantee at least that all visible columns can be sorted as intended by the user.

@walterra
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

Copy link
Copy Markdown
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

Copy link
Copy Markdown
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.

Tested and LGTM ⚡

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Metrics [docs]

async chunks size

id before after diff
ml 11.3MB 11.3MB +2.6KB

History

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

@peteharverson peteharverson merged commit b582559 into elastic:master Oct 16, 2020
peteharverson pushed a commit to peteharverson/kibana that referenced this pull request Oct 16, 2020
…80618)

* [ML] Fix column sorting.

* [ML] Tweak sorting.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
peteharverson pushed a commit to peteharverson/kibana that referenced this pull request Oct 16, 2020
…80618)

* [ML] Fix column sorting.

* [ML] Tweak sorting.

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Oct 16, 2020
* master: (115 commits)
  [ML] Transforms/DF Analytics: Fix data grid column sorting. (elastic#80618)
  added brace import to vis editor (elastic#80652)
  Fix error rate sorting in services list (elastic#80764)
  Emit info log when using custom registry URL (elastic#80768)
  [Reporting] Config Schema Validation for rules[N].protocol strings (elastic#80766)
  Add Storybook a11y addon (elastic#80069)
  Fix anomaly alert selection text (elastic#80746)
  [Security Solution] [Maps] Kibana index pattern, comma bug fix (elastic#80208)
  [kbn/optimizer] tweak split chunks options (elastic#80444)
  update template to use the new team label (elastic#80748)
  [Security Solution] Fix the Field dropdown in Timeline data providers resets when scrolled (elastic#80718)
  Adjusts observability alerting perms to require "all" (elastic#79896)
  [Security Solutions][Detection Engine] Fixes pre-packaged rules which contain exception lists to not overwrite user defined lists   (elastic#80592)
  [data.ui] Fix flaky test & lazy loading rendering artifacts. (elastic#80612)
  Licensed feature usage for connectors (elastic#77679)
  [Security Solution] Cypress template creation (elastic#80180)
  [APM] Hide service if only data is from ML (elastic#80145)
  Fix role mappings test for ESS (elastic#80604)
  [Maps] Add support for envelope (elastic#80614)
  [Security Solution] Update button text according to status (elastic#80389)
  ...
peteharverson added a commit that referenced this pull request Oct 16, 2020
…80803)

* [ML] Fix column sorting.

* [ML] Tweak sorting.

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

Co-authored-by: Walter Rafelsberger <walter@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
peteharverson added a commit that referenced this pull request Oct 16, 2020
…80802)

* [ML] Fix column sorting.

* [ML] Tweak sorting.

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

Co-authored-by: Walter Rafelsberger <walter@elastic.co>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@walterra walterra deleted the ml-data-grid-fix-sorting branch October 17, 2020 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes for quality problems that affect the customer experience Feature:Data Frame Analytics ML data frame analytics features Feature:Transforms Transforms :ml regression release_note:fix v7.10.0 v7.11.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants