[ML] Transforms: Data grid fixes.#59538
Conversation
77aa174 to
b760225
Compare
b760225 to
b68f9f3
Compare
|
@elasticmachine merge upstream |
|
Pinging @elastic/ml-ui (:ml) |
| let schema = 'string'; | ||
| // Built-in values are ['boolean', 'currency', 'datetime', 'numeric', 'json'] | ||
| // To fall back to the default string schema it needs to be undefined. | ||
| let schema; |
There was a problem hiding this comment.
Pushed a fix in c6b9430 - I thought I implemented that already in the original PR but seems it got lost somehow.
…com:walterra/kibana into ml-transforms-data-grid-fix-date-formatting
|
Probably not related to the changes in this PR, but are zero values being rendered as blank cells in the preview table? If I try and sort by |
|
@peteharverson Fixed the empty cells in 760ae8a. |
|
In 66161ff I improved the sorting related error handling: For other non-catchable error the messages is improved now to display the full error instead of just I couldn't find a way to filter the list of available fields for sorting to be passed on to |
peteharverson
left a comment
There was a problem hiding this comment.
Tested latest changes and generally LGTM.
Would be preferable if the table wasn't lost completely if for example the user tries to sort on a non-aggregatable text field. With the ecommerce data, if you pick the first category field to sort on, the table is lost and you have to start all over with creating the transform. Ideally we would look to hide fields that don't support sorting in the EuiDataGrid sorting popover.
darnautov
left a comment
There was a problem hiding this comment.
Overall LGMT 👍 just a couple of nit comments
| import { getNestedProperty } from './object_utils'; | ||
|
|
||
| describe('object_utils', () => { | ||
| test('getNestedProperty()', () => { |
There was a problem hiding this comment.
nit: I believe it'd be better to have test per expect here because assertations are not related
There was a problem hiding this comment.
I'll leave it as is since this is a 1:1 copy of the same file we have in the ML plugin. I'd like to consolidate related files in a shared space for both plugins at some point then we can also refactor the these tests.
| const valid = sc.reduce((v, c) => { | ||
| if (v === false) return v; | ||
| const columnType = dataGridColumns.find(dgc => dgc.id === c.id); | ||
| const validSortingType = columnType?.schema !== 'json'; | ||
| if (validSortingType === false) { | ||
| toastNotifications.addDanger( | ||
| i18n.translate('xpack.transform.sourceIndexPreview.invalidSortingColumnError', { | ||
| defaultMessage: `The column '{columnId}' cannot be used for sorting.`, | ||
| values: { columnId: c.id }, | ||
| }) | ||
| ); | ||
| } | ||
| return validSortingType; | ||
| }, true); |
There was a problem hiding this comment.
I find usage of reduce a bit confusing here:
- it has a side effect inside
- if one of the soring is invalid it doesn't check the others
It might be better to use find to get the first invalid one and show the toastNotifications after
| const indexPatternTitle = Array.isArray(transformConfig.source.index) | ||
| ? transformConfig.source.index.join(',') | ||
| : transformConfig.source.index; |
There was a problem hiding this comment.
potentially might be an issue if the joint index patter does not exist (has a different order etc)
|
@peteharverson I tweaked the behavior so the data grid will not be hidden when an error occurs: |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* master: Add a retry to dashboard test for a sometimes slow async operation (elastic#59600) [Endpoint] Sample data generator for endpoint app (elastic#58936) [Vis Editor] Refactoring metrics axes (elastic#59135) [DOCS] Changed Discover app to Discover (elastic#59769) [Metrics Alerts] Add support for search query and groupBy on alerts (elastic#59388) Enhancement - EUICodeEditor for Visualize JSON (elastic#58679) [ML] Transforms: Data grid fixes. (elastic#59538) [SIEM] Fix and consolidate handling of error responses in the client (elastic#59438) [Maps] convert tooltip classes to typescript (elastic#59589) [ML] Functional tests - re-activate date_nanos test (elastic#59649) Move canvas to use NP Expressions service (elastic#58387) Update misc dependencies (elastic#59542) [Unit Testing] Configure react-testing-library queries to use Kibana's data-test-subj instead of default data-testid (elastic#59445) [Console] Remove unused code (elastic#59554) [Logs / Metrics UI] Link handling / stop page reloads (elastic#58478) Add SavedObject management section registration in core (elastic#59291)







Summary
Part of #51288.
Fixes #59416.
Checklist
For maintainers