Closed laurenwalker closed 3 years ago
This seems good. I would also propose a similar routing for our proposed /datasets
routes that are not metacatui-centric. We had an extensive discussion on this topic in DataONE:
I'm fairly sure this was working for quite a while but I think @mpsaloha and I realized it broke while checking it out the other week. I've added it to the salmon data
label it's tightly related to existing deliverables.
Thanks Bryce, I moved the issue to the Next pipeline since it sounds like you'll be taking a look at it sometime soon.
Sounds good, @laurenwalker, I'll take a look this week.
Had a look and I think I've got a nice solution.
When I looked at the coode, I found that the way MetadataView#getModel
worked when passed a data PID was to look for a metadata PID to pair with the data PID and then recursively call getModel
with the metadata PID it found. The change is just to Backbone.navigate
instead of getModel to a URL of /view/$metadata#$data
.
To test locally, checkout develop
and:
MetacatUI.AppConfig = {
root: "/",
theme: "arctic",
baseUrl: "https://test.arcticdata.io",
metacatContext: "metacat",
d1CNBaseUrl: "https://cn-stage.test.dataone.org",
}
Note: You can test it out really any way you want by pointing your local MetacatUI at any node and visiting /view/$data_pid
to see the behavior.
@laurenwalker this is ready for a review so I'll put it in that column on ZenHub. One thing I couldn't decide on was whether we were stressed about having both URLs (the /view/$data and the /view/$metadata#data URL) in the browser history or just the latter. I went with just the latter since it didn't seem useful or desirable to press back and get redirected forward again.
In #83, we introduced hash fragments in the MetadataView URLs that allow people to route to data objects by using a path pattern of
/view/{metadata-id}#{data-id}
Example:
view/urn%3Auuid%3Ad64bca79-7bb7-4eb1-9b25-047fd64f32a9#urn%3Auuid%3Ad64bca79-7bb7-4eb1-9b25-047fd64f32a9
We have always supported and will continue to support direct navigation to data objects by using only the data identifier in the URL, e.g.
view/{data-id}
However I propose the following change:
view/{data-id}
--->view/{metadata-id}#{data-id}
)This was historically not supported by MetacatUI because for years we used hashes in ALL routes, but since we now leverage Apache's rewrite rules or
FallbackResource
, we can take advantage of these URL hashes