-
Notifications
You must be signed in to change notification settings - Fork 113
Add sorting to summary panel #8879
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
Conversation
E2E Tests 🚀 |
d673ed7
to
2fbb607
Compare
f01297a
to
2be60a2
Compare
* @param options.sortOption The sort option to apply to the search results, defaults to SearchSchemaSortOrder.Original. | ||
* @returns A promise that resolves to an array of matching column indices. | ||
*/ | ||
async searchSchema2(options: { |
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.
Rather than updating the existing searchSchema function, I've created a new one that is called when the feature flag is on. This is needed, because the returned result is a completely different format than the existing search.
Having this change in a separate function allows us to incrementally change the three different caching layers to use the new backend search/sort without breaking the data explorer when the feature flag is off.
searchSchema2
will become the default searchSchema
function once we've got the data grid, filter bar, and summary bar caching layers updated to handle the backend search.
screenColumns: this.screenRows | ||
}); | ||
showSummaryPanelEnhancements | ||
? await this._tableSummaryCache.update2({ |
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.
When the feature flag is on, the summary panel calls the new update function which has been updated to use the new search schema call.
*/ | ||
async setSortOption(sortOption: SearchSchemaSortOrder): Promise<void> { | ||
this._sortOption = sortOption; | ||
await this.fetchData(); |
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.
When sorting, we never invalidate the cache. This only happens when the search text is cleared.
* _displayPositionOrder[0] = 5 means the first row in the data grid should display data | ||
* for the 6th column (index 5) from the original un-modified dataset. | ||
*/ | ||
private _displayPositionOrder: number[] = []; |
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.
This logic is going to have to be moved into the layout manager layer to play well with the pinned columns feature and new backend search API.
isColumnExpanded(displayIndex: number) { | ||
const originalIndex = summaryPanelEnhancementsFeatureEnabled(this._configurationService) | ||
? this._displayPositionOrder[displayIndex] | ||
: displayIndex; | ||
|
||
return originalIndex !== undefined ? this._expandedColumns.has(originalIndex) : false; |
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.
Managing the collapsed/expanded state for columns is currently incomplete. There are changes that need to be done in the layout manager side, which can be done in a follow up after the pinned columns changes have landed.
@@ -215,64 +256,49 @@ export class TableSummaryCache extends Disposable { | |||
// Destructure the update descriptor. | |||
const { | |||
invalidateCache, | |||
searchText, |
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.
Reverted the changes in update that were search related and instead moved into a new standalone function called udpate2.
*/ | ||
private trimCache(startColumnIndex: number, endColumnIndex: number) { | ||
private trimCache(columnIndicesToKeep: number[]) { |
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 support trimming arbitrary columns from the cache, this function now takes an array of column indices we want to keep in the cache, and trims the rest. This allows the cache to only keep search results
Creating a new wrapper function in the data explorer client instance for searching that utilizes the backend for searching and sorting. The backend powered search is being implemented in an isolated way to avoid regressions in the data grid column filtering functionality which currently works. As part of adding search and sort, the order the data should be rendered in (with regards to pinned columns as well) needs to be maintained separately from the cache. The cache previously only contained the data we needed to render and was used as the source of truth on what to render and the order to render it. Now we utilze an array to determine what to render and in what order
abbafe4
to
1f92559
Compare
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.
Addresses #8533 #8534 #8806
To view these changes, set
"dataExplorer.summaryPanelEnhancements": true
in your settings.json file.This PR adds the dropdown for sorting the summary panel rows and switches the summary panel to use the search/sort backend implementation when the feature flag is on. Searching and sorting the summary panel rows should be mostly functional. The UI will still have some bugs (expanding/collapsing a specific column, and scrollbar management) but these changes can be resolved after we have the changes for pinning columns in the layout manager.
This PR also adds additional safety checks to make sure that changes behind the feature flag do not effect the behavior of the data explorer when the feature flag is off since much of the foundational logic will be changing. We will be maintaining two code paths until this feature is complete.
Release Notes
New Features
Bug Fixes
QA Notes
@:data-explorer @:web @:win @:duck-db