-
Notifications
You must be signed in to change notification settings - Fork 13
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
Use API V3 #132
Use API V3 #132
Conversation
I haven't tested this, but I just skimmed the code thinking about readthedocs/readthedocs.org#10127 and how we are going to integrate it there. It seems that the only relevant change is the addition of two new configs. We can get those from the user (
Instead of using check boxes, I'd say we should use radio buttons then, which provide this UX natively. |
Radio buttons don't allow you to uncheck them. |
Search by <a href="https://readthedocs.org/">Read the Docs</a> & <a href="https://readthedocs-sphinx-search.readthedocs.io/en/latest/">readthedocs-sphinx-search</a> \ | ||
</div>'; | ||
const generateAndReturnInitialHtml = (filters) => { | ||
let innerHTML = ` |
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.
HTML is mostly the same, diff shows like all changed, but only the trailing \
was removed to just use a multine string. The new addition is everything inside <div class="search__filters">
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 looks reasonable, but I haven't looked at the JS super heavily. I need to spend a bit more time looking over this, but the high-level seems reasonable?
We're looking at a bunch of other ways to pass data around in the readthedocs-client, but the JS approach here looks workable to start.
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 this is good to move forward. I didn't find anything where I would block this PR. I really want to get this PR merged so I can continue working on the js client.
@stsewd @ericholscher are there specific things you want to double-check before merging?
.readthedocs.yaml
Outdated
# sphinx-js isn't compatible with python 3.10. | ||
# https://github.com/mozilla/sphinx-js/issues/186 | ||
python: "3.9" | ||
python: "3.11" |
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.
python: "3.11" | |
python: "3" |
const config = getConfig(); | ||
// Add filters below the search box if present. | ||
if (filters.length > 0) { | ||
let li = createDomNode("li", {"class": "search__filters__title"}); |
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 don't like too much the pattern of "generating nodes on the fly" a lot and I'd prefer to use literal strings if possible. This way is a lot easier to read and follow the code.
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.
If you mean building the strings manually, we need to be more cautious about user input, a better pattern can be just building the skeleton first, and then change that (#117 (comment))
Well, I need to fix the test :D, but wanted a review first, before dealing with selenium |
I'm 👍 on shipping this, since it's not super heavily used, if it's been reviewed. I think user feedback will be the main thing that we care about. I agree this is a really exciting addition, so let's ship it and get it running on our docs, and then we'll get lots more feedback I imagine :) If the tests are super brittle or annoying, we can also discuss changing them up in some fashion. I don't have a ton of context about how complex they are, but I feel like selenium is probably overkill, and we could be using some lighter weight JS test stuff? Though again, I don't have much knowledge there.. |
Yeah, I'd prefer more unit tests here at the js level. But we do have some UI logic that selenium helps to test, but also, it's small, so it isn't hard to manually test that. |
- update styles - integrate under `/` I copied all the code from readthedocs/readthedocs-sphinx-search#132. However, there are lot of things that are not required for this stage. I removed some of them and make the integration nicer with the client we are creating. These changes are related to the HTML structure and the CSS style. The functionality is exactly the same. Related #19
- update styles - integrate under `/` I copied all the code from readthedocs/readthedocs-sphinx-search#132. However, there are lot of things that are not required for this stage. I removed some of them and make the integration nicer with the client we are creating. These changes are related to the HTML structure and the CSS style. The functionality is exactly the same. Related #19
Cool! Since only tests were left here, I started using the |
How to test locally:
|/api/v3/search
at https://github.com/readthedocs/readthedocs.org/blob/b574f4b0dad34ccba8595cee72246d3473f8a2e5/readthedocs/settings/base.py#L769-L781rtd_dummy_data.json
file'proxied_api_host': 'http://devthedocs.org'
rtd_sphinx_search_default_filter = "project:superproject/latest"
to the slug of a project you have locallyshowcase
showcase.webm
Closes #129
Closes #130
Closes #131