Conversation
& remove duplicate CSS variable
There was a problem hiding this comment.
@ybnd : I tried testing this today, but it's not working for me. I pulled down this PR, and ran yarn start. Everything builds fine.
Search works, & all of the other filters work fine.
But as soon as I use the date filter, the page just says "Loading search results...". In Chrome DevTools, I see that all the date filter requests are returning a "CORS error", which is odd because none of the other filter requests do so. It almost seems like the request itself isn't being sent properly, because the error console has many errors that look like this
Access to XMLHttpRequest at 'http://localhost:8080/server/api/discover/facets/has_content_in_original_bundle?page=0&size=2&sort=score,DESC&page=0&size=10&query=test&f.dateIssued=[1963%20TO%201992]' from origin 'http://localhost:4000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
|
@tdonohue I can't reproduce your issue when I test it against api7.dspace.org. I suspect It may be an issue with your rest server |
|
@artlowel and @ybnd : I looked into this more today on my end. In the end, the error is not actually from CORS & it's not coming from our REST API Instead, the underlying problem is that my Tomcat (v8.5) is throwing this error on every date filter query: By default, it appears (at least some versions of) Tomcat doesn't like unescaped square brackets ( It appears the the frontend is sending square brackets unescaped...which can result in inconsistent behavior (it may or may not work depending on how you have Tomcat configured, or even which version of Tomcat you use). My best guess is that api7.dspace.org is either running a different version of Tomcat (which handles this better), or has configured Tomcat to handle this better. If, however, I change your date filter query to send escaped square brackets, then everything seems to work for me. So, this query throws an error in my Tomcat But, this one works fine (and valid results are returned). The only difference is So, in my opinion, this should be fixed on the frontend (where it can be done more easily). A backend fix would be harder as it may end up being specific for different versions of Tomcat, which would be ugly to document, etc. |
|
You're right. We'll fix it |
* Extract "selective encoding" ops into separate methods * Add comments to clarify regex * Use hasValue() instead of just checking on 'match' * Leave only the last comma of filter values unencoded
Co-authored-by: Matus Kasak <matus.kasak@dataquest.sk>
References
Description
Fix filtering by date range
Instructions for Reviewers
List of changes in this PR:
_custom_variables.scss: Initialize--ds-slider-handle-width: 18px;so the handles show up as handles instead of just linesAdd an
'equals'operator to range filters.This used to be optional, but now the backend returns 422 if no operator is specified.
Set the fallback max date to the current year (used to be 2018)
Fix horizontal position of vertical lines in range handles (were forced all the way to the left)
Fix
.search-filter-wrappergetting stuck with.closedwhen actually in open stateReviewing
Checklist
yarn run lintpackage.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.