DSpace / dspace-angular

DSpace User Interface built on Angular.io
https://wiki.lyrasis.org/display/DSDOC8x/
BSD 3-Clause "New" or "Revised" License
131 stars 429 forks source link

Submission Form should be loaded using fewer REST requests #3162

Open tdonohue opened 3 months ago

tdonohue commented 3 months ago

Describe the bug

In 7.x and 8.x, when a user starts a new submission, this makes ~9 calls to the REST API to load all the required information to create the Submission form. First, the WorkspaceItem is loaded, then each section of the form (one by one), then any controlled vocabularies (one by one).

Here's an example of what you see in Chrome DevTools when the Submission Form loads:

# Load WorkspaceItem
GET /server/api/submission/workspaceitems/[:id]?embed=item,sections,collection

# Load each section of form one by one
GET /server/api/config/submissionforms/traditionalpageone
GET /server/api/config/submissionforms/traditionalpagetwo
GET /server/api/config/submissionforms/upload?embed=metadata
GET /server/api/config/submissionforms/license

# Load any referenced controlled vocabularies (to populate dropdowns, etc)
GET /server/api/submission/vocabularies/common_types
GET /server/api/submission/vocabularies/common_iso_languages

# Finally, load the *entry* values in those controlled vocabularies (as a separate request)
GET /server/api/submission/vocabularies/common_types/entries?page=0&size=10
GET /server/api/submission/vocabularies/common_iso_types/entries?page=0&size=10

Ideally, it'd be better to see if we can load all this information in a single request (or at least fewer requests) by better usage of Projections (embed param)

To Reproduce

Steps to reproduce the behavior:

  1. Login to demo.dspace.org or sandbox.dspace.org
  2. Open Chrome DevTools
  3. Create a new Submission. Verify that you see roughly 8-10 requests to build the submission form.

Expected behavior

Ideally, better usage of projections should allow us to load all this information in fewer REST requests. If additional endpoints need to be added to the REST API to support this behavior, then we should add them.

GraziaQuercia commented 3 months ago

Hi @tdonohue, we'd like to have this issue assigned to 4Science, @atarix83 can be the Assignee. Thanks!

kshepherd commented 3 months ago

A note here that since "replace Submission Form library" is also on the 9.0 TODO list, it should be coordinated with this so we don't accidentally do any work that has to be thrown away or replaced ;)

tdonohue commented 3 months ago

Thanks @GraziaQuercia ! I'll assign @atarix83 to this then.

I do also want to call out @kshepherd 's note above that this might be semi-related to #2216 (the ticket about replacing the submission form library). I'm not sure myself whether these two tickets are connected. But, if 4Science finds they are connected, definitely let us know. My current suspicion is that better usage of Projections (embed param) may be a possible solution to this ticket...and that approach may not touch the submission form library (ng-dynamic-forms) directly. Nonetheless, I agree with @kshepherd that we don't want to build something complex that needs to be immediately replaced.