Skip to content

Add OMERO.web viewer view configurability#4480

Merged
jburel merged 2 commits intoome:developfrom
chris-allan:viewer-view-configurability-5.2
Feb 22, 2016
Merged

Add OMERO.web viewer view configurability#4480
jburel merged 2 commits intoome:developfrom
chris-allan:viewer-view-configurability-5.2

Conversation

@chris-allan
Copy link
Copy Markdown
Member

Add OMERO.web viewer view configurability which allows for the complete override or installation of a redirect view for the existing full viewer. This is particularly useful where an OMERO.web plugin is being used in production that replaces or extends the current full viewer, during development or during proof of concept work on new full viewer technology.

Out of the box there should be no affect on existing functionality. The additional configuration option is omeroweb.web.viewer.view and this accepts a fully qualified view function name which defaults to omeroweb.webclient.views.image_viewer. It can be tested at a very basic level by running the following:

    bin/omero config set omero.web.viewer.view 'omeroweb.webclient.views.list_scripts'

This will display the current list of scripts in the full viewer window, as JSON, when an image thumbnail is doubled clicked on or the "Full Viewer" button in the right hand panel is clicked.

If a plugin wants to perform a conditional redirect, maintaining existing full viewer functionality for the majority of images, adding the following to its urls.py is likely desired:

...
    url(
        r'^vanilla-viewer/(?P<iid>\d+)/$', webclient_views.image_viewer,
        name='myviewer-vanilla-viewer'
    ),
...

A view similar to the following, which would be the target of omero.web.viewer.view, is then possible:

...
@login_required()
def viewer_redirect(request, iid, conn=None, **kwargs):
    """
    Use regular viewer, except when image name contains 'test'
    """
    image = conn.getObject('Image', iid)
    if image is not None:
        try:
            if 'test' in image.name:
                return HttpResponseRedirect(reverse('myviewer-viewer', args=(iid,)))
        except:
            pass
    return HttpResponseRedirect(reverse('myviewer-vanilla-viewer', args=(iid,)))
...

/cc @jburel, @joshmoore

Having this prefix actively prevents the use of other top level packages
within the URL patterns.  It is no longer required and has not been
required for some time.
@will-moore
Copy link
Copy Markdown
Member

This works fine.
It would certainly be useful to have the instructions and code samples above included in our documentation, so that users know how to use this config option, since I think it would often be the case that you'd want to retain the original viewer for some images.
Good to merge.

@jburel
Copy link
Copy Markdown
Member

jburel commented Feb 17, 2016

@will-moore: since you have been updating the doc for the web plugins support, could you take care of adding a section for the new extension option?

@jburel
Copy link
Copy Markdown
Member

jburel commented Feb 22, 2016

@will-moore is taking care of the documentation update.
Merging thanks @chris-allan

jburel added a commit that referenced this pull request Feb 22, 2016
…-5.2

Add OMERO.web viewer view configurability
@jburel jburel merged commit dae6d3a into ome:develop Feb 22, 2016
@will-moore
Copy link
Copy Markdown
Member

Docs PR at ome/omero-documentation#1406

@jburel jburel added this to the 5.2.2 milestone Feb 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants