Skip to content
Permalink
Browse files

bundles: uses rero-ils-ui version 0.0.5

* Adds new item serializer to add authors informations.
* Fixes mef proxy used by the document editor.
* Fixes ui organisation and library filtered select.
* Adds space on the top of the search public view.
* Removes usesless _settings in the API serializers. This fixes result
list without facets.

Co-Authored-by: Johnny Mariéthoz <Johnny.Mariethoz@rero.ch>
  • Loading branch information
jma committed Dec 10, 2019
1 parent bf37f9c commit 66244cb9ffa824ac185c31a17adb03408e8e549b
@@ -77,7 +77,7 @@ def catalog(domain):
'node_modules/@rero/rero-ils-ui/dist/admin/main.*.js',
output='gen/rero_ils_admin_ui.%(version)s.js',
npm={
'@rero/rero-ils-ui': '~0.0.3'
'@rero/rero-ils-ui': '0.0.6'
}
)

@@ -89,7 +89,7 @@ def catalog(domain):
'node_modules/@rero/rero-ils-ui/dist/public-search/main.*.js',
output='gen/rero_ils_public-search_ui.%(version)s.js',
npm={
'@rero/rero-ils-ui': '~0.0.3'
'@rero/rero-ils-ui': '0.0.6'
}
)

@@ -98,6 +98,6 @@ def catalog(domain):
'node_modules/@rero/rero-ils-ui/dist/search-bar/main.*.js',
output='gen/rero_ils_search-bar_ui.%(version)s.js',
npm={
'@rero/rero-ils-ui': '~0.0.3'
'@rero/rero-ils-ui': '0.0.6'
}
)
@@ -345,6 +345,9 @@ def _(x):
record_serializers={
'application/json': (
'rero_ils.modules.serializers:json_v1_response'
),
'application/rero+json': (
'rero_ils.modules.documents.serializers:json_doc_response'
)
},
search_serializers={
@@ -18,17 +18,35 @@
"""Document serialization."""

from flask import current_app, request
from invenio_records_rest.serializers.response import search_responsify
from invenio_records_rest.serializers.response import record_responsify, \
search_responsify

from ..documents.api import Document
from ..libraries.api import Library
from ..organisations.api import Organisation
from ..persons.api import Person
from ..serializers import JSONSerializer, RecordSchemaJSONV1


class DocumentJSONSerializer(JSONSerializer):
"""Mixin serializing records as JSON."""

def preprocess_record(self, pid, record, links_factory=None, **kwargs):
"""Prepare a record and persistent identifier for serialization."""
rec = record
if request and request.args.get('resolve') == '1':
rec = record.replace_refs()
authors = rec.get('authors', [])
for author_index in range(len(authors)):
pid_value = authors[author_index].get('pid')
if pid_value:
person = Person.get_record_by_mef_pid(pid_value)
authors[author_index] = person.dumps_for_document()
data = super(JSONSerializer, self).preprocess_record(
pid=pid, record=rec, links_factory=links_factory, kwargs=kwargs)

return JSONSerializer.add_item_links_and_permissions(record, data, pid)

def post_process_serialize_search(self, results, pid_fetcher):
"""Post process the search results."""
# Item filters.
@@ -83,3 +101,4 @@ def post_process_serialize_search(self, results, pid_fetcher):
"""JSON v1 serializer."""

json_doc_search = search_responsify(json_doc, 'application/rero+json')
json_doc_response = record_responsify(json_doc, 'application/json')
@@ -5,7 +5,7 @@
{
"title": "Organisation",
"key": "organisation.$ref",
"type": "select",
"type": "remote-select",
"remoteRecordType": "organisations",
"remoteRecordFiltersByOwningOrganisation": "pid",
"readonly": "true"
@@ -26,7 +26,7 @@
{
"key": "location.$ref",
"title": "Location",
"type": "select",
"type": "remote-select",
"remoteRecordType": "locations",
"remoteRecordFiltersByOwningLibrary": "library.pid"
}
@@ -43,4 +43,4 @@
}
]
}
]
]
@@ -5,7 +5,7 @@
{
"title": "Organisation",
"key": "organisation.$ref",
"type": "select",
"type": "remote-select",
"remoteRecordType": "organisations",
"remoteRecordFiltersByOwningOrganisation": "pid",
"readonly": "true"
@@ -32,4 +32,4 @@
}
]
}
]
]
@@ -107,7 +107,7 @@
"required": true,
"title": "Library",
"description": "Library affiliation.",
"type": "select",
"type": "remote-select",
"remoteRecordType": "libraries",
"remoteRecordFiltersByOwningLibrary": "pid",
"condition": {
@@ -111,8 +111,6 @@ def person_label(data, language):

@api_blueprint.route('/mef/', defaults={'path': ''})
@api_blueprint.route('/mef/<path:path>')
@api_blueprint.route('/persons/', defaults={'path': ''})
@api_blueprint.route('/persons/<path:path>')
def mef_proxy(path):
"""Proxy to mef server."""
resp = requests.request(
@@ -145,7 +145,7 @@ def post_process_serialize_search(self, results, pid_fetcher):
'RERO_ILS_APP_CONFIG_FACETS', {}
)
facet_config = facet_config.get(pid_type, {})
results['aggregations']['_settings'] = facet_config
# results['aggregations']['_settings'] = facet_config

# add permissions and links actions
permission = self.get_permission('create', pid_type)
@@ -23,6 +23,7 @@
<head>
<meta charset="utf-8">
<title>Admin</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="/professional">
<link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
@@ -20,7 +20,7 @@
{% extends 'rero_ils/page.html' %}

{%- block page_body %}
<div class="container ">
<div class="container mt-4">
<public-search-root></public-search-root>
</div>

0 comments on commit 66244cb

Please sign in to comment.
You can’t perform that action at this time.