ts4nfdi / terminology-service-suite

The Terminology Service Suite project is a collection of interactive widgets designed to ease the integration of terminology service functions into third-party applications.
https://ts4nfdi.github.io/terminology-service-suite/comp/latest/
MIT License
16 stars 2 forks source link

Clicking on terms in the EntityRelationWidget results in Whitelabel Error Page #136

Closed jusa3 closed 1 month ago

jusa3 commented 2 months ago

http://semlookp-ui.qa.km.k8s.zbmed.de/ontologies/icdo/terms?iri=http%253A%252F%252Fpurl.obolibrary.org%252Fobo%252FICDO_0000104

VincentKneip commented 2 months ago

The mechanism for linking was rather simple and tried to convert the api url used for querying to the frontend page url of a term. This works for the EBI url's as the api and frontend url only differ in the api url having an additional /api at the end, but this does not work in general.

I think the best solution for handling linking (as every front page has to do this individually) is to add onNavigateToEntity and onNavigateToOntology functions like in the other widgets. What do you think of this idea @jusa3?

VincentKneip commented 2 months ago

Added onNavigate functions to EntityRelationsWidget and EntityInfoWidget. The behaviour is demonstrated in a new story, in which these functions are used to navigate to the clicked entity's page on EBI OLS.

I discovered 2 problems though:

  1. In the storybook code blocks, the implementation of functions is not shown correctly. On the html storybook it works though. Therefore, an idea to fix this would be to switch to manually render the stories with a render() function as in the html storybook instead of using the automatic component arg currently used in the react storybook
  2. As the onNavigate functions work with button onClick and not with a href, no links are displayed on the bottom left of the browser window as they are for a href. I think we cannot fix that either, as onClick is not evaluated before clicking on it
jusa3 commented 2 months ago
  1. What do you mean by "the implementation of functions is not shown correctly"? Do you mean the code that is shown when clicking on the "Show code" button? It's not exactly what's defined in the story args, but an empty function is perfectly fine IMO.
  2. I don't know how important this feature is... But I don't think it's important enough not to close this issue with your current changes.
VincentKneip commented 2 months ago
  1. Exactly. The code preview displays empty functions, which could be irritating when they indeed cause a noticeable action. For example, the new story implements the onNavigate-functions so that clicking on a link navigates to the entity's page on EBI OLS, but the code preview shows an empty function: grafik
  2. I think this would only be beneficial for transparency reasons, so the user knows where he will be redirected before clicking the link. However, the most important part IMO is that some special entities like owl#Thing are still using a href (because they don't have the same structure in the api response and there are treated differently in the source code), causing an inconsistency. Should I make these also use a button onClick?