invenio-app-rdm 13.0.0b2.dev6__py2.py3-none-any.whl → 13.0.0b2.dev9__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.
@@ -1,5 +1,5 @@
1
1
  // This file is part of InvenioRDM
2
- // Copyright (C) 2020-2024 CERN.
2
+ // Copyright (C) 2020-2025 CERN.
3
3
  // Copyright (C) 2020-2022 Northwestern University.
4
4
  // Copyright (C) 2021-2022 Graz University of Technology.
5
5
  // Copyright (C) 2022-2024 KTH Royal Institute of Technology.
@@ -44,6 +44,7 @@ import { Card, Container, Grid, Ref, Sticky } from "semantic-ui-react";
44
44
  import PropTypes from "prop-types";
45
45
  import Overridable from "react-overridable";
46
46
  import { ShareDraftButton } from "./ShareDraftButton";
47
+ import { depositFormSectionsConfig, severityChecksConfig } from "./config";
47
48
 
48
49
  export class RDMDepositForm extends Component {
49
50
  constructor(props) {
@@ -90,6 +91,9 @@ export class RDMDepositForm extends Component {
90
91
  this.noFiles = true;
91
92
  }
92
93
 
94
+ this.sectionsConfig = depositFormSectionsConfig;
95
+ this.severityChecks = severityChecksConfig;
96
+
93
97
  // hide community header for branded communities
94
98
  this.hide_community_selection = this.config.hide_community_selection || false;
95
99
  }
@@ -99,6 +103,7 @@ export class RDMDepositForm extends Component {
99
103
 
100
104
  render() {
101
105
  const {
106
+ config,
102
107
  record,
103
108
  files,
104
109
  permissions,
@@ -109,608 +114,630 @@ export class RDMDepositForm extends Component {
109
114
  groupsEnabled,
110
115
  allowEmptyFiles,
111
116
  } = this.props;
112
- const customFieldsUI = this.config.custom_fields.ui;
117
+
118
+ // Adding section id to custom fields UI, to be used for accordions
119
+ const customFieldsUI = this.config.custom_fields.ui.map((section) => ({
120
+ ...section,
121
+ id: section.section.toLowerCase().replace(/\s+/g, "-") + "-section",
122
+ }));
123
+
113
124
  return (
114
- <DepositFormApp
115
- config={this.config}
125
+ <Overridable
126
+ id="InvenioAppRdm.Deposit.RDMDepositForm.layout"
116
127
  record={record}
117
- preselectedCommunity={preselectedCommunity}
118
128
  files={files}
129
+ config={config}
119
130
  permissions={permissions}
131
+ preselectedCommunity={preselectedCommunity}
132
+ filesLocked={filesLocked}
133
+ recordRestrictionGracePeriod={recordRestrictionGracePeriod}
134
+ allowRecordRestriction={allowRecordRestriction}
135
+ groupsEnabled={groupsEnabled}
136
+ allowEmptyFiles={allowEmptyFiles}
137
+ customFieldsUI={customFieldsUI}
120
138
  >
121
- <Overridable
122
- id="InvenioAppRdm.Deposit.FormFeedback.container"
123
- labels={this.config.custom_fields.error_labels}
124
- fieldPath="message"
125
- >
126
- <FormFeedback
127
- fieldPath="message"
128
- labels={this.config.custom_fields.error_labels}
129
- />
130
- </Overridable>
131
-
132
- <Overridable
133
- id="InvenioAppRdm.Deposit.CommunityHeader.container"
139
+ <DepositFormApp
140
+ config={this.config}
134
141
  record={record}
142
+ preselectedCommunity={preselectedCommunity}
143
+ files={files}
144
+ permissions={permissions}
135
145
  >
136
- {!this.hide_community_selection && (
137
- <CommunityHeader
138
- imagePlaceholderLink="/static/images/square-placeholder.png"
139
- record={record}
146
+ <Overridable
147
+ id="InvenioAppRdm.Deposit.FormFeedback.container"
148
+ labels={this.config.custom_fields.error_labels}
149
+ fieldPath="message"
150
+ >
151
+ <FormFeedback
152
+ fieldPath="message"
153
+ labels={this.config.custom_fields.error_labels}
154
+ sectionsConfig={this.sectionsConfig}
140
155
  />
141
- )}
142
- </Overridable>
143
- <Container id="rdm-deposit-form" className="rel-mt-1">
144
- <Grid className="mt-25">
145
- <Grid.Column mobile={16} tablet={16} computer={11}>
146
- <Overridable
147
- id="InvenioAppRdm.Deposit.AccordionFieldFiles.container"
156
+ </Overridable>
157
+
158
+ <Overridable
159
+ id="InvenioAppRdm.Deposit.CommunityHeader.container"
160
+ record={record}
161
+ >
162
+ {!this.hide_community_selection && (
163
+ <CommunityHeader
164
+ imagePlaceholderLink="/static/images/square-placeholder.png"
148
165
  record={record}
149
- config={this.config}
150
- noFiles={this.noFiles}
151
- >
152
- <AccordionField
153
- includesPaths={["files.enabled"]}
154
- active
155
- label={i18next.t("Files")}
166
+ />
167
+ )}
168
+ </Overridable>
169
+ <Container id="rdm-deposit-form" className="rel-mt-1">
170
+ <Grid className="mt-25">
171
+ <Grid.Column mobile={16} tablet={16} computer={11}>
172
+ <Overridable
173
+ id="InvenioAppRdm.Deposit.AccordionFieldFiles.container"
174
+ record={record}
175
+ config={this.config}
176
+ noFiles={this.noFiles}
156
177
  >
157
- {this.noFiles && record.is_published && (
158
- <div className="text-align-center pb-10">
159
- <em>{i18next.t("The record has no files.")}</em>
160
- </div>
161
- )}
162
- <Overridable
163
- id="InvenioAppRdm.Deposit.FileUploader.container"
164
- record={record}
165
- config={this.config}
166
- permissions={permissions}
167
- filesLocked={filesLocked}
168
- allowEmptyFiles={allowEmptyFiles}
178
+ <AccordionField
179
+ includesPaths={this.sectionsConfig["files-section"]}
180
+ severityChecks={this.severityChecks}
181
+ active
182
+ label={i18next.t("Files")}
183
+ id="files-section"
169
184
  >
170
- <FileUploader
171
- isDraftRecord={!record.is_published}
172
- quota={this.config.quota}
173
- decimalSizeDisplay={this.config.decimal_size_display}
174
- showMetadataOnlyToggle={permissions?.can_manage_files}
175
- allowEmptyFiles={allowEmptyFiles}
185
+ {this.noFiles && record.is_published && (
186
+ <div className="text-align-center pb-10">
187
+ <em>{i18next.t("The record has no files.")}</em>
188
+ </div>
189
+ )}
190
+ <Overridable
191
+ id="InvenioAppRdm.Deposit.FileUploader.container"
192
+ record={record}
193
+ config={this.config}
194
+ permissions={permissions}
176
195
  filesLocked={filesLocked}
177
- />
178
- </Overridable>
179
- </AccordionField>
180
- </Overridable>
181
- <Overridable
182
- id="InvenioAppRdm.Deposit.AccordionFieldBasicInformation.container"
183
- config={this.config}
184
- record={record}
185
- vocabularies={this.vocabularies}
186
- >
187
- <AccordionField
188
- includesPaths={[
189
- "metadata.resource_type",
190
- "metadata.title",
191
- "metadata.additional_titles",
192
- "metadata.publication_date",
193
- "metadata.creators",
194
- "metadata.description",
195
- "metadata.additional_descriptions",
196
- "metadata.rights",
197
- ]}
198
- active
199
- label={i18next.t("Basic information")}
196
+ allowEmptyFiles={allowEmptyFiles}
197
+ >
198
+ <FileUploader
199
+ isDraftRecord={!record.is_published}
200
+ quota={this.config.quota}
201
+ decimalSizeDisplay={this.config.decimal_size_display}
202
+ showMetadataOnlyToggle={permissions?.can_manage_files}
203
+ allowEmptyFiles={allowEmptyFiles}
204
+ filesLocked={filesLocked}
205
+ />
206
+ </Overridable>
207
+ </AccordionField>
208
+ </Overridable>
209
+ <Overridable
210
+ id="InvenioAppRdm.Deposit.AccordionFieldBasicInformation.container"
211
+ config={this.config}
212
+ record={record}
213
+ vocabularies={this.vocabularies}
200
214
  >
201
- <Overridable
202
- id="InvenioAppRdm.Deposit.PIDField.container"
203
- config={this.config}
204
- record={record}
215
+ <AccordionField
216
+ includesPaths={this.sectionsConfig["basic-information-section"]}
217
+ severityChecks={this.severityChecks}
218
+ active
219
+ label={i18next.t("Basic information")}
220
+ id="basic-information-section"
205
221
  >
206
- <Fragment>
207
- {this.config.pids.map((pid) => (
208
- <Fragment key={pid.scheme}>
209
- <PIDField
210
- btnLabelDiscardPID={pid.btn_label_discard_pid}
211
- btnLabelGetPID={pid.btn_label_get_pid}
212
- canBeManaged={pid.can_be_managed}
213
- canBeUnmanaged={pid.can_be_unmanaged}
214
- optionalDOItransitions={pid.optional_doi_transitions}
215
- fieldPath={`pids.${pid.scheme}`}
216
- fieldLabel={pid.field_label}
217
- isEditingPublishedRecord={
218
- record.is_published === true // is_published is `null` at first upload
219
- }
220
- managedHelpText={pid.managed_help_text}
221
- pidLabel={pid.pid_label}
222
- pidPlaceholder={pid.pid_placeholder}
223
- pidType={pid.scheme}
224
- unmanagedHelpText={pid.unmanaged_help_text}
225
- doiDefaultSelection={pid.default_selected}
226
- required={this.config.is_doi_required}
227
- record={record}
228
- />
229
- </Fragment>
230
- ))}
231
- </Fragment>
232
- </Overridable>
222
+ <Overridable
223
+ id="InvenioAppRdm.Deposit.PIDField.container"
224
+ config={this.config}
225
+ record={record}
226
+ >
227
+ <Fragment>
228
+ {this.config.pids.map((pid) => (
229
+ <Fragment key={pid.scheme}>
230
+ <PIDField
231
+ btnLabelDiscardPID={pid.btn_label_discard_pid}
232
+ btnLabelGetPID={pid.btn_label_get_pid}
233
+ canBeManaged={pid.can_be_managed}
234
+ canBeUnmanaged={pid.can_be_unmanaged}
235
+ optionalDOItransitions={pid.optional_doi_transitions}
236
+ fieldPath={`pids.${pid.scheme}`}
237
+ fieldLabel={pid.field_label}
238
+ isEditingPublishedRecord={
239
+ record.is_published === true // is_published is `null` at first upload
240
+ }
241
+ managedHelpText={pid.managed_help_text}
242
+ pidLabel={pid.pid_label}
243
+ pidPlaceholder={pid.pid_placeholder}
244
+ pidType={pid.scheme}
245
+ unmanagedHelpText={pid.unmanaged_help_text}
246
+ doiDefaultSelection={pid.default_selected}
247
+ required={this.config.is_doi_required}
248
+ record={record}
249
+ />
250
+ </Fragment>
251
+ ))}
252
+ </Fragment>
253
+ </Overridable>
233
254
 
234
- <Overridable
235
- id="InvenioAppRdm.Deposit.ResourceTypeField.container"
236
- vocabularies={this.vocabularies}
237
- fieldPath="metadata.resource_type"
238
- >
239
- <ResourceTypeField
240
- options={this.vocabularies.metadata.resource_type}
255
+ <Overridable
256
+ id="InvenioAppRdm.Deposit.ResourceTypeField.container"
257
+ vocabularies={this.vocabularies}
241
258
  fieldPath="metadata.resource_type"
242
- required
243
- />
244
- </Overridable>
259
+ >
260
+ <ResourceTypeField
261
+ options={this.vocabularies.metadata.resource_type}
262
+ fieldPath="metadata.resource_type"
263
+ required
264
+ />
265
+ </Overridable>
245
266
 
246
- <Overridable
247
- id="InvenioAppRdm.Deposit.TitlesField.container"
248
- vocabularies={this.vocabularies}
249
- fieldPath="metadata.title"
250
- record={record}
251
- >
252
- <TitlesField
253
- options={this.vocabularies.metadata.titles}
267
+ <Overridable
268
+ id="InvenioAppRdm.Deposit.TitlesField.container"
269
+ vocabularies={this.vocabularies}
254
270
  fieldPath="metadata.title"
255
- recordUI={record.ui}
256
- required
257
- />
258
- </Overridable>
271
+ record={record}
272
+ >
273
+ <TitlesField
274
+ options={this.vocabularies.metadata.titles}
275
+ fieldPath="metadata.title"
276
+ recordUI={record.ui}
277
+ required
278
+ />
279
+ </Overridable>
259
280
 
260
- <Overridable
261
- id="InvenioAppRdm.Deposit.PublicationDateField.container"
262
- fieldPath="metadata.publication_date"
263
- >
264
- <PublicationDateField
265
- required
281
+ <Overridable
282
+ id="InvenioAppRdm.Deposit.PublicationDateField.container"
266
283
  fieldPath="metadata.publication_date"
267
- />
268
- </Overridable>
284
+ >
285
+ <PublicationDateField
286
+ required
287
+ fieldPath="metadata.publication_date"
288
+ />
289
+ </Overridable>
269
290
 
270
- <Overridable
271
- id="InvenioAppRdm.Deposit.CreatorsField.container"
272
- vocabularies={this.vocabularies}
273
- config={this.config}
274
- fieldPath="metadata.creators"
275
- >
276
- <CreatibutorsField
277
- label={i18next.t("Creators")}
278
- labelIcon="user"
291
+ <Overridable
292
+ id="InvenioAppRdm.Deposit.CreatorsField.container"
293
+ vocabularies={this.vocabularies}
294
+ config={this.config}
279
295
  fieldPath="metadata.creators"
280
- roleOptions={this.vocabularies.metadata.creators.role}
281
- schema="creators"
282
- autocompleteNames={this.config.autocomplete_names}
283
- required
284
- />
285
- </Overridable>
296
+ >
297
+ <CreatibutorsField
298
+ label={i18next.t("Creators")}
299
+ labelIcon="user"
300
+ fieldPath="metadata.creators"
301
+ roleOptions={this.vocabularies.metadata.creators.role}
302
+ schema="creators"
303
+ autocompleteNames={this.config.autocomplete_names}
304
+ required
305
+ />
306
+ </Overridable>
286
307
 
287
- <Overridable
288
- id="InvenioAppRdm.Deposit.DescriptionsField.container"
289
- record={record}
290
- vocabularies={this.vocabularies}
291
- fieldPath="metadata.description"
292
- >
293
- <DescriptionsField
308
+ <Overridable
309
+ id="InvenioAppRdm.Deposit.DescriptionsField.container"
310
+ record={record}
311
+ vocabularies={this.vocabularies}
294
312
  fieldPath="metadata.description"
295
- options={this.vocabularies.metadata.descriptions}
296
- recordUI={_get(record, "ui", null)}
297
- />
298
- </Overridable>
313
+ >
314
+ <DescriptionsField
315
+ fieldPath="metadata.description"
316
+ options={this.vocabularies.metadata.descriptions}
317
+ recordUI={_get(record, "ui", null)}
318
+ />
319
+ </Overridable>
299
320
 
300
- <Overridable
301
- id="InvenioAppRdm.Deposit.LicenseField.container"
302
- fieldPath="metadata.rights"
303
- >
304
- <LicenseField
321
+ <Overridable
322
+ id="InvenioAppRdm.Deposit.LicenseField.container"
305
323
  fieldPath="metadata.rights"
306
- searchConfig={{
307
- searchApi: {
308
- axios: {
309
- headers: {
310
- Accept: "application/vnd.inveniordm.v1+json",
324
+ >
325
+ <LicenseField
326
+ fieldPath="metadata.rights"
327
+ searchConfig={{
328
+ searchApi: {
329
+ axios: {
330
+ headers: {
331
+ Accept: "application/vnd.inveniordm.v1+json",
332
+ },
333
+ url: "/api/vocabularies/licenses",
334
+ withCredentials: false,
311
335
  },
312
- url: "/api/vocabularies/licenses",
313
- withCredentials: false,
314
336
  },
315
- },
316
- initialQueryState: {
317
- filters: [["tags", "recommended"]],
318
- },
319
- }}
320
- serializeLicenses={(result) => ({
321
- title: result.title_l10n,
322
- description: result.description_l10n,
323
- id: result.id,
324
- link: result.props.url,
325
- })}
337
+ initialQueryState: {
338
+ filters: [["tags", "recommended"]],
339
+ },
340
+ }}
341
+ serializeLicenses={(result) => ({
342
+ title: result.title_l10n,
343
+ description: result.description_l10n,
344
+ id: result.id,
345
+ link: result.props.url,
346
+ })}
347
+ />
348
+ </Overridable>
349
+ <Overridable
350
+ id="InvenioAppRdm.Deposit.AccordionFieldBasicInformation.extra"
351
+ record={record}
352
+ files={files}
353
+ permissions={permissions}
354
+ preselectedCommunity={preselectedCommunity}
355
+ filesLocked={filesLocked}
356
+ recordRestrictionGracePeriod={recordRestrictionGracePeriod}
357
+ allowRecordRestriction={allowRecordRestriction}
358
+ groupsEnabled={groupsEnabled}
359
+ allowEmptyFiles={allowEmptyFiles}
360
+ customFieldsUI={customFieldsUI}
361
+ config={this.config}
362
+ vocabularies={this.vocabularies}
363
+ noFiles={this.noFiles}
364
+ hideCommunitySelection={this.hide_community_selection}
326
365
  />
327
- </Overridable>
328
- <Overridable
329
- id="InvenioAppRdm.Deposit.AccordionFieldBasicInformation.extra"
330
- record={record}
331
- files={files}
332
- permissions={permissions}
333
- preselectedCommunity={preselectedCommunity}
334
- filesLocked={filesLocked}
335
- recordRestrictionGracePeriod={recordRestrictionGracePeriod}
336
- allowRecordRestriction={allowRecordRestriction}
337
- groupsEnabled={groupsEnabled}
338
- allowEmptyFiles={allowEmptyFiles}
339
- customFieldsUI={customFieldsUI}
340
- config={this.config}
341
- vocabularies={this.vocabularies}
342
- noFiles={this.noFiles}
343
- hideCommunitySelection={this.hide_community_selection}
344
- />
345
- </AccordionField>
346
- </Overridable>
347
- <Overridable
348
- id="InvenioAppRdm.Deposit.AccordionFieldRecommendedInformation.container"
349
- vocabularies={this.vocabularies}
350
- config={this.config}
351
- record={record}
352
- >
353
- <AccordionField
354
- includesPaths={[
355
- "metadata.contributors",
356
- "metadata.subjects",
357
- "metadata.languages",
358
- "metadata.dates",
359
- "metadata.version",
360
- "metadata.publisher",
361
- ]}
362
- active
363
- label={i18next.t("Recommended information")}
366
+ </AccordionField>
367
+ </Overridable>
368
+ <Overridable
369
+ id="InvenioAppRdm.Deposit.AccordionFieldRecommendedInformation.container"
370
+ vocabularies={this.vocabularies}
371
+ config={this.config}
372
+ record={record}
364
373
  >
365
- <Overridable
366
- id="InvenioAppRdm.Deposit.ContributorsField.container"
367
- fieldPath="metadata.contributors"
368
- vocabularies={this.vocabularies}
369
- config={this.config}
374
+ <AccordionField
375
+ includesPaths={
376
+ this.sectionsConfig["recommended-information-section"]
377
+ }
378
+ severityChecks={this.severityChecks}
379
+ label={i18next.t("Recommended information")}
380
+ id="recommended-information-section"
370
381
  >
371
- <CreatibutorsField
372
- addButtonLabel={i18next.t("Add contributor")}
373
- label={i18next.t("Contributors")}
374
- labelIcon="user plus"
382
+ <Overridable
383
+ id="InvenioAppRdm.Deposit.ContributorsField.container"
375
384
  fieldPath="metadata.contributors"
376
- roleOptions={this.vocabularies.metadata.contributors.role}
377
- schema="contributors"
378
- autocompleteNames={this.config.autocomplete_names}
379
- modal={{
380
- addLabel: "Add contributor",
381
- editLabel: "Edit contributor",
382
- }}
383
- />
384
- </Overridable>
385
+ vocabularies={this.vocabularies}
386
+ config={this.config}
387
+ >
388
+ <CreatibutorsField
389
+ addButtonLabel={i18next.t("Add contributor")}
390
+ label={i18next.t("Contributors")}
391
+ labelIcon="user plus"
392
+ fieldPath="metadata.contributors"
393
+ roleOptions={this.vocabularies.metadata.contributors.role}
394
+ schema="contributors"
395
+ autocompleteNames={this.config.autocomplete_names}
396
+ modal={{
397
+ addLabel: "Add contributor",
398
+ editLabel: "Edit contributor",
399
+ }}
400
+ />
401
+ </Overridable>
385
402
 
386
- <Overridable
387
- id="InvenioAppRdm.Deposit.SubjectsField.container"
388
- vocabularies={this.vocabularies}
389
- fieldPath="metadata.subjects"
390
- record={record}
391
- >
392
- <SubjectsField
403
+ <Overridable
404
+ id="InvenioAppRdm.Deposit.SubjectsField.container"
405
+ vocabularies={this.vocabularies}
393
406
  fieldPath="metadata.subjects"
394
- initialOptions={_get(record, "ui.subjects", null)}
395
- limitToOptions={this.vocabularies.metadata.subjects.limit_to}
396
- searchOnFocus
397
- />
398
- </Overridable>
407
+ record={record}
408
+ >
409
+ <SubjectsField
410
+ fieldPath="metadata.subjects"
411
+ initialOptions={_get(record, "ui.subjects", null)}
412
+ limitToOptions={this.vocabularies.metadata.subjects.limit_to}
413
+ searchOnFocus
414
+ />
415
+ </Overridable>
399
416
 
400
- <Overridable
401
- id="InvenioAppRdm.Deposit.LanguagesField.container"
402
- fieldPath="metadata.languages"
403
- record={record}
404
- >
405
- <LanguagesField
417
+ <Overridable
418
+ id="InvenioAppRdm.Deposit.LanguagesField.container"
406
419
  fieldPath="metadata.languages"
407
- initialOptions={_get(record, "ui.languages", []).filter(
408
- (lang) => lang !== null
409
- )} // needed because dumped empty record from backend gives [null]
410
- serializeSuggestions={(suggestions) =>
411
- suggestions.map((item) => ({
412
- text: item.title_l10n,
413
- value: item.id,
414
- key: item.id,
415
- }))
416
- }
417
- />
418
- </Overridable>
420
+ record={record}
421
+ >
422
+ <LanguagesField
423
+ fieldPath="metadata.languages"
424
+ initialOptions={_get(record, "ui.languages", []).filter(
425
+ (lang) => lang !== null
426
+ )} // needed because dumped empty record from backend gives [null]
427
+ serializeSuggestions={(suggestions) =>
428
+ suggestions.map((item) => ({
429
+ text: item.title_l10n,
430
+ value: item.id,
431
+ key: item.id,
432
+ }))
433
+ }
434
+ />
435
+ </Overridable>
419
436
 
420
- <Overridable
421
- id="InvenioAppRdm.Deposit.DateField.container"
422
- vocabularies={this.vocabularies}
423
- fieldPath="metadata.dates"
424
- >
425
- <DatesField
437
+ <Overridable
438
+ id="InvenioAppRdm.Deposit.DateField.container"
439
+ vocabularies={this.vocabularies}
426
440
  fieldPath="metadata.dates"
427
- options={this.vocabularies.metadata.dates}
428
- showEmptyValue
429
- />
430
- </Overridable>
441
+ >
442
+ <DatesField
443
+ fieldPath="metadata.dates"
444
+ options={this.vocabularies.metadata.dates}
445
+ showEmptyValue
446
+ />
447
+ </Overridable>
431
448
 
432
- <Overridable
433
- id="InvenioAppRdm.Deposit.VersionField.container"
434
- fieldPath="metadata.version"
435
- >
436
- <VersionField fieldPath="metadata.version" />
437
- </Overridable>
449
+ <Overridable
450
+ id="InvenioAppRdm.Deposit.VersionField.container"
451
+ fieldPath="metadata.version"
452
+ >
453
+ <VersionField fieldPath="metadata.version" />
454
+ </Overridable>
438
455
 
439
- <Overridable
440
- id="InvenioAppRdm.Deposit.PublisherField.container"
441
- fieldPath="metadata.publisher"
442
- >
443
- <PublisherField fieldPath="metadata.publisher" />
444
- </Overridable>
445
- </AccordionField>
446
- </Overridable>
447
- <Overridable
448
- id="InvenioAppRdm.Deposit.AccordionFieldFunding.container"
449
- ui={this.accordionStyle}
450
- >
451
- <AccordionField
452
- includesPaths={["metadata.funding"]}
453
- active
454
- label="Funding"
456
+ <Overridable
457
+ id="InvenioAppRdm.Deposit.PublisherField.container"
458
+ fieldPath="metadata.publisher"
459
+ >
460
+ <PublisherField fieldPath="metadata.publisher" />
461
+ </Overridable>
462
+ </AccordionField>
463
+ </Overridable>
464
+ <Overridable
465
+ id="InvenioAppRdm.Deposit.AccordionFieldFunding.container"
455
466
  ui={this.accordionStyle}
456
467
  >
457
- <Overridable
458
- id="InvenioAppRdm.Deposit.FundingField.container"
459
- fieldPath="metadata.funding"
468
+ <AccordionField
469
+ includesPaths={this.sectionsConfig["funding-section"]}
470
+ severityChecks={this.severityChecks}
471
+ active
472
+ label="Funding"
473
+ ui={this.accordionStyle}
474
+ id="funding-section"
460
475
  >
461
- <FundingField
476
+ <Overridable
477
+ id="InvenioAppRdm.Deposit.FundingField.container"
462
478
  fieldPath="metadata.funding"
463
- searchConfig={{
464
- searchApi: {
465
- axios: {
466
- headers: {
467
- Accept: "application/vnd.inveniordm.v1+json",
479
+ >
480
+ <FundingField
481
+ fieldPath="metadata.funding"
482
+ searchConfig={{
483
+ searchApi: {
484
+ axios: {
485
+ headers: {
486
+ Accept: "application/vnd.inveniordm.v1+json",
487
+ },
488
+ url: "/api/awards",
489
+ withCredentials: false,
468
490
  },
469
- url: "/api/awards",
470
- withCredentials: false,
471
491
  },
472
- },
473
- initialQueryState: {
474
- sortBy: "bestmatch",
475
- sortOrder: "asc",
476
- layout: "list",
477
- page: 1,
478
- size: 5,
479
- },
480
- }}
481
- label="Awards/Grants"
482
- labelIcon="money bill alternate outline"
483
- deserializeAward={(award) => {
484
- return {
485
- title: award.title_l10n,
486
- number: award.number,
487
- funder: award.funder ?? "",
488
- id: award.id,
489
- ...(award.identifiers && {
490
- identifiers: award.identifiers,
491
- }),
492
- ...(award.acronym && { acronym: award.acronym }),
493
- };
494
- }}
495
- deserializeFunder={(funder) => {
496
- return {
497
- id: funder.id,
498
- name: funder.name,
499
- ...(funder.title_l10n && { title: funder.title_l10n }),
500
- ...(funder.pid && { pid: funder.pid }),
501
- ...(funder.country && { country: funder.country }),
502
- ...(funder.country_name && {
503
- country_name: funder.country_name,
504
- }),
505
- ...(funder.identifiers && {
506
- identifiers: funder.identifiers,
507
- }),
508
- };
509
- }}
510
- computeFundingContents={(funding) => {
511
- let headerContent,
512
- descriptionContent,
513
- awardOrFunder = "";
514
-
515
- if (funding.funder) {
516
- const funderName =
517
- funding.funder?.name ??
518
- funding.funder?.title ??
519
- funding.funder?.id ??
520
- "";
521
- awardOrFunder = "funder";
522
- headerContent = funderName;
523
- descriptionContent = "";
524
-
525
- // there cannot be an award without a funder
526
- if (funding.award) {
527
- const { acronym, title } = funding.award;
528
- awardOrFunder = "award";
529
- descriptionContent = funderName;
530
- headerContent = acronym ? `${acronym} — ${title}` : title;
492
+ initialQueryState: {
493
+ sortBy: "bestmatch",
494
+ sortOrder: "asc",
495
+ layout: "list",
496
+ page: 1,
497
+ size: 5,
498
+ },
499
+ }}
500
+ label="Awards/Grants"
501
+ labelIcon="money bill alternate outline"
502
+ deserializeAward={(award) => {
503
+ return {
504
+ title: award.title_l10n,
505
+ number: award.number,
506
+ funder: award.funder ?? "",
507
+ id: award.id,
508
+ ...(award.identifiers && {
509
+ identifiers: award.identifiers,
510
+ }),
511
+ ...(award.acronym && { acronym: award.acronym }),
512
+ };
513
+ }}
514
+ deserializeFunder={(funder) => {
515
+ return {
516
+ id: funder.id,
517
+ name: funder.name,
518
+ ...(funder.title_l10n && { title: funder.title_l10n }),
519
+ ...(funder.pid && { pid: funder.pid }),
520
+ ...(funder.country && { country: funder.country }),
521
+ ...(funder.country_name && {
522
+ country_name: funder.country_name,
523
+ }),
524
+ ...(funder.identifiers && {
525
+ identifiers: funder.identifiers,
526
+ }),
527
+ };
528
+ }}
529
+ computeFundingContents={(funding) => {
530
+ let headerContent,
531
+ descriptionContent,
532
+ awardOrFunder = "";
533
+
534
+ if (funding.funder) {
535
+ const funderName =
536
+ funding.funder?.name ??
537
+ funding.funder?.title ??
538
+ funding.funder?.id ??
539
+ "";
540
+ awardOrFunder = "funder";
541
+ headerContent = funderName;
542
+ descriptionContent = "";
543
+
544
+ // there cannot be an award without a funder
545
+ if (funding.award) {
546
+ const { acronym, title } = funding.award;
547
+ awardOrFunder = "award";
548
+ descriptionContent = funderName;
549
+ headerContent = acronym ? `${acronym} — ${title}` : title;
550
+ }
531
551
  }
532
- }
533
552
 
534
- return { headerContent, descriptionContent, awardOrFunder };
535
- }}
536
- />
537
- </Overridable>
538
- </AccordionField>
539
- </Overridable>
540
- <Overridable
541
- id="InvenioAppRdm.Deposit.AccordionFieldAlternateIdentifiers.container"
542
- vocabularies={this.vocabularies}
543
- >
544
- <AccordionField
545
- includesPaths={["metadata.identifiers"]}
546
- active
547
- label={i18next.t("Alternate identifiers")}
553
+ return { headerContent, descriptionContent, awardOrFunder };
554
+ }}
555
+ />
556
+ </Overridable>
557
+ </AccordionField>
558
+ </Overridable>
559
+ <Overridable
560
+ id="InvenioAppRdm.Deposit.AccordionFieldAlternateIdentifiers.container"
561
+ vocabularies={this.vocabularies}
548
562
  >
549
- <Overridable
550
- id="InvenioAppRdm.Deposit.IdentifiersField.container"
551
- vocabularies={this.vocabularies}
552
- fieldPath="metadata.identifiers"
563
+ <AccordionField
564
+ includesPaths={this.sectionsConfig["alternate-identifiers-section"]}
565
+ severityChecks={this.severityChecks}
566
+ active
567
+ label={i18next.t("Alternate identifiers")}
568
+ id="alternate-identifiers-section"
553
569
  >
554
- <IdentifiersField
570
+ <Overridable
571
+ id="InvenioAppRdm.Deposit.IdentifiersField.container"
572
+ vocabularies={this.vocabularies}
555
573
  fieldPath="metadata.identifiers"
556
- label={i18next.t("Alternate identifiers")}
557
- labelIcon="barcode"
558
- schemeOptions={this.vocabularies.metadata.identifiers.scheme}
559
- showEmptyValue
560
- />
561
- </Overridable>
562
- </AccordionField>
563
- </Overridable>
564
-
565
- <Overridable
566
- id="InvenioAppRdm.Deposit.AccordionFieldRelatedWorks.container"
567
- vocabularies={this.vocabularies}
568
- >
569
- <AccordionField
570
- includesPaths={["metadata.related_identifiers"]}
571
- active
572
- label={i18next.t("Related works")}
574
+ >
575
+ <IdentifiersField
576
+ fieldPath="metadata.identifiers"
577
+ label={i18next.t("Alternate identifiers")}
578
+ labelIcon="barcode"
579
+ schemeOptions={this.vocabularies.metadata.identifiers.scheme}
580
+ showEmptyValue
581
+ />
582
+ </Overridable>
583
+ </AccordionField>
584
+ </Overridable>
585
+
586
+ <Overridable
587
+ id="InvenioAppRdm.Deposit.AccordionFieldRelatedWorks.container"
588
+ vocabularies={this.vocabularies}
573
589
  >
574
- <Overridable
575
- id="InvenioAppRdm.Deposit.RelatedWorksField.container"
576
- fieldPath="metadata.related_identifiers"
577
- vocabularies={this.vocabularies}
590
+ <AccordionField
591
+ includesPaths={this.sectionsConfig["related-works-section"]}
592
+ severityChecks={this.severityChecks}
593
+ active
594
+ label={i18next.t("Related works")}
595
+ id="related-works-section"
578
596
  >
579
- <RelatedWorksField
597
+ <Overridable
598
+ id="InvenioAppRdm.Deposit.RelatedWorksField.container"
580
599
  fieldPath="metadata.related_identifiers"
581
- options={this.vocabularies.metadata.identifiers}
582
- showEmptyValue
583
- />
584
- </Overridable>
585
- </AccordionField>
586
- </Overridable>
587
- <Overridable
588
- id="InvenioAppRdm.Deposit.AccordionFieldReferences.container"
589
- vocabularies={this.vocabularies}
590
- >
591
- <AccordionField
592
- includesPaths={["metadata.references"]}
593
- active
594
- label={i18next.t("References")}
595
- >
596
- <Overridable
597
- id="InvenioAppRdm.Deposit.ReferencesField.container"
598
- fieldPath="metadata.references"
599
- vocabularies={this.vocabularies}
600
- >
601
- <ReferencesField fieldPath="metadata.references" showEmptyValue />
602
- </Overridable>
603
- </AccordionField>
604
- </Overridable>
605
- {!_isEmpty(customFieldsUI) && (
600
+ vocabularies={this.vocabularies}
601
+ >
602
+ <RelatedWorksField
603
+ fieldPath="metadata.related_identifiers"
604
+ options={this.vocabularies.metadata.identifiers}
605
+ showEmptyValue
606
+ />
607
+ </Overridable>
608
+ </AccordionField>
609
+ </Overridable>
606
610
  <Overridable
607
- id="InvenioAppRdm.Deposit.CustomFields.container"
608
- record={record}
609
- customFieldsUI={customFieldsUI}
611
+ id="InvenioAppRdm.Deposit.AccordionFieldReferences.container"
612
+ vocabularies={this.vocabularies}
610
613
  >
611
- <CustomFields
612
- config={customFieldsUI}
613
- record={record}
614
- templateLoaders={[
615
- (widget) => import(`@templates/custom_fields/${widget}.js`),
616
- (widget) =>
617
- import(`@js/invenio_rdm_records/src/deposit/customFields`),
618
- (widget) => import(`react-invenio-forms`),
619
- ]}
620
- fieldPathPrefix="custom_fields"
621
- />
622
- </Overridable>
623
- )}
624
- </Grid.Column>
625
- <Ref innerRef={this.sidebarRef}>
626
- <Grid.Column
627
- mobile={16}
628
- tablet={16}
629
- computer={5}
630
- className="deposit-sidebar"
631
- >
632
- <Sticky context={this.sidebarRef} offset={20}>
633
- <Overridable
634
- id="InvenioAppRdm.Deposit.CardDepositStatusBox.container"
635
- record={record}
636
- permissions={permissions}
637
- groupsEnabled={groupsEnabled}
614
+ <AccordionField
615
+ includesPaths={this.sectionsConfig["references-section"]}
616
+ severityChecks={this.severityChecks}
617
+ active
618
+ label={i18next.t("References")}
619
+ id="references-section"
638
620
  >
639
- <Card>
640
- <Card.Content>
641
- <DepositStatusBox />
642
- </Card.Content>
643
- <Card.Content>
644
- <Grid relaxed>
645
- <Grid.Column
646
- computer={8}
647
- mobile={16}
648
- className="pb-0 left-btn-col"
649
- >
650
- <SaveButton fluid />
651
- </Grid.Column>
652
-
653
- <Grid.Column
654
- computer={8}
655
- mobile={16}
656
- className="pb-0 right-btn-col"
657
- >
658
- <PreviewButton fluid />
659
- </Grid.Column>
660
-
661
- <Grid.Column width={16} className="pt-10">
662
- <PublishButton fluid record={record} />
663
- </Grid.Column>
664
-
665
- <Grid.Column width={16} className="pt-0">
666
- {(record.is_draft === null || permissions.can_manage) && (
667
- <ShareDraftButton
668
- record={record}
669
- permissions={permissions}
670
- groupsEnabled={groupsEnabled}
671
- />
672
- )}
673
- </Grid.Column>
674
- </Grid>
675
- </Card.Content>
676
- </Card>
677
- </Overridable>
621
+ <Overridable
622
+ id="InvenioAppRdm.Deposit.ReferencesField.container"
623
+ fieldPath="metadata.references"
624
+ vocabularies={this.vocabularies}
625
+ >
626
+ <ReferencesField fieldPath="metadata.references" showEmptyValue />
627
+ </Overridable>
628
+ </AccordionField>
629
+ </Overridable>
630
+ {!_isEmpty(customFieldsUI) && (
678
631
  <Overridable
679
- id="InvenioAppRdm.Deposit.AccessRightField.container"
680
- fieldPath="access"
632
+ id="InvenioAppRdm.Deposit.CustomFields.container"
681
633
  record={record}
682
- permissions={permissions}
683
- recordRestrictionGracePeriod={recordRestrictionGracePeriod}
684
- allowRecordRestriction={allowRecordRestriction}
634
+ customFieldsUI={customFieldsUI}
685
635
  >
686
- <AccessRightField
687
- label={i18next.t("Visibility")}
636
+ <CustomFields
637
+ config={customFieldsUI}
688
638
  record={record}
689
- labelIcon="shield"
690
- fieldPath="access"
691
- showMetadataAccess={permissions?.can_manage_record_access}
692
- recordRestrictionGracePeriod={recordRestrictionGracePeriod}
693
- allowRecordRestriction={allowRecordRestriction}
639
+ templateLoaders={[
640
+ (widget) => import(`@templates/custom_fields/${widget}.js`),
641
+ (widget) =>
642
+ import(`@js/invenio_rdm_records/src/deposit/customFields`),
643
+ (widget) => import(`react-invenio-forms`),
644
+ ]}
645
+ fieldPathPrefix="custom_fields"
694
646
  />
695
647
  </Overridable>
696
- {permissions?.can_delete_draft && (
648
+ )}
649
+ </Grid.Column>
650
+ <Ref innerRef={this.sidebarRef}>
651
+ <Grid.Column
652
+ mobile={16}
653
+ tablet={16}
654
+ computer={5}
655
+ className="deposit-sidebar"
656
+ >
657
+ <Sticky context={this.sidebarRef} offset={20}>
697
658
  <Overridable
698
- id="InvenioAppRdm.Deposit.CardDeleteButton.container"
659
+ id="InvenioAppRdm.Deposit.CardDepositStatusBox.container"
699
660
  record={record}
661
+ permissions={permissions}
662
+ groupsEnabled={groupsEnabled}
700
663
  >
701
664
  <Card>
702
665
  <Card.Content>
703
- <DeleteButton fluid />
666
+ <DepositStatusBox />
667
+ </Card.Content>
668
+ <Card.Content>
669
+ <Grid relaxed>
670
+ <Grid.Column
671
+ computer={8}
672
+ mobile={16}
673
+ className="pb-0 left-btn-col"
674
+ >
675
+ <SaveButton fluid />
676
+ </Grid.Column>
677
+
678
+ <Grid.Column
679
+ computer={8}
680
+ mobile={16}
681
+ className="pb-0 right-btn-col"
682
+ >
683
+ <PreviewButton fluid />
684
+ </Grid.Column>
685
+
686
+ <Grid.Column width={16} className="pt-10">
687
+ <PublishButton fluid record={record} />
688
+ </Grid.Column>
689
+
690
+ <Grid.Column width={16} className="pt-0">
691
+ {(record.is_draft === null || permissions.can_manage) && (
692
+ <ShareDraftButton
693
+ record={record}
694
+ permissions={permissions}
695
+ groupsEnabled={groupsEnabled}
696
+ />
697
+ )}
698
+ </Grid.Column>
699
+ </Grid>
704
700
  </Card.Content>
705
701
  </Card>
706
702
  </Overridable>
707
- )}
708
- </Sticky>
709
- </Grid.Column>
710
- </Ref>
711
- </Grid>
712
- </Container>
713
- </DepositFormApp>
703
+ <Overridable
704
+ id="InvenioAppRdm.Deposit.AccessRightField.container"
705
+ fieldPath="access"
706
+ record={record}
707
+ permissions={permissions}
708
+ recordRestrictionGracePeriod={recordRestrictionGracePeriod}
709
+ allowRecordRestriction={allowRecordRestriction}
710
+ >
711
+ <AccessRightField
712
+ label={i18next.t("Visibility")}
713
+ record={record}
714
+ labelIcon="shield"
715
+ fieldPath="access"
716
+ showMetadataAccess={permissions?.can_manage_record_access}
717
+ recordRestrictionGracePeriod={recordRestrictionGracePeriod}
718
+ allowRecordRestriction={allowRecordRestriction}
719
+ id="visibility-section"
720
+ />
721
+ </Overridable>
722
+ {permissions?.can_delete_draft && (
723
+ <Overridable
724
+ id="InvenioAppRdm.Deposit.CardDeleteButton.container"
725
+ record={record}
726
+ >
727
+ <Card>
728
+ <Card.Content>
729
+ <DeleteButton fluid />
730
+ </Card.Content>
731
+ </Card>
732
+ </Overridable>
733
+ )}
734
+ </Sticky>
735
+ </Grid.Column>
736
+ </Ref>
737
+ </Grid>
738
+ </Container>
739
+ </DepositFormApp>
740
+ </Overridable>
714
741
  );
715
742
  }
716
743
  }