-
Notifications
You must be signed in to change notification settings - Fork 87
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
feat: adds sort widget to search manager and library component page [FC-0059] #1147
feat: adds sort widget to search manager and library component page [FC-0059] #1147
Conversation
Thanks for the pull request, @pomegranited! What's next?Please work through the following steps to get your changes ready for engineering review: 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. 🔘 Let us know that your PR is ready for review:Who will review my changes?This repository is currently maintained by Where can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:
When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1147 +/- ##
==========================================
+ Coverage 92.82% 92.88% +0.05%
==========================================
Files 747 750 +3
Lines 13372 13468 +96
Branches 2856 2880 +24
==========================================
+ Hits 12413 12510 +97
+ Misses 924 923 -1
Partials 35 35 ☔ View full report in Codecov by Sentry. |
Sandbox deployment failed 💥 |
Sandbox deployment failed 💥 |
Sandbox deployment failed 💥 |
Sandbox deployment failed 💥 |
Sandbox deployment failed 💥 |
Sandbox deployment successful 🚀 |
Sandbox deployment successful 🚀 |
Sandbox deployment successful 🚀 |
Sandbox deployment successful 🚀 |
Sandbox deployment successful 🚀 |
Sandbox deployment failed 💥 |
Sandbox deployment successful 🚀 |
Sandbox deployment failed 💥 |
Sandbox deployment successful 🚀 |
* feat: Add Recently Modified library section * feat: Add "View All" to library sections The "View All" action appears on sections that pass in a view all action and contain content that exceeds the defined preview limit, which defaults to 4. * feat: Use intl library section titles * test: Update tests
19c869a
to
f1389e3
Compare
@bradenmacdonald @rpenido CC @yusuf-musleh
I'm having trouble filtering out "unpublished" components from the search results? I think there's two problems, but I can't work out how to fix them. Can you help?
But it fails to filter out components with If we can't work out how to make this happen with the filter query, I could add another boolean field for Thanks in advance for any advice you have! |
Sandbox deployment successful 🚀 |
Sandbox deployment successful 🚀 |
I think meilisearch treats null and empty differently
I'll check tomorrow and update here! |
src/search-manager/SearchManager.ts
Outdated
const sort: SearchSortOption[] = (searchSortOrderToUse === defaultSortOption ? [] : [searchSortOrderToUse]); | ||
// Selecting SearchSortOption.RECENTLY_PUBLISHED also excludes unpublished components. | ||
if (searchSortOrderToUse === SearchSortOption.RECENTLY_PUBLISHED) { | ||
extraFilter.push('last_published IS NOT EMPTY'); |
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.
Can you try this @pomegranited?
extraFilter.push('last_published IS NOT EMPTY'); | |
extraFilter.push('last_published IS NOT NULL'); |
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.
🤦♀️ That was totally it.. Thank you @rpenido !
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.
And re the last_published
date stored in the index, I think I've found the problem, but am not sure how to address it, so have asked Dave.
} | ||
const renderEmptyState = () => { | ||
if (componentCount === 0) { | ||
return searchKeywords === '' ? <NoComponents /> : <NoSearchResults />; |
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.
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! Maybe we can adjust the message.. have asked Product.
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.
Addressed with 94ac0a1.
Sandbox deployment successful 🚀 |
Sandbox deployment successful 🚀 |
This handles the case where "Recently Published" sort is selected, which filters out published components.
Sandbox deployment successful 🚀 |
Sandbox deployment successful 🚀 |
Sandbox deployment successful 🚀 |
Sandbox deployment successful 🚀 |
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 👍
Thank you for your work, @pomegranited!
I left a comment about the defaultProps (but it is not blocking, in my opinion).
- I tested this using the instructions from the PR instructions
- I read through the code
- I checked for accessibility issues
- Includes documentation
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.
Looks great! I can merge tomorrow if you address the minor comments from me and @rpenido
@@ -50,6 +50,21 @@ const returnEmptyResult = (_url, req) => { | |||
return mockEmptyResult; | |||
}; | |||
|
|||
const returnLowNumberResults = (_url, req) => { |
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.
Please add a comment explaining what this function is doing; it's not obvious to me from the name.
* use only a single state value (searchParams) * wrap returnSetter in useCallback to ensure the setter remains constant * don't modify searchParams directly -- copy and use setter only.
Sandbox deployment successful 🚀 |
Sandbox deployment successful 🚀 |
Sandbox deployment successful 🚀 |
Sandbox deployment successful 🚀 |
@pomegranited 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
Description
Adds a widget to the library component search manager which sorts the search results based on the selected option.
Plus the Recently Modified components section from open-craft#52.
Supporting information
Part of #1038
Blocked by:
Private-ref: FAL-3758
Testing instructions
Run the latest
master
branch in Studio/CMSReindex studio to update the index settings:
tutor dev run cms ./manage.py cms reindex_studio --experimental
Create a new library
Add components to the library.
From the shell, publish the library:
Add more components, but leave them unpublished.
To test this change:
The Recently Modified section should not change when sort options change.