-
Notifications
You must be signed in to change notification settings - Fork 917
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 2.0] Fixed recent query and Data Selector styles #7918
[Discover 2.0] Fixed recent query and Data Selector styles #7918
Conversation
Signed-off-by: Ashwin P Chandran <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7918 +/- ##
==========================================
- Coverage 64.30% 64.29% -0.01%
==========================================
Files 3674 3674
Lines 81138 81150 +12
Branches 12927 12928 +1
==========================================
+ Hits 52174 52176 +2
- Misses 25752 25764 +12
+ Partials 3212 3210 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
LGTM
import { Query, TimeRange } from '../..'; | ||
|
||
// Todo: Implement a more advanced QueryHistory class when needed for recent query history | ||
const MAX_HISTORY_SIZE = 500; |
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.
Should we make this a UI_SETTING
?
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.
Good call. Fast follow maybe? This was what Abby introduced in her PR but we don't today show any more than 10 to the user anyways, so having this value be user configurable isn't very useful yet. Once we implement more features for the table, then it makes sense adding it as an advanced setting
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.
nothing blocking
id: idx, | ||
query: query.query.query, | ||
timeRange: query.timeRange, | ||
time: moment(query.time).format('MMM D, YYYY HH:mm:ss'), |
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.
maybe later, i remember user can config the format when date time is displayed, should this be read from user config?
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.
yeah from ui settings
public getHistory(): any[] { | ||
return this.getHistoryKeys() | ||
.map((key) => this.storage.get(key)) | ||
.sort((a, b) => b.time - a.time); |
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.
getHistoryKeys already sorts by time, is this sort needed?
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.
Good catch. I added that sort afterwards. This is no longer needed
export class QueryHistory { | ||
constructor(private readonly storage: DataStorage) {} | ||
private changeEmitter: BehaviorSubject<any[]>; |
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 the type is just
interface QueryHistoryItem {
time: number;
query: Query;
dateRange?: TimeRange;
};
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.
imo i think the type should extend savedquery
keys.splice(0, 500); // only maintain most recent X; | ||
keys.forEach((key) => { | ||
this.storage.remove(key); | ||
public addQueryToHistory(query: Query, dateRange?: TimeRange): void { |
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.
should we just use the LRU library we have?
<RecentQueriesTable | ||
isVisible={this.state.isRecentQueryVisible && useQueryEditor} | ||
queryString={this.queryString} | ||
onClickRecentQuery={this.onClickRecentQuery} |
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.
how come not just onClick?
The backport to
To backport manually, run these commands in your terminal: # Navigate to the root of your repository
cd $(git rev-parse --show-toplevel)
# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add ../.worktrees/OpenSearch-Dashboards/backport-2.x 2.x
# Navigate to the new working tree
pushd ../.worktrees/OpenSearch-Dashboards/backport-2.x
# Create a new branch
git switch --create backport/backport-7918-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 7f9aabbb02a7fe96f86b007663fe2774ceb6ad98
# Push it to GitHub
git push --set-upstream origin backport/backport-7918-to-2.x
# Go back to the original working tree
popd
# Delete the working tree
git worktree remove ../.worktrees/OpenSearch-Dashboards/backport-2.x Then, create a pull request where the |
<div className="osdQueryEditor__body">{languageEditor.Body()}</div> | ||
<RecentQueriesTable | ||
isVisible={this.state.isRecentQueryVisible && useQueryEditor} | ||
queryString={this.queryString} |
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 it can access the service with the gettersetters
Signed-off-by: Ashwin P Chandran <[email protected]> (cherry picked from commit 7f9aabb) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…7927) (cherry picked from commit 7f9aabb) Signed-off-by: Ashwin P Chandran <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Description
This PR contains the following changes:
Issues Resolved
Screenshot
Screen.Recording.2024-08-29.at.5.55.03.AM.mov
Testing the changes
Changelog
Check List
yarn test:jest
yarn test:jest_integration