-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
Open
jughosta
wants to merge
17
commits into
elastic:main
Choose a base branch
from
jughosta:195769-draggable-columns
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+104
−10
Open
Changes from 12 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
a1cc540
[Discover][UnifiedDataTable] Enable drag&drop for grid columns
jughosta cbdc05e
Merge branch 'main' into 195769-draggable-columns
jughosta 6dfd46c
Merge branch 'main' into 195769-draggable-columns
jughosta af6b57a
Merge branch 'main' into 195769-draggable-columns
jughosta 483d40a
[Discover] Add a test
jughosta ab766d4
[Discover] Update tests
jughosta 6f51907
Merge remote-tracking branch 'origin/195769-draggable-columns' into 1…
jughosta 3fbaecf
[Discover] Update styles
jughosta 7c71840
[Discover] Update code style
jughosta a22034d
[Discover] Update code style
jughosta 4fa0a4e
[Discover] Update styles
jughosta 63acdb1
[Discover] Update styles
jughosta 047e955
Merge branch 'main' into 195769-draggable-columns
jughosta 7946301
[Discover] Update styles
jughosta 979fa69
Merge branch 'main' into 195769-draggable-columns
jughosta 6247504
Merge branch 'main' into 195769-draggable-columns
jughosta 7967c37
[Discover] Update code style
jughosta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,9 +102,25 @@ export class DataGridService extends FtrService { | |
public async resizeColumn(field: string, delta: number) { | ||
const header = await this.getHeaderElement(field); | ||
const originalWidth = (await header.getSize()).width; | ||
const resizer = await header.findByCssSelector( | ||
this.testSubjects.getCssSelector('dataGridColumnResizer') | ||
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}`); | ||
} | ||
Comment on lines
+105
to
+122
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 😅 |
||
|
||
await this.browser.dragAndDrop({ location: resizer }, { location: { x: delta, y: 0 } }); | ||
return { originalWidth, newWidth: (await header.getSize()).width }; | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:Then we can remove these nested styles including
euiDataGridHeaderCell__popover
andeuiDataGridHeaderCell__draggableIcon
, and use a single global style: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