-
Notifications
You must be signed in to change notification settings - Fork 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
[No QA] Split SearchUtils into two files #50866
[No QA] Split SearchUtils into two files #50866
Conversation
9db051f
to
328792f
Compare
328792f
to
1b9196e
Compare
@rayane-djouah Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
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.
Nice improvement to code structure
Suggestions:
/**
* Sanitizes a string by escaping special characters, placing quotes around strings that contain invalid characters.
*/
function sanitizeString() { }
/**
* Parses a given search query string into a structured JSON format suitable for further processing.
*/
function buildSearchQueryJSON() { }
/**
* Constructs a search query string from a search query JSON object.
*/
function buildSearchQueryString() { }
/**
* Constructs a query string from the values provided in the search filters form.
*/
function buildQueryStringFromFilterFormValues() { }
/**
* Replaces the IDs for values in a specific filter with display values.
*/
function getDisplayValue() { }
/**
* Constructs the filter values part of the query string for a specific filter.
*/
function buildFilterString() { }
/**
* Constructs a predefined (canned) search query string, typically used for standard searches that only specify type and status.
*/
function buildCannedSearchQuery() { }
/**
* Standardizes a search query JSON object by replacing display values with their corresponding IDs.
*/
function standardizeQueryJSON() { }
/**
* Constructs a contextual suggestion query for the Search in <Report name> search router option.
*/
function getContextualSuggestionQuery() { }
/**
* Determines whether to display the merchant field based on the transactions in the search results.
*/
function getShouldShowMerchant() { }
/**
* Checks if the date of transactions or reports indicate the need to display the year because they are from a past year.
*/
function shouldShowYear() { }
/**
* Organizes transaction data into sections for display, handling formatting and visibility of details like merchants and years.
*/
function getTransactionsSections() { }
/**
* Formats and organizes report action data into sections for display based on report actions.
*/
function getReportActionsSections() { }
/**
* Generates a display name for IOU reports considering the personal details of the payer and the transaction details.
*/
function getIOUReportName() { }
/**
* Aggregates and organizes report data into sections for display, including transaction and IOU details.
*/
function getReportSections() { }
/**
* Selects the appropriate list item component based on the type and status of the search data.
*/
function getListItem() { }
/**
* Organizes data into appropriate sections for displaying based on the type of search data and status.
*/
function getSections() { }
/**
* Orders sections of data based on a specified column and order direction for displaying sorted results.
*/
function getSortedSections() { }
/**
* Sorts transaction data by a specified column and direction, affecting how transactions are ordered in the display.
*/
function getSortedTransactionData() { }
/**
* Determines the date of the newest transaction within a report for sorting purposes.
*/
function getReportNewestTransactionDate() { }
/**
* Sorts report data based on the date of the newest transaction in each report to order them appropriately.
*/
function getSortedReportData() { }
/**
* Sorts report action data based on their creation dates to order actions chronologically.
*/
function getSortedReportActionData() { }
/**
* Checks if the search results contain any data, useful for determining if the search results are empty.
*/
function isSearchResultsEmpty() { }
/**
* Maps an expense type to its corresponding translation key for displaying localized text.
*/
function getExpenseTypeTranslationKey() { }
/**
* Constructs and configures the overflow menu for search items, handling interactions such as renaming or deleting items.
*/
function getOverflowMenu() { }
/**
* Validates the appropriateness of a user display name, excluding generic or placeholder names.
*/
function isCorrectSearchUserName() { }
|
Since the |
@rayane-djouah sounds like good idea, I will add these updates later and ping you to re-echeck |
@rayane-djouah Re 2: completely agree that 3,4 - will fix And about this:
I partially agree, from the perspective of what it returns it's UI. But what it works on is SearchQuery and it's result will be further used to allow the user to modify said query. That is why I put it there. |
0bd6464
to
16e9e3c
Compare
PR ready for re-check. I tried to add jsdoc for every single search utils method, hopefully I didn't miss any 😅 |
@rayane-djouah please re-review when you have time. However let's prioritise the polish issues: #50921 and merge polish before this PR, because it will cause conflicts in |
We have conflicts |
@rayane-djouah conflicts solved, they were a bit tricky since Jakub changed the original SearchUtils, so I made sure the query hash function was properly copied. |
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 and tests well
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. Thanks for working on this.
Reviewer Checklist
Screenshots/VideosAndroid: NativeScreen.Recording.2024-10-23.at.12.42.02.AM.movAndroid: mWeb ChromeScreen.Recording.2024-10-23.at.12.39.57.AM.moviOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-10-23.at.00.39.35.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-10-23.at.00.38.30.mp4MacOS: Chrome / SafariScreen.Recording.2024-10-23.at.12.14.44.AM.movMacOS: DesktopScreen.Recording.2024-10-23.at.12.35.23.AM.mov |
@luacmartins looks like this was merged without a test passing. Please add a note explaining why this was done and remove the |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.0.53-0 🚀
|
🚀 Deployed to staging by https://github.com/luacmartins in version: 9.0.53-0 🚀
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.0.53-1 🚀
|
🚀 Deployed to production by https://github.com/yuwenmemon in version: 9.0.53-1 🚀
|
Details
@luacmartins I went with your suggestion for the
SearchUIUtils
name, but I kept SearchQuery name; almost all functions inside this file have the word "query" inside and they mostly transform different forms of query. I think adding the wordsyntax
to the mix right now would actually be more confusingApp works without problems:
recc.mov
Fixed Issues
$ #50787
PROPOSAL:
Tests
Offline tests
QA Steps
N/A Only code changes and renames in this PR; no logic changed
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop