SciCatProject / frontend

SciCat open data catalogue web client
https://scicatproject.github.io
BSD 3-Clause "New" or "Revised" License
24 stars 29 forks source link

Instruments page is empty if `customMetadata` exists #1627

Open alahiff opened 4 weeks ago

alahiff commented 4 weeks ago

Issue Name

Instruments page is empty if customMetadata exists

Summary

If an instrument includes customMetadata then the /instruments page is empty. In the browser's web developer tools console there is an error:

ERROR TypeError: n.value is undefined

Steps to Reproduce

  1. Create an instrument without any customMetadata
  2. Click on the instrument on the /instruments page
  3. Click on the Edit tab in the Custom Metadata section
  4. Click on +, and select Add new row
  5. Specify any name and value
  6. Click the tick and click the save button
  7. Go back to the /instruments page and make sure the page has reloaded

Current Behaviour

See above.

Expected Behaviour

Expect instruments to be listed whether or not they have custom metadata

Extra Details

Experience this problem in frontend versions 4.4.1 and 4.5.0. The problem occurs both with metadata which looks like this:

customMetadata: { name1: 'value1' },

and metadata which looks like this:

customMetadata: {
  attr1: { value: 10, unit: 'angstrom', valueSI: 1e-9, unitSI: 'm' }
},

Both of the above were examples generated using the Add new row in the UI.

nitrosx commented 2 weeks ago

@alahiff thank you for reporting this issue. I promise that we will look into it, although at the moment resources are pretty tied up in few other things.

alahiff commented 1 week ago

Ok, thankyou.

We have a workaround in place which, while probably incorrect, enables instruments to be listed and allows the metadata to be displayed in a basic way:

https://github.com/alahiff/frontend/commit/0bb77fb07ef2b983db0ef4cabf8626324ecdb8bf