Skip to content

Commit

Permalink
Merge pull request #32 from oarepo/corovcam/fe-149-request-landing-page
Browse files Browse the repository at this point in the history
Request landing page and other API fixes
  • Loading branch information
mirekys authored Jul 16, 2024
2 parents 5693d1a + 38b0bf2 commit 85ad8f0
Show file tree
Hide file tree
Showing 58 changed files with 6,769 additions and 1,666 deletions.
32 changes: 32 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
"overrides": [
{
"files": ["oarepo_requests/ui/theme/assets/semantic-ui/js/oarepo_requests_ui/**/*"],
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:react-hooks/recommended",
"plugin:jsx-a11y/recommended"
],
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"settings": {
"react": {
"version": "detect"
}
},
"plugins": ["react", "react-hooks", "jsx-a11y"],
"rules": {
"react/prop-types": "off",
}
}
]
}
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,8 @@ dist/
tests/thesis
thesis

**/ui/theme/**/todo.md
node_modules
todo.md
node_modules

dummy-record.js
jsconfig.json
22 changes: 17 additions & 5 deletions oarepo_requests/invenio_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@
RequestSearchRequestArgsSchema,
RequestsResourceConfig,
)
from invenio_requests.resources.events.config import RequestCommentsResourceConfig
from invenio_requests.services.requests.config import (
RequestSearchOptions,
RequestsServiceConfig,
)
from marshmallow import fields
from opensearch_dsl.query import Bool, Term

from oarepo_requests.resources.ui import OARepoRequestsUIJSONSerializer
from oarepo_requests.resources.ui import OARepoRequestsUIJSONSerializer, OARepoRequestEventsUIJSONSerializer


class RequestOwnerFilterParam(FilterParam):
Expand Down Expand Up @@ -61,17 +62,20 @@ class ExtendedRequestSearchRequestArgsSchema(RequestSearchRequestArgsSchema):


def override_invenio_requests_config(blueprint, *args, **kwargs):
with blueprint.app.app_context():
with (blueprint.app.app_context()):
# this monkey patch should be done better (support from invenio)
RequestsServiceConfig.search = EnhancedRequestSearchOptions
RequestsResourceConfig.request_search_args = (
ExtendedRequestSearchRequestArgsSchema
)

class LazySerializer:
def __init__(self, serializer_cls):
self.serializer_cls = serializer_cls

@cached_property
def __instance(self):
return OARepoRequestsUIJSONSerializer()
return self.serializer_cls()

@property
def serialize_object_list(self):
Expand All @@ -83,7 +87,15 @@ def serialize_object(self):

RequestsResourceConfig.response_handlers = {
"application/json": ResponseHandler(JSONSerializer(), headers=etag_headers),
"application/vnd.inveniordm.v1+json": ResponseHandler(LazySerializer()),
"application/vnd.inveniordm.v1+json": ResponseHandler(LazySerializer(OARepoRequestsUIJSONSerializer),
headers=etag_headers),
}

RequestCommentsResourceConfig.response_handlers = {
"application/vnd.inveniordm.v1+json": ResponseHandler(
LazySerializer(OARepoRequestEventsUIJSONSerializer), headers=etag_headers
),
**RequestCommentsResourceConfig.response_handlers
}

from invenio_requests.proxies import current_request_type_registry
Expand All @@ -97,7 +109,7 @@ def serialize_object(self):
"declined": _("Declined"),
"cancelled": _("Cancelled"),
}
status._label = _("Status")
status._label = _("Request status")

# add extra request types dynamically
type._value_labels = {
Expand Down
Binary file modified oarepo_requests/translations/cs/LC_MESSAGES/messages.mo
Binary file not shown.
68 changes: 68 additions & 0 deletions oarepo_requests/translations/cs/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,71 @@ msgstr "Publikovat"

msgid "Close"
msgstr "Zavřít"

#: /Users/miroslavbauer/Code/github.com/oarepo/oarepo-requests/oarepo_requests/ui/templates/semantic-ui/oarepo_requests_ui/RequestDetail.jinja:3
msgid "Request"
msgstr ""

msgid "Pending"
msgstr ""

msgid "request"
msgstr ""

msgid "Error while submitting comment."
msgstr ""

msgid "Add comment"
msgstr ""

msgid "optional"
msgstr ""

msgid "Your comment here..."
msgstr ""

msgid "Comment was not created successfully."
msgstr ""

msgid "Comment"
msgstr ""

msgid "Error while submitting the comment"
msgstr ""

msgid "Back to requests"
msgstr ""

msgid "Record"
msgstr ""

msgid "preview"
msgstr ""

msgid "to top"
msgstr ""

msgid "Loading timeline..."
msgstr ""

msgid "Error while fetching timeline events"
msgstr ""

msgid "commented"
msgstr ""

msgid "icon"
msgstr ""

msgid "this request"
msgstr ""

msgid "Comment must be at least 1 character long."
msgstr ""

msgid "Invalid format."
msgstr ""

#: /Users/miroslavbauer/Code/github.com/oarepo/oarepo-requests/oarepo_requests/invenio_patches.py:100
msgid "Request status"
msgstr "Stav žádosti"
68 changes: 68 additions & 0 deletions oarepo_requests/translations/en/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -217,5 +217,73 @@ msgstr ""
msgid "Close"
msgstr ""

#: /Users/miroslavbauer/Code/github.com/oarepo/oarepo-requests/oarepo_requests/ui/templates/semantic-ui/oarepo_requests_ui/RequestDetail.jinja:3
msgid "Request"
msgstr ""

msgid "Pending"
msgstr ""

msgid "request"
msgstr ""

msgid "Error while submitting comment."
msgstr ""

msgid "Add comment"
msgstr ""

msgid "optional"
msgstr ""

msgid "Your comment here..."
msgstr ""

msgid "Comment was not created successfully."
msgstr ""

msgid "Comment"
msgstr ""

msgid "Error while submitting the comment"
msgstr ""

msgid "Back to requests"
msgstr ""

msgid "Record"
msgstr ""

msgid "preview"
msgstr ""

msgid "to top"
msgstr ""

msgid "Loading timeline..."
msgstr ""

msgid "Error while fetching timeline events"
msgstr ""

msgid "commented"
msgstr ""

msgid "icon"
msgstr ""

msgid "this request"
msgstr ""

msgid "Comment must be at least 1 character long."
msgstr ""

msgid "Invalid format."
msgstr ""

#: /Users/miroslavbauer/Code/github.com/oarepo/oarepo-requests/oarepo_requests/invenio_patches.py:100
msgid "Request status"
msgstr ""

#~ msgid "No status"
#~ msgstr ""
Binary file modified oarepo_requests/translations/messages.mo
Binary file not shown.
74 changes: 66 additions & 8 deletions oarepo_requests/translations/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2024-06-19 14:40+0200\n"
"POT-Creation-Date: 2024-07-15 09:46+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -38,7 +38,7 @@ msgid "Cancelled"
msgstr ""

#: /Users/miroslavbauer/Code/github.com/oarepo/oarepo-requests/oarepo_requests/invenio_patches.py:100
msgid "Status"
msgid "Request status"
msgstr ""

#: /Users/miroslavbauer/Code/github.com/oarepo/oarepo-requests/oarepo_requests/invenio_patches.py:106
Expand Down Expand Up @@ -193,7 +193,14 @@ msgstr ""
msgid "Request publishing of a draft"
msgstr ""

msgid "Loading request types"
#: /Users/miroslavbauer/Code/github.com/oarepo/oarepo-requests/oarepo_requests/ui/templates/semantic-ui/oarepo_requests_ui/RequestDetail.jinja:3
msgid "Request"
msgstr ""

msgid "Cancel request"
msgstr ""

msgid "Requests"
msgstr ""

msgid "Error loading request types"
Expand All @@ -205,20 +212,71 @@ msgstr ""
msgid "No status"
msgstr ""

msgid "Requests"
msgid "Pending"
msgstr ""

msgid "Error loading requests"
msgstr ""

msgid "Loading requests"
msgid "Close"
msgstr ""

msgid "Cannot send request. Please try again later."
msgid "request"
msgstr ""

msgid "Cancel request"
msgid "Error while submitting comment."
msgstr ""

msgid "Close"
msgid "Add comment"
msgstr ""

msgid "optional"
msgstr ""

msgid "Your comment here..."
msgstr ""

msgid "Comment was not created successfully."
msgstr ""

msgid "Comment"
msgstr ""

msgid "Error while submitting the comment"
msgstr ""

msgid "Back to requests"
msgstr ""

msgid "Record"
msgstr ""

msgid "preview"
msgstr ""

msgid "to top"
msgstr ""

msgid "Status"
msgstr ""

msgid "Loading timeline..."
msgstr ""

msgid "Error while fetching timeline events"
msgstr ""

msgid "commented"
msgstr ""

msgid "icon"
msgstr ""

msgid "this request"
msgstr ""

msgid "Comment must be at least 1 character long."
msgstr ""

msgid "Invalid format."
msgstr ""
File renamed without changes.
Loading

0 comments on commit 85ad8f0

Please sign in to comment.