invenio-vocabularies 9.1.2__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- invenio_vocabularies/__init__.py +16 -0
- invenio_vocabularies/administration/__init__.py +10 -0
- invenio_vocabularies/administration/views/__init__.py +10 -0
- invenio_vocabularies/administration/views/vocabularies.py +43 -0
- invenio_vocabularies/alembic/17c703ce1eb7_create_names_table.py +54 -0
- invenio_vocabularies/alembic/3ba812d80559_add_internal_name_id.py +36 -0
- invenio_vocabularies/alembic/4a9a4fd235f8_create_vocabulary_schemes.py +37 -0
- invenio_vocabularies/alembic/4f365fced43f_create_vocabularies_tables.py +92 -0
- invenio_vocabularies/alembic/55a700f897b6_add_names_and_afiliations_pid_column.py +96 -0
- invenio_vocabularies/alembic/6312f33645c1_create_affiliations_table.py +54 -0
- invenio_vocabularies/alembic/676dd587542d_create_funders_vocabulary_table.py +58 -0
- invenio_vocabularies/alembic/8ff82dfb0be8_create_vocabularies_branch.py +28 -0
- invenio_vocabularies/alembic/__init__.py +9 -0
- invenio_vocabularies/alembic/af2457652217_drop_unique_constraint_from_internal_id.py +37 -0
- invenio_vocabularies/alembic/e1146238edd3_create_awards_table.py +56 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/.eslintrc.yml +11 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/.prettierrc +1 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/index.js +7 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/package.json +25 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/AwardResults.js +95 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/CustomAwardForm.js +139 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FunderDropdown.js +87 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingField.js +244 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingField.test.js +1 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingFieldItem.js +152 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingModal.js +246 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/NoAwardResults.js +37 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/index.js +8 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/index.js +7 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/index.js +7 -0
- invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/index.js +7 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/i18next.js +36 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/_generatedTranslations.js +66 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ar/messages.po +96 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ar/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/bg/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/bg/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ca/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ca/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/cs/messages.po +97 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/cs/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/da/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/da/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/de/messages.po +98 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/de/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/el/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/el/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/en/messages.po +88 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/en/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/es/messages.po +96 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/es/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/et/messages.po +95 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/et/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/fa/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/fa/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/fr/messages.po +96 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/fr/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/hr/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/hr/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/hu/messages.po +96 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/hu/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/index.js +24 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/it/messages.po +96 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/it/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ja/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ja/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ka/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ka/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ko/messages.po +90 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ko/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/lt/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/lt/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/no/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/no/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/pl/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/pl/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/pt/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/pt/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ro/messages.po +95 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ro/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ru/messages.po +95 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/ru/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/sk/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/sk/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/sv/messages.po +98 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/sv/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/tr/messages.po +96 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/tr/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/uk/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/uk/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/zh_CN/messages.po +96 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/zh_CN/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/zh_TW/messages.po +94 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/messages/zh_TW/translations.json +28 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/package.json +19 -0
- invenio_vocabularies/assets/semantic-ui/translations/invenio_vocabularies/translations.pot +88 -0
- invenio_vocabularies/cli.py +175 -0
- invenio_vocabularies/config.py +231 -0
- invenio_vocabularies/contrib/__init__.py +9 -0
- invenio_vocabularies/contrib/affiliations/__init__.py +20 -0
- invenio_vocabularies/contrib/affiliations/affiliations.py +61 -0
- invenio_vocabularies/contrib/affiliations/api.py +13 -0
- invenio_vocabularies/contrib/affiliations/config.py +79 -0
- invenio_vocabularies/contrib/affiliations/datastreams.py +301 -0
- invenio_vocabularies/contrib/affiliations/facets.py +36 -0
- invenio_vocabularies/contrib/affiliations/jsonschemas/__init__.py +9 -0
- invenio_vocabularies/contrib/affiliations/jsonschemas/affiliations/affiliation-v1.0.0.json +63 -0
- invenio_vocabularies/contrib/affiliations/mappings/__init__.py +10 -0
- invenio_vocabularies/contrib/affiliations/mappings/os-v1/__init__.py +9 -0
- invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v1.0.0.json +112 -0
- invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v2.0.0.json +171 -0
- invenio_vocabularies/contrib/affiliations/mappings/os-v2/__init__.py +9 -0
- invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v1.0.0.json +112 -0
- invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v2.0.0.json +171 -0
- invenio_vocabularies/contrib/affiliations/mappings/v7/__init__.py +9 -0
- invenio_vocabularies/contrib/affiliations/mappings/v7/affiliations/affiliation-v1.0.0.json +112 -0
- invenio_vocabularies/contrib/affiliations/models.py +13 -0
- invenio_vocabularies/contrib/affiliations/resources.py +16 -0
- invenio_vocabularies/contrib/affiliations/schema.py +71 -0
- invenio_vocabularies/contrib/affiliations/services.py +15 -0
- invenio_vocabularies/contrib/awards/__init__.py +19 -0
- invenio_vocabularies/contrib/awards/api.py +13 -0
- invenio_vocabularies/contrib/awards/awards.py +96 -0
- invenio_vocabularies/contrib/awards/config.py +59 -0
- invenio_vocabularies/contrib/awards/datastreams.py +372 -0
- invenio_vocabularies/contrib/awards/jsonschemas/__init__.py +9 -0
- invenio_vocabularies/contrib/awards/jsonschemas/awards/award-v1.0.0.json +91 -0
- invenio_vocabularies/contrib/awards/mappings/__init__.py +9 -0
- invenio_vocabularies/contrib/awards/mappings/os-v1/__init__.py +9 -0
- invenio_vocabularies/contrib/awards/mappings/os-v1/awards/award-v1.0.0.json +147 -0
- invenio_vocabularies/contrib/awards/mappings/os-v2/__init__.py +9 -0
- invenio_vocabularies/contrib/awards/mappings/os-v2/awards/award-v1.0.0.json +147 -0
- invenio_vocabularies/contrib/awards/mappings/v7/__init__.py +9 -0
- invenio_vocabularies/contrib/awards/mappings/v7/awards/award-v1.0.0.json +147 -0
- invenio_vocabularies/contrib/awards/models.py +13 -0
- invenio_vocabularies/contrib/awards/resources.py +16 -0
- invenio_vocabularies/contrib/awards/schema.py +119 -0
- invenio_vocabularies/contrib/awards/serializer.py +47 -0
- invenio_vocabularies/contrib/awards/services.py +15 -0
- invenio_vocabularies/contrib/common/__init__.py +9 -0
- invenio_vocabularies/contrib/common/openaire/__init__.py +9 -0
- invenio_vocabularies/contrib/common/openaire/datastreams.py +84 -0
- invenio_vocabularies/contrib/common/ror/__init__.py +9 -0
- invenio_vocabularies/contrib/common/ror/datastreams.py +230 -0
- invenio_vocabularies/contrib/funders/__init__.py +19 -0
- invenio_vocabularies/contrib/funders/api.py +13 -0
- invenio_vocabularies/contrib/funders/config.py +78 -0
- invenio_vocabularies/contrib/funders/datastreams.py +97 -0
- invenio_vocabularies/contrib/funders/facets.py +36 -0
- invenio_vocabularies/contrib/funders/funders.py +72 -0
- invenio_vocabularies/contrib/funders/jsonschemas/__init__.py +9 -0
- invenio_vocabularies/contrib/funders/jsonschemas/funders/funder-v1.0.0.json +65 -0
- invenio_vocabularies/contrib/funders/mappings/__init__.py +9 -0
- invenio_vocabularies/contrib/funders/mappings/os-v1/__init__.py +9 -0
- invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v1.0.0.json +90 -0
- invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v2.0.0.json +156 -0
- invenio_vocabularies/contrib/funders/mappings/os-v2/__init__.py +9 -0
- invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v1.0.0.json +90 -0
- invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v2.0.0.json +156 -0
- invenio_vocabularies/contrib/funders/mappings/v7/__init__.py +9 -0
- invenio_vocabularies/contrib/funders/mappings/v7/funders/funder-v1.0.0.json +90 -0
- invenio_vocabularies/contrib/funders/models.py +13 -0
- invenio_vocabularies/contrib/funders/resources.py +16 -0
- invenio_vocabularies/contrib/funders/schema.py +88 -0
- invenio_vocabularies/contrib/funders/serializer.py +33 -0
- invenio_vocabularies/contrib/funders/services.py +15 -0
- invenio_vocabularies/contrib/names/__init__.py +19 -0
- invenio_vocabularies/contrib/names/api.py +13 -0
- invenio_vocabularies/contrib/names/components.py +24 -0
- invenio_vocabularies/contrib/names/config.py +75 -0
- invenio_vocabularies/contrib/names/datastreams.py +483 -0
- invenio_vocabularies/contrib/names/jsonschemas/__init__.py +9 -0
- invenio_vocabularies/contrib/names/jsonschemas/names/name-v1.0.0.json +68 -0
- invenio_vocabularies/contrib/names/mappings/__init__.py +9 -0
- invenio_vocabularies/contrib/names/mappings/os-v1/__init__.py +9 -0
- invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v1.0.0.json +101 -0
- invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v2.0.0.json +165 -0
- invenio_vocabularies/contrib/names/mappings/os-v2/__init__.py +9 -0
- invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v1.0.0.json +101 -0
- invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v2.0.0.json +165 -0
- invenio_vocabularies/contrib/names/mappings/v7/__init__.py +9 -0
- invenio_vocabularies/contrib/names/mappings/v7/names/name-v1.0.0.json +101 -0
- invenio_vocabularies/contrib/names/models.py +13 -0
- invenio_vocabularies/contrib/names/names.py +80 -0
- invenio_vocabularies/contrib/names/permissions.py +30 -0
- invenio_vocabularies/contrib/names/resources.py +54 -0
- invenio_vocabularies/contrib/names/s3client.py +50 -0
- invenio_vocabularies/contrib/names/schema.py +121 -0
- invenio_vocabularies/contrib/names/services.py +64 -0
- invenio_vocabularies/contrib/subjects/__init__.py +22 -0
- invenio_vocabularies/contrib/subjects/api.py +14 -0
- invenio_vocabularies/contrib/subjects/config.py +90 -0
- invenio_vocabularies/contrib/subjects/datastreams.py +63 -0
- invenio_vocabularies/contrib/subjects/euroscivoc/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/euroscivoc/datastreams.py +101 -0
- invenio_vocabularies/contrib/subjects/facets.py +23 -0
- invenio_vocabularies/contrib/subjects/gemet/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/gemet/datastreams.py +140 -0
- invenio_vocabularies/contrib/subjects/jsonschemas/__init__.py +10 -0
- invenio_vocabularies/contrib/subjects/jsonschemas/subjects/subject-v1.0.0.json +69 -0
- invenio_vocabularies/contrib/subjects/mappings/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/mappings/os-v1/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/mappings/os-v1/subjects/subject-v1.0.0.json +96 -0
- invenio_vocabularies/contrib/subjects/mappings/os-v2/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/mappings/os-v2/subjects/subject-v1.0.0.json +96 -0
- invenio_vocabularies/contrib/subjects/mappings/v7/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/mappings/v7/subjects/subject-v1.0.0.json +96 -0
- invenio_vocabularies/contrib/subjects/mesh/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/mesh/datastreams.py +48 -0
- invenio_vocabularies/contrib/subjects/models.py +14 -0
- invenio_vocabularies/contrib/subjects/nvs/__init__.py +9 -0
- invenio_vocabularies/contrib/subjects/nvs/datastreams.py +114 -0
- invenio_vocabularies/contrib/subjects/resources.py +17 -0
- invenio_vocabularies/contrib/subjects/schema.py +101 -0
- invenio_vocabularies/contrib/subjects/services.py +30 -0
- invenio_vocabularies/contrib/subjects/subjects.py +55 -0
- invenio_vocabularies/datastreams/__init__.py +18 -0
- invenio_vocabularies/datastreams/datastreams.py +239 -0
- invenio_vocabularies/datastreams/errors.py +29 -0
- invenio_vocabularies/datastreams/factories.py +86 -0
- invenio_vocabularies/datastreams/readers.py +448 -0
- invenio_vocabularies/datastreams/tasks.py +115 -0
- invenio_vocabularies/datastreams/transformers.py +130 -0
- invenio_vocabularies/datastreams/writers.py +222 -0
- invenio_vocabularies/datastreams/xml.py +34 -0
- invenio_vocabularies/ext.py +179 -0
- invenio_vocabularies/factories.py +193 -0
- invenio_vocabularies/fixtures.py +52 -0
- invenio_vocabularies/jobs.py +207 -0
- invenio_vocabularies/proxies.py +27 -0
- invenio_vocabularies/records/__init__.py +9 -0
- invenio_vocabularies/records/api.py +53 -0
- invenio_vocabularies/records/jsonschemas/__init__.py +9 -0
- invenio_vocabularies/records/jsonschemas/vocabularies/definitions-v1.0.0.json +30 -0
- invenio_vocabularies/records/jsonschemas/vocabularies/vocabulary-v1.0.0.json +55 -0
- invenio_vocabularies/records/mappings/__init__.py +9 -0
- invenio_vocabularies/records/mappings/os-v1/__init__.py +9 -0
- invenio_vocabularies/records/mappings/os-v1/vocabularies/vocabulary-v1.0.0.json +109 -0
- invenio_vocabularies/records/mappings/os-v2/__init__.py +9 -0
- invenio_vocabularies/records/mappings/os-v2/vocabularies/vocabulary-v1.0.0.json +109 -0
- invenio_vocabularies/records/mappings/v7/__init__.py +9 -0
- invenio_vocabularies/records/mappings/v7/vocabularies/vocabulary-v1.0.0.json +109 -0
- invenio_vocabularies/records/models.py +90 -0
- invenio_vocabularies/records/pidprovider.py +118 -0
- invenio_vocabularies/records/systemfields/__init__.py +16 -0
- invenio_vocabularies/records/systemfields/pid.py +125 -0
- invenio_vocabularies/records/systemfields/relations.py +51 -0
- invenio_vocabularies/resources/__init__.py +23 -0
- invenio_vocabularies/resources/config.py +105 -0
- invenio_vocabularies/resources/resource.py +156 -0
- invenio_vocabularies/resources/schema.py +21 -0
- invenio_vocabularies/resources/serializer.py +39 -0
- invenio_vocabularies/services/__init__.py +19 -0
- invenio_vocabularies/services/components.py +58 -0
- invenio_vocabularies/services/config.py +173 -0
- invenio_vocabularies/services/custom_fields/__init__.py +17 -0
- invenio_vocabularies/services/custom_fields/subject.py +82 -0
- invenio_vocabularies/services/custom_fields/vocabulary.py +96 -0
- invenio_vocabularies/services/facets.py +114 -0
- invenio_vocabularies/services/generators.py +38 -0
- invenio_vocabularies/services/permissions.py +30 -0
- invenio_vocabularies/services/querystr.py +57 -0
- invenio_vocabularies/services/results.py +110 -0
- invenio_vocabularies/services/schema.py +163 -0
- invenio_vocabularies/services/service.py +189 -0
- invenio_vocabularies/services/tasks.py +38 -0
- invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/subjects.html +23 -0
- invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/vocabularies-list.html +12 -0
- invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/vocabulary-details.html +71 -0
- invenio_vocabularies/translations/ar/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ar/LC_MESSAGES/messages.po +277 -0
- invenio_vocabularies/translations/bg/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/bg/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/ca/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ca/LC_MESSAGES/messages.po +276 -0
- invenio_vocabularies/translations/cs/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/cs/LC_MESSAGES/messages.po +281 -0
- invenio_vocabularies/translations/da/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/da/LC_MESSAGES/messages.po +271 -0
- invenio_vocabularies/translations/de/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/de/LC_MESSAGES/messages.po +293 -0
- invenio_vocabularies/translations/el/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/el/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/es/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/es/LC_MESSAGES/messages.po +281 -0
- invenio_vocabularies/translations/et/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/et/LC_MESSAGES/messages.po +276 -0
- invenio_vocabularies/translations/fa/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/fa/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/fr/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/fr/LC_MESSAGES/messages.po +279 -0
- invenio_vocabularies/translations/hr/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/hr/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/hu/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/hu/LC_MESSAGES/messages.po +280 -0
- invenio_vocabularies/translations/it/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/it/LC_MESSAGES/messages.po +277 -0
- invenio_vocabularies/translations/ja/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ja/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/ka/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ka/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/ko/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ko/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/lt/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/lt/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/messages.pot +270 -0
- invenio_vocabularies/translations/no/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/no/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/pl/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/pl/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/pt/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/pt/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/ro/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ro/LC_MESSAGES/messages.po +280 -0
- invenio_vocabularies/translations/ru/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/ru/LC_MESSAGES/messages.po +276 -0
- invenio_vocabularies/translations/sk/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/sk/LC_MESSAGES/messages.po +276 -0
- invenio_vocabularies/translations/sv/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/sv/LC_MESSAGES/messages.po +280 -0
- invenio_vocabularies/translations/tr/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/tr/LC_MESSAGES/messages.po +277 -0
- invenio_vocabularies/translations/uk/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/uk/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.po +276 -0
- invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.mo +0 -0
- invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.po +275 -0
- invenio_vocabularies/views.py +53 -0
- invenio_vocabularies/webpack.py +51 -0
- invenio_vocabularies-9.1.2.dist-info/METADATA +517 -0
- invenio_vocabularies-9.1.2.dist-info/RECORD +337 -0
- invenio_vocabularies-9.1.2.dist-info/WHEEL +6 -0
- invenio_vocabularies-9.1.2.dist-info/entry_points.txt +73 -0
- invenio_vocabularies-9.1.2.dist-info/licenses/AUTHORS.rst +13 -0
- invenio_vocabularies-9.1.2.dist-info/licenses/LICENSE +21 -0
- invenio_vocabularies-9.1.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@comment": [
|
|
3
|
+
"This package.json is needed to run the JS tests, locally and CI."
|
|
4
|
+
],
|
|
5
|
+
"scripts": {
|
|
6
|
+
"test": "react-scripts test"
|
|
7
|
+
},
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"@testing-library/jest-dom": "^4.2.0",
|
|
10
|
+
"@testing-library/react": "^9.5.0",
|
|
11
|
+
"@testing-library/user-event": "^7.2.0",
|
|
12
|
+
"axios": "^1.7.7",
|
|
13
|
+
"coveralls": "^3.0.0",
|
|
14
|
+
"enzyme": "^3.10.0",
|
|
15
|
+
"enzyme-adapter-react-16": "^1.15.0",
|
|
16
|
+
"expect": "^26.0.0",
|
|
17
|
+
"lodash": "^4.17.0",
|
|
18
|
+
"luxon": "^1.23.0",
|
|
19
|
+
"react": "^16.13.0",
|
|
20
|
+
"react-dom": "^16.13.0",
|
|
21
|
+
"react-scripts": "^5.0.1",
|
|
22
|
+
"semantic-ui-react": "^2.1.0",
|
|
23
|
+
"react-overridable": "^1.0.0"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// This file is part of InvenioVocabularies
|
|
2
|
+
// Copyright (C) 2021-2023 CERN.
|
|
3
|
+
// Copyright (C) 2021 Northwestern University.
|
|
4
|
+
//
|
|
5
|
+
// Invenio is free software; you can redistribute it and/or modify it
|
|
6
|
+
// under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
import PropTypes from "prop-types";
|
|
10
|
+
import _get from "lodash/get";
|
|
11
|
+
import { Item, Header, Radio, Label, Icon } from "semantic-ui-react";
|
|
12
|
+
import { withState } from "react-searchkit";
|
|
13
|
+
import { FastField } from "formik";
|
|
14
|
+
|
|
15
|
+
export const AwardResults = withState(
|
|
16
|
+
({
|
|
17
|
+
currentResultsState: results,
|
|
18
|
+
deserializeAward,
|
|
19
|
+
deserializeFunder,
|
|
20
|
+
computeFundingContents,
|
|
21
|
+
}) => {
|
|
22
|
+
return (
|
|
23
|
+
<FastField name="selectedFunding">
|
|
24
|
+
{({ form: { values, setFieldValue } }) => {
|
|
25
|
+
return (
|
|
26
|
+
<Item.Group>
|
|
27
|
+
{results.data.hits.map((award) => {
|
|
28
|
+
let funder = award?.funder;
|
|
29
|
+
const deserializedAward = deserializeAward(award);
|
|
30
|
+
const deserializedFunder = deserializeFunder(funder);
|
|
31
|
+
const funding = {
|
|
32
|
+
award: deserializedAward,
|
|
33
|
+
funder: deserializedFunder,
|
|
34
|
+
};
|
|
35
|
+
let { headerContent, descriptionContent, awardOrFunder } =
|
|
36
|
+
computeFundingContents(funding);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Item
|
|
40
|
+
key={deserializedAward.id}
|
|
41
|
+
onClick={() => setFieldValue("selectedFunding", funding)}
|
|
42
|
+
className="license-item"
|
|
43
|
+
>
|
|
44
|
+
<Radio
|
|
45
|
+
checked={
|
|
46
|
+
_get(values, "selectedFunding.award.id") === funding.award.id
|
|
47
|
+
}
|
|
48
|
+
onChange={() => setFieldValue("selectedFunding", funding)}
|
|
49
|
+
/>
|
|
50
|
+
<Item.Content className="license-item-content">
|
|
51
|
+
<Header size="small">
|
|
52
|
+
{headerContent}
|
|
53
|
+
{awardOrFunder === "award"
|
|
54
|
+
? award.number && (
|
|
55
|
+
<Label basic size="mini">
|
|
56
|
+
{award.number}
|
|
57
|
+
</Label>
|
|
58
|
+
)
|
|
59
|
+
: ""}
|
|
60
|
+
{awardOrFunder === "award"
|
|
61
|
+
? award.url && (
|
|
62
|
+
<a
|
|
63
|
+
href={`${award.url}`}
|
|
64
|
+
target="_blank"
|
|
65
|
+
rel="noopener noreferrer"
|
|
66
|
+
>
|
|
67
|
+
<Icon
|
|
68
|
+
link
|
|
69
|
+
name="external alternate"
|
|
70
|
+
className="spaced-left"
|
|
71
|
+
/>
|
|
72
|
+
</a>
|
|
73
|
+
)
|
|
74
|
+
: ""}
|
|
75
|
+
</Header>
|
|
76
|
+
<Item.Description className="license-item-description">
|
|
77
|
+
{descriptionContent}
|
|
78
|
+
</Item.Description>
|
|
79
|
+
</Item.Content>
|
|
80
|
+
</Item>
|
|
81
|
+
);
|
|
82
|
+
})}
|
|
83
|
+
</Item.Group>
|
|
84
|
+
);
|
|
85
|
+
}}
|
|
86
|
+
</FastField>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
AwardResults.propTypes = {
|
|
92
|
+
deserializeAward: PropTypes.func.isRequired,
|
|
93
|
+
deserializeFunder: PropTypes.func.isRequired,
|
|
94
|
+
computeFundingContents: PropTypes.func.isRequired,
|
|
95
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// This file is part of InvenioVocabularies
|
|
2
|
+
// Copyright (C) 2021-2024 CERN.
|
|
3
|
+
// Copyright (C) 2021 Northwestern University.
|
|
4
|
+
//
|
|
5
|
+
// Invenio is free software; you can redistribute it and/or modify it
|
|
6
|
+
// under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
import PropTypes from "prop-types";
|
|
9
|
+
import React from "react";
|
|
10
|
+
import { Form, Header } from "semantic-ui-react";
|
|
11
|
+
import { TextField, RemoteSelectField } from "react-invenio-forms";
|
|
12
|
+
import { i18next } from "@translations/invenio_vocabularies/i18next";
|
|
13
|
+
import _isEmpty from "lodash/isEmpty";
|
|
14
|
+
|
|
15
|
+
import Overridable from "react-overridable";
|
|
16
|
+
|
|
17
|
+
function CustomAwardForm({ deserializeFunder, selectedFunding }) {
|
|
18
|
+
function deserializeFunderToDropdown(funderItem) {
|
|
19
|
+
const funderName = funderItem?.name;
|
|
20
|
+
const funderPID = funderItem?.id;
|
|
21
|
+
const funderCountry = funderItem?.country_name ?? funderItem?.country;
|
|
22
|
+
|
|
23
|
+
if (!funderName && !funderPID) {
|
|
24
|
+
return {};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return {
|
|
28
|
+
text: [funderName, funderCountry, funderPID].filter((val) => val).join(", "),
|
|
29
|
+
value: funderItem.id,
|
|
30
|
+
key: funderItem.id,
|
|
31
|
+
...(funderName && { name: funderName }),
|
|
32
|
+
...(funderPID && { pid: funderPID }),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function serializeFunderFromDropdown(funderDropObject) {
|
|
37
|
+
return {
|
|
38
|
+
id: funderDropObject.key,
|
|
39
|
+
...(funderDropObject.name && { name: funderDropObject.name }),
|
|
40
|
+
...(funderDropObject.pid && { pid: funderDropObject.pid }),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Form>
|
|
46
|
+
<Overridable
|
|
47
|
+
id="InvenioVocabularies.CustomAwardForm.RemoteSelectField.Container"
|
|
48
|
+
fieldPath="selectedFunding.funder.id"
|
|
49
|
+
>
|
|
50
|
+
<RemoteSelectField
|
|
51
|
+
fieldPath="selectedFunding.funder.id"
|
|
52
|
+
suggestionAPIUrl="/api/funders"
|
|
53
|
+
suggestionAPIHeaders={{
|
|
54
|
+
Accept: "application/vnd.inveniordm.v1+json",
|
|
55
|
+
}}
|
|
56
|
+
placeholder={i18next.t("Search for a funder by name")}
|
|
57
|
+
serializeSuggestions={(funders) => {
|
|
58
|
+
return funders.map((funder) =>
|
|
59
|
+
deserializeFunderToDropdown(deserializeFunder(funder))
|
|
60
|
+
);
|
|
61
|
+
}}
|
|
62
|
+
searchInput={{
|
|
63
|
+
autoFocus: _isEmpty(selectedFunding),
|
|
64
|
+
}}
|
|
65
|
+
label={i18next.t("Funder")}
|
|
66
|
+
noQueryMessage={i18next.t("Search for funder...")}
|
|
67
|
+
clearable
|
|
68
|
+
allowAdditions={false}
|
|
69
|
+
multiple={false}
|
|
70
|
+
selectOnBlur={false}
|
|
71
|
+
selectOnNavigation={false}
|
|
72
|
+
required
|
|
73
|
+
search={(options) => options}
|
|
74
|
+
isFocused
|
|
75
|
+
onValueChange={({ formikProps }, selectedFundersArray) => {
|
|
76
|
+
if (selectedFundersArray.length === 1) {
|
|
77
|
+
const selectedFunder = selectedFundersArray[0];
|
|
78
|
+
if (selectedFunder) {
|
|
79
|
+
const deserializedFunder = serializeFunderFromDropdown(selectedFunder);
|
|
80
|
+
formikProps.form.setFieldValue(
|
|
81
|
+
"selectedFunding.funder",
|
|
82
|
+
deserializedFunder
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}}
|
|
87
|
+
/>
|
|
88
|
+
</Overridable>
|
|
89
|
+
<Overridable id="InvenioVocabularies.CustomAwardForm.AwardInformationHeader.Container">
|
|
90
|
+
<Header as="h3" size="small">
|
|
91
|
+
{i18next.t("Additional information")} ({i18next.t("optional")})
|
|
92
|
+
</Header>
|
|
93
|
+
</Overridable>
|
|
94
|
+
<Form.Group widths="equal">
|
|
95
|
+
<Overridable
|
|
96
|
+
id="InvenioVocabularies.CustomAwardForm.AwardNumberTextField.Container"
|
|
97
|
+
fieldPath="selectedFunding.award.number"
|
|
98
|
+
>
|
|
99
|
+
<TextField
|
|
100
|
+
label={i18next.t("Number")}
|
|
101
|
+
placeholder={i18next.t("Award/Grant number")}
|
|
102
|
+
fieldPath="selectedFunding.award.number"
|
|
103
|
+
/>
|
|
104
|
+
</Overridable>
|
|
105
|
+
<Overridable
|
|
106
|
+
id="InvenioVocabularies.CustomAwardForm.AwardTitleTextField.Container"
|
|
107
|
+
fieldPath="selectedFunding.award.title"
|
|
108
|
+
>
|
|
109
|
+
<TextField
|
|
110
|
+
label={i18next.t("Title")}
|
|
111
|
+
placeholder={i18next.t("Award/Grant Title")}
|
|
112
|
+
fieldPath="selectedFunding.award.title"
|
|
113
|
+
/>
|
|
114
|
+
</Overridable>
|
|
115
|
+
<Overridable
|
|
116
|
+
id="InvenioVocabularies.CustomAwardForm.AwardUrlTextField.Container"
|
|
117
|
+
fieldPath="selectedFunding.award.url"
|
|
118
|
+
>
|
|
119
|
+
<TextField
|
|
120
|
+
label={i18next.t("URL")}
|
|
121
|
+
placeholder={i18next.t("Award/Grant URL")}
|
|
122
|
+
fieldPath="selectedFunding.award.url"
|
|
123
|
+
/>
|
|
124
|
+
</Overridable>
|
|
125
|
+
</Form.Group>
|
|
126
|
+
</Form>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
CustomAwardForm.propTypes = {
|
|
131
|
+
deserializeFunder: PropTypes.func.isRequired,
|
|
132
|
+
selectedFunding: PropTypes.object,
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
CustomAwardForm.defaultProps = {
|
|
136
|
+
selectedFunding: undefined,
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export default CustomAwardForm;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// This file is part of InvenioVocabularies
|
|
2
|
+
// Copyright (C) 2021-2023 CERN.
|
|
3
|
+
// Copyright (C) 2021 Northwestern University.
|
|
4
|
+
//
|
|
5
|
+
// Invenio is free software; you can redistribute it and/or modify it
|
|
6
|
+
// under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
import { Dropdown } from "semantic-ui-react";
|
|
11
|
+
import { withState } from "react-searchkit";
|
|
12
|
+
import { i18next } from "@translations/invenio_vocabularies/i18next";
|
|
13
|
+
|
|
14
|
+
export const FunderDropdown = withState(
|
|
15
|
+
({ currentResultsState: awardsList, updateQueryState, currentQueryState }) => {
|
|
16
|
+
const [fundersFromFacets] = useFundersFromFacets(awardsList);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Trigger on funder selection.
|
|
20
|
+
* Updated the query state to filter by the selected funder.
|
|
21
|
+
*
|
|
22
|
+
* @param {*} event
|
|
23
|
+
* @param {*} data
|
|
24
|
+
*/
|
|
25
|
+
function onFunderSelect(event, data) {
|
|
26
|
+
let newFilter = [];
|
|
27
|
+
|
|
28
|
+
if (data && data.value !== "") {
|
|
29
|
+
newFilter = ["funders", data.value];
|
|
30
|
+
}
|
|
31
|
+
updateQueryState({ ...currentQueryState, filters: newFilter, page: 1 });
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Custom hook, triggered when the awards list changes.
|
|
36
|
+
* It retrieves funders from new award's facets.
|
|
37
|
+
*
|
|
38
|
+
* @param {object} awards
|
|
39
|
+
*
|
|
40
|
+
* @returns {object[]} an array of objects, each representing a facetted funder.
|
|
41
|
+
*/
|
|
42
|
+
function useFundersFromFacets(awards) {
|
|
43
|
+
const [result, setResult] = React.useState([]);
|
|
44
|
+
React.useEffect(() => {
|
|
45
|
+
/**
|
|
46
|
+
* Retrieves funders from awards facets and sets the result in state 'result'.
|
|
47
|
+
*/
|
|
48
|
+
function getFundersFromAwardsFacet() {
|
|
49
|
+
if (awards.loading) {
|
|
50
|
+
setResult([]);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const funders = awards.data.aggregations?.funders?.buckets.map((agg) => {
|
|
55
|
+
return {
|
|
56
|
+
key: agg.key,
|
|
57
|
+
value: agg.key,
|
|
58
|
+
text: agg.label,
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
setResult(funders);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
getFundersFromAwardsFacet();
|
|
65
|
+
}, [awards]);
|
|
66
|
+
|
|
67
|
+
return [result];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<Dropdown
|
|
72
|
+
placeholder={i18next.t("Funder")}
|
|
73
|
+
search
|
|
74
|
+
selection
|
|
75
|
+
clearable
|
|
76
|
+
scrolling
|
|
77
|
+
multiple={false}
|
|
78
|
+
options={fundersFromFacets || []}
|
|
79
|
+
allowAdditions={false}
|
|
80
|
+
onChange={onFunderSelect}
|
|
81
|
+
fluid
|
|
82
|
+
selectOnBlur={false}
|
|
83
|
+
selectOnNavigation={false}
|
|
84
|
+
/>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
);
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
// This file is part of InvenioVocabularies
|
|
2
|
+
// Copyright (C) 2021-2025 CERN.
|
|
3
|
+
// Copyright (C) 2021 Northwestern University.
|
|
4
|
+
//
|
|
5
|
+
// Invenio is free software; you can redistribute it and/or modify it
|
|
6
|
+
// under the terms of the MIT License; see LICENSE file for more details.
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
import PropTypes from "prop-types";
|
|
10
|
+
import { FieldArray, getIn } from "formik";
|
|
11
|
+
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
12
|
+
import { DndProvider } from "react-dnd";
|
|
13
|
+
import { Button, Form, Icon, List } from "semantic-ui-react";
|
|
14
|
+
import { FieldLabel, FeedbackLabel } from "react-invenio-forms";
|
|
15
|
+
|
|
16
|
+
import { FundingFieldItem } from "./FundingFieldItem";
|
|
17
|
+
import FundingModal from "./FundingModal";
|
|
18
|
+
|
|
19
|
+
import { i18next } from "@translations/invenio_vocabularies/i18next";
|
|
20
|
+
|
|
21
|
+
import Overridable from "react-overridable";
|
|
22
|
+
|
|
23
|
+
function FundingFieldForm(props) {
|
|
24
|
+
const {
|
|
25
|
+
label,
|
|
26
|
+
labelIcon,
|
|
27
|
+
fieldPath,
|
|
28
|
+
form: { values, errors, initialErrors, initialValues },
|
|
29
|
+
move: formikArrayMove,
|
|
30
|
+
push: formikArrayPush,
|
|
31
|
+
remove: formikArrayRemove,
|
|
32
|
+
replace: formikArrayReplace,
|
|
33
|
+
required,
|
|
34
|
+
deserializeAward: deserializeAwardFunc,
|
|
35
|
+
deserializeFunder: deserializeFunderFunc,
|
|
36
|
+
computeFundingContents: computeFundingContentsFunc,
|
|
37
|
+
searchConfig,
|
|
38
|
+
} = props;
|
|
39
|
+
|
|
40
|
+
const deserializeAward = deserializeAwardFunc
|
|
41
|
+
? deserializeAwardFunc
|
|
42
|
+
: (award) => ({
|
|
43
|
+
title: award?.title_l10n,
|
|
44
|
+
number: award.number,
|
|
45
|
+
funder: award.funder ?? "",
|
|
46
|
+
id: award.id,
|
|
47
|
+
...(award.identifiers && { identifiers: award.identifiers }),
|
|
48
|
+
...(award.acronym && { acronym: award.acronym }),
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const deserializeFunder = deserializeFunderFunc
|
|
52
|
+
? deserializeFunderFunc
|
|
53
|
+
: (funder) => ({
|
|
54
|
+
id: funder.id,
|
|
55
|
+
name: funder.name,
|
|
56
|
+
...(funder.pid && { pid: funder.pid }),
|
|
57
|
+
...(funder.country && { country: funder.country }),
|
|
58
|
+
...(funder.identifiers && { identifiers: funder.identifiers }),
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const computeFundingContents = computeFundingContentsFunc
|
|
62
|
+
? computeFundingContentsFunc
|
|
63
|
+
: (funding) => {
|
|
64
|
+
let headerContent,
|
|
65
|
+
descriptionContent = "";
|
|
66
|
+
let awardOrFunder = "award";
|
|
67
|
+
if (funding.award) {
|
|
68
|
+
headerContent = funding.award.title;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (funding.funder) {
|
|
72
|
+
const funderName =
|
|
73
|
+
funding?.funder?.name ?? funding.funder?.title ?? funding?.funder?.id ?? "";
|
|
74
|
+
descriptionContent = funderName;
|
|
75
|
+
if (!headerContent) {
|
|
76
|
+
awardOrFunder = "funder";
|
|
77
|
+
headerContent = funderName;
|
|
78
|
+
descriptionContent = "";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return { headerContent, descriptionContent, awardOrFunder };
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const fundingList = getIn(values, fieldPath, []);
|
|
86
|
+
const formikInitialValues = getIn(initialValues, fieldPath, []);
|
|
87
|
+
|
|
88
|
+
const error = getIn(errors, fieldPath, null);
|
|
89
|
+
const initialError = getIn(initialErrors, fieldPath, null);
|
|
90
|
+
const fundingError = error || (fundingList === formikInitialValues && initialError);
|
|
91
|
+
|
|
92
|
+
let className = "";
|
|
93
|
+
if (fundingError) {
|
|
94
|
+
className = typeof fundingError !== "string" ? fundingError.severity : "error";
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<DndProvider backend={HTML5Backend}>
|
|
99
|
+
<Form.Field required={required} className={className}>
|
|
100
|
+
<FieldLabel htmlFor={fieldPath} icon={labelIcon} label={label} />
|
|
101
|
+
<List>
|
|
102
|
+
{fundingList.map((value, index) => {
|
|
103
|
+
const key = `${fieldPath}.${index}`;
|
|
104
|
+
// if award does not exist or has no id, it's a custom one
|
|
105
|
+
const awardType = value?.award?.id ? "standard" : "custom";
|
|
106
|
+
return (
|
|
107
|
+
<FundingFieldItem
|
|
108
|
+
key={key}
|
|
109
|
+
{...{
|
|
110
|
+
index,
|
|
111
|
+
compKey: key,
|
|
112
|
+
fundingItem: value,
|
|
113
|
+
awardType,
|
|
114
|
+
moveFunding: formikArrayMove,
|
|
115
|
+
replaceFunding: formikArrayReplace,
|
|
116
|
+
removeFunding: formikArrayRemove,
|
|
117
|
+
searchConfig: searchConfig,
|
|
118
|
+
computeFundingContents: computeFundingContents,
|
|
119
|
+
deserializeAward: deserializeAward,
|
|
120
|
+
deserializeFunder: deserializeFunder,
|
|
121
|
+
}}
|
|
122
|
+
/>
|
|
123
|
+
);
|
|
124
|
+
})}
|
|
125
|
+
</List>
|
|
126
|
+
|
|
127
|
+
<Overridable id="InvenioVocabularies.FundingField.AddAwardFundingModal.Container">
|
|
128
|
+
<FundingModal
|
|
129
|
+
searchConfig={searchConfig}
|
|
130
|
+
trigger={
|
|
131
|
+
<Button
|
|
132
|
+
type="button"
|
|
133
|
+
key="custom"
|
|
134
|
+
icon
|
|
135
|
+
labelPosition="left"
|
|
136
|
+
className={`mb-5 ${className}`}
|
|
137
|
+
>
|
|
138
|
+
<Icon name="add" />
|
|
139
|
+
{i18next.t("Add")}
|
|
140
|
+
</Button>
|
|
141
|
+
}
|
|
142
|
+
onAwardChange={(selectedFunding) => {
|
|
143
|
+
formikArrayPush(selectedFunding);
|
|
144
|
+
}}
|
|
145
|
+
mode="standard"
|
|
146
|
+
action="add"
|
|
147
|
+
deserializeAward={deserializeAward}
|
|
148
|
+
deserializeFunder={deserializeFunder}
|
|
149
|
+
computeFundingContents={computeFundingContents}
|
|
150
|
+
/>
|
|
151
|
+
</Overridable>
|
|
152
|
+
|
|
153
|
+
<Overridable id="InvenioVocabularies.FundingField.AddCustomFundingModal.Container">
|
|
154
|
+
<FundingModal
|
|
155
|
+
searchConfig={searchConfig}
|
|
156
|
+
trigger={
|
|
157
|
+
<Button
|
|
158
|
+
type="button"
|
|
159
|
+
key="custom"
|
|
160
|
+
icon
|
|
161
|
+
labelPosition="left"
|
|
162
|
+
className={className}
|
|
163
|
+
>
|
|
164
|
+
<Icon name="add" />
|
|
165
|
+
{i18next.t("Add custom")}
|
|
166
|
+
</Button>
|
|
167
|
+
}
|
|
168
|
+
onAwardChange={(selectedFunding) => {
|
|
169
|
+
formikArrayPush(selectedFunding);
|
|
170
|
+
}}
|
|
171
|
+
mode="custom"
|
|
172
|
+
action="add"
|
|
173
|
+
deserializeAward={deserializeAward}
|
|
174
|
+
deserializeFunder={deserializeFunder}
|
|
175
|
+
computeFundingContents={computeFundingContents}
|
|
176
|
+
/>
|
|
177
|
+
</Overridable>
|
|
178
|
+
|
|
179
|
+
{fundingError && <FeedbackLabel fieldPath={fieldPath} />}
|
|
180
|
+
</Form.Field>
|
|
181
|
+
</DndProvider>
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
FundingFieldForm.propTypes = {
|
|
186
|
+
label: PropTypes.node,
|
|
187
|
+
labelIcon: PropTypes.node,
|
|
188
|
+
fieldPath: PropTypes.string.isRequired,
|
|
189
|
+
form: PropTypes.object,
|
|
190
|
+
move: PropTypes.func,
|
|
191
|
+
push: PropTypes.func,
|
|
192
|
+
remove: PropTypes.func,
|
|
193
|
+
replace: PropTypes.func,
|
|
194
|
+
required: PropTypes.bool,
|
|
195
|
+
deserializeAward: PropTypes.func,
|
|
196
|
+
deserializeFunder: PropTypes.func,
|
|
197
|
+
computeFundingContents: PropTypes.func,
|
|
198
|
+
searchConfig: PropTypes.object,
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
FundingFieldForm.defaultProps = {
|
|
202
|
+
label: undefined,
|
|
203
|
+
labelIcon: undefined,
|
|
204
|
+
form: undefined,
|
|
205
|
+
move: undefined,
|
|
206
|
+
push: undefined,
|
|
207
|
+
remove: undefined,
|
|
208
|
+
replace: undefined,
|
|
209
|
+
required: undefined,
|
|
210
|
+
deserializeAward: undefined,
|
|
211
|
+
deserializeFunder: undefined,
|
|
212
|
+
computeFundingContents: undefined,
|
|
213
|
+
searchConfig: undefined,
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export function FundingField(props) {
|
|
217
|
+
const { fieldPath } = props;
|
|
218
|
+
return (
|
|
219
|
+
<FieldArray
|
|
220
|
+
name={fieldPath}
|
|
221
|
+
component={(formikProps) => <FundingFieldForm {...formikProps} {...props} />}
|
|
222
|
+
/>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
FundingField.propTypes = {
|
|
227
|
+
fieldPath: PropTypes.string.isRequired,
|
|
228
|
+
label: PropTypes.string,
|
|
229
|
+
labelIcon: PropTypes.string,
|
|
230
|
+
searchConfig: PropTypes.object.isRequired,
|
|
231
|
+
required: PropTypes.bool,
|
|
232
|
+
deserializeAward: PropTypes.func,
|
|
233
|
+
deserializeFunder: PropTypes.func,
|
|
234
|
+
computeFundingContents: PropTypes.func,
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
FundingField.defaultProps = {
|
|
238
|
+
label: "Awards",
|
|
239
|
+
labelIcon: "money bill alternate outline",
|
|
240
|
+
required: false,
|
|
241
|
+
deserializeAward: undefined,
|
|
242
|
+
deserializeFunder: undefined,
|
|
243
|
+
computeFundingContents: undefined,
|
|
244
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
it("can contain tests", () => {});
|