Skip to content

Configuration of web link-to URL protocol/host#4744

Merged
joshmoore merged 7 commits intoome:metadata52from
manics:metadata52-linkto
Jul 12, 2016
Merged

Configuration of web link-to URL protocol/host#4744
joshmoore merged 7 commits intoome:metadata52from
manics:metadata52-linkto

Conversation

@manics
Copy link
Copy Markdown
Member

@manics manics commented Jul 4, 2016

What this PR does

The web metadata panel Link to this <object> contains a server side URL created from the HTTP Host header. This causes problems with server-side caching.

  • Wherever possible client-side URLs should be constructed in javascript using the location object, so that the /path will be cached but the protocol://host will be handled by the client browser
  • Where this isn't possible (e.g. embedded non-javascript metadata such as URLs parsed by social media) this can be overridden using omero.web.ui.omero.web.ui.external_link_baseurl (this must include the protocol).

Testing this PR

  1. Setup OMERO.web, optionally with a public user (makes testing easier)
  2. Check Link to this <object> in the web RH metadata panel. The URL should use whatever the browser has in the location bar, and in additional examination of the returned html such as http://host/webclient/metadata_details/image/ID/ should show var lnk = location.protocol + "//" + location.host + "/webclient/"; instead of a URL.
  3. Set omero.web.ui.omero.web.ui.external_link_baseurl: If twitter or opengraph is enabled the html for the full image viewer should contain URLs with this value instead of the Host header.

Related reading

Link to cards, tickets, other PRs:

Note

The only other place I'm aware of that let's you copy a link is in the full image viewer where it is already generated by client-side javascript: https://github.com/manics/openmicroscopy/blob/metadata52-linkto/components/tools/OmeroWeb/omeroweb/webgateway/templates/webgateway/viewport/omero_image.html#L665

This is unchanged, but maybe it should be unified?

Note: Description updated 2016-07-07

@@ -105,6 +105,8 @@
$("#link_info_popup").show();
{% if webclient_path %}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it not enough to just delete that if?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept it at first in case anyone wanted the old behaviour. If you're happy (as far as I know the Javascript below should work) I'll remove it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want to maintain the old logic then you need to keep request.build_absolute_uri(reverse('webindex')) rather then JS created link twice. The code below has no sense to me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the previous discussion my impression was that we want to remove usage of build_absolute_uri

Copy link
Copy Markdown
Member

@atarkowska atarkowska Jul 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

@manics manics Jul 6, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the previous discussion my impression was that we want to remove usage of build_absolute_uri

I agree, I was just a bit hesitant to do the full cleanup because I don't understand why the else is there. I'll remove it if no-one can see a reason for it.

This removes the need for another config property
@manics
Copy link
Copy Markdown
Member Author

manics commented Jul 4, 2016

@aleksandra-tarkowska Updated

@atarkowska
Copy link
Copy Markdown
Member

atarkowska commented Jul 4, 2016

thx, but I think you also need to fix batch annotations. Why we need new property in a viewer then?

@manics
Copy link
Copy Markdown
Member Author

manics commented Jul 5, 2016

The last commit changes batch-annotate to use client-side JS.

The additional property omero.web.ui.default_client_baseurl is for absolute URLs that need to be generated as HTML instead of JS. The only uses I'm aware of are the URLs for Twitter and Opengraph integration #4613, currently only on metadata52, so I put those changes in a separate commit f8d8272

manics added 2 commits July 7, 2016 16:00
This more accurately reflects how it's currently used (twitter and opengraph integration)
@manics
Copy link
Copy Markdown
Member Author

manics commented Jul 7, 2016

I've removed the else. I've also renamed the new property to omero.web.ui.external_link_baseurl.

@atarkowska
Copy link
Copy Markdown
Member

looks good to me

@joshmoore
Copy link
Copy Markdown
Member

Merging for metadata52. I assume before hitting the mainline this will need a discussion re: the unification that's mentioned in the description as well as documentation on what all values may need to be set and kept in sync. (If this is the one end-all-be-all property, then likely a shorter name would be appropriate)

@manics
Copy link
Copy Markdown
Member Author

manics commented Aug 19, 2016

Partially
--rebased-to #4792

@manics
Copy link
Copy Markdown
Member Author

manics commented Apr 10, 2017

--rebased-to #5244
--rebased-to #5245

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants