-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Discover][UnifiedDataTable] Enable drag&drop for grid columns #197832
Conversation
…95769-draggable-columns
@@ -41,13 +41,17 @@ | |||
} | |||
|
|||
.euiDataGridHeaderCell { | |||
align-items: start; | |||
align-items: center; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To align with the "graggable" state of the header column which is in a portal and we can't override it there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can keep the original styles and have this work for dragging by adding this to our EuiDataGridColumn
defs:
displayHeaderCellProps: { className: `unifiedDataTable__headerCell` }
Then we can remove these nested styles including euiDataGridHeaderCell__popover
and euiDataGridHeaderCell__draggableIcon
, and use a single global style:
.euiDataGridHeaderCell.unifiedDataTable__headerCell {
align-items: start;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea, thanks! Updated via 7946301
Pinging @elastic/kibana-data-discovery (Team:DataDiscovery) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good to me overall! Just a small suggestion around some styling.
It works well, although the delay when reordering is a bit annoying. But that exists in the EUI docs too for the most part, so not really something we can address on the Discover side. Interestingly there's less of a delay when using the keyboard and it feels smoother, maybe since there's no animation.
const headerDraggableColumns = await this.find.allByCssSelector( | ||
'[data-test-subj="euiDataGridHeaderDroppable"] > div' | ||
); | ||
// searching for a common parent of the field column header and its resizer | ||
const fieldHeader: WebElementWrapper | null | undefined = ( | ||
await Promise.all( | ||
headerDraggableColumns.map(async (column) => { | ||
const hasFieldColumn = | ||
(await column.findAllByCssSelector(`[data-gridcell-column-id="${field}"]`)).length > 0; | ||
return hasFieldColumn ? column : null; | ||
}) | ||
) | ||
).find(Boolean); | ||
const resizer = await fieldHeader?.findByTestSubject('dataGridColumnResizer'); | ||
|
||
if (!fieldHeader || !resizer) { | ||
throw new Error(`Unable to find column resizer for field ${field}`); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, maybe we should ask EUI for a test subj on the draggable wrappers as a followup 😅
@@ -41,13 +41,17 @@ | |||
} | |||
|
|||
.euiDataGridHeaderCell { | |||
align-items: start; | |||
align-items: center; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can keep the original styles and have this work for dragging by adding this to our EuiDataGridColumn
defs:
displayHeaderCellProps: { className: `unifiedDataTable__headerCell` }
Then we can remove these nested styles including euiDataGridHeaderCell__popover
and euiDataGridHeaderCell__draggableIcon
, and use a single global style:
.euiDataGridHeaderCell.unifiedDataTable__headerCell {
align-items: start;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And with the latest styling changes, this LGTM 👍 Thanks, it's so much nicer reordering columns this way vs the popover!
align-items: start; | ||
|
||
.euiDataGridHeaderCell__draggableIcon { | ||
padding-block: 2px // to align with a token height |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit :)
This could be...
padding-block: $euiSizeXS / 2;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated via 7967c37, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving with a small nit to use an EUI variable in place of the 2px
Excited for the feature :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this change opt-in
🙏 . I have desk tested it and table is working fine.
@jughosta , @davismcphee, I would suggest that these tickets should take into account ( during estimation ) the compatibility of consumers of unified data table
( in this case security solution ) otherwise, it increases tech debt for us since there are multiple features as of now which are opt-in
such as this one and couple of previous deprecations of externalControlColumns
.
Thanks @logeekal for working through this with us.
You might need to expand on this point a bit because I'm not sure I understand. Some features we intentionally make opt-in, like the document comparison feature, since we can't be sure all consumers would want it enabled by default. Other features, like this one, would ideally be enabled by default since they should be appropriate for all consumers, but we're making it opt-in for now since it happens to have a bug when used in Timeline (and I appreciate you checking btw since I did forget to check Timeline originally). For deprecations like |
Firstly, I just want to make it clear that please do not consider this discussion as a blocker to this PR. I think we can safely merge it from investigations team perspective.
100% agree with the above point.
Yes, my opinion was mainly regarding these kind of features and it is just an opinion so feel free to disagree. I was mainly referring to keeping consumer's code either up-to-date for
My statement was not just for your team. It is applicable to us as well when we are making a change in a shared component such as
I appreciate that unfamilar code can be time taking and I think we should be able to put in some time to take a look if nothing breaks. I was mainly concerned about 2 things and may be it was a pre-cautionary comment.
I think this statement really captures the essence of what I was saying and i think we are on the same page. When making that comment, I mainly had deprecations and this particular change ( which breaks security solution when opted in ) in mind. Both of these are now tech-debt for us and somehow lose priority ( I know that is our problem ) and I was feeling that cumulatively, we can be behind a lot of functionality. |
I do disagree. This kind of bug is not foreseeable, it can't be estimated. iI's a small change code wise, adapting a behavior in the EuiDataGrid that should be the default, and is long requested. So IMO having a code review from CodeOwners should have been sufficient, similar to other smaller changes we added to the table. Also we can't test all consuming apps. The modal problem is unfortunate, but such things happen in software engineering. 🙏 thx for catching it. @logeekal Ideally this should have been caught by functional testing, because also moving left and right in the "old" way didn't work with this PR initially. What would be actionable to prevent something like this, would maybe to implement more essential functional tests of the table in the security timeline, and think about a way if we could deduplicate code longer down the road. here's an example of the discover coverage:
On the other hand, there's OneDiscover, and this should won't surface in a modal, right, so it would benefit already by functional coverage of the table. |
💚 Build Succeeded
Metrics [docs]Async chunks
History
cc @jughosta |
Starting backport for target branches: 8.x |
…ic#197832) - Closes elastic#195769 ## Summary Eui now supports reordering of grid columns by dra&drop elastic/eui#8015 The PR enables this functionality for UnifiedDataTable. ![Nov-01-2024 10-21-49](https://github.com/user-attachments/assets/bc47507c-7b9e-44c2-88d7-5f48f37924cb) ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios (cherry picked from commit 436405f)
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
…mns (#197832) (#199111) # Backport This will backport the following commits from `main` to `8.x`: - [[Discover][UnifiedDataTable] Enable drag&drop for grid columns (#197832)](#197832) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Julia Rechkunova","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-06T12:00:49Z","message":"[Discover][UnifiedDataTable] Enable drag&drop for grid columns (#197832)\n\n- Closes https://github.com/elastic/kibana/issues/195769\r\n\r\n## Summary\r\n\r\nEui now supports reordering of grid columns by dra&drop\r\nhttps://github.com/elastic/eui/pull/8015\r\nThe PR enables this functionality for UnifiedDataTable.\r\n\r\n![Nov-01-2024\r\n10-21-49](https://github.com/user-attachments/assets/bc47507c-7b9e-44c2-88d7-5f48f37924cb)\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"436405fefbbd834a68df93d8179a5b377e84b614","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:enhancement","Feature:Discover","v9.0.0","Team:DataDiscovery","backport:prev-minor","Feature:UnifiedDataTable"],"title":"[Discover][UnifiedDataTable] Enable drag&drop for grid columns","number":197832,"url":"https://github.com/elastic/kibana/pull/197832","mergeCommit":{"message":"[Discover][UnifiedDataTable] Enable drag&drop for grid columns (#197832)\n\n- Closes https://github.com/elastic/kibana/issues/195769\r\n\r\n## Summary\r\n\r\nEui now supports reordering of grid columns by dra&drop\r\nhttps://github.com/elastic/eui/pull/8015\r\nThe PR enables this functionality for UnifiedDataTable.\r\n\r\n![Nov-01-2024\r\n10-21-49](https://github.com/user-attachments/assets/bc47507c-7b9e-44c2-88d7-5f48f37924cb)\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"436405fefbbd834a68df93d8179a5b377e84b614"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197832","number":197832,"mergeCommit":{"message":"[Discover][UnifiedDataTable] Enable drag&drop for grid columns (#197832)\n\n- Closes https://github.com/elastic/kibana/issues/195769\r\n\r\n## Summary\r\n\r\nEui now supports reordering of grid columns by dra&drop\r\nhttps://github.com/elastic/eui/pull/8015\r\nThe PR enables this functionality for UnifiedDataTable.\r\n\r\n![Nov-01-2024\r\n10-21-49](https://github.com/user-attachments/assets/bc47507c-7b9e-44c2-88d7-5f48f37924cb)\r\n\r\n\r\n### Checklist\r\n\r\n- [x] [Unit or functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere updated or added to match the most common scenarios","sha":"436405fefbbd834a68df93d8179a5b377e84b614"}}]}] BACKPORT--> Co-authored-by: Julia Rechkunova <[email protected]>
…ic#197832) - Closes elastic#195769 ## Summary Eui now supports reordering of grid columns by dra&drop elastic/eui#8015 The PR enables this functionality for UnifiedDataTable. ![Nov-01-2024 10-21-49](https://github.com/user-attachments/assets/bc47507c-7b9e-44c2-88d7-5f48f37924cb) ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios
This PR adds docs related to #197832 for Discover Rel: elastic/platform-docs-team#562
…#201571) This PR adds docs related to elastic#197832 for Discover Rel: elastic/platform-docs-team#562 (cherry picked from commit fcf319e)
…#201571) This PR adds docs related to elastic#197832 for Discover Rel: elastic/platform-docs-team#562 (cherry picked from commit fcf319e)
…201571) (#201601) # Backport This will backport the following commits from `main` to `8.17`: - [[Docs] Document ability to drag and drop columns in Discover (#201571)](#201571) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"florent-leborgne","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-25T14:09:07Z","message":"[Docs] Document ability to drag and drop columns in Discover (#201571)\n\nThis PR adds docs related to\r\nhttps://github.com//pull/197832 for Discover\r\n\r\nRel: https://github.com/elastic/platform-docs-team/issues/562","sha":"fcf319e7c447f3fe5057461a33d4a814ebc6a2c8","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Docs","release_note:skip","v9.0.0","docs","backport:version","v8.17.0","v8.18.0"],"title":"[Docs] Document ability to drag and drop columns in Discover","number":201571,"url":"https://github.com/elastic/kibana/pull/201571","mergeCommit":{"message":"[Docs] Document ability to drag and drop columns in Discover (#201571)\n\nThis PR adds docs related to\r\nhttps://github.com//pull/197832 for Discover\r\n\r\nRel: https://github.com/elastic/platform-docs-team/issues/562","sha":"fcf319e7c447f3fe5057461a33d4a814ebc6a2c8"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201571","number":201571,"mergeCommit":{"message":"[Docs] Document ability to drag and drop columns in Discover (#201571)\n\nThis PR adds docs related to\r\nhttps://github.com//pull/197832 for Discover\r\n\r\nRel: https://github.com/elastic/platform-docs-team/issues/562","sha":"fcf319e7c447f3fe5057461a33d4a814ebc6a2c8"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: florent-leborgne <[email protected]>
…201571) (#201602) # Backport This will backport the following commits from `main` to `8.x`: - [[Docs] Document ability to drag and drop columns in Discover (#201571)](#201571) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"florent-leborgne","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-25T14:09:07Z","message":"[Docs] Document ability to drag and drop columns in Discover (#201571)\n\nThis PR adds docs related to\r\nhttps://github.com//pull/197832 for Discover\r\n\r\nRel: https://github.com/elastic/platform-docs-team/issues/562","sha":"fcf319e7c447f3fe5057461a33d4a814ebc6a2c8","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Docs","release_note:skip","v9.0.0","docs","backport:version","v8.17.0","v8.18.0"],"title":"[Docs] Document ability to drag and drop columns in Discover","number":201571,"url":"https://github.com/elastic/kibana/pull/201571","mergeCommit":{"message":"[Docs] Document ability to drag and drop columns in Discover (#201571)\n\nThis PR adds docs related to\r\nhttps://github.com//pull/197832 for Discover\r\n\r\nRel: https://github.com/elastic/platform-docs-team/issues/562","sha":"fcf319e7c447f3fe5057461a33d4a814ebc6a2c8"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/201571","number":201571,"mergeCommit":{"message":"[Docs] Document ability to drag and drop columns in Discover (#201571)\n\nThis PR adds docs related to\r\nhttps://github.com//pull/197832 for Discover\r\n\r\nRel: https://github.com/elastic/platform-docs-team/issues/562","sha":"fcf319e7c447f3fe5057461a33d4a814ebc6a2c8"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: florent-leborgne <[email protected]>
…#201571) This PR adds docs related to elastic#197832 for Discover Rel: elastic/platform-docs-team#562
…#201571) This PR adds docs related to elastic#197832 for Discover Rel: elastic/platform-docs-team#562
Summary
Eui now supports reordering of grid columns by dra&drop elastic/eui#8015
The PR enables this functionality for UnifiedDataTable.
Checklist