galaxy-commits
Threads by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 15302 discussions
commit/galaxy-central: dannon: Merged in jmchilton/galaxy-central-fork-1 (pull request #558)
by commits-noreply@bitbucket.org 13 Nov '14
by commits-noreply@bitbucket.org 13 Nov '14
13 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/77676b985228/
Changeset: 77676b985228
User: dannon
Date: 2014-11-13 17:18:32+00:00
Summary: Merged in jmchilton/galaxy-central-fork-1 (pull request #558)
Make JSONType columns bigger in MySQL
Affected #: 2 files
diff -r 7f247bf156dfc7cfa7f764cf9757ae3839f0b72c -r 77676b9852282c0a240ebebb410374b233a1fa36 lib/galaxy/model/custom_types.py
--- a/lib/galaxy/model/custom_types.py
+++ b/lib/galaxy/model/custom_types.py
@@ -65,6 +65,13 @@
def is_mutable( self ):
return True
+ def load_dialect_impl(self, dialect):
+ if dialect.name == "mysql":
+ return dialect.type_descriptor(sqlalchemy.dialects.mysql.MEDIUMBLOB)
+ else:
+ return self.impl
+
+
metadata_pickler = AliasPickleModule( {
( "cookbook.patterns", "Bunch" ) : ( "galaxy.util.bunch" , "Bunch" )
} )
diff -r 7f247bf156dfc7cfa7f764cf9757ae3839f0b72c -r 77676b9852282c0a240ebebb410374b233a1fa36 lib/galaxy/model/migrate/versions/0122_grow_mysql_blobs.py
--- /dev/null
+++ b/lib/galaxy/model/migrate/versions/0122_grow_mysql_blobs.py
@@ -0,0 +1,58 @@
+"""
+Migration script to grow MySQL blobs.
+"""
+
+from sqlalchemy import MetaData
+
+import datetime
+now = datetime.datetime.utcnow
+
+import logging
+log = logging.getLogger( __name__ )
+
+metadata = MetaData()
+
+BLOB_COLUMNS = [
+ ("deferred_job", "params"),
+ ("extended_metadata", "data"),
+ ("form_definition", "fields"),
+ ("form_definition", "layout"),
+ ("form_values", "content"),
+ ("history_dataset_association", "metadata"),
+ ("job", "destination_params"),
+ ("library_dataset_dataset_association", "metadata"),
+ ("post_job_action", "action_arguments"),
+ ("request", "notification"),
+ ("sample", "workflow"),
+ ("transfer_job", "params"),
+ ("workflow_step", "tool_inputs"),
+ ("workflow_step", "tool_errors"),
+ ("workflow_step", "position"),
+ ("workflow_step", "config"),
+ ("tool_shed_repository", "metadata"),
+ ("tool_shed_repository", "tool_shed_status"),
+]
+
+
+def upgrade(migrate_engine):
+ metadata.bind = migrate_engine
+ print __doc__
+ metadata.reflect()
+
+ if migrate_engine.name != "mysql":
+ return
+
+ for (table, column) in BLOB_COLUMNS:
+ cmd = "ALTER TABLE %s MODIFY COLUMN %s MEDIUMBLOB;" % (table, column)
+ try:
+ migrate_engine.execute( cmd )
+ except Exception as e:
+ print "Failed to grow column %s.%s" % (table, column)
+ print str( e )
+
+
+def downgrade(migrate_engine):
+ metadata.bind = migrate_engine
+ metadata.reflect()
+ # Ignoring..., changed the datatype so no guarantee these columns weren't
+ # MEDIUMBLOBs before.
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/a94274cfff4c/
Changeset: a94274cfff4c
User: jmchilton
Date: 2014-11-12 17:46:43+00:00
Summary: Make JSONType a MEDIUMBLOB instead of a BLOB under mysql.
These can have 16 MB of data instead of 65 KB - tool shed repositories have encountered problems with the 65 KB limit - though other columns might as well.
Affected #: 1 file
diff -r f26c2543ff053b9ff31617bc03f99d505302ecda -r a94274cfff4c79d235347ff2c8ebcbd2f10eb96c lib/galaxy/model/custom_types.py
--- a/lib/galaxy/model/custom_types.py
+++ b/lib/galaxy/model/custom_types.py
@@ -65,6 +65,13 @@
def is_mutable( self ):
return True
+ def load_dialect_impl(self, dialect):
+ if dialect.name == "mysql":
+ return dialect.type_descriptor(sqlalchemy.dialects.mysql.MEDIUMBLOB)
+ else:
+ return self.impl
+
+
metadata_pickler = AliasPickleModule( {
( "cookbook.patterns", "Bunch" ) : ( "galaxy.util.bunch" , "Bunch" )
} )
https://bitbucket.org/galaxy/galaxy-central/commits/6b5cd9839533/
Changeset: 6b5cd9839533
User: jmchilton
Date: 2014-11-12 17:46:43+00:00
Summary: Database migration to grow mysql blobs.
Should address the following issues
https://trello.com/c/RbW6pOd2
https://trello.com/c/lvz4OQR1
https://trello.com/c/Hv5iIweU
Affected #: 1 file
diff -r a94274cfff4c79d235347ff2c8ebcbd2f10eb96c -r 6b5cd9839533db4365ae8cc51a19c37dbe4c2a08 lib/galaxy/model/migrate/versions/0122_grow_mysql_blobs.py
--- /dev/null
+++ b/lib/galaxy/model/migrate/versions/0122_grow_mysql_blobs.py
@@ -0,0 +1,58 @@
+"""
+Migration script to grow MySQL blobs.
+"""
+
+from sqlalchemy import MetaData
+
+import datetime
+now = datetime.datetime.utcnow
+
+import logging
+log = logging.getLogger( __name__ )
+
+metadata = MetaData()
+
+BLOB_COLUMNS = [
+ ("deferred_job", "params"),
+ ("extended_metadata", "data"),
+ ("form_definition", "fields"),
+ ("form_definition", "layout"),
+ ("form_values", "content"),
+ ("history_dataset_association", "metadata"),
+ ("job", "destination_params"),
+ ("library_dataset_dataset_association", "metadata"),
+ ("post_job_action", "action_arguments"),
+ ("request", "notification"),
+ ("sample", "workflow"),
+ ("transfer_job", "params"),
+ ("workflow_step", "tool_inputs"),
+ ("workflow_step", "tool_errors"),
+ ("workflow_step", "position"),
+ ("workflow_step", "config"),
+ ("tool_shed_repository", "metadata"),
+ ("tool_shed_repository", "tool_shed_status"),
+]
+
+
+def upgrade(migrate_engine):
+ metadata.bind = migrate_engine
+ print __doc__
+ metadata.reflect()
+
+ if migrate_engine.name != "mysql":
+ return
+
+ for (table, column) in BLOB_COLUMNS:
+ cmd = "ALTER TABLE %s MODIFY COLUMN %s MEDIUMBLOB;" % (table, column)
+ try:
+ migrate_engine.execute( cmd )
+ except Exception as e:
+ print "Failed to grow column %s.%s" % (table, column)
+ print str( e )
+
+
+def downgrade(migrate_engine):
+ metadata.bind = migrate_engine
+ metadata.reflect()
+ # Ignoring..., changed the datatype so no guarantee these columns weren't
+ # MEDIUMBLOBs before.
https://bitbucket.org/galaxy/galaxy-central/commits/77676b985228/
Changeset: 77676b985228
User: dannon
Date: 2014-11-13 17:18:32+00:00
Summary: Merged in jmchilton/galaxy-central-fork-1 (pull request #558)
Make JSONType columns bigger in MySQL
Affected #: 2 files
diff -r 7f247bf156dfc7cfa7f764cf9757ae3839f0b72c -r 77676b9852282c0a240ebebb410374b233a1fa36 lib/galaxy/model/custom_types.py
--- a/lib/galaxy/model/custom_types.py
+++ b/lib/galaxy/model/custom_types.py
@@ -65,6 +65,13 @@
def is_mutable( self ):
return True
+ def load_dialect_impl(self, dialect):
+ if dialect.name == "mysql":
+ return dialect.type_descriptor(sqlalchemy.dialects.mysql.MEDIUMBLOB)
+ else:
+ return self.impl
+
+
metadata_pickler = AliasPickleModule( {
( "cookbook.patterns", "Bunch" ) : ( "galaxy.util.bunch" , "Bunch" )
} )
diff -r 7f247bf156dfc7cfa7f764cf9757ae3839f0b72c -r 77676b9852282c0a240ebebb410374b233a1fa36 lib/galaxy/model/migrate/versions/0122_grow_mysql_blobs.py
--- /dev/null
+++ b/lib/galaxy/model/migrate/versions/0122_grow_mysql_blobs.py
@@ -0,0 +1,58 @@
+"""
+Migration script to grow MySQL blobs.
+"""
+
+from sqlalchemy import MetaData
+
+import datetime
+now = datetime.datetime.utcnow
+
+import logging
+log = logging.getLogger( __name__ )
+
+metadata = MetaData()
+
+BLOB_COLUMNS = [
+ ("deferred_job", "params"),
+ ("extended_metadata", "data"),
+ ("form_definition", "fields"),
+ ("form_definition", "layout"),
+ ("form_values", "content"),
+ ("history_dataset_association", "metadata"),
+ ("job", "destination_params"),
+ ("library_dataset_dataset_association", "metadata"),
+ ("post_job_action", "action_arguments"),
+ ("request", "notification"),
+ ("sample", "workflow"),
+ ("transfer_job", "params"),
+ ("workflow_step", "tool_inputs"),
+ ("workflow_step", "tool_errors"),
+ ("workflow_step", "position"),
+ ("workflow_step", "config"),
+ ("tool_shed_repository", "metadata"),
+ ("tool_shed_repository", "tool_shed_status"),
+]
+
+
+def upgrade(migrate_engine):
+ metadata.bind = migrate_engine
+ print __doc__
+ metadata.reflect()
+
+ if migrate_engine.name != "mysql":
+ return
+
+ for (table, column) in BLOB_COLUMNS:
+ cmd = "ALTER TABLE %s MODIFY COLUMN %s MEDIUMBLOB;" % (table, column)
+ try:
+ migrate_engine.execute( cmd )
+ except Exception as e:
+ print "Failed to grow column %s.%s" % (table, column)
+ print str( e )
+
+
+def downgrade(migrate_engine):
+ metadata.bind = migrate_engine
+ metadata.reflect()
+ # Ignoring..., changed the datatype so no guarantee these columns weren't
+ # MEDIUMBLOBs before.
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: History panel: fix dataset count off by one error
by commits-noreply@bitbucket.org 13 Nov '14
by commits-noreply@bitbucket.org 13 Nov '14
13 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/7f247bf156df/
Changeset: 7f247bf156df
User: carlfeberhard
Date: 2014-11-13 16:52:21+00:00
Summary: History panel: fix dataset count off by one error
Affected #: 3 files
diff -r e802fed907e5341d2d50c94d546a65faf3978a1a -r 7f247bf156dfc7cfa7f764cf9757ae3839f0b72c client/galaxy/scripts/mvc/history/history-panel-edit.js
--- a/client/galaxy/scripts/mvc/history/history-panel-edit.js
+++ b/client/galaxy/scripts/mvc/history/history-panel-edit.js
@@ -354,20 +354,20 @@
* @param {Model} the item model to check
*/
_handleHdaDeletionChange : function( itemModel ){
- this._renderCounts();
if( itemModel.get( 'deleted' ) && !this.showDeleted ){
this.removeItemView( itemModel );
}
+ this._renderCounts();
},
/** If this item is hidden and we're not showing hidden items, remove the view
* @param {Model} the item model to check
*/
_handleHdaVisibleChange : function( itemModel ){
- this._renderCounts();
if( itemModel.hidden() && !this.storage.showHidden ){
this.removeItemView( itemModel );
}
+ this._renderCounts();
},
/** toggle the visibility of each content's tagsEditor applying all the args sent to this function */
diff -r e802fed907e5341d2d50c94d546a65faf3978a1a -r 7f247bf156dfc7cfa7f764cf9757ae3839f0b72c static/scripts/mvc/history/history-panel-edit.js
--- a/static/scripts/mvc/history/history-panel-edit.js
+++ b/static/scripts/mvc/history/history-panel-edit.js
@@ -354,20 +354,20 @@
* @param {Model} the item model to check
*/
_handleHdaDeletionChange : function( itemModel ){
- this._renderCounts();
if( itemModel.get( 'deleted' ) && !this.showDeleted ){
this.removeItemView( itemModel );
}
+ this._renderCounts();
},
/** If this item is hidden and we're not showing hidden items, remove the view
* @param {Model} the item model to check
*/
_handleHdaVisibleChange : function( itemModel ){
- this._renderCounts();
if( itemModel.hidden() && !this.storage.showHidden ){
this.removeItemView( itemModel );
}
+ this._renderCounts();
},
/** toggle the visibility of each content's tagsEditor applying all the args sent to this function */
diff -r e802fed907e5341d2d50c94d546a65faf3978a1a -r 7f247bf156dfc7cfa7f764cf9757ae3839f0b72c static/scripts/packed/mvc/history/history-panel-edit.js
--- a/static/scripts/packed/mvc/history/history-panel-edit.js
+++ b/static/scripts/packed/mvc/history/history-panel-edit.js
@@ -1,1 +1,1 @@
-define(["mvc/history/history-panel","mvc/history/history-contents","mvc/dataset/states","mvc/history/hda-model","mvc/history/hda-li-edit","mvc/history/hdca-li-edit","mvc/tags","mvc/annotations","utils/localization"],function(f,h,k,d,c,g,j,a,b){var i=f.HistoryPanel;var e=i.extend({HDAViewClass:c.HDAListItemEdit,HDCAViewClass:g.HDCAListItemEdit,initialize:function(l){l=l||{};i.prototype.initialize.call(this,l);this.tagsEditor=null;this.annotationEditor=null;this.purgeAllowed=l.purgeAllowed||false;this.annotationEditorShown=l.annotationEditorShown||false;this.tagsEditorShown=l.tagsEditorShown||false;this.multiselectActions=l.multiselectActions||this._getActions()},_setUpListeners:function(){i.prototype._setUpListeners.call(this);this.on("drop",function(l,m){this.dataDropped(m);this.dropTargetOff()})},_setUpCollectionListeners:function(){i.prototype._setUpCollectionListeners.call(this);this.collection.on("change:deleted",this._handleHdaDeletionChange,this);this.collection.on("change:visible",this._handleHdaVisibleChange,this);this.collection.on("change:purged",function(l){this.model.fetch()},this);return this},_setUpModelListeners:function(){i.prototype._setUpModelListeners.call(this);this.model.on("change:nice_size",this.updateHistoryDiskSize,this);return this},_buildNewRender:function(){var l=i.prototype._buildNewRender.call(this);if(!this.model){return l}if(Galaxy&&Galaxy.currUser&&Galaxy.currUser.id&&Galaxy.currUser.id===this.model.get("user_id")){this._renderTags(l);this._renderAnnotation(l)}return l},renderItems:function(m){var l=i.prototype.renderItems.call(this,m);this._renderCounts(m);return l},_renderCounts:function(n){function m(q,r){return['<a class="',q,'" href="javascript:void(0);">',r,"</a>"].join("")}n=n||this.$el;var l=this.collection.where({deleted:true}),p=this.collection.where({visible:false}),o=[];if(this.views.length){o.push([this.views.length,b("shown")].join(" "))}if(l.length){o.push((!this.showDeleted)?([l.length,m("toggle-deleted-link",b("deleted"))].join(" ")):(m("toggle-deleted-link",b("hide deleted"))))}if(p.length){o.push((!this.showHidden)?([p.length,m("toggle-hidden-link",b("hidden"))].join(" ")):(m("toggle-hidden-link",b("hide hidden"))))}return n.find("> .controls .subtitle").html(o.join(", "))},_renderTags:function(l){var m=this;this.tagsEditor=new j.TagsEditor({model:this.model,el:l.find(".controls .tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){m.toggleHDATagEditors(true,m.fxSpeed)},onhide:function(){m.toggleHDATagEditors(false,m.fxSpeed)},$activator:faIconButton({title:b("Edit history tags"),classes:"history-tag-btn",faIcon:"fa-tags"}).appendTo(l.find(".controls .actions"))})},_renderAnnotation:function(l){var m=this;this.annotationEditor=new a.AnnotationEditor({model:this.model,el:l.find(".controls .annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){m.toggleHDAAnnotationEditors(true,m.fxSpeed)},onhide:function(){m.toggleHDAAnnotationEditors(false,m.fxSpeed)},$activator:faIconButton({title:b("Edit history annotation"),classes:"history-annotate-btn",faIcon:"fa-comment"}).appendTo(l.find(".controls .actions"))})},_setUpBehaviors:function(l){l=l||this.$el;i.prototype._setUpBehaviors.call(this,l);if(!this.model){return}if(this.multiselectActions.length){this.actionsPopup=new PopupMenu(l.find(".list-action-popup-btn"),this.multiselectActions)}if((!Galaxy.currUser||Galaxy.currUser.isAnonymous())||(Galaxy.currUser.id!==this.model.get("user_id"))){return}var m=this,n=".controls .name";l.find(n).attr("title",b("Click to rename history")).tooltip({placement:"bottom"}).make_text_editable({on_finish:function(o){var p=m.model.get("name");if(o&&o!==p){m.$el.find(n).text(o);m.model.save({name:o}).fail(function(){m.$el.find(n).text(m.model.previous("name"))})}else{m.$el.find(n).text(p)}}})},_getActions:function(){var l=this,m=[{html:b("Hide datasets"),func:function(){var n=d.HistoryDatasetAssociation.prototype.hide;l.getSelectedModels().ajaxQueue(n)}},{html:b("Unhide datasets"),func:function(){var n=d.HistoryDatasetAssociation.prototype.unhide;l.getSelectedModels().ajaxQueue(n)}},{html:b("Delete datasets"),func:function(){var n=d.HistoryDatasetAssociation.prototype["delete"];l.getSelectedModels().ajaxQueue(n)}},{html:b("Undelete datasets"),func:function(){var n=d.HistoryDatasetAssociation.prototype.undelete;l.getSelectedModels().ajaxQueue(n)}}];if(l.purgeAllowed){m.push({html:b("Permanently delete datasets"),func:function(){if(confirm(b("This will permanently remove the data in your datasets. Are you sure?"))){var n=d.HistoryDatasetAssociation.prototype.purge;l.getSelectedModels().ajaxQueue(n)}}})}m.push({html:b("Build Dataset List"),func:function(){l.getSelectedModels().promoteToHistoryDatasetCollection(l.model,"list")}});m.push({html:b("Build Dataset Pair"),func:function(){l.getSelectedModels().promoteToHistoryDatasetCollection(l.model,"paired")}});m.push({html:b("Build List of Dataset Pairs"),func:_.bind(l._showPairedCollectionModal,l)});return m},_showPairedCollectionModal:function(){var l=this,m=l.getSelectedModels().toJSON().filter(function(n){return n.history_content_type==="dataset"&&n.state===k.OK});if(m.length){require(["mvc/collection/paired-collection-creator"],function(n){window.creator=n.pairedCollectionCreatorModal(m,{historyId:l.model.id})})}else{}},_attachItems:function(l){this.$list(l).append(this.views.reverse().map(function(m){return m.$el}));return this},_attachView:function(m){var l=this;l.views.unshift(m);l.$list().prepend(m.render(0).$el.hide());m.$el.slideDown(l.fxSpeed)},_getItemViewOptions:function(m){var l=i.prototype._getItemViewOptions.call(this,m);_.extend(l,{purgeAllowed:this.purgeAllowed,tagsEditorShown:(this.tagsEditor&&!this.tagsEditor.hidden),annotationEditorShown:(this.annotationEditor&&!this.annotationEditor.hidden)});return l},_handleHdaDeletionChange:function(l){this._renderCounts();if(l.get("deleted")&&!this.showDeleted){this.removeItemView(l)}},_handleHdaVisibleChange:function(l){this._renderCounts();if(l.hidden()&&!this.storage.showHidden){this.removeItemView(l)}},toggleHDATagEditors:function(l){var m=Array.prototype.slice.call(arguments,1);_.each(this.views,function(n){if(n.tagsEditor){n.tagsEditor.toggle.apply(n.tagsEditor,m)}})},toggleHDAAnnotationEditors:function(l){var m=Array.prototype.slice.call(arguments,1);_.each(this.views,function(n){if(n.annotationEditor){n.annotationEditor.toggle.apply(n.annotationEditor,m)}})},events:_.extend(_.clone(i.prototype.events),{"click .show-selectors-btn":"toggleSelectors","click .toggle-deleted-link":function(l){this.toggleShowDeleted()},"click .toggle-hidden-link":function(l){this.toggleShowHidden()}}),updateHistoryDiskSize:function(){this.$el.find(".history-size").text(this.model.get("nice_size"))},dropTargetOn:function(){if(this.dropTarget){return this}this.dropTarget=true;var m={dragenter:_.bind(this.dragenter,this),dragover:_.bind(this.dragover,this),dragleave:_.bind(this.dragleave,this),drop:_.bind(this.drop,this)};var n=this._renderDropTarget();this.$list().before([this._renderDropTargetHelp(),n]);for(var l in m){if(m.hasOwnProperty(l)){n.on(l,m[l])}}return this},_renderDropTarget:function(){return $("<div/>").addClass("history-drop-target").css({height:"64px",margin:"0px 10px 10px 10px",border:"1px dashed black","border-radius":"3px"})},_renderDropTargetHelp:function(){return $("<div/>").addClass("history-drop-target-help").css({margin:"10px 10px 4px 10px",color:"grey","font-size":"80%","font-style":"italic"}).text(b("Drag datasets here to copy them to the current history"))},dropTargetOff:function(){if(!this.dropTarget){return this}this.dropTarget=false;this.$(".history-drop-target").remove();this.$(".history-drop-target-help").remove();return this},dropTargetToggle:function(){if(this.dropTarget){this.dropTargetOff()}else{this.dropTargetOn()}return this},dragenter:function(l){l.preventDefault();l.stopPropagation();this.$(".history-drop-target").css("border","2px solid black")},dragover:function(l){l.preventDefault();l.stopPropagation()},dragleave:function(l){l.preventDefault();l.stopPropagation();this.$(".history-drop-target").css("border","1px dashed black")},drop:function(n){n.preventDefault();n.dataTransfer.dropEffect="move";var l=this,o=n.dataTransfer.getData("text");try{o=JSON.parse(o)}catch(m){this.warn("error parsing JSON from drop:",o)}this.trigger("droptarget:drop",n,o,l);return false},dataDropped:function(m){var l=this;if(_.isObject(m)&&m.model_class==="HistoryDatasetAssociation"&&m.id){return l.model.contents.copy(m.id)}return jQuery.when()},toString:function(){return"HistoryPanelEdit("+((this.model)?(this.model.get("name")):(""))+")"}});return{HistoryPanelEdit:e}});
\ No newline at end of file
+define(["mvc/history/history-panel","mvc/history/history-contents","mvc/dataset/states","mvc/history/hda-model","mvc/history/hda-li-edit","mvc/history/hdca-li-edit","mvc/tags","mvc/annotations","utils/localization"],function(f,h,k,d,c,g,j,a,b){var i=f.HistoryPanel;var e=i.extend({HDAViewClass:c.HDAListItemEdit,HDCAViewClass:g.HDCAListItemEdit,initialize:function(l){l=l||{};i.prototype.initialize.call(this,l);this.tagsEditor=null;this.annotationEditor=null;this.purgeAllowed=l.purgeAllowed||false;this.annotationEditorShown=l.annotationEditorShown||false;this.tagsEditorShown=l.tagsEditorShown||false;this.multiselectActions=l.multiselectActions||this._getActions()},_setUpListeners:function(){i.prototype._setUpListeners.call(this);this.on("drop",function(l,m){this.dataDropped(m);this.dropTargetOff()})},_setUpCollectionListeners:function(){i.prototype._setUpCollectionListeners.call(this);this.collection.on("change:deleted",this._handleHdaDeletionChange,this);this.collection.on("change:visible",this._handleHdaVisibleChange,this);this.collection.on("change:purged",function(l){this.model.fetch()},this);return this},_setUpModelListeners:function(){i.prototype._setUpModelListeners.call(this);this.model.on("change:nice_size",this.updateHistoryDiskSize,this);return this},_buildNewRender:function(){var l=i.prototype._buildNewRender.call(this);if(!this.model){return l}if(Galaxy&&Galaxy.currUser&&Galaxy.currUser.id&&Galaxy.currUser.id===this.model.get("user_id")){this._renderTags(l);this._renderAnnotation(l)}return l},renderItems:function(m){var l=i.prototype.renderItems.call(this,m);this._renderCounts(m);return l},_renderCounts:function(n){function m(q,r){return['<a class="',q,'" href="javascript:void(0);">',r,"</a>"].join("")}n=n||this.$el;var l=this.collection.where({deleted:true}),p=this.collection.where({visible:false}),o=[];if(this.views.length){o.push([this.views.length,b("shown")].join(" "))}if(l.length){o.push((!this.showDeleted)?([l.length,m("toggle-deleted-link",b("deleted"))].join(" ")):(m("toggle-deleted-link",b("hide deleted"))))}if(p.length){o.push((!this.showHidden)?([p.length,m("toggle-hidden-link",b("hidden"))].join(" ")):(m("toggle-hidden-link",b("hide hidden"))))}return n.find("> .controls .subtitle").html(o.join(", "))},_renderTags:function(l){var m=this;this.tagsEditor=new j.TagsEditor({model:this.model,el:l.find(".controls .tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){m.toggleHDATagEditors(true,m.fxSpeed)},onhide:function(){m.toggleHDATagEditors(false,m.fxSpeed)},$activator:faIconButton({title:b("Edit history tags"),classes:"history-tag-btn",faIcon:"fa-tags"}).appendTo(l.find(".controls .actions"))})},_renderAnnotation:function(l){var m=this;this.annotationEditor=new a.AnnotationEditor({model:this.model,el:l.find(".controls .annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){m.toggleHDAAnnotationEditors(true,m.fxSpeed)},onhide:function(){m.toggleHDAAnnotationEditors(false,m.fxSpeed)},$activator:faIconButton({title:b("Edit history annotation"),classes:"history-annotate-btn",faIcon:"fa-comment"}).appendTo(l.find(".controls .actions"))})},_setUpBehaviors:function(l){l=l||this.$el;i.prototype._setUpBehaviors.call(this,l);if(!this.model){return}if(this.multiselectActions.length){this.actionsPopup=new PopupMenu(l.find(".list-action-popup-btn"),this.multiselectActions)}if((!Galaxy.currUser||Galaxy.currUser.isAnonymous())||(Galaxy.currUser.id!==this.model.get("user_id"))){return}var m=this,n=".controls .name";l.find(n).attr("title",b("Click to rename history")).tooltip({placement:"bottom"}).make_text_editable({on_finish:function(o){var p=m.model.get("name");if(o&&o!==p){m.$el.find(n).text(o);m.model.save({name:o}).fail(function(){m.$el.find(n).text(m.model.previous("name"))})}else{m.$el.find(n).text(p)}}})},_getActions:function(){var l=this,m=[{html:b("Hide datasets"),func:function(){var n=d.HistoryDatasetAssociation.prototype.hide;l.getSelectedModels().ajaxQueue(n)}},{html:b("Unhide datasets"),func:function(){var n=d.HistoryDatasetAssociation.prototype.unhide;l.getSelectedModels().ajaxQueue(n)}},{html:b("Delete datasets"),func:function(){var n=d.HistoryDatasetAssociation.prototype["delete"];l.getSelectedModels().ajaxQueue(n)}},{html:b("Undelete datasets"),func:function(){var n=d.HistoryDatasetAssociation.prototype.undelete;l.getSelectedModels().ajaxQueue(n)}}];if(l.purgeAllowed){m.push({html:b("Permanently delete datasets"),func:function(){if(confirm(b("This will permanently remove the data in your datasets. Are you sure?"))){var n=d.HistoryDatasetAssociation.prototype.purge;l.getSelectedModels().ajaxQueue(n)}}})}m.push({html:b("Build Dataset List"),func:function(){l.getSelectedModels().promoteToHistoryDatasetCollection(l.model,"list")}});m.push({html:b("Build Dataset Pair"),func:function(){l.getSelectedModels().promoteToHistoryDatasetCollection(l.model,"paired")}});m.push({html:b("Build List of Dataset Pairs"),func:_.bind(l._showPairedCollectionModal,l)});return m},_showPairedCollectionModal:function(){var l=this,m=l.getSelectedModels().toJSON().filter(function(n){return n.history_content_type==="dataset"&&n.state===k.OK});if(m.length){require(["mvc/collection/paired-collection-creator"],function(n){window.creator=n.pairedCollectionCreatorModal(m,{historyId:l.model.id})})}else{}},_attachItems:function(l){this.$list(l).append(this.views.reverse().map(function(m){return m.$el}));return this},_attachView:function(m){var l=this;l.views.unshift(m);l.$list().prepend(m.render(0).$el.hide());m.$el.slideDown(l.fxSpeed)},_getItemViewOptions:function(m){var l=i.prototype._getItemViewOptions.call(this,m);_.extend(l,{purgeAllowed:this.purgeAllowed,tagsEditorShown:(this.tagsEditor&&!this.tagsEditor.hidden),annotationEditorShown:(this.annotationEditor&&!this.annotationEditor.hidden)});return l},_handleHdaDeletionChange:function(l){if(l.get("deleted")&&!this.showDeleted){this.removeItemView(l)}this._renderCounts()},_handleHdaVisibleChange:function(l){if(l.hidden()&&!this.storage.showHidden){this.removeItemView(l)}this._renderCounts()},toggleHDATagEditors:function(l){var m=Array.prototype.slice.call(arguments,1);_.each(this.views,function(n){if(n.tagsEditor){n.tagsEditor.toggle.apply(n.tagsEditor,m)}})},toggleHDAAnnotationEditors:function(l){var m=Array.prototype.slice.call(arguments,1);_.each(this.views,function(n){if(n.annotationEditor){n.annotationEditor.toggle.apply(n.annotationEditor,m)}})},events:_.extend(_.clone(i.prototype.events),{"click .show-selectors-btn":"toggleSelectors","click .toggle-deleted-link":function(l){this.toggleShowDeleted()},"click .toggle-hidden-link":function(l){this.toggleShowHidden()}}),updateHistoryDiskSize:function(){this.$el.find(".history-size").text(this.model.get("nice_size"))},dropTargetOn:function(){if(this.dropTarget){return this}this.dropTarget=true;var m={dragenter:_.bind(this.dragenter,this),dragover:_.bind(this.dragover,this),dragleave:_.bind(this.dragleave,this),drop:_.bind(this.drop,this)};var n=this._renderDropTarget();this.$list().before([this._renderDropTargetHelp(),n]);for(var l in m){if(m.hasOwnProperty(l)){n.on(l,m[l])}}return this},_renderDropTarget:function(){return $("<div/>").addClass("history-drop-target").css({height:"64px",margin:"0px 10px 10px 10px",border:"1px dashed black","border-radius":"3px"})},_renderDropTargetHelp:function(){return $("<div/>").addClass("history-drop-target-help").css({margin:"10px 10px 4px 10px",color:"grey","font-size":"80%","font-style":"italic"}).text(b("Drag datasets here to copy them to the current history"))},dropTargetOff:function(){if(!this.dropTarget){return this}this.dropTarget=false;this.$(".history-drop-target").remove();this.$(".history-drop-target-help").remove();return this},dropTargetToggle:function(){if(this.dropTarget){this.dropTargetOff()}else{this.dropTargetOn()}return this},dragenter:function(l){l.preventDefault();l.stopPropagation();this.$(".history-drop-target").css("border","2px solid black")},dragover:function(l){l.preventDefault();l.stopPropagation()},dragleave:function(l){l.preventDefault();l.stopPropagation();this.$(".history-drop-target").css("border","1px dashed black")},drop:function(n){n.preventDefault();n.dataTransfer.dropEffect="move";var l=this,o=n.dataTransfer.getData("text");try{o=JSON.parse(o)}catch(m){this.warn("error parsing JSON from drop:",o)}this.trigger("droptarget:drop",n,o,l);return false},dataDropped:function(m){var l=this;if(_.isObject(m)&&m.model_class==="HistoryDatasetAssociation"&&m.id){return l.model.contents.copy(m.id)}return jQuery.when()},toString:function(){return"HistoryPanelEdit("+((this.model)?(this.model.get("name")):(""))+")"}});return{HistoryPanelEdit:e}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: Phyloviz: fix saving
by commits-noreply@bitbucket.org 13 Nov '14
by commits-noreply@bitbucket.org 13 Nov '14
13 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/e802fed907e5/
Changeset: e802fed907e5
User: carlfeberhard
Date: 2014-11-13 16:23:12+00:00
Summary: Phyloviz: fix saving
Affected #: 3 files
diff -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a -r e802fed907e5341d2d50c94d546a65faf3978a1a client/galaxy/scripts/viz/phyloviz.js
--- a/client/galaxy/scripts/viz/phyloviz.js
+++ b/client/galaxy/scripts/viz/phyloviz.js
@@ -199,6 +199,7 @@
this.set("dataset", new data_mod.Dataset({
id: options.dataset_id
}));
+
},
root : {}, // Root has to be its own independent object because it is not part of the viz_config
@@ -267,16 +268,14 @@
show_message("Saving to Galaxy", "progress");
return $.ajax({
- url : this.url,
+ url : this.url(),
type : "POST",
dataType: "json",
data : {
- vis_json: JSON.stringify(config)
+ config : JSON.stringify( config ),
+ type : 'phyloviz'
},
success: function(res){
- var viz_id = res.url.split("id=")[1].split("&")[0],
- viz_url = "/visualization?id=" + viz_id;
- window.history.pushState({}, "", viz_url + window.location.hash);
hide_modal();
}
});
diff -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a -r e802fed907e5341d2d50c94d546a65faf3978a1a static/scripts/packed/viz/phyloviz.js
--- a/static/scripts/packed/viz/phyloviz.js
+++ b/static/scripts/packed/viz/phyloviz.js
@@ -1,1 +1,1 @@
-define(["libs/d3","viz/visualization","mvc/data"],function(m,f,g){var l=Backbone.View.extend({className:"UserMenuBase",isAcceptableValue:function(q,o,n){var r=q.val(),s=q.attr("displayLabel")||q.attr("id").replace("phyloViz","");function p(t){return !isNaN(parseFloat(t))&&isFinite(t)}if(!p(r)){alert(s+" is not a number!");return false}if(r>n){alert(s+" is too large.");return false}else{if(r<o){alert(s+" is too small.");return false}}return true},hasIllegalJsonCharacters:function(n){if(n.val().search(/"|'|\\/)!==-1){alert("Named fields cannot contain these illegal characters: double quote(\"), single guote('), or back slash(\\). ");return true}return false}});function h(){var w=this,r=m.layout.hierarchy().sort(null).value(null),v=360,q="Linear",u=18,s=200,t=0,p=0.5,n=50;w.leafHeight=function(x){if(typeof x==="undefined"){return u}else{u=x;return w}};w.layoutMode=function(x){if(typeof x==="undefined"){return q}else{q=x;return w}};w.layoutAngle=function(x){if(typeof x==="undefined"){return v}if(isNaN(x)||x<0||x>360){return w}else{v=x;return w}};w.separation=function(x){if(typeof x==="undefined"){return s}else{s=x;return w}};w.links=function(x){return m.layout.tree().links(x)};w.nodes=function(A,y){if(toString.call(A)==="[object Array]"){A=A[0]}var z=r.call(w,A,y),x=[],C=0,B=0;window._d=A;window._nodes=z;z.forEach(function(D){C=D.depth>C?D.depth:C;x.push(D)});x.forEach(function(D){if(!D.children){B+=1;D.depth=C}});u=q==="Circular"?v/B:u;t=0;o(x[0],C,u,null);return x};function o(B,D,A,z){var y=B.children,x=0;var C=B.dist||p;C=C>1?1:C;B.dist=C;if(z!==null){B.y0=z.y0+C*s}else{B.y0=n}if(!y){B.x0=t*A;t+=1}else{y.forEach(function(E){E.parent=B;x+=o(E,D,A,B)});B.x0=x/y.length}B.x=B.x0;B.y=B.y0;return B.x0}return w}var b=f.Visualization.extend({defaults:{layout:"Linear",separation:250,leafHeight:18,type:"phyloviz",title:"Title",scaleFactor:1,translate:[0,0],fontSize:12,selectedNode:null,nodeAttrChangedTime:0},initialize:function(n){this.set("dataset",new g.Dataset({id:n.dataset_id}))},root:{},toggle:function(n){if(typeof n==="undefined"){return}if(n.children){n._children=n.children;n.children=null}else{n.children=n._children;n._children=null}},toggleAll:function(n){if(n.children&&n.children.length!==0){n.children.forEach(this.toggleAll);toggle(n)}},getData:function(){return this.root},save:function(){var n=this.root;o(n);function o(q){delete q.parent;if(q._selected){delete q._selected}if(q.children){q.children.forEach(o)}if(q._children){q._children.forEach(o)}}var p=jQuery.extend(true,{},this.attributes);p.selectedNode=null;show_message("Saving to Galaxy","progress");return $.ajax({url:this.url,type:"POST",dataType:"json",data:{vis_json:JSON.stringify(p)},success:function(q){var r=q.url.split("id=")[1].split("&")[0],s="/visualization?id="+r;window.history.pushState({},"",s+window.location.hash);hide_modal()}})}});var d=Backbone.View.extend({defaults:{nodeRadius:4.5},stdInit:function(o){var n=this;n.model.on("change:separation change:leafHeight change:fontSize change:nodeAttrChangedTime",n.updateAndRender,n);n.vis=o.vis;n.i=0;n.maxDepth=-1;n.width=o.width;n.height=o.height},updateAndRender:function(p){var o=m.select(".vis"),n=this;p=p||n.model.root;n.renderNodes(p);n.renderLinks(p);n.addTooltips()},renderLinks:function(n){var w=this;var o=w.diagonal;var p=w.duration;var r=w.layoutMode;var t=w.vis.selectAll("g.completeLink").data(w.tree.links(w.nodes),function(x){return x.target.id});var v=function(x){x.pos0=x.source.y0+" "+x.source.x0;x.pos1=x.source.y0+" "+x.target.x0;x.pos2=x.target.y0+" "+x.target.x0};var u=t.enter().insert("svg:g","g.node").attr("class","completeLink");u.append("svg:path").attr("class","link").attr("d",function(x){v(x);return"M "+x.pos0+" L "+x.pos1});var s=t.transition().duration(500);s.select("path.link").attr("d",function(x){v(x);return"M "+x.pos0+" L "+x.pos1+" L "+x.pos2});var q=t.exit().remove()},selectNode:function(o){var n=this;m.selectAll("g.node").classed("selectedHighlight",function(p){if(o.id===p.id){if(o._selected){delete o._selected;return false}else{o._selected=true;return true}}return false});n.model.set("selectedNode",o);$("#phyloVizSelectedNodeName").val(o.name);$("#phyloVizSelectedNodeDist").val(o.dist);$("#phyloVizSelectedNodeAnnotation").val(o.annotation||"")},addTooltips:function(){$(".tooltip").remove();$(".node").attr("data-original-title",function(){var o=this.__data__,n=o.annotation||"None";return o?(o.name?o.name+"<br/>":"")+"Dist: "+o.dist+" <br/>Annotation: "+n:""}).tooltip({placement:"top",trigger:"hover"})}});var a=d.extend({initialize:function(o){var n=this;n.margins=o.margins;n.layoutMode="Linear";n.stdInit(o);n.layout();n.updateAndRender(n.model.root)},layout:function(){var n=this;n.tree=new h().layoutMode("Linear");n.diagonal=m.svg.diagonal().projection(function(o){return[o.y,o.x]})},renderNodes:function(n){var u=this,v=u.model.get("fontSize")+"px";u.tree.separation(u.model.get("separation")).leafHeight(u.model.get("leafHeight"));var q=500,o=u.tree.separation(u.model.get("separation")).nodes(u.model.root);var p=u.vis.selectAll("g.node").data(o,function(w){return w.name+w.id||(w.id=++u.i)});u.nodes=o;u.duration=q;var r=p.enter().append("svg:g").attr("class","node").on("dblclick",function(){m.event.stopPropagation()}).on("click",function(w){if(m.event.altKey){u.selectNode(w)}else{if(w.children&&w.children.length===0){return}u.model.toggle(w);u.updateAndRender(w)}});if(toString.call(n)==="[object Array]"){n=n[0]}r.attr("transform",function(w){return"translate("+n.y0+","+n.x0+")"});r.append("svg:circle").attr("r",0.000001).style("fill",function(w){return w._children?"lightsteelblue":"#fff"});r.append("svg:text").attr("class","nodeLabel").attr("x",function(w){return w.children||w._children?-10:10}).attr("dy",".35em").attr("text-anchor",function(w){return w.children||w._children?"end":"start"}).style("fill-opacity",0.000001);var s=p.transition().duration(q);s.attr("transform",function(w){return"translate("+w.y+","+w.x+")"});s.select("circle").attr("r",u.defaults.nodeRadius).style("fill",function(w){return w._children?"lightsteelblue":"#fff"});s.select("text").style("fill-opacity",1).style("font-size",v).text(function(w){return w.name});var t=p.exit().transition().duration(q).remove();t.select("circle").attr("r",0.000001);t.select("text").style("fill-opacity",0.000001);o.forEach(function(w){w.x0=w.x;w.y0=w.y})}});var j=Backbone.View.extend({className:"phyloviz",initialize:function(o){var n=this;n.MIN_SCALE=0.05;n.MAX_SCALE=5;n.MAX_DISPLACEMENT=500;n.margins=[10,60,10,80];n.width=$("#PhyloViz").width();n.height=$("#PhyloViz").height();n.radius=n.width;n.data=o.data;$(window).resize(function(){n.width=$("#PhyloViz").width();n.height=$("#PhyloViz").height();n.render()});n.phyloTree=new b(o.config);n.phyloTree.root=n.data;n.zoomFunc=m.behavior.zoom().scaleExtent([n.MIN_SCALE,n.MAX_SCALE]);n.zoomFunc.translate(n.phyloTree.get("translate"));n.zoomFunc.scale(n.phyloTree.get("scaleFactor"));n.navMenu=new c(n);n.settingsMenu=new i({phyloTree:n.phyloTree});n.nodeSelectionView=new e({phyloTree:n.phyloTree});n.search=new k();setTimeout(function(){n.zoomAndPan()},1000)},render:function(){var o=this;$("#PhyloViz").empty();o.mainSVG=m.select("#PhyloViz").append("svg:svg").attr("width",o.width).attr("height",o.height).attr("pointer-events","all").call(o.zoomFunc.on("zoom",function(){o.zoomAndPan()}));o.boundingRect=o.mainSVG.append("svg:rect").attr("class","boundingRect").attr("width",o.width).attr("height",o.height).attr("stroke","black").attr("fill","white");o.vis=o.mainSVG.append("svg:g").attr("class","vis");o.layoutOptions={model:o.phyloTree,width:o.width,height:o.height,vis:o.vis,margins:o.margins};$("#title").text("Phylogenetic Tree from "+o.phyloTree.get("title")+":");var n=new a(o.layoutOptions)},zoomAndPan:function(n){var t,p;if(typeof n!=="undefined"){t=n.zoom;p=n.translate}var w=this,r=w.zoomFunc.scale(),v=w.zoomFunc.translate(),s="",u="";switch(t){case"reset":r=1;v=[0,0];break;case"+":r*=1.1;break;case"-":r*=0.9;break;default:if(typeof t==="number"){r=t}else{if(m.event!==null){r=m.event.scale}}}if(r<w.MIN_SCALE||r>w.MAX_SCALE){return}w.zoomFunc.scale(r);s="translate("+w.margins[3]+","+w.margins[0]+") scale("+r+")";if(m.event!==null){u="translate("+m.event.translate+")"}else{if(typeof p!=="undefined"){var q=p.split(",")[0];var o=p.split(",")[1];if(!isNaN(q)&&!isNaN(o)){v=[v[0]+parseFloat(q),v[1]+parseFloat(o)]}}w.zoomFunc.translate(v);u="translate("+v+")"}w.phyloTree.set("scaleFactor",r);w.phyloTree.set("translate",v);w.vis.attr("transform",u+s)},reloadViz:function(){var n=this,o=$("#phylovizNexSelector :selected").val();$.getJSON(n.phyloTree.get("dataset").url(),{tree_index:o,data_type:"raw_data"},function(p){n.data=p.data;n.config=p;n.render()})}});var c=Backbone.View.extend({initialize:function(o){var n=this;n.phylovizView=o;$("#panelHeaderRightBtns").empty();$("#phyloVizNavBtns").empty();$("#phylovizNexSelector").off();n.initNavBtns();n.initRightHeaderBtns();$("#phylovizNexSelector").off().on("change",function(){n.phylovizView.reloadViz()})},initRightHeaderBtns:function(){var n=this;rightMenu=create_icon_buttons_menu([{icon_class:"gear",title:"PhyloViz Settings",on_click:function(){$("#SettingsMenu").show();n.settingsMenu.updateUI()}},{icon_class:"disk",title:"Save visualization",on_click:function(){var o=$("#phylovizNexSelector option:selected").text();if(o){n.phylovizView.phyloTree.set("title",o)}n.phylovizView.phyloTree.save()}},{icon_class:"chevron-expand",title:"Search / Edit Nodes",on_click:function(){$("#nodeSelectionView").show()}},{icon_class:"information",title:"Phyloviz Help",on_click:function(){window.open("https://wiki.galaxyproject.org/Learn/Visualization/PhylogeneticTree")}}],{tooltip_config:{placement:"bottom"}});$("#panelHeaderRightBtns").append(rightMenu.$el)},initNavBtns:function(){var n=this,o=create_icon_buttons_menu([{icon_class:"zoom-in",title:"Zoom in",on_click:function(){n.phylovizView.zoomAndPan({zoom:"+"})}},{icon_class:"zoom-out",title:"Zoom out",on_click:function(){n.phylovizView.zoomAndPan({zoom:"-"})}},{icon_class:"arrow-circle",title:"Reset Zoom/Pan",on_click:function(){n.phylovizView.zoomAndPan({zoom:"reset"})}}],{tooltip_config:{placement:"bottom"}});$("#phyloVizNavBtns").append(o.$el)}});var i=l.extend({className:"Settings",initialize:function(o){var n=this;n.phyloTree=o.phyloTree;n.el=$("#SettingsMenu");n.inputs={separation:$("#phyloVizTreeSeparation"),leafHeight:$("#phyloVizTreeLeafHeight"),fontSize:$("#phyloVizTreeFontSize")};$("#settingsCloseBtn").off().on("click",function(){n.el.hide()});$("#phylovizResetSettingsBtn").off().on("click",function(){n.resetToDefaults()});$("#phylovizApplySettingsBtn").off().on("click",function(){n.apply()})},apply:function(){var n=this;if(!n.isAcceptableValue(n.inputs.separation,50,2500)||!n.isAcceptableValue(n.inputs.leafHeight,5,30)||!n.isAcceptableValue(n.inputs.fontSize,5,20)){return}$.each(n.inputs,function(o,p){n.phyloTree.set(o,p.val())})},updateUI:function(){var n=this;$.each(n.inputs,function(o,p){p.val(n.phyloTree.get(o))})},resetToDefaults:function(){$(".tooltip").remove();var n=this;$.each(n.phyloTree.defaults,function(o,p){n.phyloTree.set(o,p)});n.updateUI()},render:function(){}});var e=l.extend({className:"Settings",initialize:function(o){var n=this;n.el=$("#nodeSelectionView");n.phyloTree=o.phyloTree;n.UI={enableEdit:$("#phylovizEditNodesCheck"),saveChanges:$("#phylovizNodeSaveChanges"),cancelChanges:$("#phylovizNodeCancelChanges"),name:$("#phyloVizSelectedNodeName"),dist:$("#phyloVizSelectedNodeDist"),annotation:$("#phyloVizSelectedNodeAnnotation")};n.valuesOfConcern={name:null,dist:null,annotation:null};$("#nodeSelCloseBtn").off().on("click",function(){n.el.hide()});n.UI.saveChanges.off().on("click",function(){n.updateNodes()});n.UI.cancelChanges.off().on("click",function(){n.cancelChanges()});(function(p){p.fn.enable=function(q){return p(this).each(function(){if(q){p(this).removeAttr("disabled")}else{p(this).attr("disabled","disabled")}})}})(jQuery);n.UI.enableEdit.off().on("click",function(){n.toggleUI()})},toggleUI:function(){var n=this,o=n.UI.enableEdit.is(":checked");if(!o){n.cancelChanges()}$.each(n.valuesOfConcern,function(p,q){n.UI[p].enable(o)});if(o){n.UI.saveChanges.show();n.UI.cancelChanges.show()}else{n.UI.saveChanges.hide();n.UI.cancelChanges.hide()}},cancelChanges:function(){var n=this,o=n.phyloTree.get("selectedNode");if(o){$.each(n.valuesOfConcern,function(p,q){n.UI[p].val(o[p])})}},updateNodes:function(){var n=this,o=n.phyloTree.get("selectedNode");if(o){if(!n.isAcceptableValue(n.UI.dist,0,1)||n.hasIllegalJsonCharacters(n.UI.name)||n.hasIllegalJsonCharacters(n.UI.annotation)){return}$.each(n.valuesOfConcern,function(p,q){(o[p])=n.UI[p].val()});n.phyloTree.set("nodeAttrChangedTime",new Date())}else{alert("No node selected")}}});var k=l.extend({initialize:function(){var n=this;$("#phyloVizSearchBtn").on("click",function(){var p=$("#phyloVizSearchTerm"),q=$("#phyloVizSearchCondition").val().split("-"),o=q[0],r=q[1];n.hasIllegalJsonCharacters(p);if(o==="dist"){n.isAcceptableValue(p,0,1)}n.searchTree(o,r,p.val())})},searchTree:function(n,p,o){m.selectAll("g.node").classed("searchHighlight",function(r){var q=r[n];if(typeof q!=="undefined"&&q!==null){if(n==="dist"){switch(p){case"greaterEqual":return q>=+o;case"lesserEqual":return q<=+o;default:return}}else{if(n==="name"||n==="annotation"){return q.toLowerCase().indexOf(o.toLowerCase())!==-1}}}})}});return{PhylovizView:j}});
\ No newline at end of file
+define(["libs/d3","viz/visualization","mvc/data"],function(m,f,g){var l=Backbone.View.extend({className:"UserMenuBase",isAcceptableValue:function(q,o,n){var r=q.val(),s=q.attr("displayLabel")||q.attr("id").replace("phyloViz","");function p(t){return !isNaN(parseFloat(t))&&isFinite(t)}if(!p(r)){alert(s+" is not a number!");return false}if(r>n){alert(s+" is too large.");return false}else{if(r<o){alert(s+" is too small.");return false}}return true},hasIllegalJsonCharacters:function(n){if(n.val().search(/"|'|\\/)!==-1){alert("Named fields cannot contain these illegal characters: double quote(\"), single guote('), or back slash(\\). ");return true}return false}});function h(){var w=this,r=m.layout.hierarchy().sort(null).value(null),v=360,q="Linear",u=18,s=200,t=0,p=0.5,n=50;w.leafHeight=function(x){if(typeof x==="undefined"){return u}else{u=x;return w}};w.layoutMode=function(x){if(typeof x==="undefined"){return q}else{q=x;return w}};w.layoutAngle=function(x){if(typeof x==="undefined"){return v}if(isNaN(x)||x<0||x>360){return w}else{v=x;return w}};w.separation=function(x){if(typeof x==="undefined"){return s}else{s=x;return w}};w.links=function(x){return m.layout.tree().links(x)};w.nodes=function(A,y){if(toString.call(A)==="[object Array]"){A=A[0]}var z=r.call(w,A,y),x=[],C=0,B=0;window._d=A;window._nodes=z;z.forEach(function(D){C=D.depth>C?D.depth:C;x.push(D)});x.forEach(function(D){if(!D.children){B+=1;D.depth=C}});u=q==="Circular"?v/B:u;t=0;o(x[0],C,u,null);return x};function o(B,D,A,z){var y=B.children,x=0;var C=B.dist||p;C=C>1?1:C;B.dist=C;if(z!==null){B.y0=z.y0+C*s}else{B.y0=n}if(!y){B.x0=t*A;t+=1}else{y.forEach(function(E){E.parent=B;x+=o(E,D,A,B)});B.x0=x/y.length}B.x=B.x0;B.y=B.y0;return B.x0}return w}var b=f.Visualization.extend({defaults:{layout:"Linear",separation:250,leafHeight:18,type:"phyloviz",title:"Title",scaleFactor:1,translate:[0,0],fontSize:12,selectedNode:null,nodeAttrChangedTime:0},initialize:function(n){this.set("dataset",new g.Dataset({id:n.dataset_id}))},root:{},toggle:function(n){if(typeof n==="undefined"){return}if(n.children){n._children=n.children;n.children=null}else{n.children=n._children;n._children=null}},toggleAll:function(n){if(n.children&&n.children.length!==0){n.children.forEach(this.toggleAll);toggle(n)}},getData:function(){return this.root},save:function(){var n=this.root;o(n);function o(q){delete q.parent;if(q._selected){delete q._selected}if(q.children){q.children.forEach(o)}if(q._children){q._children.forEach(o)}}var p=jQuery.extend(true,{},this.attributes);p.selectedNode=null;show_message("Saving to Galaxy","progress");return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{config:JSON.stringify(p),type:"phyloviz"},success:function(q){hide_modal()}})}});var d=Backbone.View.extend({defaults:{nodeRadius:4.5},stdInit:function(o){var n=this;n.model.on("change:separation change:leafHeight change:fontSize change:nodeAttrChangedTime",n.updateAndRender,n);n.vis=o.vis;n.i=0;n.maxDepth=-1;n.width=o.width;n.height=o.height},updateAndRender:function(p){var o=m.select(".vis"),n=this;p=p||n.model.root;n.renderNodes(p);n.renderLinks(p);n.addTooltips()},renderLinks:function(n){var w=this;var o=w.diagonal;var p=w.duration;var r=w.layoutMode;var t=w.vis.selectAll("g.completeLink").data(w.tree.links(w.nodes),function(x){return x.target.id});var v=function(x){x.pos0=x.source.y0+" "+x.source.x0;x.pos1=x.source.y0+" "+x.target.x0;x.pos2=x.target.y0+" "+x.target.x0};var u=t.enter().insert("svg:g","g.node").attr("class","completeLink");u.append("svg:path").attr("class","link").attr("d",function(x){v(x);return"M "+x.pos0+" L "+x.pos1});var s=t.transition().duration(500);s.select("path.link").attr("d",function(x){v(x);return"M "+x.pos0+" L "+x.pos1+" L "+x.pos2});var q=t.exit().remove()},selectNode:function(o){var n=this;m.selectAll("g.node").classed("selectedHighlight",function(p){if(o.id===p.id){if(o._selected){delete o._selected;return false}else{o._selected=true;return true}}return false});n.model.set("selectedNode",o);$("#phyloVizSelectedNodeName").val(o.name);$("#phyloVizSelectedNodeDist").val(o.dist);$("#phyloVizSelectedNodeAnnotation").val(o.annotation||"")},addTooltips:function(){$(".tooltip").remove();$(".node").attr("data-original-title",function(){var o=this.__data__,n=o.annotation||"None";return o?(o.name?o.name+"<br/>":"")+"Dist: "+o.dist+" <br/>Annotation: "+n:""}).tooltip({placement:"top",trigger:"hover"})}});var a=d.extend({initialize:function(o){var n=this;n.margins=o.margins;n.layoutMode="Linear";n.stdInit(o);n.layout();n.updateAndRender(n.model.root)},layout:function(){var n=this;n.tree=new h().layoutMode("Linear");n.diagonal=m.svg.diagonal().projection(function(o){return[o.y,o.x]})},renderNodes:function(n){var u=this,v=u.model.get("fontSize")+"px";u.tree.separation(u.model.get("separation")).leafHeight(u.model.get("leafHeight"));var q=500,o=u.tree.separation(u.model.get("separation")).nodes(u.model.root);var p=u.vis.selectAll("g.node").data(o,function(w){return w.name+w.id||(w.id=++u.i)});u.nodes=o;u.duration=q;var r=p.enter().append("svg:g").attr("class","node").on("dblclick",function(){m.event.stopPropagation()}).on("click",function(w){if(m.event.altKey){u.selectNode(w)}else{if(w.children&&w.children.length===0){return}u.model.toggle(w);u.updateAndRender(w)}});if(toString.call(n)==="[object Array]"){n=n[0]}r.attr("transform",function(w){return"translate("+n.y0+","+n.x0+")"});r.append("svg:circle").attr("r",0.000001).style("fill",function(w){return w._children?"lightsteelblue":"#fff"});r.append("svg:text").attr("class","nodeLabel").attr("x",function(w){return w.children||w._children?-10:10}).attr("dy",".35em").attr("text-anchor",function(w){return w.children||w._children?"end":"start"}).style("fill-opacity",0.000001);var s=p.transition().duration(q);s.attr("transform",function(w){return"translate("+w.y+","+w.x+")"});s.select("circle").attr("r",u.defaults.nodeRadius).style("fill",function(w){return w._children?"lightsteelblue":"#fff"});s.select("text").style("fill-opacity",1).style("font-size",v).text(function(w){return w.name});var t=p.exit().transition().duration(q).remove();t.select("circle").attr("r",0.000001);t.select("text").style("fill-opacity",0.000001);o.forEach(function(w){w.x0=w.x;w.y0=w.y})}});var j=Backbone.View.extend({className:"phyloviz",initialize:function(o){var n=this;n.MIN_SCALE=0.05;n.MAX_SCALE=5;n.MAX_DISPLACEMENT=500;n.margins=[10,60,10,80];n.width=$("#PhyloViz").width();n.height=$("#PhyloViz").height();n.radius=n.width;n.data=o.data;$(window).resize(function(){n.width=$("#PhyloViz").width();n.height=$("#PhyloViz").height();n.render()});n.phyloTree=new b(o.config);n.phyloTree.root=n.data;n.zoomFunc=m.behavior.zoom().scaleExtent([n.MIN_SCALE,n.MAX_SCALE]);n.zoomFunc.translate(n.phyloTree.get("translate"));n.zoomFunc.scale(n.phyloTree.get("scaleFactor"));n.navMenu=new c(n);n.settingsMenu=new i({phyloTree:n.phyloTree});n.nodeSelectionView=new e({phyloTree:n.phyloTree});n.search=new k();setTimeout(function(){n.zoomAndPan()},1000)},render:function(){var o=this;$("#PhyloViz").empty();o.mainSVG=m.select("#PhyloViz").append("svg:svg").attr("width",o.width).attr("height",o.height).attr("pointer-events","all").call(o.zoomFunc.on("zoom",function(){o.zoomAndPan()}));o.boundingRect=o.mainSVG.append("svg:rect").attr("class","boundingRect").attr("width",o.width).attr("height",o.height).attr("stroke","black").attr("fill","white");o.vis=o.mainSVG.append("svg:g").attr("class","vis");o.layoutOptions={model:o.phyloTree,width:o.width,height:o.height,vis:o.vis,margins:o.margins};$("#title").text("Phylogenetic Tree from "+o.phyloTree.get("title")+":");var n=new a(o.layoutOptions)},zoomAndPan:function(n){var t,p;if(typeof n!=="undefined"){t=n.zoom;p=n.translate}var w=this,r=w.zoomFunc.scale(),v=w.zoomFunc.translate(),s="",u="";switch(t){case"reset":r=1;v=[0,0];break;case"+":r*=1.1;break;case"-":r*=0.9;break;default:if(typeof t==="number"){r=t}else{if(m.event!==null){r=m.event.scale}}}if(r<w.MIN_SCALE||r>w.MAX_SCALE){return}w.zoomFunc.scale(r);s="translate("+w.margins[3]+","+w.margins[0]+") scale("+r+")";if(m.event!==null){u="translate("+m.event.translate+")"}else{if(typeof p!=="undefined"){var q=p.split(",")[0];var o=p.split(",")[1];if(!isNaN(q)&&!isNaN(o)){v=[v[0]+parseFloat(q),v[1]+parseFloat(o)]}}w.zoomFunc.translate(v);u="translate("+v+")"}w.phyloTree.set("scaleFactor",r);w.phyloTree.set("translate",v);w.vis.attr("transform",u+s)},reloadViz:function(){var n=this,o=$("#phylovizNexSelector :selected").val();$.getJSON(n.phyloTree.get("dataset").url(),{tree_index:o,data_type:"raw_data"},function(p){n.data=p.data;n.config=p;n.render()})}});var c=Backbone.View.extend({initialize:function(o){var n=this;n.phylovizView=o;$("#panelHeaderRightBtns").empty();$("#phyloVizNavBtns").empty();$("#phylovizNexSelector").off();n.initNavBtns();n.initRightHeaderBtns();$("#phylovizNexSelector").off().on("change",function(){n.phylovizView.reloadViz()})},initRightHeaderBtns:function(){var n=this;rightMenu=create_icon_buttons_menu([{icon_class:"gear",title:"PhyloViz Settings",on_click:function(){$("#SettingsMenu").show();n.settingsMenu.updateUI()}},{icon_class:"disk",title:"Save visualization",on_click:function(){var o=$("#phylovizNexSelector option:selected").text();if(o){n.phylovizView.phyloTree.set("title",o)}n.phylovizView.phyloTree.save()}},{icon_class:"chevron-expand",title:"Search / Edit Nodes",on_click:function(){$("#nodeSelectionView").show()}},{icon_class:"information",title:"Phyloviz Help",on_click:function(){window.open("https://wiki.galaxyproject.org/Learn/Visualization/PhylogeneticTree")}}],{tooltip_config:{placement:"bottom"}});$("#panelHeaderRightBtns").append(rightMenu.$el)},initNavBtns:function(){var n=this,o=create_icon_buttons_menu([{icon_class:"zoom-in",title:"Zoom in",on_click:function(){n.phylovizView.zoomAndPan({zoom:"+"})}},{icon_class:"zoom-out",title:"Zoom out",on_click:function(){n.phylovizView.zoomAndPan({zoom:"-"})}},{icon_class:"arrow-circle",title:"Reset Zoom/Pan",on_click:function(){n.phylovizView.zoomAndPan({zoom:"reset"})}}],{tooltip_config:{placement:"bottom"}});$("#phyloVizNavBtns").append(o.$el)}});var i=l.extend({className:"Settings",initialize:function(o){var n=this;n.phyloTree=o.phyloTree;n.el=$("#SettingsMenu");n.inputs={separation:$("#phyloVizTreeSeparation"),leafHeight:$("#phyloVizTreeLeafHeight"),fontSize:$("#phyloVizTreeFontSize")};$("#settingsCloseBtn").off().on("click",function(){n.el.hide()});$("#phylovizResetSettingsBtn").off().on("click",function(){n.resetToDefaults()});$("#phylovizApplySettingsBtn").off().on("click",function(){n.apply()})},apply:function(){var n=this;if(!n.isAcceptableValue(n.inputs.separation,50,2500)||!n.isAcceptableValue(n.inputs.leafHeight,5,30)||!n.isAcceptableValue(n.inputs.fontSize,5,20)){return}$.each(n.inputs,function(o,p){n.phyloTree.set(o,p.val())})},updateUI:function(){var n=this;$.each(n.inputs,function(o,p){p.val(n.phyloTree.get(o))})},resetToDefaults:function(){$(".tooltip").remove();var n=this;$.each(n.phyloTree.defaults,function(o,p){n.phyloTree.set(o,p)});n.updateUI()},render:function(){}});var e=l.extend({className:"Settings",initialize:function(o){var n=this;n.el=$("#nodeSelectionView");n.phyloTree=o.phyloTree;n.UI={enableEdit:$("#phylovizEditNodesCheck"),saveChanges:$("#phylovizNodeSaveChanges"),cancelChanges:$("#phylovizNodeCancelChanges"),name:$("#phyloVizSelectedNodeName"),dist:$("#phyloVizSelectedNodeDist"),annotation:$("#phyloVizSelectedNodeAnnotation")};n.valuesOfConcern={name:null,dist:null,annotation:null};$("#nodeSelCloseBtn").off().on("click",function(){n.el.hide()});n.UI.saveChanges.off().on("click",function(){n.updateNodes()});n.UI.cancelChanges.off().on("click",function(){n.cancelChanges()});(function(p){p.fn.enable=function(q){return p(this).each(function(){if(q){p(this).removeAttr("disabled")}else{p(this).attr("disabled","disabled")}})}})(jQuery);n.UI.enableEdit.off().on("click",function(){n.toggleUI()})},toggleUI:function(){var n=this,o=n.UI.enableEdit.is(":checked");if(!o){n.cancelChanges()}$.each(n.valuesOfConcern,function(p,q){n.UI[p].enable(o)});if(o){n.UI.saveChanges.show();n.UI.cancelChanges.show()}else{n.UI.saveChanges.hide();n.UI.cancelChanges.hide()}},cancelChanges:function(){var n=this,o=n.phyloTree.get("selectedNode");if(o){$.each(n.valuesOfConcern,function(p,q){n.UI[p].val(o[p])})}},updateNodes:function(){var n=this,o=n.phyloTree.get("selectedNode");if(o){if(!n.isAcceptableValue(n.UI.dist,0,1)||n.hasIllegalJsonCharacters(n.UI.name)||n.hasIllegalJsonCharacters(n.UI.annotation)){return}$.each(n.valuesOfConcern,function(p,q){(o[p])=n.UI[p].val()});n.phyloTree.set("nodeAttrChangedTime",new Date())}else{alert("No node selected")}}});var k=l.extend({initialize:function(){var n=this;$("#phyloVizSearchBtn").on("click",function(){var p=$("#phyloVizSearchTerm"),q=$("#phyloVizSearchCondition").val().split("-"),o=q[0],r=q[1];n.hasIllegalJsonCharacters(p);if(o==="dist"){n.isAcceptableValue(p,0,1)}n.searchTree(o,r,p.val())})},searchTree:function(n,p,o){m.selectAll("g.node").classed("searchHighlight",function(r){var q=r[n];if(typeof q!=="undefined"&&q!==null){if(n==="dist"){switch(p){case"greaterEqual":return q>=+o;case"lesserEqual":return q<=+o;default:return}}else{if(n==="name"||n==="annotation"){return q.toLowerCase().indexOf(o.toLowerCase())!==-1}}}})}});return{PhylovizView:j}});
\ No newline at end of file
diff -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a -r e802fed907e5341d2d50c94d546a65faf3978a1a static/scripts/viz/phyloviz.js
--- a/static/scripts/viz/phyloviz.js
+++ b/static/scripts/viz/phyloviz.js
@@ -199,6 +199,7 @@
this.set("dataset", new data_mod.Dataset({
id: options.dataset_id
}));
+
},
root : {}, // Root has to be its own independent object because it is not part of the viz_config
@@ -267,16 +268,14 @@
show_message("Saving to Galaxy", "progress");
return $.ajax({
- url : this.url,
+ url : this.url(),
type : "POST",
dataType: "json",
data : {
- vis_json: JSON.stringify(config)
+ config : JSON.stringify( config ),
+ type : 'phyloviz'
},
success: function(res){
- var viz_id = res.url.split("id=")[1].split("&")[0],
- viz_url = "/visualization?id=" + viz_id;
- window.history.pushState({}, "", viz_url + window.location.hash);
hide_modal();
}
});
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
[galaxyproject/usegalaxy-playbook] 9e763a: Static memory increases for certain tools.
by GitHub 13 Nov '14
by GitHub 13 Nov '14
13 Nov '14
Branch: refs/heads/master
Home: https://github.com/galaxyproject/usegalaxy-playbook
Commit: 9e763a5005cb48a34122e78c208607d7aae93783
https://github.com/galaxyproject/usegalaxy-playbook/commit/9e763a5005cb48a3…
Author: Nate Coraor <nate(a)bx.psu.edu>
Date: 2014-11-13 (Thu, 13 Nov 2014)
Changed paths:
M templates/galaxy/usegalaxy.org/config/job_conf.xml.j2
Log Message:
-----------
Static memory increases for certain tools.
Commit: ea2825245643691aa084a51976e19635b97ebe28
https://github.com/galaxyproject/usegalaxy-playbook/commit/ea2825245643691a…
Author: Nate Coraor <nate(a)bx.psu.edu>
Date: 2014-11-13 (Thu, 13 Nov 2014)
Changed paths:
M files/galaxy/test.galaxyproject.org/var/integrated_tool_panel.xml
M production/group_vars/all.yml
M stage/group_vars/all.yml
Log Message:
-----------
Update Test and Main.
Compare: https://github.com/galaxyproject/usegalaxy-playbook/compare/f1c38cf9ddc8...…
1
0
commit/galaxy-central: guerler: ToolForm: Test tool form width limits
by commits-noreply@bitbucket.org 13 Nov '14
by commits-noreply@bitbucket.org 13 Nov '14
13 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/e372aaa3b3bc/
Changeset: e372aaa3b3bc
User: guerler
Date: 2014-11-13 14:59:08+00:00
Summary: ToolForm: Test tool form width limits
Affected #: 5 files
diff -r dfdb4c8c2d12261bdc691ec0db32ad459b0c2525 -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a client/galaxy/scripts/mvc/tools/tools-form.js
--- a/client/galaxy/scripts/mvc/tools/tools-form.js
+++ b/client/galaxy/scripts/mvc/tools/tools-form.js
@@ -334,6 +334,7 @@
this.portlet = new Portlet.View({
icon : 'fa-wrench',
title: '<b>' + this.model.name + '</b> ' + this.model.description,
+ cls : 'ui-portlet-short',
operations: {
menu : menu
},
diff -r dfdb4c8c2d12261bdc691ec0db32ad459b0c2525 -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a static/scripts/mvc/tools/tools-form.js
--- a/static/scripts/mvc/tools/tools-form.js
+++ b/static/scripts/mvc/tools/tools-form.js
@@ -334,6 +334,7 @@
this.portlet = new Portlet.View({
icon : 'fa-wrench',
title: '<b>' + this.model.name + '</b> ' + this.model.description,
+ cls : 'ui-portlet-short',
operations: {
menu : menu
},
diff -r dfdb4c8c2d12261bdc691ec0db32ad459b0c2525 -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a static/scripts/packed/mvc/tools/tools-form.js
--- a/static/scripts/packed/mvc/tools/tools-form.js
+++ b/static/scripts/packed/mvc/tools/tools-form.js
@@ -1,1 +1,1 @@
-define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);this._buildForm(o)},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id,src:"hda"}).id_uncoded}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];switch(p.type){case"data":t=p.options;break;default:for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);v.trigger("change");console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
+define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);this._buildForm(o)},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id,src:"hda"}).id_uncoded}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];switch(p.type){case"data":t=p.options;break;default:for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);v.trigger("change");console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,cls:"ui-portlet-short",operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
diff -r dfdb4c8c2d12261bdc691ec0db32ad459b0c2525 -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -1279,7 +1279,7 @@
.upload-ftp .upload-ftp-help{margin-bottom:10px}
.upload-ftp .upload-ftp-warning{text-align:center;margin-top:20px}
.upload-settings .upload-settings-cover{position:absolute;width:100%;height:100%;top:0px;left:0px;background:#fff;opacity:0.4;cursor:no-drop}
-.no-highlight,.ui-button-icon,.ui-portlet,.ui-portlet-repeat{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;-ms-user-select:none;}
+.no-highlight,.ui-button-icon,.ui-portlet,.ui-portlet-short,.ui-portlet-repeat{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;-ms-user-select:none;}
.ui-error{-moz-border-radius:3px;border-radius:3px;background:#f9c7c5;padding:5px}
.ui-table-form-error{display:none}.ui-table-form-error .ui-table-form-error-text{padding-left:5px}
.ui-table tbody{cursor:pointer}
@@ -1302,11 +1302,12 @@
.ui-button-icon-plain{border:none !important;background:none !important;height:inherit !important;width:inherit !important;padding-right:3px !important}
.ui-tabs .ui-tabs-add{font-size:0.8em;margin-right:5px}
.ui-tabs .ui-tabs-delete{font-size:0.8em;margin-left:5px;cursor:pointer}
-.ui-portlet,.ui-portlet-repeat,.ui-portlet-repeat{border:solid #d6b161 1px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;position:relative;clear:both;width:auto;height:100%}.ui-portlet .portlet-header{background:#ebd9b2;border-bottom:solid #d6b161 1px;padding:2px 8px;overflow:visible;float:right;width:100%}.ui-portlet .portlet-header .portlet-title .portlet-title-text{vertical-align:middle}
-.ui-portlet .portlet-header .portlet-title .icon{font-size:1.2em;vertical-align:middle}
-.ui-portlet .portlet-buttons{height:50px;padding:10px}
-.ui-portlet .portlet-content{height:inherit;padding:10px;clear:both}.ui-portlet .portlet-content .content{padding:10px;height:100%;width:100%}.ui-portlet .portlet-content .content .buttons{height:50px;padding:10px}
-.ui-portlet .no-scroll{height:calc(100% - 80px)}
+.ui-portlet,.ui-portlet-short,.ui-portlet-repeat,.ui-portlet-short,.ui-portlet-repeat{border:solid #d6b161 1px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;position:relative;clear:both;width:auto;height:100%}.ui-portlet .portlet-header,.ui-portlet-short .portlet-header{background:#ebd9b2;border-bottom:solid #d6b161 1px;padding:2px 8px;overflow:visible;float:right;width:100%}.ui-portlet .portlet-header .portlet-title .portlet-title-text,.ui-portlet-short .portlet-header .portlet-title .portlet-title-text{vertical-align:middle}
+.ui-portlet .portlet-header .portlet-title .icon,.ui-portlet-short .portlet-header .portlet-title .icon{font-size:1.2em;vertical-align:middle}
+.ui-portlet .portlet-buttons,.ui-portlet-short .portlet-buttons{height:50px;padding:10px}
+.ui-portlet .portlet-content,.ui-portlet-short .portlet-content{height:inherit;padding:10px;clear:both}.ui-portlet .portlet-content .content,.ui-portlet-short .portlet-content .content{padding:10px;height:100%;width:100%}.ui-portlet .portlet-content .content .buttons,.ui-portlet-short .portlet-content .content .buttons{height:50px;padding:10px}
+.ui-portlet .no-scroll,.ui-portlet-short .no-scroll{height:calc(100% - 80px)}
+.ui-portlet-short .portlet-content{max-width:600px}
.ui-portlet-repeat{border:none;border-left:solid 3px #ebd9b2;border-radius:5px}.ui-portlet-repeat .portlet-header{background:#ebd9b2;border-radius:3px;border-bottom-left-radius:0px;padding:0px 2px}
.ui-portlet-repeat .portlet-content{padding:0px}.ui-portlet-repeat .portlet-content .content{padding:0px;padding-left:10px}
.ui-popover{max-width:700px;display:none}.ui-popover .popover-close{position:absolute;right:10px;top:7px;font-size:1.2em;cursor:pointer}
diff -r dfdb4c8c2d12261bdc691ec0db32ad459b0c2525 -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a static/style/src/less/ui.less
--- a/static/style/src/less/ui.less
+++ b/static/style/src/less/ui.less
@@ -200,6 +200,13 @@
}
}
+.ui-portlet-short {
+ &:extend(.ui-portlet all);
+ .portlet-content {
+ max-width: 600px;
+ }
+}
+
.ui-portlet-repeat {
&:extend(.ui-portlet);
border: none;
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: ToolForm: Fix collection ids
by commits-noreply@bitbucket.org 12 Nov '14
by commits-noreply@bitbucket.org 12 Nov '14
12 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/dfdb4c8c2d12/
Changeset: dfdb4c8c2d12
User: guerler
Date: 2014-11-12 20:33:53+00:00
Summary: ToolForm: Fix collection ids
Affected #: 1 file
diff -r 76ec1e41fe30300ce12c72167ce38990028f6c27 -r dfdb4c8c2d12261bdc691ec0db32ad459b0c2525 lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -2100,7 +2100,7 @@
if dataset_collection_matcher.hdca_match( hdca, reduction=multiple ):
d['options']['hdca'].append({
'id' : trans.security.encode_id( hdca.id ),
- 'id_uncoded' : hda.id,
+ 'id_uncoded' : hdca.id,
'hid' : hdca.hid,
'name' : hdca.name,
'src' : 'hdca'
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: ToolForm: Temporary modification of return dictionary for datasets
by commits-noreply@bitbucket.org 12 Nov '14
by commits-noreply@bitbucket.org 12 Nov '14
12 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/76ec1e41fe30/
Changeset: 76ec1e41fe30
User: guerler
Date: 2014-11-12 20:30:35+00:00
Summary: ToolForm: Temporary modification of return dictionary for datasets
Affected #: 4 files
diff -r 31f05a12912be544f59a85239e584eeac15a4b98 -r 76ec1e41fe30300ce12c72167ce38990028f6c27 client/galaxy/scripts/mvc/tools/tools-form.js
--- a/client/galaxy/scripts/mvc/tools/tools-form.js
+++ b/client/galaxy/scripts/mvc/tools/tools-form.js
@@ -148,7 +148,7 @@
var current_state = this.tree.finalize({
data : function(dict) {
if (dict.values.length > 0 && dict.values[0] && dict.values[0].src === 'hda') {
- return self.content.get({id: dict.values[0].id, src: 'hda'}).dataset_id;
+ return self.content.get({id: dict.values[0].id, src: 'hda'}).id_uncoded;
}
return null;
}
diff -r 31f05a12912be544f59a85239e584eeac15a4b98 -r 76ec1e41fe30300ce12c72167ce38990028f6c27 lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -2088,10 +2088,10 @@
if dataset_matcher.hda_match( hda ):
d['options']['hda'].append({
'id' : trans.security.encode_id( hda.id ),
+ 'id_uncoded' : hda.id,
'hid' : hda.hid,
'name' : hda.name,
- 'src' : 'hda',
- 'dataset_id' : hda.dataset_id
+ 'src' : 'hda'
})
# add dataset collections
@@ -2100,6 +2100,7 @@
if dataset_collection_matcher.hdca_match( hdca, reduction=multiple ):
d['options']['hdca'].append({
'id' : trans.security.encode_id( hdca.id ),
+ 'id_uncoded' : hda.id,
'hid' : hdca.hid,
'name' : hdca.name,
'src' : 'hdca'
diff -r 31f05a12912be544f59a85239e584eeac15a4b98 -r 76ec1e41fe30300ce12c72167ce38990028f6c27 static/scripts/mvc/tools/tools-form.js
--- a/static/scripts/mvc/tools/tools-form.js
+++ b/static/scripts/mvc/tools/tools-form.js
@@ -148,7 +148,7 @@
var current_state = this.tree.finalize({
data : function(dict) {
if (dict.values.length > 0 && dict.values[0] && dict.values[0].src === 'hda') {
- return self.content.get({id: dict.values[0].id, src: 'hda'}).dataset_id;
+ return self.content.get({id: dict.values[0].id, src: 'hda'}).id_uncoded;
}
return null;
}
diff -r 31f05a12912be544f59a85239e584eeac15a4b98 -r 76ec1e41fe30300ce12c72167ce38990028f6c27 static/scripts/packed/mvc/tools/tools-form.js
--- a/static/scripts/packed/mvc/tools/tools-form.js
+++ b/static/scripts/packed/mvc/tools/tools-form.js
@@ -1,1 +1,1 @@
-define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);this._buildForm(o)},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id,src:"hda"}).dataset_id}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];switch(p.type){case"data":t=p.options;break;default:for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);v.trigger("change");console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
+define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);this._buildForm(o)},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id,src:"hda"}).id_uncoded}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];switch(p.type){case"data":t=p.options;break;default:for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);v.trigger("change");console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: Pages: allow registry visualizations to display within an iframe; Refactor embed_item.less and minor style fixes
by commits-noreply@bitbucket.org 12 Nov '14
by commits-noreply@bitbucket.org 12 Nov '14
12 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/31f05a12912b/
Changeset: 31f05a12912b
User: carlfeberhard
Date: 2014-11-12 18:45:38+00:00
Summary: Pages: allow registry visualizations to display within an iframe; Refactor embed_item.less and minor style fixes
Affected #: 7 files
diff -r f26c2543ff053b9ff31617bc03f99d505302ecda -r 31f05a12912be544f59a85239e584eeac15a4b98 lib/galaxy/webapps/galaxy/controllers/page.py
--- a/lib/galaxy/webapps/galaxy/controllers/page.py
+++ b/lib/galaxy/webapps/galaxy/controllers/page.py
@@ -755,6 +755,28 @@
user_is_owner=user_is_owner, history_dict=history_dictionary, hda_dicts=hda_dictionaries )
return filled
+ def _get_embedded_visualization_html( self, trans, id ):
+ """
+ Returns html suitable for embedding visualizations in another page.
+ """
+ visualization = self.get_visualization( trans, id, False, True )
+ visualization.annotation = self.get_item_annotation_str( trans.sa_session, visualization.user, visualization )
+ if not visualization:
+ return None
+
+ # Fork to template based on visualization.type (registry or builtin).
+ if( ( trans.app.visualizations_registry and visualization.type in trans.app.visualizations_registry.plugins )
+ and ( visualization.type not in trans.app.visualizations_registry.BUILT_IN_VISUALIZATIONS ) ):
+ # if a registry visualization, load a version into an iframe :(
+ #TODO: simplest path from A to B but not optimal - will be difficult to do reg visualizations any other way
+ #TODO: this will load the visualization twice (once above, once when the iframe src calls 'saved')
+ encoded_visualization_id = trans.security.encode_id( visualization.id )
+ return trans.fill_template( 'visualization/embed_in_frame.mako',
+ item=visualization, encoded_visualization_id=encoded_visualization_id,
+ content_only=True )
+
+ return trans.fill_template( "visualization/embed.mako", item=visualization, item_data=None )
+
def _get_embed_html( self, trans, item_class, item_id ):
""" Returns HTML for embedding an item in a page. """
item_class = self.get_class( item_class )
@@ -776,10 +798,7 @@
return trans.fill_template( "workflow/embed.mako", item=workflow, item_data=workflow.latest_workflow.steps )
elif item_class == model.Visualization:
- visualization = self.get_visualization( trans, item_id, False, True )
- visualization.annotation = self.get_item_annotation_str( trans.sa_session, visualization.user, visualization )
- if visualization:
- return trans.fill_template( "visualization/embed.mako", item=visualization, item_data=None )
+ return self._get_embedded_visualization_html( trans, item_id )
elif item_class == model.Page:
pass
diff -r f26c2543ff053b9ff31617bc03f99d505302ecda -r 31f05a12912be544f59a85239e584eeac15a4b98 lib/galaxy/webapps/galaxy/controllers/visualization.py
--- a/lib/galaxy/webapps/galaxy/controllers/visualization.py
+++ b/lib/galaxy/webapps/galaxy/controllers/visualization.py
@@ -585,7 +585,7 @@
user_item_rating = 0
ave_item_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, visualization )
- # Display.
+ # Fork to template based on visualization.type (registry or builtin).
if( ( trans.app.visualizations_registry and visualization.type in trans.app.visualizations_registry.plugins )
and ( visualization.type not in trans.app.visualizations_registry.BUILT_IN_VISUALIZATIONS ) ):
# if a registry visualization, load a version of display.mako that will load the vis into an iframe :(
diff -r f26c2543ff053b9ff31617bc03f99d505302ecda -r 31f05a12912be544f59a85239e584eeac15a4b98 static/style/blue/embed_item.css
--- a/static/style/blue/embed_item.css
+++ b/static/style/blue/embed_item.css
@@ -1,19 +1,14 @@
-.embedded-item{margin:0em auto;width:90%;-moz-border-radius:0.5em;-webkit-border-radius:0.5em;border-radius:0.5em}
-.embedded-item.display{padding:5px 10px 10px 10px}
-.embedded-item.history{background-color:#c1c9e5}
-.embedded-item.history p{background:#c1c9e5 no-repeat 2px 2px;margin-top:0;margin-bottom:0}
-.embedded-item.dataset{background-color:#cfc}
-.embedded-item.dataset p{background:#cfc no-repeat 2px 2px;margin-top:0;margin-bottom:0}
-.embedded-item.workflow{background-color:#fbddb3}
-.embedded-item.workflow p{background:#fbddb3 no-repeat 2px 2px;margin-top:0;margin-bottom:0}
-.embedded-item.visualization{background-color:#bbb}
-.embedded-item.visualization p{background:#bbb no-repeat 2px 2px;margin-top:0;margin-bottom:0}
-.embedded-item .expanded-content{display:none;background-color:white;padding:5px}
-.embedded-item .item-content{max-height:25em;overflow:auto}
-.embedded-item.visualization .item-content{overflow:hidden}
+.embedded-item{margin:0em auto;width:90%;-moz-border-radius:0.5em;-webkit-border-radius:0.5em;border-radius:0.5em}.embedded-item .expanded-content{display:none;background-color:white}
+.embedded-item .item-content{max-height:45em;overflow:auto}
.embedded-item>.title{vertical-align:top;text-align:center;font-weight:bold;padding-bottom:5px}
.embedded-item.placeholder .content{padding:0.5em 0.5em;font-style:italic;text-align:center}
-table.annotated-item{width:100%;border-collapse:collapse}
-table.annotated-item td,th{padding:0}
-table.annotated-item .annotation{padding-left:2em;width:40%}
-table.annotated-item td.annotation{vertical-align:text-top;padding-top:1em}
+.embedded-item p{background:inherit;margin-top:0;margin-bottom:0}
+.embedded-item table.annotated-item{width:100%;border-collapse:collapse}
+.embedded-item table.annotated-item td,.embedded-item th{padding:0}
+.embedded-item table.annotated-item .annotation{padding-left:2em;width:40%}
+.embedded-item table.annotated-item td.annotation{vertical-align:text-top;padding-top:1em}
+.embedded-item.display{padding:5px 10px 10px 10px}
+.embedded-item.history{background-color:#C1C9E5}
+.embedded-item.dataset{background-color:#CFC}.embedded-item.dataset .item-content{padding:5px}
+.embedded-item.workflow{background-color:#FBDDB3}.embedded-item.workflow .item-content{padding:5px}
+.embedded-item.visualization{background-color:#BBBBBB}.embedded-item.visualization .item-content{overflow:hidden;height:100%}.embedded-item.visualization .item-content iframe{min-height:320px;margin-bottom:-4px}
diff -r f26c2543ff053b9ff31617bc03f99d505302ecda -r 31f05a12912be544f59a85239e584eeac15a4b98 static/style/src/less/embed_item.less
--- a/static/style/src/less/embed_item.less
+++ b/static/style/src/less/embed_item.less
@@ -4,6 +4,54 @@
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
border-radius: 0.5em;
+
+ .expanded-content {
+ display: none;
+ background-color: white;
+ }
+
+ .item-content {
+ max-height: 45em;
+ overflow: auto;
+ }
+
+ & > .title {
+ vertical-align: top;
+ text-align: center;
+ font-weight: bold;
+ padding-bottom: 5px;
+ }
+
+ &.placeholder .content {
+ padding: 0.5em 0.5em;
+ font-style: italic;
+ text-align: center;
+ }
+
+ p {
+ background: inherit;
+ margin-top:0;
+ margin-bottom:0;
+ }
+
+ table.annotated-item {
+ width: 100%;
+ border-collapse: collapse;
+ }
+
+ table.annotated-item td,th {
+ padding: 0;
+ }
+
+ table.annotated-item .annotation {
+ padding-left: 2em;
+ width: 40%;
+ }
+
+ table.annotated-item td.annotation {
+ vertical-align: text-top;
+ padding-top: 1em;
+ }
}
.embedded-item.display {
@@ -11,89 +59,32 @@
}
.embedded-item.history {
- background-color:#C1C9E5
-}
-
-.embedded-item.history p {
- background:#C1C9E5 no-repeat 2px 2px;
- margin-top:0;
- margin-bottom:0;
+ background-color: #C1C9E5;
}
.embedded-item.dataset {
- background-color:#CFC
-}
-
-.embedded-item.dataset p {
- background:#CFC no-repeat 2px 2px;
- margin-top:0;margin-bottom:0;
+ background-color: #CFC;
+ .item-content {
+ padding: 5px;
+ }
}
.embedded-item.workflow {
- background-color:#FBDDB3
-}
-
-.embedded-item.workflow p {
- background:#FBDDB3 no-repeat 2px 2px;
- margin-top:0;
- margin-bottom:0;
+ background-color: #FBDDB3;
+ .item-content {
+ padding: 5px;
+ }
}
.embedded-item.visualization {
- background-color:#BBBBBB
+ background-color: #BBBBBB;
+ .item-content {
+ overflow: hidden;
+ height: 100%;
+ iframe {
+ min-height: 320px;
+ //TODO: hack to fix small gap after iframe
+ margin-bottom: -4px;
+ }
+ }
}
-
-.embedded-item.visualization p {
- background:#BBBBBB no-repeat 2px 2px;
- margin-top:0;
- margin-bottom:0;
-}
-
-.embedded-item.placeholder{}
-
-.embedded-item .expanded-content {
- display: none;
- background-color: white;
- padding: 5px;
-}
-
-.embedded-item .item-content {
- max-height: 25em;
- overflow: auto;
-}
-
-.embedded-item.visualization .item-content {
- overflow: hidden;
-}
-
-.embedded-item > .title {
- vertical-align: top;
- text-align: center;
- font-weight: bold;
- padding-bottom: 5px;
-}
-
-.embedded-item.placeholder .content {
- padding: 0.5em 0.5em;
- font-style: italic;
- text-align: center;
-}
-
-table.annotated-item {
- width: 100%;
- border-collapse: collapse;
-}
-
-table.annotated-item td,th {
- padding: 0;
-}
-
-table.annotated-item .annotation {
- padding-left: 2em;
- width: 40%;
-}
-
-table.annotated-item td.annotation {
- vertical-align: text-top;
- padding-top: 1em;
-}
diff -r f26c2543ff053b9ff31617bc03f99d505302ecda -r 31f05a12912be544f59a85239e584eeac15a4b98 templates/webapps/galaxy/history/embed.mako
--- a/templates/webapps/galaxy/history/embed.mako
+++ b/templates/webapps/galaxy/history/embed.mako
@@ -1,4 +1,3 @@
-##<%inherit file="/embed_base.mako"/><%namespace file="/display_common.mako" import="*" />
## Some duplication with embed_base here, needed a way to override the main embedded-item html for histories
diff -r f26c2543ff053b9ff31617bc03f99d505302ecda -r 31f05a12912be544f59a85239e584eeac15a4b98 templates/webapps/galaxy/page/display.mako
--- a/templates/webapps/galaxy/page/display.mako
+++ b/templates/webapps/galaxy/page/display.mako
@@ -10,7 +10,8 @@
// (b) ...
$('.embedded-item').each( function() {
var container = $(this);
- if( container.hasClass( 'history' ) ){ return; }
+ if( container.hasClass( 'history' )
+ || container.hasClass( 'visualization' ) ){ return; }
// Show embedded item.
var show_embedded_item = function() {
@@ -119,10 +120,6 @@
.embedded-item.history .toggle {
display: inline;
}
- .embedded-item.history .expanded-content {
- /* generates a fake wide border */
- padding: 4px;
- }
/** wraps around the history */
.embedded-item.history .item-content {
background-color: white;
@@ -138,6 +135,11 @@
.annotated-history-panel .history-controls {
margin: 0px 0px 16px 0px;
}
+
+ /* ---------------------------- visualizations */
+ .embedded-item.visualization .item-content {
+ max-height: none;
+ }
</style></%def>
diff -r f26c2543ff053b9ff31617bc03f99d505302ecda -r 31f05a12912be544f59a85239e584eeac15a4b98 templates/webapps/galaxy/visualization/embed_in_frame.mako
--- /dev/null
+++ b/templates/webapps/galaxy/visualization/embed_in_frame.mako
@@ -0,0 +1,78 @@
+<%namespace file="/display_common.mako" import="*" />
+
+<%
+ import_href = h.url_for( controller='visualization', action='imp', id=encoded_visualization_id )
+ display_href = h.url_for( controller='visualization', action='display_by_username_and_slug',
+ username=item.user.username, slug=item.slug )
+%>
+<div id="visualization-${encoded_visualization_id}" class='embedded-item display visualization'>
+ <div class='title'>
+ <div style="float: left">
+ <a class="expand-content-btn icon-button toggle-expand" href="${display_href}"
+ title="Show or hide visualization"></a>
+ </div>
+ <div style="float: right;">
+ <a title="Import" class="icon-button import" href="${import_href}"></a>
+ <a title="View" class="icon-button go-to-full-screen" href="${display_href}"></a>
+ </div>
+ <h4>
+ <a class="toggle-embed" href="${display_href}" title="Show or hide visualization">
+ Galaxy Visualization | ${get_item_name( item )}
+ </a>
+ </h4>
+ %if hasattr( item, "annotation") and item.annotation:
+ <div class="annotation">${item.annotation}</div>
+ %endif
+ </div>
+ ##<div class='summary-content'>
+ ## currently, no summary content for visualization
+ ## could do the title or caption, whatever...
+ ##</div>
+ <div class='expanded-content'>
+ <div class='item-content'>
+ </div>
+ </div>
+</div>
+
+<script type="text/javascript">
+// Embedding the same visualization more than once will confuse DOM ids.
+// In order to handle this, find this script and cache the previous node (the div above).
+// (Since we need thisScript to be locally scoped or it will get overwritten, enclose in self-calling function)
+(function(){
+ var scripts = document.getElementsByTagName( 'script' ),
+ // this is executed immediately, so the last script will be this script
+ thisScript = scripts[ scripts.length - 1 ],
+ $embeddedObj = $( thisScript ).prev();
+
+ /** check for an existing iframe for this visualization, adding one to the item-content if needed */
+ function addVisualizationIFrame(){
+ var $embeddedObj = $( thisScript ).prev(),
+ $itemContent = $embeddedObj.find( '.expanded-content .item-content' ),
+ $iframe = $itemContent.find( 'iframe' );
+ if( $iframe.size() ){ return $iframe; }
+ return $itemContent.html([
+ '<iframe frameborder="0" width="100%" height="100%" ',
+ 'sandbox="allow-forms allow-same-origin allow-scripts" ',
+ 'src="/visualization/saved?id=${encoded_visualization_id}&embedded=True">',
+ '</iframe>'
+ ].join('')).find( 'iframe' );
+ }
+
+ /** 4 elements change when expanding - toggle them all, add the iframe and prevent the url change */
+ function toggleExpanded( ev ){
+ var $embeddedObj = $( thisScript ).prev();
+ $embeddedObj.find( '.expand-content-btn' ).toggleClass( 'toggle-expand' ).toggleClass( 'toggle' );
+ $embeddedObj.find( ".summary-content" ).slideToggle( "fast" );
+ $embeddedObj.find( ".annotation" ).slideToggle( "fast" );
+ $embeddedObj.find( ".expanded-content" ).slideToggle( "fast" );
+ addVisualizationIFrame();
+ ev.preventDefault();
+ }
+
+ // add expansion to +/- btn and title
+ $(function(){
+ $embeddedObj.find( '.expand-content-btn' ).click( toggleExpanded );
+ $embeddedObj.find( '.toggle-embed' ).click( toggleExpanded );
+ });
+})();
+</script>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: ToolForm: Trigger change event manually
by commits-noreply@bitbucket.org 12 Nov '14
by commits-noreply@bitbucket.org 12 Nov '14
12 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f26c2543ff05/
Changeset: f26c2543ff05
User: guerler
Date: 2014-11-12 16:30:59+00:00
Summary: ToolForm: Trigger change event manually
Affected #: 3 files
diff -r d7450b2567fb56f93ccc0191a7059ebb46b23cc5 -r f26c2543ff053b9ff31617bc03f99d505302ecda client/galaxy/scripts/mvc/tools/tools-form.js
--- a/client/galaxy/scripts/mvc/tools/tools-form.js
+++ b/client/galaxy/scripts/mvc/tools/tools-form.js
@@ -239,6 +239,7 @@
}
}
field.update(new_options);
+ field.trigger('change');
console.debug('Updating options for ' + input_id);
}
}
diff -r d7450b2567fb56f93ccc0191a7059ebb46b23cc5 -r f26c2543ff053b9ff31617bc03f99d505302ecda static/scripts/mvc/tools/tools-form.js
--- a/static/scripts/mvc/tools/tools-form.js
+++ b/static/scripts/mvc/tools/tools-form.js
@@ -239,6 +239,7 @@
}
}
field.update(new_options);
+ field.trigger('change');
console.debug('Updating options for ' + input_id);
}
}
diff -r d7450b2567fb56f93ccc0191a7059ebb46b23cc5 -r f26c2543ff053b9ff31617bc03f99d505302ecda static/scripts/packed/mvc/tools/tools-form.js
--- a/static/scripts/packed/mvc/tools/tools-form.js
+++ b/static/scripts/packed/mvc/tools/tools-form.js
@@ -1,1 +1,1 @@
-define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);this._buildForm(o)},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id,src:"hda"}).dataset_id}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];switch(p.type){case"data":t=p.options;break;default:for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
+define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);this._buildForm(o)},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id,src:"hda"}).dataset_id}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];switch(p.type){case"data":t=p.options;break;default:for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);v.trigger("change");console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: ToolForm: Show/hide single dataset selection field
by commits-noreply@bitbucket.org 12 Nov '14
by commits-noreply@bitbucket.org 12 Nov '14
12 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d7450b2567fb/
Changeset: d7450b2567fb
User: guerler
Date: 2014-11-12 08:13:37+00:00
Summary: ToolForm: Show/hide single dataset selection field
Affected #: 3 files
diff -r 4231a77fe8946110b2c56efd436000b864b06a84 -r d7450b2567fb56f93ccc0191a7059ebb46b23cc5 client/galaxy/scripts/mvc/tools/tools-select-content.js
--- a/client/galaxy/scripts/mvc/tools/tools-select-content.js
+++ b/client/galaxy/scripts/mvc/tools/tools-select-content.js
@@ -14,15 +14,62 @@
// add element
this.setElement('<div/>');
- // current selection
- this.current = 'single';
+ // list of select fields
+ this.list = {};
+
+ // radio button options
+ var radio_buttons = [];
+
+ // set initial state
+ if (!options.multiple) {
+ this.current = 'single';
+ } else {
+ this.current = 'multiple';
+ }
+
+ // add single dataset selector
+ if (!options.multiple) {
+ radio_buttons.push({icon: 'fa-file-o', label : 'Single dataset', value : 'single'});
+ this.select_single = new Ui.Select.View({
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+ this.list['single'] = {
+ field: this.select_single,
+ type : 'hda'
+ };
+ }
+
+ // add multiple dataset selector
+ radio_buttons.push({icon: 'fa-files-o', label : 'Multiple datasets', value : 'multiple' });
+ this.select_multiple = new Ui.Select.View({
+ multiple : true,
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+ this.list['multiple'] = {
+ field: this.select_multiple,
+ type : 'hda'
+ };
+
+ // add collection selector
+ radio_buttons.push({icon: 'fa-folder-o', label : 'List of datasets', value : 'collection' });
+ this.select_collection = new Ui.Select.View({
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+ this.list['collection'] = {
+ field: this.select_collection,
+ type : 'hdca'
+ };
// create button
this.button_type = new Ui.RadioButton.View({
value : this.current,
- data : [ { icon: 'fa-file-o', label : 'Single dataset', value : 'single' },
- { icon: 'fa-files-o', label : 'Multiple datasets', value : 'multiple' },
- { icon: 'fa-folder-o', label : 'List of datasets', value : 'collection' }],
+ data : radio_buttons,
onchange: function(value) {
self.current = value;
self.refresh();
@@ -30,44 +77,6 @@
}
});
- // single dataset select field
- this.select_single = new Ui.Select.View({
- onchange : function() {
- self.trigger('change');
- }
- });
-
- // multiple datasets select field
- this.select_multiple = new Ui.Select.View({
- multiple : true,
- onchange : function() {
- self.trigger('change');
- }
- });
-
- // collection select field
- this.select_collection = new Ui.Select.View({
- onchange : function() {
- self.trigger('change');
- }
- });
-
- // list of all select fields
- this.list = {
- 'single' : {
- field: this.select_single,
- type : 'hda'
- },
- 'multiple' : {
- field: this.select_multiple,
- type : 'hda'
- },
- 'collection' : {
- field: this.select_collection,
- type : 'hdca'
- }
- };
-
// add batch mode information
this.$batch = $(ToolTemplate.batchMode());
@@ -129,7 +138,7 @@
}
// update selection fields
- this.select_single.update(dataset_options);
+ this.select_single && this.select_single.update(dataset_options);
this.select_multiple.update(dataset_options);
this.select_collection.update(collection_options);
@@ -153,7 +162,7 @@
this.current = 'collection';
this.select_collection.value(list[0]);
} else {
- if (list.length > 1) {
+ if (list.length > 1 || this.options.multiple) {
this.current = 'multiple';
this.select_multiple.value(list);
} else {
diff -r 4231a77fe8946110b2c56efd436000b864b06a84 -r d7450b2567fb56f93ccc0191a7059ebb46b23cc5 static/scripts/mvc/tools/tools-select-content.js
--- a/static/scripts/mvc/tools/tools-select-content.js
+++ b/static/scripts/mvc/tools/tools-select-content.js
@@ -14,15 +14,62 @@
// add element
this.setElement('<div/>');
- // current selection
- this.current = 'single';
+ // list of select fields
+ this.list = {};
+
+ // radio button options
+ var radio_buttons = [];
+
+ // set initial state
+ if (!options.multiple) {
+ this.current = 'single';
+ } else {
+ this.current = 'multiple';
+ }
+
+ // add single dataset selector
+ if (!options.multiple) {
+ radio_buttons.push({icon: 'fa-file-o', label : 'Single dataset', value : 'single'});
+ this.select_single = new Ui.Select.View({
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+ this.list['single'] = {
+ field: this.select_single,
+ type : 'hda'
+ };
+ }
+
+ // add multiple dataset selector
+ radio_buttons.push({icon: 'fa-files-o', label : 'Multiple datasets', value : 'multiple' });
+ this.select_multiple = new Ui.Select.View({
+ multiple : true,
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+ this.list['multiple'] = {
+ field: this.select_multiple,
+ type : 'hda'
+ };
+
+ // add collection selector
+ radio_buttons.push({icon: 'fa-folder-o', label : 'List of datasets', value : 'collection' });
+ this.select_collection = new Ui.Select.View({
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+ this.list['collection'] = {
+ field: this.select_collection,
+ type : 'hdca'
+ };
// create button
this.button_type = new Ui.RadioButton.View({
value : this.current,
- data : [ { icon: 'fa-file-o', label : 'Single dataset', value : 'single' },
- { icon: 'fa-files-o', label : 'Multiple datasets', value : 'multiple' },
- { icon: 'fa-folder-o', label : 'List of datasets', value : 'collection' }],
+ data : radio_buttons,
onchange: function(value) {
self.current = value;
self.refresh();
@@ -30,44 +77,6 @@
}
});
- // single dataset select field
- this.select_single = new Ui.Select.View({
- onchange : function() {
- self.trigger('change');
- }
- });
-
- // multiple datasets select field
- this.select_multiple = new Ui.Select.View({
- multiple : true,
- onchange : function() {
- self.trigger('change');
- }
- });
-
- // collection select field
- this.select_collection = new Ui.Select.View({
- onchange : function() {
- self.trigger('change');
- }
- });
-
- // list of all select fields
- this.list = {
- 'single' : {
- field: this.select_single,
- type : 'hda'
- },
- 'multiple' : {
- field: this.select_multiple,
- type : 'hda'
- },
- 'collection' : {
- field: this.select_collection,
- type : 'hdca'
- }
- };
-
// add batch mode information
this.$batch = $(ToolTemplate.batchMode());
@@ -129,7 +138,7 @@
}
// update selection fields
- this.select_single.update(dataset_options);
+ this.select_single && this.select_single.update(dataset_options);
this.select_multiple.update(dataset_options);
this.select_collection.update(collection_options);
@@ -153,7 +162,7 @@
this.current = 'collection';
this.select_collection.value(list[0]);
} else {
- if (list.length > 1) {
+ if (list.length > 1 || this.options.multiple) {
this.current = 'multiple';
this.select_multiple.value(list);
} else {
diff -r 4231a77fe8946110b2c56efd436000b864b06a84 -r d7450b2567fb56f93ccc0191a7059ebb46b23cc5 static/scripts/packed/mvc/tools/tools-select-content.js
--- a/static/scripts/packed/mvc/tools/tools-select-content.js
+++ b/static/scripts/packed/mvc/tools/tools-select-content.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-tabs","mvc/tools/tools-template"],function(c,e,b,a){var d=Backbone.View.extend({initialize:function(j,g){this.app=j;this.options=g;var f=this;this.setElement("<div/>");this.current="single";this.button_type=new e.RadioButton.View({value:this.current,data:[{icon:"fa-file-o",label:"Single dataset",value:"single"},{icon:"fa-files-o",label:"Multiple datasets",value:"multiple"},{icon:"fa-folder-o",label:"List of datasets",value:"collection"}],onchange:function(i){f.current=i;f.refresh();f.trigger("change")}});this.select_single=new e.Select.View({onchange:function(){f.trigger("change")}});this.select_multiple=new e.Select.View({multiple:true,onchange:function(){f.trigger("change")}});this.select_collection=new e.Select.View({onchange:function(){f.trigger("change")}});this.list={single:{field:this.select_single,type:"hda"},multiple:{field:this.select_multiple,type:"hda"},collection:{field:this.select_collection,type:"hdca"}};this.$batch=$(a.batchMode());this.$el.append(c.wrap(this.button_type.$el));for(var h in this.list){this.$el.append(this.list[h].field.$el)}this.$el.append(this.$batch);this.update(g.data);this.refresh();this.on("change",function(){if(g.onchange){g.onchange(f.value())}})},wait:function(){for(var f in this.list){this.list[f].field.wait()}},unwait:function(){for(var f in this.list){this.list[f].field.unwait()}},update:function(g){var l=[];for(var j in g.hda){var k=g.hda[j];l.push({label:k.hid+": "+k.name,value:k.id})}var f=[];for(var j in g.hdca){var h=g.hdca[j];f.push({label:h.hid+": "+h.name,value:h.id})}this.select_single.update(l);this.select_multiple.update(l);this.select_collection.update(f);this.app.content.add(g)},value:function(m){if(m!==undefined){try{var l=[];for(var h in m.values){l.push(m.values[h].id)}if(m&&m.values.length>0&&m.values[0].src=="hcda"){this.current="collection";this.select_collection.value(l[0])}else{if(l.length>1){this.current="multiple";this.select_multiple.value(l)}else{this.current="single";this.select_single.value(l[0])}}this.refresh();var g=this._select();if(!g.validate()){g.value(g.first())}}catch(k){console.debug("tools-select-content::value() - Skipped.")}}var j=this._select().value();if(!(j instanceof Array)){j=[j]}var f={batch:!this.options.multiple,values:[]};for(var h in j){f.values.push({id:j[h],src:this.list[this.current].type})}return f},validate:function(){return this._select().validate()},refresh:function(){for(var g in this.list){var f=this.list[g].field.$el;if(this.current==g){f.show()}else{f.hide()}}if(this.current!="single"&&!this.options.multiple){this.$batch.show()}else{this.$batch.hide()}},_select:function(){return this.list[this.current].field}});return{View:d}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-tabs","mvc/tools/tools-template"],function(c,e,b,a){var d=Backbone.View.extend({initialize:function(k,g){this.app=k;this.options=g;var f=this;this.setElement("<div/>");this.list={};var j=[];if(!g.multiple){this.current="single"}else{this.current="multiple"}if(!g.multiple){j.push({icon:"fa-file-o",label:"Single dataset",value:"single"});this.select_single=new e.Select.View({onchange:function(){f.trigger("change")}});this.list.single={field:this.select_single,type:"hda"}}j.push({icon:"fa-files-o",label:"Multiple datasets",value:"multiple"});this.select_multiple=new e.Select.View({multiple:true,onchange:function(){f.trigger("change")}});this.list.multiple={field:this.select_multiple,type:"hda"};j.push({icon:"fa-folder-o",label:"List of datasets",value:"collection"});this.select_collection=new e.Select.View({onchange:function(){f.trigger("change")}});this.list.collection={field:this.select_collection,type:"hdca"};this.button_type=new e.RadioButton.View({value:this.current,data:j,onchange:function(i){f.current=i;f.refresh();f.trigger("change")}});this.$batch=$(a.batchMode());this.$el.append(c.wrap(this.button_type.$el));for(var h in this.list){this.$el.append(this.list[h].field.$el)}this.$el.append(this.$batch);this.update(g.data);this.refresh();this.on("change",function(){if(g.onchange){g.onchange(f.value())}})},wait:function(){for(var f in this.list){this.list[f].field.wait()}},unwait:function(){for(var f in this.list){this.list[f].field.unwait()}},update:function(g){var l=[];for(var j in g.hda){var k=g.hda[j];l.push({label:k.hid+": "+k.name,value:k.id})}var f=[];for(var j in g.hdca){var h=g.hdca[j];f.push({label:h.hid+": "+h.name,value:h.id})}this.select_single&&this.select_single.update(l);this.select_multiple.update(l);this.select_collection.update(f);this.app.content.add(g)},value:function(m){if(m!==undefined){try{var l=[];for(var h in m.values){l.push(m.values[h].id)}if(m&&m.values.length>0&&m.values[0].src=="hcda"){this.current="collection";this.select_collection.value(l[0])}else{if(l.length>1||this.options.multiple){this.current="multiple";this.select_multiple.value(l)}else{this.current="single";this.select_single.value(l[0])}}this.refresh();var g=this._select();if(!g.validate()){g.value(g.first())}}catch(k){console.debug("tools-select-content::value() - Skipped.")}}var j=this._select().value();if(!(j instanceof Array)){j=[j]}var f={batch:!this.options.multiple,values:[]};for(var h in j){f.values.push({id:j[h],src:this.list[this.current].type})}return f},validate:function(){return this._select().validate()},refresh:function(){for(var g in this.list){var f=this.list[g].field.$el;if(this.current==g){f.show()}else{f.hide()}}if(this.current!="single"&&!this.options.multiple){this.$batch.show()}else{this.$batch.hide()}},_select:function(){return this.list[this.current].field}});return{View:d}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: ToolForm: Match and sort datasets and collections through API, add single selection as default option
by commits-noreply@bitbucket.org 12 Nov '14
by commits-noreply@bitbucket.org 12 Nov '14
12 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/4231a77fe894/
Changeset: 4231a77fe894
User: guerler
Date: 2014-11-12 02:46:38+00:00
Summary: ToolForm: Match and sort datasets and collections through API, add single selection as default option
Affected #: 21 files
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 client/galaxy/scripts/mvc/tools/tools-content.js
--- a/client/galaxy/scripts/mvc/tools/tools-content.js
+++ b/client/galaxy/scripts/mvc/tools/tools-content.js
@@ -1,96 +1,23 @@
define(['utils/utils'], function(Utils){
return Backbone.Model.extend({
// initialize
- initialize: function(options) {
- // backup basic url
- this.base_url = galaxy_config.root + 'api/histories/' + options.history_id + '/contents';
-
- // prepare content obects
- this.datatypes = {};
+ initialize: function(app) {
this.summary = {};
-
- // link this
- var self = this;
-
- // request datatypes
- Utils.get({
- url : galaxy_config.root + 'api/datatypes/mapping',
- cache : true,
- success : function(response) {
- // backup datatype dictionary
- self.datatypes = response;
-
- // get history summary
- Utils.get({
- url : self.base_url + '?deleted=false',
- success : function(response) {
- // backup summary
- self.summary = response;
-
- // sort by id
- self.summary.sort(function(a, b) {
- return a.hid > b.hid ? -1 : (a.hid < b.hid ? 1 : 0);
- });
-
- // log
- console.debug('tools-content::initialize() - Completed.');
-
- // callback
- options.success && options.success();
- },
- error : function(response) {
- // log request failure
- console.debug('tools-content::initialize() - Ajax request for summary failed.');
- console.debug(response);
- }
- });
- },
- error : function(response) {
- // log request failure
- console.debug('tools-content::initialize() - Ajax request for datatypes failed.');
- console.debug(response);
- }
- });
},
- /**
- * Filters contents by data type.
+ /** Add new content elements
*/
- filterType: function(options) {
- // initialize parameters
- options = options || {};
- var result = [];
-
- // identify content type
- var history_content_type = 'dataset';
- if (options.src== 'hdca') {
- history_content_type = 'dataset_collection';
+ add: function(content_list) {
+ // add/update content in summary list
+ for (var i in content_list) {
+ for (var j in content_list[i]) {
+ var c = content_list[i][j];
+ this.summary[c.id + '_' + c.src] = c;
+ }
}
- // search in summary
- for (var i in this.summary) {
- var content = this.summary[i];
-
- // check ok state (TODO: should be implemented in the api)
- if (content.history_content_type === 'dataset' && content.state !== 'ok') {
- continue;
- }
-
- // match datatypes
- var found = false;
- for (var i in options.extensions) {
- if (this._matchType(options.extensions[i], content.extension)) {
- found = true;
- break;
- }
- }
-
- // final match result
- if ((content.history_content_type === history_content_type) && (found || !options.extensions)) {
- result.push(content);
- }
- }
- return result;
+ // log
+ console.debug('tools-content::initialize() - Completed.');
},
/** Returns matched content from summary.
@@ -126,33 +53,6 @@
console.debug(response);
}
});
- },
-
- /** Check if datatypes match
- */
- _matchType: function(target, reference) {
- // check if target class is available
- var target_class = this.datatypes.ext_to_class_name[target];
- if (!target_class) {
- console.debug('tools-content::_matchType() - Specific target class unavailable. Accepting all formats.');
- return true;
- }
-
- // check if reference class is available
- var reference_class = this.datatypes.ext_to_class_name[reference];
- if (!reference_class) {
- console.debug('tools-content::_matchType() - Specific reference class unavailable. Accepting all formats.');
- return true;
- }
-
- // check reference group
- var reference_group = this.datatypes.class_to_classes[reference_class];
- if (reference_group[target_class]) {
- return true;
- }
-
- // classes do not match
- return false;
}
});
});
\ No newline at end of file
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 client/galaxy/scripts/mvc/tools/tools-form.js
--- a/client/galaxy/scripts/mvc/tools/tools-form.js
+++ b/client/galaxy/scripts/mvc/tools/tools-form.js
@@ -21,11 +21,19 @@
var self = this;
// link galaxy modal or create one
- if (parent.Galaxy && parent.Galaxy.modal) {
- this.modal = parent.Galaxy.modal;
+ var galaxy = parent.Galaxy;
+ if (galaxy && galaxy.modal) {
+ this.modal = galaxy.modal;
} else {
this.modal = new Ui.Modal.View();
}
+
+ // check if the user is an admin
+ if (galaxy && galaxy.currUser) {
+ this.is_admin = galaxy.currUser.get('is_admin')
+ } else {
+ this.is_admin = false;
+ }
// link options
this.options = options;
@@ -47,12 +55,10 @@
this.job_handler = new ToolJobs(this);
// request history content and build form
- this.content = new ToolContent({
- history_id : self.options.history_id,
- success : function() {
- self._buildForm(self.options);
- }
- });
+ this.content = new ToolContent(this);
+
+ // build this form
+ this._buildForm(options);
},
// message
@@ -72,7 +78,7 @@
// this happens i.e. when repeat blocks are added or removed and on initialization
rebuild: function() {
this.tree.refresh();
- console.debug('tools-form::refresh() - Refreshed form structure.');
+ console.debug('tools-form::rebuild() - Rebuilding data structures.');
},
// refreshes input states i.e. for dynamic parameters
@@ -142,7 +148,7 @@
var current_state = this.tree.finalize({
data : function(dict) {
if (dict.values.length > 0 && dict.values[0] && dict.values[0].src === 'hda') {
- return self.content.get({id: dict.values[0].id}).dataset_id;
+ return self.content.get({id: dict.values[0].id, src: 'hda'}).dataset_id;
}
return null;
}
@@ -215,16 +221,22 @@
// get/update field
var field = self.field_list[input_id];
- if (field.update && input.type != 'data') {
+ if (field.update) {
var new_options = [];
- for (var i in node.options) {
- var opt = node.options[i];
- if (opt.length > 2) {
- new_options.push({
- 'label': opt[0],
- 'value': opt[1]
- });
- }
+ switch (input.type) {
+ case 'data':
+ new_options = input.options;
+ break;
+ default:
+ for (var i in node.options) {
+ var opt = node.options[i];
+ if (opt.length > 2) {
+ new_options.push({
+ 'label': opt[0],
+ 'value': opt[1]
+ });
+ }
+ }
}
field.update(new_options);
console.debug('Updating options for ' + input_id);
@@ -292,7 +304,7 @@
});
// add admin operations
- if (Galaxy.currUser.get('is_admin')) {
+ if (this.is_admin) {
// create download button
menu.addMenu({
icon : 'fa-download',
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 client/galaxy/scripts/mvc/tools/tools-jobs.js
--- a/client/galaxy/scripts/mvc/tools/tools-jobs.js
+++ b/client/galaxy/scripts/mvc/tools/tools-jobs.js
@@ -142,8 +142,8 @@
if (batch_n === -1) {
batch_n = n;
} else {
- if (batch_n !== n && n != 1) {
- this._foundError(input_id, 'Please make sure that you select a single input or the same number of inputs for all batch mode fields. This field contains <b>' + n + '</b> selection(s) while a previous field contains <b>' + batch_n + '</b>.');
+ if (batch_n !== n) {
+ this._foundError(input_id, 'Please make sure that you select the same number of inputs for all batch mode fields. This field contains <b>' + n + '</b> selection(s) while a previous field contains <b>' + batch_n + '</b>.');
return false;
}
}
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 client/galaxy/scripts/mvc/tools/tools-section.js
--- a/client/galaxy/scripts/mvc/tools/tools-section.js
+++ b/client/galaxy/scripts/mvc/tools/tools-section.js
@@ -372,6 +372,7 @@
id : 'field-' + input_def.id,
extensions : input_def.extensions,
multiple : input_def.multiple,
+ data : input_def.options,
onchange : function() {
self.app.refresh();
}
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 client/galaxy/scripts/mvc/tools/tools-select-content.js
--- a/client/galaxy/scripts/mvc/tools/tools-select-content.js
+++ b/client/galaxy/scripts/mvc/tools/tools-select-content.js
@@ -4,7 +4,8 @@
var View = Backbone.View.extend({
// initialize
initialize : function(app, options) {
- // configure options
+ // link app and options
+ this.app = app;
this.options = options;
// link this
@@ -14,13 +15,14 @@
this.setElement('<div/>');
// current selection
- this.current = 'hda';
+ this.current = 'single';
// create button
- this.button_new = new Ui.RadioButton.View({
+ this.button_type = new Ui.RadioButton.View({
value : this.current,
- data : [ { icon: 'fa-file-o', label : 'Select datasets', value : 'hda' },
- { icon: 'fa-files-o', label : 'Select a collection', value : 'hdca' }],
+ data : [ { icon: 'fa-file-o', label : 'Single dataset', value : 'single' },
+ { icon: 'fa-files-o', label : 'Multiple datasets', value : 'multiple' },
+ { icon: 'fa-folder-o', label : 'List of datasets', value : 'collection' }],
onchange: function(value) {
self.current = value;
self.refresh();
@@ -28,68 +30,56 @@
}
});
- //
- // datasets
- //
- var datasets = app.content.filterType({
- src : 'hda',
- extensions : options.extensions
- });
-
- // configure options fields
- var dataset_options = [];
- for (var i in datasets) {
- dataset_options.push({
- label: datasets[i].hid + ': ' + datasets[i].name,
- value: datasets[i].id
- });
- }
-
- // select field
- this.select_datasets = new Ui.Select.View({
- multiple : true,
- data : dataset_options,
- value : dataset_options[0] && dataset_options[0].value,
+ // single dataset select field
+ this.select_single = new Ui.Select.View({
onchange : function() {
self.trigger('change');
}
});
- //
- // collections
- //
- var collections = app.content.filterType({
- src : 'hdca',
- extensions : options.extensions
- });
-
- // configure options fields
- var collection_options = [];
- for (var i in collections) {
- collection_options.push({
- label: collections[i].hid + ': ' + collections[i].name,
- value: collections[i].id
- });
- }
-
- // create select field for collections
- this.select_collection = new Ui.Select.View({
- data : collection_options,
- value : collection_options[0] && collection_options[0].value,
+ // multiple datasets select field
+ this.select_multiple = new Ui.Select.View({
+ multiple : true,
onchange : function() {
self.trigger('change');
}
});
+ // collection select field
+ this.select_collection = new Ui.Select.View({
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+
+ // list of all select fields
+ this.list = {
+ 'single' : {
+ field: this.select_single,
+ type : 'hda'
+ },
+ 'multiple' : {
+ field: this.select_multiple,
+ type : 'hda'
+ },
+ 'collection' : {
+ field: this.select_collection,
+ type : 'hdca'
+ }
+ };
+
+ // add batch mode information
+ this.$batch = $(ToolTemplate.batchMode());
+
// add elements to dom
- this.$el.append(Utils.wrap(this.button_new.$el));
- this.$el.append(this.select_datasets.$el);
- this.$el.append(this.select_collection.$el);
+ this.$el.append(Utils.wrap(this.button_type.$el));
+ for (var i in this.list) {
+ this.$el.append(this.list[i].field.$el);
+ }
+ this.$el.append(this.$batch);
- // check for batch mode
- if (!this.options.multiple) {
- this.$el.append(ToolTemplate.batchMode());
- }
+ // update options
+ this.update(options.data);
// refresh view
this.refresh();
@@ -102,31 +92,77 @@
});
},
+ /** Indicate that select fields are being updated */
+ wait: function() {
+ for (var i in this.list) {
+ this.list[i].field.wait();
+ }
+ },
+
+ /** Indicate that the options update has been completed */
+ unwait: function() {
+ for (var i in this.list) {
+ this.list[i].field.unwait();
+ }
+ },
+
+ /** Update content selector */
+ update: function(options) {
+ // identify dataset options
+ var dataset_options = [];
+ for (var i in options.hda) {
+ var hda = options.hda[i];
+ dataset_options.push({
+ label: hda.hid + ': ' + hda.name,
+ value: hda.id
+ });
+ }
+
+ // identify collection options
+ var collection_options = [];
+ for (var i in options.hdca) {
+ var hdca = options.hdca[i];
+ collection_options.push({
+ label: hdca.hid + ': ' + hdca.name,
+ value: hdca.id
+ });
+ }
+
+ // update selection fields
+ this.select_single.update(dataset_options);
+ this.select_multiple.update(dataset_options);
+ this.select_collection.update(collection_options);
+
+ // add to content list
+ this.app.content.add(options);
+ },
+
/** Return the currently selected dataset values */
value : function (dict) {
// update current value
if (dict !== undefined) {
try {
- // set source
- this.current = dict.values[0].src;
- this.refresh();
-
// create list
var list = [];
for (var i in dict.values) {
list.push(dict.values[i].id);
}
- // identify select element
- switch(this.current) {
- case 'hda':
- this.select_datasets.value(list);
- break;
- case 'hdca':
- this.select_collection.value(list[0]);
- break;
+ // identify suitable select field
+ if (dict && dict.values.length > 0 && dict.values[0].src == 'hcda') {
+ this.current = 'collection';
+ this.select_collection.value(list[0]);
+ } else {
+ if (list.length > 1) {
+ this.current = 'multiple';
+ this.select_multiple.value(list);
+ } else {
+ this.current = 'single';
+ this.select_single.value(list[0]);
+ }
}
-
+ this.refresh();
+
// check if value has been set
var select = this._select();
if (!select.validate()) {
@@ -153,7 +189,7 @@
for (var i in id_list) {
result.values.push({
id : id_list[i],
- src : this.current
+ src : this.list[this.current].type
});
}
@@ -169,26 +205,24 @@
/** Refreshes data selection view */
refresh: function() {
- switch (this.current) {
- case 'hda':
- this.select_datasets.$el.fadeIn();
- this.select_collection.$el.hide();
- break;
- case 'hdca':
- this.select_datasets.$el.hide();
- this.select_collection.$el.fadeIn();
- break;
+ for (var i in this.list) {
+ var $el = this.list[i].field.$el;
+ if (this.current == i) {
+ $el.show();
+ } else {
+ $el.hide();
+ }
+ }
+ if (this.current != 'single' && !this.options.multiple) {
+ this.$batch.show();
+ } else {
+ this.$batch.hide();
}
},
/** Assists in selecting the current field */
_select: function() {
- switch(this.current) {
- case 'hdca':
- return this.select_collection;
- default:
- return this.select_datasets;
- }
+ return this.list[this.current].field;
}
});
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 client/galaxy/scripts/mvc/tools/tools-template.js
--- a/client/galaxy/scripts/mvc/tools/tools-template.js
+++ b/client/galaxy/scripts/mvc/tools/tools-template.js
@@ -56,7 +56,7 @@
batchMode: function() {
return '<div class="ui-table-form-info">' +
'<i class="fa fa-sitemap" style="font-size: 1.2em; padding: 2px 5px;"/>' +
- 'This is a batch mode input field. A separate job will be triggered for each dataset.'
+ 'This is a batch mode input field. A separate job will be triggered for each dataset.' +
'</div>';
}
};
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -2067,22 +2067,49 @@
return ref
def to_dict( self, trans, view='collection', value_mapper=None, other_values=None ):
+ # create dictionary and fill default parameters
d = super( DataToolParameter, self ).to_dict( trans )
d['extensions'] = self.extensions
d['multiple'] = self.multiple
+ d['is_dynamic'] = True
+ d['options'] = {'hda': [], 'hdca': []}
+
+ # return default content if context is not available
if other_values is None:
- # No need to produce lists of datasets for history.
return d
+ # prepare dataset/collection matching
dataset_matcher = DatasetMatcher( trans, self, None, other_values )
history = trans.history
multiple = self.multiple
- for hda_match, hid in self.match_datasets( history, dataset_matcher ):
- # hda_match not an hda - it is a description of the match, may
- # describe match after implicit conversion.
- pass
- for history_dataset_collection in self.match_collections( history, dataset_matcher, reduction=multiple ):
- pass
+
+ # add datasets
+ for hda in history.active_datasets_children_and_roles:
+ if dataset_matcher.hda_match( hda ):
+ d['options']['hda'].append({
+ 'id' : trans.security.encode_id( hda.id ),
+ 'hid' : hda.hid,
+ 'name' : hda.name,
+ 'src' : 'hda',
+ 'dataset_id' : hda.dataset_id
+ })
+
+ # add dataset collections
+ dataset_collection_matcher = DatasetCollectionMatcher( dataset_matcher )
+ for hdca in history.active_dataset_collections:
+ if dataset_collection_matcher.hdca_match( hdca, reduction=multiple ):
+ d['options']['hdca'].append({
+ 'id' : trans.security.encode_id( hdca.id ),
+ 'hid' : hdca.hid,
+ 'name' : hdca.name,
+ 'src' : 'hdca'
+ })
+
+ # sort both lists
+ d['options']['hda'] = sorted(d['options']['hda'], key=lambda k: k['hid'], reverse=True)
+ d['options']['hdca'] = sorted(d['options']['hdca'], key=lambda k: k['hid'], reverse=True)
+
+ # return final dictionary
return d
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 lib/galaxy/webapps/galaxy/api/history_contents.py
--- a/lib/galaxy/webapps/galaxy/api/history_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/history_contents.py
@@ -131,12 +131,13 @@
"""
api_type = "file"
encoded_id = trans.security.encode_id( hda.id )
+ encoded_dataset_id = trans.security.encode_id( hda.dataset_id );
# TODO: handle failed_metadata here as well
return {
'id' : encoded_id,
'history_id' : encoded_history_id,
- 'dataset_id' : hda.dataset_id,
+ 'dataset_id' : encoded_dataset_id,
'name' : hda.name,
'type' : api_type,
'state' : hda.dataset.state,
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 lib/galaxy/webapps/galaxy/api/tools.py
--- a/lib/galaxy/webapps/galaxy/api/tools.py
+++ b/lib/galaxy/webapps/galaxy/api/tools.py
@@ -575,11 +575,13 @@
dict['value'] = value
return dict
- # populate state
+ # initialize state using default parameters
def initialize_state(trans, inputs, state, context=None):
context = ExpressionContext(state, context)
for input in inputs.itervalues():
state[input.name] = input.get_initial_value(trans, context)
+
+ # populates state with incoming url parameters
def populate_state(trans, inputs, state, incoming, prefix="", context=None ):
errors = dict()
context = ExpressionContext(state, context)
@@ -630,12 +632,14 @@
state[input.name] = value
return errors
- # build model
+ # builds tool model including all attributes
def iterate(group_inputs, inputs, tool_state, errors, other_values=None):
other_values = ExpressionContext( tool_state, other_values )
for input_index, input in enumerate( inputs.itervalues() ):
# create model dictionary
group_inputs[input_index] = input.to_dict(trans)
+ if group_inputs[input_index] is None:
+ continue
# identify stat for subsection/group
group_state = tool_state[input.name]
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/mvc/tools/tools-content.js
--- a/static/scripts/mvc/tools/tools-content.js
+++ b/static/scripts/mvc/tools/tools-content.js
@@ -1,96 +1,23 @@
define(['utils/utils'], function(Utils){
return Backbone.Model.extend({
// initialize
- initialize: function(options) {
- // backup basic url
- this.base_url = galaxy_config.root + 'api/histories/' + options.history_id + '/contents';
-
- // prepare content obects
- this.datatypes = {};
+ initialize: function(app) {
this.summary = {};
-
- // link this
- var self = this;
-
- // request datatypes
- Utils.get({
- url : galaxy_config.root + 'api/datatypes/mapping',
- cache : true,
- success : function(response) {
- // backup datatype dictionary
- self.datatypes = response;
-
- // get history summary
- Utils.get({
- url : self.base_url + '?deleted=false',
- success : function(response) {
- // backup summary
- self.summary = response;
-
- // sort by id
- self.summary.sort(function(a, b) {
- return a.hid > b.hid ? -1 : (a.hid < b.hid ? 1 : 0);
- });
-
- // log
- console.debug('tools-content::initialize() - Completed.');
-
- // callback
- options.success && options.success();
- },
- error : function(response) {
- // log request failure
- console.debug('tools-content::initialize() - Ajax request for summary failed.');
- console.debug(response);
- }
- });
- },
- error : function(response) {
- // log request failure
- console.debug('tools-content::initialize() - Ajax request for datatypes failed.');
- console.debug(response);
- }
- });
},
- /**
- * Filters contents by data type.
+ /** Add new content elements
*/
- filterType: function(options) {
- // initialize parameters
- options = options || {};
- var result = [];
-
- // identify content type
- var history_content_type = 'dataset';
- if (options.src== 'hdca') {
- history_content_type = 'dataset_collection';
+ add: function(content_list) {
+ // add/update content in summary list
+ for (var i in content_list) {
+ for (var j in content_list[i]) {
+ var c = content_list[i][j];
+ this.summary[c.id + '_' + c.src] = c;
+ }
}
- // search in summary
- for (var i in this.summary) {
- var content = this.summary[i];
-
- // check ok state (TODO: should be implemented in the api)
- if (content.history_content_type === 'dataset' && content.state !== 'ok') {
- continue;
- }
-
- // match datatypes
- var found = false;
- for (var i in options.extensions) {
- if (this._matchType(options.extensions[i], content.extension)) {
- found = true;
- break;
- }
- }
-
- // final match result
- if ((content.history_content_type === history_content_type) && (found || !options.extensions)) {
- result.push(content);
- }
- }
- return result;
+ // log
+ console.debug('tools-content::initialize() - Completed.');
},
/** Returns matched content from summary.
@@ -126,33 +53,6 @@
console.debug(response);
}
});
- },
-
- /** Check if datatypes match
- */
- _matchType: function(target, reference) {
- // check if target class is available
- var target_class = this.datatypes.ext_to_class_name[target];
- if (!target_class) {
- console.debug('tools-content::_matchType() - Specific target class unavailable. Accepting all formats.');
- return true;
- }
-
- // check if reference class is available
- var reference_class = this.datatypes.ext_to_class_name[reference];
- if (!reference_class) {
- console.debug('tools-content::_matchType() - Specific reference class unavailable. Accepting all formats.');
- return true;
- }
-
- // check reference group
- var reference_group = this.datatypes.class_to_classes[reference_class];
- if (reference_group[target_class]) {
- return true;
- }
-
- // classes do not match
- return false;
}
});
});
\ No newline at end of file
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/mvc/tools/tools-form.js
--- a/static/scripts/mvc/tools/tools-form.js
+++ b/static/scripts/mvc/tools/tools-form.js
@@ -21,11 +21,19 @@
var self = this;
// link galaxy modal or create one
- if (parent.Galaxy && parent.Galaxy.modal) {
- this.modal = parent.Galaxy.modal;
+ var galaxy = parent.Galaxy;
+ if (galaxy && galaxy.modal) {
+ this.modal = galaxy.modal;
} else {
this.modal = new Ui.Modal.View();
}
+
+ // check if the user is an admin
+ if (galaxy && galaxy.currUser) {
+ this.is_admin = galaxy.currUser.get('is_admin')
+ } else {
+ this.is_admin = false;
+ }
// link options
this.options = options;
@@ -47,12 +55,10 @@
this.job_handler = new ToolJobs(this);
// request history content and build form
- this.content = new ToolContent({
- history_id : self.options.history_id,
- success : function() {
- self._buildForm(self.options);
- }
- });
+ this.content = new ToolContent(this);
+
+ // build this form
+ this._buildForm(options);
},
// message
@@ -72,7 +78,7 @@
// this happens i.e. when repeat blocks are added or removed and on initialization
rebuild: function() {
this.tree.refresh();
- console.debug('tools-form::refresh() - Refreshed form structure.');
+ console.debug('tools-form::rebuild() - Rebuilding data structures.');
},
// refreshes input states i.e. for dynamic parameters
@@ -142,7 +148,7 @@
var current_state = this.tree.finalize({
data : function(dict) {
if (dict.values.length > 0 && dict.values[0] && dict.values[0].src === 'hda') {
- return self.content.get({id: dict.values[0].id}).dataset_id;
+ return self.content.get({id: dict.values[0].id, src: 'hda'}).dataset_id;
}
return null;
}
@@ -215,16 +221,22 @@
// get/update field
var field = self.field_list[input_id];
- if (field.update && input.type != 'data') {
+ if (field.update) {
var new_options = [];
- for (var i in node.options) {
- var opt = node.options[i];
- if (opt.length > 2) {
- new_options.push({
- 'label': opt[0],
- 'value': opt[1]
- });
- }
+ switch (input.type) {
+ case 'data':
+ new_options = input.options;
+ break;
+ default:
+ for (var i in node.options) {
+ var opt = node.options[i];
+ if (opt.length > 2) {
+ new_options.push({
+ 'label': opt[0],
+ 'value': opt[1]
+ });
+ }
+ }
}
field.update(new_options);
console.debug('Updating options for ' + input_id);
@@ -292,7 +304,7 @@
});
// add admin operations
- if (Galaxy.currUser.get('is_admin')) {
+ if (this.is_admin) {
// create download button
menu.addMenu({
icon : 'fa-download',
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/mvc/tools/tools-jobs.js
--- a/static/scripts/mvc/tools/tools-jobs.js
+++ b/static/scripts/mvc/tools/tools-jobs.js
@@ -142,8 +142,8 @@
if (batch_n === -1) {
batch_n = n;
} else {
- if (batch_n !== n && n != 1) {
- this._foundError(input_id, 'Please make sure that you select a single input or the same number of inputs for all batch mode fields. This field contains <b>' + n + '</b> selection(s) while a previous field contains <b>' + batch_n + '</b>.');
+ if (batch_n !== n) {
+ this._foundError(input_id, 'Please make sure that you select the same number of inputs for all batch mode fields. This field contains <b>' + n + '</b> selection(s) while a previous field contains <b>' + batch_n + '</b>.');
return false;
}
}
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/mvc/tools/tools-section.js
--- a/static/scripts/mvc/tools/tools-section.js
+++ b/static/scripts/mvc/tools/tools-section.js
@@ -372,6 +372,7 @@
id : 'field-' + input_def.id,
extensions : input_def.extensions,
multiple : input_def.multiple,
+ data : input_def.options,
onchange : function() {
self.app.refresh();
}
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/mvc/tools/tools-select-content.js
--- a/static/scripts/mvc/tools/tools-select-content.js
+++ b/static/scripts/mvc/tools/tools-select-content.js
@@ -4,7 +4,8 @@
var View = Backbone.View.extend({
// initialize
initialize : function(app, options) {
- // configure options
+ // link app and options
+ this.app = app;
this.options = options;
// link this
@@ -14,13 +15,14 @@
this.setElement('<div/>');
// current selection
- this.current = 'hda';
+ this.current = 'single';
// create button
- this.button_new = new Ui.RadioButton.View({
+ this.button_type = new Ui.RadioButton.View({
value : this.current,
- data : [ { icon: 'fa-file-o', label : 'Select datasets', value : 'hda' },
- { icon: 'fa-files-o', label : 'Select a collection', value : 'hdca' }],
+ data : [ { icon: 'fa-file-o', label : 'Single dataset', value : 'single' },
+ { icon: 'fa-files-o', label : 'Multiple datasets', value : 'multiple' },
+ { icon: 'fa-folder-o', label : 'List of datasets', value : 'collection' }],
onchange: function(value) {
self.current = value;
self.refresh();
@@ -28,68 +30,56 @@
}
});
- //
- // datasets
- //
- var datasets = app.content.filterType({
- src : 'hda',
- extensions : options.extensions
- });
-
- // configure options fields
- var dataset_options = [];
- for (var i in datasets) {
- dataset_options.push({
- label: datasets[i].hid + ': ' + datasets[i].name,
- value: datasets[i].id
- });
- }
-
- // select field
- this.select_datasets = new Ui.Select.View({
- multiple : true,
- data : dataset_options,
- value : dataset_options[0] && dataset_options[0].value,
+ // single dataset select field
+ this.select_single = new Ui.Select.View({
onchange : function() {
self.trigger('change');
}
});
- //
- // collections
- //
- var collections = app.content.filterType({
- src : 'hdca',
- extensions : options.extensions
- });
-
- // configure options fields
- var collection_options = [];
- for (var i in collections) {
- collection_options.push({
- label: collections[i].hid + ': ' + collections[i].name,
- value: collections[i].id
- });
- }
-
- // create select field for collections
- this.select_collection = new Ui.Select.View({
- data : collection_options,
- value : collection_options[0] && collection_options[0].value,
+ // multiple datasets select field
+ this.select_multiple = new Ui.Select.View({
+ multiple : true,
onchange : function() {
self.trigger('change');
}
});
+ // collection select field
+ this.select_collection = new Ui.Select.View({
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+
+ // list of all select fields
+ this.list = {
+ 'single' : {
+ field: this.select_single,
+ type : 'hda'
+ },
+ 'multiple' : {
+ field: this.select_multiple,
+ type : 'hda'
+ },
+ 'collection' : {
+ field: this.select_collection,
+ type : 'hdca'
+ }
+ };
+
+ // add batch mode information
+ this.$batch = $(ToolTemplate.batchMode());
+
// add elements to dom
- this.$el.append(Utils.wrap(this.button_new.$el));
- this.$el.append(this.select_datasets.$el);
- this.$el.append(this.select_collection.$el);
+ this.$el.append(Utils.wrap(this.button_type.$el));
+ for (var i in this.list) {
+ this.$el.append(this.list[i].field.$el);
+ }
+ this.$el.append(this.$batch);
- // check for batch mode
- if (!this.options.multiple) {
- this.$el.append(ToolTemplate.batchMode());
- }
+ // update options
+ this.update(options.data);
// refresh view
this.refresh();
@@ -102,31 +92,77 @@
});
},
+ /** Indicate that select fields are being updated */
+ wait: function() {
+ for (var i in this.list) {
+ this.list[i].field.wait();
+ }
+ },
+
+ /** Indicate that the options update has been completed */
+ unwait: function() {
+ for (var i in this.list) {
+ this.list[i].field.unwait();
+ }
+ },
+
+ /** Update content selector */
+ update: function(options) {
+ // identify dataset options
+ var dataset_options = [];
+ for (var i in options.hda) {
+ var hda = options.hda[i];
+ dataset_options.push({
+ label: hda.hid + ': ' + hda.name,
+ value: hda.id
+ });
+ }
+
+ // identify collection options
+ var collection_options = [];
+ for (var i in options.hdca) {
+ var hdca = options.hdca[i];
+ collection_options.push({
+ label: hdca.hid + ': ' + hdca.name,
+ value: hdca.id
+ });
+ }
+
+ // update selection fields
+ this.select_single.update(dataset_options);
+ this.select_multiple.update(dataset_options);
+ this.select_collection.update(collection_options);
+
+ // add to content list
+ this.app.content.add(options);
+ },
+
/** Return the currently selected dataset values */
value : function (dict) {
// update current value
if (dict !== undefined) {
try {
- // set source
- this.current = dict.values[0].src;
- this.refresh();
-
// create list
var list = [];
for (var i in dict.values) {
list.push(dict.values[i].id);
}
- // identify select element
- switch(this.current) {
- case 'hda':
- this.select_datasets.value(list);
- break;
- case 'hdca':
- this.select_collection.value(list[0]);
- break;
+ // identify suitable select field
+ if (dict && dict.values.length > 0 && dict.values[0].src == 'hcda') {
+ this.current = 'collection';
+ this.select_collection.value(list[0]);
+ } else {
+ if (list.length > 1) {
+ this.current = 'multiple';
+ this.select_multiple.value(list);
+ } else {
+ this.current = 'single';
+ this.select_single.value(list[0]);
+ }
}
-
+ this.refresh();
+
// check if value has been set
var select = this._select();
if (!select.validate()) {
@@ -153,7 +189,7 @@
for (var i in id_list) {
result.values.push({
id : id_list[i],
- src : this.current
+ src : this.list[this.current].type
});
}
@@ -169,26 +205,24 @@
/** Refreshes data selection view */
refresh: function() {
- switch (this.current) {
- case 'hda':
- this.select_datasets.$el.fadeIn();
- this.select_collection.$el.hide();
- break;
- case 'hdca':
- this.select_datasets.$el.hide();
- this.select_collection.$el.fadeIn();
- break;
+ for (var i in this.list) {
+ var $el = this.list[i].field.$el;
+ if (this.current == i) {
+ $el.show();
+ } else {
+ $el.hide();
+ }
+ }
+ if (this.current != 'single' && !this.options.multiple) {
+ this.$batch.show();
+ } else {
+ this.$batch.hide();
}
},
/** Assists in selecting the current field */
_select: function() {
- switch(this.current) {
- case 'hdca':
- return this.select_collection;
- default:
- return this.select_datasets;
- }
+ return this.list[this.current].field;
}
});
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/mvc/tools/tools-template.js
--- a/static/scripts/mvc/tools/tools-template.js
+++ b/static/scripts/mvc/tools/tools-template.js
@@ -56,7 +56,7 @@
batchMode: function() {
return '<div class="ui-table-form-info">' +
'<i class="fa fa-sitemap" style="font-size: 1.2em; padding: 2px 5px;"/>' +
- 'This is a batch mode input field. A separate job will be triggered for each dataset.'
+ 'This is a batch mode input field. A separate job will be triggered for each dataset.' +
'</div>';
}
};
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/packed/mvc/tools/tools-content.js
--- a/static/scripts/packed/mvc/tools/tools-content.js
+++ b/static/scripts/packed/mvc/tools/tools-content.js
@@ -1,1 +1,1 @@
-define(["utils/utils"],function(a){return Backbone.Model.extend({initialize:function(c){this.base_url=galaxy_config.root+"api/histories/"+c.history_id+"/contents";this.datatypes={};this.summary={};var b=this;a.get({url:galaxy_config.root+"api/datatypes/mapping",cache:true,success:function(d){b.datatypes=d;a.get({url:b.base_url+"?deleted=false",success:function(e){b.summary=e;b.summary.sort(function(g,f){return g.hid>f.hid?-1:(g.hid<f.hid?1:0)});console.debug("tools-content::initialize() - Completed.");c.success&&c.success()},error:function(e){console.debug("tools-content::initialize() - Ajax request for summary failed.");console.debug(e)}})},error:function(d){console.debug("tools-content::initialize() - Ajax request for datatypes failed.");console.debug(d)}})},filterType:function(c){c=c||{};var b=[];var g="dataset";if(c.src=="hdca"){g="dataset_collection"}for(var d in this.summary){var e=this.summary[d];if(e.history_content_type==="dataset"&&e.state!=="ok"){continue}var f=false;for(var d in c.extensions){if(this._matchType(c.extensions[d],e.extension)){f=true;break}}if((e.history_content_type===g)&&(f||!c.extensions)){b.push(e)}}return b},get:function(b){return _.findWhere(this.summary,b)||{}},getDetails:function(b){if(!b.id||b.id==="null"){b.success&&b.success();return}var c=this.base_url+"/datasets/"+b.id;if(b.src=="hdca"){c=this.base_url+"/dataset_collections/"+b.id}a.get({url:c,success:function(d){b.success&&b.success(d)},error:function(d){b.success&&b.success();console.debug("tools-content::getDetails() - Ajax request for content failed.");console.debug(d)}})},_matchType:function(f,b){var c=this.datatypes.ext_to_class_name[f];if(!c){console.debug("tools-content::_matchType() - Specific target class unavailable. Accepting all formats.");return true}var d=this.datatypes.ext_to_class_name[b];if(!d){console.debug("tools-content::_matchType() - Specific reference class unavailable. Accepting all formats.");return true}var e=this.datatypes.class_to_classes[d];if(e[c]){return true}return false}})});
\ No newline at end of file
+define(["utils/utils"],function(a){return Backbone.Model.extend({initialize:function(b){this.summary={}},add:function(e){for(var d in e){for(var b in e[d]){var f=e[d][b];this.summary[f.id+"_"+f.src]=f}}console.debug("tools-content::initialize() - Completed.")},get:function(b){return _.findWhere(this.summary,b)||{}},getDetails:function(b){if(!b.id||b.id==="null"){b.success&&b.success();return}var c=this.base_url+"/datasets/"+b.id;if(b.src=="hdca"){c=this.base_url+"/dataset_collections/"+b.id}a.get({url:c,success:function(d){b.success&&b.success(d)},error:function(d){b.success&&b.success();console.debug("tools-content::getDetails() - Ajax request for content failed.");console.debug(d)}})}})});
\ No newline at end of file
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/packed/mvc/tools/tools-form.js
--- a/static/scripts/packed/mvc/tools/tools-form.js
+++ b/static/scripts/packed/mvc/tools/tools-form.js
@@ -1,1 +1,1 @@
-define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;if(parent.Galaxy&&parent.Galaxy.modal){this.modal=parent.Galaxy.modal}else{this.modal=new m.Modal.View()}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f({history_id:n.options.history_id,success:function(){n._buildForm(n.options)}})},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::refresh() - Refreshed form structure.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id}).dataset_id}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update&&p.type!="data"){var t=[];for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}v.update(t);console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(Galaxy.currUser.get("is_admin")){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
+define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);this._buildForm(o)},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id,src:"hda"}).dataset_id}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];switch(p.type){case"data":t=p.options;break;default:for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/packed/mvc/tools/tools-jobs.js
--- a/static/scripts/packed/mvc/tools/tools-jobs.js
+++ b/static/scripts/packed/mvc/tools/tools-jobs.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/tools/tools-template"],function(b,a){return Backbone.Model.extend({initialize:function(d,c){this.app=d;this.options=b.merge(c,this.optionsDefault)},submit:function(){var c=this;var d={tool_id:this.app.options.id,inputs:this.app.tree.finalize()};this.app.reset();if(!this._validation(d)){console.debug("tools-jobs::submit - Submission canceled. Validation failed.");return}console.debug(d);this.app.modal.show({title:"Please wait...",body:"progress",closing_events:true,buttons:{Close:function(){c.app.modal.hide()}}});b.request({type:"POST",url:galaxy_config.root+"api/tools",data:d,success:function(e){c.app.modal.hide();c.app.message(a.success(e));c._refreshHdas()},error:function(e,g){c.app.modal.hide();if(e&&e.message&&e.message.data){var h=c.app.tree.matchResponse(e.message.data);for(var f in h){c._foundError(f,h[f]);break}}else{console.debug(e);c.app.modal.show({title:"Job submission failed",body:a.error(d),buttons:{Close:function(){c.app.modal.hide()}}})}}})},_foundError:function(c,d){var e=this.app.element_list[c];e.error(d||"Please verify this parameter.");$(this.app.container).animate({scrollTop:e.$el.offset().top-20},500)},_validation:function(h){var d=h.inputs;var m=-1;var i=null;for(var k in d){var f=d[k];var l=this.app.tree.match(k);var e=this.app.field_list[l];var j=this.app.input_list[l];if(j&&e&&e.validate&&!e.validate()){this._foundError(l);return false}if(f.batch){var g=f.values.length;var c=null;if(g>0){c=f.values[0]&&f.values[0].src}if(c){if(i===null){i=c}else{if(i!==c){this._foundError(l,"Please select either dataset or dataset list fields for all batch mode fields.");return false}}}if(m===-1){m=g}else{if(m!==g&&g!=1){this._foundError(l,"Please make sure that you select a single input or the same number of inputs for all batch mode fields. This field contains <b>"+g+"</b> selection(s) while a previous field contains <b>"+m+"</b>.");return false}}}}return true},_refreshHdas:function(){if(parent.Galaxy&&parent.Galaxy.currHistoryPanel){parent.Galaxy.currHistoryPanel.refreshContents()}}})});
\ No newline at end of file
+define(["utils/utils","mvc/tools/tools-template"],function(b,a){return Backbone.Model.extend({initialize:function(d,c){this.app=d;this.options=b.merge(c,this.optionsDefault)},submit:function(){var c=this;var d={tool_id:this.app.options.id,inputs:this.app.tree.finalize()};this.app.reset();if(!this._validation(d)){console.debug("tools-jobs::submit - Submission canceled. Validation failed.");return}console.debug(d);this.app.modal.show({title:"Please wait...",body:"progress",closing_events:true,buttons:{Close:function(){c.app.modal.hide()}}});b.request({type:"POST",url:galaxy_config.root+"api/tools",data:d,success:function(e){c.app.modal.hide();c.app.message(a.success(e));c._refreshHdas()},error:function(e,g){c.app.modal.hide();if(e&&e.message&&e.message.data){var h=c.app.tree.matchResponse(e.message.data);for(var f in h){c._foundError(f,h[f]);break}}else{console.debug(e);c.app.modal.show({title:"Job submission failed",body:a.error(d),buttons:{Close:function(){c.app.modal.hide()}}})}}})},_foundError:function(c,d){var e=this.app.element_list[c];e.error(d||"Please verify this parameter.");$(this.app.container).animate({scrollTop:e.$el.offset().top-20},500)},_validation:function(h){var d=h.inputs;var m=-1;var i=null;for(var k in d){var f=d[k];var l=this.app.tree.match(k);var e=this.app.field_list[l];var j=this.app.input_list[l];if(j&&e&&e.validate&&!e.validate()){this._foundError(l);return false}if(f.batch){var g=f.values.length;var c=null;if(g>0){c=f.values[0]&&f.values[0].src}if(c){if(i===null){i=c}else{if(i!==c){this._foundError(l,"Please select either dataset or dataset list fields for all batch mode fields.");return false}}}if(m===-1){m=g}else{if(m!==g){this._foundError(l,"Please make sure that you select the same number of inputs for all batch mode fields. This field contains <b>"+g+"</b> selection(s) while a previous field contains <b>"+m+"</b>.");return false}}}}return true},_refreshHdas:function(){if(parent.Galaxy&&parent.Galaxy.currHistoryPanel){parent.Galaxy.currHistoryPanel.refreshContents()}}})});
\ No newline at end of file
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/packed/mvc/tools/tools-section.js
--- a/static/scripts/packed/mvc/tools/tools-section.js
+++ b/static/scripts/packed/mvc/tools/tools-section.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/tools/tools-repeat","mvc/tools/tools-select-content","mvc/tools/tools-input"],function(d,b,g,c,a,e){var f=Backbone.View.extend({initialize:function(i,h){this.app=i;this.inputs=h.inputs;h.cls_tr="section-row";this.table=new b.View(h);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var h in this.inputs){this._add(this.inputs[h])}},_add:function(j){var i=this;var h=jQuery.extend(true,{},j);h.id=j.id=d.uuid();this.app.input_list[h.id]=h;var k=h.type;switch(k){case"conditional":this._addConditional(h);break;case"repeat":this._addRepeat(h);break;default:this._addRow(h)}},_addConditional:function(h){var j=this;h.test_param.id=h.id;var m=this._addRow(h.test_param);m.options.onchange=function(t){var p=j.app.tree.matchCase(h,t);for(var r in h.cases){var w=h.cases[r];var u=h.id+"-section-"+r;var o=j.table.get(u);var v=false;for(var q in w.inputs){var s=w.inputs[q].type;if(s&&s!=="hidden"){v=true;break}}if(r==p&&v){o.fadeIn("fast")}else{o.hide()}}j.app.refresh()};for(var l in h.cases){var k=h.id+"-section-"+l;var n=new f(this.app,{inputs:h.cases[l].inputs,cls:"ui-table-plain"});n.$el.addClass("ui-table-form-section");this.table.add(n.$el);this.table.append(k)}m.trigger("change")},_addRepeat:function(o){var r=this;var p=0;function m(i,t){var s=o.id+"-section-"+(p++);var u=null;if(t){u=function(){k.del(s);k.retitle(o.title);r.app.rebuild();r.app.refresh()}}var v=new f(r.app,{inputs:i,cls:"ui-table-plain"});k.add({id:s,title:o.title,$el:v.$el,ondel:u});k.retitle(o.title)}var k=new c.View({title_new:o.title,max:o.max,onnew:function(){m(o.inputs,true);r.app.rebuild();r.app.refresh()}});var h=o.min;var q=_.size(o.cache);for(var l=0;l<Math.max(q,h);l++){var n=null;if(l<q){n=o.cache[l]}else{n=o.inputs}m(n,l>=h)}var j=new e(this.app,{label:o.title,help:o.help,field:k});j.$el.addClass("ui-table-form-section");this.table.add(j.$el);this.table.append(o.id)},_addRow:function(h){var k=h.id;var i=this._createField(h);if(h.is_dynamic){this.app.is_dynamic=true}this.app.field_list[k]=i;var j=new e(this.app,{label:h.label,optional:h.optional,help:h.help,field:i});this.app.element_list[k]=j;this.table.add(j.$el);this.table.append(k);return i},_createField:function(h){var i=null;switch(h.type){case"text":i=this._fieldText(h);break;case"select":i=this._fieldSelect(h);break;case"data":i=this._fieldData(h);break;case"data_column":i=this._fieldSelect(h);break;case"hidden":i=this._fieldHidden(h);break;case"integer":i=this._fieldSlider(h);break;case"float":i=this._fieldSlider(h);break;case"boolean":i=this._fieldBoolean(h);break;case"genomebuild":i=this._fieldSelect(h);break;default:this.app.incompatible=true;if(h.options){i=this._fieldSelect(h)}else{i=this._fieldText(h)}console.debug("tools-form::_addRow() : Auto matched field type ("+h.type+").")}if(h.value!==undefined){i.value(h.value)}return i},_fieldData:function(h){var i=this;return new a.View(this.app,{id:"field-"+h.id,extensions:h.extensions,multiple:h.multiple,onchange:function(){i.app.refresh()}})},_fieldSelect:function(h){var k=[];for(var l in h.options){var m=h.options[l];k.push({label:m[0],value:m[1]})}var n=g.Select;switch(h.display){case"checkboxes":n=g.Checkbox;break;case"radio":n=g.Radio;break}var j=this;return new n.View({id:"field-"+h.id,data:k,multiple:h.multiple,onchange:function(){j.app.refresh()}})},_fieldText:function(h){var i=this;return new g.Input({id:"field-"+h.id,area:h.area,onchange:function(){i.app.refresh()}})},_fieldSlider:function(h){return new g.Slider.View({id:"field-"+h.id,precise:h.type=="float",min:h.min,max:h.max})},_fieldHidden:function(h){return new g.Hidden({id:"field-"+h.id})},_fieldBoolean:function(h){return new g.RadioButton.View({id:"field-"+h.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]})}});return{View:f}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/tools/tools-repeat","mvc/tools/tools-select-content","mvc/tools/tools-input"],function(d,b,g,c,a,e){var f=Backbone.View.extend({initialize:function(i,h){this.app=i;this.inputs=h.inputs;h.cls_tr="section-row";this.table=new b.View(h);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var h in this.inputs){this._add(this.inputs[h])}},_add:function(j){var i=this;var h=jQuery.extend(true,{},j);h.id=j.id=d.uuid();this.app.input_list[h.id]=h;var k=h.type;switch(k){case"conditional":this._addConditional(h);break;case"repeat":this._addRepeat(h);break;default:this._addRow(h)}},_addConditional:function(h){var j=this;h.test_param.id=h.id;var m=this._addRow(h.test_param);m.options.onchange=function(t){var p=j.app.tree.matchCase(h,t);for(var r in h.cases){var w=h.cases[r];var u=h.id+"-section-"+r;var o=j.table.get(u);var v=false;for(var q in w.inputs){var s=w.inputs[q].type;if(s&&s!=="hidden"){v=true;break}}if(r==p&&v){o.fadeIn("fast")}else{o.hide()}}j.app.refresh()};for(var l in h.cases){var k=h.id+"-section-"+l;var n=new f(this.app,{inputs:h.cases[l].inputs,cls:"ui-table-plain"});n.$el.addClass("ui-table-form-section");this.table.add(n.$el);this.table.append(k)}m.trigger("change")},_addRepeat:function(o){var r=this;var p=0;function m(i,t){var s=o.id+"-section-"+(p++);var u=null;if(t){u=function(){k.del(s);k.retitle(o.title);r.app.rebuild();r.app.refresh()}}var v=new f(r.app,{inputs:i,cls:"ui-table-plain"});k.add({id:s,title:o.title,$el:v.$el,ondel:u});k.retitle(o.title)}var k=new c.View({title_new:o.title,max:o.max,onnew:function(){m(o.inputs,true);r.app.rebuild();r.app.refresh()}});var h=o.min;var q=_.size(o.cache);for(var l=0;l<Math.max(q,h);l++){var n=null;if(l<q){n=o.cache[l]}else{n=o.inputs}m(n,l>=h)}var j=new e(this.app,{label:o.title,help:o.help,field:k});j.$el.addClass("ui-table-form-section");this.table.add(j.$el);this.table.append(o.id)},_addRow:function(h){var k=h.id;var i=this._createField(h);if(h.is_dynamic){this.app.is_dynamic=true}this.app.field_list[k]=i;var j=new e(this.app,{label:h.label,optional:h.optional,help:h.help,field:i});this.app.element_list[k]=j;this.table.add(j.$el);this.table.append(k);return i},_createField:function(h){var i=null;switch(h.type){case"text":i=this._fieldText(h);break;case"select":i=this._fieldSelect(h);break;case"data":i=this._fieldData(h);break;case"data_column":i=this._fieldSelect(h);break;case"hidden":i=this._fieldHidden(h);break;case"integer":i=this._fieldSlider(h);break;case"float":i=this._fieldSlider(h);break;case"boolean":i=this._fieldBoolean(h);break;case"genomebuild":i=this._fieldSelect(h);break;default:this.app.incompatible=true;if(h.options){i=this._fieldSelect(h)}else{i=this._fieldText(h)}console.debug("tools-form::_addRow() : Auto matched field type ("+h.type+").")}if(h.value!==undefined){i.value(h.value)}return i},_fieldData:function(h){var i=this;return new a.View(this.app,{id:"field-"+h.id,extensions:h.extensions,multiple:h.multiple,data:h.options,onchange:function(){i.app.refresh()}})},_fieldSelect:function(h){var k=[];for(var l in h.options){var m=h.options[l];k.push({label:m[0],value:m[1]})}var n=g.Select;switch(h.display){case"checkboxes":n=g.Checkbox;break;case"radio":n=g.Radio;break}var j=this;return new n.View({id:"field-"+h.id,data:k,multiple:h.multiple,onchange:function(){j.app.refresh()}})},_fieldText:function(h){var i=this;return new g.Input({id:"field-"+h.id,area:h.area,onchange:function(){i.app.refresh()}})},_fieldSlider:function(h){return new g.Slider.View({id:"field-"+h.id,precise:h.type=="float",min:h.min,max:h.max})},_fieldHidden:function(h){return new g.Hidden({id:"field-"+h.id})},_fieldBoolean:function(h){return new g.RadioButton.View({id:"field-"+h.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]})}});return{View:f}});
\ No newline at end of file
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/packed/mvc/tools/tools-select-content.js
--- a/static/scripts/packed/mvc/tools/tools-select-content.js
+++ b/static/scripts/packed/mvc/tools/tools-select-content.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-tabs","mvc/tools/tools-template"],function(c,e,b,a){var d=Backbone.View.extend({initialize:function(n,h){this.options=h;var g=this;this.setElement("<div/>");this.current="hda";this.button_new=new e.RadioButton.View({value:this.current,data:[{icon:"fa-file-o",label:"Select datasets",value:"hda"},{icon:"fa-files-o",label:"Select a collection",value:"hdca"}],onchange:function(i){g.current=i;g.refresh();g.trigger("change")}});var l=n.content.filterType({src:"hda",extensions:h.extensions});var k=[];for(var j in l){k.push({label:l[j].hid+": "+l[j].name,value:l[j].id})}this.select_datasets=new e.Select.View({multiple:true,data:k,value:k[0]&&k[0].value,onchange:function(){g.trigger("change")}});var m=n.content.filterType({src:"hdca",extensions:h.extensions});var f=[];for(var j in m){f.push({label:m[j].hid+": "+m[j].name,value:m[j].id})}this.select_collection=new e.Select.View({data:f,value:f[0]&&f[0].value,onchange:function(){g.trigger("change")}});this.$el.append(c.wrap(this.button_new.$el));this.$el.append(this.select_datasets.$el);this.$el.append(this.select_collection.$el);if(!this.options.multiple){this.$el.append(a.batchMode())}this.refresh();this.on("change",function(){if(h.onchange){h.onchange(g.value())}})},value:function(m){if(m!==undefined){try{this.current=m.values[0].src;this.refresh();var l=[];for(var h in m.values){l.push(m.values[h].id)}switch(this.current){case"hda":this.select_datasets.value(l);break;case"hdca":this.select_collection.value(l[0]);break}var g=this._select();if(!g.validate()){g.value(g.first())}}catch(k){console.debug("tools-select-content::value() - Skipped.")}}var j=this._select().value();if(!(j instanceof Array)){j=[j]}var f={batch:!this.options.multiple,values:[]};for(var h in j){f.values.push({id:j[h],src:this.current})}return f},validate:function(){return this._select().validate()},refresh:function(){switch(this.current){case"hda":this.select_datasets.$el.fadeIn();this.select_collection.$el.hide();break;case"hdca":this.select_datasets.$el.hide();this.select_collection.$el.fadeIn();break}},_select:function(){switch(this.current){case"hdca":return this.select_collection;default:return this.select_datasets}}});return{View:d}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-tabs","mvc/tools/tools-template"],function(c,e,b,a){var d=Backbone.View.extend({initialize:function(j,g){this.app=j;this.options=g;var f=this;this.setElement("<div/>");this.current="single";this.button_type=new e.RadioButton.View({value:this.current,data:[{icon:"fa-file-o",label:"Single dataset",value:"single"},{icon:"fa-files-o",label:"Multiple datasets",value:"multiple"},{icon:"fa-folder-o",label:"List of datasets",value:"collection"}],onchange:function(i){f.current=i;f.refresh();f.trigger("change")}});this.select_single=new e.Select.View({onchange:function(){f.trigger("change")}});this.select_multiple=new e.Select.View({multiple:true,onchange:function(){f.trigger("change")}});this.select_collection=new e.Select.View({onchange:function(){f.trigger("change")}});this.list={single:{field:this.select_single,type:"hda"},multiple:{field:this.select_multiple,type:"hda"},collection:{field:this.select_collection,type:"hdca"}};this.$batch=$(a.batchMode());this.$el.append(c.wrap(this.button_type.$el));for(var h in this.list){this.$el.append(this.list[h].field.$el)}this.$el.append(this.$batch);this.update(g.data);this.refresh();this.on("change",function(){if(g.onchange){g.onchange(f.value())}})},wait:function(){for(var f in this.list){this.list[f].field.wait()}},unwait:function(){for(var f in this.list){this.list[f].field.unwait()}},update:function(g){var l=[];for(var j in g.hda){var k=g.hda[j];l.push({label:k.hid+": "+k.name,value:k.id})}var f=[];for(var j in g.hdca){var h=g.hdca[j];f.push({label:h.hid+": "+h.name,value:h.id})}this.select_single.update(l);this.select_multiple.update(l);this.select_collection.update(f);this.app.content.add(g)},value:function(m){if(m!==undefined){try{var l=[];for(var h in m.values){l.push(m.values[h].id)}if(m&&m.values.length>0&&m.values[0].src=="hcda"){this.current="collection";this.select_collection.value(l[0])}else{if(l.length>1){this.current="multiple";this.select_multiple.value(l)}else{this.current="single";this.select_single.value(l[0])}}this.refresh();var g=this._select();if(!g.validate()){g.value(g.first())}}catch(k){console.debug("tools-select-content::value() - Skipped.")}}var j=this._select().value();if(!(j instanceof Array)){j=[j]}var f={batch:!this.options.multiple,values:[]};for(var h in j){f.values.push({id:j[h],src:this.list[this.current].type})}return f},validate:function(){return this._select().validate()},refresh:function(){for(var g in this.list){var f=this.list[g].field.$el;if(this.current==g){f.show()}else{f.hide()}}if(this.current!="single"&&!this.options.multiple){this.$batch.show()}else{this.$batch.hide()}},_select:function(){return this.list[this.current].field}});return{View:d}});
\ No newline at end of file
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/packed/mvc/tools/tools-template.js
--- a/static/scripts/packed/mvc/tools/tools-template.js
+++ b/static/scripts/packed/mvc/tools/tools-template.js
@@ -1,1 +1,1 @@
-define([],function(){return{help:function(a){return'<div class="toolHelp"><div class="toolHelpBody">'+a+"</div></div>"},success:function(c){if(!c.jobs||!c.jobs.length){console.debug("tools-template::success() - Failed jobs.");return}var a=c.jobs.length;var d="";if(a==1){d="1 job has"}else{d=a+" jobs have"}var b='<div class="donemessagelarge"><p>'+d+" been successfully added to the queue - resulting in the following datasets:</p>";for(var e in c.outputs){b+='<p style="padding: 10px 20px;"><b>'+(parseInt(e)+1)+": "+c.outputs[e].name+"</b></p>"}b+="<p>You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from 'running' to 'finished' if completed successfully or 'error' if problems were encountered.</p></div>";return b},error:function(a){return'<div><p>The server could not complete the request. Please contact the Galaxy Team if this error persists.</p><textarea class="ui-textarea" disabled style="color: black;" rows="6">'+JSON.stringify(a,undefined,4)+"</textarea></div>"},batchMode:function(){return'<div class="ui-table-form-info"><i class="fa fa-sitemap" style="font-size: 1.2em; padding: 2px 5px;"/>This is a batch mode input field. A separate job will be triggered for each dataset.';"</div>"}}});
\ No newline at end of file
+define([],function(){return{help:function(a){return'<div class="toolHelp"><div class="toolHelpBody">'+a+"</div></div>"},success:function(c){if(!c.jobs||!c.jobs.length){console.debug("tools-template::success() - Failed jobs.");return}var a=c.jobs.length;var d="";if(a==1){d="1 job has"}else{d=a+" jobs have"}var b='<div class="donemessagelarge"><p>'+d+" been successfully added to the queue - resulting in the following datasets:</p>";for(var e in c.outputs){b+='<p style="padding: 10px 20px;"><b>'+(parseInt(e)+1)+": "+c.outputs[e].name+"</b></p>"}b+="<p>You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from 'running' to 'finished' if completed successfully or 'error' if problems were encountered.</p></div>";return b},error:function(a){return'<div><p>The server could not complete the request. Please contact the Galaxy Team if this error persists.</p><textarea class="ui-textarea" disabled style="color: black;" rows="6">'+JSON.stringify(a,undefined,4)+"</textarea></div>"},batchMode:function(){return'<div class="ui-table-form-info"><i class="fa fa-sitemap" style="font-size: 1.2em; padding: 2px 5px;"/>This is a batch mode input field. A separate job will be triggered for each dataset.</div>'}}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jmchilton: Small fix for e4c9f0b.
by commits-noreply@bitbucket.org 11 Nov '14
by commits-noreply@bitbucket.org 11 Nov '14
11 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/7cdccd6e7573/
Changeset: 7cdccd6e7573
User: jmchilton
Date: 2014-11-11 20:56:18+00:00
Summary: Small fix for e4c9f0b.
Affected #: 1 file
diff -r e4c9f0b5a73851ab2d8644889d305aaab80208d9 -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -2268,6 +2268,8 @@
subcollection_type = self._history_query( trans ).collection_type_description.collection_type
pass
+ return d
+
class HiddenDataToolParameter( HiddenToolParameter, DataToolParameter ):
"""
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
2 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d2f7780bd1b1/
Changeset: d2f7780bd1b1
User: jmchilton
Date: 2014-11-11 18:41:00+00:00
Summary: Refactor dataset matcher stuff for use outside of field generation.
(i.e. for reuse in filtering datasets on the client side)
Affected #: 2 files
diff -r d519ad65435883112008e90ec06ebf44a91586e7 -r d2f7780bd1b1d5b545c6c222fb383d6a35833855 lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -1796,26 +1796,52 @@
field_name = "%s%s" % ( self.name, suffix )
field = form_builder.SelectField( field_name, multiple, None, self.refresh_on_change, refresh_on_change_values=self.refresh_on_change_values )
+ for history_dataset_collection in self.match_collections( history, dataset_matcher, reduction=reduction ):
+ name = history_dataset_collection.name
+ hid = str( history_dataset_collection.hid )
+ hidden_text = "" # TODO
+ id = value_modifier( dataset_matcher.trans.security.encode_id( history_dataset_collection.id ) )
+ selected = value and history_dataset_collection in value
+ text = "%s:%s %s" % ( hid, hidden_text, name )
+ field.add_option( text, id, selected )
+
+ return field
+
+ def _get_select_dataset_field( self, history, dataset_matcher, multiple=False, suffix="" ):
+ field_name = "%s%s" % ( self.name, suffix )
+ field = form_builder.SelectField( field_name, multiple, None, self.refresh_on_change, refresh_on_change_values=self.refresh_on_change_values )
+
+ for hda_match, hid in self.match_datasets( history, dataset_matcher ):
+ if not hda_match.implicit_conversion:
+ hda = hda_match.hda
+ hda_name = hda.name
+ selected = dataset_matcher.selected( hda )
+ if hda.visible:
+ hidden_text = ""
+ else:
+ hidden_text = " (hidden)"
+ field.add_option( "%s:%s %s" % ( hid, hidden_text, hda_name ), hda.id, selected )
+ else:
+ hda_name = hda_match.original_hda.name
+ hda = hda_match.hda # Get converted dataset
+ target_ext = hda_match.target_ext
+ selected = dataset_matcher.selected( hda )
+ field.add_option( "%s: (as %s) %s" % ( hid, target_ext, hda_name ), hda.id, selected )
+
+ self._ensure_selection( field )
+ return field
+
+ def match_collections( self, history, dataset_matcher, reduction=True ):
dataset_collection_matcher = DatasetCollectionMatcher( dataset_matcher )
for history_dataset_collection in history.active_dataset_collections:
if dataset_collection_matcher.hdca_match( history_dataset_collection, reduction=reduction ):
- name = history_dataset_collection.name
- hid = str( history_dataset_collection.hid )
- hidden_text = "" # TODO
- id = value_modifier( dataset_matcher.trans.security.encode_id( history_dataset_collection.id ) )
- selected = value and history_dataset_collection in value
- text = "%s:%s %s" % ( hid, hidden_text, name )
- field.add_option( text, id, selected )
+ yield history_dataset_collection
- return field
+ def match_datasets( self, history, dataset_matcher ):
- def _get_select_dataset_field( self, history, dataset_matcher, multiple=False, suffix="" ):
-
- # CRUCIAL: the dataset_collector function needs to be local to DataToolParameter.get_html_field()
def dataset_collector( hdas, parent_hid ):
for i, hda in enumerate( hdas ):
- hda_name = hda.name
if parent_hid is not None:
hid = "%s.%d" % ( parent_hid, i + 1 )
else:
@@ -1823,27 +1849,13 @@
hda_match = dataset_matcher.hda_match( hda )
if not hda_match:
continue
- if not hda_match.implicit_conversion:
- selected = dataset_matcher.selected( hda )
- if hda.visible:
- hidden_text = ""
- else:
- hidden_text = " (hidden)"
- field.add_option( "%s:%s %s" % ( hid, hidden_text, hda_name ), hda.id, selected )
- else:
- hda = hda_match.hda # Get converted dataset
- target_ext = hda_match.target_ext
- selected = dataset_matcher.selected( hda )
- field.add_option( "%s: (as %s) %s" % ( hid, target_ext, hda_name ), hda.id, selected )
+ yield (hda_match, hid)
# Also collect children via association object
- dataset_collector( hda.children, hid )
+ for item in dataset_collector( hda.children, hid ):
+ yield item
- field_name = "%s%s" % ( self.name, suffix )
- field = form_builder.SelectField( field_name, multiple, None, self.refresh_on_change, refresh_on_change_values=self.refresh_on_change_values )
-
- dataset_collector( history.active_datasets_children_and_roles, None )
- self._ensure_selection( field )
- return field
+ for item in dataset_collector( history.active_datasets_children_and_roles, None ):
+ yield item
def get_initial_value( self, trans, context, history=None ):
return self.get_initial_value_from_history_prevent_repeats(trans, context, None, history=history)
@@ -2098,15 +2110,31 @@
return self._switch_fields( fields, default_field=default_field )
- def _get_single_collection_field( self, trans, history, value, other_values ):
- field = form_builder.SelectField( self.name, self.multiple, None, self.refresh_on_change, refresh_on_change_values=self.refresh_on_change_values )
+ def match_collections( self, trans, history, dataset_matcher ):
dataset_collections = trans.app.dataset_collections_service.history_dataset_collections( history, self._history_query( trans ) )
- dataset_matcher = DatasetMatcher( trans, self, value, other_values )
dataset_collection_matcher = DatasetCollectionMatcher( dataset_matcher )
for dataset_collection_instance in dataset_collections:
if not dataset_collection_matcher.hdca_match( dataset_collection_instance ):
continue
+ yield dataset_collection_instance
+
+ def match_multirun_collections( self, trans, history, dataset_matcher ):
+ dataset_collection_matcher = DatasetCollectionMatcher( dataset_matcher )
+
+ for history_dataset_collection in history.active_dataset_collections:
+ if not self._history_query( trans ).can_map_over( history_dataset_collection ):
+ continue
+
+ datasets_match = dataset_collection_matcher.hdca_match( history_dataset_collection )
+ if datasets_match:
+ yield history_dataset_collection
+
+ def _get_single_collection_field( self, trans, history, value, other_values ):
+ field = form_builder.SelectField( self.name, self.multiple, None, self.refresh_on_change, refresh_on_change_values=self.refresh_on_change_values )
+ dataset_matcher = DatasetMatcher( trans, self, value, other_values )
+
+ for dataset_collection_instance in self.match_collections( trans, history, dataset_matcher ):
instance_id = dataset_collection_instance.hid
instance_name = dataset_collection_instance.name
selected = ( value and ( dataset_collection_instance == value ) )
@@ -2122,22 +2150,16 @@
field_name = "%s%s" % ( self.name, suffix )
field = form_builder.SelectField( field_name, multiple, None, self.refresh_on_change, refresh_on_change_values=self.refresh_on_change_values )
dataset_matcher = DatasetMatcher( trans, self, value, other_values )
- dataset_collection_matcher = DatasetCollectionMatcher( dataset_matcher )
- for history_dataset_collection in history.active_dataset_collections:
- if not self._history_query( trans ).can_map_over( history_dataset_collection ):
- continue
+ for history_dataset_collection in self.match_multirun_collections( trans, history, dataset_matcher ):
+ name = history_dataset_collection.name
+ hid = str( history_dataset_collection.hid )
+ hidden_text = "" # TODO
+ subcollection_type = self._history_query( trans ).collection_type_description.collection_type
+ id = "%s|%s" % ( dataset_matcher.trans.security.encode_id( history_dataset_collection.id ), subcollection_type )
+ text = "%s:%s %s" % ( hid, hidden_text, name )
- datasets_match = dataset_collection_matcher.hdca_match( history_dataset_collection )
- if datasets_match:
- name = history_dataset_collection.name
- hid = str( history_dataset_collection.hid )
- hidden_text = "" # TODO
- subcollection_type = self._history_query( trans ).collection_type_description.collection_type
- id = "%s|%s" % ( dataset_matcher.trans.security.encode_id( history_dataset_collection.id ), subcollection_type )
- text = "%s:%s %s" % ( hid, hidden_text, name )
-
- field.add_option( text, id, False )
+ field.add_option( text, id, False )
return field
diff -r d519ad65435883112008e90ec06ebf44a91586e7 -r d2f7780bd1b1d5b545c6c222fb383d6a35833855 lib/galaxy/tools/parameters/dataset_matcher.py
--- a/lib/galaxy/tools/parameters/dataset_matcher.py
+++ b/lib/galaxy/tools/parameters/dataset_matcher.py
@@ -53,11 +53,12 @@
return False
target_ext, converted_dataset = hda.find_conversion_destination( formats )
if target_ext:
+ original_hda = hda
if converted_dataset:
hda = converted_dataset
if check_security and not self.__can_access_dataset( hda.dataset ):
return False
- return HdaImplicitMatch( hda, target_ext )
+ return HdaImplicitMatch( hda, target_ext, original_hda )
return False
def hda_match( self, hda, check_implicit_conversions=True, ensure_visible=True ):
@@ -117,7 +118,8 @@
conversion).
"""
- def __init__( self, hda, target_ext ):
+ def __init__( self, hda, target_ext, original_hda ):
+ self.original_hda = original_hda
self.hda = hda
self.target_ext = target_ext
https://bitbucket.org/galaxy/galaxy-central/commits/e4c9f0b5a738/
Changeset: e4c9f0b5a738
User: jmchilton
Date: 2014-11-11 18:41:00+00:00
Summary: Rework ToolDataParameter and ToolDataCollectionParameter to_dict to filter over valid matches.
Doesn't do anything with them yet - passing this work off to Sam to populate the dictionaries in whatever manner makes most sense for UI consumption.
Affected #: 1 file
diff -r d2f7780bd1b1d5b545c6c222fb383d6a35833855 -r e4c9f0b5a73851ab2d8644889d305aaab80208d9 lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -2066,12 +2066,26 @@
ref = ref()
return ref
- def to_dict( self, trans, view='collection', value_mapper=None ):
+ def to_dict( self, trans, view='collection', value_mapper=None, other_values=None ):
d = super( DataToolParameter, self ).to_dict( trans )
d['extensions'] = self.extensions
d['multiple'] = self.multiple
+ if other_values is None:
+ # No need to produce lists of datasets for history.
+ return d
+
+ dataset_matcher = DatasetMatcher( trans, self, None, other_values )
+ history = trans.history
+ multiple = self.multiple
+ for hda_match, hid in self.match_datasets( history, dataset_matcher ):
+ # hda_match not an hda - it is a description of the match, may
+ # describe match after implicit conversion.
+ pass
+ for history_dataset_collection in self.match_collections( history, dataset_matcher, reduction=multiple ):
+ pass
return d
+
class DataCollectionToolParameter( BaseDataToolParameter ):
"""
"""
@@ -2238,6 +2252,22 @@
def validate( self, value, history=None ):
return True # TODO
+ def to_dict( self, trans, view='collection', value_mapper=None, other_values=None ):
+ d = super( DataCollectionToolParameter, self ).to_dict( trans )
+ if other_values is None:
+ # No need to produce lists of datasets for history.
+ return d
+
+ dataset_matcher = DatasetMatcher( trans, self, None, other_values )
+ history = trans.history
+
+ for hdca in self.match_collections( trans, history, dataset_matcher ):
+ pass
+
+ for hdca in self.match_multirun_collections( trans, history, dataset_matcher ):
+ subcollection_type = self._history_query( trans ).collection_type_description.collection_type
+ pass
+
class HiddenDataToolParameter( HiddenToolParameter, DataToolParameter ):
"""
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: martenson: Merged in anton/galaxy-central-anton (pull request #539)
by commits-noreply@bitbucket.org 11 Nov '14
by commits-noreply@bitbucket.org 11 Nov '14
11 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d519ad654358/
Changeset: d519ad654358
User: martenson
Date: 2014-11-11 17:26:45+00:00
Summary: Merged in anton/galaxy-central-anton (pull request #539)
Initial tweaks to tool_conf.xml sample and one of the tools.
Affected #: 2 files
diff -r 932f4bbf2c317fc5dc735777d167765d907a0e0d -r d519ad65435883112008e90ec06ebf44a91586e7 config/tool_conf.xml.sample
--- a/config/tool_conf.xml.sample
+++ b/config/tool_conf.xml.sample
@@ -104,10 +104,6 @@
<tool file="maf/maf_reverse_complement.xml" /><tool file="maf/maf_filter.xml" /></section>
- <section id="scores" name="Get Genomic Scores">
- <tool file="filters/wiggle_to_simple.xml" />
- <tool file="stats/aggregate_binned_scores_in_intervals.xml" />
- </section><section id="stats" name="Statistics"><tool file="stats/gsummary.xml" /><tool file="filters/uniq.xml" />
@@ -115,71 +111,6 @@
<section id="plots" name="Graph/Display Data"><tool file="plotting/bar_chart.xml" /><tool file="plotting/boxplot.xml" />
- <tool file="visualization/LAJ.xml" /><tool file="maf/vcf_to_maf_customtrack.xml" /></section>
- <section id="hyphy" name="Evolution">
- <tool file="evolution/codingSnps.xml" />
- <tool file="evolution/add_scores.xml" />
- </section>
- <section id="motifs" name="Motif Tools">
- <tool file="meme/meme.xml" />
- <tool file="meme/fimo.xml" />
- </section>
- <section id="NGS_QC" name="NGS: QC and manipulation">
-
- <label id="fastqcsambam" text="FastQC: fastq/sam/bam" />
-
- <label id="illumina" text="Illumina fastq" />
-
- <label id="454" text="Roche-454 data" />
- <label id="solid" text="AB-SOLiD data" />
- <tool file="next_gen_conversion/solid2fastq.xml" />
- <tool file="solid_tools/solid_qual_stats.xml" />
- <tool file="solid_tools/solid_qual_boxplot.xml" />
-
- <label id="generic_fastq" text="Generic FASTQ manipulation" />
-
- <label id="fastx_toolkit" text="FASTX-Toolkit for FASTQ data" />
- </section>
- <!--
- Keep this section commented until it includes tools that
- will be hosted on test/main. The velvet wrappers have been
- included in the distribution but will not be hosted on our
- public servers for the current time.
- <section name="NGS: Assembly" id="ngs_assembly">
- <label text="Velvet" id="velvet"/>
- <tool file="sr_assembly/velvetg.xml" />
- <tool file="sr_assembly/velveth.xml" />
- </section>
- -->
- <section id="solexa_tools" name="NGS: Mapping">
- <tool file="sr_mapping/bfast_wrapper.xml" />
- <tool file="sr_mapping/PerM.xml" />
- <tool file="sr_mapping/srma_wrapper.xml" />
- <tool file="sr_mapping/mosaik.xml" />
- </section>
- <section id="ngs-rna-tools" name="NGS: RNA Analysis">
-
- <label id="rna_seq" text="RNA-seq" />
- <label id="filtering" text="Filtering" />
- </section>
- <section id="samtools" name="NGS: SAM Tools">
- </section>
- <section id="ngs-simulation" name="NGS: Simulation">
- <tool file="ngs_simulation/ngs_simulation.xml" />
- </section>
- <section id="hgv" name="Phenotype Association">
- <tool file="evolution/codingSnps.xml" />
- <tool file="evolution/add_scores.xml" />
- <tool file="phenotype_association/sift.xml" />
- <tool file="phenotype_association/linkToGProfile.xml" />
- <tool file="phenotype_association/linkToDavid.xml" />
- <tool file="phenotype_association/ldtools.xml" />
- <tool file="phenotype_association/pass.xml" />
- <tool file="phenotype_association/gpass.xml" />
- <tool file="phenotype_association/beam.xml" />
- <tool file="phenotype_association/lps.xml" />
- <tool file="phenotype_association/master2pg.xml" />
- </section></toolbox>
diff -r 932f4bbf2c317fc5dc735777d167765d907a0e0d -r d519ad65435883112008e90ec06ebf44a91586e7 tools/filters/uniq.xml
--- a/tools/filters/uniq.xml
+++ b/tools/filters/uniq.xml
@@ -26,8 +26,7 @@
</test></tests><help>
-
- .. class:: infomark
+.. class:: infomark
**TIP:** If your data is not TAB delimited, use *Text Manipulation->Convert*
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/26e1a07f9f22/
Changeset: 26e1a07f9f22
User: anton
Date: 2014-10-23 16:37:58+00:00
Summary: modification to default tool_conf.xml
Affected #: 1 file
diff -r ae33952d52dcf4f682b317aaf01dcaa4d79d79b9 -r 26e1a07f9f22035e952344e34cdfa430a7b0ef7d config/tool_conf.xml.sample
--- a/config/tool_conf.xml.sample
+++ b/config/tool_conf.xml.sample
@@ -104,10 +104,6 @@
<tool file="maf/maf_reverse_complement.xml" /><tool file="maf/maf_filter.xml" /></section>
- <section id="scores" name="Get Genomic Scores">
- <tool file="filters/wiggle_to_simple.xml" />
- <tool file="stats/aggregate_binned_scores_in_intervals.xml" />
- </section><section id="stats" name="Statistics"><tool file="stats/gsummary.xml" /><tool file="filters/uniq.xml" />
@@ -115,71 +111,6 @@
<section id="plots" name="Graph/Display Data"><tool file="plotting/bar_chart.xml" /><tool file="plotting/boxplot.xml" />
- <tool file="visualization/LAJ.xml" /><tool file="maf/vcf_to_maf_customtrack.xml" /></section>
- <section id="hyphy" name="Evolution">
- <tool file="evolution/codingSnps.xml" />
- <tool file="evolution/add_scores.xml" />
- </section>
- <section id="motifs" name="Motif Tools">
- <tool file="meme/meme.xml" />
- <tool file="meme/fimo.xml" />
- </section>
- <section id="NGS_QC" name="NGS: QC and manipulation">
-
- <label id="fastqcsambam" text="FastQC: fastq/sam/bam" />
-
- <label id="illumina" text="Illumina fastq" />
-
- <label id="454" text="Roche-454 data" />
- <label id="solid" text="AB-SOLiD data" />
- <tool file="next_gen_conversion/solid2fastq.xml" />
- <tool file="solid_tools/solid_qual_stats.xml" />
- <tool file="solid_tools/solid_qual_boxplot.xml" />
-
- <label id="generic_fastq" text="Generic FASTQ manipulation" />
-
- <label id="fastx_toolkit" text="FASTX-Toolkit for FASTQ data" />
- </section>
- <!--
- Keep this section commented until it includes tools that
- will be hosted on test/main. The velvet wrappers have been
- included in the distribution but will not be hosted on our
- public servers for the current time.
- <section name="NGS: Assembly" id="ngs_assembly">
- <label text="Velvet" id="velvet"/>
- <tool file="sr_assembly/velvetg.xml" />
- <tool file="sr_assembly/velveth.xml" />
- </section>
- -->
- <section id="solexa_tools" name="NGS: Mapping">
- <tool file="sr_mapping/bfast_wrapper.xml" />
- <tool file="sr_mapping/PerM.xml" />
- <tool file="sr_mapping/srma_wrapper.xml" />
- <tool file="sr_mapping/mosaik.xml" />
- </section>
- <section id="ngs-rna-tools" name="NGS: RNA Analysis">
-
- <label id="rna_seq" text="RNA-seq" />
- <label id="filtering" text="Filtering" />
- </section>
- <section id="samtools" name="NGS: SAM Tools">
- </section>
- <section id="ngs-simulation" name="NGS: Simulation">
- <tool file="ngs_simulation/ngs_simulation.xml" />
- </section>
- <section id="hgv" name="Phenotype Association">
- <tool file="evolution/codingSnps.xml" />
- <tool file="evolution/add_scores.xml" />
- <tool file="phenotype_association/sift.xml" />
- <tool file="phenotype_association/linkToGProfile.xml" />
- <tool file="phenotype_association/linkToDavid.xml" />
- <tool file="phenotype_association/ldtools.xml" />
- <tool file="phenotype_association/pass.xml" />
- <tool file="phenotype_association/gpass.xml" />
- <tool file="phenotype_association/beam.xml" />
- <tool file="phenotype_association/lps.xml" />
- <tool file="phenotype_association/master2pg.xml" />
- </section></toolbox>
https://bitbucket.org/galaxy/galaxy-central/commits/addd9cf18318/
Changeset: addd9cf18318
User: anton
Date: 2014-10-23 16:42:15+00:00
Summary: uniq.xml edited online with Bitbucket
Affected #: 1 file
diff -r 26e1a07f9f22035e952344e34cdfa430a7b0ef7d -r addd9cf183181a9c2406c9956ed13b90e6c4558a tools/filters/uniq.xml
--- a/tools/filters/uniq.xml
+++ b/tools/filters/uniq.xml
@@ -26,8 +26,7 @@
</test></tests><help>
-
- .. class:: infomark
+.. class:: infomark
**TIP:** If your data is not TAB delimited, use *Text Manipulation->Convert*
https://bitbucket.org/galaxy/galaxy-central/commits/d519ad654358/
Changeset: d519ad654358
User: martenson
Date: 2014-11-11 17:26:45+00:00
Summary: Merged in anton/galaxy-central-anton (pull request #539)
Initial tweaks to tool_conf.xml sample and one of the tools.
Affected #: 2 files
diff -r 932f4bbf2c317fc5dc735777d167765d907a0e0d -r d519ad65435883112008e90ec06ebf44a91586e7 config/tool_conf.xml.sample
--- a/config/tool_conf.xml.sample
+++ b/config/tool_conf.xml.sample
@@ -104,10 +104,6 @@
<tool file="maf/maf_reverse_complement.xml" /><tool file="maf/maf_filter.xml" /></section>
- <section id="scores" name="Get Genomic Scores">
- <tool file="filters/wiggle_to_simple.xml" />
- <tool file="stats/aggregate_binned_scores_in_intervals.xml" />
- </section><section id="stats" name="Statistics"><tool file="stats/gsummary.xml" /><tool file="filters/uniq.xml" />
@@ -115,71 +111,6 @@
<section id="plots" name="Graph/Display Data"><tool file="plotting/bar_chart.xml" /><tool file="plotting/boxplot.xml" />
- <tool file="visualization/LAJ.xml" /><tool file="maf/vcf_to_maf_customtrack.xml" /></section>
- <section id="hyphy" name="Evolution">
- <tool file="evolution/codingSnps.xml" />
- <tool file="evolution/add_scores.xml" />
- </section>
- <section id="motifs" name="Motif Tools">
- <tool file="meme/meme.xml" />
- <tool file="meme/fimo.xml" />
- </section>
- <section id="NGS_QC" name="NGS: QC and manipulation">
-
- <label id="fastqcsambam" text="FastQC: fastq/sam/bam" />
-
- <label id="illumina" text="Illumina fastq" />
-
- <label id="454" text="Roche-454 data" />
- <label id="solid" text="AB-SOLiD data" />
- <tool file="next_gen_conversion/solid2fastq.xml" />
- <tool file="solid_tools/solid_qual_stats.xml" />
- <tool file="solid_tools/solid_qual_boxplot.xml" />
-
- <label id="generic_fastq" text="Generic FASTQ manipulation" />
-
- <label id="fastx_toolkit" text="FASTX-Toolkit for FASTQ data" />
- </section>
- <!--
- Keep this section commented until it includes tools that
- will be hosted on test/main. The velvet wrappers have been
- included in the distribution but will not be hosted on our
- public servers for the current time.
- <section name="NGS: Assembly" id="ngs_assembly">
- <label text="Velvet" id="velvet"/>
- <tool file="sr_assembly/velvetg.xml" />
- <tool file="sr_assembly/velveth.xml" />
- </section>
- -->
- <section id="solexa_tools" name="NGS: Mapping">
- <tool file="sr_mapping/bfast_wrapper.xml" />
- <tool file="sr_mapping/PerM.xml" />
- <tool file="sr_mapping/srma_wrapper.xml" />
- <tool file="sr_mapping/mosaik.xml" />
- </section>
- <section id="ngs-rna-tools" name="NGS: RNA Analysis">
-
- <label id="rna_seq" text="RNA-seq" />
- <label id="filtering" text="Filtering" />
- </section>
- <section id="samtools" name="NGS: SAM Tools">
- </section>
- <section id="ngs-simulation" name="NGS: Simulation">
- <tool file="ngs_simulation/ngs_simulation.xml" />
- </section>
- <section id="hgv" name="Phenotype Association">
- <tool file="evolution/codingSnps.xml" />
- <tool file="evolution/add_scores.xml" />
- <tool file="phenotype_association/sift.xml" />
- <tool file="phenotype_association/linkToGProfile.xml" />
- <tool file="phenotype_association/linkToDavid.xml" />
- <tool file="phenotype_association/ldtools.xml" />
- <tool file="phenotype_association/pass.xml" />
- <tool file="phenotype_association/gpass.xml" />
- <tool file="phenotype_association/beam.xml" />
- <tool file="phenotype_association/lps.xml" />
- <tool file="phenotype_association/master2pg.xml" />
- </section></toolbox>
diff -r 932f4bbf2c317fc5dc735777d167765d907a0e0d -r d519ad65435883112008e90ec06ebf44a91586e7 tools/filters/uniq.xml
--- a/tools/filters/uniq.xml
+++ b/tools/filters/uniq.xml
@@ -26,8 +26,7 @@
</test></tests><help>
-
- .. class:: infomark
+.. class:: infomark
**TIP:** If your data is not TAB delimited, use *Text Manipulation->Convert*
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: ToolForm: Fix field type output
by commits-noreply@bitbucket.org 10 Nov '14
by commits-noreply@bitbucket.org 10 Nov '14
10 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/932f4bbf2c31/
Changeset: 932f4bbf2c31
User: guerler
Date: 2014-11-10 20:07:04+00:00
Summary: ToolForm: Fix field type output
Affected #: 3 files
diff -r 1c92e972a0a38afccfffed8a51be6c63c64969e2 -r 932f4bbf2c317fc5dc735777d167765d907a0e0d client/galaxy/scripts/mvc/tools/tools-section.js
--- a/client/galaxy/scripts/mvc/tools/tools-section.js
+++ b/client/galaxy/scripts/mvc/tools/tools-section.js
@@ -352,7 +352,7 @@
}
// log
- console.debug('tools-form::_addRow() : Auto matched field type (' + field_type + ').');
+ console.debug('tools-form::_addRow() : Auto matched field type (' + input_def.type + ').');
}
// set field value
diff -r 1c92e972a0a38afccfffed8a51be6c63c64969e2 -r 932f4bbf2c317fc5dc735777d167765d907a0e0d static/scripts/mvc/tools/tools-section.js
--- a/static/scripts/mvc/tools/tools-section.js
+++ b/static/scripts/mvc/tools/tools-section.js
@@ -352,7 +352,7 @@
}
// log
- console.debug('tools-form::_addRow() : Auto matched field type (' + field_type + ').');
+ console.debug('tools-form::_addRow() : Auto matched field type (' + input_def.type + ').');
}
// set field value
diff -r 1c92e972a0a38afccfffed8a51be6c63c64969e2 -r 932f4bbf2c317fc5dc735777d167765d907a0e0d static/scripts/packed/mvc/tools/tools-section.js
--- a/static/scripts/packed/mvc/tools/tools-section.js
+++ b/static/scripts/packed/mvc/tools/tools-section.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/tools/tools-repeat","mvc/tools/tools-select-content","mvc/tools/tools-input"],function(d,b,g,c,a,e){var f=Backbone.View.extend({initialize:function(i,h){this.app=i;this.inputs=h.inputs;h.cls_tr="section-row";this.table=new b.View(h);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var h in this.inputs){this._add(this.inputs[h])}},_add:function(j){var i=this;var h=jQuery.extend(true,{},j);h.id=j.id=d.uuid();this.app.input_list[h.id]=h;var k=h.type;switch(k){case"conditional":this._addConditional(h);break;case"repeat":this._addRepeat(h);break;default:this._addRow(h)}},_addConditional:function(h){var j=this;h.test_param.id=h.id;var m=this._addRow(h.test_param);m.options.onchange=function(t){var p=j.app.tree.matchCase(h,t);for(var r in h.cases){var w=h.cases[r];var u=h.id+"-section-"+r;var o=j.table.get(u);var v=false;for(var q in w.inputs){var s=w.inputs[q].type;if(s&&s!=="hidden"){v=true;break}}if(r==p&&v){o.fadeIn("fast")}else{o.hide()}}j.app.refresh()};for(var l in h.cases){var k=h.id+"-section-"+l;var n=new f(this.app,{inputs:h.cases[l].inputs,cls:"ui-table-plain"});n.$el.addClass("ui-table-form-section");this.table.add(n.$el);this.table.append(k)}m.trigger("change")},_addRepeat:function(o){var r=this;var p=0;function m(i,t){var s=o.id+"-section-"+(p++);var u=null;if(t){u=function(){k.del(s);k.retitle(o.title);r.app.rebuild();r.app.refresh()}}var v=new f(r.app,{inputs:i,cls:"ui-table-plain"});k.add({id:s,title:o.title,$el:v.$el,ondel:u});k.retitle(o.title)}var k=new c.View({title_new:o.title,max:o.max,onnew:function(){m(o.inputs,true);r.app.rebuild();r.app.refresh()}});var h=o.min;var q=_.size(o.cache);for(var l=0;l<Math.max(q,h);l++){var n=null;if(l<q){n=o.cache[l]}else{n=o.inputs}m(n,l>=h)}var j=new e(this.app,{label:o.title,help:o.help,field:k});j.$el.addClass("ui-table-form-section");this.table.add(j.$el);this.table.append(o.id)},_addRow:function(h){var k=h.id;var i=this._createField(h);if(h.is_dynamic){this.app.is_dynamic=true}this.app.field_list[k]=i;var j=new e(this.app,{label:h.label,optional:h.optional,help:h.help,field:i});this.app.element_list[k]=j;this.table.add(j.$el);this.table.append(k);return i},_createField:function(h){var i=null;switch(h.type){case"text":i=this._fieldText(h);break;case"select":i=this._fieldSelect(h);break;case"data":i=this._fieldData(h);break;case"data_column":i=this._fieldSelect(h);break;case"hidden":i=this._fieldHidden(h);break;case"integer":i=this._fieldSlider(h);break;case"float":i=this._fieldSlider(h);break;case"boolean":i=this._fieldBoolean(h);break;case"genomebuild":i=this._fieldSelect(h);break;default:this.app.incompatible=true;if(h.options){i=this._fieldSelect(h)}else{i=this._fieldText(h)}console.debug("tools-form::_addRow() : Auto matched field type ("+field_type+").")}if(h.value!==undefined){i.value(h.value)}return i},_fieldData:function(h){var i=this;return new a.View(this.app,{id:"field-"+h.id,extensions:h.extensions,multiple:h.multiple,onchange:function(){i.app.refresh()}})},_fieldSelect:function(h){var k=[];for(var l in h.options){var m=h.options[l];k.push({label:m[0],value:m[1]})}var n=g.Select;switch(h.display){case"checkboxes":n=g.Checkbox;break;case"radio":n=g.Radio;break}var j=this;return new n.View({id:"field-"+h.id,data:k,multiple:h.multiple,onchange:function(){j.app.refresh()}})},_fieldText:function(h){var i=this;return new g.Input({id:"field-"+h.id,area:h.area,onchange:function(){i.app.refresh()}})},_fieldSlider:function(h){return new g.Slider.View({id:"field-"+h.id,precise:h.type=="float",min:h.min,max:h.max})},_fieldHidden:function(h){return new g.Hidden({id:"field-"+h.id})},_fieldBoolean:function(h){return new g.RadioButton.View({id:"field-"+h.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]})}});return{View:f}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/tools/tools-repeat","mvc/tools/tools-select-content","mvc/tools/tools-input"],function(d,b,g,c,a,e){var f=Backbone.View.extend({initialize:function(i,h){this.app=i;this.inputs=h.inputs;h.cls_tr="section-row";this.table=new b.View(h);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var h in this.inputs){this._add(this.inputs[h])}},_add:function(j){var i=this;var h=jQuery.extend(true,{},j);h.id=j.id=d.uuid();this.app.input_list[h.id]=h;var k=h.type;switch(k){case"conditional":this._addConditional(h);break;case"repeat":this._addRepeat(h);break;default:this._addRow(h)}},_addConditional:function(h){var j=this;h.test_param.id=h.id;var m=this._addRow(h.test_param);m.options.onchange=function(t){var p=j.app.tree.matchCase(h,t);for(var r in h.cases){var w=h.cases[r];var u=h.id+"-section-"+r;var o=j.table.get(u);var v=false;for(var q in w.inputs){var s=w.inputs[q].type;if(s&&s!=="hidden"){v=true;break}}if(r==p&&v){o.fadeIn("fast")}else{o.hide()}}j.app.refresh()};for(var l in h.cases){var k=h.id+"-section-"+l;var n=new f(this.app,{inputs:h.cases[l].inputs,cls:"ui-table-plain"});n.$el.addClass("ui-table-form-section");this.table.add(n.$el);this.table.append(k)}m.trigger("change")},_addRepeat:function(o){var r=this;var p=0;function m(i,t){var s=o.id+"-section-"+(p++);var u=null;if(t){u=function(){k.del(s);k.retitle(o.title);r.app.rebuild();r.app.refresh()}}var v=new f(r.app,{inputs:i,cls:"ui-table-plain"});k.add({id:s,title:o.title,$el:v.$el,ondel:u});k.retitle(o.title)}var k=new c.View({title_new:o.title,max:o.max,onnew:function(){m(o.inputs,true);r.app.rebuild();r.app.refresh()}});var h=o.min;var q=_.size(o.cache);for(var l=0;l<Math.max(q,h);l++){var n=null;if(l<q){n=o.cache[l]}else{n=o.inputs}m(n,l>=h)}var j=new e(this.app,{label:o.title,help:o.help,field:k});j.$el.addClass("ui-table-form-section");this.table.add(j.$el);this.table.append(o.id)},_addRow:function(h){var k=h.id;var i=this._createField(h);if(h.is_dynamic){this.app.is_dynamic=true}this.app.field_list[k]=i;var j=new e(this.app,{label:h.label,optional:h.optional,help:h.help,field:i});this.app.element_list[k]=j;this.table.add(j.$el);this.table.append(k);return i},_createField:function(h){var i=null;switch(h.type){case"text":i=this._fieldText(h);break;case"select":i=this._fieldSelect(h);break;case"data":i=this._fieldData(h);break;case"data_column":i=this._fieldSelect(h);break;case"hidden":i=this._fieldHidden(h);break;case"integer":i=this._fieldSlider(h);break;case"float":i=this._fieldSlider(h);break;case"boolean":i=this._fieldBoolean(h);break;case"genomebuild":i=this._fieldSelect(h);break;default:this.app.incompatible=true;if(h.options){i=this._fieldSelect(h)}else{i=this._fieldText(h)}console.debug("tools-form::_addRow() : Auto matched field type ("+h.type+").")}if(h.value!==undefined){i.value(h.value)}return i},_fieldData:function(h){var i=this;return new a.View(this.app,{id:"field-"+h.id,extensions:h.extensions,multiple:h.multiple,onchange:function(){i.app.refresh()}})},_fieldSelect:function(h){var k=[];for(var l in h.options){var m=h.options[l];k.push({label:m[0],value:m[1]})}var n=g.Select;switch(h.display){case"checkboxes":n=g.Checkbox;break;case"radio":n=g.Radio;break}var j=this;return new n.View({id:"field-"+h.id,data:k,multiple:h.multiple,onchange:function(){j.app.refresh()}})},_fieldText:function(h){var i=this;return new g.Input({id:"field-"+h.id,area:h.area,onchange:function(){i.app.refresh()}})},_fieldSlider:function(h){return new g.Slider.View({id:"field-"+h.id,precise:h.type=="float",min:h.min,max:h.max})},_fieldHidden:function(h){return new g.Hidden({id:"field-"+h.id})},_fieldBoolean:function(h){return new g.RadioButton.View({id:"field-"+h.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]})}});return{View:f}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: natefoo: Update tag latest_2014.10.06 for changeset c9759aa6e40f
by commits-noreply@bitbucket.org 10 Nov '14
by commits-noreply@bitbucket.org 10 Nov '14
10 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f01e2504095a/
Changeset: f01e2504095a
Branch: stable
User: natefoo
Date: 2014-11-10 20:00:25+00:00
Summary: Update tag latest_2014.10.06 for changeset c9759aa6e40f
Affected #: 1 file
diff -r c9759aa6e40f887dec2d27d2f244d6fd7c28e6de -r f01e2504095a477b16970f9570eb68361f031287 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -20,4 +20,4 @@
ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11
548ab24667d6206780237bd807f7d857a484c461 latest_2014.08.11
2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06
-a1dca14d5b1afbf2b5bde192e3e6b6763836eff8 latest_2014.10.06
+c9759aa6e40f887dec2d27d2f244d6fd7c28e6de latest_2014.10.06
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
10 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/1c92e972a0a3/
Changeset: 1c92e972a0a3
User: jmchilton
Date: 2014-11-10 16:43:09+00:00
Summary: Merge stable.
Affected #: 4 files
diff -r 25f0318f232ff783972c1e3e26fa853c0b9f085b -r 1c92e972a0a38afccfffed8a51be6c63c64969e2 .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -20,4 +20,4 @@
ca45b78adb4152fc6e7395514d46eba6b7d0b838 release_2014.08.11
548ab24667d6206780237bd807f7d857a484c461 latest_2014.08.11
2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06
-9bc08bc7f393362ee7e6cf1d04bb9d8cee68f2d8 latest_2014.10.06
+a1dca14d5b1afbf2b5bde192e3e6b6763836eff8 latest_2014.10.06
diff -r 25f0318f232ff783972c1e3e26fa853c0b9f085b -r 1c92e972a0a38afccfffed8a51be6c63c64969e2 client/galaxy/scripts/mvc/collection/paired-collection-creator.js
--- a/client/galaxy/scripts/mvc/collection/paired-collection-creator.js
+++ b/client/galaxy/scripts/mvc/collection/paired-collection-creator.js
@@ -1298,7 +1298,7 @@
_clickPairName : function( ev ){
ev.stopPropagation();
var $control = $( ev.currentTarget ),
- pair = this.paired[ $control.parent().index() ],
+ pair = this.paired[ $control.parent().parent().index() / 2 ],
response = prompt( 'Enter a new name for the pair:', pair.name );
if( response ){
pair.name = response;
diff -r 25f0318f232ff783972c1e3e26fa853c0b9f085b -r 1c92e972a0a38afccfffed8a51be6c63c64969e2 static/scripts/mvc/collection/paired-collection-creator.js
--- a/static/scripts/mvc/collection/paired-collection-creator.js
+++ b/static/scripts/mvc/collection/paired-collection-creator.js
@@ -1298,7 +1298,7 @@
_clickPairName : function( ev ){
ev.stopPropagation();
var $control = $( ev.currentTarget ),
- pair = this.paired[ $control.parent().index() ],
+ pair = this.paired[ $control.parent().parent().index() / 2 ],
response = prompt( 'Enter a new name for the pair:', pair.name );
if( response ){
pair.name = response;
diff -r 25f0318f232ff783972c1e3e26fa853c0b9f085b -r 1c92e972a0a38afccfffed8a51be6c63c64969e2 static/scripts/packed/mvc/collection/paired-collection-creator.js
--- a/static/scripts/packed/mvc/collection/paired-collection-creator.js
+++ b/static/scripts/packed/mvc/collection/paired-collection-creator.js
@@ -1,1 +1,1 @@
-define(["utils/levenshtein","mvc/base-mvc","utils/localization"],function(g,a,d){var f=Backbone.View.extend(a.LoggableMixin).extend({tagName:"li",className:"dataset paired",initialize:function(h){this.pair=h.pair||{}},render:function(){this.$el.attr("draggable",true).data("pair",this.pair).html(_.template(['<span class="forward-dataset-name flex-column"><%= pair.forward.name %></span>','<span class="pair-name-column flex-column">','<span class="pair-name"><%= pair.name %></span>',"</span>",'<span class="reverse-dataset-name flex-column"><%= pair.reverse.name %></span>'].join(""),{pair:this.pair})).addClass("flex-column-container");return this},events:{dragstart:"_dragstart",dragend:"_dragend",dragover:"_sendToParent",drop:"_sendToParent"},_dragstart:function(h){h.currentTarget.style.opacity="0.4";if(h.originalEvent){h=h.originalEvent}h.dataTransfer.effectAllowed="move";h.dataTransfer.setData("text/plain",JSON.stringify(this.pair));this.$el.parent().trigger("pair.dragstart",[this])},_dragend:function(h){h.currentTarget.style.opacity="1.0";this.$el.parent().trigger("pair.dragend",[this])},_sendToParent:function(h){this.$el.parent().trigger(h)},toString:function(){return"PairView("+this.pair.name+")"}});var e=Backbone.View.extend(a.LoggableMixin).extend({className:"collection-creator flex-row-container",initialize:function(h){h=_.defaults(h,{datasets:[],filters:this.DEFAULT_FILTERS,automaticallyPair:true,matchPercentage:1,strategy:"lcs"});this.initialList=h.datasets;this.historyId=h.historyId;this.filters=this.commonFilters[h.filters]||this.commonFilters[this.DEFAULT_FILTERS];if(_.isArray(h.filters)){this.filters=h.filters}this.automaticallyPair=h.automaticallyPair;this.matchPercentage=h.matchPercentage;this.strategy=this.strategies[h.strategy]||this.strategies[this.DEFAULT_STRATEGY];if(_.isFunction(h.strategy)){this.strategy=h.strategy}this.removeExtensions=true;this.oncancel=h.oncancel;this.oncreate=h.oncreate;this.unpairedPanelHidden=false;this.pairedPanelHidden=false;this.$dragging=null;this._dataSetUp();this._setUpBehaviors()},commonFilters:{none:["",""],illumina:["_1","_2"]},DEFAULT_FILTERS:"illumina",strategies:{lcs:"autoPairLCSs",levenshtein:"autoPairLevenshtein"},DEFAULT_STRATEGY:"lcs",_dataSetUp:function(){this.paired=[];this.unpaired=[];this.selectedIds=[];this._sortInitialList();this._ensureIds();this.unpaired=this.initialList.slice(0);if(this.automaticallyPair){this.autoPair()}},_sortInitialList:function(){this._sortDatasetList(this.initialList)},_sortDatasetList:function(h){h.sort(function(j,i){return naturalSort(j.name,i.name)});return h},_ensureIds:function(){this.initialList.forEach(function(h){if(!h.hasOwnProperty("id")){h.id=_.uniqueId()}});return this.initialList},_splitByFilters:function(j){var i=[],h=[];this.unpaired.forEach(function(k){if(this._filterFwdFn(k)){i.push(k)}if(this._filterRevFn(k)){h.push(k)}}.bind(this));return[i,h]},_filterFwdFn:function(i){var h=new RegExp(this.filters[0]);return h.test(i.name)},_filterRevFn:function(i){var h=new RegExp(this.filters[1]);return h.test(i.name)},_addToUnpaired:function(i){var h=function(j,l){if(j===l){return j}var k=Math.floor((l-j)/2)+j,m=naturalSort(i.name,this.unpaired[k].name);if(m<0){return h(j,k)}else{if(m>0){return h(k+1,l)}}while(this.unpaired[k]&&this.unpaired[k].name===i.name){k++}return k}.bind(this);this.unpaired.splice(h(0,this.unpaired.length),0,i)},autoPair:function(h){h=h||this.strategy;this.simpleAutoPair();return this[h].call(this)},simpleAutoPair:function(){var n=0,l,r=this._splitByFilters(),h=r[0],q=r[1],p,s,k=false;while(n<h.length){var m=h[n];p=m.name.replace(this.filters[0],"");k=false;for(l=0;l<q.length;l++){var o=q[l];s=o.name.replace(this.filters[1],"");if(m!==o&&p===s){k=true;this._pair(h.splice(n,1)[0],q.splice(l,1)[0],{silent:true});break}}if(!k){n+=1}}},autoPairLevenshtein:function(){var o=0,m,t=this._splitByFilters(),h=t[0],r=t[1],q,v,k,s,l;while(o<h.length){var n=h[o];q=n.name.replace(this.filters[0],"");l=Number.MAX_VALUE;for(m=0;m<r.length;m++){var p=r[m];v=p.name.replace(this.filters[1],"");if(n!==p){if(q===v){s=m;l=0;break}k=levenshteinDistance(q,v);if(k<l){s=m;l=k}}}var u=1-(l/(Math.max(q.length,v.length)));if(u>=this.matchPercentage){this._pair(h.splice(o,1)[0],r.splice(s,1)[0],{silent:true});if(h.length<=0||r.length<=0){return}}else{o+=1}}},autoPairLCSs:function(){var m=0,k,t=this._splitByFilters(),h=t[0],r=t[1],q,w,v,s,o;if(!h.length||!r.length){return}while(m<h.length){var l=h[m];q=l.name.replace(this.filters[0],"");o=0;for(k=0;k<r.length;k++){var p=r[k];w=p.name.replace(this.filters[1],"");if(l!==p){if(q===w){s=k;o=q.length;break}var n=this._naiveStartingAndEndingLCS(q,w);v=n.length;if(v>o){s=k;o=v}}}var u=o/(Math.min(q.length,w.length));if(u>=this.matchPercentage){this._pair(h.splice(m,1)[0],r.splice(s,1)[0],{silent:true});if(h.length<=0||r.length<=0){return}}else{m+=1}}},_naiveStartingAndEndingLCS:function(m,k){var n="",o="",l=0,h=0;while(l<m.length&&l<k.length){if(m[l]!==k[l]){break}n+=m[l];l+=1}if(l===m.length){return m}if(l===k.length){return k}l=(m.length-1);h=(k.length-1);while(l>=0&&h>=0){if(m[l]!==k[h]){break}o=[m[l],o].join("");l-=1;h-=1}return n+o},_pair:function(j,h,i){i=i||{};var k=this._createPair(j,h,i.name);this.paired.push(k);this.unpaired=_.without(this.unpaired,j,h);if(!i.silent){this.trigger("pair:new",k)}return k},_createPair:function(j,h,i){if(!(j&&h)||(j===h)){throw new Error("Bad pairing: "+[JSON.stringify(j),JSON.stringify(h)])}i=i||this._guessNameForPair(j,h);return{forward:j,name:i,reverse:h}},_guessNameForPair:function(j,h,k){k=(k!==undefined)?(k):(this.removeExtensions);var i=this._naiveStartingAndEndingLCS(j.name.replace(this.filters[0],""),h.name.replace(this.filters[1],""));if(k){var l=i.lastIndexOf(".");if(l>0){i=i.slice(0,l)}}return i||(j.name+" & "+h.name)},_unpair:function(i,h){h=h||{};if(!i){throw new Error("Bad pair: "+JSON.stringify(i))}this.paired=_.without(this.paired,i);this._addToUnpaired(i.forward);this._addToUnpaired(i.reverse);if(!h.silent){this.trigger("pair:unpair",[i])}return i},unpairAll:function(){var h=[];while(this.paired.length){h.push(this._unpair(this.paired[0],{silent:true}))}this.trigger("pair:unpair",h)},_pairToJSON:function(h){return{collection_type:"paired",src:"new_collection",name:h.name,element_identifiers:[{name:"forward",id:h.forward.id,src:"hda"},{name:"reverse",id:h.reverse.id,src:"hda"}]}},createList:function(){var j=this,i;if(j.historyId){i="/api/histories/"+this.historyId+"/contents/dataset_collections"}var h={type:"dataset_collection",collection_type:"list:paired",name:_.escape(j.$(".collection-name").val()),element_identifiers:j.paired.map(function(k){return j._pairToJSON(k)})};return jQuery.ajax(i,{type:"POST",contentType:"application/json",dataType:"json",data:JSON.stringify(h)}).fail(function(m,k,l){j._ajaxErrHandler(m,k,l)}).done(function(k,l,m){j.trigger("collection:created",k,l,m);if(typeof j.oncreate==="function"){j.oncreate.call(this,k,l,m)}})},_ajaxErrHandler:function(k,h,j){this.error(k,h,j);var i=d("An error occurred while creating this collection");if(k){if(k.readyState===0&&k.status===0){i+=": "+d("Galaxy could not be reached and may be updating.")+d(" Try again in a few minutes.")}else{if(k.responseJSON){i+="<br /><pre>"+JSON.stringify(k.responseJSON)+"</pre>"}else{i+=": "+j}}}creator._showAlert(i,"alert-danger")},render:function(h,i){this.$el.empty().html(e.templates.main());this._renderHeader(h);this._renderMiddle(h);this._renderFooter(h);this._addPluginComponents();return this},_renderHeader:function(i,j){var h=this.$(".header").empty().html(e.templates.header()).find(".help-content").prepend($(e.templates.helpContent()));this._renderFilters();return h},_renderFilters:function(){return this.$(".forward-column .column-header input").val(this.filters[0]).add(this.$(".reverse-column .column-header input").val(this.filters[1]))},_renderMiddle:function(i,j){var h=this.$(".middle").empty().html(e.templates.middle());if(this.unpairedPanelHidden){this.$(".unpaired-columns").hide()}else{if(this.pairedPanelHidden){this.$(".paired-columns").hide()}}this._renderUnpaired();this._renderPaired();return h},_renderUnpaired:function(m,n){var k=this,l,i,h=[],j=this._splitByFilters();this.$(".forward-column .title").text([j[0].length,d("unpaired forward")].join(" "));this.$(".forward-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-j[0].length));this.$(".reverse-column .title").text([j[1].length,d("unpaired reverse")].join(" "));this.$(".reverse-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-j[1].length));this.$(".unpaired-columns .column-datasets").empty();this.$(".autopair-link").toggle(this.unpaired.length!==0);if(this.unpaired.length===0){this._renderUnpairedEmpty();return}i=j[1].map(function(p,o){if((j[0][o]!==undefined)&&(j[0][o]!==p)){h.push(k._renderPairButton())}return k._renderUnpairedDataset(p)});l=j[0].map(function(o){return k._renderUnpairedDataset(o)});if(!l.length&&!i.length){this._renderUnpairedNotShown();return}this.$(".unpaired-columns .forward-column .column-datasets").append(l).add(this.$(".unpaired-columns .paired-column .column-datasets").append(h)).add(this.$(".unpaired-columns .reverse-column .column-datasets").append(i));this._adjUnpairedOnScrollbar()},_renderUnpairedDisplayStr:function(h){return["(",h," ",d("filtered out"),")"].join("")},_renderUnpairedDataset:function(h){return $("<li/>").attr("id","dataset-"+h.id).addClass("dataset unpaired").attr("draggable",true).addClass(h.selected?"selected":"").append($("<span/>").addClass("dataset-name").text(h.name)).data("dataset",h)},_renderPairButton:function(){return $("<li/>").addClass("dataset unpaired").append($("<span/>").addClass("dataset-name").text(d("Pair these datasets")))},_renderUnpairedEmpty:function(){var h=$('<div class="empty-message"></div>').text("("+d("no remaining unpaired datasets")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(h);return h},_renderUnpairedNotShown:function(){var h=$('<div class="empty-message"></div>').text("("+d("no datasets were found matching the current filters")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(h);return h},_adjUnpairedOnScrollbar:function(){var k=this.$(".unpaired-columns").last(),l=this.$(".unpaired-columns .reverse-column .dataset").first();if(!l.size()){return}var h=k.offset().left+k.outerWidth(),j=l.offset().left+l.outerWidth(),i=Math.floor(h)-Math.floor(j);this.$(".unpaired-columns .forward-column").css("margin-left",(i>0)?i:0)},_renderPaired:function(i,j){this.$(".paired-column-title .title").text([this.paired.length,d("paired")].join(" "));this.$(".unpair-all-link").toggle(this.paired.length!==0);if(this.paired.length===0){this._renderPairedEmpty();return}else{this.$(".remove-extensions-link").show()}this.$(".paired-columns .column-datasets").empty();var h=this;this.paired.forEach(function(m,k){var l=new f({pair:m});h.$(".paired-columns .column-datasets").append(l.render().$el).append(['<button class="unpair-btn">','<span class="fa fa-unlink" title="',d("Unpair"),'"></span>',"</button>"].join(""))})},_renderPairedEmpty:function(){var h=$('<div class="empty-message"></div>').text("("+d("no paired datasets yet")+")");this.$(".paired-columns .column-datasets").empty().prepend(h);return h},_renderFooter:function(i,j){var h=this.$(".footer").empty().html(e.templates.footer());this.$(".remove-extensions").prop("checked",this.removeExtensions);if(typeof this.oncancel==="function"){this.$(".cancel-create.btn").show()}return h},_addPluginComponents:function(){this._chooseFiltersPopover(".choose-filters-link");this.$(".help-content i").hoverhighlight(".collection-creator","rgba( 64, 255, 255, 1.0 )")},_chooseFiltersPopover:function(h){function i(l,k){return['<button class="filter-choice btn" ','data-forward="',l,'" data-reverse="',k,'">',d("Forward"),": ",l,", ",d("Reverse"),": ",k,"</button>"].join("")}var j=$(_.template(['<div class="choose-filters">','<div class="help">',d("Choose from the following filters to change which unpaired reads are shown in the display"),":</div>",i("_1","_2"),i("_R1","_R2"),"</div>"].join(""),{}));return this.$(h).popover({container:".collection-creator",placement:"bottom",html:true,content:j})},_validationWarning:function(i,h){var j="validation-warning";if(i==="name"){i=this.$(".collection-name").add(this.$(".collection-name-prompt"));this.$(".collection-name").focus().select()}if(h){i=i||this.$("."+j);i.removeClass(j)}else{i.addClass(j)}},_setUpBehaviors:function(){this.on("pair:new",function(){this._renderUnpaired();this._renderPaired();this.$(".paired-columns").scrollTop(8000000)});this.on("pair:unpair",function(h){this._renderUnpaired();this._renderPaired();this.splitView()});this.on("filter-change",function(){this.filters=[this.$(".forward-unpaired-filter input").val(),this.$(".reverse-unpaired-filter input").val()];this._renderFilters();this._renderUnpaired()});this.on("autopair",function(){this._renderUnpaired();this._renderPaired();var h,i=null;if(this.paired.length){i="alert-success";h=this.paired.length+" "+d("pairs created");if(!this.unpaired.length){h+=": "+d("all datasets have been successfully paired");this.hideUnpaired()}}else{h=d("Could not automatically create any pairs from the given dataset names")}this._showAlert(h,i)});return this},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .header .alert button":"_hideAlert","click .forward-column .column-title":"_clickShowOnlyUnpaired","click .reverse-column .column-title":"_clickShowOnlyUnpaired","click .unpair-all-link":"_clickUnpairAll","change .forward-unpaired-filter input":function(h){this.trigger("filter-change")},"focus .forward-unpaired-filter input":function(h){$(h.currentTarget).select()},"click .autopair-link":"_clickAutopair","click .choose-filters .filter-choice":"_clickFilterChoice","click .clear-filters-link":"_clearFilters","change .reverse-unpaired-filter input":function(h){this.trigger("filter-change")},"focus .reverse-unpaired-filter input":function(h){$(h.currentTarget).select()},"click .forward-column .dataset.unpaired":"_clickUnpairedDataset","click .reverse-column .dataset.unpaired":"_clickUnpairedDataset","click .paired-column .dataset.unpaired":"_clickPairRow","click .unpaired-columns":"clearSelectedUnpaired","mousedown .unpaired-columns .dataset":"_mousedownUnpaired","click .paired-column-title":"_clickShowOnlyPaired","mousedown .flexible-partition-drag":"_startPartitionDrag","click .paired-columns .dataset.paired":"selectPair","click .paired-columns":"clearSelectedPaired","click .paired-columns .pair-name":"_clickPairName","click .unpair-btn":"_clickUnpair","dragover .paired-columns .column-datasets":"_dragoverPairedColumns","drop .paired-columns .column-datasets":"_dropPairedColumns","pair.dragstart .paired-columns .column-datasets":"_pairDragstart","pair.dragend .paired-columns .column-datasets":"_pairDragend","change .remove-extensions":function(h){this.toggleExtensions()},"change .collection-name":"_changeName","click .cancel-create":function(h){if(typeof this.oncancel==="function"){this.oncancel.call(this)}},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(h){this.$(".main-help").addClass("expanded");this.$(".more-help").hide()},_clickLessHelp:function(h){this.$(".main-help").removeClass("expanded");this.$(".more-help").show()},_showAlert:function(i,h){h=h||"alert-danger";this.$(".main-help").hide();this.$(".header .alert").attr("class","alert alert-dismissable").addClass(h).show().find(".alert-message").html(i)},_hideAlert:function(h){this.$(".main-help").show();this.$(".header .alert").hide()},_clickShowOnlyUnpaired:function(h){if(this.$(".paired-columns").is(":visible")){this.hidePaired()}else{this.splitView()}},_clickShowOnlyPaired:function(h){if(this.$(".unpaired-columns").is(":visible")){this.hideUnpaired()}else{this.splitView()}},hideUnpaired:function(h,i){this.unpairedPanelHidden=true;this.pairedPanelHidden=false;this._renderMiddle(h,i)},hidePaired:function(h,i){this.unpairedPanelHidden=false;this.pairedPanelHidden=true;this._renderMiddle(h,i)},splitView:function(h,i){this.unpairedPanelHidden=this.pairedPanelHidden=false;this._renderMiddle(h,i);return this},_clickUnpairAll:function(h){this.unpairAll()},_clickAutopair:function(i){var h=this.autoPair();this.trigger("autopair",h)},_clickFilterChoice:function(i){var h=$(i.currentTarget);this.$(".forward-unpaired-filter input").val(h.data("forward"));this.$(".reverse-unpaired-filter input").val(h.data("reverse"));this._hideChooseFilters();this.trigger("filter-change")},_hideChooseFilters:function(){this.$(".choose-filters-link").popover("hide");this.$(".popover").css("display","none")},_clearFilters:function(h){this.$(".forward-unpaired-filter input").val("");this.$(".reverse-unpaired-filter input").val("");this.trigger("filter-change")},_clickUnpairedDataset:function(h){h.stopPropagation();return this.toggleSelectUnpaired($(h.currentTarget))},toggleSelectUnpaired:function(j,i){i=i||{};var k=j.data("dataset"),h=i.force!==undefined?i.force:!j.hasClass("selected");if(!j.size()||k===undefined){return j}if(h){j.addClass("selected");if(!i.waitToPair){this.pairAllSelected()}}else{j.removeClass("selected")}return j},pairAllSelected:function(i){i=i||{};var j=this,k=[],h=[],l=[];j.$(".unpaired-columns .forward-column .dataset.selected").each(function(){k.push($(this).data("dataset"))});j.$(".unpaired-columns .reverse-column .dataset.selected").each(function(){h.push($(this).data("dataset"))});k.length=h.length=Math.min(k.length,h.length);k.forEach(function(n,m){try{l.push(j._pair(n,h[m],{silent:true}))}catch(o){j.error(o)}});if(l.length&&!i.silent){this.trigger("pair:new",l)}return l},clearSelectedUnpaired:function(){this.$(".unpaired-columns .dataset.selected").removeClass("selected")},_mousedownUnpaired:function(j){if(j.shiftKey){var i=this,h=$(j.target).addClass("selected"),k=function(l){i.$(l.target).filter(".dataset").addClass("selected")};h.parent().on("mousemove",k);$(document).one("mouseup",function(l){h.parent().off("mousemove",k);i.pairAllSelected()})}},_clickPairRow:function(j){var k=$(j.currentTarget).index(),i=$(".unpaired-columns .forward-column .dataset").eq(k).data("dataset"),h=$(".unpaired-columns .reverse-column .dataset").eq(k).data("dataset");this._pair(i,h)},_startPartitionDrag:function(i){var h=this,l=i.pageY;$("body").css("cursor","ns-resize");h.$(".flexible-partition-drag").css("color","black");function k(m){h.$(".flexible-partition-drag").css("color","");$("body").css("cursor","").unbind("mousemove",j)}function j(m){var n=m.pageY-l;if(!h.adjPartition(n)){$("body").trigger("mouseup")}h._adjUnpairedOnScrollbar();l+=n}$("body").mousemove(j);$("body").one("mouseup",k)},adjPartition:function(i){var h=this.$(".unpaired-columns"),j=this.$(".paired-columns"),k=parseInt(h.css("height"),10),l=parseInt(j.css("height"),10);k=Math.max(10,k+i);l=l-i;var m=i<0;if(m){if(this.unpairedPanelHidden){return false}else{if(k<=10){this.hideUnpaired();return false}}}else{if(this.unpairedPanelHidden){h.show();this.unpairedPanelHidden=false}}if(!m){if(this.pairedPanelHidden){return false}else{if(l<=15){this.hidePaired();return false}}}else{if(this.pairedPanelHidden){j.show();this.pairedPanelHidden=false}}h.css({height:k+"px",flex:"0 0 auto"});return true},selectPair:function(h){h.stopPropagation();$(h.currentTarget).toggleClass("selected")},clearSelectedPaired:function(h){this.$(".paired-columns .dataset.selected").removeClass("selected")},_clickPairName:function(j){j.stopPropagation();var i=$(j.currentTarget),k=this.paired[i.parent().index()],h=prompt("Enter a new name for the pair:",k.name);if(h){k.name=h;k.customizedName=true;i.text(k.name)}},_clickUnpair:function(i){var h=Math.floor($(i.currentTarget).index()/2);this._unpair(this.paired[h])},_dragoverPairedColumns:function(k){k.preventDefault();var i=this.$(".paired-columns .column-datasets"),l=i.offset();var j=this._getNearestPairedDatasetLi(k.originalEvent.clientY);$(".paired-drop-placeholder").remove();var h=$('<div class="paired-drop-placeholder"></div>');if(!j.size()){i.append(h)}else{j.before(h)}},_getNearestPairedDatasetLi:function(o){var l=4,j=this.$(".paired-columns .column-datasets li").toArray();for(var k=0;k<j.length;k++){var n=$(j[k]),m=n.offset().top,h=Math.floor(n.outerHeight()/2)+l;if(m+h>o&&m-h<o){return n}}return $()},_dropPairedColumns:function(i){i.preventDefault();i.dataTransfer.dropEffect="move";var h=this._getNearestPairedDatasetLi(i.originalEvent.clientY);if(h.size()){this.$dragging.insertBefore(h)}else{this.$dragging.insertAfter(this.$(".paired-columns .unpair-btn").last())}this._syncPairsToDom();return false},_syncPairsToDom:function(){var h=[];this.$(".paired-columns .dataset.paired").each(function(){h.push($(this).data("pair"))});this.paired=h;this._renderPaired()},_pairDragstart:function(i,j){j.$el.addClass("selected");var h=this.$(".paired-columns .dataset.selected");this.$dragging=h},_pairDragend:function(h,i){$(".paired-drop-placeholder").remove();this.$dragging=null},toggleExtensions:function(i){var h=this;h.removeExtensions=(i!==undefined)?(i):(!h.removeExtensions);_.each(h.paired,function(j){if(j.customizedName){return}j.name=h._guessNameForPair(j.forward,j.reverse)});h._renderPaired();h._renderFooter()},_changeName:function(h){this._validationWarning("name",!!this._getName())},_getName:function(){return _.escape(this.$(".collection-name").val())},_clickCreate:function(i){var h=this._getName();if(!h){this._validationWarning("name")}else{this.createList()}},_printList:function(i){var h=this;_.each(i,function(j){if(i===h.paired){h._printPair(j)}else{}})},_printPair:function(h){this.debug(h.forward.name,h.reverse.name,": ->",h.name)},toString:function(){return"PairedCollectionCreator"}});e.templates=e.templates||{main:_.template(['<div class="header flex-row no-flex"></div>','<div class="middle flex-row flex-row-container"></div>','<div class="footer flex-row no-flex">'].join("")),header:_.template(['<div class="main-help well clear">','<a class="more-help" href="javascript:void(0);">',d("More help"),"</a>",'<div class="help-content">','<a class="less-help" href="javascript:void(0);">',d("Less"),"</a>","</div>","</div>",'<div class="alert alert-dismissable">','<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>','<span class="alert-message"></span>',"</div>",'<div class="column-headers vertically-spaced flex-column-container">','<div class="forward-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired forward"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter forward-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>",'<div class="paired-column flex-column no-flex column">','<div class="column-header">','<a class="choose-filters-link" href="javascript:void(0)">',d("Choose filters"),"</a>",'<a class="clear-filters-link" href="javascript:void(0);">',d("Clear filters"),"</a><br />",'<a class="autopair-link" href="javascript:void(0);">',d("Auto-pair"),"</a>","</div>","</div>",'<div class="reverse-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired reverse"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter reverse-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>","</div>"].join("")),middle:_.template(['<div class="unpaired-columns flex-column-container scroll-container flex-row">','<div class="forward-column flex-column column">','<ol class="column-datasets"></ol>',"</div>",'<div class="paired-column flex-column no-flex column">','<ol class="column-datasets"></ol>',"</div>",'<div class="reverse-column flex-column column">','<ol class="column-datasets"></ol>',"</div>","</div>",'<div class="flexible-partition">','<div class="flexible-partition-drag" title="',d("Drag to change"),'"></div>','<div class="column-header">','<div class="column-title paired-column-title">','<span class="title"></span>',"</div>",'<a class="unpair-all-link" href="javascript:void(0);">',d("Unpair all"),"</a>","</div>","</div>",'<div class="paired-columns flex-column-container scroll-container flex-row">','<ol class="column-datasets"></ol>',"</div>"].join("")),footer:_.template(['<div class="attributes clear">','<div class="clear">','<label class="remove-extensions-prompt pull-right">',d("Remove file extensions from pair names"),"?",'<input class="remove-extensions pull-right" type="checkbox" />',"</label>","</div>",'<div class="clear">','<input class="collection-name form-control pull-right" ','placeholder="',d("Enter a name for your new list"),'" />','<div class="collection-name-prompt pull-right">',d("Name"),":</div>","</div>","</div>",'<div class="actions clear vertically-spaced">','<div class="other-options pull-left">','<button class="cancel-create btn" tabindex="-1">',d("Cancel"),"</button>",'<div class="create-other btn-group dropup">','<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">',d("Create a different kind of collection"),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">','<li><a href="#">',d("Create a <i>single</i> pair"),"</a></li>",'<li><a href="#">',d("Create a list of <i>unpaired</i> datasets"),"</a></li>","</ul>","</div>","</div>",'<div class="main-options pull-right">','<button class="create-collection btn btn-primary">',d("Create list"),"</button>","</div>","</div>"].join("")),helpContent:_.template(["<p>",d(["Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ","These collections can be passed to tools and workflows in order to have analyses done on each member of ","the entire group. This interface allows you to create a collection, choose which datasets are paired, ","and re-order the final collection."].join("")),"</p>","<p>",d(['Unpaired datasets are shown in the <i data-target=".unpaired-columns">unpaired section</i> ',"(hover over the underlined words to highlight below). ",'Paired datasets are shown in the <i data-target=".paired-columns">paired section</i>.',"<ul>To pair datasets, you can:","<li>Click a dataset in the ",'<i data-target=".unpaired-columns .forward-column .column-datasets,','.unpaired-columns .forward-column">forward column</i> ',"to select it then click a dataset in the ",'<i data-target=".unpaired-columns .reverse-column .column-datasets,','.unpaired-columns .reverse-column">reverse column</i>.',"</li>",'<li>Click one of the "Pair these datasets" buttons in the ','<i data-target=".unpaired-columns .paired-column .column-datasets,','.unpaired-columns .paired-column">middle column</i> ',"to pair the datasets in a particular row.","</li>",'<li>Click <i data-target=".autopair-link">"Auto-pair"</i> ',"to have your datasets automatically paired based on name.","</li>","</ul>"].join("")),"</p>","<p>",d(["<ul>You can filter what is shown in the unpaired sections by:","<li>Entering partial dataset names in either the ",'<i data-target=".forward-unpaired-filter input">forward filter</i> or ','<i data-target=".reverse-unpaired-filter input">reverse filter</i>.',"</li>","<li>Choosing from a list of preset filters by clicking the ",'<i data-target=".choose-filters-link">"Choose filters" link</i>.',"</li>","<li>Entering regular expressions to match dataset names. See: ",'<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expre…"',' target="_blank">MDN\'s JavaScript Regular Expression Tutorial</a>. ',"Note: forward slashes (\\) are not needed.","</li>","<li>Clearing the filters by clicking the ",'<i data-target=".clear-filters-link">"Clear filters" link</i>.',"</li>","</ul>"].join("")),"</p>","<p>",d(["To unpair individual dataset pairs, click the ",'<i data-target=".unpair-btn">unpair buttons ( <span class="fa fa-unlink"></span> )</i>. ','Click the <i data-target=".unpair-all-link">"Unpair all" link</i> to unpair all pairs.'].join("")),"</p>","<p>",d(['You can include or remove the file extensions (e.g. ".fastq") from your pair names by toggling the ','<i data-target=".remove-extensions-prompt">"Remove file extensions from pair names?"</i> control.'].join("")),"</p>","<p>",d(['Once your collection is complete, enter a <i data-target=".collection-name">name</i> and ','click <i data-target=".create-collection">"Create list"</i>. ',"(Note: you do not have to pair all unpaired datasets to finish.)"].join("")),"</p>"].join(""))};(function(){jQuery.fn.extend({hoverhighlight:function h(j,i){j=j||"body";if(!this.size()){return this}$(this).each(function(){var l=$(this),k=l.data("target");if(k){l.mouseover(function(m){$(k,j).css({background:i})}).mouseout(function(m){$(k).css({background:""})})}});return this}})}());var b=function c(j,h){h=_.defaults(h||{},{datasets:j,oncancel:function(){Galaxy.modal.hide()},oncreate:function(){Galaxy.modal.hide();Galaxy.currHistoryPanel.refreshContents()}});if(!window.Galaxy||!Galaxy.modal){throw new Error("Galaxy or Galaxy.modal not found")}var i=new e(h).render();Galaxy.modal.show({title:"Create a collection of paired datasets",body:i.$el,width:"80%",height:"800px",closing_events:true});window.PCC=i;return i};return{PairedCollectionCreator:e,pairedCollectionCreatorModal:b}});
\ No newline at end of file
+define(["utils/levenshtein","mvc/base-mvc","utils/localization"],function(g,a,d){var f=Backbone.View.extend(a.LoggableMixin).extend({tagName:"li",className:"dataset paired",initialize:function(h){this.pair=h.pair||{}},render:function(){this.$el.attr("draggable",true).data("pair",this.pair).html(_.template(['<span class="forward-dataset-name flex-column"><%= pair.forward.name %></span>','<span class="pair-name-column flex-column">','<span class="pair-name"><%= pair.name %></span>',"</span>",'<span class="reverse-dataset-name flex-column"><%= pair.reverse.name %></span>'].join(""),{pair:this.pair})).addClass("flex-column-container");return this},events:{dragstart:"_dragstart",dragend:"_dragend",dragover:"_sendToParent",drop:"_sendToParent"},_dragstart:function(h){h.currentTarget.style.opacity="0.4";if(h.originalEvent){h=h.originalEvent}h.dataTransfer.effectAllowed="move";h.dataTransfer.setData("text/plain",JSON.stringify(this.pair));this.$el.parent().trigger("pair.dragstart",[this])},_dragend:function(h){h.currentTarget.style.opacity="1.0";this.$el.parent().trigger("pair.dragend",[this])},_sendToParent:function(h){this.$el.parent().trigger(h)},toString:function(){return"PairView("+this.pair.name+")"}});var e=Backbone.View.extend(a.LoggableMixin).extend({className:"collection-creator flex-row-container",initialize:function(h){h=_.defaults(h,{datasets:[],filters:this.DEFAULT_FILTERS,automaticallyPair:true,matchPercentage:1,strategy:"lcs"});this.initialList=h.datasets;this.historyId=h.historyId;this.filters=this.commonFilters[h.filters]||this.commonFilters[this.DEFAULT_FILTERS];if(_.isArray(h.filters)){this.filters=h.filters}this.automaticallyPair=h.automaticallyPair;this.matchPercentage=h.matchPercentage;this.strategy=this.strategies[h.strategy]||this.strategies[this.DEFAULT_STRATEGY];if(_.isFunction(h.strategy)){this.strategy=h.strategy}this.removeExtensions=true;this.oncancel=h.oncancel;this.oncreate=h.oncreate;this.unpairedPanelHidden=false;this.pairedPanelHidden=false;this.$dragging=null;this._dataSetUp();this._setUpBehaviors()},commonFilters:{none:["",""],illumina:["_1","_2"]},DEFAULT_FILTERS:"illumina",strategies:{lcs:"autoPairLCSs",levenshtein:"autoPairLevenshtein"},DEFAULT_STRATEGY:"lcs",_dataSetUp:function(){this.paired=[];this.unpaired=[];this.selectedIds=[];this._sortInitialList();this._ensureIds();this.unpaired=this.initialList.slice(0);if(this.automaticallyPair){this.autoPair()}},_sortInitialList:function(){this._sortDatasetList(this.initialList)},_sortDatasetList:function(h){h.sort(function(j,i){return naturalSort(j.name,i.name)});return h},_ensureIds:function(){this.initialList.forEach(function(h){if(!h.hasOwnProperty("id")){h.id=_.uniqueId()}});return this.initialList},_splitByFilters:function(j){var i=[],h=[];this.unpaired.forEach(function(k){if(this._filterFwdFn(k)){i.push(k)}if(this._filterRevFn(k)){h.push(k)}}.bind(this));return[i,h]},_filterFwdFn:function(i){var h=new RegExp(this.filters[0]);return h.test(i.name)},_filterRevFn:function(i){var h=new RegExp(this.filters[1]);return h.test(i.name)},_addToUnpaired:function(i){var h=function(j,l){if(j===l){return j}var k=Math.floor((l-j)/2)+j,m=naturalSort(i.name,this.unpaired[k].name);if(m<0){return h(j,k)}else{if(m>0){return h(k+1,l)}}while(this.unpaired[k]&&this.unpaired[k].name===i.name){k++}return k}.bind(this);this.unpaired.splice(h(0,this.unpaired.length),0,i)},autoPair:function(h){h=h||this.strategy;this.simpleAutoPair();return this[h].call(this)},simpleAutoPair:function(){var n=0,l,r=this._splitByFilters(),h=r[0],q=r[1],p,s,k=false;while(n<h.length){var m=h[n];p=m.name.replace(this.filters[0],"");k=false;for(l=0;l<q.length;l++){var o=q[l];s=o.name.replace(this.filters[1],"");if(m!==o&&p===s){k=true;this._pair(h.splice(n,1)[0],q.splice(l,1)[0],{silent:true});break}}if(!k){n+=1}}},autoPairLevenshtein:function(){var o=0,m,t=this._splitByFilters(),h=t[0],r=t[1],q,v,k,s,l;while(o<h.length){var n=h[o];q=n.name.replace(this.filters[0],"");l=Number.MAX_VALUE;for(m=0;m<r.length;m++){var p=r[m];v=p.name.replace(this.filters[1],"");if(n!==p){if(q===v){s=m;l=0;break}k=levenshteinDistance(q,v);if(k<l){s=m;l=k}}}var u=1-(l/(Math.max(q.length,v.length)));if(u>=this.matchPercentage){this._pair(h.splice(o,1)[0],r.splice(s,1)[0],{silent:true});if(h.length<=0||r.length<=0){return}}else{o+=1}}},autoPairLCSs:function(){var m=0,k,t=this._splitByFilters(),h=t[0],r=t[1],q,w,v,s,o;if(!h.length||!r.length){return}while(m<h.length){var l=h[m];q=l.name.replace(this.filters[0],"");o=0;for(k=0;k<r.length;k++){var p=r[k];w=p.name.replace(this.filters[1],"");if(l!==p){if(q===w){s=k;o=q.length;break}var n=this._naiveStartingAndEndingLCS(q,w);v=n.length;if(v>o){s=k;o=v}}}var u=o/(Math.min(q.length,w.length));if(u>=this.matchPercentage){this._pair(h.splice(m,1)[0],r.splice(s,1)[0],{silent:true});if(h.length<=0||r.length<=0){return}}else{m+=1}}},_naiveStartingAndEndingLCS:function(m,k){var n="",o="",l=0,h=0;while(l<m.length&&l<k.length){if(m[l]!==k[l]){break}n+=m[l];l+=1}if(l===m.length){return m}if(l===k.length){return k}l=(m.length-1);h=(k.length-1);while(l>=0&&h>=0){if(m[l]!==k[h]){break}o=[m[l],o].join("");l-=1;h-=1}return n+o},_pair:function(j,h,i){i=i||{};var k=this._createPair(j,h,i.name);this.paired.push(k);this.unpaired=_.without(this.unpaired,j,h);if(!i.silent){this.trigger("pair:new",k)}return k},_createPair:function(j,h,i){if(!(j&&h)||(j===h)){throw new Error("Bad pairing: "+[JSON.stringify(j),JSON.stringify(h)])}i=i||this._guessNameForPair(j,h);return{forward:j,name:i,reverse:h}},_guessNameForPair:function(j,h,k){k=(k!==undefined)?(k):(this.removeExtensions);var i=this._naiveStartingAndEndingLCS(j.name.replace(this.filters[0],""),h.name.replace(this.filters[1],""));if(k){var l=i.lastIndexOf(".");if(l>0){i=i.slice(0,l)}}return i||(j.name+" & "+h.name)},_unpair:function(i,h){h=h||{};if(!i){throw new Error("Bad pair: "+JSON.stringify(i))}this.paired=_.without(this.paired,i);this._addToUnpaired(i.forward);this._addToUnpaired(i.reverse);if(!h.silent){this.trigger("pair:unpair",[i])}return i},unpairAll:function(){var h=[];while(this.paired.length){h.push(this._unpair(this.paired[0],{silent:true}))}this.trigger("pair:unpair",h)},_pairToJSON:function(h){return{collection_type:"paired",src:"new_collection",name:h.name,element_identifiers:[{name:"forward",id:h.forward.id,src:"hda"},{name:"reverse",id:h.reverse.id,src:"hda"}]}},createList:function(){var j=this,i;if(j.historyId){i="/api/histories/"+this.historyId+"/contents/dataset_collections"}var h={type:"dataset_collection",collection_type:"list:paired",name:_.escape(j.$(".collection-name").val()),element_identifiers:j.paired.map(function(k){return j._pairToJSON(k)})};return jQuery.ajax(i,{type:"POST",contentType:"application/json",dataType:"json",data:JSON.stringify(h)}).fail(function(m,k,l){j._ajaxErrHandler(m,k,l)}).done(function(k,l,m){j.trigger("collection:created",k,l,m);if(typeof j.oncreate==="function"){j.oncreate.call(this,k,l,m)}})},_ajaxErrHandler:function(k,h,j){this.error(k,h,j);var i=d("An error occurred while creating this collection");if(k){if(k.readyState===0&&k.status===0){i+=": "+d("Galaxy could not be reached and may be updating.")+d(" Try again in a few minutes.")}else{if(k.responseJSON){i+="<br /><pre>"+JSON.stringify(k.responseJSON)+"</pre>"}else{i+=": "+j}}}creator._showAlert(i,"alert-danger")},render:function(h,i){this.$el.empty().html(e.templates.main());this._renderHeader(h);this._renderMiddle(h);this._renderFooter(h);this._addPluginComponents();return this},_renderHeader:function(i,j){var h=this.$(".header").empty().html(e.templates.header()).find(".help-content").prepend($(e.templates.helpContent()));this._renderFilters();return h},_renderFilters:function(){return this.$(".forward-column .column-header input").val(this.filters[0]).add(this.$(".reverse-column .column-header input").val(this.filters[1]))},_renderMiddle:function(i,j){var h=this.$(".middle").empty().html(e.templates.middle());if(this.unpairedPanelHidden){this.$(".unpaired-columns").hide()}else{if(this.pairedPanelHidden){this.$(".paired-columns").hide()}}this._renderUnpaired();this._renderPaired();return h},_renderUnpaired:function(m,n){var k=this,l,i,h=[],j=this._splitByFilters();this.$(".forward-column .title").text([j[0].length,d("unpaired forward")].join(" "));this.$(".forward-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-j[0].length));this.$(".reverse-column .title").text([j[1].length,d("unpaired reverse")].join(" "));this.$(".reverse-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-j[1].length));this.$(".unpaired-columns .column-datasets").empty();this.$(".autopair-link").toggle(this.unpaired.length!==0);if(this.unpaired.length===0){this._renderUnpairedEmpty();return}i=j[1].map(function(p,o){if((j[0][o]!==undefined)&&(j[0][o]!==p)){h.push(k._renderPairButton())}return k._renderUnpairedDataset(p)});l=j[0].map(function(o){return k._renderUnpairedDataset(o)});if(!l.length&&!i.length){this._renderUnpairedNotShown();return}this.$(".unpaired-columns .forward-column .column-datasets").append(l).add(this.$(".unpaired-columns .paired-column .column-datasets").append(h)).add(this.$(".unpaired-columns .reverse-column .column-datasets").append(i));this._adjUnpairedOnScrollbar()},_renderUnpairedDisplayStr:function(h){return["(",h," ",d("filtered out"),")"].join("")},_renderUnpairedDataset:function(h){return $("<li/>").attr("id","dataset-"+h.id).addClass("dataset unpaired").attr("draggable",true).addClass(h.selected?"selected":"").append($("<span/>").addClass("dataset-name").text(h.name)).data("dataset",h)},_renderPairButton:function(){return $("<li/>").addClass("dataset unpaired").append($("<span/>").addClass("dataset-name").text(d("Pair these datasets")))},_renderUnpairedEmpty:function(){var h=$('<div class="empty-message"></div>').text("("+d("no remaining unpaired datasets")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(h);return h},_renderUnpairedNotShown:function(){var h=$('<div class="empty-message"></div>').text("("+d("no datasets were found matching the current filters")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(h);return h},_adjUnpairedOnScrollbar:function(){var k=this.$(".unpaired-columns").last(),l=this.$(".unpaired-columns .reverse-column .dataset").first();if(!l.size()){return}var h=k.offset().left+k.outerWidth(),j=l.offset().left+l.outerWidth(),i=Math.floor(h)-Math.floor(j);this.$(".unpaired-columns .forward-column").css("margin-left",(i>0)?i:0)},_renderPaired:function(i,j){this.$(".paired-column-title .title").text([this.paired.length,d("paired")].join(" "));this.$(".unpair-all-link").toggle(this.paired.length!==0);if(this.paired.length===0){this._renderPairedEmpty();return}else{this.$(".remove-extensions-link").show()}this.$(".paired-columns .column-datasets").empty();var h=this;this.paired.forEach(function(m,k){var l=new f({pair:m});h.$(".paired-columns .column-datasets").append(l.render().$el).append(['<button class="unpair-btn">','<span class="fa fa-unlink" title="',d("Unpair"),'"></span>',"</button>"].join(""))})},_renderPairedEmpty:function(){var h=$('<div class="empty-message"></div>').text("("+d("no paired datasets yet")+")");this.$(".paired-columns .column-datasets").empty().prepend(h);return h},_renderFooter:function(i,j){var h=this.$(".footer").empty().html(e.templates.footer());this.$(".remove-extensions").prop("checked",this.removeExtensions);if(typeof this.oncancel==="function"){this.$(".cancel-create.btn").show()}return h},_addPluginComponents:function(){this._chooseFiltersPopover(".choose-filters-link");this.$(".help-content i").hoverhighlight(".collection-creator","rgba( 64, 255, 255, 1.0 )")},_chooseFiltersPopover:function(h){function i(l,k){return['<button class="filter-choice btn" ','data-forward="',l,'" data-reverse="',k,'">',d("Forward"),": ",l,", ",d("Reverse"),": ",k,"</button>"].join("")}var j=$(_.template(['<div class="choose-filters">','<div class="help">',d("Choose from the following filters to change which unpaired reads are shown in the display"),":</div>",i("_1","_2"),i("_R1","_R2"),"</div>"].join(""),{}));return this.$(h).popover({container:".collection-creator",placement:"bottom",html:true,content:j})},_validationWarning:function(i,h){var j="validation-warning";if(i==="name"){i=this.$(".collection-name").add(this.$(".collection-name-prompt"));this.$(".collection-name").focus().select()}if(h){i=i||this.$("."+j);i.removeClass(j)}else{i.addClass(j)}},_setUpBehaviors:function(){this.on("pair:new",function(){this._renderUnpaired();this._renderPaired();this.$(".paired-columns").scrollTop(8000000)});this.on("pair:unpair",function(h){this._renderUnpaired();this._renderPaired();this.splitView()});this.on("filter-change",function(){this.filters=[this.$(".forward-unpaired-filter input").val(),this.$(".reverse-unpaired-filter input").val()];this._renderFilters();this._renderUnpaired()});this.on("autopair",function(){this._renderUnpaired();this._renderPaired();var h,i=null;if(this.paired.length){i="alert-success";h=this.paired.length+" "+d("pairs created");if(!this.unpaired.length){h+=": "+d("all datasets have been successfully paired");this.hideUnpaired()}}else{h=d("Could not automatically create any pairs from the given dataset names")}this._showAlert(h,i)});return this},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .header .alert button":"_hideAlert","click .forward-column .column-title":"_clickShowOnlyUnpaired","click .reverse-column .column-title":"_clickShowOnlyUnpaired","click .unpair-all-link":"_clickUnpairAll","change .forward-unpaired-filter input":function(h){this.trigger("filter-change")},"focus .forward-unpaired-filter input":function(h){$(h.currentTarget).select()},"click .autopair-link":"_clickAutopair","click .choose-filters .filter-choice":"_clickFilterChoice","click .clear-filters-link":"_clearFilters","change .reverse-unpaired-filter input":function(h){this.trigger("filter-change")},"focus .reverse-unpaired-filter input":function(h){$(h.currentTarget).select()},"click .forward-column .dataset.unpaired":"_clickUnpairedDataset","click .reverse-column .dataset.unpaired":"_clickUnpairedDataset","click .paired-column .dataset.unpaired":"_clickPairRow","click .unpaired-columns":"clearSelectedUnpaired","mousedown .unpaired-columns .dataset":"_mousedownUnpaired","click .paired-column-title":"_clickShowOnlyPaired","mousedown .flexible-partition-drag":"_startPartitionDrag","click .paired-columns .dataset.paired":"selectPair","click .paired-columns":"clearSelectedPaired","click .paired-columns .pair-name":"_clickPairName","click .unpair-btn":"_clickUnpair","dragover .paired-columns .column-datasets":"_dragoverPairedColumns","drop .paired-columns .column-datasets":"_dropPairedColumns","pair.dragstart .paired-columns .column-datasets":"_pairDragstart","pair.dragend .paired-columns .column-datasets":"_pairDragend","change .remove-extensions":function(h){this.toggleExtensions()},"change .collection-name":"_changeName","click .cancel-create":function(h){if(typeof this.oncancel==="function"){this.oncancel.call(this)}},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(h){this.$(".main-help").addClass("expanded");this.$(".more-help").hide()},_clickLessHelp:function(h){this.$(".main-help").removeClass("expanded");this.$(".more-help").show()},_showAlert:function(i,h){h=h||"alert-danger";this.$(".main-help").hide();this.$(".header .alert").attr("class","alert alert-dismissable").addClass(h).show().find(".alert-message").html(i)},_hideAlert:function(h){this.$(".main-help").show();this.$(".header .alert").hide()},_clickShowOnlyUnpaired:function(h){if(this.$(".paired-columns").is(":visible")){this.hidePaired()}else{this.splitView()}},_clickShowOnlyPaired:function(h){if(this.$(".unpaired-columns").is(":visible")){this.hideUnpaired()}else{this.splitView()}},hideUnpaired:function(h,i){this.unpairedPanelHidden=true;this.pairedPanelHidden=false;this._renderMiddle(h,i)},hidePaired:function(h,i){this.unpairedPanelHidden=false;this.pairedPanelHidden=true;this._renderMiddle(h,i)},splitView:function(h,i){this.unpairedPanelHidden=this.pairedPanelHidden=false;this._renderMiddle(h,i);return this},_clickUnpairAll:function(h){this.unpairAll()},_clickAutopair:function(i){var h=this.autoPair();this.trigger("autopair",h)},_clickFilterChoice:function(i){var h=$(i.currentTarget);this.$(".forward-unpaired-filter input").val(h.data("forward"));this.$(".reverse-unpaired-filter input").val(h.data("reverse"));this._hideChooseFilters();this.trigger("filter-change")},_hideChooseFilters:function(){this.$(".choose-filters-link").popover("hide");this.$(".popover").css("display","none")},_clearFilters:function(h){this.$(".forward-unpaired-filter input").val("");this.$(".reverse-unpaired-filter input").val("");this.trigger("filter-change")},_clickUnpairedDataset:function(h){h.stopPropagation();return this.toggleSelectUnpaired($(h.currentTarget))},toggleSelectUnpaired:function(j,i){i=i||{};var k=j.data("dataset"),h=i.force!==undefined?i.force:!j.hasClass("selected");if(!j.size()||k===undefined){return j}if(h){j.addClass("selected");if(!i.waitToPair){this.pairAllSelected()}}else{j.removeClass("selected")}return j},pairAllSelected:function(i){i=i||{};var j=this,k=[],h=[],l=[];j.$(".unpaired-columns .forward-column .dataset.selected").each(function(){k.push($(this).data("dataset"))});j.$(".unpaired-columns .reverse-column .dataset.selected").each(function(){h.push($(this).data("dataset"))});k.length=h.length=Math.min(k.length,h.length);k.forEach(function(n,m){try{l.push(j._pair(n,h[m],{silent:true}))}catch(o){j.error(o)}});if(l.length&&!i.silent){this.trigger("pair:new",l)}return l},clearSelectedUnpaired:function(){this.$(".unpaired-columns .dataset.selected").removeClass("selected")},_mousedownUnpaired:function(j){if(j.shiftKey){var i=this,h=$(j.target).addClass("selected"),k=function(l){i.$(l.target).filter(".dataset").addClass("selected")};h.parent().on("mousemove",k);$(document).one("mouseup",function(l){h.parent().off("mousemove",k);i.pairAllSelected()})}},_clickPairRow:function(j){var k=$(j.currentTarget).index(),i=$(".unpaired-columns .forward-column .dataset").eq(k).data("dataset"),h=$(".unpaired-columns .reverse-column .dataset").eq(k).data("dataset");this._pair(i,h)},_startPartitionDrag:function(i){var h=this,l=i.pageY;$("body").css("cursor","ns-resize");h.$(".flexible-partition-drag").css("color","black");function k(m){h.$(".flexible-partition-drag").css("color","");$("body").css("cursor","").unbind("mousemove",j)}function j(m){var n=m.pageY-l;if(!h.adjPartition(n)){$("body").trigger("mouseup")}h._adjUnpairedOnScrollbar();l+=n}$("body").mousemove(j);$("body").one("mouseup",k)},adjPartition:function(i){var h=this.$(".unpaired-columns"),j=this.$(".paired-columns"),k=parseInt(h.css("height"),10),l=parseInt(j.css("height"),10);k=Math.max(10,k+i);l=l-i;var m=i<0;if(m){if(this.unpairedPanelHidden){return false}else{if(k<=10){this.hideUnpaired();return false}}}else{if(this.unpairedPanelHidden){h.show();this.unpairedPanelHidden=false}}if(!m){if(this.pairedPanelHidden){return false}else{if(l<=15){this.hidePaired();return false}}}else{if(this.pairedPanelHidden){j.show();this.pairedPanelHidden=false}}h.css({height:k+"px",flex:"0 0 auto"});return true},selectPair:function(h){h.stopPropagation();$(h.currentTarget).toggleClass("selected")},clearSelectedPaired:function(h){this.$(".paired-columns .dataset.selected").removeClass("selected")},_clickPairName:function(j){j.stopPropagation();var i=$(j.currentTarget),k=this.paired[i.parent().parent().index()/2],h=prompt("Enter a new name for the pair:",k.name);if(h){k.name=h;k.customizedName=true;i.text(k.name)}},_clickUnpair:function(i){var h=Math.floor($(i.currentTarget).index()/2);this._unpair(this.paired[h])},_dragoverPairedColumns:function(k){k.preventDefault();var i=this.$(".paired-columns .column-datasets"),l=i.offset();var j=this._getNearestPairedDatasetLi(k.originalEvent.clientY);$(".paired-drop-placeholder").remove();var h=$('<div class="paired-drop-placeholder"></div>');if(!j.size()){i.append(h)}else{j.before(h)}},_getNearestPairedDatasetLi:function(o){var l=4,j=this.$(".paired-columns .column-datasets li").toArray();for(var k=0;k<j.length;k++){var n=$(j[k]),m=n.offset().top,h=Math.floor(n.outerHeight()/2)+l;if(m+h>o&&m-h<o){return n}}return $()},_dropPairedColumns:function(i){i.preventDefault();i.dataTransfer.dropEffect="move";var h=this._getNearestPairedDatasetLi(i.originalEvent.clientY);if(h.size()){this.$dragging.insertBefore(h)}else{this.$dragging.insertAfter(this.$(".paired-columns .unpair-btn").last())}this._syncPairsToDom();return false},_syncPairsToDom:function(){var h=[];this.$(".paired-columns .dataset.paired").each(function(){h.push($(this).data("pair"))});this.paired=h;this._renderPaired()},_pairDragstart:function(i,j){j.$el.addClass("selected");var h=this.$(".paired-columns .dataset.selected");this.$dragging=h},_pairDragend:function(h,i){$(".paired-drop-placeholder").remove();this.$dragging=null},toggleExtensions:function(i){var h=this;h.removeExtensions=(i!==undefined)?(i):(!h.removeExtensions);_.each(h.paired,function(j){if(j.customizedName){return}j.name=h._guessNameForPair(j.forward,j.reverse)});h._renderPaired();h._renderFooter()},_changeName:function(h){this._validationWarning("name",!!this._getName())},_getName:function(){return _.escape(this.$(".collection-name").val())},_clickCreate:function(i){var h=this._getName();if(!h){this._validationWarning("name")}else{this.createList()}},_printList:function(i){var h=this;_.each(i,function(j){if(i===h.paired){h._printPair(j)}else{}})},_printPair:function(h){this.debug(h.forward.name,h.reverse.name,": ->",h.name)},toString:function(){return"PairedCollectionCreator"}});e.templates=e.templates||{main:_.template(['<div class="header flex-row no-flex"></div>','<div class="middle flex-row flex-row-container"></div>','<div class="footer flex-row no-flex">'].join("")),header:_.template(['<div class="main-help well clear">','<a class="more-help" href="javascript:void(0);">',d("More help"),"</a>",'<div class="help-content">','<a class="less-help" href="javascript:void(0);">',d("Less"),"</a>","</div>","</div>",'<div class="alert alert-dismissable">','<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>','<span class="alert-message"></span>',"</div>",'<div class="column-headers vertically-spaced flex-column-container">','<div class="forward-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired forward"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter forward-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>",'<div class="paired-column flex-column no-flex column">','<div class="column-header">','<a class="choose-filters-link" href="javascript:void(0)">',d("Choose filters"),"</a>",'<a class="clear-filters-link" href="javascript:void(0);">',d("Clear filters"),"</a><br />",'<a class="autopair-link" href="javascript:void(0);">',d("Auto-pair"),"</a>","</div>","</div>",'<div class="reverse-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired reverse"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter reverse-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>","</div>"].join("")),middle:_.template(['<div class="unpaired-columns flex-column-container scroll-container flex-row">','<div class="forward-column flex-column column">','<ol class="column-datasets"></ol>',"</div>",'<div class="paired-column flex-column no-flex column">','<ol class="column-datasets"></ol>',"</div>",'<div class="reverse-column flex-column column">','<ol class="column-datasets"></ol>',"</div>","</div>",'<div class="flexible-partition">','<div class="flexible-partition-drag" title="',d("Drag to change"),'"></div>','<div class="column-header">','<div class="column-title paired-column-title">','<span class="title"></span>',"</div>",'<a class="unpair-all-link" href="javascript:void(0);">',d("Unpair all"),"</a>","</div>","</div>",'<div class="paired-columns flex-column-container scroll-container flex-row">','<ol class="column-datasets"></ol>',"</div>"].join("")),footer:_.template(['<div class="attributes clear">','<div class="clear">','<label class="remove-extensions-prompt pull-right">',d("Remove file extensions from pair names"),"?",'<input class="remove-extensions pull-right" type="checkbox" />',"</label>","</div>",'<div class="clear">','<input class="collection-name form-control pull-right" ','placeholder="',d("Enter a name for your new list"),'" />','<div class="collection-name-prompt pull-right">',d("Name"),":</div>","</div>","</div>",'<div class="actions clear vertically-spaced">','<div class="other-options pull-left">','<button class="cancel-create btn" tabindex="-1">',d("Cancel"),"</button>",'<div class="create-other btn-group dropup">','<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">',d("Create a different kind of collection"),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">','<li><a href="#">',d("Create a <i>single</i> pair"),"</a></li>",'<li><a href="#">',d("Create a list of <i>unpaired</i> datasets"),"</a></li>","</ul>","</div>","</div>",'<div class="main-options pull-right">','<button class="create-collection btn btn-primary">',d("Create list"),"</button>","</div>","</div>"].join("")),helpContent:_.template(["<p>",d(["Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ","These collections can be passed to tools and workflows in order to have analyses done on each member of ","the entire group. This interface allows you to create a collection, choose which datasets are paired, ","and re-order the final collection."].join("")),"</p>","<p>",d(['Unpaired datasets are shown in the <i data-target=".unpaired-columns">unpaired section</i> ',"(hover over the underlined words to highlight below). ",'Paired datasets are shown in the <i data-target=".paired-columns">paired section</i>.',"<ul>To pair datasets, you can:","<li>Click a dataset in the ",'<i data-target=".unpaired-columns .forward-column .column-datasets,','.unpaired-columns .forward-column">forward column</i> ',"to select it then click a dataset in the ",'<i data-target=".unpaired-columns .reverse-column .column-datasets,','.unpaired-columns .reverse-column">reverse column</i>.',"</li>",'<li>Click one of the "Pair these datasets" buttons in the ','<i data-target=".unpaired-columns .paired-column .column-datasets,','.unpaired-columns .paired-column">middle column</i> ',"to pair the datasets in a particular row.","</li>",'<li>Click <i data-target=".autopair-link">"Auto-pair"</i> ',"to have your datasets automatically paired based on name.","</li>","</ul>"].join("")),"</p>","<p>",d(["<ul>You can filter what is shown in the unpaired sections by:","<li>Entering partial dataset names in either the ",'<i data-target=".forward-unpaired-filter input">forward filter</i> or ','<i data-target=".reverse-unpaired-filter input">reverse filter</i>.',"</li>","<li>Choosing from a list of preset filters by clicking the ",'<i data-target=".choose-filters-link">"Choose filters" link</i>.',"</li>","<li>Entering regular expressions to match dataset names. See: ",'<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expre…"',' target="_blank">MDN\'s JavaScript Regular Expression Tutorial</a>. ',"Note: forward slashes (\\) are not needed.","</li>","<li>Clearing the filters by clicking the ",'<i data-target=".clear-filters-link">"Clear filters" link</i>.',"</li>","</ul>"].join("")),"</p>","<p>",d(["To unpair individual dataset pairs, click the ",'<i data-target=".unpair-btn">unpair buttons ( <span class="fa fa-unlink"></span> )</i>. ','Click the <i data-target=".unpair-all-link">"Unpair all" link</i> to unpair all pairs.'].join("")),"</p>","<p>",d(['You can include or remove the file extensions (e.g. ".fastq") from your pair names by toggling the ','<i data-target=".remove-extensions-prompt">"Remove file extensions from pair names?"</i> control.'].join("")),"</p>","<p>",d(['Once your collection is complete, enter a <i data-target=".collection-name">name</i> and ','click <i data-target=".create-collection">"Create list"</i>. ',"(Note: you do not have to pair all unpaired datasets to finish.)"].join("")),"</p>"].join(""))};(function(){jQuery.fn.extend({hoverhighlight:function h(j,i){j=j||"body";if(!this.size()){return this}$(this).each(function(){var l=$(this),k=l.data("target");if(k){l.mouseover(function(m){$(k,j).css({background:i})}).mouseout(function(m){$(k).css({background:""})})}});return this}})}());var b=function c(j,h){h=_.defaults(h||{},{datasets:j,oncancel:function(){Galaxy.modal.hide()},oncreate:function(){Galaxy.modal.hide();Galaxy.currHistoryPanel.refreshContents()}});if(!window.Galaxy||!Galaxy.modal){throw new Error("Galaxy or Galaxy.modal not found")}var i=new e(h).render();Galaxy.modal.show({title:"Create a collection of paired datasets",body:i.$el,width:"80%",height:"800px",closing_events:true});window.PCC=i;return i};return{PairedCollectionCreator:e,pairedCollectionCreatorModal:b}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jmchilton: Bugfix renaming individual parts of pairs.
by commits-noreply@bitbucket.org 10 Nov '14
by commits-noreply@bitbucket.org 10 Nov '14
10 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/c9759aa6e40f/
Changeset: c9759aa6e40f
Branch: stable
User: jmchilton
Date: 2014-11-10 15:07:56+00:00
Summary: Bugfix renaming individual parts of pairs.
>From Carl: "Yeah - that looks fine for stable. A better fix is probably adding the pair index directly into the DOM and getting it there - I'll add that to the 'Iteration 2' card. I'll approve now if you want to do the request."
Affected #: 3 files
diff -r a16007e4df83c21ff1d9218b3892fae783742fb8 -r c9759aa6e40f887dec2d27d2f244d6fd7c28e6de client/galaxy/scripts/mvc/collection/paired-collection-creator.js
--- a/client/galaxy/scripts/mvc/collection/paired-collection-creator.js
+++ b/client/galaxy/scripts/mvc/collection/paired-collection-creator.js
@@ -1298,7 +1298,7 @@
_clickPairName : function( ev ){
ev.stopPropagation();
var $control = $( ev.currentTarget ),
- pair = this.paired[ $control.parent().index() ],
+ pair = this.paired[ $control.parent().parent().index() / 2 ],
response = prompt( 'Enter a new name for the pair:', pair.name );
if( response ){
pair.name = response;
diff -r a16007e4df83c21ff1d9218b3892fae783742fb8 -r c9759aa6e40f887dec2d27d2f244d6fd7c28e6de static/scripts/mvc/collection/paired-collection-creator.js
--- a/static/scripts/mvc/collection/paired-collection-creator.js
+++ b/static/scripts/mvc/collection/paired-collection-creator.js
@@ -1298,7 +1298,7 @@
_clickPairName : function( ev ){
ev.stopPropagation();
var $control = $( ev.currentTarget ),
- pair = this.paired[ $control.parent().index() ],
+ pair = this.paired[ $control.parent().parent().index() / 2 ],
response = prompt( 'Enter a new name for the pair:', pair.name );
if( response ){
pair.name = response;
diff -r a16007e4df83c21ff1d9218b3892fae783742fb8 -r c9759aa6e40f887dec2d27d2f244d6fd7c28e6de static/scripts/packed/mvc/collection/paired-collection-creator.js
--- a/static/scripts/packed/mvc/collection/paired-collection-creator.js
+++ b/static/scripts/packed/mvc/collection/paired-collection-creator.js
@@ -1,1 +1,1 @@
-define(["utils/levenshtein","mvc/base-mvc","utils/localization"],function(g,a,d){var f=Backbone.View.extend(a.LoggableMixin).extend({tagName:"li",className:"dataset paired",initialize:function(h){this.pair=h.pair||{}},render:function(){this.$el.attr("draggable",true).data("pair",this.pair).html(_.template(['<span class="forward-dataset-name flex-column"><%= pair.forward.name %></span>','<span class="pair-name-column flex-column">','<span class="pair-name"><%= pair.name %></span>',"</span>",'<span class="reverse-dataset-name flex-column"><%= pair.reverse.name %></span>'].join(""),{pair:this.pair})).addClass("flex-column-container");return this},events:{dragstart:"_dragstart",dragend:"_dragend",dragover:"_sendToParent",drop:"_sendToParent"},_dragstart:function(h){h.currentTarget.style.opacity="0.4";if(h.originalEvent){h=h.originalEvent}h.dataTransfer.effectAllowed="move";h.dataTransfer.setData("text/plain",JSON.stringify(this.pair));this.$el.parent().trigger("pair.dragstart",[this])},_dragend:function(h){h.currentTarget.style.opacity="1.0";this.$el.parent().trigger("pair.dragend",[this])},_sendToParent:function(h){this.$el.parent().trigger(h)},toString:function(){return"PairView("+this.pair.name+")"}});var e=Backbone.View.extend(a.LoggableMixin).extend({className:"collection-creator flex-row-container",initialize:function(h){h=_.defaults(h,{datasets:[],filters:this.DEFAULT_FILTERS,automaticallyPair:true,matchPercentage:1,strategy:"lcs"});this.initialList=h.datasets;this.historyId=h.historyId;this.filters=this.commonFilters[h.filters]||this.commonFilters[this.DEFAULT_FILTERS];if(_.isArray(h.filters)){this.filters=h.filters}this.automaticallyPair=h.automaticallyPair;this.matchPercentage=h.matchPercentage;this.strategy=this.strategies[h.strategy]||this.strategies[this.DEFAULT_STRATEGY];if(_.isFunction(h.strategy)){this.strategy=h.strategy}this.removeExtensions=true;this.oncancel=h.oncancel;this.oncreate=h.oncreate;this.unpairedPanelHidden=false;this.pairedPanelHidden=false;this.$dragging=null;this._dataSetUp();this._setUpBehaviors()},commonFilters:{none:["",""],illumina:["_1","_2"]},DEFAULT_FILTERS:"illumina",strategies:{lcs:"autoPairLCSs",levenshtein:"autoPairLevenshtein"},DEFAULT_STRATEGY:"lcs",_dataSetUp:function(){this.paired=[];this.unpaired=[];this.selectedIds=[];this._sortInitialList();this._ensureIds();this.unpaired=this.initialList.slice(0);if(this.automaticallyPair){this.autoPair()}},_sortInitialList:function(){this._sortDatasetList(this.initialList)},_sortDatasetList:function(h){h.sort(function(j,i){return naturalSort(j.name,i.name)});return h},_ensureIds:function(){this.initialList.forEach(function(h){if(!h.hasOwnProperty("id")){h.id=_.uniqueId()}});return this.initialList},_splitByFilters:function(j){var i=[],h=[];this.unpaired.forEach(function(k){if(this._filterFwdFn(k)){i.push(k)}if(this._filterRevFn(k)){h.push(k)}}.bind(this));return[i,h]},_filterFwdFn:function(i){var h=new RegExp(this.filters[0]);return h.test(i.name)},_filterRevFn:function(i){var h=new RegExp(this.filters[1]);return h.test(i.name)},_addToUnpaired:function(i){var h=function(j,l){if(j===l){return j}var k=Math.floor((l-j)/2)+j,m=naturalSort(i.name,this.unpaired[k].name);if(m<0){return h(j,k)}else{if(m>0){return h(k+1,l)}}while(this.unpaired[k]&&this.unpaired[k].name===i.name){k++}return k}.bind(this);this.unpaired.splice(h(0,this.unpaired.length),0,i)},autoPair:function(h){h=h||this.strategy;this.simpleAutoPair();return this[h].call(this)},simpleAutoPair:function(){var n=0,l,r=this._splitByFilters(),h=r[0],q=r[1],p,s,k=false;while(n<h.length){var m=h[n];p=m.name.replace(this.filters[0],"");k=false;for(l=0;l<q.length;l++){var o=q[l];s=o.name.replace(this.filters[1],"");if(m!==o&&p===s){k=true;this._pair(h.splice(n,1)[0],q.splice(l,1)[0],{silent:true});break}}if(!k){n+=1}}},autoPairLevenshtein:function(){var o=0,m,t=this._splitByFilters(),h=t[0],r=t[1],q,v,k,s,l;while(o<h.length){var n=h[o];q=n.name.replace(this.filters[0],"");l=Number.MAX_VALUE;for(m=0;m<r.length;m++){var p=r[m];v=p.name.replace(this.filters[1],"");if(n!==p){if(q===v){s=m;l=0;break}k=levenshteinDistance(q,v);if(k<l){s=m;l=k}}}var u=1-(l/(Math.max(q.length,v.length)));if(u>=this.matchPercentage){this._pair(h.splice(o,1)[0],r.splice(s,1)[0],{silent:true});if(h.length<=0||r.length<=0){return}}else{o+=1}}},autoPairLCSs:function(){var m=0,k,t=this._splitByFilters(),h=t[0],r=t[1],q,w,v,s,o;if(!h.length||!r.length){return}while(m<h.length){var l=h[m];q=l.name.replace(this.filters[0],"");o=0;for(k=0;k<r.length;k++){var p=r[k];w=p.name.replace(this.filters[1],"");if(l!==p){if(q===w){s=k;o=q.length;break}var n=this._naiveStartingAndEndingLCS(q,w);v=n.length;if(v>o){s=k;o=v}}}var u=o/(Math.min(q.length,w.length));if(u>=this.matchPercentage){this._pair(h.splice(m,1)[0],r.splice(s,1)[0],{silent:true});if(h.length<=0||r.length<=0){return}}else{m+=1}}},_naiveStartingAndEndingLCS:function(m,k){var n="",o="",l=0,h=0;while(l<m.length&&l<k.length){if(m[l]!==k[l]){break}n+=m[l];l+=1}if(l===m.length){return m}if(l===k.length){return k}l=(m.length-1);h=(k.length-1);while(l>=0&&h>=0){if(m[l]!==k[h]){break}o=[m[l],o].join("");l-=1;h-=1}return n+o},_pair:function(j,h,i){i=i||{};var k=this._createPair(j,h,i.name);this.paired.push(k);this.unpaired=_.without(this.unpaired,j,h);if(!i.silent){this.trigger("pair:new",k)}return k},_createPair:function(j,h,i){if(!(j&&h)||(j===h)){throw new Error("Bad pairing: "+[JSON.stringify(j),JSON.stringify(h)])}i=i||this._guessNameForPair(j,h);return{forward:j,name:i,reverse:h}},_guessNameForPair:function(j,h,k){k=(k!==undefined)?(k):(this.removeExtensions);var i=this._naiveStartingAndEndingLCS(j.name.replace(this.filters[0],""),h.name.replace(this.filters[1],""));if(k){var l=i.lastIndexOf(".");if(l>0){i=i.slice(0,l)}}return i||(j.name+" & "+h.name)},_unpair:function(i,h){h=h||{};if(!i){throw new Error("Bad pair: "+JSON.stringify(i))}this.paired=_.without(this.paired,i);this._addToUnpaired(i.forward);this._addToUnpaired(i.reverse);if(!h.silent){this.trigger("pair:unpair",[i])}return i},unpairAll:function(){var h=[];while(this.paired.length){h.push(this._unpair(this.paired[0],{silent:true}))}this.trigger("pair:unpair",h)},_pairToJSON:function(h){return{collection_type:"paired",src:"new_collection",name:h.name,element_identifiers:[{name:"forward",id:h.forward.id,src:"hda"},{name:"reverse",id:h.reverse.id,src:"hda"}]}},createList:function(){var j=this,i;if(j.historyId){i="/api/histories/"+this.historyId+"/contents/dataset_collections"}var h={type:"dataset_collection",collection_type:"list:paired",name:_.escape(j.$(".collection-name").val()),element_identifiers:j.paired.map(function(k){return j._pairToJSON(k)})};return jQuery.ajax(i,{type:"POST",contentType:"application/json",dataType:"json",data:JSON.stringify(h)}).fail(function(m,k,l){j._ajaxErrHandler(m,k,l)}).done(function(k,l,m){j.trigger("collection:created",k,l,m);if(typeof j.oncreate==="function"){j.oncreate.call(this,k,l,m)}})},_ajaxErrHandler:function(k,h,j){this.error(k,h,j);var i=d("An error occurred while creating this collection");if(k){if(k.readyState===0&&k.status===0){i+=": "+d("Galaxy could not be reached and may be updating.")+d(" Try again in a few minutes.")}else{if(k.responseJSON){i+="<br /><pre>"+JSON.stringify(k.responseJSON)+"</pre>"}else{i+=": "+j}}}creator._showAlert(i,"alert-danger")},render:function(h,i){this.$el.empty().html(e.templates.main());this._renderHeader(h);this._renderMiddle(h);this._renderFooter(h);this._addPluginComponents();return this},_renderHeader:function(i,j){var h=this.$(".header").empty().html(e.templates.header()).find(".help-content").prepend($(e.templates.helpContent()));this._renderFilters();return h},_renderFilters:function(){return this.$(".forward-column .column-header input").val(this.filters[0]).add(this.$(".reverse-column .column-header input").val(this.filters[1]))},_renderMiddle:function(i,j){var h=this.$(".middle").empty().html(e.templates.middle());if(this.unpairedPanelHidden){this.$(".unpaired-columns").hide()}else{if(this.pairedPanelHidden){this.$(".paired-columns").hide()}}this._renderUnpaired();this._renderPaired();return h},_renderUnpaired:function(m,n){var k=this,l,i,h=[],j=this._splitByFilters();this.$(".forward-column .title").text([j[0].length,d("unpaired forward")].join(" "));this.$(".forward-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-j[0].length));this.$(".reverse-column .title").text([j[1].length,d("unpaired reverse")].join(" "));this.$(".reverse-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-j[1].length));this.$(".unpaired-columns .column-datasets").empty();this.$(".autopair-link").toggle(this.unpaired.length!==0);if(this.unpaired.length===0){this._renderUnpairedEmpty();return}i=j[1].map(function(p,o){if((j[0][o]!==undefined)&&(j[0][o]!==p)){h.push(k._renderPairButton())}return k._renderUnpairedDataset(p)});l=j[0].map(function(o){return k._renderUnpairedDataset(o)});if(!l.length&&!i.length){this._renderUnpairedNotShown();return}this.$(".unpaired-columns .forward-column .column-datasets").append(l).add(this.$(".unpaired-columns .paired-column .column-datasets").append(h)).add(this.$(".unpaired-columns .reverse-column .column-datasets").append(i));this._adjUnpairedOnScrollbar()},_renderUnpairedDisplayStr:function(h){return["(",h," ",d("filtered out"),")"].join("")},_renderUnpairedDataset:function(h){return $("<li/>").attr("id","dataset-"+h.id).addClass("dataset unpaired").attr("draggable",true).addClass(h.selected?"selected":"").append($("<span/>").addClass("dataset-name").text(h.name)).data("dataset",h)},_renderPairButton:function(){return $("<li/>").addClass("dataset unpaired").append($("<span/>").addClass("dataset-name").text(d("Pair these datasets")))},_renderUnpairedEmpty:function(){var h=$('<div class="empty-message"></div>').text("("+d("no remaining unpaired datasets")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(h);return h},_renderUnpairedNotShown:function(){var h=$('<div class="empty-message"></div>').text("("+d("no datasets were found matching the current filters")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(h);return h},_adjUnpairedOnScrollbar:function(){var k=this.$(".unpaired-columns").last(),l=this.$(".unpaired-columns .reverse-column .dataset").first();if(!l.size()){return}var h=k.offset().left+k.outerWidth(),j=l.offset().left+l.outerWidth(),i=Math.floor(h)-Math.floor(j);this.$(".unpaired-columns .forward-column").css("margin-left",(i>0)?i:0)},_renderPaired:function(i,j){this.$(".paired-column-title .title").text([this.paired.length,d("paired")].join(" "));this.$(".unpair-all-link").toggle(this.paired.length!==0);if(this.paired.length===0){this._renderPairedEmpty();return}else{this.$(".remove-extensions-link").show()}this.$(".paired-columns .column-datasets").empty();var h=this;this.paired.forEach(function(m,k){var l=new f({pair:m});h.$(".paired-columns .column-datasets").append(l.render().$el).append(['<button class="unpair-btn">','<span class="fa fa-unlink" title="',d("Unpair"),'"></span>',"</button>"].join(""))})},_renderPairedEmpty:function(){var h=$('<div class="empty-message"></div>').text("("+d("no paired datasets yet")+")");this.$(".paired-columns .column-datasets").empty().prepend(h);return h},_renderFooter:function(i,j){var h=this.$(".footer").empty().html(e.templates.footer());this.$(".remove-extensions").prop("checked",this.removeExtensions);if(typeof this.oncancel==="function"){this.$(".cancel-create.btn").show()}return h},_addPluginComponents:function(){this._chooseFiltersPopover(".choose-filters-link");this.$(".help-content i").hoverhighlight(".collection-creator","rgba( 64, 255, 255, 1.0 )")},_chooseFiltersPopover:function(h){function i(l,k){return['<button class="filter-choice btn" ','data-forward="',l,'" data-reverse="',k,'">',d("Forward"),": ",l,", ",d("Reverse"),": ",k,"</button>"].join("")}var j=$(_.template(['<div class="choose-filters">','<div class="help">',d("Choose from the following filters to change which unpaired reads are shown in the display"),":</div>",i("_1","_2"),i("_R1","_R2"),"</div>"].join(""),{}));return this.$(h).popover({container:".collection-creator",placement:"bottom",html:true,content:j})},_validationWarning:function(i,h){var j="validation-warning";if(i==="name"){i=this.$(".collection-name").add(this.$(".collection-name-prompt"));this.$(".collection-name").focus().select()}if(h){i=i||this.$("."+j);i.removeClass(j)}else{i.addClass(j)}},_setUpBehaviors:function(){this.on("pair:new",function(){this._renderUnpaired();this._renderPaired();this.$(".paired-columns").scrollTop(8000000)});this.on("pair:unpair",function(h){this._renderUnpaired();this._renderPaired();this.splitView()});this.on("filter-change",function(){this.filters=[this.$(".forward-unpaired-filter input").val(),this.$(".reverse-unpaired-filter input").val()];this._renderFilters();this._renderUnpaired()});this.on("autopair",function(){this._renderUnpaired();this._renderPaired();var h,i=null;if(this.paired.length){i="alert-success";h=this.paired.length+" "+d("pairs created");if(!this.unpaired.length){h+=": "+d("all datasets have been successfully paired");this.hideUnpaired()}}else{h=d("Could not automatically create any pairs from the given dataset names")}this._showAlert(h,i)});return this},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .header .alert button":"_hideAlert","click .forward-column .column-title":"_clickShowOnlyUnpaired","click .reverse-column .column-title":"_clickShowOnlyUnpaired","click .unpair-all-link":"_clickUnpairAll","change .forward-unpaired-filter input":function(h){this.trigger("filter-change")},"focus .forward-unpaired-filter input":function(h){$(h.currentTarget).select()},"click .autopair-link":"_clickAutopair","click .choose-filters .filter-choice":"_clickFilterChoice","click .clear-filters-link":"_clearFilters","change .reverse-unpaired-filter input":function(h){this.trigger("filter-change")},"focus .reverse-unpaired-filter input":function(h){$(h.currentTarget).select()},"click .forward-column .dataset.unpaired":"_clickUnpairedDataset","click .reverse-column .dataset.unpaired":"_clickUnpairedDataset","click .paired-column .dataset.unpaired":"_clickPairRow","click .unpaired-columns":"clearSelectedUnpaired","mousedown .unpaired-columns .dataset":"_mousedownUnpaired","click .paired-column-title":"_clickShowOnlyPaired","mousedown .flexible-partition-drag":"_startPartitionDrag","click .paired-columns .dataset.paired":"selectPair","click .paired-columns":"clearSelectedPaired","click .paired-columns .pair-name":"_clickPairName","click .unpair-btn":"_clickUnpair","dragover .paired-columns .column-datasets":"_dragoverPairedColumns","drop .paired-columns .column-datasets":"_dropPairedColumns","pair.dragstart .paired-columns .column-datasets":"_pairDragstart","pair.dragend .paired-columns .column-datasets":"_pairDragend","change .remove-extensions":function(h){this.toggleExtensions()},"change .collection-name":"_changeName","click .cancel-create":function(h){if(typeof this.oncancel==="function"){this.oncancel.call(this)}},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(h){this.$(".main-help").addClass("expanded");this.$(".more-help").hide()},_clickLessHelp:function(h){this.$(".main-help").removeClass("expanded");this.$(".more-help").show()},_showAlert:function(i,h){h=h||"alert-danger";this.$(".main-help").hide();this.$(".header .alert").attr("class","alert alert-dismissable").addClass(h).show().find(".alert-message").html(i)},_hideAlert:function(h){this.$(".main-help").show();this.$(".header .alert").hide()},_clickShowOnlyUnpaired:function(h){if(this.$(".paired-columns").is(":visible")){this.hidePaired()}else{this.splitView()}},_clickShowOnlyPaired:function(h){if(this.$(".unpaired-columns").is(":visible")){this.hideUnpaired()}else{this.splitView()}},hideUnpaired:function(h,i){this.unpairedPanelHidden=true;this.pairedPanelHidden=false;this._renderMiddle(h,i)},hidePaired:function(h,i){this.unpairedPanelHidden=false;this.pairedPanelHidden=true;this._renderMiddle(h,i)},splitView:function(h,i){this.unpairedPanelHidden=this.pairedPanelHidden=false;this._renderMiddle(h,i);return this},_clickUnpairAll:function(h){this.unpairAll()},_clickAutopair:function(i){var h=this.autoPair();this.trigger("autopair",h)},_clickFilterChoice:function(i){var h=$(i.currentTarget);this.$(".forward-unpaired-filter input").val(h.data("forward"));this.$(".reverse-unpaired-filter input").val(h.data("reverse"));this._hideChooseFilters();this.trigger("filter-change")},_hideChooseFilters:function(){this.$(".choose-filters-link").popover("hide");this.$(".popover").css("display","none")},_clearFilters:function(h){this.$(".forward-unpaired-filter input").val("");this.$(".reverse-unpaired-filter input").val("");this.trigger("filter-change")},_clickUnpairedDataset:function(h){h.stopPropagation();return this.toggleSelectUnpaired($(h.currentTarget))},toggleSelectUnpaired:function(j,i){i=i||{};var k=j.data("dataset"),h=i.force!==undefined?i.force:!j.hasClass("selected");if(!j.size()||k===undefined){return j}if(h){j.addClass("selected");if(!i.waitToPair){this.pairAllSelected()}}else{j.removeClass("selected")}return j},pairAllSelected:function(i){i=i||{};var j=this,k=[],h=[],l=[];j.$(".unpaired-columns .forward-column .dataset.selected").each(function(){k.push($(this).data("dataset"))});j.$(".unpaired-columns .reverse-column .dataset.selected").each(function(){h.push($(this).data("dataset"))});k.length=h.length=Math.min(k.length,h.length);k.forEach(function(n,m){try{l.push(j._pair(n,h[m],{silent:true}))}catch(o){j.error(o)}});if(l.length&&!i.silent){this.trigger("pair:new",l)}return l},clearSelectedUnpaired:function(){this.$(".unpaired-columns .dataset.selected").removeClass("selected")},_mousedownUnpaired:function(j){if(j.shiftKey){var i=this,h=$(j.target).addClass("selected"),k=function(l){i.$(l.target).filter(".dataset").addClass("selected")};h.parent().on("mousemove",k);$(document).one("mouseup",function(l){h.parent().off("mousemove",k);i.pairAllSelected()})}},_clickPairRow:function(j){var k=$(j.currentTarget).index(),i=$(".unpaired-columns .forward-column .dataset").eq(k).data("dataset"),h=$(".unpaired-columns .reverse-column .dataset").eq(k).data("dataset");this._pair(i,h)},_startPartitionDrag:function(i){var h=this,l=i.pageY;$("body").css("cursor","ns-resize");h.$(".flexible-partition-drag").css("color","black");function k(m){h.$(".flexible-partition-drag").css("color","");$("body").css("cursor","").unbind("mousemove",j)}function j(m){var n=m.pageY-l;if(!h.adjPartition(n)){$("body").trigger("mouseup")}h._adjUnpairedOnScrollbar();l+=n}$("body").mousemove(j);$("body").one("mouseup",k)},adjPartition:function(i){var h=this.$(".unpaired-columns"),j=this.$(".paired-columns"),k=parseInt(h.css("height"),10),l=parseInt(j.css("height"),10);k=Math.max(10,k+i);l=l-i;var m=i<0;if(m){if(this.unpairedPanelHidden){return false}else{if(k<=10){this.hideUnpaired();return false}}}else{if(this.unpairedPanelHidden){h.show();this.unpairedPanelHidden=false}}if(!m){if(this.pairedPanelHidden){return false}else{if(l<=15){this.hidePaired();return false}}}else{if(this.pairedPanelHidden){j.show();this.pairedPanelHidden=false}}h.css({height:k+"px",flex:"0 0 auto"});return true},selectPair:function(h){h.stopPropagation();$(h.currentTarget).toggleClass("selected")},clearSelectedPaired:function(h){this.$(".paired-columns .dataset.selected").removeClass("selected")},_clickPairName:function(j){j.stopPropagation();var i=$(j.currentTarget),k=this.paired[i.parent().index()],h=prompt("Enter a new name for the pair:",k.name);if(h){k.name=h;k.customizedName=true;i.text(k.name)}},_clickUnpair:function(i){var h=Math.floor($(i.currentTarget).index()/2);this._unpair(this.paired[h])},_dragoverPairedColumns:function(k){k.preventDefault();var i=this.$(".paired-columns .column-datasets"),l=i.offset();var j=this._getNearestPairedDatasetLi(k.originalEvent.clientY);$(".paired-drop-placeholder").remove();var h=$('<div class="paired-drop-placeholder"></div>');if(!j.size()){i.append(h)}else{j.before(h)}},_getNearestPairedDatasetLi:function(o){var l=4,j=this.$(".paired-columns .column-datasets li").toArray();for(var k=0;k<j.length;k++){var n=$(j[k]),m=n.offset().top,h=Math.floor(n.outerHeight()/2)+l;if(m+h>o&&m-h<o){return n}}return $()},_dropPairedColumns:function(i){i.preventDefault();i.dataTransfer.dropEffect="move";var h=this._getNearestPairedDatasetLi(i.originalEvent.clientY);if(h.size()){this.$dragging.insertBefore(h)}else{this.$dragging.insertAfter(this.$(".paired-columns .unpair-btn").last())}this._syncPairsToDom();return false},_syncPairsToDom:function(){var h=[];this.$(".paired-columns .dataset.paired").each(function(){h.push($(this).data("pair"))});this.paired=h;this._renderPaired()},_pairDragstart:function(i,j){j.$el.addClass("selected");var h=this.$(".paired-columns .dataset.selected");this.$dragging=h},_pairDragend:function(h,i){$(".paired-drop-placeholder").remove();this.$dragging=null},toggleExtensions:function(i){var h=this;h.removeExtensions=(i!==undefined)?(i):(!h.removeExtensions);_.each(h.paired,function(j){if(j.customizedName){return}j.name=h._guessNameForPair(j.forward,j.reverse)});h._renderPaired();h._renderFooter()},_changeName:function(h){this._validationWarning("name",!!this._getName())},_getName:function(){return _.escape(this.$(".collection-name").val())},_clickCreate:function(i){var h=this._getName();if(!h){this._validationWarning("name")}else{this.createList()}},_printList:function(i){var h=this;_.each(i,function(j){if(i===h.paired){h._printPair(j)}else{}})},_printPair:function(h){this.debug(h.forward.name,h.reverse.name,": ->",h.name)},toString:function(){return"PairedCollectionCreator"}});e.templates=e.templates||{main:_.template(['<div class="header flex-row no-flex"></div>','<div class="middle flex-row flex-row-container"></div>','<div class="footer flex-row no-flex">'].join("")),header:_.template(['<div class="main-help well clear">','<a class="more-help" href="javascript:void(0);">',d("More help"),"</a>",'<div class="help-content">','<a class="less-help" href="javascript:void(0);">',d("Less"),"</a>","</div>","</div>",'<div class="alert alert-dismissable">','<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>','<span class="alert-message"></span>',"</div>",'<div class="column-headers vertically-spaced flex-column-container">','<div class="forward-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired forward"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter forward-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>",'<div class="paired-column flex-column no-flex column">','<div class="column-header">','<a class="choose-filters-link" href="javascript:void(0)">',d("Choose filters"),"</a>",'<a class="clear-filters-link" href="javascript:void(0);">',d("Clear filters"),"</a><br />",'<a class="autopair-link" href="javascript:void(0);">',d("Auto-pair"),"</a>","</div>","</div>",'<div class="reverse-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired reverse"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter reverse-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>","</div>"].join("")),middle:_.template(['<div class="unpaired-columns flex-column-container scroll-container flex-row">','<div class="forward-column flex-column column">','<ol class="column-datasets"></ol>',"</div>",'<div class="paired-column flex-column no-flex column">','<ol class="column-datasets"></ol>',"</div>",'<div class="reverse-column flex-column column">','<ol class="column-datasets"></ol>',"</div>","</div>",'<div class="flexible-partition">','<div class="flexible-partition-drag" title="',d("Drag to change"),'"></div>','<div class="column-header">','<div class="column-title paired-column-title">','<span class="title"></span>',"</div>",'<a class="unpair-all-link" href="javascript:void(0);">',d("Unpair all"),"</a>","</div>","</div>",'<div class="paired-columns flex-column-container scroll-container flex-row">','<ol class="column-datasets"></ol>',"</div>"].join("")),footer:_.template(['<div class="attributes clear">','<div class="clear">','<label class="remove-extensions-prompt pull-right">',d("Remove file extensions from pair names"),"?",'<input class="remove-extensions pull-right" type="checkbox" />',"</label>","</div>",'<div class="clear">','<input class="collection-name form-control pull-right" ','placeholder="',d("Enter a name for your new list"),'" />','<div class="collection-name-prompt pull-right">',d("Name"),":</div>","</div>","</div>",'<div class="actions clear vertically-spaced">','<div class="other-options pull-left">','<button class="cancel-create btn" tabindex="-1">',d("Cancel"),"</button>",'<div class="create-other btn-group dropup">','<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">',d("Create a different kind of collection"),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">','<li><a href="#">',d("Create a <i>single</i> pair"),"</a></li>",'<li><a href="#">',d("Create a list of <i>unpaired</i> datasets"),"</a></li>","</ul>","</div>","</div>",'<div class="main-options pull-right">','<button class="create-collection btn btn-primary">',d("Create list"),"</button>","</div>","</div>"].join("")),helpContent:_.template(["<p>",d(["Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ","These collections can be passed to tools and workflows in order to have analyses done on each member of ","the entire group. This interface allows you to create a collection, choose which datasets are paired, ","and re-order the final collection."].join("")),"</p>","<p>",d(['Unpaired datasets are shown in the <i data-target=".unpaired-columns">unpaired section</i> ',"(hover over the underlined words to highlight below). ",'Paired datasets are shown in the <i data-target=".paired-columns">paired section</i>.',"<ul>To pair datasets, you can:","<li>Click a dataset in the ",'<i data-target=".unpaired-columns .forward-column .column-datasets,','.unpaired-columns .forward-column">forward column</i> ',"to select it then click a dataset in the ",'<i data-target=".unpaired-columns .reverse-column .column-datasets,','.unpaired-columns .reverse-column">reverse column</i>.',"</li>",'<li>Click one of the "Pair these datasets" buttons in the ','<i data-target=".unpaired-columns .paired-column .column-datasets,','.unpaired-columns .paired-column">middle column</i> ',"to pair the datasets in a particular row.","</li>",'<li>Click <i data-target=".autopair-link">"Auto-pair"</i> ',"to have your datasets automatically paired based on name.","</li>","</ul>"].join("")),"</p>","<p>",d(["<ul>You can filter what is shown in the unpaired sections by:","<li>Entering partial dataset names in either the ",'<i data-target=".forward-unpaired-filter input">forward filter</i> or ','<i data-target=".reverse-unpaired-filter input">reverse filter</i>.',"</li>","<li>Choosing from a list of preset filters by clicking the ",'<i data-target=".choose-filters-link">"Choose filters" link</i>.',"</li>","<li>Entering regular expressions to match dataset names. See: ",'<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expre…"',' target="_blank">MDN\'s JavaScript Regular Expression Tutorial</a>. ',"Note: forward slashes (\\) are not needed.","</li>","<li>Clearing the filters by clicking the ",'<i data-target=".clear-filters-link">"Clear filters" link</i>.',"</li>","</ul>"].join("")),"</p>","<p>",d(["To unpair individual dataset pairs, click the ",'<i data-target=".unpair-btn">unpair buttons ( <span class="fa fa-unlink"></span> )</i>. ','Click the <i data-target=".unpair-all-link">"Unpair all" link</i> to unpair all pairs.'].join("")),"</p>","<p>",d(['You can include or remove the file extensions (e.g. ".fastq") from your pair names by toggling the ','<i data-target=".remove-extensions-prompt">"Remove file extensions from pair names?"</i> control.'].join("")),"</p>","<p>",d(['Once your collection is complete, enter a <i data-target=".collection-name">name</i> and ','click <i data-target=".create-collection">"Create list"</i>. ',"(Note: you do not have to pair all unpaired datasets to finish.)"].join("")),"</p>"].join(""))};(function(){jQuery.fn.extend({hoverhighlight:function h(j,i){j=j||"body";if(!this.size()){return this}$(this).each(function(){var l=$(this),k=l.data("target");if(k){l.mouseover(function(m){$(k,j).css({background:i})}).mouseout(function(m){$(k).css({background:""})})}});return this}})}());var b=function c(j,h){h=_.defaults(h||{},{datasets:j,oncancel:function(){Galaxy.modal.hide()},oncreate:function(){Galaxy.modal.hide();Galaxy.currHistoryPanel.refreshContents()}});if(!window.Galaxy||!Galaxy.modal){throw new Error("Galaxy or Galaxy.modal not found")}var i=new e(h).render();Galaxy.modal.show({title:"Create a collection of paired datasets",body:i.$el,width:"80%",height:"800px",closing_events:true});window.PCC=i;return i};return{PairedCollectionCreator:e,pairedCollectionCreatorModal:b}});
\ No newline at end of file
+define(["utils/levenshtein","mvc/base-mvc","utils/localization"],function(g,a,d){var f=Backbone.View.extend(a.LoggableMixin).extend({tagName:"li",className:"dataset paired",initialize:function(h){this.pair=h.pair||{}},render:function(){this.$el.attr("draggable",true).data("pair",this.pair).html(_.template(['<span class="forward-dataset-name flex-column"><%= pair.forward.name %></span>','<span class="pair-name-column flex-column">','<span class="pair-name"><%= pair.name %></span>',"</span>",'<span class="reverse-dataset-name flex-column"><%= pair.reverse.name %></span>'].join(""),{pair:this.pair})).addClass("flex-column-container");return this},events:{dragstart:"_dragstart",dragend:"_dragend",dragover:"_sendToParent",drop:"_sendToParent"},_dragstart:function(h){h.currentTarget.style.opacity="0.4";if(h.originalEvent){h=h.originalEvent}h.dataTransfer.effectAllowed="move";h.dataTransfer.setData("text/plain",JSON.stringify(this.pair));this.$el.parent().trigger("pair.dragstart",[this])},_dragend:function(h){h.currentTarget.style.opacity="1.0";this.$el.parent().trigger("pair.dragend",[this])},_sendToParent:function(h){this.$el.parent().trigger(h)},toString:function(){return"PairView("+this.pair.name+")"}});var e=Backbone.View.extend(a.LoggableMixin).extend({className:"collection-creator flex-row-container",initialize:function(h){h=_.defaults(h,{datasets:[],filters:this.DEFAULT_FILTERS,automaticallyPair:true,matchPercentage:1,strategy:"lcs"});this.initialList=h.datasets;this.historyId=h.historyId;this.filters=this.commonFilters[h.filters]||this.commonFilters[this.DEFAULT_FILTERS];if(_.isArray(h.filters)){this.filters=h.filters}this.automaticallyPair=h.automaticallyPair;this.matchPercentage=h.matchPercentage;this.strategy=this.strategies[h.strategy]||this.strategies[this.DEFAULT_STRATEGY];if(_.isFunction(h.strategy)){this.strategy=h.strategy}this.removeExtensions=true;this.oncancel=h.oncancel;this.oncreate=h.oncreate;this.unpairedPanelHidden=false;this.pairedPanelHidden=false;this.$dragging=null;this._dataSetUp();this._setUpBehaviors()},commonFilters:{none:["",""],illumina:["_1","_2"]},DEFAULT_FILTERS:"illumina",strategies:{lcs:"autoPairLCSs",levenshtein:"autoPairLevenshtein"},DEFAULT_STRATEGY:"lcs",_dataSetUp:function(){this.paired=[];this.unpaired=[];this.selectedIds=[];this._sortInitialList();this._ensureIds();this.unpaired=this.initialList.slice(0);if(this.automaticallyPair){this.autoPair()}},_sortInitialList:function(){this._sortDatasetList(this.initialList)},_sortDatasetList:function(h){h.sort(function(j,i){return naturalSort(j.name,i.name)});return h},_ensureIds:function(){this.initialList.forEach(function(h){if(!h.hasOwnProperty("id")){h.id=_.uniqueId()}});return this.initialList},_splitByFilters:function(j){var i=[],h=[];this.unpaired.forEach(function(k){if(this._filterFwdFn(k)){i.push(k)}if(this._filterRevFn(k)){h.push(k)}}.bind(this));return[i,h]},_filterFwdFn:function(i){var h=new RegExp(this.filters[0]);return h.test(i.name)},_filterRevFn:function(i){var h=new RegExp(this.filters[1]);return h.test(i.name)},_addToUnpaired:function(i){var h=function(j,l){if(j===l){return j}var k=Math.floor((l-j)/2)+j,m=naturalSort(i.name,this.unpaired[k].name);if(m<0){return h(j,k)}else{if(m>0){return h(k+1,l)}}while(this.unpaired[k]&&this.unpaired[k].name===i.name){k++}return k}.bind(this);this.unpaired.splice(h(0,this.unpaired.length),0,i)},autoPair:function(h){h=h||this.strategy;this.simpleAutoPair();return this[h].call(this)},simpleAutoPair:function(){var n=0,l,r=this._splitByFilters(),h=r[0],q=r[1],p,s,k=false;while(n<h.length){var m=h[n];p=m.name.replace(this.filters[0],"");k=false;for(l=0;l<q.length;l++){var o=q[l];s=o.name.replace(this.filters[1],"");if(m!==o&&p===s){k=true;this._pair(h.splice(n,1)[0],q.splice(l,1)[0],{silent:true});break}}if(!k){n+=1}}},autoPairLevenshtein:function(){var o=0,m,t=this._splitByFilters(),h=t[0],r=t[1],q,v,k,s,l;while(o<h.length){var n=h[o];q=n.name.replace(this.filters[0],"");l=Number.MAX_VALUE;for(m=0;m<r.length;m++){var p=r[m];v=p.name.replace(this.filters[1],"");if(n!==p){if(q===v){s=m;l=0;break}k=levenshteinDistance(q,v);if(k<l){s=m;l=k}}}var u=1-(l/(Math.max(q.length,v.length)));if(u>=this.matchPercentage){this._pair(h.splice(o,1)[0],r.splice(s,1)[0],{silent:true});if(h.length<=0||r.length<=0){return}}else{o+=1}}},autoPairLCSs:function(){var m=0,k,t=this._splitByFilters(),h=t[0],r=t[1],q,w,v,s,o;if(!h.length||!r.length){return}while(m<h.length){var l=h[m];q=l.name.replace(this.filters[0],"");o=0;for(k=0;k<r.length;k++){var p=r[k];w=p.name.replace(this.filters[1],"");if(l!==p){if(q===w){s=k;o=q.length;break}var n=this._naiveStartingAndEndingLCS(q,w);v=n.length;if(v>o){s=k;o=v}}}var u=o/(Math.min(q.length,w.length));if(u>=this.matchPercentage){this._pair(h.splice(m,1)[0],r.splice(s,1)[0],{silent:true});if(h.length<=0||r.length<=0){return}}else{m+=1}}},_naiveStartingAndEndingLCS:function(m,k){var n="",o="",l=0,h=0;while(l<m.length&&l<k.length){if(m[l]!==k[l]){break}n+=m[l];l+=1}if(l===m.length){return m}if(l===k.length){return k}l=(m.length-1);h=(k.length-1);while(l>=0&&h>=0){if(m[l]!==k[h]){break}o=[m[l],o].join("");l-=1;h-=1}return n+o},_pair:function(j,h,i){i=i||{};var k=this._createPair(j,h,i.name);this.paired.push(k);this.unpaired=_.without(this.unpaired,j,h);if(!i.silent){this.trigger("pair:new",k)}return k},_createPair:function(j,h,i){if(!(j&&h)||(j===h)){throw new Error("Bad pairing: "+[JSON.stringify(j),JSON.stringify(h)])}i=i||this._guessNameForPair(j,h);return{forward:j,name:i,reverse:h}},_guessNameForPair:function(j,h,k){k=(k!==undefined)?(k):(this.removeExtensions);var i=this._naiveStartingAndEndingLCS(j.name.replace(this.filters[0],""),h.name.replace(this.filters[1],""));if(k){var l=i.lastIndexOf(".");if(l>0){i=i.slice(0,l)}}return i||(j.name+" & "+h.name)},_unpair:function(i,h){h=h||{};if(!i){throw new Error("Bad pair: "+JSON.stringify(i))}this.paired=_.without(this.paired,i);this._addToUnpaired(i.forward);this._addToUnpaired(i.reverse);if(!h.silent){this.trigger("pair:unpair",[i])}return i},unpairAll:function(){var h=[];while(this.paired.length){h.push(this._unpair(this.paired[0],{silent:true}))}this.trigger("pair:unpair",h)},_pairToJSON:function(h){return{collection_type:"paired",src:"new_collection",name:h.name,element_identifiers:[{name:"forward",id:h.forward.id,src:"hda"},{name:"reverse",id:h.reverse.id,src:"hda"}]}},createList:function(){var j=this,i;if(j.historyId){i="/api/histories/"+this.historyId+"/contents/dataset_collections"}var h={type:"dataset_collection",collection_type:"list:paired",name:_.escape(j.$(".collection-name").val()),element_identifiers:j.paired.map(function(k){return j._pairToJSON(k)})};return jQuery.ajax(i,{type:"POST",contentType:"application/json",dataType:"json",data:JSON.stringify(h)}).fail(function(m,k,l){j._ajaxErrHandler(m,k,l)}).done(function(k,l,m){j.trigger("collection:created",k,l,m);if(typeof j.oncreate==="function"){j.oncreate.call(this,k,l,m)}})},_ajaxErrHandler:function(k,h,j){this.error(k,h,j);var i=d("An error occurred while creating this collection");if(k){if(k.readyState===0&&k.status===0){i+=": "+d("Galaxy could not be reached and may be updating.")+d(" Try again in a few minutes.")}else{if(k.responseJSON){i+="<br /><pre>"+JSON.stringify(k.responseJSON)+"</pre>"}else{i+=": "+j}}}creator._showAlert(i,"alert-danger")},render:function(h,i){this.$el.empty().html(e.templates.main());this._renderHeader(h);this._renderMiddle(h);this._renderFooter(h);this._addPluginComponents();return this},_renderHeader:function(i,j){var h=this.$(".header").empty().html(e.templates.header()).find(".help-content").prepend($(e.templates.helpContent()));this._renderFilters();return h},_renderFilters:function(){return this.$(".forward-column .column-header input").val(this.filters[0]).add(this.$(".reverse-column .column-header input").val(this.filters[1]))},_renderMiddle:function(i,j){var h=this.$(".middle").empty().html(e.templates.middle());if(this.unpairedPanelHidden){this.$(".unpaired-columns").hide()}else{if(this.pairedPanelHidden){this.$(".paired-columns").hide()}}this._renderUnpaired();this._renderPaired();return h},_renderUnpaired:function(m,n){var k=this,l,i,h=[],j=this._splitByFilters();this.$(".forward-column .title").text([j[0].length,d("unpaired forward")].join(" "));this.$(".forward-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-j[0].length));this.$(".reverse-column .title").text([j[1].length,d("unpaired reverse")].join(" "));this.$(".reverse-column .unpaired-info").text(this._renderUnpairedDisplayStr(this.unpaired.length-j[1].length));this.$(".unpaired-columns .column-datasets").empty();this.$(".autopair-link").toggle(this.unpaired.length!==0);if(this.unpaired.length===0){this._renderUnpairedEmpty();return}i=j[1].map(function(p,o){if((j[0][o]!==undefined)&&(j[0][o]!==p)){h.push(k._renderPairButton())}return k._renderUnpairedDataset(p)});l=j[0].map(function(o){return k._renderUnpairedDataset(o)});if(!l.length&&!i.length){this._renderUnpairedNotShown();return}this.$(".unpaired-columns .forward-column .column-datasets").append(l).add(this.$(".unpaired-columns .paired-column .column-datasets").append(h)).add(this.$(".unpaired-columns .reverse-column .column-datasets").append(i));this._adjUnpairedOnScrollbar()},_renderUnpairedDisplayStr:function(h){return["(",h," ",d("filtered out"),")"].join("")},_renderUnpairedDataset:function(h){return $("<li/>").attr("id","dataset-"+h.id).addClass("dataset unpaired").attr("draggable",true).addClass(h.selected?"selected":"").append($("<span/>").addClass("dataset-name").text(h.name)).data("dataset",h)},_renderPairButton:function(){return $("<li/>").addClass("dataset unpaired").append($("<span/>").addClass("dataset-name").text(d("Pair these datasets")))},_renderUnpairedEmpty:function(){var h=$('<div class="empty-message"></div>').text("("+d("no remaining unpaired datasets")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(h);return h},_renderUnpairedNotShown:function(){var h=$('<div class="empty-message"></div>').text("("+d("no datasets were found matching the current filters")+")");this.$(".unpaired-columns .paired-column .column-datasets").empty().prepend(h);return h},_adjUnpairedOnScrollbar:function(){var k=this.$(".unpaired-columns").last(),l=this.$(".unpaired-columns .reverse-column .dataset").first();if(!l.size()){return}var h=k.offset().left+k.outerWidth(),j=l.offset().left+l.outerWidth(),i=Math.floor(h)-Math.floor(j);this.$(".unpaired-columns .forward-column").css("margin-left",(i>0)?i:0)},_renderPaired:function(i,j){this.$(".paired-column-title .title").text([this.paired.length,d("paired")].join(" "));this.$(".unpair-all-link").toggle(this.paired.length!==0);if(this.paired.length===0){this._renderPairedEmpty();return}else{this.$(".remove-extensions-link").show()}this.$(".paired-columns .column-datasets").empty();var h=this;this.paired.forEach(function(m,k){var l=new f({pair:m});h.$(".paired-columns .column-datasets").append(l.render().$el).append(['<button class="unpair-btn">','<span class="fa fa-unlink" title="',d("Unpair"),'"></span>',"</button>"].join(""))})},_renderPairedEmpty:function(){var h=$('<div class="empty-message"></div>').text("("+d("no paired datasets yet")+")");this.$(".paired-columns .column-datasets").empty().prepend(h);return h},_renderFooter:function(i,j){var h=this.$(".footer").empty().html(e.templates.footer());this.$(".remove-extensions").prop("checked",this.removeExtensions);if(typeof this.oncancel==="function"){this.$(".cancel-create.btn").show()}return h},_addPluginComponents:function(){this._chooseFiltersPopover(".choose-filters-link");this.$(".help-content i").hoverhighlight(".collection-creator","rgba( 64, 255, 255, 1.0 )")},_chooseFiltersPopover:function(h){function i(l,k){return['<button class="filter-choice btn" ','data-forward="',l,'" data-reverse="',k,'">',d("Forward"),": ",l,", ",d("Reverse"),": ",k,"</button>"].join("")}var j=$(_.template(['<div class="choose-filters">','<div class="help">',d("Choose from the following filters to change which unpaired reads are shown in the display"),":</div>",i("_1","_2"),i("_R1","_R2"),"</div>"].join(""),{}));return this.$(h).popover({container:".collection-creator",placement:"bottom",html:true,content:j})},_validationWarning:function(i,h){var j="validation-warning";if(i==="name"){i=this.$(".collection-name").add(this.$(".collection-name-prompt"));this.$(".collection-name").focus().select()}if(h){i=i||this.$("."+j);i.removeClass(j)}else{i.addClass(j)}},_setUpBehaviors:function(){this.on("pair:new",function(){this._renderUnpaired();this._renderPaired();this.$(".paired-columns").scrollTop(8000000)});this.on("pair:unpair",function(h){this._renderUnpaired();this._renderPaired();this.splitView()});this.on("filter-change",function(){this.filters=[this.$(".forward-unpaired-filter input").val(),this.$(".reverse-unpaired-filter input").val()];this._renderFilters();this._renderUnpaired()});this.on("autopair",function(){this._renderUnpaired();this._renderPaired();var h,i=null;if(this.paired.length){i="alert-success";h=this.paired.length+" "+d("pairs created");if(!this.unpaired.length){h+=": "+d("all datasets have been successfully paired");this.hideUnpaired()}}else{h=d("Could not automatically create any pairs from the given dataset names")}this._showAlert(h,i)});return this},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .header .alert button":"_hideAlert","click .forward-column .column-title":"_clickShowOnlyUnpaired","click .reverse-column .column-title":"_clickShowOnlyUnpaired","click .unpair-all-link":"_clickUnpairAll","change .forward-unpaired-filter input":function(h){this.trigger("filter-change")},"focus .forward-unpaired-filter input":function(h){$(h.currentTarget).select()},"click .autopair-link":"_clickAutopair","click .choose-filters .filter-choice":"_clickFilterChoice","click .clear-filters-link":"_clearFilters","change .reverse-unpaired-filter input":function(h){this.trigger("filter-change")},"focus .reverse-unpaired-filter input":function(h){$(h.currentTarget).select()},"click .forward-column .dataset.unpaired":"_clickUnpairedDataset","click .reverse-column .dataset.unpaired":"_clickUnpairedDataset","click .paired-column .dataset.unpaired":"_clickPairRow","click .unpaired-columns":"clearSelectedUnpaired","mousedown .unpaired-columns .dataset":"_mousedownUnpaired","click .paired-column-title":"_clickShowOnlyPaired","mousedown .flexible-partition-drag":"_startPartitionDrag","click .paired-columns .dataset.paired":"selectPair","click .paired-columns":"clearSelectedPaired","click .paired-columns .pair-name":"_clickPairName","click .unpair-btn":"_clickUnpair","dragover .paired-columns .column-datasets":"_dragoverPairedColumns","drop .paired-columns .column-datasets":"_dropPairedColumns","pair.dragstart .paired-columns .column-datasets":"_pairDragstart","pair.dragend .paired-columns .column-datasets":"_pairDragend","change .remove-extensions":function(h){this.toggleExtensions()},"change .collection-name":"_changeName","click .cancel-create":function(h){if(typeof this.oncancel==="function"){this.oncancel.call(this)}},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(h){this.$(".main-help").addClass("expanded");this.$(".more-help").hide()},_clickLessHelp:function(h){this.$(".main-help").removeClass("expanded");this.$(".more-help").show()},_showAlert:function(i,h){h=h||"alert-danger";this.$(".main-help").hide();this.$(".header .alert").attr("class","alert alert-dismissable").addClass(h).show().find(".alert-message").html(i)},_hideAlert:function(h){this.$(".main-help").show();this.$(".header .alert").hide()},_clickShowOnlyUnpaired:function(h){if(this.$(".paired-columns").is(":visible")){this.hidePaired()}else{this.splitView()}},_clickShowOnlyPaired:function(h){if(this.$(".unpaired-columns").is(":visible")){this.hideUnpaired()}else{this.splitView()}},hideUnpaired:function(h,i){this.unpairedPanelHidden=true;this.pairedPanelHidden=false;this._renderMiddle(h,i)},hidePaired:function(h,i){this.unpairedPanelHidden=false;this.pairedPanelHidden=true;this._renderMiddle(h,i)},splitView:function(h,i){this.unpairedPanelHidden=this.pairedPanelHidden=false;this._renderMiddle(h,i);return this},_clickUnpairAll:function(h){this.unpairAll()},_clickAutopair:function(i){var h=this.autoPair();this.trigger("autopair",h)},_clickFilterChoice:function(i){var h=$(i.currentTarget);this.$(".forward-unpaired-filter input").val(h.data("forward"));this.$(".reverse-unpaired-filter input").val(h.data("reverse"));this._hideChooseFilters();this.trigger("filter-change")},_hideChooseFilters:function(){this.$(".choose-filters-link").popover("hide");this.$(".popover").css("display","none")},_clearFilters:function(h){this.$(".forward-unpaired-filter input").val("");this.$(".reverse-unpaired-filter input").val("");this.trigger("filter-change")},_clickUnpairedDataset:function(h){h.stopPropagation();return this.toggleSelectUnpaired($(h.currentTarget))},toggleSelectUnpaired:function(j,i){i=i||{};var k=j.data("dataset"),h=i.force!==undefined?i.force:!j.hasClass("selected");if(!j.size()||k===undefined){return j}if(h){j.addClass("selected");if(!i.waitToPair){this.pairAllSelected()}}else{j.removeClass("selected")}return j},pairAllSelected:function(i){i=i||{};var j=this,k=[],h=[],l=[];j.$(".unpaired-columns .forward-column .dataset.selected").each(function(){k.push($(this).data("dataset"))});j.$(".unpaired-columns .reverse-column .dataset.selected").each(function(){h.push($(this).data("dataset"))});k.length=h.length=Math.min(k.length,h.length);k.forEach(function(n,m){try{l.push(j._pair(n,h[m],{silent:true}))}catch(o){j.error(o)}});if(l.length&&!i.silent){this.trigger("pair:new",l)}return l},clearSelectedUnpaired:function(){this.$(".unpaired-columns .dataset.selected").removeClass("selected")},_mousedownUnpaired:function(j){if(j.shiftKey){var i=this,h=$(j.target).addClass("selected"),k=function(l){i.$(l.target).filter(".dataset").addClass("selected")};h.parent().on("mousemove",k);$(document).one("mouseup",function(l){h.parent().off("mousemove",k);i.pairAllSelected()})}},_clickPairRow:function(j){var k=$(j.currentTarget).index(),i=$(".unpaired-columns .forward-column .dataset").eq(k).data("dataset"),h=$(".unpaired-columns .reverse-column .dataset").eq(k).data("dataset");this._pair(i,h)},_startPartitionDrag:function(i){var h=this,l=i.pageY;$("body").css("cursor","ns-resize");h.$(".flexible-partition-drag").css("color","black");function k(m){h.$(".flexible-partition-drag").css("color","");$("body").css("cursor","").unbind("mousemove",j)}function j(m){var n=m.pageY-l;if(!h.adjPartition(n)){$("body").trigger("mouseup")}h._adjUnpairedOnScrollbar();l+=n}$("body").mousemove(j);$("body").one("mouseup",k)},adjPartition:function(i){var h=this.$(".unpaired-columns"),j=this.$(".paired-columns"),k=parseInt(h.css("height"),10),l=parseInt(j.css("height"),10);k=Math.max(10,k+i);l=l-i;var m=i<0;if(m){if(this.unpairedPanelHidden){return false}else{if(k<=10){this.hideUnpaired();return false}}}else{if(this.unpairedPanelHidden){h.show();this.unpairedPanelHidden=false}}if(!m){if(this.pairedPanelHidden){return false}else{if(l<=15){this.hidePaired();return false}}}else{if(this.pairedPanelHidden){j.show();this.pairedPanelHidden=false}}h.css({height:k+"px",flex:"0 0 auto"});return true},selectPair:function(h){h.stopPropagation();$(h.currentTarget).toggleClass("selected")},clearSelectedPaired:function(h){this.$(".paired-columns .dataset.selected").removeClass("selected")},_clickPairName:function(j){j.stopPropagation();var i=$(j.currentTarget),k=this.paired[i.parent().parent().index()/2],h=prompt("Enter a new name for the pair:",k.name);if(h){k.name=h;k.customizedName=true;i.text(k.name)}},_clickUnpair:function(i){var h=Math.floor($(i.currentTarget).index()/2);this._unpair(this.paired[h])},_dragoverPairedColumns:function(k){k.preventDefault();var i=this.$(".paired-columns .column-datasets"),l=i.offset();var j=this._getNearestPairedDatasetLi(k.originalEvent.clientY);$(".paired-drop-placeholder").remove();var h=$('<div class="paired-drop-placeholder"></div>');if(!j.size()){i.append(h)}else{j.before(h)}},_getNearestPairedDatasetLi:function(o){var l=4,j=this.$(".paired-columns .column-datasets li").toArray();for(var k=0;k<j.length;k++){var n=$(j[k]),m=n.offset().top,h=Math.floor(n.outerHeight()/2)+l;if(m+h>o&&m-h<o){return n}}return $()},_dropPairedColumns:function(i){i.preventDefault();i.dataTransfer.dropEffect="move";var h=this._getNearestPairedDatasetLi(i.originalEvent.clientY);if(h.size()){this.$dragging.insertBefore(h)}else{this.$dragging.insertAfter(this.$(".paired-columns .unpair-btn").last())}this._syncPairsToDom();return false},_syncPairsToDom:function(){var h=[];this.$(".paired-columns .dataset.paired").each(function(){h.push($(this).data("pair"))});this.paired=h;this._renderPaired()},_pairDragstart:function(i,j){j.$el.addClass("selected");var h=this.$(".paired-columns .dataset.selected");this.$dragging=h},_pairDragend:function(h,i){$(".paired-drop-placeholder").remove();this.$dragging=null},toggleExtensions:function(i){var h=this;h.removeExtensions=(i!==undefined)?(i):(!h.removeExtensions);_.each(h.paired,function(j){if(j.customizedName){return}j.name=h._guessNameForPair(j.forward,j.reverse)});h._renderPaired();h._renderFooter()},_changeName:function(h){this._validationWarning("name",!!this._getName())},_getName:function(){return _.escape(this.$(".collection-name").val())},_clickCreate:function(i){var h=this._getName();if(!h){this._validationWarning("name")}else{this.createList()}},_printList:function(i){var h=this;_.each(i,function(j){if(i===h.paired){h._printPair(j)}else{}})},_printPair:function(h){this.debug(h.forward.name,h.reverse.name,": ->",h.name)},toString:function(){return"PairedCollectionCreator"}});e.templates=e.templates||{main:_.template(['<div class="header flex-row no-flex"></div>','<div class="middle flex-row flex-row-container"></div>','<div class="footer flex-row no-flex">'].join("")),header:_.template(['<div class="main-help well clear">','<a class="more-help" href="javascript:void(0);">',d("More help"),"</a>",'<div class="help-content">','<a class="less-help" href="javascript:void(0);">',d("Less"),"</a>","</div>","</div>",'<div class="alert alert-dismissable">','<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>','<span class="alert-message"></span>',"</div>",'<div class="column-headers vertically-spaced flex-column-container">','<div class="forward-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired forward"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter forward-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>",'<div class="paired-column flex-column no-flex column">','<div class="column-header">','<a class="choose-filters-link" href="javascript:void(0)">',d("Choose filters"),"</a>",'<a class="clear-filters-link" href="javascript:void(0);">',d("Clear filters"),"</a><br />",'<a class="autopair-link" href="javascript:void(0);">',d("Auto-pair"),"</a>","</div>","</div>",'<div class="reverse-column flex-column column">','<div class="column-header">','<div class="column-title">','<span class="title">',d("Unpaired reverse"),"</span>",'<span class="title-info unpaired-info"></span>',"</div>",'<div class="unpaired-filter reverse-unpaired-filter pull-left">','<input class="search-query" placeholder="',d("Filter this list"),'" />',"</div>","</div>","</div>","</div>"].join("")),middle:_.template(['<div class="unpaired-columns flex-column-container scroll-container flex-row">','<div class="forward-column flex-column column">','<ol class="column-datasets"></ol>',"</div>",'<div class="paired-column flex-column no-flex column">','<ol class="column-datasets"></ol>',"</div>",'<div class="reverse-column flex-column column">','<ol class="column-datasets"></ol>',"</div>","</div>",'<div class="flexible-partition">','<div class="flexible-partition-drag" title="',d("Drag to change"),'"></div>','<div class="column-header">','<div class="column-title paired-column-title">','<span class="title"></span>',"</div>",'<a class="unpair-all-link" href="javascript:void(0);">',d("Unpair all"),"</a>","</div>","</div>",'<div class="paired-columns flex-column-container scroll-container flex-row">','<ol class="column-datasets"></ol>',"</div>"].join("")),footer:_.template(['<div class="attributes clear">','<div class="clear">','<label class="remove-extensions-prompt pull-right">',d("Remove file extensions from pair names"),"?",'<input class="remove-extensions pull-right" type="checkbox" />',"</label>","</div>",'<div class="clear">','<input class="collection-name form-control pull-right" ','placeholder="',d("Enter a name for your new list"),'" />','<div class="collection-name-prompt pull-right">',d("Name"),":</div>","</div>","</div>",'<div class="actions clear vertically-spaced">','<div class="other-options pull-left">','<button class="cancel-create btn" tabindex="-1">',d("Cancel"),"</button>",'<div class="create-other btn-group dropup">','<button class="btn btn-default dropdown-toggle" data-toggle="dropdown">',d("Create a different kind of collection"),' <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">','<li><a href="#">',d("Create a <i>single</i> pair"),"</a></li>",'<li><a href="#">',d("Create a list of <i>unpaired</i> datasets"),"</a></li>","</ul>","</div>","</div>",'<div class="main-options pull-right">','<button class="create-collection btn btn-primary">',d("Create list"),"</button>","</div>","</div>"].join("")),helpContent:_.template(["<p>",d(["Collections of paired datasets are ordered lists of dataset pairs (often forward and reverse reads). ","These collections can be passed to tools and workflows in order to have analyses done on each member of ","the entire group. This interface allows you to create a collection, choose which datasets are paired, ","and re-order the final collection."].join("")),"</p>","<p>",d(['Unpaired datasets are shown in the <i data-target=".unpaired-columns">unpaired section</i> ',"(hover over the underlined words to highlight below). ",'Paired datasets are shown in the <i data-target=".paired-columns">paired section</i>.',"<ul>To pair datasets, you can:","<li>Click a dataset in the ",'<i data-target=".unpaired-columns .forward-column .column-datasets,','.unpaired-columns .forward-column">forward column</i> ',"to select it then click a dataset in the ",'<i data-target=".unpaired-columns .reverse-column .column-datasets,','.unpaired-columns .reverse-column">reverse column</i>.',"</li>",'<li>Click one of the "Pair these datasets" buttons in the ','<i data-target=".unpaired-columns .paired-column .column-datasets,','.unpaired-columns .paired-column">middle column</i> ',"to pair the datasets in a particular row.","</li>",'<li>Click <i data-target=".autopair-link">"Auto-pair"</i> ',"to have your datasets automatically paired based on name.","</li>","</ul>"].join("")),"</p>","<p>",d(["<ul>You can filter what is shown in the unpaired sections by:","<li>Entering partial dataset names in either the ",'<i data-target=".forward-unpaired-filter input">forward filter</i> or ','<i data-target=".reverse-unpaired-filter input">reverse filter</i>.',"</li>","<li>Choosing from a list of preset filters by clicking the ",'<i data-target=".choose-filters-link">"Choose filters" link</i>.',"</li>","<li>Entering regular expressions to match dataset names. See: ",'<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expre…"',' target="_blank">MDN\'s JavaScript Regular Expression Tutorial</a>. ',"Note: forward slashes (\\) are not needed.","</li>","<li>Clearing the filters by clicking the ",'<i data-target=".clear-filters-link">"Clear filters" link</i>.',"</li>","</ul>"].join("")),"</p>","<p>",d(["To unpair individual dataset pairs, click the ",'<i data-target=".unpair-btn">unpair buttons ( <span class="fa fa-unlink"></span> )</i>. ','Click the <i data-target=".unpair-all-link">"Unpair all" link</i> to unpair all pairs.'].join("")),"</p>","<p>",d(['You can include or remove the file extensions (e.g. ".fastq") from your pair names by toggling the ','<i data-target=".remove-extensions-prompt">"Remove file extensions from pair names?"</i> control.'].join("")),"</p>","<p>",d(['Once your collection is complete, enter a <i data-target=".collection-name">name</i> and ','click <i data-target=".create-collection">"Create list"</i>. ',"(Note: you do not have to pair all unpaired datasets to finish.)"].join("")),"</p>"].join(""))};(function(){jQuery.fn.extend({hoverhighlight:function h(j,i){j=j||"body";if(!this.size()){return this}$(this).each(function(){var l=$(this),k=l.data("target");if(k){l.mouseover(function(m){$(k,j).css({background:i})}).mouseout(function(m){$(k).css({background:""})})}});return this}})}());var b=function c(j,h){h=_.defaults(h||{},{datasets:j,oncancel:function(){Galaxy.modal.hide()},oncreate:function(){Galaxy.modal.hide();Galaxy.currHistoryPanel.refreshContents()}});if(!window.Galaxy||!Galaxy.modal){throw new Error("Galaxy or Galaxy.modal not found")}var i=new e(h).render();Galaxy.modal.show({title:"Create a collection of paired datasets",body:i.$el,width:"80%",height:"800px",closing_events:true});window.PCC=i;return i};return{PairedCollectionCreator:e,pairedCollectionCreatorModal:b}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/72719f9c3af0/
Changeset: 72719f9c3af0
Branch: obo-owl-datatype
User: dannon
Date: 2014-11-10 16:16:03+00:00
Summary: Branch prune.
Affected #: 0 files
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: dannon: Merged in BjoernGruening/galaxy-central-1/obo-owl-datatype (pull request #542)
by commits-noreply@bitbucket.org 10 Nov '14
by commits-noreply@bitbucket.org 10 Nov '14
10 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/25f0318f232f/
Changeset: 25f0318f232f
User: dannon
Date: 2014-11-10 16:14:49+00:00
Summary: Merged in BjoernGruening/galaxy-central-1/obo-owl-datatype (pull request #542)
Add OWL & OBO datatype.
Affected #: 3 files
diff -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 -r 25f0318f232ff783972c1e3e26fa853c0b9f085b config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -160,6 +160,8 @@
<converter file="interval_to_bgzip_converter.xml" target_datatype="bgzip"/><converter file="interval_to_tabix_converter.xml" target_datatype="tabix" depends_on="bgzip"/></datatype>
+ <datatype extension="obo" type="galaxy.datatypes.text:Obo" mimetype="text/html" display_in_upload="True" />
+ <datatype extension="owl" type="galaxy.datatypes.xml:Owl" mimetype="text/html" display_in_upload="True" /><datatype extension="png" type="galaxy.datatypes.images:Png" mimetype="image/png"/><datatype extension="qual" type="galaxy.datatypes.qualityscore:QualityScore" /><datatype extension="qualsolexa" type="galaxy.datatypes.qualityscore:QualityScoreSolexa" display_in_upload="true"/>
@@ -272,6 +274,7 @@
<sniffer type="galaxy.datatypes.binary:Bam"/><sniffer type="galaxy.datatypes.binary:Sff"/><sniffer type="galaxy.datatypes.xml:Phyloxml"/>
+ <sniffer type="galaxy.datatypes.xml:Owl"/><sniffer type="galaxy.datatypes.xml:GenericXml"/><sniffer type="galaxy.datatypes.sequence:Maf"/><sniffer type="galaxy.datatypes.sequence:Lav"/>
@@ -294,6 +297,7 @@
<sniffer type="galaxy.datatypes.tabular:Sam"/><sniffer type="galaxy.datatypes.data:Newick"/><sniffer type="galaxy.datatypes.data:Nexus"/>
+ <sniffer type="galaxy.datatypes.text:Obo"/><sniffer type="galaxy.datatypes.text:Ipynb"/><sniffer type="galaxy.datatypes.text:Json"/><sniffer type="galaxy.datatypes.images:Jpg"/>
diff -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 -r 25f0318f232ff783972c1e3e26fa853c0b9f085b lib/galaxy/datatypes/text.py
--- a/lib/galaxy/datatypes/text.py
+++ b/lib/galaxy/datatypes/text.py
@@ -12,6 +12,7 @@
import subprocess
import json
import os
+import re
import logging
log = logging.getLogger(__name__)
@@ -119,3 +120,37 @@
Set the number of models in dataset.
"""
pass
+
+
+class Obo( Text ):
+ """
+ OBO file format description
+ http://www.geneontology.org/GO.format.obo-1_2.shtml
+ """
+ file_ext = "obo"
+
+ def set_peek( self, dataset, is_multi_byte=False ):
+ if not dataset.dataset.purged:
+ dataset.peek = get_file_peek( dataset.file_name, is_multi_byte=is_multi_byte )
+ dataset.blurb = "Open Biomedical Ontology (OBO)"
+ else:
+ dataset.peek = 'file does not exist'
+ dataset.blurb = 'file purged from disc'
+
+ def sniff( self, filename ):
+ """
+ Try to load the string with the json module. If successful it's a json file.
+ """
+ stanza = re.compile(r'^\[.*\]$')
+ with open( filename ) as handle:
+ first_line = handle.readline()
+ if not first_line.startswith('format-version:'):
+ return False
+
+ for line in handle:
+ if stanza.match(line.strip()):
+ # a stanza needs to begin with an ID tag
+ if handle.next().startswith('id:'):
+ return True
+ return False
+
diff -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 -r 25f0318f232ff783972c1e3e26fa853c0b9f085b lib/galaxy/datatypes/xml.py
--- a/lib/galaxy/datatypes/xml.py
+++ b/lib/galaxy/datatypes/xml.py
@@ -1,6 +1,7 @@
"""
XML format classes
"""
+import re
import data
import logging
from galaxy.datatypes.sniff import *
@@ -116,3 +117,32 @@
"""
return [ 'phyloviz' ]
+
+
+class Owl( GenericXml ):
+ """
+ Web Ontology Language OWL format description
+ http://www.w3.org/TR/owl-ref/
+ """
+ file_ext = "owl"
+
+ def set_peek( self, dataset, is_multi_byte=False ):
+ if not dataset.dataset.purged:
+ dataset.peek = data.get_file_peek( dataset.file_name, is_multi_byte=is_multi_byte )
+ dataset.blurb = "Web Ontology Language OWL"
+ else:
+ dataset.peek = 'file does not exist'
+ dataset.blurb = 'file purged from disc'
+
+ def sniff( self, filename ):
+ """
+ Try to load the string with the json module. If successful it's a json file.
+ """
+ owl_marker = re.compile(r'\<owl:')
+ with open( filename ) as handle:
+ # Check first 200 lines for the string "<owl:"
+ first_lines = handle.readlines(200)
+ for line in first_lines:
+ if owl_marker.search( line ):
+ return True
+ return False
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
4 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/0be206ac31c2/
Changeset: 0be206ac31c2
Branch: obo-owl-datatype
User: BjoernGruening
Date: 2014-10-27 15:13:14+00:00
Summary: Add OWL & OBO datatype.
Affected #: 3 files
diff -r 32929a1f9bf4b2150f99655c266223cd05d9a2bd -r 0be206ac31c2005f009e37af9d665cc9b4b955db config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -160,6 +160,8 @@
<converter file="interval_to_bgzip_converter.xml" target_datatype="bgzip"/><converter file="interval_to_tabix_converter.xml" target_datatype="tabix" depends_on="bgzip"/></datatype>
+ <datatype extension="obo" type="galaxy.datatypes.text:Obo" mimetype="text/html" display_in_upload="True" />
+ <datatype extension="owl" type="galaxy.datatypes.xml:Owl" mimetype="text/html" display_in_upload="True" /><datatype extension="png" type="galaxy.datatypes.images:Png" mimetype="image/png"/><datatype extension="qual" type="galaxy.datatypes.qualityscore:QualityScore" /><datatype extension="qualsolexa" type="galaxy.datatypes.qualityscore:QualityScoreSolexa" display_in_upload="true"/>
@@ -272,6 +274,7 @@
<sniffer type="galaxy.datatypes.binary:Bam"/><sniffer type="galaxy.datatypes.binary:Sff"/><sniffer type="galaxy.datatypes.xml:Phyloxml"/>
+ <sniffer type="galaxy.datatypes.xml:Owl"/><sniffer type="galaxy.datatypes.xml:GenericXml"/><sniffer type="galaxy.datatypes.sequence:Maf"/><sniffer type="galaxy.datatypes.sequence:Lav"/>
@@ -294,6 +297,7 @@
<sniffer type="galaxy.datatypes.tabular:Sam"/><sniffer type="galaxy.datatypes.data:Newick"/><sniffer type="galaxy.datatypes.data:Nexus"/>
+ <sniffer type="galaxy.datatypes.text:Obo"/><sniffer type="galaxy.datatypes.text:Ipynb"/><sniffer type="galaxy.datatypes.text:Json"/><sniffer type="galaxy.datatypes.images:Jpg"/>
diff -r 32929a1f9bf4b2150f99655c266223cd05d9a2bd -r 0be206ac31c2005f009e37af9d665cc9b4b955db lib/galaxy/datatypes/text.py
--- a/lib/galaxy/datatypes/text.py
+++ b/lib/galaxy/datatypes/text.py
@@ -12,6 +12,7 @@
import subprocess
import json
import os
+import re
import logging
log = logging.getLogger(__name__)
@@ -119,3 +120,45 @@
Set the number of models in dataset.
"""
pass
+
+
+class Obo( Text ):
+ """
+ OBO file format description
+ http://www.geneontology.org/GO.format.obo-1_2.shtml
+ """
+ file_ext = "obo"
+
+ def set_peek( self, dataset, is_multi_byte=False ):
+ if not dataset.dataset.purged:
+ dataset.peek = get_file_peek( dataset.file_name, is_multi_byte=is_multi_byte )
+ dataset.blurb = "Open Biomedical Ontology (OBO)"
+ else:
+ dataset.peek = 'file does not exist'
+ dataset.blurb = 'file purged from disc'
+
+ def sniff( self, filename ):
+ """
+ Try to load the string with the json module. If successful it's a json file.
+ """
+ stanza = re.compile(r'^\[.*\]$')
+ with open( filename ) as handle:
+ first_line = handle.readline()
+ if not first_line.startswith('format-version:'):
+ return False
+
+ for line in handle:
+ if stanza.match(line.strip()):
+ # a stanza needs to begin with an ID tag
+ if handle.next().startswith('id:'):
+ return True
+ return False
+
+
+
+ def set_meta( self, dataset, **kwd ):
+ """
+ Set metadata for OBO files.
+ """
+ pass
+
diff -r 32929a1f9bf4b2150f99655c266223cd05d9a2bd -r 0be206ac31c2005f009e37af9d665cc9b4b955db lib/galaxy/datatypes/xml.py
--- a/lib/galaxy/datatypes/xml.py
+++ b/lib/galaxy/datatypes/xml.py
@@ -1,6 +1,7 @@
"""
XML format classes
"""
+import re
import data
import logging
from galaxy.datatypes.sniff import *
@@ -116,3 +117,39 @@
"""
return [ 'phyloviz' ]
+
+
+class Owl( GenericXml ):
+ """
+ Web Ontology Language OWL format description
+ http://www.w3.org/TR/owl-ref/
+ """
+ file_ext = "owl"
+
+ def set_peek( self, dataset, is_multi_byte=False ):
+ if not dataset.dataset.purged:
+ dataset.peek = data.get_file_peek( dataset.file_name, is_multi_byte=is_multi_byte )
+ dataset.blurb = "Web Ontology Language OWL"
+ else:
+ dataset.peek = 'file does not exist'
+ dataset.blurb = 'file purged from disc'
+
+ def sniff( self, filename ):
+ """
+ Try to load the string with the json module. If successful it's a json file.
+ """
+ owl_marker = re.compile(r'\<owl:')
+ with open( filename ) as handle:
+ # Check first 200 lines for the string "<owl:"
+ first_lines = handle.readlines(200)
+ for line in first_lines:
+ if owl_marker.search( line ):
+ return True
+ return False
+
+ def set_meta( self, dataset, **kwd ):
+ """
+ Set metadata for OBO files.
+ """
+ pass
+
https://bitbucket.org/galaxy/galaxy-central/commits/58b8aa9edad1/
Changeset: 58b8aa9edad1
Branch: obo-owl-datatype
User: BjoernGruening
Date: 2014-11-04 10:01:52+00:00
Summary: Remove set_meta() function. It's not used.
Affected #: 1 file
diff -r 0be206ac31c2005f009e37af9d665cc9b4b955db -r 58b8aa9edad12df296cde8a18b8d33c904e2e059 lib/galaxy/datatypes/text.py
--- a/lib/galaxy/datatypes/text.py
+++ b/lib/galaxy/datatypes/text.py
@@ -154,11 +154,3 @@
return True
return False
-
-
- def set_meta( self, dataset, **kwd ):
- """
- Set metadata for OBO files.
- """
- pass
-
https://bitbucket.org/galaxy/galaxy-central/commits/b581932bb2ea/
Changeset: b581932bb2ea
Branch: obo-owl-datatype
User: BjoernGruening
Date: 2014-11-04 11:01:42+00:00
Summary: Remove set_meta() function. It's not used.
Affected #: 1 file
diff -r 58b8aa9edad12df296cde8a18b8d33c904e2e059 -r b581932bb2ea861c50efce69fde9e508d937d739 lib/galaxy/datatypes/xml.py
--- a/lib/galaxy/datatypes/xml.py
+++ b/lib/galaxy/datatypes/xml.py
@@ -146,10 +146,3 @@
if owl_marker.search( line ):
return True
return False
-
- def set_meta( self, dataset, **kwd ):
- """
- Set metadata for OBO files.
- """
- pass
-
https://bitbucket.org/galaxy/galaxy-central/commits/25f0318f232f/
Changeset: 25f0318f232f
User: dannon
Date: 2014-11-10 16:14:49+00:00
Summary: Merged in BjoernGruening/galaxy-central-1/obo-owl-datatype (pull request #542)
Add OWL & OBO datatype.
Affected #: 3 files
diff -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 -r 25f0318f232ff783972c1e3e26fa853c0b9f085b config/datatypes_conf.xml.sample
--- a/config/datatypes_conf.xml.sample
+++ b/config/datatypes_conf.xml.sample
@@ -160,6 +160,8 @@
<converter file="interval_to_bgzip_converter.xml" target_datatype="bgzip"/><converter file="interval_to_tabix_converter.xml" target_datatype="tabix" depends_on="bgzip"/></datatype>
+ <datatype extension="obo" type="galaxy.datatypes.text:Obo" mimetype="text/html" display_in_upload="True" />
+ <datatype extension="owl" type="galaxy.datatypes.xml:Owl" mimetype="text/html" display_in_upload="True" /><datatype extension="png" type="galaxy.datatypes.images:Png" mimetype="image/png"/><datatype extension="qual" type="galaxy.datatypes.qualityscore:QualityScore" /><datatype extension="qualsolexa" type="galaxy.datatypes.qualityscore:QualityScoreSolexa" display_in_upload="true"/>
@@ -272,6 +274,7 @@
<sniffer type="galaxy.datatypes.binary:Bam"/><sniffer type="galaxy.datatypes.binary:Sff"/><sniffer type="galaxy.datatypes.xml:Phyloxml"/>
+ <sniffer type="galaxy.datatypes.xml:Owl"/><sniffer type="galaxy.datatypes.xml:GenericXml"/><sniffer type="galaxy.datatypes.sequence:Maf"/><sniffer type="galaxy.datatypes.sequence:Lav"/>
@@ -294,6 +297,7 @@
<sniffer type="galaxy.datatypes.tabular:Sam"/><sniffer type="galaxy.datatypes.data:Newick"/><sniffer type="galaxy.datatypes.data:Nexus"/>
+ <sniffer type="galaxy.datatypes.text:Obo"/><sniffer type="galaxy.datatypes.text:Ipynb"/><sniffer type="galaxy.datatypes.text:Json"/><sniffer type="galaxy.datatypes.images:Jpg"/>
diff -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 -r 25f0318f232ff783972c1e3e26fa853c0b9f085b lib/galaxy/datatypes/text.py
--- a/lib/galaxy/datatypes/text.py
+++ b/lib/galaxy/datatypes/text.py
@@ -12,6 +12,7 @@
import subprocess
import json
import os
+import re
import logging
log = logging.getLogger(__name__)
@@ -119,3 +120,37 @@
Set the number of models in dataset.
"""
pass
+
+
+class Obo( Text ):
+ """
+ OBO file format description
+ http://www.geneontology.org/GO.format.obo-1_2.shtml
+ """
+ file_ext = "obo"
+
+ def set_peek( self, dataset, is_multi_byte=False ):
+ if not dataset.dataset.purged:
+ dataset.peek = get_file_peek( dataset.file_name, is_multi_byte=is_multi_byte )
+ dataset.blurb = "Open Biomedical Ontology (OBO)"
+ else:
+ dataset.peek = 'file does not exist'
+ dataset.blurb = 'file purged from disc'
+
+ def sniff( self, filename ):
+ """
+ Try to load the string with the json module. If successful it's a json file.
+ """
+ stanza = re.compile(r'^\[.*\]$')
+ with open( filename ) as handle:
+ first_line = handle.readline()
+ if not first_line.startswith('format-version:'):
+ return False
+
+ for line in handle:
+ if stanza.match(line.strip()):
+ # a stanza needs to begin with an ID tag
+ if handle.next().startswith('id:'):
+ return True
+ return False
+
diff -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 -r 25f0318f232ff783972c1e3e26fa853c0b9f085b lib/galaxy/datatypes/xml.py
--- a/lib/galaxy/datatypes/xml.py
+++ b/lib/galaxy/datatypes/xml.py
@@ -1,6 +1,7 @@
"""
XML format classes
"""
+import re
import data
import logging
from galaxy.datatypes.sniff import *
@@ -116,3 +117,32 @@
"""
return [ 'phyloviz' ]
+
+
+class Owl( GenericXml ):
+ """
+ Web Ontology Language OWL format description
+ http://www.w3.org/TR/owl-ref/
+ """
+ file_ext = "owl"
+
+ def set_peek( self, dataset, is_multi_byte=False ):
+ if not dataset.dataset.purged:
+ dataset.peek = data.get_file_peek( dataset.file_name, is_multi_byte=is_multi_byte )
+ dataset.blurb = "Web Ontology Language OWL"
+ else:
+ dataset.peek = 'file does not exist'
+ dataset.blurb = 'file purged from disc'
+
+ def sniff( self, filename ):
+ """
+ Try to load the string with the json module. If successful it's a json file.
+ """
+ owl_marker = re.compile(r'\<owl:')
+ with open( filename ) as handle:
+ # Check first 200 lines for the string "<owl:"
+ first_lines = handle.readlines(200)
+ for line in first_lines:
+ if owl_marker.search( line ):
+ return True
+ return False
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jmchilton: Merged in nsoranzo/galaxy-central (pull request #551)
by commits-noreply@bitbucket.org 10 Nov '14
by commits-noreply@bitbucket.org 10 Nov '14
10 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/a3ebaac5d312/
Changeset: a3ebaac5d312
User: jmchilton
Date: 2014-11-10 16:04:02+00:00
Summary: Merged in nsoranzo/galaxy-central (pull request #551)
Small bugs, doc and pylint fixes.
Affected #: 9 files
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/util/bunch.py
--- a/lib/galaxy/util/bunch.py
+++ b/lib/galaxy/util/bunch.py
@@ -17,6 +17,12 @@
def items(self):
return self.__dict__.items()
+ def keys(self):
+ return self.__dict__.keys()
+
+ def values(self):
+ return self.__dict__.values()
+
def __str__(self):
return '%s' % self.__dict__
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/web/base/controller.py
--- a/lib/galaxy/web/base/controller.py
+++ b/lib/galaxy/web/base/controller.py
@@ -13,7 +13,6 @@
from paste.httpexceptions import HTTPBadRequest, HTTPInternalServerError
from paste.httpexceptions import HTTPNotImplemented, HTTPRequestRangeNotSatisfiable
-from galaxy import exceptions
from galaxy.exceptions import ItemAccessibilityException, ItemDeletionException, ItemOwnershipException
from galaxy.exceptions import MessageException
@@ -27,7 +26,7 @@
from galaxy.web.form_builder import AddressField, CheckboxField, SelectField, TextArea, TextField
from galaxy.web.form_builder import build_select_field, HistoryField, PasswordField, WorkflowField, WorkflowMappingField
from galaxy.workflow.modules import module_factory, WorkflowModuleInjector, MissingToolException
-from galaxy.model.orm import eagerload, eagerload_all, desc, not_
+from galaxy.model.orm import eagerload, eagerload_all, desc
from galaxy.security.validate_user_input import validate_publicname
from galaxy.util.sanitize_html import sanitize_html
from galaxy.model.item_attrs import Dictifiable, UsesAnnotations
@@ -85,7 +84,7 @@
Convenience method to get a model object with the specified checks.
"""
return managers_base.get_object( trans, id, class_name, check_ownership=check_ownership, check_accessible=check_accessible, deleted=deleted )
-
+
# this should be here - but catching errors from sharable item controllers that *should* have SharableItemMixin
# but *don't* then becomes difficult
#def security_check( self, trans, item, check_ownership=False, check_accessible=False ):
@@ -322,7 +321,7 @@
# Initialize count dict with all states.
state_count_dict = {}
- for k, state in trans.app.model.Dataset.states.items():
+ for state in trans.app.model.Dataset.states.values():
state_count_dict[ state ] = 0
# Process query results, adding to count dict.
@@ -370,7 +369,7 @@
# init counts, ids for each state
state_counts = {}
state_ids = {}
- for key, state in trans.app.model.Dataset.states.items():
+ for state in trans.app.model.Dataset.states.values():
state_counts[ state ] = 0
state_ids[ state ] = []
@@ -566,7 +565,7 @@
# DEPRECATION: We still support unencoded ids for backward compatibility
try:
dataset_id = int( dataset_id )
- except ValueError, v_err:
+ except ValueError:
raise HTTPBadRequest( "Invalid dataset id: %s." % str( dataset_id ) )
try:
@@ -589,7 +588,7 @@
error( "You are not allowed to access this dataset" )
if check_state and data.state == trans.model.Dataset.states.UPLOAD:
- return trans.show_error_message( "Please wait until this dataset finishes uploading "
+ return trans.show_error_message( "Please wait until this dataset finishes uploading "
+ "before attempting to view it." )
return data
@@ -651,7 +650,7 @@
check_ownership=check_ownership,
check_accessible=check_accessible,
check_state=check_state )
- except Exception, exception:
+ except Exception:
pass
hdas.append( hda )
return hdas
@@ -711,7 +710,7 @@
# ---- return here if deleted AND purged OR can't access
purged = ( hda.purged or hda.dataset.purged )
- if ( hda.deleted and purged ):
+ if hda.deleted and purged:
#TODO: to_dict should really go AFTER this - only summary data
return trans.security.encode_dict_ids( hda_dict )
@@ -747,10 +746,6 @@
#TODO: it may also be wiser to remove from here and add as API call that loads the visualizations
# when the visualizations button is clicked (instead of preloading/pre-checking)
- # ---- return here if deleted
- if hda.deleted and not purged:
- return trans.security.encode_dict_ids( hda_dict )
-
return trans.security.encode_dict_ids( hda_dict )
def get_inaccessible_hda_dict( self, trans, hda ):
@@ -892,7 +887,8 @@
# or ( trans.app.security_agent.can_add_library_item( user.all_roles(), item ) ) )
def can_current_user_add_to_library_item( self, trans, item ):
- if not trans.user: return False
+ if not trans.user:
+ return False
return ( ( trans.user_is_admin() )
or ( trans.app.security_agent.can_add_library_item( trans.get_current_user_roles(), item ) ) )
@@ -1411,11 +1407,6 @@
# Get data provider.
track_data_provider = trans.app.data_provider_registry.get_data_provider( trans, original_dataset=dataset )
- if isinstance( dataset, trans.app.model.HistoryDatasetAssociation ):
- hda_ldda = "hda"
- elif isinstance( dataset, trans.app.model.LibraryDatasetDatasetAssociation ):
- hda_ldda = "ldda"
-
# Get track definition.
return {
"track_type": dataset.datatype.track_type,
@@ -1705,7 +1696,7 @@
data['name'] = workflow.name
data['annotation'] = annotation_str
if workflow.uuid is not None:
- data['uuid'] = str(workflow.uuid)
+ data['uuid'] = str(workflow.uuid)
data['steps'] = {}
# For each step, rebuild the form and encode the state
for step in workflow.steps:
@@ -1743,18 +1734,16 @@
step_dict['inputs'] = module.get_runtime_input_dicts( annotation_str )
# User outputs
step_dict['user_outputs'] = []
- """
- module_outputs = module.get_data_outputs()
- step_outputs = trans.sa_session.query( WorkflowOutput ).filter( step=step )
- for output in step_outputs:
- name = output.output_name
- annotation = ""
- for module_output in module_outputs:
- if module_output.get( 'name', None ) == name:
- output_type = module_output.get( 'extension', '' )
- break
- data['outputs'][name] = { 'name' : name, 'annotation' : annotation, 'type' : output_type }
- """
+# module_outputs = module.get_data_outputs()
+# step_outputs = trans.sa_session.query( WorkflowOutput ).filter( step=step )
+# for output in step_outputs:
+# name = output.output_name
+# annotation = ""
+# for module_output in module_outputs:
+# if module_output.get( 'name', None ) == name:
+# output_type = module_output.get( 'extension', '' )
+# break
+# data['outputs'][name] = { 'name' : name, 'annotation' : annotation, 'type' : output_type }
# All step outputs
step_dict['outputs'] = []
@@ -2139,7 +2128,7 @@
# We need the type of each template field widget
widgets = item.get_template_widgets( trans )
# The list of widgets may include an AddressField which we need to save if it is new
- for index, widget_dict in enumerate( widgets ):
+ for widget_dict in widgets:
widget = widget_dict[ 'widget' ]
if isinstance( widget, AddressField ):
value = util.restore_text( params.get( widget.name, '' ) )
@@ -2220,7 +2209,7 @@
trans.sa_session.flush()
info_association = sra.run
else:
- info_association = assoc.run
+ info_association = assoc.run
else:
info_association = None
if info_association:
@@ -2364,7 +2353,7 @@
def widget_fields_have_contents( self, widgets ):
# Return True if any of the fields in widgets contain contents, widgets is a list of dictionaries that looks something like:
# [{'widget': <galaxy.web.form_builder.TextField object at 0x10867aa10>, 'helptext': 'Field 0 help (Optional)', 'label': 'Field 0'}]
- for i, field in enumerate( widgets ):
+ for field in widgets:
if ( isinstance( field[ 'widget' ], TextArea ) or isinstance( field[ 'widget' ], TextField ) ) and field[ 'widget' ].value:
return True
if isinstance( field[ 'widget' ], SelectField ) and field[ 'widget' ].options:
@@ -2385,7 +2374,7 @@
def clean_field_contents( self, widgets, **kwd ):
field_contents = {}
- for index, widget_dict in enumerate( widgets ):
+ for widget_dict in widgets:
widget = widget_dict[ 'widget' ]
value = kwd.get( widget.name, '' )
if isinstance( widget, CheckboxField ):
@@ -2434,7 +2423,7 @@
'''
params = util.Params( kwd )
values = {}
- for index, field in enumerate( form_definition.fields ):
+ for field in form_definition.fields:
field_type = field[ 'type' ]
field_name = field[ 'name' ]
input_value = params.get( field_name, '' )
@@ -2586,7 +2575,7 @@
if message:
return trans.fill_template( '/sharing_base.mako', item=self.get_item( trans, id ), message=message, status='error' )
user.username = username
- trans.sa_session.flush
+ trans.sa_session.flush()
return self.sharing( trans, id, **kwargs )
@web.expose
@@ -2648,34 +2637,34 @@
@web.require_login( "share Galaxy items" )
def sharing( self, trans, id, **kwargs ):
""" Handle item sharing. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
@web.expose
@web.require_login( "share Galaxy items" )
def share( self, trans, id=None, email="", **kwd ):
""" Handle sharing an item with a particular user. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
@web.expose
def display_by_username_and_slug( self, trans, username, slug ):
""" Display item by username and slug. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
@web.json
@web.require_login( "get item name and link" )
def get_name_and_link_async( self, trans, id=None ):
""" Returns item's name and link. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
@web.expose
@web.require_login("get item content asynchronously")
def get_item_content_async( self, trans, id ):
""" Returns item content in HTML format. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
def get_item( self, trans, id ):
""" Return item based on id. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
class UsesQuotaMixin( object ):
@@ -2692,7 +2681,7 @@
def _get_user_tags( self, trans, item_class_name, id ):
user = trans.user
tagged_item = self._get_tagged_item( trans, item_class_name, id )
- return [ tag for tag in tagged_item.tags if ( tag.user == user ) ]
+ return [ tag for tag in tagged_item.tags if tag.user == user ]
def _get_tagged_item( self, trans, item_class_name, id, check_ownership=True ):
tagged_item = self.get_object( trans, id, item_class_name, check_ownership=check_ownership, check_accessible=True )
@@ -2756,7 +2745,6 @@
return sorted( tags )
-
class UsesExtendedMetadataMixin( SharableItemSecurityMixin ):
""" Mixin for getting and setting item extended metadata. """
@@ -2846,10 +2834,10 @@
yield prefix, ("%s" % (meta)).encode("utf8", errors='replace')
-"""
-Deprecated: `BaseController` used to be available under the name `Root`
-"""
class ControllerUnavailable( Exception ):
+ """
+ Deprecated: `BaseController` used to be available under the name `Root`
+ """
pass
## ---- Utility methods -------------------------------------------------------
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/web/framework/webapp.py
--- a/lib/galaxy/web/framework/webapp.py
+++ b/lib/galaxy/web/framework/webapp.py
@@ -504,9 +504,9 @@
for char in filter( lambda x: x not in string.ascii_lowercase + string.digits + '-', username ):
username = username.replace( char, '-' )
# Find a unique username - user can change it later
- if ( self.sa_session.query( self.app.model.User ).filter_by( username=username ).first() ):
+ if self.sa_session.query( self.app.model.User ).filter_by( username=username ).first():
i = 1
- while ( self.sa_session.query( self.app.model.User ).filter_by( username=(username + '-' + str(i) ) ).first() ):
+ while self.sa_session.query( self.app.model.User ).filter_by( username=(username + '-' + str(i) ) ).first():
i += 1
username += '-' + str(i)
user.username = username
@@ -701,11 +701,6 @@
def template_context( self ):
return dict()
- def make_form_data( self, name, **kwargs ):
- rval = self.template_context[name] = FormData()
- rval.values.update( kwargs )
- return rval
-
def set_message( self, message, type=None ):
"""
Convenience method for setting the 'message' and 'message_type'
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/webapps/demo_sequencer/framework/__init__.py
--- a/lib/galaxy/webapps/demo_sequencer/framework/__init__.py
+++ b/lib/galaxy/webapps/demo_sequencer/framework/__init__.py
@@ -116,10 +116,7 @@
@galaxy.web.framework.base.lazy_property
def template_context( self ):
return dict()
- def make_form_data( self, name, **kwargs ):
- rval = self.template_context[name] = FormData()
- rval.values.update( kwargs )
- return rval
+
def set_message( self, message, type=None ):
"""
Convenience method for setting the 'message' and 'message_type'
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/webapps/galaxy/api/histories.py
--- a/lib/galaxy/webapps/galaxy/api/histories.py
+++ b/lib/galaxy/webapps/galaxy/api/histories.py
@@ -92,7 +92,7 @@
:rtype: dictionary
:returns: detailed history information from
- :func:`galaxy.web.base.controller.UsesHistoryDatasetAssociationMixin.get_history_dict`
+ :func:`galaxy.web.base.controller.UsesHistoryMixin.get_history_dict`
"""
history_id = id
deleted = string_as_bool( deleted )
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/webapps/galaxy/api/lda_datasets.py
--- a/lib/galaxy/webapps/galaxy/api/lda_datasets.py
+++ b/lib/galaxy/webapps/galaxy/api/lda_datasets.py
@@ -480,7 +480,7 @@
tool.update_state( trans, tool.inputs_by_page[ 0 ], state.inputs, kwd )
tool_params = state.inputs
dataset_upload_inputs = []
- for input_name, input in tool.inputs.iteritems():
+ for input in tool.inputs.itervalues():
if input.type == "upload_dataset":
dataset_upload_inputs.append( input )
library_bunch = upload_common.handle_library_params( trans, {}, trans.security.encode_id( folder.id ) )
@@ -536,7 +536,7 @@
* POST /api/libraries/datasets/download/{format}
Downloads requested datasets (identified by encoded IDs) in requested format.
- example: ``GET localhost:8080/api/libraries/datasets/download/tbz?ldda_ids%255B%255D=a0d84b45643a2678&ldda_ids%255B%255D=fe38c84dcd46c828``
+ example: ``GET localhost:8080/api/libraries/datasets/download/tbz?ld_ids%255B%255D=a0d84b45643a2678&ld_ids%255B%255D=fe38c84dcd46c828``
.. note:: supported format values are: 'zip', 'tgz', 'tbz', 'uncompressed'
@@ -554,7 +554,7 @@
datasets_to_download = kwd.get( 'ld_ids%5B%5D', None )
if datasets_to_download is None:
datasets_to_download = kwd.get( 'ld_ids', None )
- if ( datasets_to_download is not None ):
+ if datasets_to_download is not None:
datasets_to_download = util.listify( datasets_to_download )
for dataset_id in datasets_to_download:
try:
@@ -570,128 +570,128 @@
raise exceptions.RequestParameterMissingException( 'Request has to contain a list of dataset ids to download.' )
if format in [ 'zip', 'tgz', 'tbz' ]:
- # error = False
- killme = string.punctuation + string.whitespace
- trantab = string.maketrans( killme, '_'*len( killme ) )
- try:
- outext = 'zip'
- if format == 'zip':
- # Can't use mkstemp - the file must not exist first
- tmpd = tempfile.mkdtemp()
- util.umask_fix_perms( tmpd, trans.app.config.umask, 0777, self.app.config.gid )
- tmpf = os.path.join( tmpd, 'library_download.' + format )
- if trans.app.config.upstream_gzip:
- archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_STORED, True )
+ # error = False
+ killme = string.punctuation + string.whitespace
+ trantab = string.maketrans( killme, '_'*len( killme ) )
+ try:
+ outext = 'zip'
+ if format == 'zip':
+ # Can't use mkstemp - the file must not exist first
+ tmpd = tempfile.mkdtemp()
+ util.umask_fix_perms( tmpd, trans.app.config.umask, 0777, self.app.config.gid )
+ tmpf = os.path.join( tmpd, 'library_download.' + format )
+ if trans.app.config.upstream_gzip:
+ archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_STORED, True )
+ else:
+ archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_DEFLATED, True )
+ archive.add = lambda x, y: archive.write( x, y.encode( 'CP437' ) )
+ elif format == 'tgz':
+ if trans.app.config.upstream_gzip:
+ archive = StreamBall( 'w|' )
+ outext = 'tar'
+ else:
+ archive = StreamBall( 'w|gz' )
+ outext = 'tgz'
+ elif format == 'tbz':
+ archive = StreamBall( 'w|bz2' )
+ outext = 'tbz2'
+ except ( OSError, zipfile.BadZipfile ):
+ log.exception( "Unable to create archive for download" )
+ raise exceptions.InternalServerError( "Unable to create archive for download." )
+ except Exception:
+ log.exception( "Unexpected error %s in create archive for download" % sys.exc_info()[ 0 ] )
+ raise exceptions.InternalServerError( "Unable to create archive for download." )
+ composite_extensions = trans.app.datatypes_registry.get_composite_extensions()
+ seen = []
+ for ld in library_datasets:
+ ldda = ld.library_dataset_dataset_association
+ ext = ldda.extension
+ is_composite = ext in composite_extensions
+ path = ""
+ parent_folder = ldda.library_dataset.folder
+ while parent_folder is not None:
+ # Exclude the now-hidden "root folder"
+ if parent_folder.parent is None:
+ path = os.path.join( parent_folder.library_root[ 0 ].name, path )
+ break
+ path = os.path.join( parent_folder.name, path )
+ parent_folder = parent_folder.parent
+ path += ldda.name
+ while path in seen:
+ path += '_'
+ seen.append( path )
+ zpath = os.path.split(path)[ -1 ] # comes as base_name/fname
+ outfname, zpathext = os.path.splitext( zpath )
+
+ if is_composite: # need to add all the components from the extra_files_path to the zip
+ if zpathext == '':
+ zpath = '%s.html' % zpath # fake the real nature of the html file
+ try:
+ if format == 'zip':
+ archive.add( ldda.dataset.file_name, zpath ) # add the primary of a composite set
else:
- archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_DEFLATED, True )
- archive.add = lambda x, y: archive.write( x, y.encode( 'CP437' ) )
- elif format == 'tgz':
- if trans.app.config.upstream_gzip:
- archive = StreamBall( 'w|' )
- outext = 'tar'
- else:
- archive = StreamBall( 'w|gz' )
- outext = 'tgz'
- elif format == 'tbz':
- archive = StreamBall( 'w|bz2' )
- outext = 'tbz2'
- except ( OSError, zipfile.BadZipfile ):
- log.exception( "Unable to create archive for download" )
- raise exceptions.InternalServerError( "Unable to create archive for download." )
- except Exception:
- log.exception( "Unexpected error %s in create archive for download" % sys.exc_info()[ 0 ] )
- raise exceptions.InternalServerError( "Unable to create archive for download." )
- composite_extensions = trans.app.datatypes_registry.get_composite_extensions()
- seen = []
- for ld in library_datasets:
- ldda = ld.library_dataset_dataset_association
- ext = ldda.extension
- is_composite = ext in composite_extensions
- path = ""
- parent_folder = ldda.library_dataset.folder
- while parent_folder is not None:
- # Exclude the now-hidden "root folder"
- if parent_folder.parent is None:
- path = os.path.join( parent_folder.library_root[ 0 ].name, path )
- break
- path = os.path.join( parent_folder.name, path )
- parent_folder = parent_folder.parent
- path += ldda.name
- while path in seen:
- path += '_'
- seen.append( path )
- zpath = os.path.split(path)[ -1 ] # comes as base_name/fname
- outfname, zpathext = os.path.splitext( zpath )
+ archive.add( ldda.dataset.file_name, zpath, check_file=True ) # add the primary of a composite set
+ except IOError:
+ log.exception( "Unable to add composite parent %s to temporary library download archive" % ldda.dataset.file_name )
+ raise exceptions.InternalServerError( "Unable to create archive for download." )
+ except ObjectNotFound:
+ log.exception( "Requested dataset %s does not exist on the host." % ldda.dataset.file_name )
+ raise exceptions.ObjectNotFound( "Requested dataset not found. " )
+ except Exception, e:
+ log.exception( "Unable to add composite parent %s to temporary library download archive" % ldda.dataset.file_name )
+ raise exceptions.InternalServerError( "Unable to add composite parent to temporary library download archive. " + str( e ) )
- if is_composite: # need to add all the components from the extra_files_path to the zip
- if zpathext == '':
- zpath = '%s.html' % zpath # fake the real nature of the html file
+ flist = glob.glob(os.path.join(ldda.dataset.extra_files_path, '*.*')) # glob returns full paths
+ for fpath in flist:
+ efp, fname = os.path.split(fpath)
+ if fname > '':
+ fname = fname.translate(trantab)
try:
if format == 'zip':
- archive.add( ldda.dataset.file_name, zpath ) # add the primary of a composite set
+ archive.add( fpath, fname )
else:
- archive.add( ldda.dataset.file_name, zpath, check_file=True ) # add the primary of a composite set
+ archive.add( fpath, fname, check_file=True )
except IOError:
- log.exception( "Unable to add composite parent %s to temporary library download archive" % ldda.dataset.file_name )
+ log.exception( "Unable to add %s to temporary library download archive %s" % ( fname, outfname) )
raise exceptions.InternalServerError( "Unable to create archive for download." )
except ObjectNotFound:
- log.exception( "Requested dataset %s does not exist on the host." % ldda.dataset.file_name )
- raise exceptions.ObjectNotFound( "Requested dataset not found. " )
- except Exception, e:
- log.exception( "Unable to add composite parent %s to temporary library download archive" % ldda.dataset.file_name )
- raise exceptions.InternalServerError( "Unable to add composite parent to temporary library download archive. " + str( e ) )
-
- flist = glob.glob(os.path.join(ldda.dataset.extra_files_path, '*.*')) # glob returns full paths
- for fpath in flist:
- efp, fname = os.path.split(fpath)
- if fname > '':
- fname = fname.translate(trantab)
- try:
- if format == 'zip':
- archive.add( fpath, fname )
- else:
- archive.add( fpath, fname, check_file=True )
- except IOError:
- log.exception( "Unable to add %s to temporary library download archive %s" % ( fname, outfname) )
- raise exceptions.InternalServerError( "Unable to create archive for download." )
- except ObjectNotFound:
- log.exception( "Requested dataset %s does not exist on the host." % fpath )
- raise exceptions.ObjectNotFound( "Requested dataset not found." )
- except Exception, e:
- log.exception( "Unable to add %s to temporary library download archive %s" % ( fname, outfname ) )
- raise exceptions.InternalServerError( "Unable to add dataset to temporary library download archive . " + str( e ) )
-
- else: # simple case
- try:
- if format == 'zip':
- archive.add( ldda.dataset.file_name, path )
- else:
- archive.add( ldda.dataset.file_name, path, check_file=True )
- except IOError:
- log.exception( "Unable to write %s to temporary library download archive" % ldda.dataset.file_name )
- raise exceptions.InternalServerError( "Unable to create archive for download" )
- except ObjectNotFound:
- log.exception( "Requested dataset %s does not exist on the host." % ldda.dataset.file_name )
+ log.exception( "Requested dataset %s does not exist on the host." % fpath )
raise exceptions.ObjectNotFound( "Requested dataset not found." )
except Exception, e:
log.exception( "Unable to add %s to temporary library download archive %s" % ( fname, outfname ) )
- raise exceptions.InternalServerError( "Unknown error. " + str( e ) )
- lname = 'selected_dataset'
- fname = lname.replace( ' ', '_' ) + '_files'
- if format == 'zip':
- archive.close()
- trans.response.set_content_type( "application/octet-stream" )
- trans.response.headers[ "Content-Disposition" ] = 'attachment; filename="%s.%s"' % ( fname, outext )
- archive = util.streamball.ZipBall( tmpf, tmpd )
- archive.wsgi_status = trans.response.wsgi_status()
- archive.wsgi_headeritems = trans.response.wsgi_headeritems()
- return archive.stream
- else:
- trans.response.set_content_type( "application/x-tar" )
- trans.response.headers[ "Content-Disposition" ] = 'attachment; filename="%s.%s"' % ( fname, outext )
- archive.wsgi_status = trans.response.wsgi_status()
- archive.wsgi_headeritems = trans.response.wsgi_headeritems()
- return archive.stream
+ raise exceptions.InternalServerError( "Unable to add dataset to temporary library download archive . " + str( e ) )
+
+ else: # simple case
+ try:
+ if format == 'zip':
+ archive.add( ldda.dataset.file_name, path )
+ else:
+ archive.add( ldda.dataset.file_name, path, check_file=True )
+ except IOError:
+ log.exception( "Unable to write %s to temporary library download archive" % ldda.dataset.file_name )
+ raise exceptions.InternalServerError( "Unable to create archive for download" )
+ except ObjectNotFound:
+ log.exception( "Requested dataset %s does not exist on the host." % ldda.dataset.file_name )
+ raise exceptions.ObjectNotFound( "Requested dataset not found." )
+ except Exception, e:
+ log.exception( "Unable to add %s to temporary library download archive %s" % ( fname, outfname ) )
+ raise exceptions.InternalServerError( "Unknown error. " + str( e ) )
+ lname = 'selected_dataset'
+ fname = lname.replace( ' ', '_' ) + '_files'
+ if format == 'zip':
+ archive.close()
+ trans.response.set_content_type( "application/octet-stream" )
+ trans.response.headers[ "Content-Disposition" ] = 'attachment; filename="%s.%s"' % ( fname, outext )
+ archive = util.streamball.ZipBall( tmpf, tmpd )
+ archive.wsgi_status = trans.response.wsgi_status()
+ archive.wsgi_headeritems = trans.response.wsgi_headeritems()
+ return archive.stream
+ else:
+ trans.response.set_content_type( "application/x-tar" )
+ trans.response.headers[ "Content-Disposition" ] = 'attachment; filename="%s.%s"' % ( fname, outext )
+ archive.wsgi_status = trans.response.wsgi_status()
+ archive.wsgi_headeritems = trans.response.wsgi_headeritems()
+ return archive.stream
elif format == 'uncompressed':
if len(library_datasets) != 1:
raise exceptions.RequestParameterInvalidException( "You can download only one uncompressed file at once." )
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/webapps/galaxy/api/library_contents.py
--- a/lib/galaxy/webapps/galaxy/api/library_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/library_contents.py
@@ -146,17 +146,21 @@
the HDA's encoded id in ``from_hda_id`` (and optionally ``ldda_message``).
:type library_id: str
- :param library_id: encoded id string of the library that contains this item
+ :param library_id: encoded id string of the library where to create the new item
:type payload: dict
:param payload: dictionary structure containing:
* folder_id: the parent folder of the new item
- * create_type: the type of item to create ('file' or 'folder')
+ * create_type: the type of item to create ('file', 'folder' or 'collection')
* from_hda_id: (optional) the id of an accessible HDA to copy into the
library
* ldda_message: (optional) the new message attribute of the LDDA created
* extended_metadata: (optional) dub-dictionary containing any extended
metadata to associate with the item
+ * link_data_only: (optional) either 'copy_files' (default) or 'link_to_files'
+ * upload_option: (optional) one of 'upload_file' (default), 'upload_directory' or 'upload_paths'
+ * server_dir: (optional) only if upload_option is 'upload_directory'
+ * filesystem_paths: (optional) only if upload_option is 'upload_paths' and the user is an admin
:rtype: dict
:returns: a dictionary containing the id, name,
@@ -217,11 +221,9 @@
return output
else:
rval = []
- for k, v in output.items():
+ for v in output.values():
if ex_meta_payload is not None:
- """
- If there is extended metadata, store it, attach it to the dataset, and index it
- """
+ # If there is extended metadata, store it, attach it to the dataset, and index it
ex_meta = ExtendedMetadata(ex_meta_payload)
trans.sa_session.add( ex_meta )
v.extended_metadata = ex_meta
@@ -343,9 +345,9 @@
trans.sa_session.flush()
def __decode_library_content_id( self, trans, content_id ):
- if ( len( content_id ) % 16 == 0 ):
+ if len( content_id ) % 16 == 0:
return 'LibraryDataset', content_id
- elif ( content_id.startswith( 'F' ) ):
+ elif content_id.startswith( 'F' ):
return 'LibraryFolder', content_id[ 1: ]
else:
raise HTTPBadRequest( 'Malformed library content id ( %s ) specified, unable to decode.' % str( content_id ) )
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/webapps/galaxy/controllers/dataset.py
--- a/lib/galaxy/webapps/galaxy/controllers/dataset.py
+++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py
@@ -1,8 +1,6 @@
import logging
import os
-import tempfile
import urllib
-import zipfile
from galaxy import datatypes, eggs, model, util, web
from galaxy.datatypes.display_applications.util import decode_dataset_user, encode_dataset_user
@@ -43,8 +41,8 @@
accepted_filter_labels_and_vals = { "Active" : "False", "Deleted" : "True", "All": "All" }
accepted_filters = []
for label, val in accepted_filter_labels_and_vals.items():
- args = { self.key: val }
- accepted_filters.append( grids.GridColumnFilter( label, args) )
+ args = { self.key: val }
+ accepted_filters.append( grids.GridColumnFilter( label, args) )
return accepted_filters
# Grid definition
@@ -147,7 +145,7 @@
trans.response.set_content_type( 'text/plain' )
exit_code = ""
try:
- job = self._get_job_for_dataset( dataset_id )
+ job = self._get_job_for_dataset( trans, dataset_id )
exit_code = job.exit_code
except:
exit_code = "Invalid dataset ID or you are not allowed to access this dataset"
@@ -323,40 +321,38 @@
if params.annotation:
annotation = sanitize_html( params.annotation, 'utf-8', 'text/html' )
self.add_item_annotation( trans.sa_session, trans.get_user(), data, annotation )
- """
# This block on controller code is inactive until the 'extended_metadata' edit box is added back into the UI
# Add or delete extended metadata
- if params.extended_metadata:
- em_string = params.extended_metadata
- if len(em_string):
- em_payload = None
- try:
- em_payload = loads(em_string)
- except Exception, e:
- message = 'Invalid JSON input'
- error = True
- if em_payload is not None:
- if data is not None:
- ex_obj = self.get_item_extended_metadata_obj(trans, data)
- if ex_obj is not None:
- self.unset_item_extended_metadata_obj(trans, data)
- self.delete_extended_metadata(trans, ex_obj)
- ex_obj = self.create_extended_metadata(trans, em_payload)
- self.set_item_extended_metadata_obj(trans, data, ex_obj)
- message = "Updated Extended metadata '%s'." % data.name
- status = 'done'
- else:
- message = "data not found"
- error = True
- else:
- if data is not None:
- ex_obj = self.get_item_extended_metadata_obj(trans, data)
- if ex_obj is not None:
- self.unset_item_extended_metadata_obj(trans, data)
- self.delete_extended_metadata(trans, ex_obj)
- message = "Deleted Extended metadata '%s'." % data.name
- status = 'done'
- """
+# if params.extended_metadata:
+# em_string = params.extended_metadata
+# if len(em_string):
+# em_payload = None
+# try:
+# em_payload = loads(em_string)
+# except Exception, e:
+# message = 'Invalid JSON input'
+# error = True
+# if em_payload is not None:
+# if data is not None:
+# ex_obj = self.get_item_extended_metadata_obj(trans, data)
+# if ex_obj is not None:
+# self.unset_item_extended_metadata_obj(trans, data)
+# self.delete_extended_metadata(trans, ex_obj)
+# ex_obj = self.create_extended_metadata(trans, em_payload)
+# self.set_item_extended_metadata_obj(trans, data, ex_obj)
+# message = "Updated Extended metadata '%s'." % data.name
+# status = 'done'
+# else:
+# message = "data not found"
+# error = True
+# else:
+# if data is not None:
+# ex_obj = self.get_item_extended_metadata_obj(trans, data)
+# if ex_obj is not None:
+# self.unset_item_extended_metadata_obj(trans, data)
+# self.delete_extended_metadata(trans, ex_obj)
+# message = "Deleted Extended metadata '%s'." % data.name
+# status = 'done'
# If setting metadata previously failed and all required elements have now been set, clear the failed state.
if data._state == trans.model.Dataset.states.FAILED_METADATA and not data.missing_meta():
@@ -954,13 +950,11 @@
has_parameter_errors = False
inherit_chain = hda.source_dataset_chain
if inherit_chain:
- job_dataset_association, dataset_association_container_name = inherit_chain[-1]
+ job_dataset_association = inherit_chain[-1][0]
else:
job_dataset_association = hda
if job_dataset_association.creating_job_associations:
- for assoc in job_dataset_association.creating_job_associations:
- job = assoc.job
- break
+ job = job_dataset_association.creating_job_associations[0].job
if job:
# Get the tool object
try:
@@ -1024,7 +1018,7 @@
trans.sa_session.flush()
target_history_ids.append( new_history.id )
if user:
- target_histories = [ hist for hist in map( trans.sa_session.query( trans.app.model.History ).get, target_history_ids ) if ( hist is not None and hist.user == user )]
+ target_histories = [ hist for hist in map( trans.sa_session.query( trans.app.model.History ).get, target_history_ids ) if hist is not None and hist.user == user ]
else:
target_histories = [ history ]
if len( target_histories ) != len( target_history_ids ):
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/webapps/galaxy/controllers/library_common.py
--- a/lib/galaxy/webapps/galaxy/controllers/library_common.py
+++ b/lib/galaxy/webapps/galaxy/controllers/library_common.py
@@ -162,6 +162,7 @@
default_action=default_action,
message=util.sanitize_text( message ),
status=status ) )
+
@web.expose
def library_info( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
@@ -222,6 +223,7 @@
inherited=inherited,
message=message,
status=status )
+
@web.expose
def library_permissions( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
@@ -269,6 +271,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def create_folder( self, trans, cntrller, parent_id, library_id, **kwd ):
params = util.Params( kwd )
@@ -346,6 +349,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def folder_info( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
@@ -403,6 +407,7 @@
inherited=inherited,
message=message,
status=status )
+
@web.expose
def folder_permissions( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
@@ -453,6 +458,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def ldda_edit_info( self, trans, cntrller, library_id, folder_id, id, **kwd ):
params = util.Params( kwd )
@@ -606,6 +612,7 @@
inherited=inherited,
message=message,
status=status )
+
@web.expose
def ldda_info( self, trans, cntrller, library_id, folder_id, id, **kwd ):
params = util.Params( kwd )
@@ -655,6 +662,7 @@
inherited=inherited,
message=message,
status=status )
+
@web.expose
def ldda_permissions( self, trans, cntrller, library_id, folder_id, id, **kwd ):
params = util.Params( kwd )
@@ -793,6 +801,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def upload_library_dataset( self, trans, cntrller, library_id, folder_id, **kwd ):
params = util.Params( kwd )
@@ -1042,6 +1051,7 @@
ldda_message=ldda_message,
message=message,
status=status )
+
def upload_dataset( self, trans, cntrller, library_id, folder_id, replace_dataset=None, **kwd ):
# Set up the traditional tool state/params
tool_id = 'upload1'
@@ -1132,6 +1142,7 @@
trans.sa_session.add( job )
trans.sa_session.flush()
return output
+
def make_library_uploaded_dataset( self, trans, cntrller, params, name, path, type, library_bunch, in_folder=None ):
link_data_only = params.get( 'link_data_only', 'copy_files' )
uuid_str = params.get( 'uuid', None )
@@ -1166,6 +1177,7 @@
trans.sa_session.add_all( ( uploaded_dataset.data, uploaded_dataset.data.dataset ) )
trans.sa_session.flush()
return uploaded_dataset
+
def get_server_dir_uploaded_datasets( self, trans, cntrller, params, full_dir, import_dir_desc, library_bunch, response_code, message ):
dir_response = self._get_server_dir_files(params, full_dir, import_dir_desc)
files = dir_response[0]
@@ -1176,6 +1188,7 @@
name = os.path.basename( file )
uploaded_datasets.append( self.make_library_uploaded_dataset( trans, cntrller, params, name, file, 'server_dir', library_bunch ) )
return uploaded_datasets, 200, None
+
def _get_server_dir_files( self, params, full_dir, import_dir_desc ):
files = []
try:
@@ -1212,6 +1225,7 @@
response_code = 400
return None, response_code, message
return files, None, None
+
def get_path_paste_uploaded_datasets( self, trans, cntrller, params, library_bunch, response_code, message ):
preserve_dirs = util.string_as_bool( params.get( 'preserve_dirs', False ) )
uploaded_datasets = []
@@ -1246,6 +1260,7 @@
in_folder = None
files_and_folders.append((file_path, file, in_folder))
return files_and_folders
+
def _paths_list(self, params):
return [ (l.strip(), os.path.abspath(l.strip())) for l in params.filesystem_paths.splitlines() if l.strip() ]
@@ -1463,6 +1478,7 @@
ldda_message=ldda_message,
message=message,
status=status )
+
def _build_roles_select_list( self, trans, cntrller, library, selected_role_ids=[] ):
# Get the list of legitimate roles to display on the upload form. If the library is public,
# all active roles are legitimate. If the library is restricted by the LIBRARY_ACCESS permission, only
@@ -1478,10 +1494,11 @@
return roles_select_list
else:
return None
+
def _build_upload_option_select_list( self, trans, upload_option, is_admin, do_not_include_values=[] ):
# Build the upload_option select list. The do_not_include_values param can contain options that
# should not be included in the list. For example, the 'upload_directory' option should not be
- # included if uploading a new version of a librar dataset.
+ # included if uploading a new version of a library dataset.
upload_refresh_on_change_values = []
for option_value, option_label in trans.model.LibraryDataset.upload_options:
if option_value not in do_not_include_values:
@@ -1508,6 +1525,7 @@
continue
upload_option_select_list.add_option( option_label, option_value, selected=option_value==upload_option )
return upload_option_select_list
+
def _get_populated_widgets( self, folder ):
# See if we have any inherited templates.
info_association, inherited = folder.get_info_association( inherited=True )
@@ -1517,6 +1535,7 @@
return self.populate_widgets_from_kwd( trans, widgets, **kwd )
else:
return []
+
@web.expose
def download_dataset_from_folder( self, trans, cntrller, id, library_id=None, **kwd ):
"""Catches the dataset id and displays file contents as directed"""
@@ -1557,6 +1576,7 @@
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status='error' ) )
+
@web.expose
def library_dataset_info( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
@@ -1606,6 +1626,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def library_dataset_permissions( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
@@ -1654,6 +1675,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def make_library_item_public( self, trans, cntrller, library_id, item_type, id, **kwd ):
params = util.Params( kwd )
@@ -1696,6 +1718,7 @@
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status=status ) )
+
@web.expose
def act_on_multiple_datasets( self, trans, cntrller, library_id=None, ldda_ids='', **kwd ):
# This method is called from 1 of 3 places:
@@ -2113,6 +2136,7 @@
use_panels=use_panels,
message=message,
status=status )
+
@web.expose
def manage_template_inheritance( self, trans, cntrller, item_type, library_id, folder_id=None, ldda_id=None, **kwd ):
params = util.Params( kwd )
@@ -2159,6 +2183,7 @@
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status='done' ) )
+
@web.expose
def move_library_item( self, trans, cntrller, item_type, item_id, source_library_id='', make_target_current=True, **kwd ):
# This method is called from one of the following places:
@@ -2374,6 +2399,7 @@
use_panels=use_panels,
message=message,
status=status )
+
@web.expose
def delete_library_item( self, trans, cntrller, library_id, item_id, item_type, **kwd ):
# This action will handle deleting all types of library items. State is saved for libraries and
@@ -2441,6 +2467,7 @@
show_deleted=show_deleted,
message=message,
status=status ) )
+
@web.expose
def undelete_library_item( self, trans, cntrller, library_id, item_id, item_type, **kwd ):
# This action will handle undeleting all types of library items
@@ -2509,6 +2536,7 @@
show_deleted=show_deleted,
message=message,
status=status ) )
+
def _check_access( self, trans, cntrller, is_admin, item, current_user_roles, use_panels, library_id, show_deleted ):
can_access = True
if isinstance( item, trans.model.HistoryDatasetAssociation ):
@@ -2551,6 +2579,7 @@
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status='error' ) )
+
def _check_add( self, trans, cntrller, is_admin, item, current_user_roles, use_panels, library_id, show_deleted ):
# Deny access if the user is not an admin and does not have the LIBRARY_ADD permission.
if not ( is_admin or trans.app.security_agent.can_add_library_item( current_user_roles, item ) ):
@@ -2566,6 +2595,7 @@
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status='error' ) )
+
def _check_manage( self, trans, cntrller, is_admin, item, current_user_roles, use_panels, library_id, show_deleted ):
if isinstance( item, trans.model.LibraryDataset ):
# Deny access if the user is not an admin and does not have the LIBRARY_MANAGE and DATASET_MANAGE_PERMISSIONS permissions.
@@ -2594,6 +2624,7 @@
use_panels=use_panels,
message=util.sanitize_text( message ),
status='error' ) )
+
def _check_modify( self, trans, cntrller, is_admin, item, current_user_roles, use_panels, library_id, show_deleted ):
# Deny modification if the user is not an admin and does not have the LIBRARY_MODIFY permission.
if not ( is_admin or trans.app.security_agent.can_modify_library_item( current_user_roles, item ) ):
@@ -2619,6 +2650,7 @@
.options( eagerload_all( "actions" ) ) \
.order_by( trans.app.model.LibraryFolder.table.c.name ) \
.all()
+
def activatable_folders( trans, folder ):
return trans.sa_session.query( trans.app.model.LibraryFolder ) \
.filter_by( parent=folder, purged=False ) \
@@ -2685,6 +2717,7 @@
if folder.parent:
return branch_deleted( folder.parent )
return False
+
def get_containing_library_from_library_dataset( trans, library_dataset ):
"""Given a library_dataset, get the containing library"""
folder = library_dataset.folder
@@ -2698,6 +2731,7 @@
if library.root_folder == folder:
return library
return None
+
def get_comptypes( trans ):
comptypes_t = comptypes
if trans.app.config.nginx_x_archive_files_base:
@@ -2710,6 +2744,7 @@
except:
pass
return comptypes_t
+
def get_sorted_accessible_library_items( trans, cntrller, items, sort_attr ):
is_admin = trans.user_is_admin() and cntrller == 'library_admin'
if is_admin:
@@ -2723,6 +2758,7 @@
accessible_items.append( item )
# Sort by name
return sort_by_attr( [ item for item in accessible_items ], sort_attr )
+
def sort_by_attr( seq, attr ):
"""
Sort the sequence of objects by object's attribute
@@ -2738,6 +2774,7 @@
intermed = map( None, map( getattr, seq, ( attr, ) * len( seq ) ), xrange( len( seq ) ), seq )
intermed.sort()
return map( operator.getitem, intermed, ( -1, ) * len( intermed ) )
+
def lucene_search( trans, cntrller, search_term, search_url, **kwd ):
"""Return display of results from a full-text lucene search of data libraries."""
params = util.Params( kwd )
@@ -2749,6 +2786,7 @@
response.close()
lddas = [ trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( ldda_id ) for ldda_id in ldda_ids ]
return status, message, get_sorted_accessible_library_items( trans, cntrller, lddas, 'name' )
+
def whoosh_search( trans, cntrller, search_term, **kwd ):
"""Return display of results from a full-text whoosh search of data libraries."""
params = util.Params( kwd )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
4 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f2b125ad393e/
Changeset: f2b125ad393e
User: nsoranzo
Date: 2014-11-04 15:46:42+00:00
Summary: Remove unused and buggy function.
Affected #: 2 files
diff -r f9e8de1c84b2d60cc727ec5b64da6fe67616b7ed -r f2b125ad393e0a1a0a72ddfd5497855576b5d1dd lib/galaxy/web/framework/webapp.py
--- a/lib/galaxy/web/framework/webapp.py
+++ b/lib/galaxy/web/framework/webapp.py
@@ -504,9 +504,9 @@
for char in filter( lambda x: x not in string.ascii_lowercase + string.digits + '-', username ):
username = username.replace( char, '-' )
# Find a unique username - user can change it later
- if ( self.sa_session.query( self.app.model.User ).filter_by( username=username ).first() ):
+ if self.sa_session.query( self.app.model.User ).filter_by( username=username ).first():
i = 1
- while ( self.sa_session.query( self.app.model.User ).filter_by( username=(username + '-' + str(i) ) ).first() ):
+ while self.sa_session.query( self.app.model.User ).filter_by( username=(username + '-' + str(i) ) ).first():
i += 1
username += '-' + str(i)
user.username = username
@@ -701,11 +701,6 @@
def template_context( self ):
return dict()
- def make_form_data( self, name, **kwargs ):
- rval = self.template_context[name] = FormData()
- rval.values.update( kwargs )
- return rval
-
def set_message( self, message, type=None ):
"""
Convenience method for setting the 'message' and 'message_type'
diff -r f9e8de1c84b2d60cc727ec5b64da6fe67616b7ed -r f2b125ad393e0a1a0a72ddfd5497855576b5d1dd lib/galaxy/webapps/demo_sequencer/framework/__init__.py
--- a/lib/galaxy/webapps/demo_sequencer/framework/__init__.py
+++ b/lib/galaxy/webapps/demo_sequencer/framework/__init__.py
@@ -116,10 +116,7 @@
@galaxy.web.framework.base.lazy_property
def template_context( self ):
return dict()
- def make_form_data( self, name, **kwargs ):
- rval = self.template_context[name] = FormData()
- rval.values.update( kwargs )
- return rval
+
def set_message( self, message, type=None ):
"""
Convenience method for setting the 'message' and 'message_type'
https://bitbucket.org/galaxy/galaxy-central/commits/636f0fff0061/
Changeset: 636f0fff0061
User: nsoranzo
Date: 2014-11-05 13:28:14+00:00
Summary: Add keys() and values() methods to Bunch.
Affected #: 1 file
diff -r f2b125ad393e0a1a0a72ddfd5497855576b5d1dd -r 636f0fff006148e875f55bab684821cc60b0630f lib/galaxy/util/bunch.py
--- a/lib/galaxy/util/bunch.py
+++ b/lib/galaxy/util/bunch.py
@@ -17,6 +17,12 @@
def items(self):
return self.__dict__.items()
+ def keys(self):
+ return self.__dict__.keys()
+
+ def values(self):
+ return self.__dict__.values()
+
def __str__(self):
return '%s' % self.__dict__
https://bitbucket.org/galaxy/galaxy-central/commits/e14c29154b8a/
Changeset: e14c29154b8a
User: nsoranzo
Date: 2014-11-04 15:48:33+00:00
Summary: Bugs, doc and pylint fixes.
Affected #: 6 files
diff -r 636f0fff006148e875f55bab684821cc60b0630f -r e14c29154b8ac2ce85aacbe8435b8b73108c8464 lib/galaxy/web/base/controller.py
--- a/lib/galaxy/web/base/controller.py
+++ b/lib/galaxy/web/base/controller.py
@@ -13,7 +13,6 @@
from paste.httpexceptions import HTTPBadRequest, HTTPInternalServerError
from paste.httpexceptions import HTTPNotImplemented, HTTPRequestRangeNotSatisfiable
-from galaxy import exceptions
from galaxy.exceptions import ItemAccessibilityException, ItemDeletionException, ItemOwnershipException
from galaxy.exceptions import MessageException
@@ -27,7 +26,7 @@
from galaxy.web.form_builder import AddressField, CheckboxField, SelectField, TextArea, TextField
from galaxy.web.form_builder import build_select_field, HistoryField, PasswordField, WorkflowField, WorkflowMappingField
from galaxy.workflow.modules import module_factory, WorkflowModuleInjector, MissingToolException
-from galaxy.model.orm import eagerload, eagerload_all, desc, not_
+from galaxy.model.orm import eagerload, eagerload_all, desc
from galaxy.security.validate_user_input import validate_publicname
from galaxy.util.sanitize_html import sanitize_html
from galaxy.model.item_attrs import Dictifiable, UsesAnnotations
@@ -85,7 +84,7 @@
Convenience method to get a model object with the specified checks.
"""
return managers_base.get_object( trans, id, class_name, check_ownership=check_ownership, check_accessible=check_accessible, deleted=deleted )
-
+
# this should be here - but catching errors from sharable item controllers that *should* have SharableItemMixin
# but *don't* then becomes difficult
#def security_check( self, trans, item, check_ownership=False, check_accessible=False ):
@@ -322,7 +321,7 @@
# Initialize count dict with all states.
state_count_dict = {}
- for k, state in trans.app.model.Dataset.states.items():
+ for state in trans.app.model.Dataset.states.values():
state_count_dict[ state ] = 0
# Process query results, adding to count dict.
@@ -370,7 +369,7 @@
# init counts, ids for each state
state_counts = {}
state_ids = {}
- for key, state in trans.app.model.Dataset.states.items():
+ for state in trans.app.model.Dataset.states.values():
state_counts[ state ] = 0
state_ids[ state ] = []
@@ -566,7 +565,7 @@
# DEPRECATION: We still support unencoded ids for backward compatibility
try:
dataset_id = int( dataset_id )
- except ValueError, v_err:
+ except ValueError:
raise HTTPBadRequest( "Invalid dataset id: %s." % str( dataset_id ) )
try:
@@ -589,7 +588,7 @@
error( "You are not allowed to access this dataset" )
if check_state and data.state == trans.model.Dataset.states.UPLOAD:
- return trans.show_error_message( "Please wait until this dataset finishes uploading "
+ return trans.show_error_message( "Please wait until this dataset finishes uploading "
+ "before attempting to view it." )
return data
@@ -651,7 +650,7 @@
check_ownership=check_ownership,
check_accessible=check_accessible,
check_state=check_state )
- except Exception, exception:
+ except Exception:
pass
hdas.append( hda )
return hdas
@@ -711,7 +710,7 @@
# ---- return here if deleted AND purged OR can't access
purged = ( hda.purged or hda.dataset.purged )
- if ( hda.deleted and purged ):
+ if hda.deleted and purged:
#TODO: to_dict should really go AFTER this - only summary data
return trans.security.encode_dict_ids( hda_dict )
@@ -747,10 +746,6 @@
#TODO: it may also be wiser to remove from here and add as API call that loads the visualizations
# when the visualizations button is clicked (instead of preloading/pre-checking)
- # ---- return here if deleted
- if hda.deleted and not purged:
- return trans.security.encode_dict_ids( hda_dict )
-
return trans.security.encode_dict_ids( hda_dict )
def get_inaccessible_hda_dict( self, trans, hda ):
@@ -892,7 +887,8 @@
# or ( trans.app.security_agent.can_add_library_item( user.all_roles(), item ) ) )
def can_current_user_add_to_library_item( self, trans, item ):
- if not trans.user: return False
+ if not trans.user:
+ return False
return ( ( trans.user_is_admin() )
or ( trans.app.security_agent.can_add_library_item( trans.get_current_user_roles(), item ) ) )
@@ -1411,11 +1407,6 @@
# Get data provider.
track_data_provider = trans.app.data_provider_registry.get_data_provider( trans, original_dataset=dataset )
- if isinstance( dataset, trans.app.model.HistoryDatasetAssociation ):
- hda_ldda = "hda"
- elif isinstance( dataset, trans.app.model.LibraryDatasetDatasetAssociation ):
- hda_ldda = "ldda"
-
# Get track definition.
return {
"track_type": dataset.datatype.track_type,
@@ -1703,7 +1694,7 @@
data['name'] = workflow.name
data['annotation'] = annotation_str
if workflow.uuid is not None:
- data['uuid'] = str(workflow.uuid)
+ data['uuid'] = str(workflow.uuid)
data['steps'] = {}
# For each step, rebuild the form and encode the state
for step in workflow.steps:
@@ -1741,18 +1732,16 @@
step_dict['inputs'] = module.get_runtime_input_dicts( annotation_str )
# User outputs
step_dict['user_outputs'] = []
- """
- module_outputs = module.get_data_outputs()
- step_outputs = trans.sa_session.query( WorkflowOutput ).filter( step=step )
- for output in step_outputs:
- name = output.output_name
- annotation = ""
- for module_output in module_outputs:
- if module_output.get( 'name', None ) == name:
- output_type = module_output.get( 'extension', '' )
- break
- data['outputs'][name] = { 'name' : name, 'annotation' : annotation, 'type' : output_type }
- """
+# module_outputs = module.get_data_outputs()
+# step_outputs = trans.sa_session.query( WorkflowOutput ).filter( step=step )
+# for output in step_outputs:
+# name = output.output_name
+# annotation = ""
+# for module_output in module_outputs:
+# if module_output.get( 'name', None ) == name:
+# output_type = module_output.get( 'extension', '' )
+# break
+# data['outputs'][name] = { 'name' : name, 'annotation' : annotation, 'type' : output_type }
# All step outputs
step_dict['outputs'] = []
@@ -2137,7 +2126,7 @@
# We need the type of each template field widget
widgets = item.get_template_widgets( trans )
# The list of widgets may include an AddressField which we need to save if it is new
- for index, widget_dict in enumerate( widgets ):
+ for widget_dict in widgets:
widget = widget_dict[ 'widget' ]
if isinstance( widget, AddressField ):
value = util.restore_text( params.get( widget.name, '' ) )
@@ -2218,7 +2207,7 @@
trans.sa_session.flush()
info_association = sra.run
else:
- info_association = assoc.run
+ info_association = assoc.run
else:
info_association = None
if info_association:
@@ -2362,7 +2351,7 @@
def widget_fields_have_contents( self, widgets ):
# Return True if any of the fields in widgets contain contents, widgets is a list of dictionaries that looks something like:
# [{'widget': <galaxy.web.form_builder.TextField object at 0x10867aa10>, 'helptext': 'Field 0 help (Optional)', 'label': 'Field 0'}]
- for i, field in enumerate( widgets ):
+ for field in widgets:
if ( isinstance( field[ 'widget' ], TextArea ) or isinstance( field[ 'widget' ], TextField ) ) and field[ 'widget' ].value:
return True
if isinstance( field[ 'widget' ], SelectField ) and field[ 'widget' ].options:
@@ -2383,7 +2372,7 @@
def clean_field_contents( self, widgets, **kwd ):
field_contents = {}
- for index, widget_dict in enumerate( widgets ):
+ for widget_dict in widgets:
widget = widget_dict[ 'widget' ]
value = kwd.get( widget.name, '' )
if isinstance( widget, CheckboxField ):
@@ -2432,7 +2421,7 @@
'''
params = util.Params( kwd )
values = {}
- for index, field in enumerate( form_definition.fields ):
+ for field in form_definition.fields:
field_type = field[ 'type' ]
field_name = field[ 'name' ]
input_value = params.get( field_name, '' )
@@ -2584,7 +2573,7 @@
if message:
return trans.fill_template( '/sharing_base.mako', item=self.get_item( trans, id ), message=message, status='error' )
user.username = username
- trans.sa_session.flush
+ trans.sa_session.flush()
return self.sharing( trans, id, **kwargs )
@web.expose
@@ -2646,34 +2635,34 @@
@web.require_login( "share Galaxy items" )
def sharing( self, trans, id, **kwargs ):
""" Handle item sharing. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
@web.expose
@web.require_login( "share Galaxy items" )
def share( self, trans, id=None, email="", **kwd ):
""" Handle sharing an item with a particular user. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
@web.expose
def display_by_username_and_slug( self, trans, username, slug ):
""" Display item by username and slug. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
@web.json
@web.require_login( "get item name and link" )
def get_name_and_link_async( self, trans, id=None ):
""" Returns item's name and link. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
@web.expose
@web.require_login("get item content asynchronously")
def get_item_content_async( self, trans, id ):
""" Returns item content in HTML format. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
def get_item( self, trans, id ):
""" Return item based on id. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
class UsesQuotaMixin( object ):
@@ -2690,7 +2679,7 @@
def _get_user_tags( self, trans, item_class_name, id ):
user = trans.user
tagged_item = self._get_tagged_item( trans, item_class_name, id )
- return [ tag for tag in tagged_item.tags if ( tag.user == user ) ]
+ return [ tag for tag in tagged_item.tags if tag.user == user ]
def _get_tagged_item( self, trans, item_class_name, id, check_ownership=True ):
tagged_item = self.get_object( trans, id, item_class_name, check_ownership=check_ownership, check_accessible=True )
@@ -2754,7 +2743,6 @@
return sorted( tags )
-
class UsesExtendedMetadataMixin( SharableItemSecurityMixin ):
""" Mixin for getting and setting item extended metadata. """
@@ -2844,10 +2832,10 @@
yield prefix, ("%s" % (meta)).encode("utf8", errors='replace')
-"""
-Deprecated: `BaseController` used to be available under the name `Root`
-"""
class ControllerUnavailable( Exception ):
+ """
+ Deprecated: `BaseController` used to be available under the name `Root`
+ """
pass
## ---- Utility methods -------------------------------------------------------
diff -r 636f0fff006148e875f55bab684821cc60b0630f -r e14c29154b8ac2ce85aacbe8435b8b73108c8464 lib/galaxy/webapps/galaxy/api/histories.py
--- a/lib/galaxy/webapps/galaxy/api/histories.py
+++ b/lib/galaxy/webapps/galaxy/api/histories.py
@@ -92,7 +92,7 @@
:rtype: dictionary
:returns: detailed history information from
- :func:`galaxy.web.base.controller.UsesHistoryDatasetAssociationMixin.get_history_dict`
+ :func:`galaxy.web.base.controller.UsesHistoryMixin.get_history_dict`
"""
history_id = id
deleted = string_as_bool( deleted )
diff -r 636f0fff006148e875f55bab684821cc60b0630f -r e14c29154b8ac2ce85aacbe8435b8b73108c8464 lib/galaxy/webapps/galaxy/api/lda_datasets.py
--- a/lib/galaxy/webapps/galaxy/api/lda_datasets.py
+++ b/lib/galaxy/webapps/galaxy/api/lda_datasets.py
@@ -480,7 +480,7 @@
tool.update_state( trans, tool.inputs_by_page[ 0 ], state.inputs, kwd )
tool_params = state.inputs
dataset_upload_inputs = []
- for input_name, input in tool.inputs.iteritems():
+ for input in tool.inputs.itervalues():
if input.type == "upload_dataset":
dataset_upload_inputs.append( input )
library_bunch = upload_common.handle_library_params( trans, {}, trans.security.encode_id( folder.id ) )
@@ -536,7 +536,7 @@
* POST /api/libraries/datasets/download/{format}
Downloads requested datasets (identified by encoded IDs) in requested format.
- example: ``GET localhost:8080/api/libraries/datasets/download/tbz?ldda_ids%255B%255D=a0d84b45643a2678&ldda_ids%255B%255D=fe38c84dcd46c828``
+ example: ``GET localhost:8080/api/libraries/datasets/download/tbz?ld_ids%255B%255D=a0d84b45643a2678&ld_ids%255B%255D=fe38c84dcd46c828``
.. note:: supported format values are: 'zip', 'tgz', 'tbz', 'uncompressed'
@@ -554,7 +554,7 @@
datasets_to_download = kwd.get( 'ld_ids%5B%5D', None )
if datasets_to_download is None:
datasets_to_download = kwd.get( 'ld_ids', None )
- if ( datasets_to_download is not None ):
+ if datasets_to_download is not None:
datasets_to_download = util.listify( datasets_to_download )
for dataset_id in datasets_to_download:
try:
@@ -570,128 +570,128 @@
raise exceptions.RequestParameterMissingException( 'Request has to contain a list of dataset ids to download.' )
if format in [ 'zip', 'tgz', 'tbz' ]:
- # error = False
- killme = string.punctuation + string.whitespace
- trantab = string.maketrans( killme, '_'*len( killme ) )
- try:
- outext = 'zip'
- if format == 'zip':
- # Can't use mkstemp - the file must not exist first
- tmpd = tempfile.mkdtemp()
- util.umask_fix_perms( tmpd, trans.app.config.umask, 0777, self.app.config.gid )
- tmpf = os.path.join( tmpd, 'library_download.' + format )
- if trans.app.config.upstream_gzip:
- archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_STORED, True )
+ # error = False
+ killme = string.punctuation + string.whitespace
+ trantab = string.maketrans( killme, '_'*len( killme ) )
+ try:
+ outext = 'zip'
+ if format == 'zip':
+ # Can't use mkstemp - the file must not exist first
+ tmpd = tempfile.mkdtemp()
+ util.umask_fix_perms( tmpd, trans.app.config.umask, 0777, self.app.config.gid )
+ tmpf = os.path.join( tmpd, 'library_download.' + format )
+ if trans.app.config.upstream_gzip:
+ archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_STORED, True )
+ else:
+ archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_DEFLATED, True )
+ archive.add = lambda x, y: archive.write( x, y.encode( 'CP437' ) )
+ elif format == 'tgz':
+ if trans.app.config.upstream_gzip:
+ archive = StreamBall( 'w|' )
+ outext = 'tar'
+ else:
+ archive = StreamBall( 'w|gz' )
+ outext = 'tgz'
+ elif format == 'tbz':
+ archive = StreamBall( 'w|bz2' )
+ outext = 'tbz2'
+ except ( OSError, zipfile.BadZipfile ):
+ log.exception( "Unable to create archive for download" )
+ raise exceptions.InternalServerError( "Unable to create archive for download." )
+ except Exception:
+ log.exception( "Unexpected error %s in create archive for download" % sys.exc_info()[ 0 ] )
+ raise exceptions.InternalServerError( "Unable to create archive for download." )
+ composite_extensions = trans.app.datatypes_registry.get_composite_extensions()
+ seen = []
+ for ld in library_datasets:
+ ldda = ld.library_dataset_dataset_association
+ ext = ldda.extension
+ is_composite = ext in composite_extensions
+ path = ""
+ parent_folder = ldda.library_dataset.folder
+ while parent_folder is not None:
+ # Exclude the now-hidden "root folder"
+ if parent_folder.parent is None:
+ path = os.path.join( parent_folder.library_root[ 0 ].name, path )
+ break
+ path = os.path.join( parent_folder.name, path )
+ parent_folder = parent_folder.parent
+ path += ldda.name
+ while path in seen:
+ path += '_'
+ seen.append( path )
+ zpath = os.path.split(path)[ -1 ] # comes as base_name/fname
+ outfname, zpathext = os.path.splitext( zpath )
+
+ if is_composite: # need to add all the components from the extra_files_path to the zip
+ if zpathext == '':
+ zpath = '%s.html' % zpath # fake the real nature of the html file
+ try:
+ if format == 'zip':
+ archive.add( ldda.dataset.file_name, zpath ) # add the primary of a composite set
else:
- archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_DEFLATED, True )
- archive.add = lambda x, y: archive.write( x, y.encode( 'CP437' ) )
- elif format == 'tgz':
- if trans.app.config.upstream_gzip:
- archive = StreamBall( 'w|' )
- outext = 'tar'
- else:
- archive = StreamBall( 'w|gz' )
- outext = 'tgz'
- elif format == 'tbz':
- archive = StreamBall( 'w|bz2' )
- outext = 'tbz2'
- except ( OSError, zipfile.BadZipfile ):
- log.exception( "Unable to create archive for download" )
- raise exceptions.InternalServerError( "Unable to create archive for download." )
- except Exception:
- log.exception( "Unexpected error %s in create archive for download" % sys.exc_info()[ 0 ] )
- raise exceptions.InternalServerError( "Unable to create archive for download." )
- composite_extensions = trans.app.datatypes_registry.get_composite_extensions()
- seen = []
- for ld in library_datasets:
- ldda = ld.library_dataset_dataset_association
- ext = ldda.extension
- is_composite = ext in composite_extensions
- path = ""
- parent_folder = ldda.library_dataset.folder
- while parent_folder is not None:
- # Exclude the now-hidden "root folder"
- if parent_folder.parent is None:
- path = os.path.join( parent_folder.library_root[ 0 ].name, path )
- break
- path = os.path.join( parent_folder.name, path )
- parent_folder = parent_folder.parent
- path += ldda.name
- while path in seen:
- path += '_'
- seen.append( path )
- zpath = os.path.split(path)[ -1 ] # comes as base_name/fname
- outfname, zpathext = os.path.splitext( zpath )
+ archive.add( ldda.dataset.file_name, zpath, check_file=True ) # add the primary of a composite set
+ except IOError:
+ log.exception( "Unable to add composite parent %s to temporary library download archive" % ldda.dataset.file_name )
+ raise exceptions.InternalServerError( "Unable to create archive for download." )
+ except ObjectNotFound:
+ log.exception( "Requested dataset %s does not exist on the host." % ldda.dataset.file_name )
+ raise exceptions.ObjectNotFound( "Requested dataset not found. " )
+ except Exception, e:
+ log.exception( "Unable to add composite parent %s to temporary library download archive" % ldda.dataset.file_name )
+ raise exceptions.InternalServerError( "Unable to add composite parent to temporary library download archive. " + str( e ) )
- if is_composite: # need to add all the components from the extra_files_path to the zip
- if zpathext == '':
- zpath = '%s.html' % zpath # fake the real nature of the html file
+ flist = glob.glob(os.path.join(ldda.dataset.extra_files_path, '*.*')) # glob returns full paths
+ for fpath in flist:
+ efp, fname = os.path.split(fpath)
+ if fname > '':
+ fname = fname.translate(trantab)
try:
if format == 'zip':
- archive.add( ldda.dataset.file_name, zpath ) # add the primary of a composite set
+ archive.add( fpath, fname )
else:
- archive.add( ldda.dataset.file_name, zpath, check_file=True ) # add the primary of a composite set
+ archive.add( fpath, fname, check_file=True )
except IOError:
- log.exception( "Unable to add composite parent %s to temporary library download archive" % ldda.dataset.file_name )
+ log.exception( "Unable to add %s to temporary library download archive %s" % ( fname, outfname) )
raise exceptions.InternalServerError( "Unable to create archive for download." )
except ObjectNotFound:
- log.exception( "Requested dataset %s does not exist on the host." % ldda.dataset.file_name )
- raise exceptions.ObjectNotFound( "Requested dataset not found. " )
- except Exception, e:
- log.exception( "Unable to add composite parent %s to temporary library download archive" % ldda.dataset.file_name )
- raise exceptions.InternalServerError( "Unable to add composite parent to temporary library download archive. " + str( e ) )
-
- flist = glob.glob(os.path.join(ldda.dataset.extra_files_path, '*.*')) # glob returns full paths
- for fpath in flist:
- efp, fname = os.path.split(fpath)
- if fname > '':
- fname = fname.translate(trantab)
- try:
- if format == 'zip':
- archive.add( fpath, fname )
- else:
- archive.add( fpath, fname, check_file=True )
- except IOError:
- log.exception( "Unable to add %s to temporary library download archive %s" % ( fname, outfname) )
- raise exceptions.InternalServerError( "Unable to create archive for download." )
- except ObjectNotFound:
- log.exception( "Requested dataset %s does not exist on the host." % fpath )
- raise exceptions.ObjectNotFound( "Requested dataset not found." )
- except Exception, e:
- log.exception( "Unable to add %s to temporary library download archive %s" % ( fname, outfname ) )
- raise exceptions.InternalServerError( "Unable to add dataset to temporary library download archive . " + str( e ) )
-
- else: # simple case
- try:
- if format == 'zip':
- archive.add( ldda.dataset.file_name, path )
- else:
- archive.add( ldda.dataset.file_name, path, check_file=True )
- except IOError:
- log.exception( "Unable to write %s to temporary library download archive" % ldda.dataset.file_name )
- raise exceptions.InternalServerError( "Unable to create archive for download" )
- except ObjectNotFound:
- log.exception( "Requested dataset %s does not exist on the host." % ldda.dataset.file_name )
+ log.exception( "Requested dataset %s does not exist on the host." % fpath )
raise exceptions.ObjectNotFound( "Requested dataset not found." )
except Exception, e:
log.exception( "Unable to add %s to temporary library download archive %s" % ( fname, outfname ) )
- raise exceptions.InternalServerError( "Unknown error. " + str( e ) )
- lname = 'selected_dataset'
- fname = lname.replace( ' ', '_' ) + '_files'
- if format == 'zip':
- archive.close()
- trans.response.set_content_type( "application/octet-stream" )
- trans.response.headers[ "Content-Disposition" ] = 'attachment; filename="%s.%s"' % ( fname, outext )
- archive = util.streamball.ZipBall( tmpf, tmpd )
- archive.wsgi_status = trans.response.wsgi_status()
- archive.wsgi_headeritems = trans.response.wsgi_headeritems()
- return archive.stream
- else:
- trans.response.set_content_type( "application/x-tar" )
- trans.response.headers[ "Content-Disposition" ] = 'attachment; filename="%s.%s"' % ( fname, outext )
- archive.wsgi_status = trans.response.wsgi_status()
- archive.wsgi_headeritems = trans.response.wsgi_headeritems()
- return archive.stream
+ raise exceptions.InternalServerError( "Unable to add dataset to temporary library download archive . " + str( e ) )
+
+ else: # simple case
+ try:
+ if format == 'zip':
+ archive.add( ldda.dataset.file_name, path )
+ else:
+ archive.add( ldda.dataset.file_name, path, check_file=True )
+ except IOError:
+ log.exception( "Unable to write %s to temporary library download archive" % ldda.dataset.file_name )
+ raise exceptions.InternalServerError( "Unable to create archive for download" )
+ except ObjectNotFound:
+ log.exception( "Requested dataset %s does not exist on the host." % ldda.dataset.file_name )
+ raise exceptions.ObjectNotFound( "Requested dataset not found." )
+ except Exception, e:
+ log.exception( "Unable to add %s to temporary library download archive %s" % ( fname, outfname ) )
+ raise exceptions.InternalServerError( "Unknown error. " + str( e ) )
+ lname = 'selected_dataset'
+ fname = lname.replace( ' ', '_' ) + '_files'
+ if format == 'zip':
+ archive.close()
+ trans.response.set_content_type( "application/octet-stream" )
+ trans.response.headers[ "Content-Disposition" ] = 'attachment; filename="%s.%s"' % ( fname, outext )
+ archive = util.streamball.ZipBall( tmpf, tmpd )
+ archive.wsgi_status = trans.response.wsgi_status()
+ archive.wsgi_headeritems = trans.response.wsgi_headeritems()
+ return archive.stream
+ else:
+ trans.response.set_content_type( "application/x-tar" )
+ trans.response.headers[ "Content-Disposition" ] = 'attachment; filename="%s.%s"' % ( fname, outext )
+ archive.wsgi_status = trans.response.wsgi_status()
+ archive.wsgi_headeritems = trans.response.wsgi_headeritems()
+ return archive.stream
elif format == 'uncompressed':
if len(library_datasets) != 1:
raise exceptions.RequestParameterInvalidException( "You can download only one uncompressed file at once." )
diff -r 636f0fff006148e875f55bab684821cc60b0630f -r e14c29154b8ac2ce85aacbe8435b8b73108c8464 lib/galaxy/webapps/galaxy/api/library_contents.py
--- a/lib/galaxy/webapps/galaxy/api/library_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/library_contents.py
@@ -146,17 +146,21 @@
the HDA's encoded id in ``from_hda_id`` (and optionally ``ldda_message``).
:type library_id: str
- :param library_id: encoded id string of the library that contains this item
+ :param library_id: encoded id string of the library where to create the new item
:type payload: dict
:param payload: dictionary structure containing:
* folder_id: the parent folder of the new item
- * create_type: the type of item to create ('file' or 'folder')
+ * create_type: the type of item to create ('file', 'folder' or 'collection')
* from_hda_id: (optional) the id of an accessible HDA to copy into the
library
* ldda_message: (optional) the new message attribute of the LDDA created
* extended_metadata: (optional) dub-dictionary containing any extended
metadata to associate with the item
+ * link_data_only: (optional) either 'copy_files' (default) or 'link_to_files'
+ * upload_option: (optional) one of 'upload_file' (default), 'upload_directory' or 'upload_paths'
+ * server_dir: (optional) only if upload_option is 'upload_directory'
+ * filesystem_paths: (optional) only if upload_option is 'upload_paths' and the user is an admin
:rtype: dict
:returns: a dictionary containing the id, name,
@@ -217,11 +221,9 @@
return output
else:
rval = []
- for k, v in output.items():
+ for v in output.values():
if ex_meta_payload is not None:
- """
- If there is extended metadata, store it, attach it to the dataset, and index it
- """
+ # If there is extended metadata, store it, attach it to the dataset, and index it
ex_meta = ExtendedMetadata(ex_meta_payload)
trans.sa_session.add( ex_meta )
v.extended_metadata = ex_meta
@@ -343,9 +345,9 @@
trans.sa_session.flush()
def __decode_library_content_id( self, trans, content_id ):
- if ( len( content_id ) % 16 == 0 ):
+ if len( content_id ) % 16 == 0:
return 'LibraryDataset', content_id
- elif ( content_id.startswith( 'F' ) ):
+ elif content_id.startswith( 'F' ):
return 'LibraryFolder', content_id[ 1: ]
else:
raise HTTPBadRequest( 'Malformed library content id ( %s ) specified, unable to decode.' % str( content_id ) )
diff -r 636f0fff006148e875f55bab684821cc60b0630f -r e14c29154b8ac2ce85aacbe8435b8b73108c8464 lib/galaxy/webapps/galaxy/controllers/dataset.py
--- a/lib/galaxy/webapps/galaxy/controllers/dataset.py
+++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py
@@ -1,8 +1,6 @@
import logging
import os
-import tempfile
import urllib
-import zipfile
from galaxy import datatypes, eggs, model, util, web
from galaxy.datatypes.display_applications.util import decode_dataset_user, encode_dataset_user
@@ -43,8 +41,8 @@
accepted_filter_labels_and_vals = { "Active" : "False", "Deleted" : "True", "All": "All" }
accepted_filters = []
for label, val in accepted_filter_labels_and_vals.items():
- args = { self.key: val }
- accepted_filters.append( grids.GridColumnFilter( label, args) )
+ args = { self.key: val }
+ accepted_filters.append( grids.GridColumnFilter( label, args) )
return accepted_filters
# Grid definition
@@ -147,7 +145,7 @@
trans.response.set_content_type( 'text/plain' )
exit_code = ""
try:
- job = self._get_job_for_dataset( dataset_id )
+ job = self._get_job_for_dataset( trans, dataset_id )
exit_code = job.exit_code
except:
exit_code = "Invalid dataset ID or you are not allowed to access this dataset"
@@ -323,40 +321,38 @@
if params.annotation:
annotation = sanitize_html( params.annotation, 'utf-8', 'text/html' )
self.add_item_annotation( trans.sa_session, trans.get_user(), data, annotation )
- """
# This block on controller code is inactive until the 'extended_metadata' edit box is added back into the UI
# Add or delete extended metadata
- if params.extended_metadata:
- em_string = params.extended_metadata
- if len(em_string):
- em_payload = None
- try:
- em_payload = loads(em_string)
- except Exception, e:
- message = 'Invalid JSON input'
- error = True
- if em_payload is not None:
- if data is not None:
- ex_obj = self.get_item_extended_metadata_obj(trans, data)
- if ex_obj is not None:
- self.unset_item_extended_metadata_obj(trans, data)
- self.delete_extended_metadata(trans, ex_obj)
- ex_obj = self.create_extended_metadata(trans, em_payload)
- self.set_item_extended_metadata_obj(trans, data, ex_obj)
- message = "Updated Extended metadata '%s'." % data.name
- status = 'done'
- else:
- message = "data not found"
- error = True
- else:
- if data is not None:
- ex_obj = self.get_item_extended_metadata_obj(trans, data)
- if ex_obj is not None:
- self.unset_item_extended_metadata_obj(trans, data)
- self.delete_extended_metadata(trans, ex_obj)
- message = "Deleted Extended metadata '%s'." % data.name
- status = 'done'
- """
+# if params.extended_metadata:
+# em_string = params.extended_metadata
+# if len(em_string):
+# em_payload = None
+# try:
+# em_payload = loads(em_string)
+# except Exception, e:
+# message = 'Invalid JSON input'
+# error = True
+# if em_payload is not None:
+# if data is not None:
+# ex_obj = self.get_item_extended_metadata_obj(trans, data)
+# if ex_obj is not None:
+# self.unset_item_extended_metadata_obj(trans, data)
+# self.delete_extended_metadata(trans, ex_obj)
+# ex_obj = self.create_extended_metadata(trans, em_payload)
+# self.set_item_extended_metadata_obj(trans, data, ex_obj)
+# message = "Updated Extended metadata '%s'." % data.name
+# status = 'done'
+# else:
+# message = "data not found"
+# error = True
+# else:
+# if data is not None:
+# ex_obj = self.get_item_extended_metadata_obj(trans, data)
+# if ex_obj is not None:
+# self.unset_item_extended_metadata_obj(trans, data)
+# self.delete_extended_metadata(trans, ex_obj)
+# message = "Deleted Extended metadata '%s'." % data.name
+# status = 'done'
# If setting metadata previously failed and all required elements have now been set, clear the failed state.
if data._state == trans.model.Dataset.states.FAILED_METADATA and not data.missing_meta():
@@ -954,13 +950,11 @@
has_parameter_errors = False
inherit_chain = hda.source_dataset_chain
if inherit_chain:
- job_dataset_association, dataset_association_container_name = inherit_chain[-1]
+ job_dataset_association = inherit_chain[-1][0]
else:
job_dataset_association = hda
if job_dataset_association.creating_job_associations:
- for assoc in job_dataset_association.creating_job_associations:
- job = assoc.job
- break
+ job = job_dataset_association.creating_job_associations[0].job
if job:
# Get the tool object
try:
@@ -1024,7 +1018,7 @@
trans.sa_session.flush()
target_history_ids.append( new_history.id )
if user:
- target_histories = [ hist for hist in map( trans.sa_session.query( trans.app.model.History ).get, target_history_ids ) if ( hist is not None and hist.user == user )]
+ target_histories = [ hist for hist in map( trans.sa_session.query( trans.app.model.History ).get, target_history_ids ) if hist is not None and hist.user == user ]
else:
target_histories = [ history ]
if len( target_histories ) != len( target_history_ids ):
diff -r 636f0fff006148e875f55bab684821cc60b0630f -r e14c29154b8ac2ce85aacbe8435b8b73108c8464 lib/galaxy/webapps/galaxy/controllers/library_common.py
--- a/lib/galaxy/webapps/galaxy/controllers/library_common.py
+++ b/lib/galaxy/webapps/galaxy/controllers/library_common.py
@@ -162,6 +162,7 @@
default_action=default_action,
message=util.sanitize_text( message ),
status=status ) )
+
@web.expose
def library_info( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
@@ -222,6 +223,7 @@
inherited=inherited,
message=message,
status=status )
+
@web.expose
def library_permissions( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
@@ -269,6 +271,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def create_folder( self, trans, cntrller, parent_id, library_id, **kwd ):
params = util.Params( kwd )
@@ -346,6 +349,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def folder_info( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
@@ -403,6 +407,7 @@
inherited=inherited,
message=message,
status=status )
+
@web.expose
def folder_permissions( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
@@ -453,6 +458,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def ldda_edit_info( self, trans, cntrller, library_id, folder_id, id, **kwd ):
params = util.Params( kwd )
@@ -606,6 +612,7 @@
inherited=inherited,
message=message,
status=status )
+
@web.expose
def ldda_info( self, trans, cntrller, library_id, folder_id, id, **kwd ):
params = util.Params( kwd )
@@ -655,6 +662,7 @@
inherited=inherited,
message=message,
status=status )
+
@web.expose
def ldda_permissions( self, trans, cntrller, library_id, folder_id, id, **kwd ):
params = util.Params( kwd )
@@ -793,6 +801,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def upload_library_dataset( self, trans, cntrller, library_id, folder_id, **kwd ):
params = util.Params( kwd )
@@ -1042,6 +1051,7 @@
ldda_message=ldda_message,
message=message,
status=status )
+
def upload_dataset( self, trans, cntrller, library_id, folder_id, replace_dataset=None, **kwd ):
# Set up the traditional tool state/params
tool_id = 'upload1'
@@ -1132,6 +1142,7 @@
trans.sa_session.add( job )
trans.sa_session.flush()
return output
+
def make_library_uploaded_dataset( self, trans, cntrller, params, name, path, type, library_bunch, in_folder=None ):
link_data_only = params.get( 'link_data_only', 'copy_files' )
uuid_str = params.get( 'uuid', None )
@@ -1166,6 +1177,7 @@
trans.sa_session.add_all( ( uploaded_dataset.data, uploaded_dataset.data.dataset ) )
trans.sa_session.flush()
return uploaded_dataset
+
def get_server_dir_uploaded_datasets( self, trans, cntrller, params, full_dir, import_dir_desc, library_bunch, response_code, message ):
dir_response = self._get_server_dir_files(params, full_dir, import_dir_desc)
files = dir_response[0]
@@ -1176,6 +1188,7 @@
name = os.path.basename( file )
uploaded_datasets.append( self.make_library_uploaded_dataset( trans, cntrller, params, name, file, 'server_dir', library_bunch ) )
return uploaded_datasets, 200, None
+
def _get_server_dir_files( self, params, full_dir, import_dir_desc ):
files = []
try:
@@ -1212,6 +1225,7 @@
response_code = 400
return None, response_code, message
return files, None, None
+
def get_path_paste_uploaded_datasets( self, trans, cntrller, params, library_bunch, response_code, message ):
preserve_dirs = util.string_as_bool( params.get( 'preserve_dirs', False ) )
uploaded_datasets = []
@@ -1246,6 +1260,7 @@
in_folder = None
files_and_folders.append((file_path, file, in_folder))
return files_and_folders
+
def _paths_list(self, params):
return [ (l.strip(), os.path.abspath(l.strip())) for l in params.filesystem_paths.splitlines() if l.strip() ]
@@ -1463,6 +1478,7 @@
ldda_message=ldda_message,
message=message,
status=status )
+
def _build_roles_select_list( self, trans, cntrller, library, selected_role_ids=[] ):
# Get the list of legitimate roles to display on the upload form. If the library is public,
# all active roles are legitimate. If the library is restricted by the LIBRARY_ACCESS permission, only
@@ -1478,10 +1494,11 @@
return roles_select_list
else:
return None
+
def _build_upload_option_select_list( self, trans, upload_option, is_admin, do_not_include_values=[] ):
# Build the upload_option select list. The do_not_include_values param can contain options that
# should not be included in the list. For example, the 'upload_directory' option should not be
- # included if uploading a new version of a librar dataset.
+ # included if uploading a new version of a library dataset.
upload_refresh_on_change_values = []
for option_value, option_label in trans.model.LibraryDataset.upload_options:
if option_value not in do_not_include_values:
@@ -1508,6 +1525,7 @@
continue
upload_option_select_list.add_option( option_label, option_value, selected=option_value==upload_option )
return upload_option_select_list
+
def _get_populated_widgets( self, folder ):
# See if we have any inherited templates.
info_association, inherited = folder.get_info_association( inherited=True )
@@ -1517,6 +1535,7 @@
return self.populate_widgets_from_kwd( trans, widgets, **kwd )
else:
return []
+
@web.expose
def download_dataset_from_folder( self, trans, cntrller, id, library_id=None, **kwd ):
"""Catches the dataset id and displays file contents as directed"""
@@ -1557,6 +1576,7 @@
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status='error' ) )
+
@web.expose
def library_dataset_info( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
@@ -1606,6 +1626,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def library_dataset_permissions( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
@@ -1654,6 +1675,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def make_library_item_public( self, trans, cntrller, library_id, item_type, id, **kwd ):
params = util.Params( kwd )
@@ -1696,6 +1718,7 @@
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status=status ) )
+
@web.expose
def act_on_multiple_datasets( self, trans, cntrller, library_id=None, ldda_ids='', **kwd ):
# This method is called from 1 of 3 places:
@@ -2113,6 +2136,7 @@
use_panels=use_panels,
message=message,
status=status )
+
@web.expose
def manage_template_inheritance( self, trans, cntrller, item_type, library_id, folder_id=None, ldda_id=None, **kwd ):
params = util.Params( kwd )
@@ -2159,6 +2183,7 @@
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status='done' ) )
+
@web.expose
def move_library_item( self, trans, cntrller, item_type, item_id, source_library_id='', make_target_current=True, **kwd ):
# This method is called from one of the following places:
@@ -2374,6 +2399,7 @@
use_panels=use_panels,
message=message,
status=status )
+
@web.expose
def delete_library_item( self, trans, cntrller, library_id, item_id, item_type, **kwd ):
# This action will handle deleting all types of library items. State is saved for libraries and
@@ -2441,6 +2467,7 @@
show_deleted=show_deleted,
message=message,
status=status ) )
+
@web.expose
def undelete_library_item( self, trans, cntrller, library_id, item_id, item_type, **kwd ):
# This action will handle undeleting all types of library items
@@ -2509,6 +2536,7 @@
show_deleted=show_deleted,
message=message,
status=status ) )
+
def _check_access( self, trans, cntrller, is_admin, item, current_user_roles, use_panels, library_id, show_deleted ):
can_access = True
if isinstance( item, trans.model.HistoryDatasetAssociation ):
@@ -2551,6 +2579,7 @@
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status='error' ) )
+
def _check_add( self, trans, cntrller, is_admin, item, current_user_roles, use_panels, library_id, show_deleted ):
# Deny access if the user is not an admin and does not have the LIBRARY_ADD permission.
if not ( is_admin or trans.app.security_agent.can_add_library_item( current_user_roles, item ) ):
@@ -2566,6 +2595,7 @@
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status='error' ) )
+
def _check_manage( self, trans, cntrller, is_admin, item, current_user_roles, use_panels, library_id, show_deleted ):
if isinstance( item, trans.model.LibraryDataset ):
# Deny access if the user is not an admin and does not have the LIBRARY_MANAGE and DATASET_MANAGE_PERMISSIONS permissions.
@@ -2594,6 +2624,7 @@
use_panels=use_panels,
message=util.sanitize_text( message ),
status='error' ) )
+
def _check_modify( self, trans, cntrller, is_admin, item, current_user_roles, use_panels, library_id, show_deleted ):
# Deny modification if the user is not an admin and does not have the LIBRARY_MODIFY permission.
if not ( is_admin or trans.app.security_agent.can_modify_library_item( current_user_roles, item ) ):
@@ -2619,6 +2650,7 @@
.options( eagerload_all( "actions" ) ) \
.order_by( trans.app.model.LibraryFolder.table.c.name ) \
.all()
+
def activatable_folders( trans, folder ):
return trans.sa_session.query( trans.app.model.LibraryFolder ) \
.filter_by( parent=folder, purged=False ) \
@@ -2685,6 +2717,7 @@
if folder.parent:
return branch_deleted( folder.parent )
return False
+
def get_containing_library_from_library_dataset( trans, library_dataset ):
"""Given a library_dataset, get the containing library"""
folder = library_dataset.folder
@@ -2698,6 +2731,7 @@
if library.root_folder == folder:
return library
return None
+
def get_comptypes( trans ):
comptypes_t = comptypes
if trans.app.config.nginx_x_archive_files_base:
@@ -2710,6 +2744,7 @@
except:
pass
return comptypes_t
+
def get_sorted_accessible_library_items( trans, cntrller, items, sort_attr ):
is_admin = trans.user_is_admin() and cntrller == 'library_admin'
if is_admin:
@@ -2723,6 +2758,7 @@
accessible_items.append( item )
# Sort by name
return sort_by_attr( [ item for item in accessible_items ], sort_attr )
+
def sort_by_attr( seq, attr ):
"""
Sort the sequence of objects by object's attribute
@@ -2738,6 +2774,7 @@
intermed = map( None, map( getattr, seq, ( attr, ) * len( seq ) ), xrange( len( seq ) ), seq )
intermed.sort()
return map( operator.getitem, intermed, ( -1, ) * len( intermed ) )
+
def lucene_search( trans, cntrller, search_term, search_url, **kwd ):
"""Return display of results from a full-text lucene search of data libraries."""
params = util.Params( kwd )
@@ -2749,6 +2786,7 @@
response.close()
lddas = [ trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( ldda_id ) for ldda_id in ldda_ids ]
return status, message, get_sorted_accessible_library_items( trans, cntrller, lddas, 'name' )
+
def whoosh_search( trans, cntrller, search_term, **kwd ):
"""Return display of results from a full-text whoosh search of data libraries."""
params = util.Params( kwd )
https://bitbucket.org/galaxy/galaxy-central/commits/a3ebaac5d312/
Changeset: a3ebaac5d312
User: jmchilton
Date: 2014-11-10 16:04:02+00:00
Summary: Merged in nsoranzo/galaxy-central (pull request #551)
Small bugs, doc and pylint fixes.
Affected #: 9 files
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/util/bunch.py
--- a/lib/galaxy/util/bunch.py
+++ b/lib/galaxy/util/bunch.py
@@ -17,6 +17,12 @@
def items(self):
return self.__dict__.items()
+ def keys(self):
+ return self.__dict__.keys()
+
+ def values(self):
+ return self.__dict__.values()
+
def __str__(self):
return '%s' % self.__dict__
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/web/base/controller.py
--- a/lib/galaxy/web/base/controller.py
+++ b/lib/galaxy/web/base/controller.py
@@ -13,7 +13,6 @@
from paste.httpexceptions import HTTPBadRequest, HTTPInternalServerError
from paste.httpexceptions import HTTPNotImplemented, HTTPRequestRangeNotSatisfiable
-from galaxy import exceptions
from galaxy.exceptions import ItemAccessibilityException, ItemDeletionException, ItemOwnershipException
from galaxy.exceptions import MessageException
@@ -27,7 +26,7 @@
from galaxy.web.form_builder import AddressField, CheckboxField, SelectField, TextArea, TextField
from galaxy.web.form_builder import build_select_field, HistoryField, PasswordField, WorkflowField, WorkflowMappingField
from galaxy.workflow.modules import module_factory, WorkflowModuleInjector, MissingToolException
-from galaxy.model.orm import eagerload, eagerload_all, desc, not_
+from galaxy.model.orm import eagerload, eagerload_all, desc
from galaxy.security.validate_user_input import validate_publicname
from galaxy.util.sanitize_html import sanitize_html
from galaxy.model.item_attrs import Dictifiable, UsesAnnotations
@@ -85,7 +84,7 @@
Convenience method to get a model object with the specified checks.
"""
return managers_base.get_object( trans, id, class_name, check_ownership=check_ownership, check_accessible=check_accessible, deleted=deleted )
-
+
# this should be here - but catching errors from sharable item controllers that *should* have SharableItemMixin
# but *don't* then becomes difficult
#def security_check( self, trans, item, check_ownership=False, check_accessible=False ):
@@ -322,7 +321,7 @@
# Initialize count dict with all states.
state_count_dict = {}
- for k, state in trans.app.model.Dataset.states.items():
+ for state in trans.app.model.Dataset.states.values():
state_count_dict[ state ] = 0
# Process query results, adding to count dict.
@@ -370,7 +369,7 @@
# init counts, ids for each state
state_counts = {}
state_ids = {}
- for key, state in trans.app.model.Dataset.states.items():
+ for state in trans.app.model.Dataset.states.values():
state_counts[ state ] = 0
state_ids[ state ] = []
@@ -566,7 +565,7 @@
# DEPRECATION: We still support unencoded ids for backward compatibility
try:
dataset_id = int( dataset_id )
- except ValueError, v_err:
+ except ValueError:
raise HTTPBadRequest( "Invalid dataset id: %s." % str( dataset_id ) )
try:
@@ -589,7 +588,7 @@
error( "You are not allowed to access this dataset" )
if check_state and data.state == trans.model.Dataset.states.UPLOAD:
- return trans.show_error_message( "Please wait until this dataset finishes uploading "
+ return trans.show_error_message( "Please wait until this dataset finishes uploading "
+ "before attempting to view it." )
return data
@@ -651,7 +650,7 @@
check_ownership=check_ownership,
check_accessible=check_accessible,
check_state=check_state )
- except Exception, exception:
+ except Exception:
pass
hdas.append( hda )
return hdas
@@ -711,7 +710,7 @@
# ---- return here if deleted AND purged OR can't access
purged = ( hda.purged or hda.dataset.purged )
- if ( hda.deleted and purged ):
+ if hda.deleted and purged:
#TODO: to_dict should really go AFTER this - only summary data
return trans.security.encode_dict_ids( hda_dict )
@@ -747,10 +746,6 @@
#TODO: it may also be wiser to remove from here and add as API call that loads the visualizations
# when the visualizations button is clicked (instead of preloading/pre-checking)
- # ---- return here if deleted
- if hda.deleted and not purged:
- return trans.security.encode_dict_ids( hda_dict )
-
return trans.security.encode_dict_ids( hda_dict )
def get_inaccessible_hda_dict( self, trans, hda ):
@@ -892,7 +887,8 @@
# or ( trans.app.security_agent.can_add_library_item( user.all_roles(), item ) ) )
def can_current_user_add_to_library_item( self, trans, item ):
- if not trans.user: return False
+ if not trans.user:
+ return False
return ( ( trans.user_is_admin() )
or ( trans.app.security_agent.can_add_library_item( trans.get_current_user_roles(), item ) ) )
@@ -1411,11 +1407,6 @@
# Get data provider.
track_data_provider = trans.app.data_provider_registry.get_data_provider( trans, original_dataset=dataset )
- if isinstance( dataset, trans.app.model.HistoryDatasetAssociation ):
- hda_ldda = "hda"
- elif isinstance( dataset, trans.app.model.LibraryDatasetDatasetAssociation ):
- hda_ldda = "ldda"
-
# Get track definition.
return {
"track_type": dataset.datatype.track_type,
@@ -1705,7 +1696,7 @@
data['name'] = workflow.name
data['annotation'] = annotation_str
if workflow.uuid is not None:
- data['uuid'] = str(workflow.uuid)
+ data['uuid'] = str(workflow.uuid)
data['steps'] = {}
# For each step, rebuild the form and encode the state
for step in workflow.steps:
@@ -1743,18 +1734,16 @@
step_dict['inputs'] = module.get_runtime_input_dicts( annotation_str )
# User outputs
step_dict['user_outputs'] = []
- """
- module_outputs = module.get_data_outputs()
- step_outputs = trans.sa_session.query( WorkflowOutput ).filter( step=step )
- for output in step_outputs:
- name = output.output_name
- annotation = ""
- for module_output in module_outputs:
- if module_output.get( 'name', None ) == name:
- output_type = module_output.get( 'extension', '' )
- break
- data['outputs'][name] = { 'name' : name, 'annotation' : annotation, 'type' : output_type }
- """
+# module_outputs = module.get_data_outputs()
+# step_outputs = trans.sa_session.query( WorkflowOutput ).filter( step=step )
+# for output in step_outputs:
+# name = output.output_name
+# annotation = ""
+# for module_output in module_outputs:
+# if module_output.get( 'name', None ) == name:
+# output_type = module_output.get( 'extension', '' )
+# break
+# data['outputs'][name] = { 'name' : name, 'annotation' : annotation, 'type' : output_type }
# All step outputs
step_dict['outputs'] = []
@@ -2139,7 +2128,7 @@
# We need the type of each template field widget
widgets = item.get_template_widgets( trans )
# The list of widgets may include an AddressField which we need to save if it is new
- for index, widget_dict in enumerate( widgets ):
+ for widget_dict in widgets:
widget = widget_dict[ 'widget' ]
if isinstance( widget, AddressField ):
value = util.restore_text( params.get( widget.name, '' ) )
@@ -2220,7 +2209,7 @@
trans.sa_session.flush()
info_association = sra.run
else:
- info_association = assoc.run
+ info_association = assoc.run
else:
info_association = None
if info_association:
@@ -2364,7 +2353,7 @@
def widget_fields_have_contents( self, widgets ):
# Return True if any of the fields in widgets contain contents, widgets is a list of dictionaries that looks something like:
# [{'widget': <galaxy.web.form_builder.TextField object at 0x10867aa10>, 'helptext': 'Field 0 help (Optional)', 'label': 'Field 0'}]
- for i, field in enumerate( widgets ):
+ for field in widgets:
if ( isinstance( field[ 'widget' ], TextArea ) or isinstance( field[ 'widget' ], TextField ) ) and field[ 'widget' ].value:
return True
if isinstance( field[ 'widget' ], SelectField ) and field[ 'widget' ].options:
@@ -2385,7 +2374,7 @@
def clean_field_contents( self, widgets, **kwd ):
field_contents = {}
- for index, widget_dict in enumerate( widgets ):
+ for widget_dict in widgets:
widget = widget_dict[ 'widget' ]
value = kwd.get( widget.name, '' )
if isinstance( widget, CheckboxField ):
@@ -2434,7 +2423,7 @@
'''
params = util.Params( kwd )
values = {}
- for index, field in enumerate( form_definition.fields ):
+ for field in form_definition.fields:
field_type = field[ 'type' ]
field_name = field[ 'name' ]
input_value = params.get( field_name, '' )
@@ -2586,7 +2575,7 @@
if message:
return trans.fill_template( '/sharing_base.mako', item=self.get_item( trans, id ), message=message, status='error' )
user.username = username
- trans.sa_session.flush
+ trans.sa_session.flush()
return self.sharing( trans, id, **kwargs )
@web.expose
@@ -2648,34 +2637,34 @@
@web.require_login( "share Galaxy items" )
def sharing( self, trans, id, **kwargs ):
""" Handle item sharing. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
@web.expose
@web.require_login( "share Galaxy items" )
def share( self, trans, id=None, email="", **kwd ):
""" Handle sharing an item with a particular user. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
@web.expose
def display_by_username_and_slug( self, trans, username, slug ):
""" Display item by username and slug. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
@web.json
@web.require_login( "get item name and link" )
def get_name_and_link_async( self, trans, id=None ):
""" Returns item's name and link. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
@web.expose
@web.require_login("get item content asynchronously")
def get_item_content_async( self, trans, id ):
""" Returns item content in HTML format. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
def get_item( self, trans, id ):
""" Return item based on id. """
- raise "Unimplemented Method"
+ raise NotImplementedError()
class UsesQuotaMixin( object ):
@@ -2692,7 +2681,7 @@
def _get_user_tags( self, trans, item_class_name, id ):
user = trans.user
tagged_item = self._get_tagged_item( trans, item_class_name, id )
- return [ tag for tag in tagged_item.tags if ( tag.user == user ) ]
+ return [ tag for tag in tagged_item.tags if tag.user == user ]
def _get_tagged_item( self, trans, item_class_name, id, check_ownership=True ):
tagged_item = self.get_object( trans, id, item_class_name, check_ownership=check_ownership, check_accessible=True )
@@ -2756,7 +2745,6 @@
return sorted( tags )
-
class UsesExtendedMetadataMixin( SharableItemSecurityMixin ):
""" Mixin for getting and setting item extended metadata. """
@@ -2846,10 +2834,10 @@
yield prefix, ("%s" % (meta)).encode("utf8", errors='replace')
-"""
-Deprecated: `BaseController` used to be available under the name `Root`
-"""
class ControllerUnavailable( Exception ):
+ """
+ Deprecated: `BaseController` used to be available under the name `Root`
+ """
pass
## ---- Utility methods -------------------------------------------------------
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/web/framework/webapp.py
--- a/lib/galaxy/web/framework/webapp.py
+++ b/lib/galaxy/web/framework/webapp.py
@@ -504,9 +504,9 @@
for char in filter( lambda x: x not in string.ascii_lowercase + string.digits + '-', username ):
username = username.replace( char, '-' )
# Find a unique username - user can change it later
- if ( self.sa_session.query( self.app.model.User ).filter_by( username=username ).first() ):
+ if self.sa_session.query( self.app.model.User ).filter_by( username=username ).first():
i = 1
- while ( self.sa_session.query( self.app.model.User ).filter_by( username=(username + '-' + str(i) ) ).first() ):
+ while self.sa_session.query( self.app.model.User ).filter_by( username=(username + '-' + str(i) ) ).first():
i += 1
username += '-' + str(i)
user.username = username
@@ -701,11 +701,6 @@
def template_context( self ):
return dict()
- def make_form_data( self, name, **kwargs ):
- rval = self.template_context[name] = FormData()
- rval.values.update( kwargs )
- return rval
-
def set_message( self, message, type=None ):
"""
Convenience method for setting the 'message' and 'message_type'
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/webapps/demo_sequencer/framework/__init__.py
--- a/lib/galaxy/webapps/demo_sequencer/framework/__init__.py
+++ b/lib/galaxy/webapps/demo_sequencer/framework/__init__.py
@@ -116,10 +116,7 @@
@galaxy.web.framework.base.lazy_property
def template_context( self ):
return dict()
- def make_form_data( self, name, **kwargs ):
- rval = self.template_context[name] = FormData()
- rval.values.update( kwargs )
- return rval
+
def set_message( self, message, type=None ):
"""
Convenience method for setting the 'message' and 'message_type'
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/webapps/galaxy/api/histories.py
--- a/lib/galaxy/webapps/galaxy/api/histories.py
+++ b/lib/galaxy/webapps/galaxy/api/histories.py
@@ -92,7 +92,7 @@
:rtype: dictionary
:returns: detailed history information from
- :func:`galaxy.web.base.controller.UsesHistoryDatasetAssociationMixin.get_history_dict`
+ :func:`galaxy.web.base.controller.UsesHistoryMixin.get_history_dict`
"""
history_id = id
deleted = string_as_bool( deleted )
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/webapps/galaxy/api/lda_datasets.py
--- a/lib/galaxy/webapps/galaxy/api/lda_datasets.py
+++ b/lib/galaxy/webapps/galaxy/api/lda_datasets.py
@@ -480,7 +480,7 @@
tool.update_state( trans, tool.inputs_by_page[ 0 ], state.inputs, kwd )
tool_params = state.inputs
dataset_upload_inputs = []
- for input_name, input in tool.inputs.iteritems():
+ for input in tool.inputs.itervalues():
if input.type == "upload_dataset":
dataset_upload_inputs.append( input )
library_bunch = upload_common.handle_library_params( trans, {}, trans.security.encode_id( folder.id ) )
@@ -536,7 +536,7 @@
* POST /api/libraries/datasets/download/{format}
Downloads requested datasets (identified by encoded IDs) in requested format.
- example: ``GET localhost:8080/api/libraries/datasets/download/tbz?ldda_ids%255B%255D=a0d84b45643a2678&ldda_ids%255B%255D=fe38c84dcd46c828``
+ example: ``GET localhost:8080/api/libraries/datasets/download/tbz?ld_ids%255B%255D=a0d84b45643a2678&ld_ids%255B%255D=fe38c84dcd46c828``
.. note:: supported format values are: 'zip', 'tgz', 'tbz', 'uncompressed'
@@ -554,7 +554,7 @@
datasets_to_download = kwd.get( 'ld_ids%5B%5D', None )
if datasets_to_download is None:
datasets_to_download = kwd.get( 'ld_ids', None )
- if ( datasets_to_download is not None ):
+ if datasets_to_download is not None:
datasets_to_download = util.listify( datasets_to_download )
for dataset_id in datasets_to_download:
try:
@@ -570,128 +570,128 @@
raise exceptions.RequestParameterMissingException( 'Request has to contain a list of dataset ids to download.' )
if format in [ 'zip', 'tgz', 'tbz' ]:
- # error = False
- killme = string.punctuation + string.whitespace
- trantab = string.maketrans( killme, '_'*len( killme ) )
- try:
- outext = 'zip'
- if format == 'zip':
- # Can't use mkstemp - the file must not exist first
- tmpd = tempfile.mkdtemp()
- util.umask_fix_perms( tmpd, trans.app.config.umask, 0777, self.app.config.gid )
- tmpf = os.path.join( tmpd, 'library_download.' + format )
- if trans.app.config.upstream_gzip:
- archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_STORED, True )
+ # error = False
+ killme = string.punctuation + string.whitespace
+ trantab = string.maketrans( killme, '_'*len( killme ) )
+ try:
+ outext = 'zip'
+ if format == 'zip':
+ # Can't use mkstemp - the file must not exist first
+ tmpd = tempfile.mkdtemp()
+ util.umask_fix_perms( tmpd, trans.app.config.umask, 0777, self.app.config.gid )
+ tmpf = os.path.join( tmpd, 'library_download.' + format )
+ if trans.app.config.upstream_gzip:
+ archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_STORED, True )
+ else:
+ archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_DEFLATED, True )
+ archive.add = lambda x, y: archive.write( x, y.encode( 'CP437' ) )
+ elif format == 'tgz':
+ if trans.app.config.upstream_gzip:
+ archive = StreamBall( 'w|' )
+ outext = 'tar'
+ else:
+ archive = StreamBall( 'w|gz' )
+ outext = 'tgz'
+ elif format == 'tbz':
+ archive = StreamBall( 'w|bz2' )
+ outext = 'tbz2'
+ except ( OSError, zipfile.BadZipfile ):
+ log.exception( "Unable to create archive for download" )
+ raise exceptions.InternalServerError( "Unable to create archive for download." )
+ except Exception:
+ log.exception( "Unexpected error %s in create archive for download" % sys.exc_info()[ 0 ] )
+ raise exceptions.InternalServerError( "Unable to create archive for download." )
+ composite_extensions = trans.app.datatypes_registry.get_composite_extensions()
+ seen = []
+ for ld in library_datasets:
+ ldda = ld.library_dataset_dataset_association
+ ext = ldda.extension
+ is_composite = ext in composite_extensions
+ path = ""
+ parent_folder = ldda.library_dataset.folder
+ while parent_folder is not None:
+ # Exclude the now-hidden "root folder"
+ if parent_folder.parent is None:
+ path = os.path.join( parent_folder.library_root[ 0 ].name, path )
+ break
+ path = os.path.join( parent_folder.name, path )
+ parent_folder = parent_folder.parent
+ path += ldda.name
+ while path in seen:
+ path += '_'
+ seen.append( path )
+ zpath = os.path.split(path)[ -1 ] # comes as base_name/fname
+ outfname, zpathext = os.path.splitext( zpath )
+
+ if is_composite: # need to add all the components from the extra_files_path to the zip
+ if zpathext == '':
+ zpath = '%s.html' % zpath # fake the real nature of the html file
+ try:
+ if format == 'zip':
+ archive.add( ldda.dataset.file_name, zpath ) # add the primary of a composite set
else:
- archive = zipfile.ZipFile( tmpf, 'w', zipfile.ZIP_DEFLATED, True )
- archive.add = lambda x, y: archive.write( x, y.encode( 'CP437' ) )
- elif format == 'tgz':
- if trans.app.config.upstream_gzip:
- archive = StreamBall( 'w|' )
- outext = 'tar'
- else:
- archive = StreamBall( 'w|gz' )
- outext = 'tgz'
- elif format == 'tbz':
- archive = StreamBall( 'w|bz2' )
- outext = 'tbz2'
- except ( OSError, zipfile.BadZipfile ):
- log.exception( "Unable to create archive for download" )
- raise exceptions.InternalServerError( "Unable to create archive for download." )
- except Exception:
- log.exception( "Unexpected error %s in create archive for download" % sys.exc_info()[ 0 ] )
- raise exceptions.InternalServerError( "Unable to create archive for download." )
- composite_extensions = trans.app.datatypes_registry.get_composite_extensions()
- seen = []
- for ld in library_datasets:
- ldda = ld.library_dataset_dataset_association
- ext = ldda.extension
- is_composite = ext in composite_extensions
- path = ""
- parent_folder = ldda.library_dataset.folder
- while parent_folder is not None:
- # Exclude the now-hidden "root folder"
- if parent_folder.parent is None:
- path = os.path.join( parent_folder.library_root[ 0 ].name, path )
- break
- path = os.path.join( parent_folder.name, path )
- parent_folder = parent_folder.parent
- path += ldda.name
- while path in seen:
- path += '_'
- seen.append( path )
- zpath = os.path.split(path)[ -1 ] # comes as base_name/fname
- outfname, zpathext = os.path.splitext( zpath )
+ archive.add( ldda.dataset.file_name, zpath, check_file=True ) # add the primary of a composite set
+ except IOError:
+ log.exception( "Unable to add composite parent %s to temporary library download archive" % ldda.dataset.file_name )
+ raise exceptions.InternalServerError( "Unable to create archive for download." )
+ except ObjectNotFound:
+ log.exception( "Requested dataset %s does not exist on the host." % ldda.dataset.file_name )
+ raise exceptions.ObjectNotFound( "Requested dataset not found. " )
+ except Exception, e:
+ log.exception( "Unable to add composite parent %s to temporary library download archive" % ldda.dataset.file_name )
+ raise exceptions.InternalServerError( "Unable to add composite parent to temporary library download archive. " + str( e ) )
- if is_composite: # need to add all the components from the extra_files_path to the zip
- if zpathext == '':
- zpath = '%s.html' % zpath # fake the real nature of the html file
+ flist = glob.glob(os.path.join(ldda.dataset.extra_files_path, '*.*')) # glob returns full paths
+ for fpath in flist:
+ efp, fname = os.path.split(fpath)
+ if fname > '':
+ fname = fname.translate(trantab)
try:
if format == 'zip':
- archive.add( ldda.dataset.file_name, zpath ) # add the primary of a composite set
+ archive.add( fpath, fname )
else:
- archive.add( ldda.dataset.file_name, zpath, check_file=True ) # add the primary of a composite set
+ archive.add( fpath, fname, check_file=True )
except IOError:
- log.exception( "Unable to add composite parent %s to temporary library download archive" % ldda.dataset.file_name )
+ log.exception( "Unable to add %s to temporary library download archive %s" % ( fname, outfname) )
raise exceptions.InternalServerError( "Unable to create archive for download." )
except ObjectNotFound:
- log.exception( "Requested dataset %s does not exist on the host." % ldda.dataset.file_name )
- raise exceptions.ObjectNotFound( "Requested dataset not found. " )
- except Exception, e:
- log.exception( "Unable to add composite parent %s to temporary library download archive" % ldda.dataset.file_name )
- raise exceptions.InternalServerError( "Unable to add composite parent to temporary library download archive. " + str( e ) )
-
- flist = glob.glob(os.path.join(ldda.dataset.extra_files_path, '*.*')) # glob returns full paths
- for fpath in flist:
- efp, fname = os.path.split(fpath)
- if fname > '':
- fname = fname.translate(trantab)
- try:
- if format == 'zip':
- archive.add( fpath, fname )
- else:
- archive.add( fpath, fname, check_file=True )
- except IOError:
- log.exception( "Unable to add %s to temporary library download archive %s" % ( fname, outfname) )
- raise exceptions.InternalServerError( "Unable to create archive for download." )
- except ObjectNotFound:
- log.exception( "Requested dataset %s does not exist on the host." % fpath )
- raise exceptions.ObjectNotFound( "Requested dataset not found." )
- except Exception, e:
- log.exception( "Unable to add %s to temporary library download archive %s" % ( fname, outfname ) )
- raise exceptions.InternalServerError( "Unable to add dataset to temporary library download archive . " + str( e ) )
-
- else: # simple case
- try:
- if format == 'zip':
- archive.add( ldda.dataset.file_name, path )
- else:
- archive.add( ldda.dataset.file_name, path, check_file=True )
- except IOError:
- log.exception( "Unable to write %s to temporary library download archive" % ldda.dataset.file_name )
- raise exceptions.InternalServerError( "Unable to create archive for download" )
- except ObjectNotFound:
- log.exception( "Requested dataset %s does not exist on the host." % ldda.dataset.file_name )
+ log.exception( "Requested dataset %s does not exist on the host." % fpath )
raise exceptions.ObjectNotFound( "Requested dataset not found." )
except Exception, e:
log.exception( "Unable to add %s to temporary library download archive %s" % ( fname, outfname ) )
- raise exceptions.InternalServerError( "Unknown error. " + str( e ) )
- lname = 'selected_dataset'
- fname = lname.replace( ' ', '_' ) + '_files'
- if format == 'zip':
- archive.close()
- trans.response.set_content_type( "application/octet-stream" )
- trans.response.headers[ "Content-Disposition" ] = 'attachment; filename="%s.%s"' % ( fname, outext )
- archive = util.streamball.ZipBall( tmpf, tmpd )
- archive.wsgi_status = trans.response.wsgi_status()
- archive.wsgi_headeritems = trans.response.wsgi_headeritems()
- return archive.stream
- else:
- trans.response.set_content_type( "application/x-tar" )
- trans.response.headers[ "Content-Disposition" ] = 'attachment; filename="%s.%s"' % ( fname, outext )
- archive.wsgi_status = trans.response.wsgi_status()
- archive.wsgi_headeritems = trans.response.wsgi_headeritems()
- return archive.stream
+ raise exceptions.InternalServerError( "Unable to add dataset to temporary library download archive . " + str( e ) )
+
+ else: # simple case
+ try:
+ if format == 'zip':
+ archive.add( ldda.dataset.file_name, path )
+ else:
+ archive.add( ldda.dataset.file_name, path, check_file=True )
+ except IOError:
+ log.exception( "Unable to write %s to temporary library download archive" % ldda.dataset.file_name )
+ raise exceptions.InternalServerError( "Unable to create archive for download" )
+ except ObjectNotFound:
+ log.exception( "Requested dataset %s does not exist on the host." % ldda.dataset.file_name )
+ raise exceptions.ObjectNotFound( "Requested dataset not found." )
+ except Exception, e:
+ log.exception( "Unable to add %s to temporary library download archive %s" % ( fname, outfname ) )
+ raise exceptions.InternalServerError( "Unknown error. " + str( e ) )
+ lname = 'selected_dataset'
+ fname = lname.replace( ' ', '_' ) + '_files'
+ if format == 'zip':
+ archive.close()
+ trans.response.set_content_type( "application/octet-stream" )
+ trans.response.headers[ "Content-Disposition" ] = 'attachment; filename="%s.%s"' % ( fname, outext )
+ archive = util.streamball.ZipBall( tmpf, tmpd )
+ archive.wsgi_status = trans.response.wsgi_status()
+ archive.wsgi_headeritems = trans.response.wsgi_headeritems()
+ return archive.stream
+ else:
+ trans.response.set_content_type( "application/x-tar" )
+ trans.response.headers[ "Content-Disposition" ] = 'attachment; filename="%s.%s"' % ( fname, outext )
+ archive.wsgi_status = trans.response.wsgi_status()
+ archive.wsgi_headeritems = trans.response.wsgi_headeritems()
+ return archive.stream
elif format == 'uncompressed':
if len(library_datasets) != 1:
raise exceptions.RequestParameterInvalidException( "You can download only one uncompressed file at once." )
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/webapps/galaxy/api/library_contents.py
--- a/lib/galaxy/webapps/galaxy/api/library_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/library_contents.py
@@ -146,17 +146,21 @@
the HDA's encoded id in ``from_hda_id`` (and optionally ``ldda_message``).
:type library_id: str
- :param library_id: encoded id string of the library that contains this item
+ :param library_id: encoded id string of the library where to create the new item
:type payload: dict
:param payload: dictionary structure containing:
* folder_id: the parent folder of the new item
- * create_type: the type of item to create ('file' or 'folder')
+ * create_type: the type of item to create ('file', 'folder' or 'collection')
* from_hda_id: (optional) the id of an accessible HDA to copy into the
library
* ldda_message: (optional) the new message attribute of the LDDA created
* extended_metadata: (optional) dub-dictionary containing any extended
metadata to associate with the item
+ * link_data_only: (optional) either 'copy_files' (default) or 'link_to_files'
+ * upload_option: (optional) one of 'upload_file' (default), 'upload_directory' or 'upload_paths'
+ * server_dir: (optional) only if upload_option is 'upload_directory'
+ * filesystem_paths: (optional) only if upload_option is 'upload_paths' and the user is an admin
:rtype: dict
:returns: a dictionary containing the id, name,
@@ -217,11 +221,9 @@
return output
else:
rval = []
- for k, v in output.items():
+ for v in output.values():
if ex_meta_payload is not None:
- """
- If there is extended metadata, store it, attach it to the dataset, and index it
- """
+ # If there is extended metadata, store it, attach it to the dataset, and index it
ex_meta = ExtendedMetadata(ex_meta_payload)
trans.sa_session.add( ex_meta )
v.extended_metadata = ex_meta
@@ -343,9 +345,9 @@
trans.sa_session.flush()
def __decode_library_content_id( self, trans, content_id ):
- if ( len( content_id ) % 16 == 0 ):
+ if len( content_id ) % 16 == 0:
return 'LibraryDataset', content_id
- elif ( content_id.startswith( 'F' ) ):
+ elif content_id.startswith( 'F' ):
return 'LibraryFolder', content_id[ 1: ]
else:
raise HTTPBadRequest( 'Malformed library content id ( %s ) specified, unable to decode.' % str( content_id ) )
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/webapps/galaxy/controllers/dataset.py
--- a/lib/galaxy/webapps/galaxy/controllers/dataset.py
+++ b/lib/galaxy/webapps/galaxy/controllers/dataset.py
@@ -1,8 +1,6 @@
import logging
import os
-import tempfile
import urllib
-import zipfile
from galaxy import datatypes, eggs, model, util, web
from galaxy.datatypes.display_applications.util import decode_dataset_user, encode_dataset_user
@@ -43,8 +41,8 @@
accepted_filter_labels_and_vals = { "Active" : "False", "Deleted" : "True", "All": "All" }
accepted_filters = []
for label, val in accepted_filter_labels_and_vals.items():
- args = { self.key: val }
- accepted_filters.append( grids.GridColumnFilter( label, args) )
+ args = { self.key: val }
+ accepted_filters.append( grids.GridColumnFilter( label, args) )
return accepted_filters
# Grid definition
@@ -147,7 +145,7 @@
trans.response.set_content_type( 'text/plain' )
exit_code = ""
try:
- job = self._get_job_for_dataset( dataset_id )
+ job = self._get_job_for_dataset( trans, dataset_id )
exit_code = job.exit_code
except:
exit_code = "Invalid dataset ID or you are not allowed to access this dataset"
@@ -323,40 +321,38 @@
if params.annotation:
annotation = sanitize_html( params.annotation, 'utf-8', 'text/html' )
self.add_item_annotation( trans.sa_session, trans.get_user(), data, annotation )
- """
# This block on controller code is inactive until the 'extended_metadata' edit box is added back into the UI
# Add or delete extended metadata
- if params.extended_metadata:
- em_string = params.extended_metadata
- if len(em_string):
- em_payload = None
- try:
- em_payload = loads(em_string)
- except Exception, e:
- message = 'Invalid JSON input'
- error = True
- if em_payload is not None:
- if data is not None:
- ex_obj = self.get_item_extended_metadata_obj(trans, data)
- if ex_obj is not None:
- self.unset_item_extended_metadata_obj(trans, data)
- self.delete_extended_metadata(trans, ex_obj)
- ex_obj = self.create_extended_metadata(trans, em_payload)
- self.set_item_extended_metadata_obj(trans, data, ex_obj)
- message = "Updated Extended metadata '%s'." % data.name
- status = 'done'
- else:
- message = "data not found"
- error = True
- else:
- if data is not None:
- ex_obj = self.get_item_extended_metadata_obj(trans, data)
- if ex_obj is not None:
- self.unset_item_extended_metadata_obj(trans, data)
- self.delete_extended_metadata(trans, ex_obj)
- message = "Deleted Extended metadata '%s'." % data.name
- status = 'done'
- """
+# if params.extended_metadata:
+# em_string = params.extended_metadata
+# if len(em_string):
+# em_payload = None
+# try:
+# em_payload = loads(em_string)
+# except Exception, e:
+# message = 'Invalid JSON input'
+# error = True
+# if em_payload is not None:
+# if data is not None:
+# ex_obj = self.get_item_extended_metadata_obj(trans, data)
+# if ex_obj is not None:
+# self.unset_item_extended_metadata_obj(trans, data)
+# self.delete_extended_metadata(trans, ex_obj)
+# ex_obj = self.create_extended_metadata(trans, em_payload)
+# self.set_item_extended_metadata_obj(trans, data, ex_obj)
+# message = "Updated Extended metadata '%s'." % data.name
+# status = 'done'
+# else:
+# message = "data not found"
+# error = True
+# else:
+# if data is not None:
+# ex_obj = self.get_item_extended_metadata_obj(trans, data)
+# if ex_obj is not None:
+# self.unset_item_extended_metadata_obj(trans, data)
+# self.delete_extended_metadata(trans, ex_obj)
+# message = "Deleted Extended metadata '%s'." % data.name
+# status = 'done'
# If setting metadata previously failed and all required elements have now been set, clear the failed state.
if data._state == trans.model.Dataset.states.FAILED_METADATA and not data.missing_meta():
@@ -954,13 +950,11 @@
has_parameter_errors = False
inherit_chain = hda.source_dataset_chain
if inherit_chain:
- job_dataset_association, dataset_association_container_name = inherit_chain[-1]
+ job_dataset_association = inherit_chain[-1][0]
else:
job_dataset_association = hda
if job_dataset_association.creating_job_associations:
- for assoc in job_dataset_association.creating_job_associations:
- job = assoc.job
- break
+ job = job_dataset_association.creating_job_associations[0].job
if job:
# Get the tool object
try:
@@ -1024,7 +1018,7 @@
trans.sa_session.flush()
target_history_ids.append( new_history.id )
if user:
- target_histories = [ hist for hist in map( trans.sa_session.query( trans.app.model.History ).get, target_history_ids ) if ( hist is not None and hist.user == user )]
+ target_histories = [ hist for hist in map( trans.sa_session.query( trans.app.model.History ).get, target_history_ids ) if hist is not None and hist.user == user ]
else:
target_histories = [ history ]
if len( target_histories ) != len( target_history_ids ):
diff -r 84b3e72b8dcf5ce9f10040024459872fe7e6f98e -r a3ebaac5d31258a02bc7f037721f898c2c1e80e3 lib/galaxy/webapps/galaxy/controllers/library_common.py
--- a/lib/galaxy/webapps/galaxy/controllers/library_common.py
+++ b/lib/galaxy/webapps/galaxy/controllers/library_common.py
@@ -162,6 +162,7 @@
default_action=default_action,
message=util.sanitize_text( message ),
status=status ) )
+
@web.expose
def library_info( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
@@ -222,6 +223,7 @@
inherited=inherited,
message=message,
status=status )
+
@web.expose
def library_permissions( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
@@ -269,6 +271,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def create_folder( self, trans, cntrller, parent_id, library_id, **kwd ):
params = util.Params( kwd )
@@ -346,6 +349,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def folder_info( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
@@ -403,6 +407,7 @@
inherited=inherited,
message=message,
status=status )
+
@web.expose
def folder_permissions( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
@@ -453,6 +458,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def ldda_edit_info( self, trans, cntrller, library_id, folder_id, id, **kwd ):
params = util.Params( kwd )
@@ -606,6 +612,7 @@
inherited=inherited,
message=message,
status=status )
+
@web.expose
def ldda_info( self, trans, cntrller, library_id, folder_id, id, **kwd ):
params = util.Params( kwd )
@@ -655,6 +662,7 @@
inherited=inherited,
message=message,
status=status )
+
@web.expose
def ldda_permissions( self, trans, cntrller, library_id, folder_id, id, **kwd ):
params = util.Params( kwd )
@@ -793,6 +801,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def upload_library_dataset( self, trans, cntrller, library_id, folder_id, **kwd ):
params = util.Params( kwd )
@@ -1042,6 +1051,7 @@
ldda_message=ldda_message,
message=message,
status=status )
+
def upload_dataset( self, trans, cntrller, library_id, folder_id, replace_dataset=None, **kwd ):
# Set up the traditional tool state/params
tool_id = 'upload1'
@@ -1132,6 +1142,7 @@
trans.sa_session.add( job )
trans.sa_session.flush()
return output
+
def make_library_uploaded_dataset( self, trans, cntrller, params, name, path, type, library_bunch, in_folder=None ):
link_data_only = params.get( 'link_data_only', 'copy_files' )
uuid_str = params.get( 'uuid', None )
@@ -1166,6 +1177,7 @@
trans.sa_session.add_all( ( uploaded_dataset.data, uploaded_dataset.data.dataset ) )
trans.sa_session.flush()
return uploaded_dataset
+
def get_server_dir_uploaded_datasets( self, trans, cntrller, params, full_dir, import_dir_desc, library_bunch, response_code, message ):
dir_response = self._get_server_dir_files(params, full_dir, import_dir_desc)
files = dir_response[0]
@@ -1176,6 +1188,7 @@
name = os.path.basename( file )
uploaded_datasets.append( self.make_library_uploaded_dataset( trans, cntrller, params, name, file, 'server_dir', library_bunch ) )
return uploaded_datasets, 200, None
+
def _get_server_dir_files( self, params, full_dir, import_dir_desc ):
files = []
try:
@@ -1212,6 +1225,7 @@
response_code = 400
return None, response_code, message
return files, None, None
+
def get_path_paste_uploaded_datasets( self, trans, cntrller, params, library_bunch, response_code, message ):
preserve_dirs = util.string_as_bool( params.get( 'preserve_dirs', False ) )
uploaded_datasets = []
@@ -1246,6 +1260,7 @@
in_folder = None
files_and_folders.append((file_path, file, in_folder))
return files_and_folders
+
def _paths_list(self, params):
return [ (l.strip(), os.path.abspath(l.strip())) for l in params.filesystem_paths.splitlines() if l.strip() ]
@@ -1463,6 +1478,7 @@
ldda_message=ldda_message,
message=message,
status=status )
+
def _build_roles_select_list( self, trans, cntrller, library, selected_role_ids=[] ):
# Get the list of legitimate roles to display on the upload form. If the library is public,
# all active roles are legitimate. If the library is restricted by the LIBRARY_ACCESS permission, only
@@ -1478,10 +1494,11 @@
return roles_select_list
else:
return None
+
def _build_upload_option_select_list( self, trans, upload_option, is_admin, do_not_include_values=[] ):
# Build the upload_option select list. The do_not_include_values param can contain options that
# should not be included in the list. For example, the 'upload_directory' option should not be
- # included if uploading a new version of a librar dataset.
+ # included if uploading a new version of a library dataset.
upload_refresh_on_change_values = []
for option_value, option_label in trans.model.LibraryDataset.upload_options:
if option_value not in do_not_include_values:
@@ -1508,6 +1525,7 @@
continue
upload_option_select_list.add_option( option_label, option_value, selected=option_value==upload_option )
return upload_option_select_list
+
def _get_populated_widgets( self, folder ):
# See if we have any inherited templates.
info_association, inherited = folder.get_info_association( inherited=True )
@@ -1517,6 +1535,7 @@
return self.populate_widgets_from_kwd( trans, widgets, **kwd )
else:
return []
+
@web.expose
def download_dataset_from_folder( self, trans, cntrller, id, library_id=None, **kwd ):
"""Catches the dataset id and displays file contents as directed"""
@@ -1557,6 +1576,7 @@
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status='error' ) )
+
@web.expose
def library_dataset_info( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
@@ -1606,6 +1626,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def library_dataset_permissions( self, trans, cntrller, id, library_id, **kwd ):
params = util.Params( kwd )
@@ -1654,6 +1675,7 @@
show_deleted=show_deleted,
message=message,
status=status )
+
@web.expose
def make_library_item_public( self, trans, cntrller, library_id, item_type, id, **kwd ):
params = util.Params( kwd )
@@ -1696,6 +1718,7 @@
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status=status ) )
+
@web.expose
def act_on_multiple_datasets( self, trans, cntrller, library_id=None, ldda_ids='', **kwd ):
# This method is called from 1 of 3 places:
@@ -2113,6 +2136,7 @@
use_panels=use_panels,
message=message,
status=status )
+
@web.expose
def manage_template_inheritance( self, trans, cntrller, item_type, library_id, folder_id=None, ldda_id=None, **kwd ):
params = util.Params( kwd )
@@ -2159,6 +2183,7 @@
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status='done' ) )
+
@web.expose
def move_library_item( self, trans, cntrller, item_type, item_id, source_library_id='', make_target_current=True, **kwd ):
# This method is called from one of the following places:
@@ -2374,6 +2399,7 @@
use_panels=use_panels,
message=message,
status=status )
+
@web.expose
def delete_library_item( self, trans, cntrller, library_id, item_id, item_type, **kwd ):
# This action will handle deleting all types of library items. State is saved for libraries and
@@ -2441,6 +2467,7 @@
show_deleted=show_deleted,
message=message,
status=status ) )
+
@web.expose
def undelete_library_item( self, trans, cntrller, library_id, item_id, item_type, **kwd ):
# This action will handle undeleting all types of library items
@@ -2509,6 +2536,7 @@
show_deleted=show_deleted,
message=message,
status=status ) )
+
def _check_access( self, trans, cntrller, is_admin, item, current_user_roles, use_panels, library_id, show_deleted ):
can_access = True
if isinstance( item, trans.model.HistoryDatasetAssociation ):
@@ -2551,6 +2579,7 @@
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status='error' ) )
+
def _check_add( self, trans, cntrller, is_admin, item, current_user_roles, use_panels, library_id, show_deleted ):
# Deny access if the user is not an admin and does not have the LIBRARY_ADD permission.
if not ( is_admin or trans.app.security_agent.can_add_library_item( current_user_roles, item ) ):
@@ -2566,6 +2595,7 @@
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status='error' ) )
+
def _check_manage( self, trans, cntrller, is_admin, item, current_user_roles, use_panels, library_id, show_deleted ):
if isinstance( item, trans.model.LibraryDataset ):
# Deny access if the user is not an admin and does not have the LIBRARY_MANAGE and DATASET_MANAGE_PERMISSIONS permissions.
@@ -2594,6 +2624,7 @@
use_panels=use_panels,
message=util.sanitize_text( message ),
status='error' ) )
+
def _check_modify( self, trans, cntrller, is_admin, item, current_user_roles, use_panels, library_id, show_deleted ):
# Deny modification if the user is not an admin and does not have the LIBRARY_MODIFY permission.
if not ( is_admin or trans.app.security_agent.can_modify_library_item( current_user_roles, item ) ):
@@ -2619,6 +2650,7 @@
.options( eagerload_all( "actions" ) ) \
.order_by( trans.app.model.LibraryFolder.table.c.name ) \
.all()
+
def activatable_folders( trans, folder ):
return trans.sa_session.query( trans.app.model.LibraryFolder ) \
.filter_by( parent=folder, purged=False ) \
@@ -2685,6 +2717,7 @@
if folder.parent:
return branch_deleted( folder.parent )
return False
+
def get_containing_library_from_library_dataset( trans, library_dataset ):
"""Given a library_dataset, get the containing library"""
folder = library_dataset.folder
@@ -2698,6 +2731,7 @@
if library.root_folder == folder:
return library
return None
+
def get_comptypes( trans ):
comptypes_t = comptypes
if trans.app.config.nginx_x_archive_files_base:
@@ -2710,6 +2744,7 @@
except:
pass
return comptypes_t
+
def get_sorted_accessible_library_items( trans, cntrller, items, sort_attr ):
is_admin = trans.user_is_admin() and cntrller == 'library_admin'
if is_admin:
@@ -2723,6 +2758,7 @@
accessible_items.append( item )
# Sort by name
return sort_by_attr( [ item for item in accessible_items ], sort_attr )
+
def sort_by_attr( seq, attr ):
"""
Sort the sequence of objects by object's attribute
@@ -2738,6 +2774,7 @@
intermed = map( None, map( getattr, seq, ( attr, ) * len( seq ) ), xrange( len( seq ) ), seq )
intermed.sort()
return map( operator.getitem, intermed, ( -1, ) * len( intermed ) )
+
def lucene_search( trans, cntrller, search_term, search_url, **kwd ):
"""Return display of results from a full-text lucene search of data libraries."""
params = util.Params( kwd )
@@ -2749,6 +2786,7 @@
response.close()
lddas = [ trans.sa_session.query( trans.app.model.LibraryDatasetDatasetAssociation ).get( ldda_id ) for ldda_id in ldda_ids ]
return status, message, get_sorted_accessible_library_items( trans, cntrller, lddas, 'name' )
+
def whoosh_search( trans, cntrller, search_term, **kwd ):
"""Return display of results from a full-text whoosh search of data libraries."""
params = util.Params( kwd )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0