NASA-PDS / doi-ui

The web interface for the PDS DOI Service providing the ability management PDS archive DOIs. See the DOI Service for more details on the available capabilities. https://nasa-pds.github.io/doi-service/
Apache License 2.0
0 stars 4 forks source link

Return API error message in UI #9

Closed tloubrieu-jpl closed 3 years ago

tloubrieu-jpl commented 3 years ago

How to create a test case: send multiple time the same reserve request.

In curl:

curl --location --request POST 'http://localhost:8080/PDS_APIs/pds_doi_api/0.1/dois?action=reserve&submitter=loubrieu@jpl.nasa.gov&node=eng' \ --header 'Content-Type: application/json' \ --data-raw '{"labels":[{"status":"Reserved","title":"Laboratory Shocked Feldspars Bundle","publication_date":"2020-03-11","product_type_specific":"PDS4 Collection","author_last_name":"Johnson","author_first_name":"J. R.","related_resource":"urn:nasa:pds:lab_shocked_feldspars"}]}

The second time an error 400 is sent back with message: { "errors": [ { "message": "The title: 'Laboratory Shocked Feldspars Bundle' has already been used for a DOI by lidvid(s):urn:nasa:pds:lab_shocked_feldspars::None, status: reserved_not_submitted, doi: ,None . You must use a different title.", "name": "WarningDOIException" } ] }

The errors need to be shown in the UI.

Acceptance criteria: When an invalidate file is submitted for reservation Then: the error message is displayed in the UI and helps the user to correct the error

When an invalid PDS4 label is used for draft Then the error message is displayed in the UI and helps the user to correct the error.

When an invalid OSTI record is submitted for review (ie released to Engineering Node) Then the error message is displayed in the UI and helps the user to correct the error.

tloubrieu-jpl commented 3 years ago

Thanks @eddiesarevalo . Can you do something more readable by parsing the json and presenting the error type and text on one line ?

image

gxtchen commented 3 years ago

@tloubrieu-jpl Hi Thomas, how do I start the doi-service on localhost:8080? Can you point me to the instructions on doi_ui and doi_api. I tried runing npm install after cloning doi-ui but I don't have the npm package and system wouldn't let me install it either.

Thanks Gary

jordanpadams commented 3 years ago

@gxtchen hey Gary, from https://nasa-pds.github.io/releases/11.1/index.html, it's the pds-doi-service here: https://nasa-pds.github.io/pds-doi-service/

tloubrieu-jpl commented 3 years ago

@gxtchen I also added the instructions on the pds-doi-ui README, as a prerequisite https://github.com/NASA-PDS/pds-doi-ui