-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix: Federation portal button link #854
Fix: Federation portal button link #854
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅
@@ -10,4 +11,8 @@ def initialize(name:, link:, color:, tooltip:, light_color:) | |||
@color = color | |||
@light_color = light_color | |||
end | |||
|
|||
def internal? | |||
!link?(@link) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here it should be id.include?($REST_URL)
, because logically this function does not make sense if you are unaware of the existence of ontoportal_ui_link
hack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't got you well, what do you mean by ontoportal_ui_link
hack?
Here basically, when a link is internal we pass it relative like this /ontologies/acronym
and when it is external we pass it absolute like this https://data...
so the first one technically is not considered as a valid link this is why I used the function link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you enforce that internal we pass it relative like this /ontologies/acronym and when it is external we pass it absolute like this https://data...
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the external, no choice it should be absolute.
And for the internal onces, this is the practice that we have in all the app.
What is the case that you have in your mind and can break this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the external, yes.
For the internal, you did this
def ontoportal_ui_link(id)
if id.include?($REST_URL)
return id.gsub($REST_URL,'')
end
which says if I understood well, check if the given link includes the internal rest URL, and in this case remove it from it. So that you enforce that the internal link is not absolute, what I propose is to not have this code and just directly test if includes or not $REST_URL
inside your new function internal?
, with no need for any external expectation of absolute or relative URL.
And also I think that this function does that already https://github.com/ontoportal-lirmm/bioportal_web_ui/blob/master/app/helpers/federation_helper.rb#L65, but to test if does work in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not substruct the $REST_URL
only to use it inside the other component here.
If the url is internal the best practice is to use the relative one instead of the absolute.
And inside the component I built my logic based on that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed, ok
Fix: #853
Changes:
federated portal button
link of the current portal in browse page(5279023)