NCEAS / metacatui

MetacatUI: A client-side web interface for DataONE data repositories
https://nceas.github.io/metacatui
Apache License 2.0
42 stars 26 forks source link

Allow navigation to project views by seriesId #1059

Closed laurenwalker closed 4 years ago

laurenwalker commented 5 years ago

We need to allow users to specify a seriesId in the URL in addition to a label. This will allow users to get to a project view or project editor view if they accidentally created one with a duplicate label (or if they only have the seriesId for some reason)

rushirajnenuji commented 5 years ago

[WIP] - updated the solr query in getSeriesIdByName function to check if the given label (shortName) is a seriesId. TODO: The path gets a label and a sectionName appended after the seriesId - which is also discussed in this ticket: https://github.com/NCEAS/metacatui/issues/1066

rushirajnenuji commented 4 years ago

Solved by making a SOLR query to get the portal metadata via seriesId. If match is found - we get the label and promote the label in the path while rendering the view. Relevant commits: https://github.com/NCEAS/metacatui/commit/875ac362ef83635beb0944a6cdc2d8dec9ff4e10 and https://github.com/NCEAS/metacatui/commit/02420bf318037d4e1c348bbbf176d3e5be3440a5

laurenwalker commented 4 years ago

When I navigate to the portal editor by seriesId, the portal editor is rendered correctly but the URL is updated incorrectly.

When I go to: /edit/portals/urn%3Auuid%3A5cce5eb7-1225-4587-b761-9cf74992aa47

the URL is changed to: /edit/portals/urn%3Auuid%3A5cce5eb7-1225-4587-b761-9cf74992aa47/lauren-test2

when it should be changed to: /edit/portals/lauren-test2

rushirajnenuji commented 4 years ago

Hi Lauren - Thanks for reopening this ticket. It looks like the issue is with the URL encoded seriesID.

The following test case works correctly: Case: navigate to /edit/portals/urn:uuid:5cce5eb7-1225-4587-b761-9cf74992aa47 Current behavior: /edit/portals/lauren-test2 Expected behavior:

The case that needs fix: Case: navigate to /edit/portals/urn%3Auuid%3A5cce5eb7-1225-4587-b761-9cf74992aa47 Current behavior: /edit/portals/urn%3Auuid%3A5cce5eb7-1225-4587-b761-9cf74992aa47/lauren-test2 Expected behavior: /edit/portals/lauren-test2

I'll add proper URL encoding to the check. Thanks!

rushirajnenuji commented 4 years ago

Added decoding of the pathName in updatePath function.

Handles the following cases:

Case A: navigate to /edit/portals/urn%3Auuid%3A5cce5eb7-1225-4587-b761-9cf74992aa47 Previous behavior: /edit/portals/urn%3Auuid%3A5cce5eb7-1225-4587-b761-9cf74992aa47/lauren-test2 Current behavior: /edit/portals/lauren-test2

Case B: navigate to /portals/urn%3Auuid%3A5cce5eb7-1225-4587-b761-9cf74992aa47 Previous behavior: /portals/urn%3Auuid%3A5cce5eb7-1225-4587-b761-9cf74992aa47/lauren-test2 Current behavior: /portals/lauren-test2

laurenwalker commented 4 years ago

Look great, thanks Rushi!