-
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
Merged
Merged
Changes from 21 commits
Commits
Show all changes
23 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 a8eaa1b
Merge branch 'main' into 195769-draggable-columns
jughosta ae44093
Merge branch 'main' into 195769-draggable-columns
jughosta 7978524
[Discover] Switch to opt-in prop
jughosta 940b492
Merge branch 'main' into 195769-draggable-columns
jughosta 2e61677
[Discover] Update tests
jughosta 4008bd8
Merge branch 'main' into 195769-draggable-columns
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
45 changes: 45 additions & 0 deletions
45
...ages/kbn-unified-data-table/src/components/__snapshots__/data_table_columns.test.tsx.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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}`); | ||
} | ||
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.
What is the role of
defaultColumns
here. Does this condition covers the scenario whenSummary
column is visible?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.
@logeekal Yes, I noticed that columns are not movable right now when Summary is present. So I disabled the drag&drop too.