Skip to content

Commit

Permalink
Merge pull request #3 from galaxyproject/dev
Browse files Browse the repository at this point in the history
Merge from upstream
  • Loading branch information
pvanheus authored Jun 20, 2017
2 parents 0db0d7b + 89851e4 commit 7dab2aa
Show file tree
Hide file tree
Showing 257 changed files with 4,708 additions and 3,251 deletions.
1 change: 0 additions & 1 deletion .ci/flake8_lint_include_list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ cron/cleanup_datasets.py
cron/parse_builds_3_sites.py
cron/parse_builds.py
doc/parse_gx_xsd.py
doc/patch.py
lib/galaxy/actions/
lib/galaxy/auth/
lib/galaxy/config.py
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ tool-data/genome/*
tool-data/*.sample
tool-data/testtoolshed.g2.bx.psu.edu/
tool-data/toolshed.g2.bx.psu.edu/
tool-data/**/*.fa
tool-data/**/*.fa

# Test output
test-data-cache
Expand Down Expand Up @@ -135,4 +135,3 @@ doc/source/dev/schema.rst
.DS_Store
*.rej
*~
.idea/
16 changes: 16 additions & 0 deletions client/galaxy/scripts/apps/analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ var jQuery = require( 'jquery' ),
UserPreferences = require( 'mvc/user/user-preferences' ),
CustomBuilds = require( 'mvc/user/user-custom-builds' ),
Tours = require( 'mvc/tours' ),
GridView = require( 'mvc/grid/grid-view' ),
PageList = require( 'mvc/page/page-list' ),
Workflows = require( 'mvc/workflow/workflow' ),
WorkflowsConfigureMenu = require( 'mvc/workflow/workflow-configure-menu' );

Expand Down Expand Up @@ -80,6 +82,8 @@ window.app = function app( options, bootstrapped ){
'(/)user(/)' : 'show_user',
'(/)user(/)(:form_id)' : 'show_user_form',
'(/)workflow(/)' : 'show_workflows',
'(/)pages(/)(:action_id)' : 'show_pages',
'(/)datasets(/)(:action_id)' : 'show_datasets',
'(/)workflow/configure_menu(/)' : 'show_configure_menu',
'(/)custom_builds' : 'show_custom_builds'
},
Expand Down Expand Up @@ -115,6 +119,18 @@ window.app = function app( options, bootstrapped ){
this.page.display( new UserPreferences.Forms( { form_id: form_id, user_id: Galaxy.params.id } ) );
},

show_datasets : function() {
this.page.display( new GridView( { url_base: Galaxy.root + 'dataset/list', dict_format: true } ) );
},

show_pages : function( action_id ) {
if ( action_id == 'list' ) {
this.page.display( new PageList.View() );
} else {
this.page.display( new GridView( { url_base: Galaxy.root + 'page/list_published', dict_format: true } ) );
}
},

show_workflows : function(){
this.page.display( new Workflows.View() );
},
Expand Down
20 changes: 14 additions & 6 deletions client/galaxy/scripts/layout/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var Collection = Backbone.Collection.extend({
url : 'visualization/list_published'
},{
title : _l('Pages'),
url : 'page/list_published'
url : 'pages/list_published'
}]
});

Expand Down Expand Up @@ -122,13 +122,21 @@ var Collection = Backbone.Collection.extend({
$.each(webhooks.models, function(index, model) {
var webhook = model.toJSON();
if (webhook.activate) {
self.add({
var obj = {
id : webhook.name,
icon : webhook.config.icon,
url : webhook.config.url,
tooltip : webhook.config.tooltip,
onclick : webhook.config.function && new Function(webhook.config.function),
});
};

// Galaxy.page is undefined for data libraries, workflows pages
if( Galaxy.page ) {
Galaxy.page.masthead.collection.add(obj);
}
else if( Galaxy.masthead ) {
Galaxy.masthead.collection.add(obj);
}
}
});
});
Expand Down Expand Up @@ -271,11 +279,11 @@ var Collection = Backbone.Collection.extend({
target : 'galaxy_main'
},{
title : _l('Saved Datasets'),
url : 'dataset/list',
target : 'galaxy_main'
url : 'datasets/list',
target : '_top'
},{
title : _l('Saved Pages'),
url : 'page/list',
url : 'pages/list',
target : '_top'
}]
};
Expand Down
10 changes: 9 additions & 1 deletion client/galaxy/scripts/mvc/collection/collection-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ var CollectionView = _super.extend(
this.parentName = attributes.parentName;
/** foldout or drilldown */
this.foldoutStyle = attributes.foldoutStyle || 'foldout';
this.downloadUrl = this.model.attributes.url + '/download';
},

_queueNewRender : function( $newRender, speed ) {
Expand Down Expand Up @@ -171,7 +172,14 @@ CollectionView.prototype.templates = (function(){
'</div>',

'<div class="tags-display"></div>',
'</div>'

'<div class="actions">',
'<a class="download-btn icon-btn" ',
'href="<%- view.downloadUrl %>', '" title="" download="" data-original-title="Download Collection">',
'<span class="fa fa-floppy-o"></span>',
'</a>',
'</div>',
'</div>',
], 'collection' );

return _.extend( _.clone( _super.prototype.templates ), {
Expand Down
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mvc/dataset/dataset-li.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ var DatasetListItemView = _super.extend(

_renderNametags : function(){
var tpl = _.template([
'<% _.each(_.uniq(tags), function(tag){ %>',
'<% _.each(_.sortBy(_.uniq(tags), function(x) { return x }), function(tag){ %>',
'<% if (tag.indexOf("name:") == 0){ %>',
'<span class="label label-info"><%- tag.slice(5) %></span>',
'<% } %>',
Expand Down
8 changes: 7 additions & 1 deletion client/galaxy/scripts/mvc/form/form-input.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ define([], function() {
text_enable : this.app_options.text_enable || 'Enable',
text_disable : this.app_options.text_disable || 'Disable',
cls_enable : this.app_options.cls_enable || 'fa fa-caret-square-o-down',
cls_disable : this.app_options.cls_disable || 'fa fa-caret-square-o-up'
cls_disable : this.app_options.cls_disable || 'fa fa-caret-square-o-up',
always_refresh : this.app_options.always_refresh
}).set( options );

// set element and link components
Expand Down Expand Up @@ -44,6 +45,11 @@ define([], function() {
app.trigger && app.trigger( 'change' );
self.render();
});

// hide error on value change
if ( this.field.model && !this.model.get( 'always_refresh' ) ) {
this.listenTo( this.field.model, 'change:value', function() { self.reset() } );
}
},

/** Set backdrop for input element */
Expand Down
4 changes: 2 additions & 2 deletions client/galaxy/scripts/mvc/grid/grid-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ return {
}
return tmpl;
},

// template
footer: function(options) {

Expand Down Expand Up @@ -304,7 +304,7 @@ return {
'<input type="hidden" id="operation" name="operation" value="">' +
'<td></td>' +
'<td colspan="100">' +
'For <span class="grid-selected-count"></span> selected ' + options.get_class_plural + ': ';
'For <span class="grid-selected-count"></span> selected items: ';

// configure buttons for operations
for (i in options.operations) {
Expand Down
42 changes: 34 additions & 8 deletions client/galaxy/scripts/mvc/grid/grid-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ jQuery.ajaxSettings.traditional = true;

// dependencies
define([
'utils/utils',
'mvc/grid/grid-model',
'mvc/grid/grid-template',
"mvc/ui/popup-menu"
], function(GridModel, Templates, PopupMenu) {
], function(Utils, GridModel, Templates, PopupMenu) {

// grid view
return Backbone.View.extend({
Expand All @@ -18,8 +19,36 @@ return Backbone.View.extend({
// Initialize
initialize: function(grid_config)
{
this.dict_format = grid_config.dict_format;
var self = this;
window.add_tag_to_grid_filter = function( tag_name, tag_value ){
// Put tag name and value together.
var tag = tag_name + ( tag_value !== undefined && tag_value !== "" ? ":" + tag_value : "" );
var advanced_search = $( '#advanced-search').is(":visible" );
if( !advanced_search ){
$('#standard-search').slideToggle('fast');
$('#advanced-search').slideToggle('fast');
}
self.add_filter_condition( "tags", tag );
};

// set element
this.setElement('#grid-container');
if ( this.dict_format ) {
this.setElement('<div/>');
if ( grid_config.url_base && !grid_config.items ) {
Utils.get({
url: grid_config.url_base,
success: function( response ) {
self.init_grid( response );
}
});
} else {
this.init_grid(grid_config);
}
} else {
this.setElement('#grid-container');
this.init_grid(grid_config);
}

// fix padding
if (grid_config.use_panels) {
Expand All @@ -28,9 +57,6 @@ return Backbone.View.extend({
overflow : 'auto'
});
}

// initialize controls
this.init_grid(grid_config);
},

// refresh frames
Expand Down Expand Up @@ -545,7 +571,7 @@ return Backbone.View.extend({
});

// Do operation. If operation cannot be performed asynchronously, redirect to location.
if (this.grid.can_async_op(operation)) {
if (this.grid.can_async_op(operation) || this.dict_format) {
this.update_grid();
} else {
this.go_to(target, href);
Expand All @@ -562,7 +588,7 @@ return Backbone.View.extend({
}

// refresh grid
if (this.grid.get('async')) {
if (this.grid.get('async') || this.dict_format) {
this.update_grid();
} else {
this.go_to(target, href);
Expand Down Expand Up @@ -630,7 +656,7 @@ return Backbone.View.extend({
var insert = self.grid.get('insert');

// request new configuration
var json = $.parseJSON(response_text);
var json = self.dict_format ? response_text : $.parseJSON(response_text);

// update
json.embedded = embedded;
Expand Down
4 changes: 2 additions & 2 deletions client/galaxy/scripts/mvc/history/hda-li.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var _super = DATASET_LI.DatasetListItemView;
var HDAListItemView = _super.extend(
/** @lends HDAListItemView.prototype */{

className : _super.prototype.className + " history-content",
className : _super.prototype.className + " history-content",

initialize : function( attributes, options ){
_super.prototype.initialize.call( this, attributes, options );
Expand Down Expand Up @@ -45,7 +45,7 @@ HDAListItemView.prototype.templates = (function(){
'</div>',
'</br>',
'<span class="nametags">',
'<% _.each(dataset.tags, function(tag){ %>',
'<% _.each(_.sortBy(_.uniq(dataset.tags), function(x) { return x }), function(tag){ %>',
'<% if (tag.indexOf("name:") == 0){ %>',
'<span class="label label-info"><%- tag.slice(5) %></span>',
'<% } %>',
Expand Down
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mvc/history/hdca-li.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ HDCAListItemView.prototype.templates = (function(){
'</div>',
'<div class="subtitle"></div>',
'<span class="nametags">',
'<% _.each(_.uniq(collection.tags), function(tag){ %>',
'<% _.each(_.sortBy(_.uniq(collection.tags), function(x) { return x }), function(tag){ %>',
'<% if (tag.indexOf("name:") == 0){ %>',
'<span class="label label-info"><%- tag.slice(5) %></span>',
'<% } %>',
Expand Down
56 changes: 56 additions & 0 deletions client/galaxy/scripts/mvc/page/page-list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/** This class renders the page list. */
define( [ 'utils/utils', 'mvc/grid/grid-view' ], function( Utils, GridView ) {
var View = Backbone.View.extend({
initialize: function( options ) {
var self = this;
this.setElement( $( '<div/>' ) );
this.model = new Backbone.Model();
Utils.get({
url : Galaxy.root + 'page/list',
success : function( response ) {
response[ 'dict_format' ] = true;
self.model.set( response );
self.render();
}
});
},

render: function() {
var grid = new GridView( this.model.attributes );
this.$el.empty().append( grid.$el );
this.$el.append( this._templateShared() );
},

_templateShared: function() {
var $tmpl = $( '<div>' +
'<h2>Pages shared with you by others</h2>' +
'</div>' );
var options = this.model.attributes;
if ( options.shared_by_others && options.shared_by_others.length > 0 ) {
var $table = $( '<table class="colored" border="0" cellspacing="0" cellpadding="0" width="100%">' +
'<tr class="header">' +
'<th>Title</th>' +
'<th>Owner</th>' +
'</tr>' +
'</table>' );
_.each( options.shared_by_others, function( page, index ) {
var display_url = Galaxy.root + 'page/display_by_username_and_slug?username=' + page.username + '&slug=' + page.slug;
$table.append( '<tr>' +
'<td>' +
'<a href="' + display_url + '">' + _.escape( page.title ) + '</a>' +
'</td>' +
'<td>' + _.escape( page.username ) + '</td>' +
'</tr>' );
});
$tmpl.append( $table );
} else {
$tmpl.append( 'No pages have been shared with you.' );
}
return $tmpl;
}
});

return {
View: View
}
});
16 changes: 16 additions & 0 deletions client/galaxy/scripts/mvc/tool/tool-form-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,22 @@ define( [ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view
});
}

// add tool menu webhooks
$.getJSON('/api/webhooks/tool-menu/all', function(webhooks) {
_.each(webhooks, function(webhook) {
if (webhook.activate && webhook.config.function) {
menu_button.addMenu({
icon : webhook.config.icon,
title : webhook.config.title,
onclick : function() {
var func = new Function('options', webhook.config.function);
func(options);
}
});
}
});
});

return {
menu : menu_button,
versions : versions_button
Expand Down
4 changes: 3 additions & 1 deletion client/galaxy/scripts/mvc/tool/tool-form-composite.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,9 @@ define([ 'utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view'
if ($.isArray( response ) && response.length > 0) {
self.$el.append( $( '<div/>', { id: 'webhook-view' } ) );
var WebhookApp = new Webhooks.WebhookView({
urlRoot: Galaxy.root + 'api/webhooks/workflow'
urlRoot: Galaxy.root + 'api/webhooks/workflow',
toolId: job_def.tool_id,
toolVersion: job_def.tool_version,
});
}

Expand Down
3 changes: 2 additions & 1 deletion client/galaxy/scripts/mvc/tool/tool-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ define([ 'utils/utils', 'mvc/ui/ui-misc', 'mvc/ui/ui-modal', 'mvc/tool/tool-form
if ( response.jobs && response.jobs.length > 0 ) {
self.$el.append( $( '<div/>', { id: 'webhook-view' } ) );
var WebhookApp = new Webhooks.WebhookView({
urlRoot: Galaxy.root + 'api/webhooks/tool'
urlRoot: Galaxy.root + 'api/webhooks/tool',
toolId: job_def.tool_id
});
}
parent.Galaxy && parent.Galaxy.currHistoryPanel && parent.Galaxy.currHistoryPanel.refreshContents();
Expand Down
Loading

0 comments on commit 7dab2aa

Please sign in to comment.