Skip to content

Commit

Permalink
Revise initial viewer, fix logo display
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Feb 11, 2018
1 parent 39c0eb3 commit b6db962
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 37 deletions.
58 changes: 22 additions & 36 deletions client/galaxy/scripts/mvc/visualization/visualization-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ var View = Backbone.View.extend({
var self = this;
this.setElement( $( '<div/>' ) );
this.model = new Backbone.Model();
Utils.get({
url : Galaxy.root + 'api/datasets/' + options.dataset_id,
success : function( dataset ) {
if ( dataset.visualizations.length === 0 ) {
self.$el.append( $( '<div/>' ).addClass( 'errormessagelarge' )
.append( $( '<p/>' ).text( 'Unfortunately we could not identify a suitable plugin. Feel free to contact us if you are aware of visualizations for this datatype.' ) ) );
} else {
self.model.set( { 'dataset': dataset } );
self.render();
}
$.ajax({
url: `${Galaxy.root}api/datasets/${options.dataset_id}`
})
.done(dataset => {
if ( dataset.visualizations.length === 0 ) {
self.$el.append( $( '<div/>' ).addClass( 'errormessagelarge' )
.append( $( '<p/>' ).text( 'Unfortunately we could not identify a suitable plugin. Feel free to contact us if you are aware of visualizations for this datatype.' ) ) );
} else {
self.model.set( { 'dataset': dataset } );
self.render();
}
});
},
Expand All @@ -29,18 +29,19 @@ var View = Backbone.View.extend({
var dataset = this.model.get( 'dataset' );
this.vis_index = {};
this.vis_array = [];
_.each( dataset.visualizations, function( v ) {
if ( v.types ) {
_.each( v.types, function( type ) {
var dict = self._getTypeDictionary( v, type );
self.vis_index[ dict.id ] = dict;
self.vis_array.push( dict );
});
} else {
var dict = self._getTypeDictionary( v );
self.vis_index[ dict.id ] = dict;
self.vis_array.push( dict );
_.each( dataset.visualizations, function( v, id ) {
var dict = {
id : id,
name : v.name,
keywords : v.keywords || [],
title : v.title ? type.title + ' (' + v.html + ')' : v.html,
image_src : v.logo ? Galaxy.root + v.logo : null,
description : v.description || 'No description available.',
regular : v.regular,
visualization : v
}
self.vis_index[ dict.id ] = dict;
self.vis_array.push( dict );
});
this.types = new Thumbnails.View({
title_default : 'Suggested plugins',
Expand All @@ -52,21 +53,6 @@ var View = Backbone.View.extend({
}
});
this.$el.empty().append( this.types.$el );
},

/** Build a dictionary for the thumbnail ui element */
_getTypeDictionary: function( visualization, type ) {
type = type || visualization;
return {
id : visualization.name + '_' + type.name,
name : type.name,
keywords : type.keywords || [],
title : type.title ? type.title + ' (' + visualization.html + ')' : visualization.html,
image_src : type.image ? Galaxy.root + type.image : null,
description : type.description || 'No description available.',
regular : type.regular,
visualization : visualization
}
}
});
export default { View: View }
2 changes: 1 addition & 1 deletion lib/galaxy/visualization/plugins/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def _check_path(self, path):
def _set_up_static_images(self):
default_path = 'static/logo.png'
if self._check_path(default_path):
self.config['image'] = 'plugins/%s/%s' % (self.base_url, default_path)
self.config['logo'] = 'plugins/%s/%s' % (self.base_url, default_path)

def _build_render_vars(self, config, trans=None, **kwargs):
"""
Expand Down
1 change: 1 addition & 0 deletions lib/galaxy/visualization/plugins/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def get_visualization(self, trans, visualization_name, target_object):
'html' : visualization.config.get('name'),
'description' : visualization.config.get('description'),
'regular' : visualization.config.get('regular'),
'logo' : visualization.config.get('logo'),
'title' : visualization.config.get('title'),
'target' : visualization.config.get('render_target', 'galaxy_main'),
'embeddable' : visualization.config.get('embeddable', False)
Expand Down

0 comments on commit b6db962

Please sign in to comment.