From ecbbc0fcb0f3b64b6189da80a4f22a857c19bcd7 Mon Sep 17 00:00:00 2001 From: Anika Churilova Date: Fri, 13 Dec 2024 10:50:29 +0100 Subject: [PATCH 1/8] pages: do not create a static page if it already exists * closes https://github.com/CERNDocumentServer/cds-rdm/issues/160 --- invenio_app_rdm/fixtures/pages.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/invenio_app_rdm/fixtures/pages.py b/invenio_app_rdm/fixtures/pages.py index 67cfba06b..9789643f3 100644 --- a/invenio_app_rdm/fixtures/pages.py +++ b/invenio_app_rdm/fixtures/pages.py @@ -13,6 +13,7 @@ from invenio_access.permissions import system_identity from invenio_db import db from invenio_pages.proxies import current_pages_service +from invenio_pages.records.errors import PageNotFoundError from invenio_rdm_records.fixtures.fixture import FixtureMixin @@ -45,11 +46,15 @@ def page_data(self, page): def create(self, entry): """Load a single page.""" - data = { - "url": entry.pop("url"), - "title": entry.get("title"), - "content": self.page_data(entry.get("template")), - "description": entry.get("description"), - "template_name": current_app.config["PAGES_DEFAULT_TEMPLATE"], - } - current_pages_service.create(system_identity, data) + url = entry["url"] + try: + current_pages_service.read_by_url(system_identity, url) + except PageNotFoundError: + data = { + "url": url, + "title": entry.get("title", ""), + "content": self.page_data(entry["template"]), + "description": entry.get("description", ""), + "template_name": current_app.config["PAGES_DEFAULT_TEMPLATE"], + } + current_pages_service.create(system_identity, data) From c0c7e9dd6f9bd0973916769c5bccabf534bd2711 Mon Sep 17 00:00:00 2001 From: Anika Churilova Date: Fri, 13 Dec 2024 15:33:14 +0100 Subject: [PATCH 2/8] theme: put banner message below other objects *closes https://github.com/CERNDocumentServer/cds-rdm/issues/163 --- .../less/invenio_app_rdm/theme/collections/message.overrides | 1 + 1 file changed, 1 insertion(+) diff --git a/invenio_app_rdm/theme/assets/semantic-ui/less/invenio_app_rdm/theme/collections/message.overrides b/invenio_app_rdm/theme/assets/semantic-ui/less/invenio_app_rdm/theme/collections/message.overrides index dd387c13f..2b9944303 100644 --- a/invenio_app_rdm/theme/assets/semantic-ui/less/invenio_app_rdm/theme/collections/message.overrides +++ b/invenio_app_rdm/theme/assets/semantic-ui/less/invenio_app_rdm/theme/collections/message.overrides @@ -5,6 +5,7 @@ .ui.flashed.message, .ui.form .flashed.message { + z-index: 0; &.manage { padding: 1em 0; } From 339114db63d78c1bf5d98f6463e2e32282b8833f Mon Sep 17 00:00:00 2001 From: Anika Churilova Date: Thu, 5 Dec 2024 11:42:08 +0100 Subject: [PATCH 3/8] doi: handle UI for optional DOI feature * closes https://github.com/CERNDocumentServer/cds-rdm/issues/163 --- invenio_app_rdm/ext.py | 13 ++++ invenio_app_rdm/records_ui/views/deposits.py | 60 ++++++++++++++++--- .../invenio_app_rdm/deposit/RDMDepositForm.js | 3 +- .../js/invenio_app_rdm/deposit/index.js | 1 + 4 files changed, 67 insertions(+), 10 deletions(-) diff --git a/invenio_app_rdm/ext.py b/invenio_app_rdm/ext.py index a6c6e20de..61e949e9f 100644 --- a/invenio_app_rdm/ext.py +++ b/invenio_app_rdm/ext.py @@ -33,6 +33,19 @@ def finalize_app(app): def init_config(app): """Initialize configuration.""" + record_doi_required = ( + app.config["RDM_PERSISTENT_IDENTIFIERS"].get("doi", {}).get("required") + ) + parent_doi_required = ( + app.config["RDM_PARENT_PERSISTENT_IDENTIFIERS"].get("doi", {}).get("required") + ) + + if record_doi_required != parent_doi_required: + raise Exception( + "Config variables RDM_PERSISTENT_IDENTIFIERS.doi.required and " + "RDM_PARENT_PERSISTENT_IDENTIFIERS.doi.required must be set to the same value." + ) + if "COMMUNITIES_GROUPS_ENABLED" in app.config: warnings.warn( "COMMUNITIES_GROUPS_ENABLED config variable is deprecated. Please use USERS_RESOURCES_GROUPS_ENABLED " diff --git a/invenio_app_rdm/records_ui/views/deposits.py b/invenio_app_rdm/records_ui/views/deposits.py index d9afc7487..79793b312 100644 --- a/invenio_app_rdm/records_ui/views/deposits.py +++ b/invenio_app_rdm/records_ui/views/deposits.py @@ -60,6 +60,12 @@ def get_form_pids_config(): continue record_pid_config = current_app.config["RDM_PERSISTENT_IDENTIFIERS"] scheme_label = record_pid_config.get(scheme, {}).get("label", scheme) + is_doi_required = record_pid_config.get(scheme, {}).get("required") + default_selected = ( + record_pid_config.get(scheme, {}).get("ui", {}).get("default_selected") + ) + if is_doi_required and default_selected == "not_needed": + default_selected = "yes" pids_provider = { "scheme": scheme, "field_label": "Digital Object Identifier", @@ -82,6 +88,7 @@ def get_form_pids_config(): "A {scheme_label} allows your upload to be easily and " "unambiguously cited. Example: 10.1234/foo.bar" ).format(scheme_label=scheme_label), + "default_selected": default_selected, } pids_providers.append(pids_provider) @@ -360,7 +367,16 @@ def new_record(): record = dump_empty(RDMRecordSchema) record["files"] = {"enabled": current_app.config.get("RDM_DEFAULT_FILES_ENABLED")} if "doi" in current_rdm_records.records_service.config.pids_providers: - record["pids"] = {"doi": {"provider": "external", "identifier": ""}} + if ( + current_app.config["RDM_PERSISTENT_IDENTIFIERS"] + .get("doi", {}) + .get("ui", {}) + .get("default_selected") + == "yes" # yes, no or not_needed + ): + record["pids"] = {"doi": {"provider": "external", "identifier": ""}} + else: + record["pids"] = {} else: record["pids"] = {} record["status"] = "draft" @@ -389,6 +405,11 @@ def deposit_create(community=None): community_use_jinja_header = bool(community_theme) dashboard_routes = current_app.config["APP_RDM_USER_DASHBOARD_ROUTES"] + is_doi_required = ( + current_app.config.get("RDM_PERSISTENT_IDENTIFIERS", {}) + .get("doi", {}) + .get("required") + ) return render_community_theme_template( current_app.config["APP_RDM_DEPOSIT_FORM_TEMPLATE"], theme=community_theme, @@ -397,6 +418,7 @@ def deposit_create(community=None): createUrl="/api/records", quota=get_files_quota(), hide_community_selection=community_use_jinja_header, + is_doi_required=is_doi_required, ), searchbar_config=dict(searchUrl=get_search_url()), record=new_record(), @@ -455,17 +477,37 @@ def deposit_edit(pid_value, draft=None, draft_files=None, files_locked=True): # communities community_use_jinja_header = bool(community_theme) dashboard_routes = current_app.config["APP_RDM_USER_DASHBOARD_ROUTES"] + is_doi_required = ( + current_app.config.get("RDM_PERSISTENT_IDENTIFIERS", {}) + .get("doi", {}) + .get("required") + ) + form_config = get_form_config( + apiUrl=f"/api/records/{pid_value}/draft", + dashboard_routes=dashboard_routes, + # maybe quota should be serialized into the record e.g for admins + quota=get_files_quota(draft._record), + # hide react community component + hide_community_selection=community_use_jinja_header, + is_doi_required=is_doi_required, + ) + + if is_doi_required and not record.get("pids", {}).get("doi"): + # if the DOI is required but there is no value, we set the default selected pid + # to no i.e. system should automatically mint a local DOI + if record["status"] == "new_version_draft": + doi_provider_config = [ + pid_config + for pid_config in form_config["pids"] + if pid_config.get("scheme") == "doi" + ] + if doi_provider_config: + doi_provider_config[0]["default_selected"] = "no" + return render_community_theme_template( current_app.config["APP_RDM_DEPOSIT_FORM_TEMPLATE"], theme=community_theme, - forms_config=get_form_config( - apiUrl=f"/api/records/{pid_value}/draft", - dashboard_routes=dashboard_routes, - # maybe quota should be serialized into the record e.g for admins - quota=get_files_quota(draft._record), - # hide react community component - hide_community_selection=community_use_jinja_header, - ), + forms_config=form_config, record=record, community=community, community_use_jinja_header=community_use_jinja_header, diff --git a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/RDMDepositForm.js b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/RDMDepositForm.js index aa0eab5cd..ef0329622 100644 --- a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/RDMDepositForm.js +++ b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/RDMDepositForm.js @@ -221,7 +221,8 @@ export class RDMDepositForm extends Component { pidPlaceholder={pid.pid_placeholder} pidType={pid.scheme} unmanagedHelpText={pid.unmanaged_help_text} - required + doiDefaultSelection={pid.default_selected} + required={this.config.is_doi_required} record={record} /> diff --git a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/index.js b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/index.js index 2005fa220..3894697d5 100644 --- a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/index.js +++ b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/index.js @@ -29,6 +29,7 @@ ReactDOM.render( allowRecordRestriction={getInputFromDOM("deposits-allow-record-restriction")} groupsEnabled={getInputFromDOM("config-groups-enabled")} allowEmptyFiles={getInputFromDOM("records-resources-allow-empty-files")} + isDoiRequired={getInputFromDOM("deposits-is-doi-required")} /> , document.getElementById("deposit-form") From 20b01c4d3492d63f58349a9fe1db730fde0f444b Mon Sep 17 00:00:00 2001 From: Zacharias Zacharodimos Date: Mon, 16 Dec 2024 09:09:43 +0100 Subject: [PATCH 4/8] release: v13.0.0b1.dev25 --- invenio_app_rdm/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/invenio_app_rdm/__init__.py b/invenio_app_rdm/__init__.py index 30cd19f46..4bdd0ab56 100644 --- a/invenio_app_rdm/__init__.py +++ b/invenio_app_rdm/__init__.py @@ -17,6 +17,6 @@ # # See PEP 0440 for details - https://www.python.org/dev/peps/pep-0440 -__version__ = "13.0.0b1.dev24" +__version__ = "13.0.0b1.dev25" __all__ = ("__version__",) From d2a36d49b213e1d86b074dce8ab4e22c31e3985e Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Thu, 12 Dec 2024 14:50:54 +0100 Subject: [PATCH 5/8] setup: bump major dependencies --- setup.cfg | 72 +++++++++++++++++++++++++++---------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/setup.cfg b/setup.cfg index 01a326d89..d3f905388 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ # # Copyright (C) 2019-2024 CERN. # Copyright (C) 2019-2022 Northwestern University. -# Copyright (C) 2022 Graz University of Technology. +# Copyright (C) 2022-2024 Graz University of Technology. # # Invenio App RDM is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. @@ -28,61 +28,61 @@ python_requires = >=3.7 zip_safe = False install_requires = # Invenio core modules - invenio-app>=1.4.0,<2.0.0 - invenio-base>=1.3.0,<2.0.0 - invenio-cache>=1.3.0,<2.0.0 - invenio-celery>=1.2.4,<2.0.0 + invenio-app>=2.0.0,<3.0.0 + invenio-base>=2.0.0,<3.0.0 + invenio-cache>=2.0.0,<3.0.0 + invenio-celery>=2.0.0,<3.0.0 invenio-config>=1.0.3,<2.0.0 - invenio-i18n>=2.0.0,<3.0.0 - invenio-db[postgresql,mysql]>=1.1.0,<2.0.0 + invenio-i18n>=3.0.0,<4.0.0 + invenio-db[postgresql,mysql]>=2.0.0,<3.0.0 # Invenio base bundle - invenio-assets>=3.1.0,<4.0.0 - invenio-formatter>=2.0.0,<3.0.0 - invenio-logging>=2.0.0,<3.0.0 + invenio-assets>=4.0.0,<5.0.0 + invenio-formatter>=3.0.0,<4.0.0 + invenio-logging>=4.0.0,<5.0.0 invenio-mail>=2.0.0,<3.0.0 - invenio-rest>=1.3.0,<2.0.0 - invenio-theme>=3.0.0,<4.0.0 + invenio-rest>=2.0.0,<3.0.0 + invenio-theme>=4.0.0,<5.0.0 # Invenio auth bundle - invenio-access>=3.0.0,<4.0.0 - invenio-accounts>=5.0.0,<6.0.0 - invenio-oauth2server>=2.0.0,<3.0.0 - invenio-oauthclient>=4.0.0,<5.0.0 - invenio-userprofiles>=3.0.0,<4.0.0 + invenio-access>=4.0.0,<5.0.0 + invenio-accounts>=6.0.0,<7.0.0 + invenio-oauth2server>=3.0.0,<4.0.0 + invenio-oauthclient>=5.0.0,<6.0.0 + invenio-userprofiles>=4.0.0,<5.0.0 # Invenio metadata bundle - invenio-indexer>=2.2.0,<3.0.0 - invenio-jsonschemas>=1.1.4,<2.0.0 - invenio-oaiserver>=2.2.0,<3.0.0 - invenio-pidstore>=1.3.0,<2.0.0 - invenio-records-rest>=2.2.0,<3.0.0 - invenio-records-ui>=1.2.0,<2.0.0 - invenio-records>=2.2.1,<3.0.0 - invenio-search-ui>=3.0.0,<4.0.0 + invenio-indexer>=3.0.0,<4.0.0 + invenio-jsonschemas>=2.0.0,<3.0.0 + invenio-oaiserver>=3.0.0,<4.0.0 + invenio-pidstore>=2.0.0,<3.0.0 + invenio-records-rest>=3.0.0,<4.0.0 + invenio-records-ui>=2.0.0,<3.0.0 + invenio-records>=3.0.0,<4.0.0 + invenio-search-ui>=4.0.0,<5.0.0 # Invenio files bundle - invenio-files-rest>=2.0.0,<3.0.0 - invenio-previewer>=2.2.0,<3.0.0 + invenio-files-rest>=3.0.0,<4.0.0 + invenio-previewer>=3.0.0,<4.0.0 invenio-records-files>=1.2.1,<2.0.0 # Invenio-App-RDM - invenio-communities>=17.0.0,<18.0.0 - invenio-rdm-records>=16.0.0,<17.0.0 + invenio-communities>=18.0.0.dev1,<19.0.0 + invenio-rdm-records>=17.0.0.dev1,<18.0.0 CairoSVG>=2.5.2,<3.0.0 - invenio-banners>=3.0.0,<4.0.0 - invenio-pages>=4.0.0,<5.0.0 + invenio-banners>=4.0.0,<5.0.0 + invenio-pages>=5.0.0,<6.0.0 # Pinned due to before_first_request deprecation https://flask.palletsprojects.com/en/2.2.x/api/#flask.Flask.before_first_request Flask>=2.2.0,<2.3.0 [options.extras_require] tests = pytest-black-ng>=0.4.0 - pytest-invenio>=2.1.0,<3.0.0 + pytest-invenio>=3.0.0,<4.0.0 Sphinx>=4.5.0 elasticsearch7 = - invenio-search[elasticsearch7]>=2.1.0,<3.0.0 + invenio-search[elasticsearch7]>=3.0.0,<4.0.0 opensearch1 = - invenio-search[opensearch1]>=2.1.0,<3.0.0 + invenio-search[opensearch1]>=3.0.0,<4.0.0 opensearch2 = - invenio-search[opensearch2]>=2.1.0,<3.0.0 + invenio-search[opensearch2]>=3.0.0,<4.0.0 s3 = - invenio-s3~=1.0.5 + invenio-s3>=2.0.0,<3.0.0 [options.entry_points] flask.commands = From 19cf5b64f5d21ffc1eb7b673389e5e899e4a9868 Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Thu, 12 Dec 2024 14:51:56 +0100 Subject: [PATCH 6/8] setup: change to reusable workflows --- .github/workflows/pypi-publish.yml | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index a7b027316..8c07a538e 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # # Copyright (C) 2021 CERN. +# Copyright (C) 2024 Graz University of Technology. # # Invenio App RDM is free software; you can redistribute it and/or modify # it under the terms of the MIT License; see LICENSE file for more details. @@ -14,26 +15,7 @@ on: jobs: build-n-publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Set up Python 3.7 - uses: actions/setup-python@v2 - with: - python-version: 3.7 - - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel babel - - - name: Build package - run: | - python setup.py compile_catalog sdist bdist_wheel - - - name: Publish - uses: pypa/gh-action-pypi-publish@v1.3.1 - with: - user: __token__ - password: ${{ secrets.pypi_token }} + uses: inveniosoftware/workflows/.github/workflows/pypi-publish.yml@master + secrets: inherit + with: + babel-compile-catalog: true From 81de3ed6036e677e7b798aa499808aed97d15a54 Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Mon, 16 Dec 2024 07:46:28 +0100 Subject: [PATCH 7/8] setup: remove flask pin --- setup.cfg | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup.cfg b/setup.cfg index d3f905388..7fc6b3e91 100644 --- a/setup.cfg +++ b/setup.cfg @@ -67,8 +67,6 @@ install_requires = CairoSVG>=2.5.2,<3.0.0 invenio-banners>=4.0.0,<5.0.0 invenio-pages>=5.0.0,<6.0.0 - # Pinned due to before_first_request deprecation https://flask.palletsprojects.com/en/2.2.x/api/#flask.Flask.before_first_request - Flask>=2.2.0,<2.3.0 [options.extras_require] tests = From 330a779dd336113936b5d64d5878dbf3e32fb472 Mon Sep 17 00:00:00 2001 From: Christoph Ladurner Date: Mon, 16 Dec 2024 07:48:15 +0100 Subject: [PATCH 8/8] release: v13.0.0b2.dev0 --- CHANGES.rst | 6 ++++++ invenio_app_rdm/__init__.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index f11fc613d..5e3bc16f4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,12 @@ Changes ======= +Version 13.0.0b2.dev0 (released 2024-12-16) + +- setup: remove flask pin +- setup: change to reusable workflows +- setup: bump major dependencies + Version v13.0.0b1.dev24 (released 2024-12-10) - fix: meta: add missing HighWire authors diff --git a/invenio_app_rdm/__init__.py b/invenio_app_rdm/__init__.py index 4bdd0ab56..0ac86f691 100644 --- a/invenio_app_rdm/__init__.py +++ b/invenio_app_rdm/__init__.py @@ -17,6 +17,6 @@ # # See PEP 0440 for details - https://www.python.org/dev/peps/pep-0440 -__version__ = "13.0.0b1.dev25" +__version__ = "13.0.0b2.dev0" __all__ = ("__version__",)