gbif / hosted-portals

Support material for establishing the GBIF Hosted Portals
Apache License 2.0
10 stars 6 forks source link

Update occurrence view and support an own url (e.g /occurrence/123) #203

Open MortenHofft opened 2 years ago

MortenHofft commented 2 years ago

Currently occurrences can only be seen as a sliding in drawer. It would be useful to be able to show and link to standalone pages.

Secondly these pages are still missing useful features such as showing video, audio and extensions. And a map.

The work to fix this has been started in a branch (occDetails), but isn't complete.

rukayaj commented 2 years ago

I have a kind of related question! Is it possible at all for us hosted portal users to customise the occurrence pages/sliding drawer? We have an API where we were planning to add annotations for occurrences, and it would be cool to not have to build a whole separate UI to display these, but just be able to show them on an occurrence page in a hosted portal.

MortenHofft commented 2 years ago

There isn't currently a way to do so no. I have pondered it at times, but concluded that it was too speculative without even knowing a real use case.

Could you please describe in more details what it is you imagine this look look like and work like?

The goal would of course be to find a solution that was flexible enough to accommodate your particular use case and others in the future, while also not adding so much complexity that it becomes a pain to maintain/develop the code. I'm not sure I'm able to strike that balance, but perhaps you can help. Understanding your request in more details would be a good start

rukayaj commented 2 years ago

Yes, so it would be something like this:

User clicks on a record > the drawer slides out + an API call is made to http://annotate.gbif.no/?resolvable_object_id=[occurrenceid] to get a list of our annotations for that record

If there are any annotations for that record, the UI would need to show something like:

Screenshot 2022-02-14 at 15 56 10

Clicking on the green button would bring up a modal window showing the annotations for that particular dwc term. Like just a simple list of them would be fine I suppose. So there'd need to be some logic iterating through the terms and inserting the View x annotations button where necessary.

There'd also need to be an Add annotation button:

Screenshot 2022-02-14 at 16 07 25

Clicking this would bring up a modal with a simple form to post data to annotate.gbif.no:

Screenshot 2022-02-14 at 16 14 43

So something like this is what we have in mind. It seems silly to build from scratch yet another UI for GBIF data just to add this one bit of functionality.

Edit: It would actually also be good to be able to add to the main data listing page too, so that we can bulk annotate records. Like an extra table column with tickboxes to select rows, and a button at the bottom to launch the bulk annotate version of the form.

siwelisabeth commented 2 years ago

I also have a related question :-) In the occurrence view in the portal, the occurrence has a link to the gbif dataset page. Since we have our own dataset pages in the living-norway portal, we would like to link to our own dataset page from the slide-in drawer. Is there a way to to that or could that be a possibility in the future?

MortenHofft commented 2 years ago

Thank you @rukayaj Doing something bespoke for the norwegian annotation API isn't feasible. But I can explore the option to have some hooks that allowed you to extend an area of the header. E.g. allowing you to write a custom React component that you could inject into the header of the occurrence page. In there you could do whatever. For example call your API and add a button that says: "5 annotations available" and create a popup showing them. Or whatever you wanted to do from that point.

The same hook could then be used for other purposes by others. Say add a custom projectId or such.

rukayaj commented 2 years ago

Well, it sounds a little limited if we just have access to the header, perhaps on the whole it will be faster and easier for us to build something ourselves instead. Chances are it will need further customisation anyway. But thanks for offering. It sounds like it could possibly still be helpful for @siwelisabeth.

MortenHofft commented 2 years ago

You are very welcome to continue using the hosted portals and I will gladly answer any questions, but the questions and requests from the Living Norway group have from the beginning indicated that this isn't really a good solution for you. Have you considered just using the APIs to build what you want instead? I suspect that the end result would be better instead of the current mixed approach. Either way I would be happy to help with any question you might have.

rukayaj commented 2 years ago

Thanks for your help @MortenHofft . Yes what I've been asking about is actually unrelated to Living Norway, but I think you are right in that it will be better to just build what we need ourselves.

MortenHofft commented 2 years ago

Thanks for your help @MortenHofft . Yes what I've been asking about is actually unrelated to Living Norway, but I think you are right in that it will be better to just build what we need ourselves.

Nice - I would love to see it when you have something. It is always intersting to see how others go about it.