Skip to content

Commit bb550f6

Browse files
authored
Mug curations enable (#51)
* feat(mug): enable curation workflow
1 parent 2f89ee6 commit bb550f6

5 files changed

Lines changed: 165 additions & 11 deletions

File tree

assets/js/invenio_app_rdm/overridableRegistry/mapping.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@
88
* Add here all the overridden components of your app.
99
*/
1010

11-
export const overriddenComponents = {}
11+
import { DepositBox } from "@js/invenio_curations/deposit/DepositBox";
12+
import { curationComponentOverrides } from "@js/invenio_curations/requests";
13+
14+
export const overriddenComponents = {
15+
...curationComponentOverrides,
16+
"InvenioAppRdm.Deposit.CardDepositStatusBox.container": DepositBox,
17+
};

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,13 @@ dependencies = [
1414
"uwsgi >=2.0",
1515
"uwsgitop >=0.11",
1616
"uwsgi-tools >=1.1.1",
17+
"invenio-curations==0.4.0",
18+
"invenio-global-search>=0.3.0",
1719
"invenio-override ~=0.0.6",
1820
]
1921

2022
[tool.setuptools]
2123
py-modules = []
2224

2325
[tool.uv.sources]
24-
invenio-override = { git = "https://github.com/sharedRDM/invenio-override", branch = "main" }
26+
invenio-curations = { git = "https://github.com/tu-graz-library/invenio-curations", branch = "main"}

templates/comment-template.html

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<body>
4+
<h3> {{header}} </h3>
5+
6+
{% if adds|length > 0 %}
7+
<h3>{{ _("Added") }}</h3>
8+
<ul>
9+
{% for add in adds %}
10+
{% set result_items = add.diff[2] %}
11+
{% for result in result_items %}
12+
{% set field = result[0] %}
13+
{% set values = result[1:] %}
14+
{% for value in values %}
15+
<li>
16+
<strong>{{ field }}</strong>
17+
<div style="margin-left: 1em;">
18+
<span style="color: green;">New: {{ value|safe }}</span>
19+
</div>
20+
</li>
21+
{% endfor %}
22+
{% endfor %}
23+
{% endfor %}
24+
</ul>
25+
{% endif %}
26+
27+
{% if changes|length > 0 %}
28+
<h3>{{_("Changed")}}</h3>
29+
<ul>
30+
{% for change in changes %}
31+
{% set result = change.diff[2] %}
32+
{% set old = result[0] %}
33+
{% set new = result[1] %}
34+
<li>
35+
<strong>{{ change.diff[1] }}</strong>
36+
<div style="margin-left: 1em;">
37+
<span style="color: red;">Old: {{ old|safe }}</span><br>
38+
<span style="color: green;">New: {{ new|safe }}</span>
39+
</div>
40+
</li>
41+
{% endfor %}
42+
</ul>
43+
{% endif %}
44+
45+
{% if removes|length > 0 %}
46+
<h3>{{ _("Removed") }}</h3>
47+
<ul>
48+
{% for remove in removes %}
49+
{% set result_items = remove.diff[2] %}
50+
{% for result in result_items %}
51+
{% set values = result[1:] %}
52+
{% for value in values %}
53+
{% if remove.diff[1] == "metadata" %}
54+
{% set field = result[0] %}
55+
{% else %}
56+
{% set field = remove.diff[1] %}
57+
{% endif %}
58+
<li>
59+
<strong>{{ field }}</strong>
60+
<div style="margin-left: 1em;">
61+
<span style="color: red;">{{ value|safe }}</span>
62+
</div>
63+
</li>
64+
{% endfor %}
65+
{% endfor %}
66+
{% endfor %}
67+
</ul>
68+
{% endif %}
69+
</body>
70+
</html>

themes/MUG/invenio.cfg

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ from datetime import datetime
1111
from invenio_i18n import lazy_gettext as _
1212
from invenio_oauthclient.contrib.keycloak import KeycloakSettingsHelper
1313

14+
from invenio_app_rdm.config import NOTIFICATIONS_BUILDERS as RDM_NOTIFICATIONS_BUILDERS
15+
from invenio_curations.config import CURATIONS_NOTIFICATIONS_BUILDERS
16+
from invenio_curations.services import facets as curations_facets
17+
from invenio_curations.services.components import CurationComponent
18+
from invenio_curations.services.permissions import (
19+
CurationRDMRecordPermissionPolicy,
20+
CurationRDMRequestsPermissionPolicy,
21+
)
22+
from invenio_rdm_records.services.components import DefaultRecordsComponents
23+
1424
def _(x): # needed to avoid start time failure with lazy strings
1525
return x
1626

@@ -99,9 +109,9 @@ APP_DEFAULT_SECURE_HEADERS = {
99109
# See https://github.com/inveniosoftware/invenio-app-rdm/blob/master/invenio_app_rdm/config.py
100110
# ============================================================================
101111
# Name used in header and UI
102-
THEME_SITENAME = "instance"
112+
THEME_SITENAME = "MUG Repository"
103113
# Frontpage title
104-
THEME_FRONTPAGE_TITLE = "instance"
114+
THEME_FRONTPAGE_TITLE = "Medical University of Graz Repository"
105115
# Header logo
106116
# THEME_LOGO = 'images/invenio-rdm.svg'
107117

@@ -221,6 +231,37 @@ BABEL_DEFAULT_TIMEZONE = "Europe/Vienna"
221231
# Other supported languages (do not include BABEL_DEFAULT_LOCALE in list).
222232
I18N_LANGUAGES = []
223233

234+
# ============================================================================
235+
# Invenio-Curations
236+
# ============================================================================
237+
NOTIFICATIONS_BUILDERS = {
238+
**RDM_NOTIFICATIONS_BUILDERS,
239+
**CURATIONS_NOTIFICATIONS_BUILDERS,
240+
}
241+
242+
RDM_RECORDS_SERVICE_COMPONENTS = DefaultRecordsComponents + [CurationComponent]
243+
244+
REQUESTS_FACETS = {
245+
"type": {"facet": curations_facets.type, "ui": {"field": "type"}},
246+
"status": {"facet": curations_facets.status, "ui": {"field": "status"}},
247+
}
248+
249+
# Roles that are exempted from curation workflow
250+
CURATIONS_PRIVILEGED_ROLES = [
251+
"administration",
252+
"bypass-curation",
253+
"administration-rdm-records-curation",
254+
]
255+
256+
RDM_PERMISSION_POLICY = CurationRDMRecordPermissionPolicy
257+
258+
REQUESTS_PERMISSION_POLICY = CurationRDMRequestsPermissionPolicy
259+
# ============================================================================
260+
# Invenio-Curations - Comment Template
261+
# ============================================================================
262+
CURATIONS_ENABLE_REQUEST_COMMENTS = True
263+
CURATIONS_COMMENT_TEMPLATE_FILE = "comment-template.html"
264+
224265
# ============================================================================
225266
# Extras
226267
# ============================================================================
@@ -284,7 +325,7 @@ OVERRIDE_SHIBBOLETH = False
284325
"""Set True if SAML is configured"""
285326

286327
#INVENIO_OVERRIDE_FRONTPAGE_RIGHT=False
287-
OVERRIDE_FRONTPAGE_RIGHT = False
328+
OVERRIDE_FRONTPAGE_RIGHT = True
288329
"""Frontpage right section"""
289330

290331
# Right Section Configuration
@@ -300,7 +341,7 @@ OVERRIDE_RIGHT_SECTION_CONTACT_EMAIL = "rdmsupport@medunigraz.at"
300341

301342
# Theme and Templates
302343
# --------------
303-
OVERRIDE_RESOURCE_OVERVIEW = True
344+
OVERRIDE_RESOURCE_OVERVIEW = False
304345
"""Resource overview section"""
305346

306347
# ============================================================================

uv.lock

Lines changed: 40 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)