invenio-vocabularies 2.3.1__py2.py3-none-any.whl → 6.3.1__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.

Potentially problematic release.


This version of invenio-vocabularies might be problematic. Click here for more details.

Files changed (165) hide show
  1. invenio_vocabularies/__init__.py +2 -2
  2. invenio_vocabularies/administration/__init__.py +10 -0
  3. invenio_vocabularies/administration/views/__init__.py +10 -0
  4. invenio_vocabularies/administration/views/vocabularies.py +45 -0
  5. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/package.json +1 -7
  6. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/CustomAwardForm.js +80 -64
  7. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingField.js +49 -41
  8. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/FundingModal.js +5 -7
  9. invenio_vocabularies/assets/semantic-ui/js/invenio_vocabularies/src/contrib/forms/Funding/NoAwardResults.js +3 -3
  10. invenio_vocabularies/cli.py +31 -44
  11. invenio_vocabularies/config.py +68 -4
  12. invenio_vocabularies/contrib/affiliations/affiliations.py +11 -0
  13. invenio_vocabularies/contrib/affiliations/api.py +1 -2
  14. invenio_vocabularies/contrib/affiliations/config.py +13 -2
  15. invenio_vocabularies/contrib/affiliations/datastreams.py +186 -0
  16. invenio_vocabularies/contrib/affiliations/jsonschemas/affiliations/affiliation-v1.0.0.json +38 -1
  17. invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v1.0.0.json +22 -1
  18. invenio_vocabularies/contrib/affiliations/mappings/os-v1/affiliations/affiliation-v2.0.0.json +171 -0
  19. invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v1.0.0.json +22 -1
  20. invenio_vocabularies/contrib/affiliations/mappings/os-v2/affiliations/affiliation-v2.0.0.json +171 -0
  21. invenio_vocabularies/contrib/affiliations/mappings/v7/affiliations/affiliation-v1.0.0.json +22 -1
  22. invenio_vocabularies/contrib/affiliations/schema.py +17 -3
  23. invenio_vocabularies/contrib/affiliations/services.py +1 -2
  24. invenio_vocabularies/contrib/awards/awards.py +17 -5
  25. invenio_vocabularies/contrib/awards/datastreams.py +241 -7
  26. invenio_vocabularies/contrib/awards/jsonschemas/awards/award-v1.0.0.json +38 -0
  27. invenio_vocabularies/contrib/awards/mappings/os-v1/awards/award-v1.0.0.json +51 -2
  28. invenio_vocabularies/contrib/awards/mappings/os-v2/awards/award-v1.0.0.json +51 -2
  29. invenio_vocabularies/contrib/awards/mappings/v7/awards/award-v1.0.0.json +51 -2
  30. invenio_vocabularies/contrib/awards/schema.py +16 -1
  31. invenio_vocabularies/contrib/awards/serializer.py +8 -1
  32. invenio_vocabularies/contrib/awards/services.py +1 -2
  33. invenio_vocabularies/contrib/common/__init__.py +9 -0
  34. invenio_vocabularies/contrib/common/openaire/__init__.py +9 -0
  35. invenio_vocabularies/contrib/common/openaire/datastreams.py +84 -0
  36. invenio_vocabularies/contrib/common/ror/__init__.py +9 -0
  37. invenio_vocabularies/contrib/common/ror/datastreams.py +220 -0
  38. invenio_vocabularies/contrib/funders/config.py +11 -2
  39. invenio_vocabularies/contrib/funders/datastreams.py +40 -62
  40. invenio_vocabularies/contrib/funders/funders.py +3 -1
  41. invenio_vocabularies/contrib/funders/jsonschemas/funders/funder-v1.0.0.json +36 -1
  42. invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v1.0.0.json +22 -1
  43. invenio_vocabularies/contrib/funders/mappings/os-v1/funders/funder-v2.0.0.json +156 -0
  44. invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v1.0.0.json +22 -1
  45. invenio_vocabularies/contrib/funders/mappings/os-v2/funders/funder-v2.0.0.json +156 -0
  46. invenio_vocabularies/contrib/funders/mappings/v7/funders/funder-v1.0.0.json +22 -1
  47. invenio_vocabularies/contrib/funders/schema.py +8 -0
  48. invenio_vocabularies/contrib/funders/serializer.py +2 -1
  49. invenio_vocabularies/contrib/names/config.py +5 -3
  50. invenio_vocabularies/contrib/names/datastreams.py +172 -4
  51. invenio_vocabularies/contrib/names/jsonschemas/names/name-v1.0.0.json +3 -0
  52. invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v1.0.0.json +3 -0
  53. invenio_vocabularies/contrib/names/mappings/os-v1/names/name-v2.0.0.json +150 -0
  54. invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v1.0.0.json +3 -0
  55. invenio_vocabularies/contrib/names/mappings/os-v2/names/name-v2.0.0.json +150 -0
  56. invenio_vocabularies/contrib/names/mappings/v7/names/name-v1.0.0.json +3 -0
  57. invenio_vocabularies/contrib/names/names.py +15 -3
  58. invenio_vocabularies/contrib/names/permissions.py +20 -0
  59. invenio_vocabularies/contrib/names/s3client.py +44 -0
  60. invenio_vocabularies/contrib/names/schema.py +14 -0
  61. invenio_vocabularies/contrib/subjects/config.py +9 -3
  62. invenio_vocabularies/contrib/subjects/datastreams.py +61 -0
  63. invenio_vocabularies/contrib/subjects/euroscivoc/__init__.py +9 -0
  64. invenio_vocabularies/contrib/subjects/euroscivoc/datastreams.py +171 -0
  65. invenio_vocabularies/contrib/subjects/jsonschemas/subjects/subject-v1.0.0.json +31 -0
  66. invenio_vocabularies/contrib/subjects/mappings/os-v1/subjects/subject-v1.0.0.json +35 -0
  67. invenio_vocabularies/contrib/subjects/mappings/os-v2/subjects/subject-v1.0.0.json +35 -0
  68. invenio_vocabularies/contrib/subjects/mappings/v7/subjects/subject-v1.0.0.json +35 -0
  69. invenio_vocabularies/contrib/subjects/mesh/__init__.py +9 -0
  70. invenio_vocabularies/contrib/subjects/mesh/datastreams.py +43 -0
  71. invenio_vocabularies/contrib/subjects/schema.py +47 -5
  72. invenio_vocabularies/contrib/subjects/subjects.py +10 -0
  73. invenio_vocabularies/datastreams/datastreams.py +61 -13
  74. invenio_vocabularies/datastreams/factories.py +1 -2
  75. invenio_vocabularies/datastreams/readers.py +138 -29
  76. invenio_vocabularies/datastreams/tasks.py +37 -0
  77. invenio_vocabularies/datastreams/transformers.py +17 -27
  78. invenio_vocabularies/datastreams/writers.py +116 -14
  79. invenio_vocabularies/datastreams/xml.py +34 -0
  80. invenio_vocabularies/ext.py +59 -5
  81. invenio_vocabularies/factories.py +137 -0
  82. invenio_vocabularies/jobs.py +133 -0
  83. invenio_vocabularies/proxies.py +2 -2
  84. invenio_vocabularies/records/jsonschemas/vocabularies/definitions-v1.0.0.json +7 -0
  85. invenio_vocabularies/records/jsonschemas/vocabularies/vocabulary-v1.0.0.json +1 -4
  86. invenio_vocabularies/records/mappings/os-v1/vocabularies/vocabulary-v1.0.0.json +3 -3
  87. invenio_vocabularies/records/mappings/os-v2/vocabularies/vocabulary-v1.0.0.json +3 -3
  88. invenio_vocabularies/records/mappings/v7/vocabularies/vocabulary-v1.0.0.json +3 -3
  89. invenio_vocabularies/records/models.py +2 -4
  90. invenio_vocabularies/records/pidprovider.py +1 -2
  91. invenio_vocabularies/records/systemfields/relations.py +2 -2
  92. invenio_vocabularies/resources/__init__.py +9 -1
  93. invenio_vocabularies/resources/config.py +105 -0
  94. invenio_vocabularies/resources/resource.py +31 -41
  95. invenio_vocabularies/resources/schema.py +2 -1
  96. invenio_vocabularies/services/__init__.py +5 -2
  97. invenio_vocabularies/services/config.py +179 -0
  98. invenio_vocabularies/services/custom_fields/__init__.py +6 -2
  99. invenio_vocabularies/services/custom_fields/subject.py +82 -0
  100. invenio_vocabularies/services/custom_fields/vocabulary.py +5 -3
  101. invenio_vocabularies/services/permissions.py +3 -1
  102. invenio_vocabularies/services/results.py +110 -0
  103. invenio_vocabularies/services/schema.py +11 -2
  104. invenio_vocabularies/services/service.py +46 -94
  105. invenio_vocabularies/services/tasks.py +1 -1
  106. invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/subjects.html +23 -0
  107. invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/vocabularies-list.html +12 -0
  108. invenio_vocabularies/templates/semantic-ui/invenio_vocabularies/vocabulary-details.html +71 -0
  109. invenio_vocabularies/translations/af/LC_MESSAGES/messages.mo +0 -0
  110. invenio_vocabularies/translations/ar/LC_MESSAGES/messages.mo +0 -0
  111. invenio_vocabularies/translations/bg/LC_MESSAGES/messages.mo +0 -0
  112. invenio_vocabularies/translations/ca/LC_MESSAGES/messages.mo +0 -0
  113. invenio_vocabularies/translations/cs/LC_MESSAGES/messages.mo +0 -0
  114. invenio_vocabularies/translations/da/LC_MESSAGES/messages.mo +0 -0
  115. invenio_vocabularies/translations/de/LC_MESSAGES/messages.mo +0 -0
  116. invenio_vocabularies/translations/de_AT/LC_MESSAGES/messages.mo +0 -0
  117. invenio_vocabularies/translations/de_DE/LC_MESSAGES/messages.mo +0 -0
  118. invenio_vocabularies/translations/el/LC_MESSAGES/messages.mo +0 -0
  119. invenio_vocabularies/translations/en/LC_MESSAGES/messages.mo +0 -0
  120. invenio_vocabularies/translations/en_AT/LC_MESSAGES/messages.mo +0 -0
  121. invenio_vocabularies/translations/en_HU/LC_MESSAGES/messages.mo +0 -0
  122. invenio_vocabularies/translations/es/LC_MESSAGES/messages.mo +0 -0
  123. invenio_vocabularies/translations/es_CU/LC_MESSAGES/messages.mo +0 -0
  124. invenio_vocabularies/translations/es_MX/LC_MESSAGES/messages.mo +0 -0
  125. invenio_vocabularies/translations/et/LC_MESSAGES/messages.mo +0 -0
  126. invenio_vocabularies/translations/et_EE/LC_MESSAGES/messages.mo +0 -0
  127. invenio_vocabularies/translations/fa/LC_MESSAGES/messages.mo +0 -0
  128. invenio_vocabularies/translations/fa_IR/LC_MESSAGES/messages.mo +0 -0
  129. invenio_vocabularies/translations/fr/LC_MESSAGES/messages.mo +0 -0
  130. invenio_vocabularies/translations/fr_CI/LC_MESSAGES/messages.mo +0 -0
  131. invenio_vocabularies/translations/fr_FR/LC_MESSAGES/messages.mo +0 -0
  132. invenio_vocabularies/translations/gl/LC_MESSAGES/messages.mo +0 -0
  133. invenio_vocabularies/translations/hi_IN/LC_MESSAGES/messages.mo +0 -0
  134. invenio_vocabularies/translations/hr/LC_MESSAGES/messages.mo +0 -0
  135. invenio_vocabularies/translations/hu/LC_MESSAGES/messages.mo +0 -0
  136. invenio_vocabularies/translations/hu_HU/LC_MESSAGES/messages.mo +0 -0
  137. invenio_vocabularies/translations/it/LC_MESSAGES/messages.mo +0 -0
  138. invenio_vocabularies/translations/ja/LC_MESSAGES/messages.mo +0 -0
  139. invenio_vocabularies/translations/ka/LC_MESSAGES/messages.mo +0 -0
  140. invenio_vocabularies/translations/lt/LC_MESSAGES/messages.mo +0 -0
  141. invenio_vocabularies/translations/messages.pot +95 -48
  142. invenio_vocabularies/translations/ne/LC_MESSAGES/messages.mo +0 -0
  143. invenio_vocabularies/translations/no/LC_MESSAGES/messages.mo +0 -0
  144. invenio_vocabularies/translations/pl/LC_MESSAGES/messages.mo +0 -0
  145. invenio_vocabularies/translations/pt/LC_MESSAGES/messages.mo +0 -0
  146. invenio_vocabularies/translations/ro/LC_MESSAGES/messages.mo +0 -0
  147. invenio_vocabularies/translations/ru/LC_MESSAGES/messages.mo +0 -0
  148. invenio_vocabularies/translations/rw/LC_MESSAGES/messages.mo +0 -0
  149. invenio_vocabularies/translations/sk/LC_MESSAGES/messages.mo +0 -0
  150. invenio_vocabularies/translations/sv/LC_MESSAGES/messages.mo +0 -0
  151. invenio_vocabularies/translations/sv_SE/LC_MESSAGES/messages.mo +0 -0
  152. invenio_vocabularies/translations/tr/LC_MESSAGES/messages.mo +0 -0
  153. invenio_vocabularies/translations/uk/LC_MESSAGES/messages.mo +0 -0
  154. invenio_vocabularies/translations/uk_UA/LC_MESSAGES/messages.mo +0 -0
  155. invenio_vocabularies/translations/zh_CN/LC_MESSAGES/messages.mo +0 -0
  156. invenio_vocabularies/translations/zh_TW/LC_MESSAGES/messages.mo +0 -0
  157. invenio_vocabularies/views.py +12 -26
  158. invenio_vocabularies/webpack.py +3 -3
  159. {invenio_vocabularies-2.3.1.dist-info → invenio_vocabularies-6.3.1.dist-info}/METADATA +150 -6
  160. {invenio_vocabularies-2.3.1.dist-info → invenio_vocabularies-6.3.1.dist-info}/RECORD +165 -132
  161. {invenio_vocabularies-2.3.1.dist-info → invenio_vocabularies-6.3.1.dist-info}/WHEEL +1 -1
  162. {invenio_vocabularies-2.3.1.dist-info → invenio_vocabularies-6.3.1.dist-info}/entry_points.txt +17 -0
  163. {invenio_vocabularies-2.3.1.dist-info → invenio_vocabularies-6.3.1.dist-info}/AUTHORS.rst +0 -0
  164. {invenio_vocabularies-2.3.1.dist-info → invenio_vocabularies-6.3.1.dist-info}/LICENSE +0 -0
  165. {invenio_vocabularies-2.3.1.dist-info → invenio_vocabularies-6.3.1.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2020-2023 CERN.
3
+ # Copyright (C) 2020-2024 CERN.
4
4
  #
5
5
  # Invenio-Vocabularies is free software; you can redistribute it and/or
6
6
  # modify it under the terms of the MIT License; see LICENSE file for more
@@ -10,6 +10,6 @@
10
10
 
11
11
  from .ext import InvenioVocabularies
12
12
 
13
- __version__ = "2.3.1"
13
+ __version__ = "6.3.1"
14
14
 
15
15
  __all__ = ("__version__", "InvenioVocabularies")
@@ -0,0 +1,10 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2024 CERN.
4
+ # Copyright (C) 2024 Uni Münster.
5
+ #
6
+ # Invenio-Vocabularies is free software; you can redistribute it and/or
7
+ # modify it under the terms of the MIT License; see LICENSE file for more
8
+ # details.
9
+
10
+ """Invenio administration views module for vocabularies."""
@@ -0,0 +1,10 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2020-2024 CERN.
4
+ # Copyright (C) 2024 Uni Münster.
5
+ #
6
+ # Invenio-Vocabularies is free software; you can redistribute it and/or
7
+ # modify it under the terms of the MIT License; see LICENSE file for more
8
+ # details.
9
+
10
+ """Invenio administration views module for Vocabularies."""
@@ -0,0 +1,45 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2020-2024 CERN.
4
+ # Copyright (C) 2024 Uni Münster.
5
+ #
6
+ # Invenio-Vocabularies is free software; you can redistribute it and/or
7
+ # modify it under the terms of the MIT License; see LICENSE file for more
8
+ # details.
9
+
10
+ """Vocabularies admin interface."""
11
+
12
+ from invenio_administration.views.base import (
13
+ AdminResourceEditView,
14
+ AdminResourceListView,
15
+ )
16
+
17
+
18
+ class VocabulariesListView(AdminResourceListView):
19
+ """Configuration for vocabularies list view."""
20
+
21
+ api_endpoint = "/vocabularies/"
22
+ name = "vocabulary-types"
23
+ menu_label = "Vocabulary Types"
24
+ resource_config = "vocabulary_admin_resource"
25
+ search_request_headers = {"Accept": "application/json"}
26
+ title = "Vocabulary Types"
27
+ category = "Site management"
28
+
29
+ pid_path = "id"
30
+ icon = "exchange"
31
+ template = "invenio_administration/search.html"
32
+
33
+ display_search = True
34
+ display_delete = False
35
+ display_edit = False
36
+ display_create = False
37
+
38
+ item_field_list = {
39
+ "id": {"text": "Name", "order": 1},
40
+ "count": {"text": "Number of entries", "order": 2},
41
+ }
42
+
43
+ search_config_name = "VOCABULARIES_TYPES_SEARCH"
44
+ search_facets_config_name = "VOCABULARIES_TYPES_FACETS"
45
+ search_sort_config_name = "VOCABULARIES_TYPES_SORT_OPTIONS"
@@ -9,11 +9,10 @@
9
9
  "@testing-library/jest-dom": "^4.2.0",
10
10
  "@testing-library/react": "^9.5.0",
11
11
  "@testing-library/user-event": "^7.2.0",
12
- "axios": "^0.21.0",
12
+ "axios": "^1.7.7",
13
13
  "coveralls": "^3.0.0",
14
14
  "enzyme": "^3.10.0",
15
15
  "enzyme-adapter-react-16": "^1.15.0",
16
- "enzyme-to-json": "^3.4.0",
17
16
  "expect": "^26.0.0",
18
17
  "lodash": "^4.17.0",
19
18
  "luxon": "^1.23.0",
@@ -22,10 +21,5 @@
22
21
  "react-scripts": "^5.0.1",
23
22
  "semantic-ui-react": "^2.1.0",
24
23
  "react-overridable": "^0.0.3"
25
- },
26
- "jest": {
27
- "snapshotSerializers": [
28
- "enzyme-to-json/serializer"
29
- ]
30
24
  }
31
25
  }
@@ -1,5 +1,5 @@
1
1
  // This file is part of InvenioVocabularies
2
- // Copyright (C) 2021-2023 CERN.
2
+ // Copyright (C) 2021-2024 CERN.
3
3
  // Copyright (C) 2021 Northwestern University.
4
4
  //
5
5
  // Invenio is free software; you can redistribute it and/or modify it
@@ -12,25 +12,20 @@ import { TextField, RemoteSelectField } from "react-invenio-forms";
12
12
  import { i18next } from "@translations/invenio_rdm_records/i18next";
13
13
  import _isEmpty from "lodash/isEmpty";
14
14
 
15
+ import Overridable from "react-overridable";
16
+
15
17
  function CustomAwardForm({ deserializeFunder, selectedFunding }) {
16
18
  function deserializeFunderToDropdown(funderItem) {
17
- let funderName = null;
18
- let funderPID = null;
19
-
20
- if (funderItem.name) {
21
- funderName = funderItem.name;
22
- }
23
-
24
- if (funderItem.pid) {
25
- funderPID = funderItem.pid;
26
- }
19
+ const funderName = funderItem?.name;
20
+ const funderPID = funderItem?.id;
21
+ const funderCountry = funderItem?.country_name ?? funderItem?.country;
27
22
 
28
23
  if (!funderName && !funderPID) {
29
24
  return {};
30
25
  }
31
26
 
32
27
  return {
33
- text: funderName || funderPID,
28
+ text: [funderName, funderCountry, funderPID].filter((val) => val).join(", "),
34
29
  value: funderItem.id,
35
30
  key: funderItem.id,
36
31
  ...(funderName && { name: funderName }),
@@ -48,64 +43,85 @@ function CustomAwardForm({ deserializeFunder, selectedFunding }) {
48
43
 
49
44
  return (
50
45
  <Form>
51
- <RemoteSelectField
46
+ <Overridable
47
+ id="InvenioVocabularies.CustomAwardForm.RemoteSelectField.Container"
52
48
  fieldPath="selectedFunding.funder.id"
53
- suggestionAPIUrl="/api/funders"
54
- suggestionAPIHeaders={{
55
- Accept: "application/vnd.inveniordm.v1+json",
56
- }}
57
- placeholder={i18next.t("Search for a funder by name")}
58
- serializeSuggestions={(funders) => {
59
- return funders.map((funder) =>
60
- deserializeFunderToDropdown(deserializeFunder(funder))
61
- );
62
- }}
63
- searchInput={{
64
- autoFocus: _isEmpty(selectedFunding),
65
- }}
66
- label={i18next.t("Funder")}
67
- noQueryMessage={i18next.t("Search for funder...")}
68
- clearable
69
- allowAdditions={false}
70
- multiple={false}
71
- selectOnBlur={false}
72
- selectOnNavigation={false}
73
- required
74
- search={(options) => options}
75
- isFocused
76
- onValueChange={({ formikProps }, selectedFundersArray) => {
77
- if (selectedFundersArray.length === 1) {
78
- const selectedFunder = selectedFundersArray[0];
79
- if (selectedFunder) {
80
- const deserializedFunder = serializeFunderFromDropdown(selectedFunder);
81
- formikProps.form.setFieldValue(
82
- "selectedFunding.funder",
83
- deserializedFunder
84
- );
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
85
  }
86
- }
87
- }}
88
- />
89
-
90
- <Header as="h3" size="small">
91
- {i18next.t("Award information")} ({i18next.t("optional")})
92
- </Header>
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>
93
94
  <Form.Group widths="equal">
94
- <TextField
95
- label={i18next.t("Number")}
96
- placeholder={i18next.t("Award number")}
95
+ <Overridable
96
+ id="InvenioVocabularies.CustomAwardForm.AwardNumberTextField.Container"
97
97
  fieldPath="selectedFunding.award.number"
98
- />
99
- <TextField
100
- label={i18next.t("Title")}
101
- placeholder={i18next.t("Award Title")}
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"
102
107
  fieldPath="selectedFunding.award.title"
103
- />
104
- <TextField
105
- label={i18next.t("URL")}
106
- placeholder={i18next.t("Award URL")}
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"
107
117
  fieldPath="selectedFunding.award.url"
108
- />
118
+ >
119
+ <TextField
120
+ label={i18next.t("URL")}
121
+ placeholder={i18next.t("Award/Grant URL")}
122
+ fieldPath="selectedFunding.award.url"
123
+ />
124
+ </Overridable>
109
125
  </Form.Group>
110
126
  </Form>
111
127
  );
@@ -1,5 +1,5 @@
1
1
  // This file is part of InvenioVocabularies
2
- // Copyright (C) 2021-2023 CERN.
2
+ // Copyright (C) 2021-2024 CERN.
3
3
  // Copyright (C) 2021 Northwestern University.
4
4
  //
5
5
  // Invenio is free software; you can redistribute it and/or modify it
@@ -18,6 +18,8 @@ import FundingModal from "./FundingModal";
18
18
 
19
19
  import { i18next } from "@translations/invenio_rdm_records/i18next";
20
20
 
21
+ import Overridable from "react-overridable";
22
+
21
23
  function FundingFieldForm(props) {
22
24
  const {
23
25
  label,
@@ -108,46 +110,52 @@ function FundingFieldForm(props) {
108
110
  );
109
111
  })}
110
112
  </List>
111
- <FundingModal
112
- searchConfig={searchConfig}
113
- trigger={
114
- <Button
115
- type="button"
116
- key="custom"
117
- icon
118
- labelPosition="left"
119
- className="mb-5"
120
- >
121
- <Icon name="add" />
122
- {i18next.t("Add award")}
123
- </Button>
124
- }
125
- onAwardChange={(selectedFunding) => {
126
- formikArrayPush(selectedFunding);
127
- }}
128
- mode="standard"
129
- action="add"
130
- deserializeAward={deserializeAward}
131
- deserializeFunder={deserializeFunder}
132
- computeFundingContents={computeFundingContents}
133
- />
134
- <FundingModal
135
- searchConfig={searchConfig}
136
- trigger={
137
- <Button type="button" key="custom" icon labelPosition="left">
138
- <Icon name="add" />
139
- {i18next.t("Add custom")}
140
- </Button>
141
- }
142
- onAwardChange={(selectedFunding) => {
143
- formikArrayPush(selectedFunding);
144
- }}
145
- mode="custom"
146
- action="add"
147
- deserializeAward={deserializeAward}
148
- deserializeFunder={deserializeFunder}
149
- computeFundingContents={computeFundingContents}
150
- />
113
+
114
+ <Overridable id="InvenioVocabularies.FundingField.AddAwardFundingModal.Container">
115
+ <FundingModal
116
+ searchConfig={searchConfig}
117
+ trigger={
118
+ <Button
119
+ type="button"
120
+ key="custom"
121
+ icon
122
+ labelPosition="left"
123
+ className="mb-5"
124
+ >
125
+ <Icon name="add" />
126
+ {i18next.t("Add")}
127
+ </Button>
128
+ }
129
+ onAwardChange={(selectedFunding) => {
130
+ formikArrayPush(selectedFunding);
131
+ }}
132
+ mode="standard"
133
+ action="add"
134
+ deserializeAward={deserializeAward}
135
+ deserializeFunder={deserializeFunder}
136
+ computeFundingContents={computeFundingContents}
137
+ />
138
+ </Overridable>
139
+
140
+ <Overridable id="InvenioVocabularies.FundingField.AddCustomFundingModal.Container">
141
+ <FundingModal
142
+ searchConfig={searchConfig}
143
+ trigger={
144
+ <Button type="button" key="custom" icon labelPosition="left">
145
+ <Icon name="add" />
146
+ {i18next.t("Add custom")}
147
+ </Button>
148
+ }
149
+ onAwardChange={(selectedFunding) => {
150
+ formikArrayPush(selectedFunding);
151
+ }}
152
+ mode="custom"
153
+ action="add"
154
+ deserializeAward={deserializeAward}
155
+ deserializeFunder={deserializeFunder}
156
+ computeFundingContents={computeFundingContents}
157
+ />
158
+ </Overridable>
151
159
  </Form.Field>
152
160
  </DndProvider>
153
161
  );
@@ -1,5 +1,5 @@
1
1
  // This file is part of InvenioVocabularies
2
- // Copyright (C) 2021-2023 CERN.
2
+ // Copyright (C) 2021-2024 CERN.
3
3
  // Copyright (C) 2021 Northwestern University.
4
4
  //
5
5
  // Invenio is free software; you can redistribute it and/or modify it
@@ -157,8 +157,8 @@ function FundingModal({
157
157
  >
158
158
  <Modal.Header as="h2" className="pt-10 pb-10">
159
159
  {mode === "standard"
160
- ? i18next.t("Add standard award")
161
- : i18next.t("Add custom award")}
160
+ ? i18next.t("Add standard award/grant")
161
+ : i18next.t("Add custom funding")}
162
162
  </Modal.Header>
163
163
  <Modal.Content>
164
164
  {mode === ModalTypes.STANDARD && (
@@ -172,7 +172,7 @@ function FundingModal({
172
172
  <Grid.Row>
173
173
  <Grid.Column width={11} floated="left" verticalAlign="middle">
174
174
  <SearchBar
175
- placeholder={i18next.t("Search for awards")}
175
+ placeholder={i18next.t("Search for awards/grants")}
176
176
  autofocus
177
177
  actionProps={{
178
178
  icon: "search",
@@ -234,9 +234,7 @@ function FundingModal({
234
234
  primary
235
235
  icon="checkmark"
236
236
  content={
237
- action === ModalActions.ADD
238
- ? i18next.t("Add award")
239
- : i18next.t("Change award")
237
+ action === ModalActions.ADD ? i18next.t("Add") : i18next.t("Change")
240
238
  }
241
239
  />
242
240
  </Modal.Actions>
@@ -1,5 +1,5 @@
1
1
  // This file is part of InvenioVocabularies
2
- // Copyright (C) 2021-2023 CERN.
2
+ // Copyright (C) 2021-2024 CERN.
3
3
  // Copyright (C) 2021 Northwestern University.
4
4
  //
5
5
  // Invenio is free software; you can redistribute it and/or modify it
@@ -16,7 +16,7 @@ export function NoAwardResults({ switchToCustom }) {
16
16
  basic
17
17
  content={
18
18
  <p>
19
- {i18next.t("Did not find your award? ")}
19
+ {i18next.t("Did not find your award/grant? ")}
20
20
  <a
21
21
  href="/"
22
22
  onClick={(e) => {
@@ -24,7 +24,7 @@ export function NoAwardResults({ switchToCustom }) {
24
24
  switchToCustom();
25
25
  }}
26
26
  >
27
- {i18next.t("Add a custom award.")}
27
+ {i18next.t("Add a custom award/grant.")}
28
28
  </a>
29
29
  </p>
30
30
  }
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2020-2021 CERN.
3
+ # Copyright (C) 2020-2024 CERN.
4
4
  # Copyright (C) 2021 Graz University of Technology.
5
5
  #
6
6
  # Invenio-Vocabularies is free software; you can redistribute it and/or
@@ -9,46 +9,13 @@
9
9
 
10
10
  """Commands to create and manage vocabularies."""
11
11
 
12
- from copy import deepcopy
13
-
14
12
  import click
15
- import yaml
16
13
  from flask.cli import with_appcontext
17
14
  from invenio_access.permissions import system_identity
18
15
  from invenio_pidstore.errors import PIDDeletedError, PIDDoesNotExistError
19
- from invenio_records_resources.proxies import current_service_registry
20
16
 
21
- from .contrib.awards.datastreams import DATASTREAM_CONFIG as awards_ds_config
22
- from .contrib.funders.datastreams import DATASTREAM_CONFIG as funders_ds_config
23
- from .contrib.names.datastreams import DATASTREAM_CONFIG as names_ds_config
24
17
  from .datastreams import DataStreamFactory
25
-
26
-
27
- def get_config_for_ds(vocabulary, filepath=None, origin=None):
28
- """Calculates the configuration for a Data Stream."""
29
- config = None
30
- if vocabulary == "names": # FIXME: turn into a proper factory
31
- config = deepcopy(names_ds_config)
32
- elif vocabulary == "funders":
33
- config = deepcopy(funders_ds_config)
34
- elif vocabulary == "awards":
35
- config = deepcopy(awards_ds_config)
36
-
37
- if config:
38
- if filepath:
39
- with open(filepath) as f:
40
- config = yaml.safe_load(f).get(vocabulary)
41
- if origin:
42
- config["readers"][0].setdefault("args", {})
43
- config["readers"][0]["args"]["origin"] = origin
44
-
45
- return config
46
-
47
-
48
- def get_service_for_vocabulary(vocabulary):
49
- """Calculates the configuration for a Data Stream."""
50
- if vocabulary == "names": # FIXME: turn into a proper factory
51
- return current_service_registry.get("names")
18
+ from .factories import get_vocabulary_config
52
19
 
53
20
 
54
21
  @click.group()
@@ -111,7 +78,9 @@ def import_vocab(vocabulary, filepath=None, origin=None, num_samples=None):
111
78
  click.secho("One of --filepath or --origin must be present.", fg="red")
112
79
  exit(1)
113
80
 
114
- config = get_config_for_ds(vocabulary, filepath, origin)
81
+ vc = get_vocabulary_config(vocabulary)
82
+ config = vc.get_config(filepath, origin)
83
+
115
84
  success, errored, filtered = _process_vocab(config, num_samples)
116
85
 
117
86
  _output_process(vocabulary, "imported", success, errored, filtered)
@@ -127,11 +96,19 @@ def update(vocabulary, filepath=None, origin=None):
127
96
  if not filepath and not origin:
128
97
  click.secho("One of --filepath or --origin must be present.", fg="red")
129
98
  exit(1)
130
-
131
- config = get_config_for_ds(vocabulary, filepath, origin)
99
+ vc = get_vocabulary_config(vocabulary)
100
+ config = vc.get_config(filepath, origin)
132
101
 
133
102
  for w_conf in config["writers"]:
134
- w_conf["args"]["update"] = True
103
+ if w_conf["type"] == "async":
104
+ w_conf_update = w_conf["args"]["writer"]
105
+ else:
106
+ w_conf_update = w_conf
107
+
108
+ if "args" in w_conf_update:
109
+ w_conf_update["args"]["update"] = True
110
+ else:
111
+ w_conf_update["args"] = {"update": True}
135
112
 
136
113
  success, errored, filtered = _process_vocab(config)
137
114
 
@@ -153,7 +130,8 @@ def convert(vocabulary, filepath=None, origin=None, target=None, num_samples=Non
153
130
  )
154
131
  exit(1)
155
132
 
156
- config = get_config_for_ds(vocabulary, filepath, origin)
133
+ vc = get_vocabulary_config(vocabulary)
134
+ config = vc.get_config(filepath, origin)
157
135
  if not filepath:
158
136
  config["writers"] = [{"type": "yaml", "args": {"filepath": target}}]
159
137
 
@@ -169,18 +147,27 @@ def convert(vocabulary, filepath=None, origin=None, target=None, num_samples=Non
169
147
  type=click.STRING,
170
148
  help="Identifier of the vocabulary item to delete.",
171
149
  )
172
- @click.option("--all", is_flag=True, default=False, help="Not supported yet.")
150
+ @click.option("--all", is_flag=True, default=False)
173
151
  @with_appcontext
174
152
  def delete(vocabulary, identifier, all):
175
153
  """Delete all items or a specific one of the vocabulary."""
176
- if not id and not all:
154
+ if not identifier and not all:
177
155
  click.secho("An identifier or the --all flag must be present.", fg="red")
178
156
  exit(1)
179
157
 
180
- service = get_service_for_vocabulary(vocabulary)
158
+ vc = get_vocabulary_config(vocabulary)
159
+ service = vc.get_service()
181
160
  if identifier:
182
161
  try:
183
- if service.delete(identifier, system_identity):
162
+ if service.delete(system_identity, identifier):
184
163
  click.secho(f"{identifier} deleted from {vocabulary}.", fg="green")
185
164
  except (PIDDeletedError, PIDDoesNotExistError):
186
165
  click.secho(f"PID {identifier} not found.")
166
+ elif all:
167
+ items = service.scan(system_identity)
168
+ for item in items.hits:
169
+ try:
170
+ if service.delete(system_identity, item["id"]):
171
+ click.secho(f"{item['id']} deleted from {vocabulary}.", fg="green")
172
+ except (PIDDeletedError, PIDDoesNotExistError):
173
+ click.secho(f"PID {item['id']} not found.")