-
Notifications
You must be signed in to change notification settings - Fork 55
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
global: react-searchkit integration #76
global: react-searchkit integration #76
Conversation
af2666b
to
a7be4eb
Compare
import { Results } from "./Results"; | ||
import { InvenioSearchApi } from "react-searchkit"; | ||
|
||
import "semantic-ui-css/semantic.min.css"; |
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.
note: this will have to be removed when integrated in the global Invenio theme
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.
yes, I'm waiting for the theme to be available to remove that
|
||
render() { | ||
|
||
const config = new InvenioSearchApi({ |
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 would say that this should be configurable too. What about if you have:
const searchApi = this.props.searchApi || new InvenioSearchApi(...)
this should be possible for all the params that can be passed to the RSK, for at least most of them, see [https://inveniosoftware.github.io/react-searchkit/docs/components/react-searchkit] (I am not sure that the doc there is up-to-date).
How to inject that JS inside... something to be brainstormed! :)
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.
👍
<Grid.Row columns={2}> | ||
<Grid.Column width={4}> | ||
<Grid.Row><Grid.Column/></Grid.Row> | ||
<BucketAggregation |
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.
We should use RECORDS_REST_FACETS
to render these buckets
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.
done, thanks for noticing this
|
||
const OnResults = withState(Results); | ||
|
||
const resultsPerPageValues = [ |
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 should be also configurable, depending on the default that the user sets in RECORDS_REST_DEFAULT_RESULTS_SIZE
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 removed this component in the end, as the variable allows only one option
<Item.Content> | ||
<Item.Header>{metadata.title}</Item.Header> | ||
<Item.Description> | ||
{_truncate(metadata.keywords.join(","), { length: 200 })} |
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.
Everything related to marc21 can be removed.
Something like record.title + record.description
<Grid relaxed> | ||
<Grid.Row> | ||
<Grid.Column width={16}> | ||
<ActiveFilters /> |
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.
IMHO, I would remove this one in the default invenio-search-ui
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.
removed.
} | ||
} | ||
|
||
Results.propTypes = {}; |
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 make sure that at some point (probably later?) you fill in all propTypes and defaultProps :)
31e4b1c
to
a502595
Compare
renderResultsListItem = (result, index) => { | ||
const metadata = result.metadata; | ||
return ( | ||
<Item key={index} href={_get(result, "links.html", "#")}> |
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 solved the link like this: inveniosoftware/cookiecutter-invenio-instance#226
(also removed truncate
and change style... do we actually need lodash
)?
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 see the solution for the links.html
under your link. Could you explain in more details, which line do you mean?
<Grid.Row verticalAlign="middle"> | ||
<Grid.Column width={7}> | ||
<Count | ||
renderElement={this.renderCount} |
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.
be aware render element has disappeared in the next version of RSK
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 remember, actually I could just remove it
ca96b7e
to
981323b
Compare
invenio_search_ui/webpack.py
Outdated
themes={ | ||
'semantic-ui': dict( | ||
entry={ | ||
'search_ui_app': './js/invenio_react_search_ui/index.js', |
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.
'search_ui_app': './js/invenio_react_search_ui/index.js', | |
'search_ui_app': './js/invenio_search_ui/react/index.js', |
I would do the namespacing like suggested (<module name>/react/
) or simply just use without react
part.
Ditto for below on the angular app. -> invenio_search_ui/angular/app.js
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.
fixed
invenio_search_ui/views.py
Outdated
config_default_sort = config.get('RECORDS_REST_DEFAULT_SORT', {}).get( | ||
search_index) | ||
|
||
return json.dumps({ |
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.
Minor: Use the Jinja filter |tojson
instead. It's not a big issue since there's no user-provided data, but tojson
does proper escaping to prevent XSS attacks, so that the JSON can safely be included in HTML script tags.
I can see this is an inherited problem from the module :-)
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.
fixed
invenio_search_ui/config.py
Outdated
@@ -10,6 +10,8 @@ | |||
|
|||
from __future__ import absolute_import, print_function | |||
|
|||
APP_THEME = ['semantic-ui', 'bootstrap3'] |
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.
Comment: I guess this is also just for testing?
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 left it until I'm sure where this should go, cookiecutter right? Also I'm still not 100% sure if the js framework should be "hidden" under themes=
names
3590535
to
a5aca8f
Compare
* choose js framework * layout fixes
* ID-assigned searchbar * remove double searchbar
6f0253d
to
9e332c7
Compare
There are issues when integrating with cookiecutter with the id of the header and React portals, we will need to fix it tomorrow. |
b210ebd
to
9bb42a7
Compare
9bb42a7
to
2fecd7a
Compare
choose js framework
closes Integrate React-SearchKit #75