galaxy-commits
Threads by month
- ----- 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
February 2015
- 2 participants
- 305 discussions
commit/galaxy-central: natefoo: Ensure the correct default Galaxy config file is found in common_startup.sh, it
by commits-noreply@bitbucket.org 12 Feb '15
by commits-noreply@bitbucket.org 12 Feb '15
12 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/93d2916499f4/
Changeset: 93d2916499f4
User: natefoo
Date: 2015-02-12 16:47:58+00:00
Summary: Ensure the correct default Galaxy config file is found in common_startup.sh, it
makes a difference for egg fetching since some eggs are conditional based on
config.
Affected #: 1 file
diff -r 51a3606fe3bdf21d663b35d41c886ff819fd234d -r 93d2916499f4ddc3093adc65cb5718a25841aa15 scripts/common_startup.sh
--- a/scripts/common_startup.sh
+++ b/scripts/common_startup.sh
@@ -34,7 +34,13 @@
done
fi
-: ${GALAXY_CONFIG_FILE:=config/galaxy.ini.sample}
+: ${GALAXY_CONFIG_FILE:=config/galaxy.ini}
+if [ ! -f $GALAXY_CONFIG_FILE ]; then
+ GALAXY_CONFIG_FILE=universe_wsgi.ini
+fi
+if [ ! -f $GALAXY_CONFIG_FILE ]; then
+ GALAXY_CONFIG_FILE=config/galaxy.ini.sample
+fi
if [ $FETCH_EGGS -eq 1 ]; then
python ./scripts/check_eggs.py -q -c $GALAXY_CONFIG_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: martenson: Merged in dan/galaxy-central-prs/stable (pull request #667)
by commits-noreply@bitbucket.org 12 Feb '15
by commits-noreply@bitbucket.org 12 Feb '15
12 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/71054665755b/
Changeset: 71054665755b
Branch: stable
User: martenson
Date: 2015-02-12 16:42:29+00:00
Summary: Merged in dan/galaxy-central-prs/stable (pull request #667)
[STABLE] Fixes for resetting metadata on ToolShed Repositories.
Affected #: 3 files
diff -r f1c89c016624edd48edf604b14745d2a85b8402a -r 71054665755b0b6c6348aedb56222b954fea3e7b lib/galaxy/webapps/tool_shed/controllers/repository.py
--- a/lib/galaxy/webapps/tool_shed/controllers/repository.py
+++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py
@@ -2766,7 +2766,8 @@
repository = suc.get_repository_in_tool_shed( trans.app, id )
rmm = repository_metadata_manager.RepositoryMetadataManager( app=trans.app,
user=trans.user,
- repository=repository )
+ repository=repository,
+ resetting_all_metadata_on_repository=True )
rmm.reset_all_metadata_on_repository_in_tool_shed()
rmm_metadata_dict = rmm.get_metadata_dict()
rmm_invalid_file_tups = rmm.get_invalid_file_tups()
@@ -2787,7 +2788,7 @@
@web.expose
def reset_metadata_on_my_writable_repositories_in_tool_shed( self, trans, **kwd ):
- rmm = repository_metadata_manager.RepositoryMetadataManager( trans.app, trans.user )
+ rmm = repository_metadata_manager.RepositoryMetadataManager( trans.app, trans.user, resetting_all_metadata_on_repository=True )
if 'reset_metadata_on_selected_repositories_button' in kwd:
message, status = rmm.reset_metadata_on_selected_repositories( **kwd )
else:
diff -r f1c89c016624edd48edf604b14745d2a85b8402a -r 71054665755b0b6c6348aedb56222b954fea3e7b lib/tool_shed/metadata/metadata_generator.py
--- a/lib/tool_shed/metadata/metadata_generator.py
+++ b/lib/tool_shed/metadata/metadata_generator.py
@@ -853,7 +853,7 @@
if tool_path and relative_install_dir:
if relative_path_to_sample_file.startswith( os.path.join( tool_path, relative_install_dir ) ):
relative_path_to_sample_file = relative_path_to_sample_file[ len( tool_path ) + 1 :]
- sample_file_metadata_paths.append( relative_path_to_sample_file )
+ sample_file_metadata_paths.append( relative_path_to_sample_file )
return sample_file_metadata_paths, sample_file_copy_paths
def handle_repository_elem( self, repository_elem, only_if_compiling_contained_td=False ):
diff -r f1c89c016624edd48edf604b14745d2a85b8402a -r 71054665755b0b6c6348aedb56222b954fea3e7b lib/tool_shed/metadata/repository_metadata_manager.py
--- a/lib/tool_shed/metadata/repository_metadata_manager.py
+++ b/lib/tool_shed/metadata/repository_metadata_manager.py
@@ -834,7 +834,6 @@
if cloned_ok:
log.debug( "Generating metadata for changset revision: %s", str( ctx.rev() ) )
self.set_changeset_revision( str( repo.changectx( changeset ) ) )
- self.set_relative_install_dir( work_dir )
self.set_repository_files_dir( work_dir )
self.generate_metadata_for_changeset_revision()
if self.metadata_dict:
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/852e7e14fab2/
Changeset: 852e7e14fab2
Branch: stable
User: dan
Date: 2015-02-11 21:50:25+00:00
Summary: Fix for resetting repository metadata in the toolshed via UI (pass resetting_all_metadata_on_repository=True flag).
Affected #: 1 file
diff -r ca653e8d044d29e15d4ff3266e333aa75c09e5d7 -r 852e7e14fab21ac9bb2c4aa40840d054dddb6d91 lib/galaxy/webapps/tool_shed/controllers/repository.py
--- a/lib/galaxy/webapps/tool_shed/controllers/repository.py
+++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py
@@ -2763,7 +2763,8 @@
repository = suc.get_repository_in_tool_shed( trans.app, id )
rmm = repository_metadata_manager.RepositoryMetadataManager( app=trans.app,
user=trans.user,
- repository=repository )
+ repository=repository,
+ resetting_all_metadata_on_repository=True )
rmm.reset_all_metadata_on_repository_in_tool_shed()
rmm_metadata_dict = rmm.get_metadata_dict()
rmm_invalid_file_tups = rmm.get_invalid_file_tups()
@@ -2784,7 +2785,7 @@
@web.expose
def reset_metadata_on_my_writable_repositories_in_tool_shed( self, trans, **kwd ):
- rmm = repository_metadata_manager.RepositoryMetadataManager( trans.app, trans.user )
+ rmm = repository_metadata_manager.RepositoryMetadataManager( trans.app, trans.user, resetting_all_metadata_on_repository=True )
if 'reset_metadata_on_selected_repositories_button' in kwd:
message, status = rmm.reset_metadata_on_selected_repositories( **kwd )
else:
https://bitbucket.org/galaxy/galaxy-central/commits/8e264f9103b5/
Changeset: 8e264f9103b5
Branch: stable
User: dan
Date: 2015-02-11 22:31:49+00:00
Summary: Always add sample file info to metadata, not only during initial creation..
Affected #: 1 file
diff -r 852e7e14fab21ac9bb2c4aa40840d054dddb6d91 -r 8e264f9103b568eed5c7df899f749443b18e0954 lib/tool_shed/metadata/metadata_generator.py
--- a/lib/tool_shed/metadata/metadata_generator.py
+++ b/lib/tool_shed/metadata/metadata_generator.py
@@ -853,7 +853,7 @@
if tool_path and relative_install_dir:
if relative_path_to_sample_file.startswith( os.path.join( tool_path, relative_install_dir ) ):
relative_path_to_sample_file = relative_path_to_sample_file[ len( tool_path ) + 1 :]
- sample_file_metadata_paths.append( relative_path_to_sample_file )
+ sample_file_metadata_paths.append( relative_path_to_sample_file )
return sample_file_metadata_paths, sample_file_copy_paths
def handle_repository_elem( self, repository_elem, only_if_compiling_contained_td=False ):
https://bitbucket.org/galaxy/galaxy-central/commits/81fc2eddcad8/
Changeset: 81fc2eddcad8
Branch: stable
User: dan
Date: 2015-02-11 22:36:05+00:00
Summary: When resetting repository metadata in the toolshed, don't overwrite the already set relative_install_dir.
Affected #: 1 file
diff -r 8e264f9103b568eed5c7df899f749443b18e0954 -r 81fc2eddcad807ef6eac5e9eb42e2cb8b9e39b22 lib/tool_shed/metadata/repository_metadata_manager.py
--- a/lib/tool_shed/metadata/repository_metadata_manager.py
+++ b/lib/tool_shed/metadata/repository_metadata_manager.py
@@ -834,7 +834,6 @@
if cloned_ok:
log.debug( "Generating metadata for changset revision: %s", str( ctx.rev() ) )
self.set_changeset_revision( str( repo.changectx( changeset ) ) )
- self.set_relative_install_dir( work_dir )
self.set_repository_files_dir( work_dir )
self.generate_metadata_for_changeset_revision()
if self.metadata_dict:
https://bitbucket.org/galaxy/galaxy-central/commits/71054665755b/
Changeset: 71054665755b
Branch: stable
User: martenson
Date: 2015-02-12 16:42:29+00:00
Summary: Merged in dan/galaxy-central-prs/stable (pull request #667)
[STABLE] Fixes for resetting metadata on ToolShed Repositories.
Affected #: 3 files
diff -r f1c89c016624edd48edf604b14745d2a85b8402a -r 71054665755b0b6c6348aedb56222b954fea3e7b lib/galaxy/webapps/tool_shed/controllers/repository.py
--- a/lib/galaxy/webapps/tool_shed/controllers/repository.py
+++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py
@@ -2766,7 +2766,8 @@
repository = suc.get_repository_in_tool_shed( trans.app, id )
rmm = repository_metadata_manager.RepositoryMetadataManager( app=trans.app,
user=trans.user,
- repository=repository )
+ repository=repository,
+ resetting_all_metadata_on_repository=True )
rmm.reset_all_metadata_on_repository_in_tool_shed()
rmm_metadata_dict = rmm.get_metadata_dict()
rmm_invalid_file_tups = rmm.get_invalid_file_tups()
@@ -2787,7 +2788,7 @@
@web.expose
def reset_metadata_on_my_writable_repositories_in_tool_shed( self, trans, **kwd ):
- rmm = repository_metadata_manager.RepositoryMetadataManager( trans.app, trans.user )
+ rmm = repository_metadata_manager.RepositoryMetadataManager( trans.app, trans.user, resetting_all_metadata_on_repository=True )
if 'reset_metadata_on_selected_repositories_button' in kwd:
message, status = rmm.reset_metadata_on_selected_repositories( **kwd )
else:
diff -r f1c89c016624edd48edf604b14745d2a85b8402a -r 71054665755b0b6c6348aedb56222b954fea3e7b lib/tool_shed/metadata/metadata_generator.py
--- a/lib/tool_shed/metadata/metadata_generator.py
+++ b/lib/tool_shed/metadata/metadata_generator.py
@@ -853,7 +853,7 @@
if tool_path and relative_install_dir:
if relative_path_to_sample_file.startswith( os.path.join( tool_path, relative_install_dir ) ):
relative_path_to_sample_file = relative_path_to_sample_file[ len( tool_path ) + 1 :]
- sample_file_metadata_paths.append( relative_path_to_sample_file )
+ sample_file_metadata_paths.append( relative_path_to_sample_file )
return sample_file_metadata_paths, sample_file_copy_paths
def handle_repository_elem( self, repository_elem, only_if_compiling_contained_td=False ):
diff -r f1c89c016624edd48edf604b14745d2a85b8402a -r 71054665755b0b6c6348aedb56222b954fea3e7b lib/tool_shed/metadata/repository_metadata_manager.py
--- a/lib/tool_shed/metadata/repository_metadata_manager.py
+++ b/lib/tool_shed/metadata/repository_metadata_manager.py
@@ -834,7 +834,6 @@
if cloned_ok:
log.debug( "Generating metadata for changset revision: %s", str( ctx.rev() ) )
self.set_changeset_revision( str( repo.changectx( changeset ) ) )
- self.set_relative_install_dir( work_dir )
self.set_repository_files_dir( work_dir )
self.generate_metadata_for_changeset_revision()
if self.metadata_dict:
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/a03ff352f393/
Changeset: a03ff352f393
User: carlfeberhard
Date: 2015-02-12 16:18:21+00:00
Summary: UI, history multi-view: render and keep drag help text on current histry as an affordance for drag-to-copy
Affected #: 8 files
diff -r 2c6690a2faea4882a688044ec269de5b15569f58 -r a03ff352f39379b231da22259b9bde89ac7f6340 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
@@ -445,6 +445,7 @@
/** */
_renderDropTarget : function(){
+ this.$( '.history-drop-target' ).remove();
return $( '<div/>' ).addClass( 'history-drop-target' )
.css({
'height': '64px',
@@ -456,6 +457,7 @@
/** */
_renderDropTargetHelp : function(){
+ this.$( '.history-drop-target-help' ).remove();
return $( '<div/>' ).addClass( 'history-drop-target-help' )
.css({
'margin' : '10px 10px 4px 10px',
diff -r 2c6690a2faea4882a688044ec269de5b15569f58 -r a03ff352f39379b231da22259b9bde89ac7f6340 client/galaxy/scripts/mvc/history/multi-panel.js
--- a/client/galaxy/scripts/mvc/history/multi-panel.js
+++ b/client/galaxy/scripts/mvc/history/multi-panel.js
@@ -278,6 +278,9 @@
renderPanel : function renderPanel( speed ){
speed = ( speed !== undefined )?( speed ):( 'fast' );
this.panel.setElement( this.$panel() ).render( speed );
+ if( this.currentHistory ){
+ this.panel.$list().before( this.panel._renderDropTargetHelp() );
+ }
return this;
},
@@ -953,7 +956,9 @@
var currentColumn = this.columnMap[ this.currentHistoryId ];
if( !currentColumn ){ return; }
currentColumn.panel.dataDropped = HPANEL_EDIT.HistoryPanelEdit.prototype.dataDrop;
- currentColumn.panel.dropTargetOff();
+ // slight override of dropTargetOff to not erase drop-target-help
+ currentColumn.panel.dropTarget = false;
+ currentColumn.panel.$( '.history-drop-target' ).remove();
},
// ------------------------------------------------------------------------ misc
diff -r 2c6690a2faea4882a688044ec269de5b15569f58 -r a03ff352f39379b231da22259b9bde89ac7f6340 client/galaxy/scripts/mvc/list/list-panel.js
--- a/client/galaxy/scripts/mvc/list/list-panel.js
+++ b/client/galaxy/scripts/mvc/list/list-panel.js
@@ -399,7 +399,7 @@
panel.trigger.apply( panel, args );
});
- // drag multiple - hijack ev.setData to add all selected datasets
+ // drag multiple - hijack ev.setData to add all selected items
view.on( 'draggable:dragstart', function( ev, v ){
//TODO: set multiple drag data here
var json = {},
@@ -410,6 +410,7 @@
json = [ v.model.toJSON() ];
}
ev.dataTransfer.setData( 'text', JSON.stringify( json ) );
+ //ev.dataTransfer.setDragImage( v.el, 60, 60 );
}, this );
// debugging
diff -r 2c6690a2faea4882a688044ec269de5b15569f58 -r a03ff352f39379b231da22259b9bde89ac7f6340 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
@@ -445,6 +445,7 @@
/** */
_renderDropTarget : function(){
+ this.$( '.history-drop-target' ).remove();
return $( '<div/>' ).addClass( 'history-drop-target' )
.css({
'height': '64px',
@@ -456,6 +457,7 @@
/** */
_renderDropTargetHelp : function(){
+ this.$( '.history-drop-target-help' ).remove();
return $( '<div/>' ).addClass( 'history-drop-target-help' )
.css({
'margin' : '10px 10px 4px 10px',
diff -r 2c6690a2faea4882a688044ec269de5b15569f58 -r a03ff352f39379b231da22259b9bde89ac7f6340 static/scripts/mvc/history/multi-panel.js
--- a/static/scripts/mvc/history/multi-panel.js
+++ b/static/scripts/mvc/history/multi-panel.js
@@ -278,6 +278,9 @@
renderPanel : function renderPanel( speed ){
speed = ( speed !== undefined )?( speed ):( 'fast' );
this.panel.setElement( this.$panel() ).render( speed );
+ if( this.currentHistory ){
+ this.panel.$list().before( this.panel._renderDropTargetHelp() );
+ }
return this;
},
@@ -953,7 +956,9 @@
var currentColumn = this.columnMap[ this.currentHistoryId ];
if( !currentColumn ){ return; }
currentColumn.panel.dataDropped = HPANEL_EDIT.HistoryPanelEdit.prototype.dataDrop;
- currentColumn.panel.dropTargetOff();
+ // slight override of dropTargetOff to not erase drop-target-help
+ currentColumn.panel.dropTarget = false;
+ currentColumn.panel.$( '.history-drop-target' ).remove();
},
// ------------------------------------------------------------------------ misc
diff -r 2c6690a2faea4882a688044ec269de5b15569f58 -r a03ff352f39379b231da22259b9bde89ac7f6340 static/scripts/mvc/list/list-panel.js
--- a/static/scripts/mvc/list/list-panel.js
+++ b/static/scripts/mvc/list/list-panel.js
@@ -399,7 +399,7 @@
panel.trigger.apply( panel, args );
});
- // drag multiple - hijack ev.setData to add all selected datasets
+ // drag multiple - hijack ev.setData to add all selected items
view.on( 'draggable:dragstart', function( ev, v ){
//TODO: set multiple drag data here
var json = {},
@@ -410,6 +410,7 @@
json = [ v.model.toJSON() ];
}
ev.dataTransfer.setData( 'text', JSON.stringify( json ) );
+ //ev.dataTransfer.setDragImage( v.el, 60, 60 );
}, this );
// debugging
diff -r 2c6690a2faea4882a688044ec269de5b15569f58 -r a03ff352f39379b231da22259b9bde89ac7f6340 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","ui/fa-icon-button","mvc/ui/popup-menu","utils/localization"],function(h,j,m,f,e,i,l,c,b,a,d){var k=h.HistoryPanel;var g=k.extend({HDAViewClass:e.HDAListItemEdit,HDCAViewClass:i.HDCAListItemEdit,initialize:function(n){n=n||{};k.prototype.initialize.call(this,n);this.tagsEditor=null;this.annotationEditor=null;this.purgeAllowed=n.purgeAllowed||false;this.annotationEditorShown=n.annotationEditorShown||false;this.tagsEditorShown=n.tagsEditorShown||false;this.multiselectActions=n.multiselectActions||this._getActions()},_setUpListeners:function(){var n=this;k.prototype._setUpListeners.call(n);n.on("drop",function(o,p){n.dataDropped(p);n.dropTargetOff()});n.on("view:attached view:removed",function(){n._renderCounts()},n)},_setUpCollectionListeners:function(){k.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(n){this.model.fetch()},this);return this},_setUpModelListeners:function(){k.prototype._setUpModelListeners.call(this);this.model.on("change:nice_size",this.updateHistoryDiskSize,this);return this},_buildNewRender:function(){var n=k.prototype._buildNewRender.call(this);if(!this.model){return n}if(Galaxy&&Galaxy.currUser&&Galaxy.currUser.id&&Galaxy.currUser.id===this.model.get("user_id")){this._renderTags(n);this._renderAnnotation(n)}return n},renderItems:function(o){var n=k.prototype.renderItems.call(this,o);this._renderCounts(o);return n},_renderCounts:function(p){function o(s,t){return['<a class="',s,'" href="javascript:void(0);">',t,"</a>"].join("")}p=p||this.$el;var n=this.collection.where({deleted:true}),r=this.collection.where({visible:false}),q=[];if(this.views.length){q.push([this.views.length,d("shown")].join(" "))}if(n.length){q.push((!this.showDeleted)?([n.length,o("toggle-deleted-link",d("deleted"))].join(" ")):(o("toggle-deleted-link",d("hide deleted"))))}if(r.length){q.push((!this.showHidden)?([r.length,o("toggle-hidden-link",d("hidden"))].join(" ")):(o("toggle-hidden-link",d("hide hidden"))))}return p.find("> .controls .subtitle").html(q.join(", "))},_renderTags:function(n){var o=this;this.tagsEditor=new l.TagsEditor({model:this.model,el:n.find(".controls .tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){o.toggleHDATagEditors(true,o.fxSpeed)},onhide:function(){o.toggleHDATagEditors(false,o.fxSpeed)},$activator:b({title:d("Edit history tags"),classes:"history-tag-btn",faIcon:"fa-tags"}).appendTo(n.find(".controls .actions"))})},_renderAnnotation:function(n){var o=this;this.annotationEditor=new c.AnnotationEditor({model:this.model,el:n.find(".controls .annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){o.toggleHDAAnnotationEditors(true,o.fxSpeed)},onhide:function(){o.toggleHDAAnnotationEditors(false,o.fxSpeed)},$activator:b({title:d("Edit history annotation"),classes:"history-annotate-btn",faIcon:"fa-comment"}).appendTo(n.find(".controls .actions"))})},_setUpBehaviors:function(n){n=n||this.$el;k.prototype._setUpBehaviors.call(this,n);if(!this.model){return}if(this.multiselectActions.length){this.actionsPopup=new a(n.find(".list-action-popup-btn"),this.multiselectActions)}if((!Galaxy.currUser||Galaxy.currUser.isAnonymous())||(Galaxy.currUser.id!==this.model.get("user_id"))){return}var o=this,p=".controls .name";n.find(p).attr("title",d("Click to rename history")).tooltip({placement:"bottom"}).make_text_editable({on_finish:function(q){var r=o.model.get("name");if(q&&q!==r){o.$el.find(p).text(q);o.model.save({name:q}).fail(function(){o.$el.find(p).text(o.model.previous("name"))})}else{o.$el.find(p).text(r)}}})},_getActions:function(){var n=this,o=[{html:d("Hide datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype.hide;n.getSelectedModels().ajaxQueue(p)}},{html:d("Unhide datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype.unhide;n.getSelectedModels().ajaxQueue(p)}},{html:d("Delete datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype["delete"];n.getSelectedModels().ajaxQueue(p)}},{html:d("Undelete datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype.undelete;n.getSelectedModels().ajaxQueue(p)}}];if(n.purgeAllowed){o.push({html:d("Permanently delete datasets"),func:function(){if(confirm(d("This will permanently remove the data in your datasets. Are you sure?"))){var p=f.HistoryDatasetAssociation.prototype.purge;n.getSelectedModels().ajaxQueue(p)}}})}o.push({html:d("Build Dataset List"),func:function(){n.getSelectedModels().promoteToHistoryDatasetCollection(n.model,"list")}});o.push({html:d("Build Dataset Pair"),func:function(){n.getSelectedModels().promoteToHistoryDatasetCollection(n.model,"paired")}});o.push({html:d("Build List of Dataset Pairs"),func:_.bind(n._showPairedCollectionModal,n)});return o},_showPairedCollectionModal:function(){var n=this,o=n.getSelectedModels().toJSON().filter(function(p){return p.history_content_type==="dataset"&&p.state===m.OK});if(o.length){require(["mvc/collection/paired-collection-creator"],function(p){window.creator=p.pairedCollectionCreatorModal(o,{historyId:n.model.id})})}else{Galaxy.modal.show({title:d("No valid datasets were selected"),body:d(["Use the checkboxes at the left of the dataset names to select them.","Selected datasets should be error-free and should have completed running."].join(" ")),buttons:{Ok:function(){Galaxy.modal.hide()}},closing_events:true})}},_attachItems:function(n){this.$list(n).append(this.views.reverse().map(function(o){return o.$el}));return this},_attachView:function(o){var n=this;n.views.unshift(o);n.$list().prepend(o.render(0).$el.hide());n.trigger("view:attached",o);o.$el.slideDown(n.fxSpeed,function(){n.trigger("view:attached:rendered")})},_getItemViewOptions:function(o){var n=k.prototype._getItemViewOptions.call(this,o);_.extend(n,{purgeAllowed:this.purgeAllowed,tagsEditorShown:(this.tagsEditor&&!this.tagsEditor.hidden),annotationEditorShown:(this.annotationEditor&&!this.annotationEditor.hidden)});return n},_handleHdaDeletionChange:function(n){if(n.get("deleted")&&!this.showDeleted){this.removeItemView(n)}this._renderCounts()},_handleHdaVisibleChange:function(n){if(n.hidden()&&!this.storage.showHidden){this.removeItemView(n)}this._renderCounts()},toggleHDATagEditors:function(n){var o=Array.prototype.slice.call(arguments,1);_.each(this.views,function(p){if(p.tagsEditor){p.tagsEditor.toggle.apply(p.tagsEditor,o)}})},toggleHDAAnnotationEditors:function(n){var o=Array.prototype.slice.call(arguments,1);_.each(this.views,function(p){if(p.annotationEditor){p.annotationEditor.toggle.apply(p.annotationEditor,o)}})},events:_.extend(_.clone(k.prototype.events),{"click .show-selectors-btn":"toggleSelectors","click .toggle-deleted-link":function(n){this.toggleShowDeleted()},"click .toggle-hidden-link":function(n){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 o={dragenter:_.bind(this.dragenter,this),dragover:_.bind(this.dragover,this),dragleave:_.bind(this.dragleave,this),drop:_.bind(this.drop,this)};var p=this._renderDropTarget();this.$list().before([this._renderDropTargetHelp(),p]);for(var n in o){if(o.hasOwnProperty(n)){p.on(n,o[n])}}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(d("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(n){n.preventDefault();n.stopPropagation();this.$(".history-drop-target").css("border","2px solid black")},dragover:function(n){n.preventDefault();n.stopPropagation()},dragleave:function(n){n.preventDefault();n.stopPropagation();this.$(".history-drop-target").css("border","1px dashed black")},drop:function(p){p.preventDefault();p.dataTransfer.dropEffect="move";var n=this,q=p.dataTransfer.getData("text");try{q=JSON.parse(q)}catch(o){this.warn("error parsing JSON from drop:",q)}this.trigger("droptarget:drop",p,q,n);return false},dataDropped:function(o){var n=this;if(_.isObject(o)&&o.model_class==="HistoryDatasetAssociation"&&o.id){return n.model.contents.copy(o.id)}return jQuery.when()},toString:function(){return"HistoryPanelEdit("+((this.model)?(this.model.get("name")):(""))+")"}});return{HistoryPanelEdit:g}});
\ 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","ui/fa-icon-button","mvc/ui/popup-menu","utils/localization"],function(h,j,m,f,e,i,l,c,b,a,d){var k=h.HistoryPanel;var g=k.extend({HDAViewClass:e.HDAListItemEdit,HDCAViewClass:i.HDCAListItemEdit,initialize:function(n){n=n||{};k.prototype.initialize.call(this,n);this.tagsEditor=null;this.annotationEditor=null;this.purgeAllowed=n.purgeAllowed||false;this.annotationEditorShown=n.annotationEditorShown||false;this.tagsEditorShown=n.tagsEditorShown||false;this.multiselectActions=n.multiselectActions||this._getActions()},_setUpListeners:function(){var n=this;k.prototype._setUpListeners.call(n);n.on("drop",function(o,p){n.dataDropped(p);n.dropTargetOff()});n.on("view:attached view:removed",function(){n._renderCounts()},n)},_setUpCollectionListeners:function(){k.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(n){this.model.fetch()},this);return this},_setUpModelListeners:function(){k.prototype._setUpModelListeners.call(this);this.model.on("change:nice_size",this.updateHistoryDiskSize,this);return this},_buildNewRender:function(){var n=k.prototype._buildNewRender.call(this);if(!this.model){return n}if(Galaxy&&Galaxy.currUser&&Galaxy.currUser.id&&Galaxy.currUser.id===this.model.get("user_id")){this._renderTags(n);this._renderAnnotation(n)}return n},renderItems:function(o){var n=k.prototype.renderItems.call(this,o);this._renderCounts(o);return n},_renderCounts:function(p){function o(s,t){return['<a class="',s,'" href="javascript:void(0);">',t,"</a>"].join("")}p=p||this.$el;var n=this.collection.where({deleted:true}),r=this.collection.where({visible:false}),q=[];if(this.views.length){q.push([this.views.length,d("shown")].join(" "))}if(n.length){q.push((!this.showDeleted)?([n.length,o("toggle-deleted-link",d("deleted"))].join(" ")):(o("toggle-deleted-link",d("hide deleted"))))}if(r.length){q.push((!this.showHidden)?([r.length,o("toggle-hidden-link",d("hidden"))].join(" ")):(o("toggle-hidden-link",d("hide hidden"))))}return p.find("> .controls .subtitle").html(q.join(", "))},_renderTags:function(n){var o=this;this.tagsEditor=new l.TagsEditor({model:this.model,el:n.find(".controls .tags-display"),onshowFirstTime:function(){this.render()},onshow:function(){o.toggleHDATagEditors(true,o.fxSpeed)},onhide:function(){o.toggleHDATagEditors(false,o.fxSpeed)},$activator:b({title:d("Edit history tags"),classes:"history-tag-btn",faIcon:"fa-tags"}).appendTo(n.find(".controls .actions"))})},_renderAnnotation:function(n){var o=this;this.annotationEditor=new c.AnnotationEditor({model:this.model,el:n.find(".controls .annotation-display"),onshowFirstTime:function(){this.render()},onshow:function(){o.toggleHDAAnnotationEditors(true,o.fxSpeed)},onhide:function(){o.toggleHDAAnnotationEditors(false,o.fxSpeed)},$activator:b({title:d("Edit history annotation"),classes:"history-annotate-btn",faIcon:"fa-comment"}).appendTo(n.find(".controls .actions"))})},_setUpBehaviors:function(n){n=n||this.$el;k.prototype._setUpBehaviors.call(this,n);if(!this.model){return}if(this.multiselectActions.length){this.actionsPopup=new a(n.find(".list-action-popup-btn"),this.multiselectActions)}if((!Galaxy.currUser||Galaxy.currUser.isAnonymous())||(Galaxy.currUser.id!==this.model.get("user_id"))){return}var o=this,p=".controls .name";n.find(p).attr("title",d("Click to rename history")).tooltip({placement:"bottom"}).make_text_editable({on_finish:function(q){var r=o.model.get("name");if(q&&q!==r){o.$el.find(p).text(q);o.model.save({name:q}).fail(function(){o.$el.find(p).text(o.model.previous("name"))})}else{o.$el.find(p).text(r)}}})},_getActions:function(){var n=this,o=[{html:d("Hide datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype.hide;n.getSelectedModels().ajaxQueue(p)}},{html:d("Unhide datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype.unhide;n.getSelectedModels().ajaxQueue(p)}},{html:d("Delete datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype["delete"];n.getSelectedModels().ajaxQueue(p)}},{html:d("Undelete datasets"),func:function(){var p=f.HistoryDatasetAssociation.prototype.undelete;n.getSelectedModels().ajaxQueue(p)}}];if(n.purgeAllowed){o.push({html:d("Permanently delete datasets"),func:function(){if(confirm(d("This will permanently remove the data in your datasets. Are you sure?"))){var p=f.HistoryDatasetAssociation.prototype.purge;n.getSelectedModels().ajaxQueue(p)}}})}o.push({html:d("Build Dataset List"),func:function(){n.getSelectedModels().promoteToHistoryDatasetCollection(n.model,"list")}});o.push({html:d("Build Dataset Pair"),func:function(){n.getSelectedModels().promoteToHistoryDatasetCollection(n.model,"paired")}});o.push({html:d("Build List of Dataset Pairs"),func:_.bind(n._showPairedCollectionModal,n)});return o},_showPairedCollectionModal:function(){var n=this,o=n.getSelectedModels().toJSON().filter(function(p){return p.history_content_type==="dataset"&&p.state===m.OK});if(o.length){require(["mvc/collection/paired-collection-creator"],function(p){window.creator=p.pairedCollectionCreatorModal(o,{historyId:n.model.id})})}else{Galaxy.modal.show({title:d("No valid datasets were selected"),body:d(["Use the checkboxes at the left of the dataset names to select them.","Selected datasets should be error-free and should have completed running."].join(" ")),buttons:{Ok:function(){Galaxy.modal.hide()}},closing_events:true})}},_attachItems:function(n){this.$list(n).append(this.views.reverse().map(function(o){return o.$el}));return this},_attachView:function(o){var n=this;n.views.unshift(o);n.$list().prepend(o.render(0).$el.hide());n.trigger("view:attached",o);o.$el.slideDown(n.fxSpeed,function(){n.trigger("view:attached:rendered")})},_getItemViewOptions:function(o){var n=k.prototype._getItemViewOptions.call(this,o);_.extend(n,{purgeAllowed:this.purgeAllowed,tagsEditorShown:(this.tagsEditor&&!this.tagsEditor.hidden),annotationEditorShown:(this.annotationEditor&&!this.annotationEditor.hidden)});return n},_handleHdaDeletionChange:function(n){if(n.get("deleted")&&!this.showDeleted){this.removeItemView(n)}this._renderCounts()},_handleHdaVisibleChange:function(n){if(n.hidden()&&!this.storage.showHidden){this.removeItemView(n)}this._renderCounts()},toggleHDATagEditors:function(n){var o=Array.prototype.slice.call(arguments,1);_.each(this.views,function(p){if(p.tagsEditor){p.tagsEditor.toggle.apply(p.tagsEditor,o)}})},toggleHDAAnnotationEditors:function(n){var o=Array.prototype.slice.call(arguments,1);_.each(this.views,function(p){if(p.annotationEditor){p.annotationEditor.toggle.apply(p.annotationEditor,o)}})},events:_.extend(_.clone(k.prototype.events),{"click .show-selectors-btn":"toggleSelectors","click .toggle-deleted-link":function(n){this.toggleShowDeleted()},"click .toggle-hidden-link":function(n){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 o={dragenter:_.bind(this.dragenter,this),dragover:_.bind(this.dragover,this),dragleave:_.bind(this.dragleave,this),drop:_.bind(this.drop,this)};var p=this._renderDropTarget();this.$list().before([this._renderDropTargetHelp(),p]);for(var n in o){if(o.hasOwnProperty(n)){p.on(n,o[n])}}return this},_renderDropTarget:function(){this.$(".history-drop-target").remove();return $("<div/>").addClass("history-drop-target").css({height:"64px",margin:"0px 10px 10px 10px",border:"1px dashed black","border-radius":"3px"})},_renderDropTargetHelp:function(){this.$(".history-drop-target-help").remove();return $("<div/>").addClass("history-drop-target-help").css({margin:"10px 10px 4px 10px",color:"grey","font-size":"80%","font-style":"italic"}).text(d("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(n){n.preventDefault();n.stopPropagation();this.$(".history-drop-target").css("border","2px solid black")},dragover:function(n){n.preventDefault();n.stopPropagation()},dragleave:function(n){n.preventDefault();n.stopPropagation();this.$(".history-drop-target").css("border","1px dashed black")},drop:function(p){p.preventDefault();p.dataTransfer.dropEffect="move";var n=this,q=p.dataTransfer.getData("text");try{q=JSON.parse(q)}catch(o){this.warn("error parsing JSON from drop:",q)}this.trigger("droptarget:drop",p,q,n);return false},dataDropped:function(o){var n=this;if(_.isObject(o)&&o.model_class==="HistoryDatasetAssociation"&&o.id){return n.model.contents.copy(o.id)}return jQuery.when()},toString:function(){return"HistoryPanelEdit("+((this.model)?(this.model.get("name")):(""))+")"}});return{HistoryPanelEdit:g}});
\ No newline at end of file
diff -r 2c6690a2faea4882a688044ec269de5b15569f58 -r a03ff352f39379b231da22259b9bde89ac7f6340 static/scripts/packed/mvc/history/multi-panel.js
--- a/static/scripts/packed/mvc/history/multi-panel.js
+++ b/static/scripts/packed/mvc/history/multi-panel.js
@@ -1,1 +1,1 @@
-define(["mvc/history/history-model","mvc/history/history-panel-edit","mvc/base-mvc","utils/ajax-queue","ui/mode-button","ui/search-input"],function(d,l,z,a){function g(I,E){E=E||{};if(!(Galaxy&&Galaxy.modal)){return I.copy()}var F=I.get("name"),C="Copy of '"+F+"'";function D(K){if(!K){if(!Galaxy.modal.$("#invalid-title").size()){var J=$("<p/>").attr("id","invalid-title").css({color:"red","margin-top":"8px"}).addClass("bg-danger").text(_l("Please enter a valid history title"));Galaxy.modal.$(".modal-body").append(J)}return false}return K}function G(J){var K=$('<p><span class="fa fa-spinner fa-spin"></span> Copying history...</p>').css("margin-top","8px");Galaxy.modal.$(".modal-body").append(K);I.copy(true,J).fail(function(){alert(_l("History could not be copied. Please contact a Galaxy administrator"))}).always(function(){Galaxy.modal.hide()})}function H(){var J=Galaxy.modal.$("#copy-modal-title").val();if(!D(J)){return}G(J)}Galaxy.modal.show(_.extend({title:_l("Copying history")+' "'+F+'"',body:$(['<label for="copy-modal-title">',_l("Enter a title for the copied history"),":","</label><br />",'<input id="copy-modal-title" class="form-control" style="width: 100%" value="',C,'" />'].join("")),buttons:{Cancel:function(){Galaxy.modal.hide()},Copy:H}},E));$("#copy-modal-title").focus().select();$("#copy-modal-title").on("keydown",function(J){if(J.keyCode===13){H()}})}var B=Backbone.View.extend(z.LoggableMixin).extend({tagName:"div",className:"history-column flex-column flex-row-container",id:function q(){if(!this.model){return""}return"history-column-"+this.model.get("id")},initialize:function c(C){C=C||{};this.panel=C.panel||this.createPanel(C);this.setUpListeners()},createPanel:function u(D){D=_.extend({model:this.model,dragItems:true},D);var C=new l.HistoryPanelEdit(D);C._renderEmptyMessage=this.__patch_renderEmptyMessage;return C},__patch_renderEmptyMessage:function(E){var D=this,F=_.chain(this.model.get("state_ids")).values().flatten().value().length,C=D.$emptyMessage(E);if(!_.isEmpty(D.hdaViews)){C.hide()}else{if(F&&!this.model.contents.length){C.empty().append($('<span class="fa fa-spinner fa-spin"></span><i>loading datasets...</i>')).show()}else{if(D.searchFor){C.text(D.noneFoundMsg).show()}else{C.text(D.emptyMsg).show()}}}return C},setUpListeners:function f(){var C=this;this.once("rendered",function(){C.trigger("rendered:initial",C)});this.setUpPanelListeners()},setUpPanelListeners:function k(){var C=this;this.listenTo(this.panel,{rendered:function(){C.trigger("rendered",C)}},this)},inView:function(C,D){var F=this.$el.offset().left,E=F+this.$el.width();if(E<C){return false}if(F>D){return false}return true},$panel:function e(){return this.$(".history-panel")},render:function A(D){D=(D!==undefined)?(D):("fast");var C=this.model?this.model.toJSON():{};this.$el.html(this.template(C));this.renderPanel(D);this.setUpBehaviors();return this},setUpBehaviors:function v(){},template:function w(D){D=D||{};var C=['<div class="panel-controls clear flex-row">',this.controlsLeftTemplate(),'<div class="pull-right">','<button class="delete-history btn btn-default">',D.deleted?_l("Undelete"):_l("Delete"),"</button>",'<button class="copy-history btn btn-default">',_l("Copy"),"</button>","</div>","</div>",'<div class="inner flex-row flex-column-container">','<div id="history-',D.id,'" class="history-column history-panel flex-column"></div>',"</div>"].join("");return $(C)},controlsLeftTemplate:function(){return(this.currentHistory)?['<div class="pull-left">','<strong class="current-label">',_l("Current History"),"</strong>","</div>"].join(""):['<div class="pull-left">','<button class="switch-to btn btn-default">',_l("Switch to"),"</button>","</div>"].join("")},renderPanel:function h(C){C=(C!==undefined)?(C):("fast");this.panel.setElement(this.$panel()).render(C);return this},events:{"click .switch-to.btn":function(){this.model.setAsCurrent()},"click .delete-history.btn":function(){var C=this,D;if(this.model.get("deleted")){D=this.model.undelete()}else{D=this.model._delete()}D.fail(function(G,E,F){alert(_l("Could not delete the history")+":\n"+F)}).done(function(E){C.render()})},"click .copy-history.btn":"copy"},copy:function s(){g(this.model)},toString:function(){return"HistoryPanelColumn("+(this.panel?this.panel:"")+")"}});var m=Backbone.View.extend(z.LoggableMixin).extend({className:"multi-history-columns",initialize:function c(C){C=C||{};this.log(this+".init",C);if(!C.currentHistoryId){throw new Error(this+" requires a currentHistoryId in the options")}this.currentHistoryId=C.currentHistoryId;this.options={columnWidth:312,borderWidth:1,columnGap:8,headerHeight:29,footerHeight:0,controlsHeight:20};this.order=C.order||"update";this.hdaQueue=new a.NamedAjaxQueue([],false);this.collection=null;this.setCollection(C.histories||[]);this.columnMap={};this.createColumns(C.columnOptions);this.setUpListeners()},setUpListeners:function f(){},setCollection:function y(D){var C=this;C.stopListening(C.collection);C.collection=D;C.sortCollection(C.order,{silent:true});C.setUpCollectionListeners();C.trigger("new-collection",C);return C},setUpCollectionListeners:function(){var C=this,D=C.collection;C.listenTo(D,{add:C.addAsCurrentColumn,"set-as-current":C.setCurrentHistory,"change:deleted":C.handleDeletedHistory,sort:function(){C.renderColumns(0)}})},setCurrentHistory:function p(D){var C=this.columnMap[this.currentHistoryId];if(C){C.currentHistory=false;C.$el.height("")}this.currentHistoryId=D.id;var E=this.columnMap[this.currentHistoryId];E.currentHistory=true;this.sortCollection();multipanel._recalcFirstColumnHeight();return E},handleDeletedHistory:function b(D){if(D.get("deleted")){this.log("handleDeletedHistory",this.collection.includeDeleted,D);var C=this;column=C.columnMap[D.id];if(!column){return}if(column.model.id===this.currentHistoryId){}else{if(!C.collection.includeDeleted){C.removeColumn(column)}}}},sortCollection:function(C,D){C=C||this.order;var E=this.currentHistoryId;switch(C){case"name":this.collection.comparator=function(F){return[F.id!==E,F.get("name").toLowerCase()]};break;case"size":this.collection.comparator=function(F){return[F.id!==E,F.get("size")]};break;default:this.collection.comparator=function(F){return[F.id!==E,Date(F.get("update_time"))]}}this.collection.sort(D);return this.collection},setOrder:function(C){if(["update","name","size"].indexOf(C)===-1){C="update"}this.order=C;this.trigger("order:change",C,this);this.$(".current-order").text(C);this.sortCollection();return this},create:function(C){return this.collection.create({current:true})},createColumns:function r(D){D=D||{};var C=this;this.columnMap={};C.collection.each(function(E,F){var G=C.createColumn(E,D);C.columnMap[E.id]=G})},createColumn:function t(E,C){C=_.extend({},C,{model:E});var D=new B(C);if(E.id===this.currentHistoryId){D.currentHistory=true}this.setUpColumnListeners(D);return D},sortedFilteredColumns:function(C){C=C||this.filters;if(!C||!C.length){return this.sortedColumns()}var D=this;return D.sortedColumns().filter(function(G,F){var E=G.currentHistory||_.every(C.map(function(H){return H.call(G)}));return E})},sortedColumns:function(){var D=this;var C=this.collection.map(function(F,E){return D.columnMap[F.id]});return C},addColumn:function o(E,C){C=C!==undefined?C:true;var D=this.createColumn(E);this.columnMap[E.id]=D;if(C){this.renderColumns()}return D},addAsCurrentColumn:function o(E){var D=this,C=this.addColumn(E,false);this.setCurrentHistory(E);C.once("rendered",function(){D.queueHdaFetch(C)});return C},removeColumn:function x(E,D){D=D!==undefined?D:true;this.log("removeColumn",E);if(!E){return}var F=this,C=this.options.columnWidth+this.options.columnGap;E.$el.fadeOut("fast",function(){if(D){$(this).remove();F.$(".middle").width(F.$(".middle").width()-C);F.checkColumnsInView();F._recalcFirstColumnHeight()}F.stopListening(E.panel);F.stopListening(E);delete F.columnMap[E.model.id];E.remove()})},setUpColumnListeners:function n(C){var D=this;D.listenTo(C,{"in-view":D.queueHdaFetch});D.listenTo(C.panel,{"view:draggable:dragstart":function(H,F,E,G){D._dropData=JSON.parse(H.dataTransfer.getData("text"));D.currentColumnDropTargetOn()},"view:draggable:dragend":function(H,F,E,G){D._dropData=null;D.currentColumnDropTargetOff()},"droptarget:drop":function(G,H,F){var I=D._dropData.filter(function(J){return(_.isObject(J)&&J.id&&J.model_class==="HistoryDatasetAssociation")});D._dropData=null;var E=new a.NamedAjaxQueue();I.forEach(function(J){E.add({name:"copy-"+J.id,fn:function(){return F.model.contents.copy(J.id)}})});E.start();E.done(function(J){F.model.fetch()})}})},columnMapLength:function(){return Object.keys(this.columnMap).length},render:function A(D){D=D!==undefined?D:this.fxSpeed;var C=this;C.log(C+".render");C.$el.html(C.mainTemplate(C));C.renderColumns(D);C.setUpBehaviors();C.trigger("rendered",C);return C},renderColumns:function j(F){F=F!==undefined?F:this.fxSpeed;var E=this,C=E.sortedFilteredColumns();E.$(".middle").width(C.length*(this.options.columnWidth+this.options.columnGap)+this.options.columnGap+16);var D=E.$(".middle");D.empty();C.forEach(function(H,G){H.$el.appendTo(D);H.delegateEvents();E.renderColumn(H,F)});if(this.searchFor&&C.length<=1){}else{E.checkColumnsInView();this._recalcFirstColumnHeight()}return C},renderColumn:function(C,D){D=D!==undefined?D:this.fxSpeed;return C.render(D)},queueHdaFetch:function i(E){if(E.model.contents.length===0&&!E.model.get("empty")){var C={},D=_.values(E.panel.storage.get("expandedIds")).join();if(D){C.dataset_details=D}this.hdaQueue.add({name:E.model.id,fn:function(){var F=E.model.contents.fetch({data:C,silent:true});return F.done(function(G){E.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},queueHdaFetchDetails:function(C){if((C.model.contents.length===0&&!C.model.get("empty"))||(!C.model.contents.haveDetails())){this.hdaQueue.add({name:C.model.id,fn:function(){var D=C.model.contents.fetch({data:{details:"all"},silent:true});return D.done(function(E){C.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},renderInfo:function(C){this.$(".header .header-info").text(C)},events:{"click .done.btn":"close","click .create-new.btn":"create","click #include-deleted":"_clickToggleDeletedHistories","click .order .order-update":function(C){this.setOrder("update")},"click .order .order-name":function(C){this.setOrder("name")},"click .order .order-size":function(C){this.setOrder("size")},"click #toggle-deleted":"_clickToggleDeletedDatasets","click #toggle-hidden":"_clickToggleHiddenDatasets"},close:function(D){var C="/";if(Galaxy&&Galaxy.options&&Galaxy.options.root){C=Galaxy.options.root}else{if(galaxy_config&&galaxy_config.root){C=galaxy_config.root}}window.location=C},_clickToggleDeletedHistories:function(C){return this.toggleDeletedHistories($(C.currentTarget).is(":checked"))},toggleDeletedHistories:function(C){if(C){window.location=Galaxy.options.root+"history/view_multiple?include_deleted_histories=True"}else{window.location=Galaxy.options.root+"history/view_multiple"}},_clickToggleDeletedDatasets:function(C){return this.toggleDeletedDatasets($(C.currentTarget).is(":checked"))},toggleDeletedDatasets:function(C){C=C!==undefined?C:false;var D=this;D.sortedFilteredColumns().forEach(function(F,E){_.delay(function(){F.panel.toggleShowDeleted(C,false)},E*200)})},_clickToggleHiddenDatasets:function(C){return this.toggleHiddenDatasets($(C.currentTarget).is(":checked"))},toggleHiddenDatasets:function(C){C=C!==undefined?C:false;var D=this;D.sortedFilteredColumns().forEach(function(F,E){_.delay(function(){F.panel.toggleShowHidden(C,false)},E*200)})},setUpBehaviors:function(){var D=this;D._moreOptionsPopover();D.$("#search-histories").searchInput({name:"search-histories",placeholder:_l("search histories"),onsearch:function(E){D.searchFor=E;D.filters=[function(){return this.model.matchesAll(D.searchFor)}];D.renderColumns(0)},onclear:function(E){D.searchFor=null;D.filters=[];D.renderColumns(0)}});D.$("#search-datasets").searchInput({name:"search-datasets",placeholder:_l("search all datasets"),onfirstsearch:function(E){D.hdaQueue.clear();D.$("#search-datasets").searchInput("toggle-loading");D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E);D.queueHdaFetchDetails(F)});D.hdaQueue.progress(function(F){D.renderInfo([_l("searching"),(F.curr+1),_l("of"),F.total].join(" "))});D.hdaQueue.deferred.done(function(){D.renderInfo("");D.$("#search-datasets").searchInput("toggle-loading")})},onsearch:function(E){D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E)})},onclear:function(E){D.searchFor=null;D.sortedFilteredColumns().forEach(function(F){F.panel.clearSearch()})}});$(window).resize(function(){D._recalcFirstColumnHeight()});var C=_.debounce(_.bind(this.checkColumnsInView,this),100);this.$(".middle").parent().scroll(C)},_moreOptionsPopover:function(){return this.$(".open-more-options.btn").popover({container:".header",placement:"bottom",html:true,content:$(this.optionsPopoverTemplate(this))})},_recalcFirstColumnHeight:function(){var C=this.$(".history-column").first(),E=this.$(".middle").height(),D=C.find(".panel-controls").height();C.height(E).find(".inner").height(E-D)},_viewport:function(){var C=this.$(".middle").parent().offset().left;return{left:C,right:C+this.$(".middle").parent().width()}},columnsInView:function(){var C=this._viewport();return this.sortedFilteredColumns().filter(function(D){return D.currentHistory||D.inView(C.left,C.right)})},checkColumnsInView:function(){this.columnsInView().forEach(function(C){C.trigger("in-view",C)})},currentColumnDropTargetOn:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=function(D){};C.panel.dropTargetOn()},currentColumnDropTargetOff:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=l.HistoryPanelEdit.prototype.dataDrop;C.panel.dropTargetOff()},toString:function(){return"MultiPanelColumns("+(this.columns?this.columns.length:0)+")"},mainTemplate:_.template(['<div class="header flex-column-container">','<div class="control-column control-column-left flex-column">','<button class="create-new btn btn-default">',_l("Create new"),"</button> ",'<div id="search-histories" class="search-control"></div>','<div id="search-datasets" class="search-control"></div>','<button class="open-more-options btn btn-default">','<span class="fa fa-ellipsis-h" title="More options"></span>',"</button>","</div>",'<div class="control-column control-column-center flex-column">','<div class="header-info">',"</div>","</div>",'<div class="control-column control-column-right flex-column">','<button class="done btn btn-default">',_l("Done"),"</button>","</div>","</div>",'<div class="outer-middle flex-row flex-row-container">','<div class="middle flex-column-container flex-row"></div>',"</div>",'<div class="footer flex-column-container">',"</div>"].join(""),{variable:"view"}),optionsPopoverTemplate:_.template(['<div class="more-options">','<div class="checkbox"><label><input id="include-deleted" type="checkbox"','<%= view.collection.includeDeleted? " checked" : "" %>>',_l("Include deleted histories"),"</label></div>",'<div class="order btn-group">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',_l("Order histories by")+" ",'<span class="current-order"><%= view.order %></span> ','<span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">','<li><a href="javascript:void(0);" class="order-update">',_l("Time of last update"),"</a></li>",'<li><a href="javascript:void(0);" class="order-name">',_l("Name"),"</a></li>",'<li><a href="javascript:void(0);" class="order-size">',_l("Size"),"</a></li>","</ul>","</div>",'<div class="checkbox"><label><input id="toggle-deleted" type="checkbox">',_l("Include deleted datasets"),"</label></div>",'<div class="checkbox"><label><input id="toggle-hidden" type="checkbox">',_l("Include hidden datasets"),"</label></div>","</div>"].join(""),{variable:"view"}),});return{MultiPanelColumns:m}});
\ No newline at end of file
+define(["mvc/history/history-model","mvc/history/history-panel-edit","mvc/base-mvc","utils/ajax-queue","ui/mode-button","ui/search-input"],function(d,l,z,a){function g(I,E){E=E||{};if(!(Galaxy&&Galaxy.modal)){return I.copy()}var F=I.get("name"),C="Copy of '"+F+"'";function D(K){if(!K){if(!Galaxy.modal.$("#invalid-title").size()){var J=$("<p/>").attr("id","invalid-title").css({color:"red","margin-top":"8px"}).addClass("bg-danger").text(_l("Please enter a valid history title"));Galaxy.modal.$(".modal-body").append(J)}return false}return K}function G(J){var K=$('<p><span class="fa fa-spinner fa-spin"></span> Copying history...</p>').css("margin-top","8px");Galaxy.modal.$(".modal-body").append(K);I.copy(true,J).fail(function(){alert(_l("History could not be copied. Please contact a Galaxy administrator"))}).always(function(){Galaxy.modal.hide()})}function H(){var J=Galaxy.modal.$("#copy-modal-title").val();if(!D(J)){return}G(J)}Galaxy.modal.show(_.extend({title:_l("Copying history")+' "'+F+'"',body:$(['<label for="copy-modal-title">',_l("Enter a title for the copied history"),":","</label><br />",'<input id="copy-modal-title" class="form-control" style="width: 100%" value="',C,'" />'].join("")),buttons:{Cancel:function(){Galaxy.modal.hide()},Copy:H}},E));$("#copy-modal-title").focus().select();$("#copy-modal-title").on("keydown",function(J){if(J.keyCode===13){H()}})}var B=Backbone.View.extend(z.LoggableMixin).extend({tagName:"div",className:"history-column flex-column flex-row-container",id:function q(){if(!this.model){return""}return"history-column-"+this.model.get("id")},initialize:function c(C){C=C||{};this.panel=C.panel||this.createPanel(C);this.setUpListeners()},createPanel:function u(D){D=_.extend({model:this.model,dragItems:true},D);var C=new l.HistoryPanelEdit(D);C._renderEmptyMessage=this.__patch_renderEmptyMessage;return C},__patch_renderEmptyMessage:function(E){var D=this,F=_.chain(this.model.get("state_ids")).values().flatten().value().length,C=D.$emptyMessage(E);if(!_.isEmpty(D.hdaViews)){C.hide()}else{if(F&&!this.model.contents.length){C.empty().append($('<span class="fa fa-spinner fa-spin"></span><i>loading datasets...</i>')).show()}else{if(D.searchFor){C.text(D.noneFoundMsg).show()}else{C.text(D.emptyMsg).show()}}}return C},setUpListeners:function f(){var C=this;this.once("rendered",function(){C.trigger("rendered:initial",C)});this.setUpPanelListeners()},setUpPanelListeners:function k(){var C=this;this.listenTo(this.panel,{rendered:function(){C.trigger("rendered",C)}},this)},inView:function(C,D){var F=this.$el.offset().left,E=F+this.$el.width();if(E<C){return false}if(F>D){return false}return true},$panel:function e(){return this.$(".history-panel")},render:function A(D){D=(D!==undefined)?(D):("fast");var C=this.model?this.model.toJSON():{};this.$el.html(this.template(C));this.renderPanel(D);this.setUpBehaviors();return this},setUpBehaviors:function v(){},template:function w(D){D=D||{};var C=['<div class="panel-controls clear flex-row">',this.controlsLeftTemplate(),'<div class="pull-right">','<button class="delete-history btn btn-default">',D.deleted?_l("Undelete"):_l("Delete"),"</button>",'<button class="copy-history btn btn-default">',_l("Copy"),"</button>","</div>","</div>",'<div class="inner flex-row flex-column-container">','<div id="history-',D.id,'" class="history-column history-panel flex-column"></div>',"</div>"].join("");return $(C)},controlsLeftTemplate:function(){return(this.currentHistory)?['<div class="pull-left">','<strong class="current-label">',_l("Current History"),"</strong>","</div>"].join(""):['<div class="pull-left">','<button class="switch-to btn btn-default">',_l("Switch to"),"</button>","</div>"].join("")},renderPanel:function h(C){C=(C!==undefined)?(C):("fast");this.panel.setElement(this.$panel()).render(C);if(this.currentHistory){this.panel.$list().before(this.panel._renderDropTargetHelp())}return this},events:{"click .switch-to.btn":function(){this.model.setAsCurrent()},"click .delete-history.btn":function(){var C=this,D;if(this.model.get("deleted")){D=this.model.undelete()}else{D=this.model._delete()}D.fail(function(G,E,F){alert(_l("Could not delete the history")+":\n"+F)}).done(function(E){C.render()})},"click .copy-history.btn":"copy"},copy:function s(){g(this.model)},toString:function(){return"HistoryPanelColumn("+(this.panel?this.panel:"")+")"}});var m=Backbone.View.extend(z.LoggableMixin).extend({className:"multi-history-columns",initialize:function c(C){C=C||{};this.log(this+".init",C);if(!C.currentHistoryId){throw new Error(this+" requires a currentHistoryId in the options")}this.currentHistoryId=C.currentHistoryId;this.options={columnWidth:312,borderWidth:1,columnGap:8,headerHeight:29,footerHeight:0,controlsHeight:20};this.order=C.order||"update";this.hdaQueue=new a.NamedAjaxQueue([],false);this.collection=null;this.setCollection(C.histories||[]);this.columnMap={};this.createColumns(C.columnOptions);this.setUpListeners()},setUpListeners:function f(){},setCollection:function y(D){var C=this;C.stopListening(C.collection);C.collection=D;C.sortCollection(C.order,{silent:true});C.setUpCollectionListeners();C.trigger("new-collection",C);return C},setUpCollectionListeners:function(){var C=this,D=C.collection;C.listenTo(D,{add:C.addAsCurrentColumn,"set-as-current":C.setCurrentHistory,"change:deleted":C.handleDeletedHistory,sort:function(){C.renderColumns(0)}})},setCurrentHistory:function p(D){var C=this.columnMap[this.currentHistoryId];if(C){C.currentHistory=false;C.$el.height("")}this.currentHistoryId=D.id;var E=this.columnMap[this.currentHistoryId];E.currentHistory=true;this.sortCollection();multipanel._recalcFirstColumnHeight();return E},handleDeletedHistory:function b(D){if(D.get("deleted")){this.log("handleDeletedHistory",this.collection.includeDeleted,D);var C=this;column=C.columnMap[D.id];if(!column){return}if(column.model.id===this.currentHistoryId){}else{if(!C.collection.includeDeleted){C.removeColumn(column)}}}},sortCollection:function(C,D){C=C||this.order;var E=this.currentHistoryId;switch(C){case"name":this.collection.comparator=function(F){return[F.id!==E,F.get("name").toLowerCase()]};break;case"size":this.collection.comparator=function(F){return[F.id!==E,F.get("size")]};break;default:this.collection.comparator=function(F){return[F.id!==E,Date(F.get("update_time"))]}}this.collection.sort(D);return this.collection},setOrder:function(C){if(["update","name","size"].indexOf(C)===-1){C="update"}this.order=C;this.trigger("order:change",C,this);this.$(".current-order").text(C);this.sortCollection();return this},create:function(C){return this.collection.create({current:true})},createColumns:function r(D){D=D||{};var C=this;this.columnMap={};C.collection.each(function(E,F){var G=C.createColumn(E,D);C.columnMap[E.id]=G})},createColumn:function t(E,C){C=_.extend({},C,{model:E});var D=new B(C);if(E.id===this.currentHistoryId){D.currentHistory=true}this.setUpColumnListeners(D);return D},sortedFilteredColumns:function(C){C=C||this.filters;if(!C||!C.length){return this.sortedColumns()}var D=this;return D.sortedColumns().filter(function(G,F){var E=G.currentHistory||_.every(C.map(function(H){return H.call(G)}));return E})},sortedColumns:function(){var D=this;var C=this.collection.map(function(F,E){return D.columnMap[F.id]});return C},addColumn:function o(E,C){C=C!==undefined?C:true;var D=this.createColumn(E);this.columnMap[E.id]=D;if(C){this.renderColumns()}return D},addAsCurrentColumn:function o(E){var D=this,C=this.addColumn(E,false);this.setCurrentHistory(E);C.once("rendered",function(){D.queueHdaFetch(C)});return C},removeColumn:function x(E,D){D=D!==undefined?D:true;this.log("removeColumn",E);if(!E){return}var F=this,C=this.options.columnWidth+this.options.columnGap;E.$el.fadeOut("fast",function(){if(D){$(this).remove();F.$(".middle").width(F.$(".middle").width()-C);F.checkColumnsInView();F._recalcFirstColumnHeight()}F.stopListening(E.panel);F.stopListening(E);delete F.columnMap[E.model.id];E.remove()})},setUpColumnListeners:function n(C){var D=this;D.listenTo(C,{"in-view":D.queueHdaFetch});D.listenTo(C.panel,{"view:draggable:dragstart":function(H,F,E,G){D._dropData=JSON.parse(H.dataTransfer.getData("text"));D.currentColumnDropTargetOn()},"view:draggable:dragend":function(H,F,E,G){D._dropData=null;D.currentColumnDropTargetOff()},"droptarget:drop":function(G,H,F){var I=D._dropData.filter(function(J){return(_.isObject(J)&&J.id&&J.model_class==="HistoryDatasetAssociation")});D._dropData=null;var E=new a.NamedAjaxQueue();I.forEach(function(J){E.add({name:"copy-"+J.id,fn:function(){return F.model.contents.copy(J.id)}})});E.start();E.done(function(J){F.model.fetch()})}})},columnMapLength:function(){return Object.keys(this.columnMap).length},render:function A(D){D=D!==undefined?D:this.fxSpeed;var C=this;C.log(C+".render");C.$el.html(C.mainTemplate(C));C.renderColumns(D);C.setUpBehaviors();C.trigger("rendered",C);return C},renderColumns:function j(F){F=F!==undefined?F:this.fxSpeed;var E=this,C=E.sortedFilteredColumns();E.$(".middle").width(C.length*(this.options.columnWidth+this.options.columnGap)+this.options.columnGap+16);var D=E.$(".middle");D.empty();C.forEach(function(H,G){H.$el.appendTo(D);H.delegateEvents();E.renderColumn(H,F)});if(this.searchFor&&C.length<=1){}else{E.checkColumnsInView();this._recalcFirstColumnHeight()}return C},renderColumn:function(C,D){D=D!==undefined?D:this.fxSpeed;return C.render(D)},queueHdaFetch:function i(E){if(E.model.contents.length===0&&!E.model.get("empty")){var C={},D=_.values(E.panel.storage.get("expandedIds")).join();if(D){C.dataset_details=D}this.hdaQueue.add({name:E.model.id,fn:function(){var F=E.model.contents.fetch({data:C,silent:true});return F.done(function(G){E.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},queueHdaFetchDetails:function(C){if((C.model.contents.length===0&&!C.model.get("empty"))||(!C.model.contents.haveDetails())){this.hdaQueue.add({name:C.model.id,fn:function(){var D=C.model.contents.fetch({data:{details:"all"},silent:true});return D.done(function(E){C.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},renderInfo:function(C){this.$(".header .header-info").text(C)},events:{"click .done.btn":"close","click .create-new.btn":"create","click #include-deleted":"_clickToggleDeletedHistories","click .order .order-update":function(C){this.setOrder("update")},"click .order .order-name":function(C){this.setOrder("name")},"click .order .order-size":function(C){this.setOrder("size")},"click #toggle-deleted":"_clickToggleDeletedDatasets","click #toggle-hidden":"_clickToggleHiddenDatasets"},close:function(D){var C="/";if(Galaxy&&Galaxy.options&&Galaxy.options.root){C=Galaxy.options.root}else{if(galaxy_config&&galaxy_config.root){C=galaxy_config.root}}window.location=C},_clickToggleDeletedHistories:function(C){return this.toggleDeletedHistories($(C.currentTarget).is(":checked"))},toggleDeletedHistories:function(C){if(C){window.location=Galaxy.options.root+"history/view_multiple?include_deleted_histories=True"}else{window.location=Galaxy.options.root+"history/view_multiple"}},_clickToggleDeletedDatasets:function(C){return this.toggleDeletedDatasets($(C.currentTarget).is(":checked"))},toggleDeletedDatasets:function(C){C=C!==undefined?C:false;var D=this;D.sortedFilteredColumns().forEach(function(F,E){_.delay(function(){F.panel.toggleShowDeleted(C,false)},E*200)})},_clickToggleHiddenDatasets:function(C){return this.toggleHiddenDatasets($(C.currentTarget).is(":checked"))},toggleHiddenDatasets:function(C){C=C!==undefined?C:false;var D=this;D.sortedFilteredColumns().forEach(function(F,E){_.delay(function(){F.panel.toggleShowHidden(C,false)},E*200)})},setUpBehaviors:function(){var D=this;D._moreOptionsPopover();D.$("#search-histories").searchInput({name:"search-histories",placeholder:_l("search histories"),onsearch:function(E){D.searchFor=E;D.filters=[function(){return this.model.matchesAll(D.searchFor)}];D.renderColumns(0)},onclear:function(E){D.searchFor=null;D.filters=[];D.renderColumns(0)}});D.$("#search-datasets").searchInput({name:"search-datasets",placeholder:_l("search all datasets"),onfirstsearch:function(E){D.hdaQueue.clear();D.$("#search-datasets").searchInput("toggle-loading");D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E);D.queueHdaFetchDetails(F)});D.hdaQueue.progress(function(F){D.renderInfo([_l("searching"),(F.curr+1),_l("of"),F.total].join(" "))});D.hdaQueue.deferred.done(function(){D.renderInfo("");D.$("#search-datasets").searchInput("toggle-loading")})},onsearch:function(E){D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E)})},onclear:function(E){D.searchFor=null;D.sortedFilteredColumns().forEach(function(F){F.panel.clearSearch()})}});$(window).resize(function(){D._recalcFirstColumnHeight()});var C=_.debounce(_.bind(this.checkColumnsInView,this),100);this.$(".middle").parent().scroll(C)},_moreOptionsPopover:function(){return this.$(".open-more-options.btn").popover({container:".header",placement:"bottom",html:true,content:$(this.optionsPopoverTemplate(this))})},_recalcFirstColumnHeight:function(){var C=this.$(".history-column").first(),E=this.$(".middle").height(),D=C.find(".panel-controls").height();C.height(E).find(".inner").height(E-D)},_viewport:function(){var C=this.$(".middle").parent().offset().left;return{left:C,right:C+this.$(".middle").parent().width()}},columnsInView:function(){var C=this._viewport();return this.sortedFilteredColumns().filter(function(D){return D.currentHistory||D.inView(C.left,C.right)})},checkColumnsInView:function(){this.columnsInView().forEach(function(C){C.trigger("in-view",C)})},currentColumnDropTargetOn:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=function(D){};C.panel.dropTargetOn()},currentColumnDropTargetOff:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=l.HistoryPanelEdit.prototype.dataDrop;C.panel.dropTarget=false;C.panel.$(".history-drop-target").remove()},toString:function(){return"MultiPanelColumns("+(this.columns?this.columns.length:0)+")"},mainTemplate:_.template(['<div class="header flex-column-container">','<div class="control-column control-column-left flex-column">','<button class="create-new btn btn-default">',_l("Create new"),"</button> ",'<div id="search-histories" class="search-control"></div>','<div id="search-datasets" class="search-control"></div>','<button class="open-more-options btn btn-default">','<span class="fa fa-ellipsis-h" title="More options"></span>',"</button>","</div>",'<div class="control-column control-column-center flex-column">','<div class="header-info">',"</div>","</div>",'<div class="control-column control-column-right flex-column">','<button class="done btn btn-default">',_l("Done"),"</button>","</div>","</div>",'<div class="outer-middle flex-row flex-row-container">','<div class="middle flex-column-container flex-row"></div>',"</div>",'<div class="footer flex-column-container">',"</div>"].join(""),{variable:"view"}),optionsPopoverTemplate:_.template(['<div class="more-options">','<div class="checkbox"><label><input id="include-deleted" type="checkbox"','<%= view.collection.includeDeleted? " checked" : "" %>>',_l("Include deleted histories"),"</label></div>",'<div class="order btn-group">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',_l("Order histories by")+" ",'<span class="current-order"><%= view.order %></span> ','<span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">','<li><a href="javascript:void(0);" class="order-update">',_l("Time of last update"),"</a></li>",'<li><a href="javascript:void(0);" class="order-name">',_l("Name"),"</a></li>",'<li><a href="javascript:void(0);" class="order-size">',_l("Size"),"</a></li>","</ul>","</div>",'<div class="checkbox"><label><input id="toggle-deleted" type="checkbox">',_l("Include deleted datasets"),"</label></div>",'<div class="checkbox"><label><input id="toggle-hidden" type="checkbox">',_l("Include hidden datasets"),"</label></div>","</div>"].join(""),{variable:"view"}),});return{MultiPanelColumns:m}});
\ No newline at end of file
https://bitbucket.org/galaxy/galaxy-central/commits/51a3606fe3bd/
Changeset: 51a3606fe3bd
User: carlfeberhard
Date: 2015-02-12 16:18:40+00:00
Summary: Merge
Affected #: 6 files
diff -r a03ff352f39379b231da22259b9bde89ac7f6340 -r 51a3606fe3bdf21d663b35d41c886ff819fd234d client/galaxy/scripts/mvc/tools/tools-parameters.js
--- /dev/null
+++ b/client/galaxy/scripts/mvc/tools/tools-parameters.js
@@ -0,0 +1,247 @@
+/**
+ This class creates input elements. New input parameter types should be added to the types dictionary.
+*/
+define(['utils/utils','mvc/ui/ui-misc', 'mvc/tools/tools-select-content'],
+ function(Utils, Ui, SelectContent) {
+
+ // create form view
+ return Backbone.Model.extend({
+ /** Available parameter types */
+ types: {
+ 'text' : '_fieldText',
+ 'select' : '_fieldSelect',
+ 'data_column' : '_fieldSelect',
+ 'genomebuild' : '_fieldSelect',
+ 'data' : '_fieldData',
+ 'data_collection' : '_fieldData',
+ 'integer' : '_fieldSlider',
+ 'float' : '_fieldSlider',
+ 'boolean' : '_fieldBoolean',
+ 'drill_down' : '_fieldDrilldown',
+ 'hidden' : '_fieldHidden',
+ 'hidden_data' : '_fieldHidden',
+ 'baseurl' : '_fieldHidden'
+ },
+
+ // initialize
+ initialize: function(app, options) {
+ this.app = app;
+ },
+
+ /** Returns an input field for a given field type
+ */
+ create: function(input_def) {
+ // add regular/default value if missing
+ if (input_def.value === undefined) {
+ input_def.value = null;
+ }
+ if (input_def.default_value === undefined) {
+ input_def.default_value = input_def.value;
+ }
+
+ // field wrapper
+ var field = null;
+
+ // get field class
+ var fieldClass = this.types[input_def.type];
+ if (fieldClass && typeof(this[fieldClass]) === 'function') {
+ field = this[fieldClass].call(this, input_def);
+ }
+
+ // identify field type
+ if (!field) {
+ // flag
+ this.app.incompatible = true;
+
+ // with or without options
+ if (input_def.options) {
+ // assign select field
+ field = this._fieldSelect(input_def);
+ } else {
+ // assign text field
+ field = this._fieldText(input_def);
+ }
+
+ // log
+ console.debug('tools-form::_addRow() : Auto matched field type (' + input_def.type + ').');
+ }
+
+ // set field value
+ if (input_def.value !== undefined) {
+ field.value(input_def.value);
+ }
+
+ // return field element
+ return field;
+ },
+
+ /** Data input field
+ */
+ _fieldData : function(input_def) {
+ if (!this.app.options.is_dynamic) {
+ input_def.info = 'Data input \'' + input_def.name + '\' (' + Utils.textify(input_def.extensions.toString()) + ')';
+ input_def.value = null;
+ return this._fieldHidden(input_def);
+ }
+ var self = this;
+ return new SelectContent.View(this.app, {
+ id : 'field-' + input_def.id,
+ extensions : input_def.extensions,
+ optional : input_def.optional,
+ multiple : input_def.multiple,
+ type : input_def.type,
+ data : input_def.options,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Select/Checkbox/Radio options field
+ */
+ _fieldSelect : function (input_def) {
+ // show text field in if dynamic fields are disabled e.g. in workflow editor
+ if (!this.app.options.is_dynamic && input_def.is_dynamic) {
+ return this._fieldText(input_def);
+ }
+
+ // customize properties
+ if (input_def.type == 'data_column') {
+ input_def.error_text = 'Missing columns in referenced dataset.'
+ }
+ if (input_def.type == 'genomebuild') {
+ input_def.searchable = true;
+ }
+
+ // configure options fields
+ var options = [];
+ for (var i in input_def.options) {
+ var option = input_def.options[i];
+ options.push({
+ label: option[0],
+ value: option[1]
+ });
+ }
+
+ // identify display type
+ var SelectClass = Ui.Select;
+ switch (input_def.display) {
+ case 'checkboxes':
+ SelectClass = Ui.Checkbox;
+ break;
+ case 'radio':
+ SelectClass = Ui.Radio;
+ break;
+ }
+
+ // select field
+ var self = this;
+ return new SelectClass.View({
+ id : 'field-' + input_def.id,
+ data : options,
+ error_text : input_def.error_text || 'No options available',
+ multiple : input_def.multiple,
+ searchable : input_def.searchable,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Drill down options field
+ */
+ _fieldDrilldown : function (input_def) {
+ // show text field in if dynamic fields are disabled e.g. in workflow editor
+ if (!this.app.options.is_dynamic && input_def.is_dynamic) {
+ return this._fieldText(input_def);
+ }
+
+ // create drill down field
+ var self = this;
+ return new Ui.Drilldown.View({
+ id : 'field-' + input_def.id,
+ data : input_def.options,
+ display : input_def.display,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Text input field
+ */
+ _fieldText : function(input_def) {
+ // field replaces e.g. a select field
+ if (input_def.options) {
+ // show text area if selecting multiple entries is allowed
+ input_def.area = input_def.multiple;
+
+ // validate value
+ if (!Utils.validate(input_def.value)) {
+ input_def.value = '';
+ } else {
+ if (input_def.value instanceof Array) {
+ input_def.value = value.toString();
+ } else {
+ input_def.value = String(input_def.value).replace(/[\[\]'"\s]/g, '');
+ if (input_def.multiple) {
+ input_def.value = input_def.value.replace(/,/g, '\n');
+ }
+ }
+ }
+ }
+
+ // create input element
+ var self = this;
+ return new Ui.Input({
+ id : 'field-' + input_def.id,
+ area : input_def.area,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Slider field
+ */
+ _fieldSlider: function(input_def) {
+ var self = this;
+ return new Ui.Slider.View({
+ id : 'field-' + input_def.id,
+ precise : input_def.type == 'float',
+ min : input_def.min,
+ max : input_def.max,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Hidden field
+ */
+ _fieldHidden : function(input_def) {
+ return new Ui.Hidden({
+ id : 'field-' + input_def.id,
+ info : input_def.info
+ });
+ },
+
+ /** Boolean field
+ */
+ _fieldBoolean : function(input_def) {
+ var self = this;
+ return new Ui.RadioButton.View({
+ id : 'field-' + input_def.id,
+ data : [ { label : 'Yes', value : 'true' },
+ { label : 'No', value : 'false' }],
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ }
+ });
+
+ return {
+ View: View
+ };
+});
diff -r a03ff352f39379b231da22259b9bde89ac7f6340 -r 51a3606fe3bdf21d663b35d41c886ff819fd234d 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
@@ -1,8 +1,14 @@
/**
- This class creates a tool form section and populates it with input elements. It also handles repeat blocks and conditionals by recursively creating new sub sections. New input elements can be plugged in by adding cases to the switch block defined in the _createField() function.
+ This class creates a tool form section and populates it with input elements. It also handles repeat blocks and conditionals by recursively creating new sub sections.
*/
-define(['utils/utils', 'mvc/ui/ui-table', 'mvc/ui/ui-misc', 'mvc/ui/ui-portlet', 'mvc/tools/tools-repeat', 'mvc/tools/tools-select-content', 'mvc/tools/tools-input'],
- function(Utils, Table, Ui, Portlet, Repeat, SelectContent, InputElement) {
+define(['utils/utils',
+ 'mvc/ui/ui-table',
+ 'mvc/ui/ui-misc',
+ 'mvc/ui/ui-portlet',
+ 'mvc/tools/tools-repeat',
+ 'mvc/tools/tools-input',
+ 'mvc/tools/tools-parameters'],
+ function(Utils, Table, Ui, Portlet, Repeat, InputElement, Parameters) {
// create form view
var View = Backbone.View.extend({
@@ -23,6 +29,9 @@
// create table
this.table = new Table.View(options);
+
+ // create parameter handler
+ this.parameters = new Parameters(app, options);
// configure portlet and form table
this.setElement(this.table.$el);
@@ -294,16 +303,8 @@
// get id
var id = input_def.id;
- // add regular/default value if missing
- if (input_def.value === undefined) {
- input_def.value = null;
- }
- if (input_def.default_value === undefined) {
- input_def.default_value = input_def.value;
- }
-
// create input field
- var field = this._createField(input_def);
+ var field = this.parameters.create(input_def);
// add to field list
this.app.field_list[id] = field;
@@ -333,265 +334,6 @@
// return created field
return field;
- },
-
- /** Returns an input field for a given field type
- */
- _createField: function(input_def) {
- // field wrapper
- var field = null;
-
- // identify field type
- switch(input_def.type) {
- // text input field
- case 'text' :
- field = this._fieldText(input_def);
- break;
-
- // select field
- case 'select' :
- field = this._fieldSelect(input_def);
- break;
-
- // data selector
- case 'data':
- field = this._fieldData(input_def);
- break;
-
- // collection selector
- case 'data_collection':
- field = this._fieldData(input_def);
- break;
-
- // data column
- case 'data_column':
- input_def.error_text = 'Missing columns in referenced dataset.';
- field = this._fieldSelect(input_def);
- break;
-
- // hidden field
- case 'hidden':
- field = this._fieldHidden(input_def);
- break;
-
- // hidden data field
- case 'hidden_data':
- field = this._fieldHidden(input_def);
- break;
-
- // integer field
- case 'integer':
- field = this._fieldSlider(input_def);
- break;
-
- // float field
- case 'float':
- field = this._fieldSlider(input_def);
- break;
-
- // boolean field
- case 'boolean':
- field = this._fieldBoolean(input_def);
- break;
-
- // genome field
- case 'genomebuild':
- input_def.searchable = true;
- field = this._fieldSelect(input_def);
- break;
-
- // drill down field
- case 'drill_down':
- field = this._fieldDrilldown(input_def);
- break;
-
- // base url field
- case 'baseurl':
- field = this._fieldHidden(input_def);
- break;
-
- // field not found
- default:
- // flag
- this.app.incompatible = true;
-
- // with or without options
- if (input_def.options) {
- // assign select field
- field = this._fieldSelect(input_def);
- } else {
- // assign text field
- field = this._fieldText(input_def);
- }
-
- // log
- console.debug('tools-form::_addRow() : Auto matched field type (' + input_def.type + ').');
- }
-
- // set field value
- if (input_def.value !== undefined) {
- field.value(input_def.value);
- }
-
- // return field element
- return field;
- },
-
- /** Data input field
- */
- _fieldData : function(input_def) {
- if (!this.app.options.is_dynamic) {
- input_def.info = 'Data input \'' + input_def.name + '\' (' + Utils.textify(input_def.extensions.toString()) + ')';
- input_def.value = null;
- return this._fieldHidden(input_def);
- }
- var self = this;
- return new SelectContent.View(this.app, {
- id : 'field-' + input_def.id,
- extensions : input_def.extensions,
- optional : input_def.optional,
- multiple : input_def.multiple,
- type : input_def.type,
- data : input_def.options,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Select/Checkbox/Radio options field
- */
- _fieldSelect : function (input_def) {
- // show text field in if dynamic fields are disabled e.g. in workflow editor
- if (!this.app.options.is_dynamic && input_def.is_dynamic) {
- return this._fieldText(input_def);
- }
-
- // configure options fields
- var options = [];
- for (var i in input_def.options) {
- var option = input_def.options[i];
- options.push({
- label: option[0],
- value: option[1]
- });
- }
-
- // identify display type
- var SelectClass = Ui.Select;
- switch (input_def.display) {
- case 'checkboxes':
- SelectClass = Ui.Checkbox;
- break;
- case 'radio':
- SelectClass = Ui.Radio;
- break;
- }
-
- // select field
- var self = this;
- return new SelectClass.View({
- id : 'field-' + input_def.id,
- data : options,
- error_text : input_def.error_text || 'No options available',
- multiple : input_def.multiple,
- searchable : input_def.searchable,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Drill down options field
- */
- _fieldDrilldown : function (input_def) {
- // show text field in if dynamic fields are disabled e.g. in workflow editor
- if (!this.app.options.is_dynamic && input_def.is_dynamic) {
- return this._fieldText(input_def);
- }
-
- // create drill down field
- var self = this;
- return new Ui.Drilldown.View({
- id : 'field-' + input_def.id,
- data : input_def.options,
- display : input_def.display,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Text input field
- */
- _fieldText : function(input_def) {
- // field replaces e.g. a select field
- if (input_def.options) {
- // show text area if selecting multiple entries is allowed
- input_def.area = input_def.multiple;
-
- // validate value
- if (!Utils.validate(input_def.value)) {
- input_def.value = '';
- } else {
- if (input_def.value instanceof Array) {
- input_def.value = value.toString();
- } else {
- input_def.value = String(input_def.value).replace(/[\[\]'"\s]/g, '');
- if (input_def.multiple) {
- input_def.value = input_def.value.replace(/,/g, '\n');
- }
- }
- }
- }
-
- // create input element
- var self = this;
- return new Ui.Input({
- id : 'field-' + input_def.id,
- area : input_def.area,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Slider field
- */
- _fieldSlider: function(input_def) {
- var self = this;
- return new Ui.Slider.View({
- id : 'field-' + input_def.id,
- precise : input_def.type == 'float',
- min : input_def.min,
- max : input_def.max,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Hidden field
- */
- _fieldHidden : function(input_def) {
- return new Ui.Hidden({
- id : 'field-' + input_def.id,
- info : input_def.info
- });
- },
-
- /** Boolean field
- */
- _fieldBoolean : function(input_def) {
- var self = this;
- return new Ui.RadioButton.View({
- id : 'field-' + input_def.id,
- data : [ { label : 'Yes', value : 'true' },
- { label : 'No', value : 'false' }],
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
}
});
diff -r a03ff352f39379b231da22259b9bde89ac7f6340 -r 51a3606fe3bdf21d663b35d41c886ff819fd234d static/scripts/mvc/tools/tools-parameters.js
--- /dev/null
+++ b/static/scripts/mvc/tools/tools-parameters.js
@@ -0,0 +1,247 @@
+/**
+ This class creates input elements. New input parameter types should be added to the types dictionary.
+*/
+define(['utils/utils','mvc/ui/ui-misc', 'mvc/tools/tools-select-content'],
+ function(Utils, Ui, SelectContent) {
+
+ // create form view
+ return Backbone.Model.extend({
+ /** Available parameter types */
+ types: {
+ 'text' : '_fieldText',
+ 'select' : '_fieldSelect',
+ 'data_column' : '_fieldSelect',
+ 'genomebuild' : '_fieldSelect',
+ 'data' : '_fieldData',
+ 'data_collection' : '_fieldData',
+ 'integer' : '_fieldSlider',
+ 'float' : '_fieldSlider',
+ 'boolean' : '_fieldBoolean',
+ 'drill_down' : '_fieldDrilldown',
+ 'hidden' : '_fieldHidden',
+ 'hidden_data' : '_fieldHidden',
+ 'baseurl' : '_fieldHidden'
+ },
+
+ // initialize
+ initialize: function(app, options) {
+ this.app = app;
+ },
+
+ /** Returns an input field for a given field type
+ */
+ create: function(input_def) {
+ // add regular/default value if missing
+ if (input_def.value === undefined) {
+ input_def.value = null;
+ }
+ if (input_def.default_value === undefined) {
+ input_def.default_value = input_def.value;
+ }
+
+ // field wrapper
+ var field = null;
+
+ // get field class
+ var fieldClass = this.types[input_def.type];
+ if (fieldClass && typeof(this[fieldClass]) === 'function') {
+ field = this[fieldClass].call(this, input_def);
+ }
+
+ // identify field type
+ if (!field) {
+ // flag
+ this.app.incompatible = true;
+
+ // with or without options
+ if (input_def.options) {
+ // assign select field
+ field = this._fieldSelect(input_def);
+ } else {
+ // assign text field
+ field = this._fieldText(input_def);
+ }
+
+ // log
+ console.debug('tools-form::_addRow() : Auto matched field type (' + input_def.type + ').');
+ }
+
+ // set field value
+ if (input_def.value !== undefined) {
+ field.value(input_def.value);
+ }
+
+ // return field element
+ return field;
+ },
+
+ /** Data input field
+ */
+ _fieldData : function(input_def) {
+ if (!this.app.options.is_dynamic) {
+ input_def.info = 'Data input \'' + input_def.name + '\' (' + Utils.textify(input_def.extensions.toString()) + ')';
+ input_def.value = null;
+ return this._fieldHidden(input_def);
+ }
+ var self = this;
+ return new SelectContent.View(this.app, {
+ id : 'field-' + input_def.id,
+ extensions : input_def.extensions,
+ optional : input_def.optional,
+ multiple : input_def.multiple,
+ type : input_def.type,
+ data : input_def.options,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Select/Checkbox/Radio options field
+ */
+ _fieldSelect : function (input_def) {
+ // show text field in if dynamic fields are disabled e.g. in workflow editor
+ if (!this.app.options.is_dynamic && input_def.is_dynamic) {
+ return this._fieldText(input_def);
+ }
+
+ // customize properties
+ if (input_def.type == 'data_column') {
+ input_def.error_text = 'Missing columns in referenced dataset.'
+ }
+ if (input_def.type == 'genomebuild') {
+ input_def.searchable = true;
+ }
+
+ // configure options fields
+ var options = [];
+ for (var i in input_def.options) {
+ var option = input_def.options[i];
+ options.push({
+ label: option[0],
+ value: option[1]
+ });
+ }
+
+ // identify display type
+ var SelectClass = Ui.Select;
+ switch (input_def.display) {
+ case 'checkboxes':
+ SelectClass = Ui.Checkbox;
+ break;
+ case 'radio':
+ SelectClass = Ui.Radio;
+ break;
+ }
+
+ // select field
+ var self = this;
+ return new SelectClass.View({
+ id : 'field-' + input_def.id,
+ data : options,
+ error_text : input_def.error_text || 'No options available',
+ multiple : input_def.multiple,
+ searchable : input_def.searchable,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Drill down options field
+ */
+ _fieldDrilldown : function (input_def) {
+ // show text field in if dynamic fields are disabled e.g. in workflow editor
+ if (!this.app.options.is_dynamic && input_def.is_dynamic) {
+ return this._fieldText(input_def);
+ }
+
+ // create drill down field
+ var self = this;
+ return new Ui.Drilldown.View({
+ id : 'field-' + input_def.id,
+ data : input_def.options,
+ display : input_def.display,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Text input field
+ */
+ _fieldText : function(input_def) {
+ // field replaces e.g. a select field
+ if (input_def.options) {
+ // show text area if selecting multiple entries is allowed
+ input_def.area = input_def.multiple;
+
+ // validate value
+ if (!Utils.validate(input_def.value)) {
+ input_def.value = '';
+ } else {
+ if (input_def.value instanceof Array) {
+ input_def.value = value.toString();
+ } else {
+ input_def.value = String(input_def.value).replace(/[\[\]'"\s]/g, '');
+ if (input_def.multiple) {
+ input_def.value = input_def.value.replace(/,/g, '\n');
+ }
+ }
+ }
+ }
+
+ // create input element
+ var self = this;
+ return new Ui.Input({
+ id : 'field-' + input_def.id,
+ area : input_def.area,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Slider field
+ */
+ _fieldSlider: function(input_def) {
+ var self = this;
+ return new Ui.Slider.View({
+ id : 'field-' + input_def.id,
+ precise : input_def.type == 'float',
+ min : input_def.min,
+ max : input_def.max,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Hidden field
+ */
+ _fieldHidden : function(input_def) {
+ return new Ui.Hidden({
+ id : 'field-' + input_def.id,
+ info : input_def.info
+ });
+ },
+
+ /** Boolean field
+ */
+ _fieldBoolean : function(input_def) {
+ var self = this;
+ return new Ui.RadioButton.View({
+ id : 'field-' + input_def.id,
+ data : [ { label : 'Yes', value : 'true' },
+ { label : 'No', value : 'false' }],
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ }
+ });
+
+ return {
+ View: View
+ };
+});
diff -r a03ff352f39379b231da22259b9bde89ac7f6340 -r 51a3606fe3bdf21d663b35d41c886ff819fd234d static/scripts/mvc/tools/tools-section.js
--- a/static/scripts/mvc/tools/tools-section.js
+++ b/static/scripts/mvc/tools/tools-section.js
@@ -1,8 +1,14 @@
/**
- This class creates a tool form section and populates it with input elements. It also handles repeat blocks and conditionals by recursively creating new sub sections. New input elements can be plugged in by adding cases to the switch block defined in the _createField() function.
+ This class creates a tool form section and populates it with input elements. It also handles repeat blocks and conditionals by recursively creating new sub sections.
*/
-define(['utils/utils', 'mvc/ui/ui-table', 'mvc/ui/ui-misc', 'mvc/ui/ui-portlet', 'mvc/tools/tools-repeat', 'mvc/tools/tools-select-content', 'mvc/tools/tools-input'],
- function(Utils, Table, Ui, Portlet, Repeat, SelectContent, InputElement) {
+define(['utils/utils',
+ 'mvc/ui/ui-table',
+ 'mvc/ui/ui-misc',
+ 'mvc/ui/ui-portlet',
+ 'mvc/tools/tools-repeat',
+ 'mvc/tools/tools-input',
+ 'mvc/tools/tools-parameters'],
+ function(Utils, Table, Ui, Portlet, Repeat, InputElement, Parameters) {
// create form view
var View = Backbone.View.extend({
@@ -23,6 +29,9 @@
// create table
this.table = new Table.View(options);
+
+ // create parameter handler
+ this.parameters = new Parameters(app, options);
// configure portlet and form table
this.setElement(this.table.$el);
@@ -294,16 +303,8 @@
// get id
var id = input_def.id;
- // add regular/default value if missing
- if (input_def.value === undefined) {
- input_def.value = null;
- }
- if (input_def.default_value === undefined) {
- input_def.default_value = input_def.value;
- }
-
// create input field
- var field = this._createField(input_def);
+ var field = this.parameters.create(input_def);
// add to field list
this.app.field_list[id] = field;
@@ -333,265 +334,6 @@
// return created field
return field;
- },
-
- /** Returns an input field for a given field type
- */
- _createField: function(input_def) {
- // field wrapper
- var field = null;
-
- // identify field type
- switch(input_def.type) {
- // text input field
- case 'text' :
- field = this._fieldText(input_def);
- break;
-
- // select field
- case 'select' :
- field = this._fieldSelect(input_def);
- break;
-
- // data selector
- case 'data':
- field = this._fieldData(input_def);
- break;
-
- // collection selector
- case 'data_collection':
- field = this._fieldData(input_def);
- break;
-
- // data column
- case 'data_column':
- input_def.error_text = 'Missing columns in referenced dataset.';
- field = this._fieldSelect(input_def);
- break;
-
- // hidden field
- case 'hidden':
- field = this._fieldHidden(input_def);
- break;
-
- // hidden data field
- case 'hidden_data':
- field = this._fieldHidden(input_def);
- break;
-
- // integer field
- case 'integer':
- field = this._fieldSlider(input_def);
- break;
-
- // float field
- case 'float':
- field = this._fieldSlider(input_def);
- break;
-
- // boolean field
- case 'boolean':
- field = this._fieldBoolean(input_def);
- break;
-
- // genome field
- case 'genomebuild':
- input_def.searchable = true;
- field = this._fieldSelect(input_def);
- break;
-
- // drill down field
- case 'drill_down':
- field = this._fieldDrilldown(input_def);
- break;
-
- // base url field
- case 'baseurl':
- field = this._fieldHidden(input_def);
- break;
-
- // field not found
- default:
- // flag
- this.app.incompatible = true;
-
- // with or without options
- if (input_def.options) {
- // assign select field
- field = this._fieldSelect(input_def);
- } else {
- // assign text field
- field = this._fieldText(input_def);
- }
-
- // log
- console.debug('tools-form::_addRow() : Auto matched field type (' + input_def.type + ').');
- }
-
- // set field value
- if (input_def.value !== undefined) {
- field.value(input_def.value);
- }
-
- // return field element
- return field;
- },
-
- /** Data input field
- */
- _fieldData : function(input_def) {
- if (!this.app.options.is_dynamic) {
- input_def.info = 'Data input \'' + input_def.name + '\' (' + Utils.textify(input_def.extensions.toString()) + ')';
- input_def.value = null;
- return this._fieldHidden(input_def);
- }
- var self = this;
- return new SelectContent.View(this.app, {
- id : 'field-' + input_def.id,
- extensions : input_def.extensions,
- optional : input_def.optional,
- multiple : input_def.multiple,
- type : input_def.type,
- data : input_def.options,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Select/Checkbox/Radio options field
- */
- _fieldSelect : function (input_def) {
- // show text field in if dynamic fields are disabled e.g. in workflow editor
- if (!this.app.options.is_dynamic && input_def.is_dynamic) {
- return this._fieldText(input_def);
- }
-
- // configure options fields
- var options = [];
- for (var i in input_def.options) {
- var option = input_def.options[i];
- options.push({
- label: option[0],
- value: option[1]
- });
- }
-
- // identify display type
- var SelectClass = Ui.Select;
- switch (input_def.display) {
- case 'checkboxes':
- SelectClass = Ui.Checkbox;
- break;
- case 'radio':
- SelectClass = Ui.Radio;
- break;
- }
-
- // select field
- var self = this;
- return new SelectClass.View({
- id : 'field-' + input_def.id,
- data : options,
- error_text : input_def.error_text || 'No options available',
- multiple : input_def.multiple,
- searchable : input_def.searchable,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Drill down options field
- */
- _fieldDrilldown : function (input_def) {
- // show text field in if dynamic fields are disabled e.g. in workflow editor
- if (!this.app.options.is_dynamic && input_def.is_dynamic) {
- return this._fieldText(input_def);
- }
-
- // create drill down field
- var self = this;
- return new Ui.Drilldown.View({
- id : 'field-' + input_def.id,
- data : input_def.options,
- display : input_def.display,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Text input field
- */
- _fieldText : function(input_def) {
- // field replaces e.g. a select field
- if (input_def.options) {
- // show text area if selecting multiple entries is allowed
- input_def.area = input_def.multiple;
-
- // validate value
- if (!Utils.validate(input_def.value)) {
- input_def.value = '';
- } else {
- if (input_def.value instanceof Array) {
- input_def.value = value.toString();
- } else {
- input_def.value = String(input_def.value).replace(/[\[\]'"\s]/g, '');
- if (input_def.multiple) {
- input_def.value = input_def.value.replace(/,/g, '\n');
- }
- }
- }
- }
-
- // create input element
- var self = this;
- return new Ui.Input({
- id : 'field-' + input_def.id,
- area : input_def.area,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Slider field
- */
- _fieldSlider: function(input_def) {
- var self = this;
- return new Ui.Slider.View({
- id : 'field-' + input_def.id,
- precise : input_def.type == 'float',
- min : input_def.min,
- max : input_def.max,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Hidden field
- */
- _fieldHidden : function(input_def) {
- return new Ui.Hidden({
- id : 'field-' + input_def.id,
- info : input_def.info
- });
- },
-
- /** Boolean field
- */
- _fieldBoolean : function(input_def) {
- var self = this;
- return new Ui.RadioButton.View({
- id : 'field-' + input_def.id,
- data : [ { label : 'Yes', value : 'true' },
- { label : 'No', value : 'false' }],
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
}
});
diff -r a03ff352f39379b231da22259b9bde89ac7f6340 -r 51a3606fe3bdf21d663b35d41c886ff819fd234d static/scripts/packed/mvc/tools/tools-parameters.js
--- /dev/null
+++ b/static/scripts/packed/mvc/tools/tools-parameters.js
@@ -0,0 +1,1 @@
+define(["utils/utils","mvc/ui/ui-misc","mvc/tools/tools-select-content"],function(b,c,a){return Backbone.Model.extend({types:{text:"_fieldText",select:"_fieldSelect",data_column:"_fieldSelect",genomebuild:"_fieldSelect",data:"_fieldData",data_collection:"_fieldData",integer:"_fieldSlider","float":"_fieldSlider","boolean":"_fieldBoolean",drill_down:"_fieldDrilldown",hidden:"_fieldHidden",hidden_data:"_fieldHidden",baseurl:"_fieldHidden"},initialize:function(e,d){this.app=e},create:function(d){if(d.value===undefined){d.value=null}if(d.default_value===undefined){d.default_value=d.value}var f=null;var e=this.types[d.type];if(e&&typeof(this[e])==="function"){f=this[e].call(this,d)}if(!f){this.app.incompatible=true;if(d.options){f=this._fieldSelect(d)}else{f=this._fieldText(d)}console.debug("tools-form::_addRow() : Auto matched field type ("+d.type+").")}if(d.value!==undefined){f.value(d.value)}return f},_fieldData:function(d){if(!this.app.options.is_dynamic){d.info="Data input '"+d.name+"' ("+b.textify(d.extensions.toString())+")";d.value=null;return this._fieldHidden(d)}var e=this;return new a.View(this.app,{id:"field-"+d.id,extensions:d.extensions,optional:d.optional,multiple:d.multiple,type:d.type,data:d.options,onchange:function(){e.app.trigger("refresh")}})},_fieldSelect:function(d){if(!this.app.options.is_dynamic&&d.is_dynamic){return this._fieldText(d)}if(d.type=="data_column"){d.error_text="Missing columns in referenced dataset."}if(d.type=="genomebuild"){d.searchable=true}var f=[];for(var g in d.options){var h=d.options[g];f.push({label:h[0],value:h[1]})}var j=c.Select;switch(d.display){case"checkboxes":j=c.Checkbox;break;case"radio":j=c.Radio;break}var e=this;return new j.View({id:"field-"+d.id,data:f,error_text:d.error_text||"No options available",multiple:d.multiple,searchable:d.searchable,onchange:function(){e.app.trigger("refresh")}})},_fieldDrilldown:function(d){if(!this.app.options.is_dynamic&&d.is_dynamic){return this._fieldText(d)}var e=this;return new c.Drilldown.View({id:"field-"+d.id,data:d.options,display:d.display,onchange:function(){e.app.trigger("refresh")}})},_fieldText:function(d){if(d.options){d.area=d.multiple;if(!b.validate(d.value)){d.value=""}else{if(d.value instanceof Array){d.value=value.toString()}else{d.value=String(d.value).replace(/[\[\]'"\s]/g,"");if(d.multiple){d.value=d.value.replace(/,/g,"\n")}}}}var e=this;return new c.Input({id:"field-"+d.id,area:d.area,onchange:function(){e.app.trigger("refresh")}})},_fieldSlider:function(d){var e=this;return new c.Slider.View({id:"field-"+d.id,precise:d.type=="float",min:d.min,max:d.max,onchange:function(){e.app.trigger("refresh")}})},_fieldHidden:function(d){return new c.Hidden({id:"field-"+d.id,info:d.info})},_fieldBoolean:function(d){var e=this;return new c.RadioButton.View({id:"field-"+d.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:function(){e.app.trigger("refresh")}})}});return{View:View}});
\ No newline at end of file
diff -r a03ff352f39379b231da22259b9bde89ac7f6340 -r 51a3606fe3bdf21d663b35d41c886ff819fd234d 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/ui/ui-portlet","mvc/tools/tools-repeat","mvc/tools/tools-select-content","mvc/tools/tools-input"],function(e,b,h,d,c,a,f){var g=Backbone.View.extend({initialize:function(j,i){this.app=j;this.inputs=i.inputs;i.cls="ui-table-plain";i.cls_tr="section-row";this.table=new b.View(i);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var j in this.inputs){this.add(this.inputs[j])}},add:function(k){var j=this;var i=jQuery.extend(true,{},k);i.id=k.id=e.uuid();this.app.input_list[i.id]=i;var l=i.type;switch(l){case"conditional":this._addConditional(i);break;case"repeat":this._addRepeat(i);break;case"section":this._addSection(i);break;default:this._addRow(i)}},_addConditional:function(j){var k=this;j.test_param.id=j.id;var n=this._addRow(j.test_param);n.options.onchange=function(w){var v=k.app.tree.matchCase(j,w);for(var u in j.cases){var q=j.cases[u];var t=j.id+"-section-"+u;var p=k.table.get(t);var s=false;for(var r in q.inputs){if(!q.inputs[r].hidden){s=true;break}}if(u==v&&s){p.fadeIn("fast")}else{p.hide()}}k.app.trigger("refresh")};for(var m in j.cases){var l=j.id+"-section-"+m;var o=new g(this.app,{inputs:j.cases[m].inputs});o.$el.addClass("ui-table-section");this.table.add(o.$el);this.table.append(l)}n.trigger("change")},_addRepeat:function(p){var s=this;var q=0;var l=new c.View({title:p.title,title_new:p.title,min:p.min,max:p.max,onnew:function(){n(p.inputs);s.app.trigger("refresh")}});function n(i){var t=p.id+"-section-"+(q++);var u=new g(s.app,{inputs:i});l.add({id:t,$el:u.$el,ondel:function(){l.del(t);s.app.trigger("refresh")}})}var j=p.min;var r=_.size(p.cache);for(var m=0;m<Math.max(r,j);m++){var o=null;if(m<r){o=p.cache[m]}else{o=p.inputs}n(o)}var k=new f(this.app,{label:p.title,help:p.help,field:l});this.table.add(k.$el);this.table.append(p.id)},_addSection:function(i){var j=this;var n=new g(j.app,{inputs:i.inputs});var m=new h.ButtonIcon({icon:"fa-eye-slash",tooltip:"Show/hide section",cls:"ui-button-icon-plain"});var l=new d.View({title:i.label,cls:"ui-portlet-section",operations:{button_visible:m}});l.append(n.$el);l.append($("<div/>").addClass("ui-table-form-info").html(i.help));var k=false;l.$content.hide();l.$header.css("cursor","pointer");l.$header.on("click",function(){if(k){k=false;l.$content.hide();m.setIcon("fa-eye-slash")}else{k=true;l.$content.fadeIn("fast");m.setIcon("fa-eye")}});if(i.expand){l.$header.trigger("click")}this.table.add(l.$el);this.table.append(i.id)},_addRow:function(i){var l=i.id;if(i.value===undefined){i.value=null}if(i.default_value===undefined){i.default_value=i.value}var j=this._createField(i);this.app.field_list[l]=j;var k=new f(this.app,{label:i.label,default_value:i.default_value,optional:i.optional,help:i.help,field:j});this.app.element_list[l]=k;this.table.add(k.$el);this.table.append(l);if(i.hidden){this.table.get(l).hide()}return j},_createField:function(i){var j=null;switch(i.type){case"text":j=this._fieldText(i);break;case"select":j=this._fieldSelect(i);break;case"data":j=this._fieldData(i);break;case"data_collection":j=this._fieldData(i);break;case"data_column":i.error_text="Missing columns in referenced dataset.";j=this._fieldSelect(i);break;case"hidden":j=this._fieldHidden(i);break;case"hidden_data":j=this._fieldHidden(i);break;case"integer":j=this._fieldSlider(i);break;case"float":j=this._fieldSlider(i);break;case"boolean":j=this._fieldBoolean(i);break;case"genomebuild":i.searchable=true;j=this._fieldSelect(i);break;case"drill_down":j=this._fieldDrilldown(i);break;case"baseurl":j=this._fieldHidden(i);break;default:this.app.incompatible=true;if(i.options){j=this._fieldSelect(i)}else{j=this._fieldText(i)}console.debug("tools-form::_addRow() : Auto matched field type ("+i.type+").")}if(i.value!==undefined){j.value(i.value)}return j},_fieldData:function(i){if(!this.app.options.is_dynamic){i.info="Data input '"+i.name+"' ("+e.textify(i.extensions.toString())+")";i.value=null;return this._fieldHidden(i)}var j=this;return new a.View(this.app,{id:"field-"+i.id,extensions:i.extensions,optional:i.optional,multiple:i.multiple,type:i.type,data:i.options,onchange:function(){j.app.trigger("refresh")}})},_fieldSelect:function(j){if(!this.app.options.is_dynamic&&j.is_dynamic){return this._fieldText(j)}var l=[];for(var m in j.options){var n=j.options[m];l.push({label:n[0],value:n[1]})}var o=h.Select;switch(j.display){case"checkboxes":o=h.Checkbox;break;case"radio":o=h.Radio;break}var k=this;return new o.View({id:"field-"+j.id,data:l,error_text:j.error_text||"No options available",multiple:j.multiple,searchable:j.searchable,onchange:function(){k.app.trigger("refresh")}})},_fieldDrilldown:function(i){if(!this.app.options.is_dynamic&&i.is_dynamic){return this._fieldText(i)}var j=this;return new h.Drilldown.View({id:"field-"+i.id,data:i.options,display:i.display,onchange:function(){j.app.trigger("refresh")}})},_fieldText:function(i){if(i.options){i.area=i.multiple;if(!e.validate(i.value)){i.value=""}else{if(i.value instanceof Array){i.value=value.toString()}else{i.value=String(i.value).replace(/[\[\]'"\s]/g,"");if(i.multiple){i.value=i.value.replace(/,/g,"\n")}}}}var j=this;return new h.Input({id:"field-"+i.id,area:i.area,onchange:function(){j.app.trigger("refresh")}})},_fieldSlider:function(i){var j=this;return new h.Slider.View({id:"field-"+i.id,precise:i.type=="float",min:i.min,max:i.max,onchange:function(){j.app.trigger("refresh")}})},_fieldHidden:function(i){return new h.Hidden({id:"field-"+i.id,info:i.info})},_fieldBoolean:function(i){var j=this;return new h.RadioButton.View({id:"field-"+i.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:function(){j.app.trigger("refresh")}})}});return{View:g}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/ui/ui-portlet","mvc/tools/tools-repeat","mvc/tools/tools-input","mvc/tools/tools-parameters"],function(e,a,h,d,c,f,b){var g=Backbone.View.extend({initialize:function(j,i){this.app=j;this.inputs=i.inputs;i.cls="ui-table-plain";i.cls_tr="section-row";this.table=new a.View(i);this.parameters=new b(j,i);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var j in this.inputs){this.add(this.inputs[j])}},add:function(k){var j=this;var i=jQuery.extend(true,{},k);i.id=k.id=e.uuid();this.app.input_list[i.id]=i;var l=i.type;switch(l){case"conditional":this._addConditional(i);break;case"repeat":this._addRepeat(i);break;case"section":this._addSection(i);break;default:this._addRow(i)}},_addConditional:function(j){var k=this;j.test_param.id=j.id;var n=this._addRow(j.test_param);n.options.onchange=function(w){var v=k.app.tree.matchCase(j,w);for(var u in j.cases){var q=j.cases[u];var t=j.id+"-section-"+u;var p=k.table.get(t);var s=false;for(var r in q.inputs){if(!q.inputs[r].hidden){s=true;break}}if(u==v&&s){p.fadeIn("fast")}else{p.hide()}}k.app.trigger("refresh")};for(var m in j.cases){var l=j.id+"-section-"+m;var o=new g(this.app,{inputs:j.cases[m].inputs});o.$el.addClass("ui-table-section");this.table.add(o.$el);this.table.append(l)}n.trigger("change")},_addRepeat:function(p){var s=this;var q=0;var l=new c.View({title:p.title,title_new:p.title,min:p.min,max:p.max,onnew:function(){n(p.inputs);s.app.trigger("refresh")}});function n(i){var t=p.id+"-section-"+(q++);var u=new g(s.app,{inputs:i});l.add({id:t,$el:u.$el,ondel:function(){l.del(t);s.app.trigger("refresh")}})}var j=p.min;var r=_.size(p.cache);for(var m=0;m<Math.max(r,j);m++){var o=null;if(m<r){o=p.cache[m]}else{o=p.inputs}n(o)}var k=new f(this.app,{label:p.title,help:p.help,field:l});this.table.add(k.$el);this.table.append(p.id)},_addSection:function(i){var j=this;var n=new g(j.app,{inputs:i.inputs});var m=new h.ButtonIcon({icon:"fa-eye-slash",tooltip:"Show/hide section",cls:"ui-button-icon-plain"});var l=new d.View({title:i.label,cls:"ui-portlet-section",operations:{button_visible:m}});l.append(n.$el);l.append($("<div/>").addClass("ui-table-form-info").html(i.help));var k=false;l.$content.hide();l.$header.css("cursor","pointer");l.$header.on("click",function(){if(k){k=false;l.$content.hide();m.setIcon("fa-eye-slash")}else{k=true;l.$content.fadeIn("fast");m.setIcon("fa-eye")}});if(i.expand){l.$header.trigger("click")}this.table.add(l.$el);this.table.append(i.id)},_addRow:function(i){var l=i.id;var j=this.parameters.create(i);this.app.field_list[l]=j;var k=new f(this.app,{label:i.label,default_value:i.default_value,optional:i.optional,help:i.help,field:j});this.app.element_list[l]=k;this.table.add(k.$el);this.table.append(l);if(i.hidden){this.table.get(l).hide()}return j}});return{View:g}});
\ 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: Separate tool parameters from sections
by commits-noreply@bitbucket.org 12 Feb '15
by commits-noreply@bitbucket.org 12 Feb '15
12 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f8012e167c9d/
Changeset: f8012e167c9d
User: guerler
Date: 2015-02-12 16:10:14+00:00
Summary: ToolForm: Separate tool parameters from sections
Affected #: 6 files
diff -r 2c6690a2faea4882a688044ec269de5b15569f58 -r f8012e167c9d569cd06140d28e3def5135ba3ed9 client/galaxy/scripts/mvc/tools/tools-parameters.js
--- /dev/null
+++ b/client/galaxy/scripts/mvc/tools/tools-parameters.js
@@ -0,0 +1,247 @@
+/**
+ This class creates input elements. New input parameter types should be added to the types dictionary.
+*/
+define(['utils/utils','mvc/ui/ui-misc', 'mvc/tools/tools-select-content'],
+ function(Utils, Ui, SelectContent) {
+
+ // create form view
+ return Backbone.Model.extend({
+ /** Available parameter types */
+ types: {
+ 'text' : '_fieldText',
+ 'select' : '_fieldSelect',
+ 'data_column' : '_fieldSelect',
+ 'genomebuild' : '_fieldSelect',
+ 'data' : '_fieldData',
+ 'data_collection' : '_fieldData',
+ 'integer' : '_fieldSlider',
+ 'float' : '_fieldSlider',
+ 'boolean' : '_fieldBoolean',
+ 'drill_down' : '_fieldDrilldown',
+ 'hidden' : '_fieldHidden',
+ 'hidden_data' : '_fieldHidden',
+ 'baseurl' : '_fieldHidden'
+ },
+
+ // initialize
+ initialize: function(app, options) {
+ this.app = app;
+ },
+
+ /** Returns an input field for a given field type
+ */
+ create: function(input_def) {
+ // add regular/default value if missing
+ if (input_def.value === undefined) {
+ input_def.value = null;
+ }
+ if (input_def.default_value === undefined) {
+ input_def.default_value = input_def.value;
+ }
+
+ // field wrapper
+ var field = null;
+
+ // get field class
+ var fieldClass = this.types[input_def.type];
+ if (fieldClass && typeof(this[fieldClass]) === 'function') {
+ field = this[fieldClass].call(this, input_def);
+ }
+
+ // identify field type
+ if (!field) {
+ // flag
+ this.app.incompatible = true;
+
+ // with or without options
+ if (input_def.options) {
+ // assign select field
+ field = this._fieldSelect(input_def);
+ } else {
+ // assign text field
+ field = this._fieldText(input_def);
+ }
+
+ // log
+ console.debug('tools-form::_addRow() : Auto matched field type (' + input_def.type + ').');
+ }
+
+ // set field value
+ if (input_def.value !== undefined) {
+ field.value(input_def.value);
+ }
+
+ // return field element
+ return field;
+ },
+
+ /** Data input field
+ */
+ _fieldData : function(input_def) {
+ if (!this.app.options.is_dynamic) {
+ input_def.info = 'Data input \'' + input_def.name + '\' (' + Utils.textify(input_def.extensions.toString()) + ')';
+ input_def.value = null;
+ return this._fieldHidden(input_def);
+ }
+ var self = this;
+ return new SelectContent.View(this.app, {
+ id : 'field-' + input_def.id,
+ extensions : input_def.extensions,
+ optional : input_def.optional,
+ multiple : input_def.multiple,
+ type : input_def.type,
+ data : input_def.options,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Select/Checkbox/Radio options field
+ */
+ _fieldSelect : function (input_def) {
+ // show text field in if dynamic fields are disabled e.g. in workflow editor
+ if (!this.app.options.is_dynamic && input_def.is_dynamic) {
+ return this._fieldText(input_def);
+ }
+
+ // customize properties
+ if (input_def.type == 'data_column') {
+ input_def.error_text = 'Missing columns in referenced dataset.'
+ }
+ if (input_def.type == 'genomebuild') {
+ input_def.searchable = true;
+ }
+
+ // configure options fields
+ var options = [];
+ for (var i in input_def.options) {
+ var option = input_def.options[i];
+ options.push({
+ label: option[0],
+ value: option[1]
+ });
+ }
+
+ // identify display type
+ var SelectClass = Ui.Select;
+ switch (input_def.display) {
+ case 'checkboxes':
+ SelectClass = Ui.Checkbox;
+ break;
+ case 'radio':
+ SelectClass = Ui.Radio;
+ break;
+ }
+
+ // select field
+ var self = this;
+ return new SelectClass.View({
+ id : 'field-' + input_def.id,
+ data : options,
+ error_text : input_def.error_text || 'No options available',
+ multiple : input_def.multiple,
+ searchable : input_def.searchable,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Drill down options field
+ */
+ _fieldDrilldown : function (input_def) {
+ // show text field in if dynamic fields are disabled e.g. in workflow editor
+ if (!this.app.options.is_dynamic && input_def.is_dynamic) {
+ return this._fieldText(input_def);
+ }
+
+ // create drill down field
+ var self = this;
+ return new Ui.Drilldown.View({
+ id : 'field-' + input_def.id,
+ data : input_def.options,
+ display : input_def.display,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Text input field
+ */
+ _fieldText : function(input_def) {
+ // field replaces e.g. a select field
+ if (input_def.options) {
+ // show text area if selecting multiple entries is allowed
+ input_def.area = input_def.multiple;
+
+ // validate value
+ if (!Utils.validate(input_def.value)) {
+ input_def.value = '';
+ } else {
+ if (input_def.value instanceof Array) {
+ input_def.value = value.toString();
+ } else {
+ input_def.value = String(input_def.value).replace(/[\[\]'"\s]/g, '');
+ if (input_def.multiple) {
+ input_def.value = input_def.value.replace(/,/g, '\n');
+ }
+ }
+ }
+ }
+
+ // create input element
+ var self = this;
+ return new Ui.Input({
+ id : 'field-' + input_def.id,
+ area : input_def.area,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Slider field
+ */
+ _fieldSlider: function(input_def) {
+ var self = this;
+ return new Ui.Slider.View({
+ id : 'field-' + input_def.id,
+ precise : input_def.type == 'float',
+ min : input_def.min,
+ max : input_def.max,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Hidden field
+ */
+ _fieldHidden : function(input_def) {
+ return new Ui.Hidden({
+ id : 'field-' + input_def.id,
+ info : input_def.info
+ });
+ },
+
+ /** Boolean field
+ */
+ _fieldBoolean : function(input_def) {
+ var self = this;
+ return new Ui.RadioButton.View({
+ id : 'field-' + input_def.id,
+ data : [ { label : 'Yes', value : 'true' },
+ { label : 'No', value : 'false' }],
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ }
+ });
+
+ return {
+ View: View
+ };
+});
diff -r 2c6690a2faea4882a688044ec269de5b15569f58 -r f8012e167c9d569cd06140d28e3def5135ba3ed9 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
@@ -1,8 +1,14 @@
/**
- This class creates a tool form section and populates it with input elements. It also handles repeat blocks and conditionals by recursively creating new sub sections. New input elements can be plugged in by adding cases to the switch block defined in the _createField() function.
+ This class creates a tool form section and populates it with input elements. It also handles repeat blocks and conditionals by recursively creating new sub sections.
*/
-define(['utils/utils', 'mvc/ui/ui-table', 'mvc/ui/ui-misc', 'mvc/ui/ui-portlet', 'mvc/tools/tools-repeat', 'mvc/tools/tools-select-content', 'mvc/tools/tools-input'],
- function(Utils, Table, Ui, Portlet, Repeat, SelectContent, InputElement) {
+define(['utils/utils',
+ 'mvc/ui/ui-table',
+ 'mvc/ui/ui-misc',
+ 'mvc/ui/ui-portlet',
+ 'mvc/tools/tools-repeat',
+ 'mvc/tools/tools-input',
+ 'mvc/tools/tools-parameters'],
+ function(Utils, Table, Ui, Portlet, Repeat, InputElement, Parameters) {
// create form view
var View = Backbone.View.extend({
@@ -23,6 +29,9 @@
// create table
this.table = new Table.View(options);
+
+ // create parameter handler
+ this.parameters = new Parameters(app, options);
// configure portlet and form table
this.setElement(this.table.$el);
@@ -294,16 +303,8 @@
// get id
var id = input_def.id;
- // add regular/default value if missing
- if (input_def.value === undefined) {
- input_def.value = null;
- }
- if (input_def.default_value === undefined) {
- input_def.default_value = input_def.value;
- }
-
// create input field
- var field = this._createField(input_def);
+ var field = this.parameters.create(input_def);
// add to field list
this.app.field_list[id] = field;
@@ -333,265 +334,6 @@
// return created field
return field;
- },
-
- /** Returns an input field for a given field type
- */
- _createField: function(input_def) {
- // field wrapper
- var field = null;
-
- // identify field type
- switch(input_def.type) {
- // text input field
- case 'text' :
- field = this._fieldText(input_def);
- break;
-
- // select field
- case 'select' :
- field = this._fieldSelect(input_def);
- break;
-
- // data selector
- case 'data':
- field = this._fieldData(input_def);
- break;
-
- // collection selector
- case 'data_collection':
- field = this._fieldData(input_def);
- break;
-
- // data column
- case 'data_column':
- input_def.error_text = 'Missing columns in referenced dataset.';
- field = this._fieldSelect(input_def);
- break;
-
- // hidden field
- case 'hidden':
- field = this._fieldHidden(input_def);
- break;
-
- // hidden data field
- case 'hidden_data':
- field = this._fieldHidden(input_def);
- break;
-
- // integer field
- case 'integer':
- field = this._fieldSlider(input_def);
- break;
-
- // float field
- case 'float':
- field = this._fieldSlider(input_def);
- break;
-
- // boolean field
- case 'boolean':
- field = this._fieldBoolean(input_def);
- break;
-
- // genome field
- case 'genomebuild':
- input_def.searchable = true;
- field = this._fieldSelect(input_def);
- break;
-
- // drill down field
- case 'drill_down':
- field = this._fieldDrilldown(input_def);
- break;
-
- // base url field
- case 'baseurl':
- field = this._fieldHidden(input_def);
- break;
-
- // field not found
- default:
- // flag
- this.app.incompatible = true;
-
- // with or without options
- if (input_def.options) {
- // assign select field
- field = this._fieldSelect(input_def);
- } else {
- // assign text field
- field = this._fieldText(input_def);
- }
-
- // log
- console.debug('tools-form::_addRow() : Auto matched field type (' + input_def.type + ').');
- }
-
- // set field value
- if (input_def.value !== undefined) {
- field.value(input_def.value);
- }
-
- // return field element
- return field;
- },
-
- /** Data input field
- */
- _fieldData : function(input_def) {
- if (!this.app.options.is_dynamic) {
- input_def.info = 'Data input \'' + input_def.name + '\' (' + Utils.textify(input_def.extensions.toString()) + ')';
- input_def.value = null;
- return this._fieldHidden(input_def);
- }
- var self = this;
- return new SelectContent.View(this.app, {
- id : 'field-' + input_def.id,
- extensions : input_def.extensions,
- optional : input_def.optional,
- multiple : input_def.multiple,
- type : input_def.type,
- data : input_def.options,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Select/Checkbox/Radio options field
- */
- _fieldSelect : function (input_def) {
- // show text field in if dynamic fields are disabled e.g. in workflow editor
- if (!this.app.options.is_dynamic && input_def.is_dynamic) {
- return this._fieldText(input_def);
- }
-
- // configure options fields
- var options = [];
- for (var i in input_def.options) {
- var option = input_def.options[i];
- options.push({
- label: option[0],
- value: option[1]
- });
- }
-
- // identify display type
- var SelectClass = Ui.Select;
- switch (input_def.display) {
- case 'checkboxes':
- SelectClass = Ui.Checkbox;
- break;
- case 'radio':
- SelectClass = Ui.Radio;
- break;
- }
-
- // select field
- var self = this;
- return new SelectClass.View({
- id : 'field-' + input_def.id,
- data : options,
- error_text : input_def.error_text || 'No options available',
- multiple : input_def.multiple,
- searchable : input_def.searchable,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Drill down options field
- */
- _fieldDrilldown : function (input_def) {
- // show text field in if dynamic fields are disabled e.g. in workflow editor
- if (!this.app.options.is_dynamic && input_def.is_dynamic) {
- return this._fieldText(input_def);
- }
-
- // create drill down field
- var self = this;
- return new Ui.Drilldown.View({
- id : 'field-' + input_def.id,
- data : input_def.options,
- display : input_def.display,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Text input field
- */
- _fieldText : function(input_def) {
- // field replaces e.g. a select field
- if (input_def.options) {
- // show text area if selecting multiple entries is allowed
- input_def.area = input_def.multiple;
-
- // validate value
- if (!Utils.validate(input_def.value)) {
- input_def.value = '';
- } else {
- if (input_def.value instanceof Array) {
- input_def.value = value.toString();
- } else {
- input_def.value = String(input_def.value).replace(/[\[\]'"\s]/g, '');
- if (input_def.multiple) {
- input_def.value = input_def.value.replace(/,/g, '\n');
- }
- }
- }
- }
-
- // create input element
- var self = this;
- return new Ui.Input({
- id : 'field-' + input_def.id,
- area : input_def.area,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Slider field
- */
- _fieldSlider: function(input_def) {
- var self = this;
- return new Ui.Slider.View({
- id : 'field-' + input_def.id,
- precise : input_def.type == 'float',
- min : input_def.min,
- max : input_def.max,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Hidden field
- */
- _fieldHidden : function(input_def) {
- return new Ui.Hidden({
- id : 'field-' + input_def.id,
- info : input_def.info
- });
- },
-
- /** Boolean field
- */
- _fieldBoolean : function(input_def) {
- var self = this;
- return new Ui.RadioButton.View({
- id : 'field-' + input_def.id,
- data : [ { label : 'Yes', value : 'true' },
- { label : 'No', value : 'false' }],
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
}
});
diff -r 2c6690a2faea4882a688044ec269de5b15569f58 -r f8012e167c9d569cd06140d28e3def5135ba3ed9 static/scripts/mvc/tools/tools-parameters.js
--- /dev/null
+++ b/static/scripts/mvc/tools/tools-parameters.js
@@ -0,0 +1,247 @@
+/**
+ This class creates input elements. New input parameter types should be added to the types dictionary.
+*/
+define(['utils/utils','mvc/ui/ui-misc', 'mvc/tools/tools-select-content'],
+ function(Utils, Ui, SelectContent) {
+
+ // create form view
+ return Backbone.Model.extend({
+ /** Available parameter types */
+ types: {
+ 'text' : '_fieldText',
+ 'select' : '_fieldSelect',
+ 'data_column' : '_fieldSelect',
+ 'genomebuild' : '_fieldSelect',
+ 'data' : '_fieldData',
+ 'data_collection' : '_fieldData',
+ 'integer' : '_fieldSlider',
+ 'float' : '_fieldSlider',
+ 'boolean' : '_fieldBoolean',
+ 'drill_down' : '_fieldDrilldown',
+ 'hidden' : '_fieldHidden',
+ 'hidden_data' : '_fieldHidden',
+ 'baseurl' : '_fieldHidden'
+ },
+
+ // initialize
+ initialize: function(app, options) {
+ this.app = app;
+ },
+
+ /** Returns an input field for a given field type
+ */
+ create: function(input_def) {
+ // add regular/default value if missing
+ if (input_def.value === undefined) {
+ input_def.value = null;
+ }
+ if (input_def.default_value === undefined) {
+ input_def.default_value = input_def.value;
+ }
+
+ // field wrapper
+ var field = null;
+
+ // get field class
+ var fieldClass = this.types[input_def.type];
+ if (fieldClass && typeof(this[fieldClass]) === 'function') {
+ field = this[fieldClass].call(this, input_def);
+ }
+
+ // identify field type
+ if (!field) {
+ // flag
+ this.app.incompatible = true;
+
+ // with or without options
+ if (input_def.options) {
+ // assign select field
+ field = this._fieldSelect(input_def);
+ } else {
+ // assign text field
+ field = this._fieldText(input_def);
+ }
+
+ // log
+ console.debug('tools-form::_addRow() : Auto matched field type (' + input_def.type + ').');
+ }
+
+ // set field value
+ if (input_def.value !== undefined) {
+ field.value(input_def.value);
+ }
+
+ // return field element
+ return field;
+ },
+
+ /** Data input field
+ */
+ _fieldData : function(input_def) {
+ if (!this.app.options.is_dynamic) {
+ input_def.info = 'Data input \'' + input_def.name + '\' (' + Utils.textify(input_def.extensions.toString()) + ')';
+ input_def.value = null;
+ return this._fieldHidden(input_def);
+ }
+ var self = this;
+ return new SelectContent.View(this.app, {
+ id : 'field-' + input_def.id,
+ extensions : input_def.extensions,
+ optional : input_def.optional,
+ multiple : input_def.multiple,
+ type : input_def.type,
+ data : input_def.options,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Select/Checkbox/Radio options field
+ */
+ _fieldSelect : function (input_def) {
+ // show text field in if dynamic fields are disabled e.g. in workflow editor
+ if (!this.app.options.is_dynamic && input_def.is_dynamic) {
+ return this._fieldText(input_def);
+ }
+
+ // customize properties
+ if (input_def.type == 'data_column') {
+ input_def.error_text = 'Missing columns in referenced dataset.'
+ }
+ if (input_def.type == 'genomebuild') {
+ input_def.searchable = true;
+ }
+
+ // configure options fields
+ var options = [];
+ for (var i in input_def.options) {
+ var option = input_def.options[i];
+ options.push({
+ label: option[0],
+ value: option[1]
+ });
+ }
+
+ // identify display type
+ var SelectClass = Ui.Select;
+ switch (input_def.display) {
+ case 'checkboxes':
+ SelectClass = Ui.Checkbox;
+ break;
+ case 'radio':
+ SelectClass = Ui.Radio;
+ break;
+ }
+
+ // select field
+ var self = this;
+ return new SelectClass.View({
+ id : 'field-' + input_def.id,
+ data : options,
+ error_text : input_def.error_text || 'No options available',
+ multiple : input_def.multiple,
+ searchable : input_def.searchable,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Drill down options field
+ */
+ _fieldDrilldown : function (input_def) {
+ // show text field in if dynamic fields are disabled e.g. in workflow editor
+ if (!this.app.options.is_dynamic && input_def.is_dynamic) {
+ return this._fieldText(input_def);
+ }
+
+ // create drill down field
+ var self = this;
+ return new Ui.Drilldown.View({
+ id : 'field-' + input_def.id,
+ data : input_def.options,
+ display : input_def.display,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Text input field
+ */
+ _fieldText : function(input_def) {
+ // field replaces e.g. a select field
+ if (input_def.options) {
+ // show text area if selecting multiple entries is allowed
+ input_def.area = input_def.multiple;
+
+ // validate value
+ if (!Utils.validate(input_def.value)) {
+ input_def.value = '';
+ } else {
+ if (input_def.value instanceof Array) {
+ input_def.value = value.toString();
+ } else {
+ input_def.value = String(input_def.value).replace(/[\[\]'"\s]/g, '');
+ if (input_def.multiple) {
+ input_def.value = input_def.value.replace(/,/g, '\n');
+ }
+ }
+ }
+ }
+
+ // create input element
+ var self = this;
+ return new Ui.Input({
+ id : 'field-' + input_def.id,
+ area : input_def.area,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Slider field
+ */
+ _fieldSlider: function(input_def) {
+ var self = this;
+ return new Ui.Slider.View({
+ id : 'field-' + input_def.id,
+ precise : input_def.type == 'float',
+ min : input_def.min,
+ max : input_def.max,
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ },
+
+ /** Hidden field
+ */
+ _fieldHidden : function(input_def) {
+ return new Ui.Hidden({
+ id : 'field-' + input_def.id,
+ info : input_def.info
+ });
+ },
+
+ /** Boolean field
+ */
+ _fieldBoolean : function(input_def) {
+ var self = this;
+ return new Ui.RadioButton.View({
+ id : 'field-' + input_def.id,
+ data : [ { label : 'Yes', value : 'true' },
+ { label : 'No', value : 'false' }],
+ onchange : function() {
+ self.app.trigger('refresh');
+ }
+ });
+ }
+ });
+
+ return {
+ View: View
+ };
+});
diff -r 2c6690a2faea4882a688044ec269de5b15569f58 -r f8012e167c9d569cd06140d28e3def5135ba3ed9 static/scripts/mvc/tools/tools-section.js
--- a/static/scripts/mvc/tools/tools-section.js
+++ b/static/scripts/mvc/tools/tools-section.js
@@ -1,8 +1,14 @@
/**
- This class creates a tool form section and populates it with input elements. It also handles repeat blocks and conditionals by recursively creating new sub sections. New input elements can be plugged in by adding cases to the switch block defined in the _createField() function.
+ This class creates a tool form section and populates it with input elements. It also handles repeat blocks and conditionals by recursively creating new sub sections.
*/
-define(['utils/utils', 'mvc/ui/ui-table', 'mvc/ui/ui-misc', 'mvc/ui/ui-portlet', 'mvc/tools/tools-repeat', 'mvc/tools/tools-select-content', 'mvc/tools/tools-input'],
- function(Utils, Table, Ui, Portlet, Repeat, SelectContent, InputElement) {
+define(['utils/utils',
+ 'mvc/ui/ui-table',
+ 'mvc/ui/ui-misc',
+ 'mvc/ui/ui-portlet',
+ 'mvc/tools/tools-repeat',
+ 'mvc/tools/tools-input',
+ 'mvc/tools/tools-parameters'],
+ function(Utils, Table, Ui, Portlet, Repeat, InputElement, Parameters) {
// create form view
var View = Backbone.View.extend({
@@ -23,6 +29,9 @@
// create table
this.table = new Table.View(options);
+
+ // create parameter handler
+ this.parameters = new Parameters(app, options);
// configure portlet and form table
this.setElement(this.table.$el);
@@ -294,16 +303,8 @@
// get id
var id = input_def.id;
- // add regular/default value if missing
- if (input_def.value === undefined) {
- input_def.value = null;
- }
- if (input_def.default_value === undefined) {
- input_def.default_value = input_def.value;
- }
-
// create input field
- var field = this._createField(input_def);
+ var field = this.parameters.create(input_def);
// add to field list
this.app.field_list[id] = field;
@@ -333,265 +334,6 @@
// return created field
return field;
- },
-
- /** Returns an input field for a given field type
- */
- _createField: function(input_def) {
- // field wrapper
- var field = null;
-
- // identify field type
- switch(input_def.type) {
- // text input field
- case 'text' :
- field = this._fieldText(input_def);
- break;
-
- // select field
- case 'select' :
- field = this._fieldSelect(input_def);
- break;
-
- // data selector
- case 'data':
- field = this._fieldData(input_def);
- break;
-
- // collection selector
- case 'data_collection':
- field = this._fieldData(input_def);
- break;
-
- // data column
- case 'data_column':
- input_def.error_text = 'Missing columns in referenced dataset.';
- field = this._fieldSelect(input_def);
- break;
-
- // hidden field
- case 'hidden':
- field = this._fieldHidden(input_def);
- break;
-
- // hidden data field
- case 'hidden_data':
- field = this._fieldHidden(input_def);
- break;
-
- // integer field
- case 'integer':
- field = this._fieldSlider(input_def);
- break;
-
- // float field
- case 'float':
- field = this._fieldSlider(input_def);
- break;
-
- // boolean field
- case 'boolean':
- field = this._fieldBoolean(input_def);
- break;
-
- // genome field
- case 'genomebuild':
- input_def.searchable = true;
- field = this._fieldSelect(input_def);
- break;
-
- // drill down field
- case 'drill_down':
- field = this._fieldDrilldown(input_def);
- break;
-
- // base url field
- case 'baseurl':
- field = this._fieldHidden(input_def);
- break;
-
- // field not found
- default:
- // flag
- this.app.incompatible = true;
-
- // with or without options
- if (input_def.options) {
- // assign select field
- field = this._fieldSelect(input_def);
- } else {
- // assign text field
- field = this._fieldText(input_def);
- }
-
- // log
- console.debug('tools-form::_addRow() : Auto matched field type (' + input_def.type + ').');
- }
-
- // set field value
- if (input_def.value !== undefined) {
- field.value(input_def.value);
- }
-
- // return field element
- return field;
- },
-
- /** Data input field
- */
- _fieldData : function(input_def) {
- if (!this.app.options.is_dynamic) {
- input_def.info = 'Data input \'' + input_def.name + '\' (' + Utils.textify(input_def.extensions.toString()) + ')';
- input_def.value = null;
- return this._fieldHidden(input_def);
- }
- var self = this;
- return new SelectContent.View(this.app, {
- id : 'field-' + input_def.id,
- extensions : input_def.extensions,
- optional : input_def.optional,
- multiple : input_def.multiple,
- type : input_def.type,
- data : input_def.options,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Select/Checkbox/Radio options field
- */
- _fieldSelect : function (input_def) {
- // show text field in if dynamic fields are disabled e.g. in workflow editor
- if (!this.app.options.is_dynamic && input_def.is_dynamic) {
- return this._fieldText(input_def);
- }
-
- // configure options fields
- var options = [];
- for (var i in input_def.options) {
- var option = input_def.options[i];
- options.push({
- label: option[0],
- value: option[1]
- });
- }
-
- // identify display type
- var SelectClass = Ui.Select;
- switch (input_def.display) {
- case 'checkboxes':
- SelectClass = Ui.Checkbox;
- break;
- case 'radio':
- SelectClass = Ui.Radio;
- break;
- }
-
- // select field
- var self = this;
- return new SelectClass.View({
- id : 'field-' + input_def.id,
- data : options,
- error_text : input_def.error_text || 'No options available',
- multiple : input_def.multiple,
- searchable : input_def.searchable,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Drill down options field
- */
- _fieldDrilldown : function (input_def) {
- // show text field in if dynamic fields are disabled e.g. in workflow editor
- if (!this.app.options.is_dynamic && input_def.is_dynamic) {
- return this._fieldText(input_def);
- }
-
- // create drill down field
- var self = this;
- return new Ui.Drilldown.View({
- id : 'field-' + input_def.id,
- data : input_def.options,
- display : input_def.display,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Text input field
- */
- _fieldText : function(input_def) {
- // field replaces e.g. a select field
- if (input_def.options) {
- // show text area if selecting multiple entries is allowed
- input_def.area = input_def.multiple;
-
- // validate value
- if (!Utils.validate(input_def.value)) {
- input_def.value = '';
- } else {
- if (input_def.value instanceof Array) {
- input_def.value = value.toString();
- } else {
- input_def.value = String(input_def.value).replace(/[\[\]'"\s]/g, '');
- if (input_def.multiple) {
- input_def.value = input_def.value.replace(/,/g, '\n');
- }
- }
- }
- }
-
- // create input element
- var self = this;
- return new Ui.Input({
- id : 'field-' + input_def.id,
- area : input_def.area,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Slider field
- */
- _fieldSlider: function(input_def) {
- var self = this;
- return new Ui.Slider.View({
- id : 'field-' + input_def.id,
- precise : input_def.type == 'float',
- min : input_def.min,
- max : input_def.max,
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
- },
-
- /** Hidden field
- */
- _fieldHidden : function(input_def) {
- return new Ui.Hidden({
- id : 'field-' + input_def.id,
- info : input_def.info
- });
- },
-
- /** Boolean field
- */
- _fieldBoolean : function(input_def) {
- var self = this;
- return new Ui.RadioButton.View({
- id : 'field-' + input_def.id,
- data : [ { label : 'Yes', value : 'true' },
- { label : 'No', value : 'false' }],
- onchange : function() {
- self.app.trigger('refresh');
- }
- });
}
});
diff -r 2c6690a2faea4882a688044ec269de5b15569f58 -r f8012e167c9d569cd06140d28e3def5135ba3ed9 static/scripts/packed/mvc/tools/tools-parameters.js
--- /dev/null
+++ b/static/scripts/packed/mvc/tools/tools-parameters.js
@@ -0,0 +1,1 @@
+define(["utils/utils","mvc/ui/ui-misc","mvc/tools/tools-select-content"],function(b,c,a){return Backbone.Model.extend({types:{text:"_fieldText",select:"_fieldSelect",data_column:"_fieldSelect",genomebuild:"_fieldSelect",data:"_fieldData",data_collection:"_fieldData",integer:"_fieldSlider","float":"_fieldSlider","boolean":"_fieldBoolean",drill_down:"_fieldDrilldown",hidden:"_fieldHidden",hidden_data:"_fieldHidden",baseurl:"_fieldHidden"},initialize:function(e,d){this.app=e},create:function(d){if(d.value===undefined){d.value=null}if(d.default_value===undefined){d.default_value=d.value}var f=null;var e=this.types[d.type];if(e&&typeof(this[e])==="function"){f=this[e].call(this,d)}if(!f){this.app.incompatible=true;if(d.options){f=this._fieldSelect(d)}else{f=this._fieldText(d)}console.debug("tools-form::_addRow() : Auto matched field type ("+d.type+").")}if(d.value!==undefined){f.value(d.value)}return f},_fieldData:function(d){if(!this.app.options.is_dynamic){d.info="Data input '"+d.name+"' ("+b.textify(d.extensions.toString())+")";d.value=null;return this._fieldHidden(d)}var e=this;return new a.View(this.app,{id:"field-"+d.id,extensions:d.extensions,optional:d.optional,multiple:d.multiple,type:d.type,data:d.options,onchange:function(){e.app.trigger("refresh")}})},_fieldSelect:function(d){if(!this.app.options.is_dynamic&&d.is_dynamic){return this._fieldText(d)}if(d.type=="data_column"){d.error_text="Missing columns in referenced dataset."}if(d.type=="genomebuild"){d.searchable=true}var f=[];for(var g in d.options){var h=d.options[g];f.push({label:h[0],value:h[1]})}var j=c.Select;switch(d.display){case"checkboxes":j=c.Checkbox;break;case"radio":j=c.Radio;break}var e=this;return new j.View({id:"field-"+d.id,data:f,error_text:d.error_text||"No options available",multiple:d.multiple,searchable:d.searchable,onchange:function(){e.app.trigger("refresh")}})},_fieldDrilldown:function(d){if(!this.app.options.is_dynamic&&d.is_dynamic){return this._fieldText(d)}var e=this;return new c.Drilldown.View({id:"field-"+d.id,data:d.options,display:d.display,onchange:function(){e.app.trigger("refresh")}})},_fieldText:function(d){if(d.options){d.area=d.multiple;if(!b.validate(d.value)){d.value=""}else{if(d.value instanceof Array){d.value=value.toString()}else{d.value=String(d.value).replace(/[\[\]'"\s]/g,"");if(d.multiple){d.value=d.value.replace(/,/g,"\n")}}}}var e=this;return new c.Input({id:"field-"+d.id,area:d.area,onchange:function(){e.app.trigger("refresh")}})},_fieldSlider:function(d){var e=this;return new c.Slider.View({id:"field-"+d.id,precise:d.type=="float",min:d.min,max:d.max,onchange:function(){e.app.trigger("refresh")}})},_fieldHidden:function(d){return new c.Hidden({id:"field-"+d.id,info:d.info})},_fieldBoolean:function(d){var e=this;return new c.RadioButton.View({id:"field-"+d.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:function(){e.app.trigger("refresh")}})}});return{View:View}});
\ No newline at end of file
diff -r 2c6690a2faea4882a688044ec269de5b15569f58 -r f8012e167c9d569cd06140d28e3def5135ba3ed9 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/ui/ui-portlet","mvc/tools/tools-repeat","mvc/tools/tools-select-content","mvc/tools/tools-input"],function(e,b,h,d,c,a,f){var g=Backbone.View.extend({initialize:function(j,i){this.app=j;this.inputs=i.inputs;i.cls="ui-table-plain";i.cls_tr="section-row";this.table=new b.View(i);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var j in this.inputs){this.add(this.inputs[j])}},add:function(k){var j=this;var i=jQuery.extend(true,{},k);i.id=k.id=e.uuid();this.app.input_list[i.id]=i;var l=i.type;switch(l){case"conditional":this._addConditional(i);break;case"repeat":this._addRepeat(i);break;case"section":this._addSection(i);break;default:this._addRow(i)}},_addConditional:function(j){var k=this;j.test_param.id=j.id;var n=this._addRow(j.test_param);n.options.onchange=function(w){var v=k.app.tree.matchCase(j,w);for(var u in j.cases){var q=j.cases[u];var t=j.id+"-section-"+u;var p=k.table.get(t);var s=false;for(var r in q.inputs){if(!q.inputs[r].hidden){s=true;break}}if(u==v&&s){p.fadeIn("fast")}else{p.hide()}}k.app.trigger("refresh")};for(var m in j.cases){var l=j.id+"-section-"+m;var o=new g(this.app,{inputs:j.cases[m].inputs});o.$el.addClass("ui-table-section");this.table.add(o.$el);this.table.append(l)}n.trigger("change")},_addRepeat:function(p){var s=this;var q=0;var l=new c.View({title:p.title,title_new:p.title,min:p.min,max:p.max,onnew:function(){n(p.inputs);s.app.trigger("refresh")}});function n(i){var t=p.id+"-section-"+(q++);var u=new g(s.app,{inputs:i});l.add({id:t,$el:u.$el,ondel:function(){l.del(t);s.app.trigger("refresh")}})}var j=p.min;var r=_.size(p.cache);for(var m=0;m<Math.max(r,j);m++){var o=null;if(m<r){o=p.cache[m]}else{o=p.inputs}n(o)}var k=new f(this.app,{label:p.title,help:p.help,field:l});this.table.add(k.$el);this.table.append(p.id)},_addSection:function(i){var j=this;var n=new g(j.app,{inputs:i.inputs});var m=new h.ButtonIcon({icon:"fa-eye-slash",tooltip:"Show/hide section",cls:"ui-button-icon-plain"});var l=new d.View({title:i.label,cls:"ui-portlet-section",operations:{button_visible:m}});l.append(n.$el);l.append($("<div/>").addClass("ui-table-form-info").html(i.help));var k=false;l.$content.hide();l.$header.css("cursor","pointer");l.$header.on("click",function(){if(k){k=false;l.$content.hide();m.setIcon("fa-eye-slash")}else{k=true;l.$content.fadeIn("fast");m.setIcon("fa-eye")}});if(i.expand){l.$header.trigger("click")}this.table.add(l.$el);this.table.append(i.id)},_addRow:function(i){var l=i.id;if(i.value===undefined){i.value=null}if(i.default_value===undefined){i.default_value=i.value}var j=this._createField(i);this.app.field_list[l]=j;var k=new f(this.app,{label:i.label,default_value:i.default_value,optional:i.optional,help:i.help,field:j});this.app.element_list[l]=k;this.table.add(k.$el);this.table.append(l);if(i.hidden){this.table.get(l).hide()}return j},_createField:function(i){var j=null;switch(i.type){case"text":j=this._fieldText(i);break;case"select":j=this._fieldSelect(i);break;case"data":j=this._fieldData(i);break;case"data_collection":j=this._fieldData(i);break;case"data_column":i.error_text="Missing columns in referenced dataset.";j=this._fieldSelect(i);break;case"hidden":j=this._fieldHidden(i);break;case"hidden_data":j=this._fieldHidden(i);break;case"integer":j=this._fieldSlider(i);break;case"float":j=this._fieldSlider(i);break;case"boolean":j=this._fieldBoolean(i);break;case"genomebuild":i.searchable=true;j=this._fieldSelect(i);break;case"drill_down":j=this._fieldDrilldown(i);break;case"baseurl":j=this._fieldHidden(i);break;default:this.app.incompatible=true;if(i.options){j=this._fieldSelect(i)}else{j=this._fieldText(i)}console.debug("tools-form::_addRow() : Auto matched field type ("+i.type+").")}if(i.value!==undefined){j.value(i.value)}return j},_fieldData:function(i){if(!this.app.options.is_dynamic){i.info="Data input '"+i.name+"' ("+e.textify(i.extensions.toString())+")";i.value=null;return this._fieldHidden(i)}var j=this;return new a.View(this.app,{id:"field-"+i.id,extensions:i.extensions,optional:i.optional,multiple:i.multiple,type:i.type,data:i.options,onchange:function(){j.app.trigger("refresh")}})},_fieldSelect:function(j){if(!this.app.options.is_dynamic&&j.is_dynamic){return this._fieldText(j)}var l=[];for(var m in j.options){var n=j.options[m];l.push({label:n[0],value:n[1]})}var o=h.Select;switch(j.display){case"checkboxes":o=h.Checkbox;break;case"radio":o=h.Radio;break}var k=this;return new o.View({id:"field-"+j.id,data:l,error_text:j.error_text||"No options available",multiple:j.multiple,searchable:j.searchable,onchange:function(){k.app.trigger("refresh")}})},_fieldDrilldown:function(i){if(!this.app.options.is_dynamic&&i.is_dynamic){return this._fieldText(i)}var j=this;return new h.Drilldown.View({id:"field-"+i.id,data:i.options,display:i.display,onchange:function(){j.app.trigger("refresh")}})},_fieldText:function(i){if(i.options){i.area=i.multiple;if(!e.validate(i.value)){i.value=""}else{if(i.value instanceof Array){i.value=value.toString()}else{i.value=String(i.value).replace(/[\[\]'"\s]/g,"");if(i.multiple){i.value=i.value.replace(/,/g,"\n")}}}}var j=this;return new h.Input({id:"field-"+i.id,area:i.area,onchange:function(){j.app.trigger("refresh")}})},_fieldSlider:function(i){var j=this;return new h.Slider.View({id:"field-"+i.id,precise:i.type=="float",min:i.min,max:i.max,onchange:function(){j.app.trigger("refresh")}})},_fieldHidden:function(i){return new h.Hidden({id:"field-"+i.id,info:i.info})},_fieldBoolean:function(i){var j=this;return new h.RadioButton.View({id:"field-"+i.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:function(){j.app.trigger("refresh")}})}});return{View:g}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/ui/ui-portlet","mvc/tools/tools-repeat","mvc/tools/tools-input","mvc/tools/tools-parameters"],function(e,a,h,d,c,f,b){var g=Backbone.View.extend({initialize:function(j,i){this.app=j;this.inputs=i.inputs;i.cls="ui-table-plain";i.cls_tr="section-row";this.table=new a.View(i);this.parameters=new b(j,i);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var j in this.inputs){this.add(this.inputs[j])}},add:function(k){var j=this;var i=jQuery.extend(true,{},k);i.id=k.id=e.uuid();this.app.input_list[i.id]=i;var l=i.type;switch(l){case"conditional":this._addConditional(i);break;case"repeat":this._addRepeat(i);break;case"section":this._addSection(i);break;default:this._addRow(i)}},_addConditional:function(j){var k=this;j.test_param.id=j.id;var n=this._addRow(j.test_param);n.options.onchange=function(w){var v=k.app.tree.matchCase(j,w);for(var u in j.cases){var q=j.cases[u];var t=j.id+"-section-"+u;var p=k.table.get(t);var s=false;for(var r in q.inputs){if(!q.inputs[r].hidden){s=true;break}}if(u==v&&s){p.fadeIn("fast")}else{p.hide()}}k.app.trigger("refresh")};for(var m in j.cases){var l=j.id+"-section-"+m;var o=new g(this.app,{inputs:j.cases[m].inputs});o.$el.addClass("ui-table-section");this.table.add(o.$el);this.table.append(l)}n.trigger("change")},_addRepeat:function(p){var s=this;var q=0;var l=new c.View({title:p.title,title_new:p.title,min:p.min,max:p.max,onnew:function(){n(p.inputs);s.app.trigger("refresh")}});function n(i){var t=p.id+"-section-"+(q++);var u=new g(s.app,{inputs:i});l.add({id:t,$el:u.$el,ondel:function(){l.del(t);s.app.trigger("refresh")}})}var j=p.min;var r=_.size(p.cache);for(var m=0;m<Math.max(r,j);m++){var o=null;if(m<r){o=p.cache[m]}else{o=p.inputs}n(o)}var k=new f(this.app,{label:p.title,help:p.help,field:l});this.table.add(k.$el);this.table.append(p.id)},_addSection:function(i){var j=this;var n=new g(j.app,{inputs:i.inputs});var m=new h.ButtonIcon({icon:"fa-eye-slash",tooltip:"Show/hide section",cls:"ui-button-icon-plain"});var l=new d.View({title:i.label,cls:"ui-portlet-section",operations:{button_visible:m}});l.append(n.$el);l.append($("<div/>").addClass("ui-table-form-info").html(i.help));var k=false;l.$content.hide();l.$header.css("cursor","pointer");l.$header.on("click",function(){if(k){k=false;l.$content.hide();m.setIcon("fa-eye-slash")}else{k=true;l.$content.fadeIn("fast");m.setIcon("fa-eye")}});if(i.expand){l.$header.trigger("click")}this.table.add(l.$el);this.table.append(i.id)},_addRow:function(i){var l=i.id;var j=this.parameters.create(i);this.app.field_list[l]=j;var k=new f(this.app,{label:i.label,default_value:i.default_value,optional:i.optional,help:i.help,field:j});this.app.element_list[l]=k;this.table.add(k.$el);this.table.append(l);if(i.hidden){this.table.get(l).hide()}return j}});return{View:g}});
\ 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
3 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d09ea0b99ac8/
Changeset: d09ea0b99ac8
User: dannon
Date: 2015-02-12 15:34:51+00:00
Summary: Fix path insertion vs appending of <galaxy>/lib for all scripts.
Affected #: 24 files
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/check_eggs.py
--- a/scripts/check_eggs.py
+++ b/scripts/check_eggs.py
@@ -37,7 +37,7 @@
config_arg = '-c %s' % config
lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), "..", "lib" ) )
-sys.path.append( lib )
+sys.path.insert( 1, lib )
from galaxy.eggs import Crate
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/check_galaxy.py
--- a/scripts/check_galaxy.py
+++ b/scripts/check_galaxy.py
@@ -90,7 +90,7 @@
# find/import twill
lib_dir = os.path.join( scripts_dir, "..", "lib" )
-sys.path.append( lib_dir )
+sys.path.insert( 1, lib_dir )
from galaxy import eggs
import pkg_resources
pkg_resources.require( "twill" )
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/dist-scramble.py
--- a/scripts/dist-scramble.py
+++ b/scripts/dist-scramble.py
@@ -44,7 +44,7 @@
root.addHandler( logging.StreamHandler( sys.stdout ) )
lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) )
-sys.path.append( lib )
+sys.path.insert( 1, lib )
from galaxy.eggs.dist import DistScrambleCrate, ScrambleFailure
from galaxy.eggs import EggNotFetchable
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/get_platforms.py
--- a/scripts/get_platforms.py
+++ b/scripts/get_platforms.py
@@ -5,7 +5,7 @@
assert sys.version_info[:2] >= ( 2, 4 )
lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), "..", "lib" ) )
-sys.path.append( lib )
+sys.path.insert( 1, lib )
import galaxy
import pkg_resources
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/helper.py
--- a/scripts/helper.py
+++ b/scripts/helper.py
@@ -26,7 +26,7 @@
sys.exit( 1 )
options.config = os.path.abspath( options.config )
-sys.path.append( os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) )
+sys.path.insert( 1, os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) )
from galaxy import eggs
import pkg_resources
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/make_egg_packager.py
--- a/scripts/make_egg_packager.py
+++ b/scripts/make_egg_packager.py
@@ -17,7 +17,7 @@
root.addHandler( logging.StreamHandler( sys.stdout ) )
lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), "..", "lib" ) )
-sys.path.append( lib )
+sys.path.insert( 1, lib )
from galaxy.eggs import Crate, EggNotFetchable, py
import pkg_resources
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble.py
--- a/scripts/scramble.py
+++ b/scripts/scramble.py
@@ -15,7 +15,7 @@
root.addHandler( logging.StreamHandler( sys.stdout ) )
lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), "..", "lib" ) )
-sys.path.append( lib )
+sys.path.insert( 1, lib )
from galaxy.eggs.scramble import ScrambleCrate, ScrambleFailure, EggNotFetchable
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble/scripts/DRMAA_python-macosx.py
--- a/scripts/scramble/scripts/DRMAA_python-macosx.py
+++ b/scripts/scramble/scripts/DRMAA_python-macosx.py
@@ -10,7 +10,7 @@
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
-sys.path.append( os.path.join( '..', '..', '..', 'lib' ) )
+sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) )
from scramble_lib import *
tag = get_tag() # get the tag
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble/scripts/DRMAA_python-solaris.py
--- a/scripts/scramble/scripts/DRMAA_python-solaris.py
+++ b/scripts/scramble/scripts/DRMAA_python-solaris.py
@@ -10,7 +10,7 @@
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
-sys.path.append( os.path.join( '..', '..', '..', 'lib' ) )
+sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) )
from scramble_lib import *
tag = get_tag() # get the tag
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble/scripts/DRMAA_python.py
--- a/scripts/scramble/scripts/DRMAA_python.py
+++ b/scripts/scramble/scripts/DRMAA_python.py
@@ -10,7 +10,7 @@
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
-sys.path.append( os.path.join( '..', '..', '..', 'lib' ) )
+sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) )
from scramble_lib import *
tag = get_tag() # get the tag
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble/scripts/MySQL_python-solaris.py
--- a/scripts/scramble/scripts/MySQL_python-solaris.py
+++ b/scripts/scramble/scripts/MySQL_python-solaris.py
@@ -50,7 +50,7 @@
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
- sys.path.append( os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) )
+ sys.path.insert( 1, os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) )
from scramble_lib import *
tag = get_tag()
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble/scripts/MySQL_python.py
--- a/scripts/scramble/scripts/MySQL_python.py
+++ b/scripts/scramble/scripts/MySQL_python.py
@@ -47,7 +47,7 @@
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
- sys.path.append( os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) )
+ sys.path.insert( 1, os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) )
from scramble_lib import *
tag = get_tag()
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble/scripts/PyRods.py
--- a/scripts/scramble/scripts/PyRods.py
+++ b/scripts/scramble/scripts/PyRods.py
@@ -6,7 +6,7 @@
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
-sys.path.append( os.path.join( '..', '..', '..', 'lib' ) )
+sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) )
from scramble_lib import *
tag = get_tag() # get the tag
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble/scripts/bx_python-solaris.py
--- a/scripts/scramble/scripts/bx_python-solaris.py
+++ b/scripts/scramble/scripts/bx_python-solaris.py
@@ -5,7 +5,7 @@
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
-sys.path.append( os.path.join( '..', '..', '..', 'lib' ) )
+sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) )
from scramble_lib import *
tag = get_tag() # get the tag
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble/scripts/generic.py
--- a/scripts/scramble/scripts/generic.py
+++ b/scripts/scramble/scripts/generic.py
@@ -5,7 +5,7 @@
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
-sys.path.append( os.path.join( '..', '..', '..', 'lib' ) )
+sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) )
from scramble_lib import *
tag = get_tag() # get the tag
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble/scripts/pbs_python.py
--- a/scripts/scramble/scripts/pbs_python.py
+++ b/scripts/scramble/scripts/pbs_python.py
@@ -10,7 +10,7 @@
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
-sys.path.append( os.path.join( '..', '..', '..', 'lib' ) )
+sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) )
from scramble_lib import *
tag = get_tag() # get the tag
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble/scripts/psycopg2-linux.py
--- a/scripts/scramble/scripts/psycopg2-linux.py
+++ b/scripts/scramble/scripts/psycopg2-linux.py
@@ -44,7 +44,7 @@
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
- sys.path.append( os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) )
+ sys.path.insert( 1, os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) )
from scramble_lib import *
tag = get_tag()
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble/scripts/psycopg2-macosx.py
--- a/scripts/scramble/scripts/psycopg2-macosx.py
+++ b/scripts/scramble/scripts/psycopg2-macosx.py
@@ -50,7 +50,7 @@
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
- sys.path.append( os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) )
+ sys.path.insert( 1, os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) )
from scramble_lib import *
tag = get_tag()
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble/scripts/psycopg2-solaris.py
--- a/scripts/scramble/scripts/psycopg2-solaris.py
+++ b/scripts/scramble/scripts/psycopg2-solaris.py
@@ -47,7 +47,7 @@
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
- sys.path.append( os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) )
+ sys.path.insert( 1, os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) )
from scramble_lib import *
tag = get_tag()
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble/scripts/psycopg2.py
--- a/scripts/scramble/scripts/psycopg2.py
+++ b/scripts/scramble/scripts/psycopg2.py
@@ -44,7 +44,7 @@
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
- sys.path.append( os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) )
+ sys.path.insert( 1, os.path.abspath( os.path.join( '..', '..', '..', 'lib' ) ) )
from scramble_lib import *
tag = get_tag()
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble/scripts/pysam-solaris.py
--- a/scripts/scramble/scripts/pysam-solaris.py
+++ b/scripts/scramble/scripts/pysam-solaris.py
@@ -5,7 +5,7 @@
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
-sys.path.append( os.path.join( '..', '..', '..', 'lib' ) )
+sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) )
from scramble_lib import *
tag = get_tag() # get the tag
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/scramble/scripts/pysqlite.py
--- a/scripts/scramble/scripts/pysqlite.py
+++ b/scripts/scramble/scripts/pysqlite.py
@@ -10,7 +10,7 @@
os.chdir( os.path.dirname( sys.argv[0] ) )
# find setuptools
-sys.path.append( os.path.join( '..', '..', '..', 'lib' ) )
+sys.path.insert( 1, os.path.join( '..', '..', '..', 'lib' ) )
from scramble_lib import *
tag = get_tag() # get the tag
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/set_dataset_sizes.py
--- a/scripts/set_dataset_sizes.py
+++ b/scripts/set_dataset_sizes.py
@@ -13,7 +13,7 @@
def init():
options.config = os.path.abspath( options.config )
- sys.path.append( os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) )
+ sys.path.insert( 1, os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) )
from galaxy import eggs
import pkg_resources
diff -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e -r d09ea0b99ac884c7d452b007db91339a4864f606 scripts/set_user_disk_usage.py
--- a/scripts/set_user_disk_usage.py
+++ b/scripts/set_user_disk_usage.py
@@ -21,7 +21,7 @@
if options.email == 'all':
options.email = None
- sys.path.append( os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) )
+ sys.path.insert( 1, os.path.join( os.path.dirname( __file__ ), '..', 'lib' ) )
from galaxy import eggs
import pkg_resources
https://bitbucket.org/galaxy/galaxy-central/commits/a1a089bdd773/
Changeset: a1a089bdd773
User: dannon
Date: 2015-02-12 15:36:10+00:00
Summary: Fix path insertion vs appending of <galaxy>/lib for galaxy/main.py.
Affected #: 1 file
diff -r d09ea0b99ac884c7d452b007db91339a4864f606 -r a1a089bdd77348340f6ba2c97c1a6e113cc18377 lib/galaxy/main.py
--- a/lib/galaxy/main.py
+++ b/lib/galaxy/main.py
@@ -87,7 +87,7 @@
log.exception("Failed to chdir")
raise
try:
- sys.path.append(GALAXY_LIB_DIR)
+ sys.path.insert(1, GALAXY_LIB_DIR)
except Exception:
log.exception("Failed to add Galaxy to sys.path")
raise
https://bitbucket.org/galaxy/galaxy-central/commits/2c6690a2faea/
Changeset: 2c6690a2faea
User: dannon
Date: 2015-02-12 15:37:44+00:00
Summary: Fix path insertion vs appending of <galaxy>/lib for unit tests.
Affected #: 8 files
diff -r a1a089bdd77348340f6ba2c97c1a6e113cc18377 -r 2c6690a2faea4882a688044ec269de5b15569f58 test/unit/managers/mock.py
--- a/test/unit/managers/mock.py
+++ b/test/unit/managers/mock.py
@@ -5,7 +5,7 @@
import os
__GALAXY_ROOT__ = os.getcwd() + '/../../../'
-sys.path.append( __GALAXY_ROOT__ + 'lib' )
+sys.path.insert( 1, __GALAXY_ROOT__ + 'lib' )
from galaxy import eggs
eggs.require( 'SQLAlchemy >= 0.4' )
diff -r a1a089bdd77348340f6ba2c97c1a6e113cc18377 -r 2c6690a2faea4882a688044ec269de5b15569f58 test/unit/managers/test_CollectionManager.py
--- a/test/unit/managers/test_CollectionManager.py
+++ b/test/unit/managers/test_CollectionManager.py
@@ -7,7 +7,7 @@
import unittest
__GALAXY_ROOT__ = os.getcwd() + '/../../../'
-sys.path.append( __GALAXY_ROOT__ + 'lib' )
+sys.path.insert( 1, __GALAXY_ROOT__ + 'lib' )
from galaxy import eggs
eggs.require( 'SQLAlchemy >= 0.4' )
diff -r a1a089bdd77348340f6ba2c97c1a6e113cc18377 -r 2c6690a2faea4882a688044ec269de5b15569f58 test/unit/managers/test_DatasetManager.py
--- a/test/unit/managers/test_DatasetManager.py
+++ b/test/unit/managers/test_DatasetManager.py
@@ -7,7 +7,7 @@
import unittest
__GALAXY_ROOT__ = os.getcwd() + '/../../../'
-sys.path.append( __GALAXY_ROOT__ + 'lib' )
+sys.path.insert( 1, __GALAXY_ROOT__ + 'lib' )
from galaxy import eggs
eggs.require( 'SQLAlchemy >= 0.4' )
diff -r a1a089bdd77348340f6ba2c97c1a6e113cc18377 -r 2c6690a2faea4882a688044ec269de5b15569f58 test/unit/managers/test_HDAManager.py
--- a/test/unit/managers/test_HDAManager.py
+++ b/test/unit/managers/test_HDAManager.py
@@ -4,7 +4,7 @@
import unittest
__GALAXY_ROOT__ = os.getcwd() + '/../../../'
-sys.path.append( __GALAXY_ROOT__ + 'lib' )
+sys.path.insert( 1, __GALAXY_ROOT__ + 'lib' )
from galaxy import eggs
eggs.require( 'SQLAlchemy >= 0.4' )
diff -r a1a089bdd77348340f6ba2c97c1a6e113cc18377 -r 2c6690a2faea4882a688044ec269de5b15569f58 test/unit/managers/test_HistoryManager.py
--- a/test/unit/managers/test_HistoryManager.py
+++ b/test/unit/managers/test_HistoryManager.py
@@ -7,7 +7,7 @@
import unittest
__GALAXY_ROOT__ = os.getcwd() + '/../../../'
-sys.path.append( __GALAXY_ROOT__ + 'lib' )
+sys.path.insert( 1, __GALAXY_ROOT__ + 'lib' )
from galaxy import eggs
eggs.require( 'SQLAlchemy >= 0.4' )
diff -r a1a089bdd77348340f6ba2c97c1a6e113cc18377 -r 2c6690a2faea4882a688044ec269de5b15569f58 test/unit/managers/test_ModelManager.py
--- a/test/unit/managers/test_ModelManager.py
+++ b/test/unit/managers/test_ModelManager.py
@@ -9,7 +9,7 @@
import unittest
__GALAXY_ROOT__ = os.getcwd() + '/../../../'
-sys.path.append( __GALAXY_ROOT__ + 'lib' )
+sys.path.insert( 1, __GALAXY_ROOT__ + 'lib' )
from galaxy import eggs
eggs.require( 'SQLAlchemy >= 0.4' )
diff -r a1a089bdd77348340f6ba2c97c1a6e113cc18377 -r 2c6690a2faea4882a688044ec269de5b15569f58 test/unit/managers/test_UserManager.py
--- a/test/unit/managers/test_UserManager.py
+++ b/test/unit/managers/test_UserManager.py
@@ -7,7 +7,7 @@
import unittest
__GALAXY_ROOT__ = os.getcwd() + '/../../../'
-sys.path.append( __GALAXY_ROOT__ + 'lib' )
+sys.path.insert( 1, __GALAXY_ROOT__ + 'lib' )
from galaxy import eggs
eggs.require( 'SQLAlchemy >= 0.4' )
diff -r a1a089bdd77348340f6ba2c97c1a6e113cc18377 -r 2c6690a2faea4882a688044ec269de5b15569f58 test/unit/util/utility.py
--- a/test/unit/util/utility.py
+++ b/test/unit/util/utility.py
@@ -29,7 +29,7 @@
utility.add_galaxy_lib_to_path( '/test/unit/datatypes/dataproviders' )
"""
glx_lib = os.path.join( os.getcwd().replace( this_dir_relative_to_root, '' ), 'lib' )
- sys.path.append( glx_lib )
+ sys.path.insert( 1, glx_lib )
def clean_multiline_string( multiline_string, sep='\n' ):
"""
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: UI, history multi-view: simplify header UI, label current history, some clean up
by commits-noreply@bitbucket.org 12 Feb '15
by commits-noreply@bitbucket.org 12 Feb '15
12 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/a99aafec2a89/
Changeset: a99aafec2a89
User: carlfeberhard
Date: 2015-02-12 15:06:37+00:00
Summary: UI, history multi-view: simplify header UI, label current history, some clean up
Affected #: 4 files
diff -r 5b2f1eab281920eca6c9d1b84e6cebf02866ea09 -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e client/galaxy/scripts/mvc/history/multi-panel.js
--- a/client/galaxy/scripts/mvc/history/multi-panel.js
+++ b/client/galaxy/scripts/mvc/history/multi-panel.js
@@ -6,7 +6,6 @@
"ui/mode-button",
"ui/search-input"
], function( HISTORY_MODEL, HPANEL_EDIT, baseMVC, ajaxQueue ){
-window.HISTORY_MODEL = HISTORY_MODEL;
//==============================================================================
/** */
function historyCopyDialog( history, options ){
@@ -265,7 +264,7 @@
return ( this.currentHistory )?
[
'<div class="pull-left">',
- '<button class="create-new btn btn-default">', _l( 'Create new' ), '</button> ',
+ '<strong class="current-label">', _l( 'Current History' ), '</strong>',
'</div>'
].join( '' )
:[
@@ -328,6 +327,7 @@
var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
//logger : console,
+ className : 'multi-history-columns',
// ------------------------------------------------------------------------ set up
/** Set up internals, history collection, and columns to display the history */
@@ -366,9 +366,8 @@
/** model id to column map */
this.columnMap = {};
-//TODO: why create here?
+ //TODO: why create here?
this.createColumns( options.columnOptions );
-
this.setUpListeners();
},
@@ -386,10 +385,7 @@
var multipanel = this;
multipanel.stopListening( multipanel.collection );
multipanel.collection = models;
-//TODO: slow... esp. on start up
- //if( multipanel.order !== 'update' ){
- multipanel.sortCollection( multipanel.order, { silent: true });
- //}
+ multipanel.sortCollection( multipanel.order, { silent: true });
multipanel.setUpCollectionListeners();
multipanel.trigger( 'new-collection', multipanel );
return multipanel;
@@ -408,11 +404,6 @@
'change:deleted': multipanel.handleDeletedHistory,
'sort' : function(){ multipanel.renderColumns( 0 ); }
-
- // debugging
- //'all' : function(){
- // console.info( 'collection:', arguments );
- //}
});
},
@@ -430,11 +421,6 @@
this.sortCollection();
-////TODO: this actually means these render twice (1st from setCollection) - good enough for now
- //if( oldCurrentColumn ){ oldCurrentColumn.render().delegateEvents(); }
- //TODO:?? this occasionally causes race with hdaQueue
- //newCurrentColumn.panel.render( 'fast' ).delegateEvents();
-
multipanel._recalcFirstColumnHeight();
return newCurrentColumn;
},
@@ -451,14 +437,14 @@
// if it's the current column, create a new, empty history as the new current
if( column.model.id === this.currentHistoryId ){
-//TODO: figuring out the order of async here is tricky - for now let the user handle the two step process
+ //TODO: figuring out the order of async here is tricky
+ // - for now let the user handle the two step process
//multipanel.collection.create().done( function(){
// if( !multipanel.collection.includeDeleted ){ multipanel.removeColumn( column, false ); }
//});
} else if( !multipanel.collection.includeDeleted ){
multipanel.removeColumn( column );
}
-//TODO: prob. be done better
}
},
@@ -475,13 +461,12 @@
//TODO: we can use a 2 arg version and return 1/0/-1
//this.collection.comparator = function( h1, h2 ){
this.collection.comparator = function( h ){
-//TODO: this won't do reverse order well
+ //TODO: this won't do reverse order well
return [ h.id !== currentHistoryId, h.get( 'name' ).toLowerCase() ];
};
break;
case 'size':
this.collection.comparator = function( h ){
-//console.debug( 'name sort', arguments )
return [ h.id !== currentHistoryId, h.get( 'size' ) ];
};
break;
@@ -501,6 +486,8 @@
order = 'update';
}
this.order = order;
+ this.trigger( 'order:change', order, this );
+ this.$( '.current-order' ).text( order );
this.sortCollection();
return this;
},
@@ -533,6 +520,9 @@
return column;
},
+ /** return array of Columns filtered by filters and sorted to match the collection
+ * @param: filters Function[] array of filter fns
+ */
sortedFilteredColumns : function( filters ){
filters = filters || this.filters;
if( !filters || !filters.length ){
@@ -547,6 +537,7 @@
});
},
+ /** return array of Columns sorted to match the collection */
sortedColumns : function(){
var multipanel = this;
var sorted = this.collection.map( function( history, index ){
@@ -555,9 +546,9 @@
return sorted;
},
- /** */
+ /** add a new column for history and render all columns if render is true */
addColumn : function add( history, render ){
-//console.debug( 'adding column for:', history );
+ //this.debug( 'adding column for:', history );
render = render !== undefined? render: true;
var newColumn = this.createColumn( history );
this.columnMap[ history.id ] = newColumn;
@@ -567,9 +558,9 @@
return newColumn;
},
- /** */
+ /** add a new column for history and make it the current history/column */
addAsCurrentColumn : function add( history ){
-//console.log( 'adding current column for:', history );
+ //this.log( 'adding current column for:', history );
var multipanel = this,
newColumn = this.addColumn( history, false );
this.setCurrentHistory( history );
@@ -579,7 +570,7 @@
return newColumn;
},
- /** */
+ /** remove the given column, it's listeners, and optionally render */
removeColumn : function remove( column, render ){
render = render !== undefined? render : true;
this.log( 'removeColumn', column );
@@ -657,79 +648,17 @@
var multipanel = this;
multipanel.log( multipanel + '.render' );
- multipanel.$el.html( multipanel.template( multipanel.options ) );
- //console.debug( multipanel.$( '.loading-overlay' ).fadeIn( 0 ) );
+ multipanel.$el.html( multipanel.mainTemplate( multipanel ) );
multipanel.renderColumns( speed );
- //console.debug( multipanel.$( '.loading-overlay' ).fadeOut( 'fast' ) );
// set the columns to full height allowed and set up behaviors for thie multipanel
multipanel.setUpBehaviors();
-//TODO: wrong - has to wait for columns to render
+ //TODO: wrong - has to wait for columns to render
+ // - create a column listener that fires this when all columns are rendered
multipanel.trigger( 'rendered', multipanel );
return multipanel;
},
- /** Template - overall structure relies on flex-boxes and is 3 components: header, middle, footer */
- template : function template( options ){
- options = options || {};
- var html = [];
- if( this.options.headerHeight ){
- html = html.concat([
- // a loading overlay
- '<div class="loading-overlay flex-row"><div class="loading-overlay-message">loading...</div></div>',
- '<div class="header flex-column-container">',
- // page & history controls
- '<div class="header-control header-control-left flex-column">',
- '<button class="done btn btn-default">', _l( 'Done' ), '</button>',
- '<button class="include-deleted btn btn-default"></button>',
- '<div class="order btn-group">',
- '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',
- _l( 'Order histories by' ) + '... <span class="caret"></span>',
- '</button>',
- '<ul class="dropdown-menu" role="menu">',
- '<li><a href="javascript:void(0);" class="order-update">',
- _l( 'Time of last update' ),
- '</a></li>',
- '<li><a href="javascript:void(0);" class="order-name">',
- _l( 'Name' ),
- '</a></li>',
- '<li><a href="javascript:void(0);" class="order-size">',
- _l( 'Size' ),
- '</a></li>',
- '</ul>',
- '</div>',
- '<div id="search-histories" class="header-search"></div>',
- '</div>',
- // feedback
- '<div class="header-control header-control-center flex-column">',
- '<div class="header-info">',
- '</div>',
- '</div>',
- // dataset controls
- '<div class="header-control header-control-right flex-column">',
- '<div id="search-datasets" class="header-search"></div>',
- '<button id="toggle-deleted" class="btn btn-default">',
- _l( 'Include deleted datasets' ),
- '</button>',
- '<button id="toggle-hidden" class="btn btn-default">',
- _l( 'Include hidden datasets' ),
- '</button>',
- '</div>',
- '</div>'
- ]);
- }
-
- html = html.concat([
- // middle - where the columns go
- '<div class="outer-middle flex-row flex-row-container">',
- '<div class="middle flex-column-container flex-row"></div>',
- '</div>',
- // footer
- '<div class="footer flex-column-container">','</div>'
- ]);
- return $( html.join( '' ) );
- },
-
/** Render the columns and panels */
renderColumns : function renderColumns( speed ){
speed = speed !== undefined? speed: this.fxSpeed;
@@ -737,61 +666,21 @@
// render columns and track the total number rendered, firing an event when all are rendered
var multipanel = this,
sortedAndFiltered = multipanel.sortedFilteredColumns();
-//console.log( '\t columnMapLength:', this.columnMapLength(), this.columnMap );
//this.log( '\t sortedAndFiltered:', sortedAndFiltered );
// set up width based on collection size
-//console.debug( '(render) width before:', multipanel.$( '.middle' ).width() )
multipanel.$( '.middle' ).width( sortedAndFiltered.length
//TODO: magic number 16 === the amount that safely prevents stacking of columns when adding a new one
* ( this.options.columnWidth + this.options.columnGap ) + this.options.columnGap + 16 );
-//console.debug( '(render) width now:', multipanel.$( '.middle' ).width() )
-
-//console.debug( 'sortedAndFiltered:', sortedAndFiltered )
- //multipanel.$( '.middle' ).empty();
-
-// this.$( '.middle' ).html( sortedAndFiltered.map( function( column, i ){
-// return column.$el.hide();
-// }));
-// sortedAndFiltered.forEach( function( column, i ){
-////console.debug( 'rendering:', column, i )
-// //multipanel.$( '.middle' ).append( column.$el.hide() );
-// column.delegateEvents();
-////TODO: current column in-view is never fired
-// multipanel.renderColumn( column, speed ).$el.show();
-// });
-
-// var $els = sortedAndFiltered.map( function( column, i ){
-////console.debug( 'rendering:', column, i )
-// multipanel.renderColumn( column, speed );
-// return column.$el;
-// });
-//// this breaks the event map
-// //this.$( '.middle' ).html( $els );
-//// this doesn't
-// this.$( '.middle' ).append( $els );
var $middle = multipanel.$( '.middle' );
$middle.empty();
sortedAndFiltered.forEach( function( column, i ){
-//console.debug( 'rendering:', column, i, column.panel )
-
column.$el.appendTo( $middle );
column.delegateEvents();
multipanel.renderColumn( column, speed );
-
- //column.$el.hide().appendTo( $middle );
- //multipanel.renderColumn( column, speed );
- // //.panel.on( 'all', function(){
- // // console.debug( 'column rendered:', arguments );
- // //});
- //// this won't work until we checkColumnsInView after the render
- ////column.$el.fadeIn( speed );
- //column.$el.show();
});
- //this.log( 'column rendering done' );
-
-//TODO: event columns-rendered
+ //TODO: event columns-rendered
if( this.searchFor && sortedAndFiltered.length <= 1 ){
} else {
@@ -808,15 +697,11 @@
renderColumn : function( column, speed ){
speed = speed !== undefined? speed: this.fxSpeed;
return column.render( speed );
- //TODO: causes weirdness
- //return _.delay( function(){
- // return column.render( speed );
- //}, 0 );
},
-//TODO: combine the following two more sensibly
-//TODO: could have HistoryContents.haveDetails return false
-// if column.model.contents.length === 0 && !column.model.get( 'empty' ) then just check that
+ //TODO: combine the following two more sensibly
+ //TODO: could have HistoryContents.haveDetails return false
+ // if column.model.contents.length === 0 && !column.model.get( 'empty' ) then just check that
/** Get the *summary* contents of a column's history (and details on any expanded contents),
* queueing the ajax call and using a named queue to prevent the call being sent twice
*/
@@ -874,14 +759,17 @@
events : {
// will move to the server root (gen. Analyze data)
'click .done.btn' : 'close',
- //TODO:?? could just go back - but that's not always correct/desired behav.
- //'click .done.btn' : function(){ window.history.back(); },
// creates a new empty history and makes it current
'click .create-new.btn' : 'create',
+
+ 'click #include-deleted' : '_clickToggleDeletedHistories',
// these change the collection and column sort order
'click .order .order-update' : function( e ){ this.setOrder( 'update' ); },
'click .order .order-name' : function( e ){ this.setOrder( 'name' ); },
- 'click .order .order-size' : function( e ){ this.setOrder( 'size' ); }
+ 'click .order .order-size' : function( e ){ this.setOrder( 'size' ); },
+
+ 'click #toggle-deleted' : '_clickToggleDeletedDatasets',
+ 'click #toggle-hidden' : '_clickToggleHiddenDatasets'
//'dragstart .list-item .title-bar' : function( e ){ console.debug( 'ok' ); }
},
@@ -897,37 +785,48 @@
window.location = destination;
},
+ _clickToggleDeletedHistories : function( ev ){
+ return this.toggleDeletedHistories( $( ev.currentTarget ).is( ':checked' ) );
+ },
/** Include deleted histories in the collection */
- includeDeletedHistories : function(){
- //TODO: better through API/limit+offset
- window.location += ( /\?/.test( window.location.toString() ) )?( '&' ):( '?' )
- + 'include_deleted_histories=True';
+ toggleDeletedHistories : function( show ){
+ if( show ){
+ window.location = Galaxy.options.root + 'history/view_multiple?include_deleted_histories=True';
+ } else {
+ window.location = Galaxy.options.root + 'history/view_multiple';
+ }
},
- /** Show only non-deleted histories */
- excludeDeletedHistories : function(){
- //TODO: better through API/limit+offset
- window.location = window.location.toString().replace( /[&\?]include_deleted_histories=True/g, '' );
+ _clickToggleDeletedDatasets : function( ev ){
+ return this.toggleDeletedDatasets( $( ev.currentTarget ).is( ':checked' ) );
+ },
+ toggleDeletedDatasets : function( show ){
+ show = show !== undefined? show : false;
+ var multipanel = this;
+ multipanel.sortedFilteredColumns().forEach( function( column, i ){
+ _.delay( function(){
+ column.panel.toggleShowDeleted( show, false );
+ }, i * 200 );
+ });
+ },
+
+ _clickToggleHiddenDatasets : function( ev ){
+ return this.toggleHiddenDatasets( $( ev.currentTarget ).is( ':checked' ) );
+ },
+ toggleHiddenDatasets : function( show ){
+ show = show !== undefined? show : false;
+ var multipanel = this;
+ multipanel.sortedFilteredColumns().forEach( function( column, i ){
+ _.delay( function(){
+ column.panel.toggleShowHidden( show, false );
+ }, i * 200 );
+ });
},
/** Set up any view plugins */
setUpBehaviors : function(){
var multipanel = this;
-
-//TODO: currently doesn't need to be a mode button
- // toggle button for include deleted
- multipanel.$( '.include-deleted' ).modeButton({
- initialMode : this.collection.includeDeleted? 'exclude' : 'include',
- switchModesOnClick : false,
- modes: [
- { mode: 'include', html: _l( 'Include deleted histories' ),
- onclick: _.bind( multipanel.includeDeletedHistories, multipanel )
- },
- { mode: 'exclude', html: _l( 'Exclude deleted histories' ),
- onclick: _.bind( multipanel.excludeDeletedHistories, multipanel )
- }
- ]
- });
+ multipanel._moreOptionsPopover();
// input to search histories
multipanel.$( '#search-histories' ).searchInput({
@@ -942,7 +841,7 @@
},
onclear : function( searchFor ){
multipanel.searchFor = null;
-//TODO: remove specifically not just reset
+ //TODO: remove specifically not just reset
multipanel.filters = [];
multipanel.renderColumns( 0 );
}
@@ -986,53 +885,25 @@
}
});
-//TODO: each panel stores the hidden/deleted state - and that isn't reflected in the buttons
- // toggle button for showing deleted history contents
- multipanel.$( '#toggle-deleted' ).modeButton({
- initialMode : 'include',
- modes: [
- { mode: 'exclude', html: _l( 'Exclude deleted datasets' ) },
- { mode: 'include', html: _l( 'Include deleted datasets' ) }
- ]
- }).click( function(){
- var show = $( this ).modeButton( 'getMode' ).mode === 'exclude';
- multipanel.sortedFilteredColumns().forEach( function( column, i ){
- _.delay( function(){
- column.panel.toggleShowDeleted( show, false );
- }, i * 200 );
- });
- });
-
- // toggle button for showing hidden history contents
- multipanel.$( '#toggle-hidden' ).modeButton({
- initialMode : 'include',
- modes: [
- { mode: 'exclude', html: _l( 'Exclude hidden datasets' ) },
- { mode: 'include', html: _l( 'Include hidden datasets' ) }
- ]
- }).click( function(){
- var show = $( this ).modeButton( 'getMode' ).mode === 'exclude';
- multipanel.sortedFilteredColumns().forEach( function( column, i ){
- _.delay( function(){
- column.panel.toggleShowHidden( show, false );
- }, i * 200 );
- });
- });
-
// resize first (fixed position) column on page resize
$( window ).resize( function(){
multipanel._recalcFirstColumnHeight();
});
// when scrolling - check for histories now in view: they will fire 'in-view' and queueHdaLoading if necc.
-//TODO:?? might be able to simplify and not use pub-sub
+ //TODO:?? might be able to simplify and not use pub-sub
var debouncedInView = _.debounce( _.bind( this.checkColumnsInView, this ), 100 );
this.$( '.middle' ).parent().scroll( debouncedInView );
},
- ///** Put the in-view columns then the other columns in a queue, rendering each one at a time */
- //panelRenderQueue : function( columns, fn, args, renderEventName ){
- //},
+ _moreOptionsPopover : function(){
+ return this.$( '.open-more-options.btn' ).popover({
+ container : '.header',
+ placement : 'bottom',
+ html : true,
+ content : $( this.optionsPopoverTemplate( this ) )
+ });
+ },
/** Adjust the height of the first, current column since flex-boxes won't work with fixed postiion elements */
_recalcFirstColumnHeight : function(){
@@ -1052,18 +923,17 @@
/** returns the columns currently in the viewport */
columnsInView : function(){
//TODO: uses offset which is render intensive
-//TODO: 2N - could use arg filter (sortedFilteredColumns( filter )) instead
+ //TODO: 2N - could use arg filter (sortedFilteredColumns( filter )) instead
var vp = this._viewport();
return this.sortedFilteredColumns().filter( function( column ){
return column.currentHistory || column.inView( vp.left, vp.right );
});
},
-//TODO: sortByInView - return cols in view, then others
+ //TODO: sortByInView - return cols in view, then others
/** trigger in-view from columns in-view */
checkColumnsInView : function(){
-//TODO: assbackward
-//console.debug( 'checking columns in view', this.columnsInView() );
+ //TODO: assbackward - don't fire from the column, fire from here and listen from here
this.columnsInView().forEach( function( column ){
column.trigger( 'in-view', column );
});
@@ -1073,7 +943,7 @@
currentColumnDropTargetOn : function(){
var currentColumn = this.columnMap[ this.currentHistoryId ];
if( !currentColumn ){ return; }
-//TODO: fix this - shouldn't need monkeypatch
+ //TODO: fix this - shouldn't need monkeypatch
currentColumn.panel.dataDropped = function( data ){};
currentColumn.panel.dropTargetOn();
},
@@ -1090,7 +960,73 @@
/** String rep */
toString : function(){
return 'MultiPanelColumns(' + ( this.columns? this.columns.length : 0 ) + ')';
- }
+ },
+
+ // ------------------------------------------------------------------------ templates
+ mainTemplate : _.template([
+ '<div class="header flex-column-container">',
+ '<div class="control-column control-column-left flex-column">',
+ '<button class="create-new btn btn-default">', _l( 'Create new' ), '</button> ',
+ '<div id="search-histories" class="search-control"></div>',
+ '<div id="search-datasets" class="search-control"></div>',
+ '<button class="open-more-options btn btn-default">',
+ //TODO: tip not working
+ '<span class="fa fa-ellipsis-h" title="More options"></span>',
+ '</button>',
+ '</div>',
+ // feedback
+ '<div class="control-column control-column-center flex-column">',
+ '<div class="header-info">',
+ '</div>',
+ '</div>',
+ '<div class="control-column control-column-right flex-column">',
+ '<button class="done btn btn-default">', _l( 'Done' ), '</button>',
+ '</div>',
+ '</div>',
+ // middle - where the columns go
+ '<div class="outer-middle flex-row flex-row-container">',
+ '<div class="middle flex-column-container flex-row"></div>',
+ '</div>',
+ // footer
+ '<div class="footer flex-column-container">',
+ '</div>'
+ ].join(''), { variable: 'view' }),
+
+ optionsPopoverTemplate : _.template([
+ '<div class="more-options">',
+ '<div class="checkbox"><label><input id="include-deleted" type="checkbox"',
+ '<%= view.collection.includeDeleted? " checked" : "" %>>',
+ _l( 'Include deleted histories' ),
+ '</label></div>',
+
+ '<div class="order btn-group">',
+ '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',
+ _l( 'Order histories by' ) + ' ',
+ '<span class="current-order"><%= view.order %></span> ',
+ '<span class="caret"></span>',
+ '</button>',
+ '<ul class="dropdown-menu" role="menu">',
+ '<li><a href="javascript:void(0);" class="order-update">',
+ _l( 'Time of last update' ),
+ '</a></li>',
+ '<li><a href="javascript:void(0);" class="order-name">',
+ _l( 'Name' ),
+ '</a></li>',
+ '<li><a href="javascript:void(0);" class="order-size">',
+ _l( 'Size' ),
+ '</a></li>',
+ '</ul>',
+ '</div>',
+
+ '<div class="checkbox"><label><input id="toggle-deleted" type="checkbox">',
+ _l( 'Include deleted datasets' ),
+ '</label></div>',
+ '<div class="checkbox"><label><input id="toggle-hidden" type="checkbox">',
+ _l( 'Include hidden datasets' ),
+ '</label></div>',
+ '</div>'
+ ].join(''), { variable: 'view' }),
+
});
diff -r 5b2f1eab281920eca6c9d1b84e6cebf02866ea09 -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e static/scripts/mvc/history/multi-panel.js
--- a/static/scripts/mvc/history/multi-panel.js
+++ b/static/scripts/mvc/history/multi-panel.js
@@ -6,7 +6,6 @@
"ui/mode-button",
"ui/search-input"
], function( HISTORY_MODEL, HPANEL_EDIT, baseMVC, ajaxQueue ){
-window.HISTORY_MODEL = HISTORY_MODEL;
//==============================================================================
/** */
function historyCopyDialog( history, options ){
@@ -265,7 +264,7 @@
return ( this.currentHistory )?
[
'<div class="pull-left">',
- '<button class="create-new btn btn-default">', _l( 'Create new' ), '</button> ',
+ '<strong class="current-label">', _l( 'Current History' ), '</strong>',
'</div>'
].join( '' )
:[
@@ -328,6 +327,7 @@
var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
//logger : console,
+ className : 'multi-history-columns',
// ------------------------------------------------------------------------ set up
/** Set up internals, history collection, and columns to display the history */
@@ -366,9 +366,8 @@
/** model id to column map */
this.columnMap = {};
-//TODO: why create here?
+ //TODO: why create here?
this.createColumns( options.columnOptions );
-
this.setUpListeners();
},
@@ -386,10 +385,7 @@
var multipanel = this;
multipanel.stopListening( multipanel.collection );
multipanel.collection = models;
-//TODO: slow... esp. on start up
- //if( multipanel.order !== 'update' ){
- multipanel.sortCollection( multipanel.order, { silent: true });
- //}
+ multipanel.sortCollection( multipanel.order, { silent: true });
multipanel.setUpCollectionListeners();
multipanel.trigger( 'new-collection', multipanel );
return multipanel;
@@ -408,11 +404,6 @@
'change:deleted': multipanel.handleDeletedHistory,
'sort' : function(){ multipanel.renderColumns( 0 ); }
-
- // debugging
- //'all' : function(){
- // console.info( 'collection:', arguments );
- //}
});
},
@@ -430,11 +421,6 @@
this.sortCollection();
-////TODO: this actually means these render twice (1st from setCollection) - good enough for now
- //if( oldCurrentColumn ){ oldCurrentColumn.render().delegateEvents(); }
- //TODO:?? this occasionally causes race with hdaQueue
- //newCurrentColumn.panel.render( 'fast' ).delegateEvents();
-
multipanel._recalcFirstColumnHeight();
return newCurrentColumn;
},
@@ -451,14 +437,14 @@
// if it's the current column, create a new, empty history as the new current
if( column.model.id === this.currentHistoryId ){
-//TODO: figuring out the order of async here is tricky - for now let the user handle the two step process
+ //TODO: figuring out the order of async here is tricky
+ // - for now let the user handle the two step process
//multipanel.collection.create().done( function(){
// if( !multipanel.collection.includeDeleted ){ multipanel.removeColumn( column, false ); }
//});
} else if( !multipanel.collection.includeDeleted ){
multipanel.removeColumn( column );
}
-//TODO: prob. be done better
}
},
@@ -475,13 +461,12 @@
//TODO: we can use a 2 arg version and return 1/0/-1
//this.collection.comparator = function( h1, h2 ){
this.collection.comparator = function( h ){
-//TODO: this won't do reverse order well
+ //TODO: this won't do reverse order well
return [ h.id !== currentHistoryId, h.get( 'name' ).toLowerCase() ];
};
break;
case 'size':
this.collection.comparator = function( h ){
-//console.debug( 'name sort', arguments )
return [ h.id !== currentHistoryId, h.get( 'size' ) ];
};
break;
@@ -501,6 +486,8 @@
order = 'update';
}
this.order = order;
+ this.trigger( 'order:change', order, this );
+ this.$( '.current-order' ).text( order );
this.sortCollection();
return this;
},
@@ -533,6 +520,9 @@
return column;
},
+ /** return array of Columns filtered by filters and sorted to match the collection
+ * @param: filters Function[] array of filter fns
+ */
sortedFilteredColumns : function( filters ){
filters = filters || this.filters;
if( !filters || !filters.length ){
@@ -547,6 +537,7 @@
});
},
+ /** return array of Columns sorted to match the collection */
sortedColumns : function(){
var multipanel = this;
var sorted = this.collection.map( function( history, index ){
@@ -555,9 +546,9 @@
return sorted;
},
- /** */
+ /** add a new column for history and render all columns if render is true */
addColumn : function add( history, render ){
-//console.debug( 'adding column for:', history );
+ //this.debug( 'adding column for:', history );
render = render !== undefined? render: true;
var newColumn = this.createColumn( history );
this.columnMap[ history.id ] = newColumn;
@@ -567,9 +558,9 @@
return newColumn;
},
- /** */
+ /** add a new column for history and make it the current history/column */
addAsCurrentColumn : function add( history ){
-//console.log( 'adding current column for:', history );
+ //this.log( 'adding current column for:', history );
var multipanel = this,
newColumn = this.addColumn( history, false );
this.setCurrentHistory( history );
@@ -579,7 +570,7 @@
return newColumn;
},
- /** */
+ /** remove the given column, it's listeners, and optionally render */
removeColumn : function remove( column, render ){
render = render !== undefined? render : true;
this.log( 'removeColumn', column );
@@ -657,79 +648,17 @@
var multipanel = this;
multipanel.log( multipanel + '.render' );
- multipanel.$el.html( multipanel.template( multipanel.options ) );
- //console.debug( multipanel.$( '.loading-overlay' ).fadeIn( 0 ) );
+ multipanel.$el.html( multipanel.mainTemplate( multipanel ) );
multipanel.renderColumns( speed );
- //console.debug( multipanel.$( '.loading-overlay' ).fadeOut( 'fast' ) );
// set the columns to full height allowed and set up behaviors for thie multipanel
multipanel.setUpBehaviors();
-//TODO: wrong - has to wait for columns to render
+ //TODO: wrong - has to wait for columns to render
+ // - create a column listener that fires this when all columns are rendered
multipanel.trigger( 'rendered', multipanel );
return multipanel;
},
- /** Template - overall structure relies on flex-boxes and is 3 components: header, middle, footer */
- template : function template( options ){
- options = options || {};
- var html = [];
- if( this.options.headerHeight ){
- html = html.concat([
- // a loading overlay
- '<div class="loading-overlay flex-row"><div class="loading-overlay-message">loading...</div></div>',
- '<div class="header flex-column-container">',
- // page & history controls
- '<div class="header-control header-control-left flex-column">',
- '<button class="done btn btn-default">', _l( 'Done' ), '</button>',
- '<button class="include-deleted btn btn-default"></button>',
- '<div class="order btn-group">',
- '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',
- _l( 'Order histories by' ) + '... <span class="caret"></span>',
- '</button>',
- '<ul class="dropdown-menu" role="menu">',
- '<li><a href="javascript:void(0);" class="order-update">',
- _l( 'Time of last update' ),
- '</a></li>',
- '<li><a href="javascript:void(0);" class="order-name">',
- _l( 'Name' ),
- '</a></li>',
- '<li><a href="javascript:void(0);" class="order-size">',
- _l( 'Size' ),
- '</a></li>',
- '</ul>',
- '</div>',
- '<div id="search-histories" class="header-search"></div>',
- '</div>',
- // feedback
- '<div class="header-control header-control-center flex-column">',
- '<div class="header-info">',
- '</div>',
- '</div>',
- // dataset controls
- '<div class="header-control header-control-right flex-column">',
- '<div id="search-datasets" class="header-search"></div>',
- '<button id="toggle-deleted" class="btn btn-default">',
- _l( 'Include deleted datasets' ),
- '</button>',
- '<button id="toggle-hidden" class="btn btn-default">',
- _l( 'Include hidden datasets' ),
- '</button>',
- '</div>',
- '</div>'
- ]);
- }
-
- html = html.concat([
- // middle - where the columns go
- '<div class="outer-middle flex-row flex-row-container">',
- '<div class="middle flex-column-container flex-row"></div>',
- '</div>',
- // footer
- '<div class="footer flex-column-container">','</div>'
- ]);
- return $( html.join( '' ) );
- },
-
/** Render the columns and panels */
renderColumns : function renderColumns( speed ){
speed = speed !== undefined? speed: this.fxSpeed;
@@ -737,61 +666,21 @@
// render columns and track the total number rendered, firing an event when all are rendered
var multipanel = this,
sortedAndFiltered = multipanel.sortedFilteredColumns();
-//console.log( '\t columnMapLength:', this.columnMapLength(), this.columnMap );
//this.log( '\t sortedAndFiltered:', sortedAndFiltered );
// set up width based on collection size
-//console.debug( '(render) width before:', multipanel.$( '.middle' ).width() )
multipanel.$( '.middle' ).width( sortedAndFiltered.length
//TODO: magic number 16 === the amount that safely prevents stacking of columns when adding a new one
* ( this.options.columnWidth + this.options.columnGap ) + this.options.columnGap + 16 );
-//console.debug( '(render) width now:', multipanel.$( '.middle' ).width() )
-
-//console.debug( 'sortedAndFiltered:', sortedAndFiltered )
- //multipanel.$( '.middle' ).empty();
-
-// this.$( '.middle' ).html( sortedAndFiltered.map( function( column, i ){
-// return column.$el.hide();
-// }));
-// sortedAndFiltered.forEach( function( column, i ){
-////console.debug( 'rendering:', column, i )
-// //multipanel.$( '.middle' ).append( column.$el.hide() );
-// column.delegateEvents();
-////TODO: current column in-view is never fired
-// multipanel.renderColumn( column, speed ).$el.show();
-// });
-
-// var $els = sortedAndFiltered.map( function( column, i ){
-////console.debug( 'rendering:', column, i )
-// multipanel.renderColumn( column, speed );
-// return column.$el;
-// });
-//// this breaks the event map
-// //this.$( '.middle' ).html( $els );
-//// this doesn't
-// this.$( '.middle' ).append( $els );
var $middle = multipanel.$( '.middle' );
$middle.empty();
sortedAndFiltered.forEach( function( column, i ){
-//console.debug( 'rendering:', column, i, column.panel )
-
column.$el.appendTo( $middle );
column.delegateEvents();
multipanel.renderColumn( column, speed );
-
- //column.$el.hide().appendTo( $middle );
- //multipanel.renderColumn( column, speed );
- // //.panel.on( 'all', function(){
- // // console.debug( 'column rendered:', arguments );
- // //});
- //// this won't work until we checkColumnsInView after the render
- ////column.$el.fadeIn( speed );
- //column.$el.show();
});
- //this.log( 'column rendering done' );
-
-//TODO: event columns-rendered
+ //TODO: event columns-rendered
if( this.searchFor && sortedAndFiltered.length <= 1 ){
} else {
@@ -808,15 +697,11 @@
renderColumn : function( column, speed ){
speed = speed !== undefined? speed: this.fxSpeed;
return column.render( speed );
- //TODO: causes weirdness
- //return _.delay( function(){
- // return column.render( speed );
- //}, 0 );
},
-//TODO: combine the following two more sensibly
-//TODO: could have HistoryContents.haveDetails return false
-// if column.model.contents.length === 0 && !column.model.get( 'empty' ) then just check that
+ //TODO: combine the following two more sensibly
+ //TODO: could have HistoryContents.haveDetails return false
+ // if column.model.contents.length === 0 && !column.model.get( 'empty' ) then just check that
/** Get the *summary* contents of a column's history (and details on any expanded contents),
* queueing the ajax call and using a named queue to prevent the call being sent twice
*/
@@ -874,14 +759,17 @@
events : {
// will move to the server root (gen. Analyze data)
'click .done.btn' : 'close',
- //TODO:?? could just go back - but that's not always correct/desired behav.
- //'click .done.btn' : function(){ window.history.back(); },
// creates a new empty history and makes it current
'click .create-new.btn' : 'create',
+
+ 'click #include-deleted' : '_clickToggleDeletedHistories',
// these change the collection and column sort order
'click .order .order-update' : function( e ){ this.setOrder( 'update' ); },
'click .order .order-name' : function( e ){ this.setOrder( 'name' ); },
- 'click .order .order-size' : function( e ){ this.setOrder( 'size' ); }
+ 'click .order .order-size' : function( e ){ this.setOrder( 'size' ); },
+
+ 'click #toggle-deleted' : '_clickToggleDeletedDatasets',
+ 'click #toggle-hidden' : '_clickToggleHiddenDatasets'
//'dragstart .list-item .title-bar' : function( e ){ console.debug( 'ok' ); }
},
@@ -897,37 +785,48 @@
window.location = destination;
},
+ _clickToggleDeletedHistories : function( ev ){
+ return this.toggleDeletedHistories( $( ev.currentTarget ).is( ':checked' ) );
+ },
/** Include deleted histories in the collection */
- includeDeletedHistories : function(){
- //TODO: better through API/limit+offset
- window.location += ( /\?/.test( window.location.toString() ) )?( '&' ):( '?' )
- + 'include_deleted_histories=True';
+ toggleDeletedHistories : function( show ){
+ if( show ){
+ window.location = Galaxy.options.root + 'history/view_multiple?include_deleted_histories=True';
+ } else {
+ window.location = Galaxy.options.root + 'history/view_multiple';
+ }
},
- /** Show only non-deleted histories */
- excludeDeletedHistories : function(){
- //TODO: better through API/limit+offset
- window.location = window.location.toString().replace( /[&\?]include_deleted_histories=True/g, '' );
+ _clickToggleDeletedDatasets : function( ev ){
+ return this.toggleDeletedDatasets( $( ev.currentTarget ).is( ':checked' ) );
+ },
+ toggleDeletedDatasets : function( show ){
+ show = show !== undefined? show : false;
+ var multipanel = this;
+ multipanel.sortedFilteredColumns().forEach( function( column, i ){
+ _.delay( function(){
+ column.panel.toggleShowDeleted( show, false );
+ }, i * 200 );
+ });
+ },
+
+ _clickToggleHiddenDatasets : function( ev ){
+ return this.toggleHiddenDatasets( $( ev.currentTarget ).is( ':checked' ) );
+ },
+ toggleHiddenDatasets : function( show ){
+ show = show !== undefined? show : false;
+ var multipanel = this;
+ multipanel.sortedFilteredColumns().forEach( function( column, i ){
+ _.delay( function(){
+ column.panel.toggleShowHidden( show, false );
+ }, i * 200 );
+ });
},
/** Set up any view plugins */
setUpBehaviors : function(){
var multipanel = this;
-
-//TODO: currently doesn't need to be a mode button
- // toggle button for include deleted
- multipanel.$( '.include-deleted' ).modeButton({
- initialMode : this.collection.includeDeleted? 'exclude' : 'include',
- switchModesOnClick : false,
- modes: [
- { mode: 'include', html: _l( 'Include deleted histories' ),
- onclick: _.bind( multipanel.includeDeletedHistories, multipanel )
- },
- { mode: 'exclude', html: _l( 'Exclude deleted histories' ),
- onclick: _.bind( multipanel.excludeDeletedHistories, multipanel )
- }
- ]
- });
+ multipanel._moreOptionsPopover();
// input to search histories
multipanel.$( '#search-histories' ).searchInput({
@@ -942,7 +841,7 @@
},
onclear : function( searchFor ){
multipanel.searchFor = null;
-//TODO: remove specifically not just reset
+ //TODO: remove specifically not just reset
multipanel.filters = [];
multipanel.renderColumns( 0 );
}
@@ -986,53 +885,25 @@
}
});
-//TODO: each panel stores the hidden/deleted state - and that isn't reflected in the buttons
- // toggle button for showing deleted history contents
- multipanel.$( '#toggle-deleted' ).modeButton({
- initialMode : 'include',
- modes: [
- { mode: 'exclude', html: _l( 'Exclude deleted datasets' ) },
- { mode: 'include', html: _l( 'Include deleted datasets' ) }
- ]
- }).click( function(){
- var show = $( this ).modeButton( 'getMode' ).mode === 'exclude';
- multipanel.sortedFilteredColumns().forEach( function( column, i ){
- _.delay( function(){
- column.panel.toggleShowDeleted( show, false );
- }, i * 200 );
- });
- });
-
- // toggle button for showing hidden history contents
- multipanel.$( '#toggle-hidden' ).modeButton({
- initialMode : 'include',
- modes: [
- { mode: 'exclude', html: _l( 'Exclude hidden datasets' ) },
- { mode: 'include', html: _l( 'Include hidden datasets' ) }
- ]
- }).click( function(){
- var show = $( this ).modeButton( 'getMode' ).mode === 'exclude';
- multipanel.sortedFilteredColumns().forEach( function( column, i ){
- _.delay( function(){
- column.panel.toggleShowHidden( show, false );
- }, i * 200 );
- });
- });
-
// resize first (fixed position) column on page resize
$( window ).resize( function(){
multipanel._recalcFirstColumnHeight();
});
// when scrolling - check for histories now in view: they will fire 'in-view' and queueHdaLoading if necc.
-//TODO:?? might be able to simplify and not use pub-sub
+ //TODO:?? might be able to simplify and not use pub-sub
var debouncedInView = _.debounce( _.bind( this.checkColumnsInView, this ), 100 );
this.$( '.middle' ).parent().scroll( debouncedInView );
},
- ///** Put the in-view columns then the other columns in a queue, rendering each one at a time */
- //panelRenderQueue : function( columns, fn, args, renderEventName ){
- //},
+ _moreOptionsPopover : function(){
+ return this.$( '.open-more-options.btn' ).popover({
+ container : '.header',
+ placement : 'bottom',
+ html : true,
+ content : $( this.optionsPopoverTemplate( this ) )
+ });
+ },
/** Adjust the height of the first, current column since flex-boxes won't work with fixed postiion elements */
_recalcFirstColumnHeight : function(){
@@ -1052,18 +923,17 @@
/** returns the columns currently in the viewport */
columnsInView : function(){
//TODO: uses offset which is render intensive
-//TODO: 2N - could use arg filter (sortedFilteredColumns( filter )) instead
+ //TODO: 2N - could use arg filter (sortedFilteredColumns( filter )) instead
var vp = this._viewport();
return this.sortedFilteredColumns().filter( function( column ){
return column.currentHistory || column.inView( vp.left, vp.right );
});
},
-//TODO: sortByInView - return cols in view, then others
+ //TODO: sortByInView - return cols in view, then others
/** trigger in-view from columns in-view */
checkColumnsInView : function(){
-//TODO: assbackward
-//console.debug( 'checking columns in view', this.columnsInView() );
+ //TODO: assbackward - don't fire from the column, fire from here and listen from here
this.columnsInView().forEach( function( column ){
column.trigger( 'in-view', column );
});
@@ -1073,7 +943,7 @@
currentColumnDropTargetOn : function(){
var currentColumn = this.columnMap[ this.currentHistoryId ];
if( !currentColumn ){ return; }
-//TODO: fix this - shouldn't need monkeypatch
+ //TODO: fix this - shouldn't need monkeypatch
currentColumn.panel.dataDropped = function( data ){};
currentColumn.panel.dropTargetOn();
},
@@ -1090,7 +960,73 @@
/** String rep */
toString : function(){
return 'MultiPanelColumns(' + ( this.columns? this.columns.length : 0 ) + ')';
- }
+ },
+
+ // ------------------------------------------------------------------------ templates
+ mainTemplate : _.template([
+ '<div class="header flex-column-container">',
+ '<div class="control-column control-column-left flex-column">',
+ '<button class="create-new btn btn-default">', _l( 'Create new' ), '</button> ',
+ '<div id="search-histories" class="search-control"></div>',
+ '<div id="search-datasets" class="search-control"></div>',
+ '<button class="open-more-options btn btn-default">',
+ //TODO: tip not working
+ '<span class="fa fa-ellipsis-h" title="More options"></span>',
+ '</button>',
+ '</div>',
+ // feedback
+ '<div class="control-column control-column-center flex-column">',
+ '<div class="header-info">',
+ '</div>',
+ '</div>',
+ '<div class="control-column control-column-right flex-column">',
+ '<button class="done btn btn-default">', _l( 'Done' ), '</button>',
+ '</div>',
+ '</div>',
+ // middle - where the columns go
+ '<div class="outer-middle flex-row flex-row-container">',
+ '<div class="middle flex-column-container flex-row"></div>',
+ '</div>',
+ // footer
+ '<div class="footer flex-column-container">',
+ '</div>'
+ ].join(''), { variable: 'view' }),
+
+ optionsPopoverTemplate : _.template([
+ '<div class="more-options">',
+ '<div class="checkbox"><label><input id="include-deleted" type="checkbox"',
+ '<%= view.collection.includeDeleted? " checked" : "" %>>',
+ _l( 'Include deleted histories' ),
+ '</label></div>',
+
+ '<div class="order btn-group">',
+ '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',
+ _l( 'Order histories by' ) + ' ',
+ '<span class="current-order"><%= view.order %></span> ',
+ '<span class="caret"></span>',
+ '</button>',
+ '<ul class="dropdown-menu" role="menu">',
+ '<li><a href="javascript:void(0);" class="order-update">',
+ _l( 'Time of last update' ),
+ '</a></li>',
+ '<li><a href="javascript:void(0);" class="order-name">',
+ _l( 'Name' ),
+ '</a></li>',
+ '<li><a href="javascript:void(0);" class="order-size">',
+ _l( 'Size' ),
+ '</a></li>',
+ '</ul>',
+ '</div>',
+
+ '<div class="checkbox"><label><input id="toggle-deleted" type="checkbox">',
+ _l( 'Include deleted datasets' ),
+ '</label></div>',
+ '<div class="checkbox"><label><input id="toggle-hidden" type="checkbox">',
+ _l( 'Include hidden datasets' ),
+ '</label></div>',
+ '</div>'
+ ].join(''), { variable: 'view' }),
+
});
diff -r 5b2f1eab281920eca6c9d1b84e6cebf02866ea09 -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e static/scripts/packed/mvc/history/multi-panel.js
--- a/static/scripts/packed/mvc/history/multi-panel.js
+++ b/static/scripts/packed/mvc/history/multi-panel.js
@@ -1,1 +1,1 @@
-define(["mvc/history/history-model","mvc/history/history-panel-edit","mvc/base-mvc","utils/ajax-queue","ui/mode-button","ui/search-input"],function(d,l,z,a){window.HISTORY_MODEL=d;function g(I,E){E=E||{};if(!(Galaxy&&Galaxy.modal)){return I.copy()}var F=I.get("name"),C="Copy of '"+F+"'";function D(K){if(!K){if(!Galaxy.modal.$("#invalid-title").size()){var J=$("<p/>").attr("id","invalid-title").css({color:"red","margin-top":"8px"}).addClass("bg-danger").text(_l("Please enter a valid history title"));Galaxy.modal.$(".modal-body").append(J)}return false}return K}function G(J){var K=$('<p><span class="fa fa-spinner fa-spin"></span> Copying history...</p>').css("margin-top","8px");Galaxy.modal.$(".modal-body").append(K);I.copy(true,J).fail(function(){alert(_l("History could not be copied. Please contact a Galaxy administrator"))}).always(function(){Galaxy.modal.hide()})}function H(){var J=Galaxy.modal.$("#copy-modal-title").val();if(!D(J)){return}G(J)}Galaxy.modal.show(_.extend({title:_l("Copying history")+' "'+F+'"',body:$(['<label for="copy-modal-title">',_l("Enter a title for the copied history"),":","</label><br />",'<input id="copy-modal-title" class="form-control" style="width: 100%" value="',C,'" />'].join("")),buttons:{Cancel:function(){Galaxy.modal.hide()},Copy:H}},E));$("#copy-modal-title").focus().select();$("#copy-modal-title").on("keydown",function(J){if(J.keyCode===13){H()}})}var B=Backbone.View.extend(z.LoggableMixin).extend({tagName:"div",className:"history-column flex-column flex-row-container",id:function q(){if(!this.model){return""}return"history-column-"+this.model.get("id")},initialize:function c(C){C=C||{};this.panel=C.panel||this.createPanel(C);this.setUpListeners()},createPanel:function u(D){D=_.extend({model:this.model,dragItems:true},D);var C=new l.HistoryPanelEdit(D);C._renderEmptyMessage=this.__patch_renderEmptyMessage;return C},__patch_renderEmptyMessage:function(E){var D=this,F=_.chain(this.model.get("state_ids")).values().flatten().value().length,C=D.$emptyMessage(E);if(!_.isEmpty(D.hdaViews)){C.hide()}else{if(F&&!this.model.contents.length){C.empty().append($('<span class="fa fa-spinner fa-spin"></span><i>loading datasets...</i>')).show()}else{if(D.searchFor){C.text(D.noneFoundMsg).show()}else{C.text(D.emptyMsg).show()}}}return C},setUpListeners:function f(){var C=this;this.once("rendered",function(){C.trigger("rendered:initial",C)});this.setUpPanelListeners()},setUpPanelListeners:function k(){var C=this;this.listenTo(this.panel,{rendered:function(){C.trigger("rendered",C)}},this)},inView:function(C,D){var F=this.$el.offset().left,E=F+this.$el.width();if(E<C){return false}if(F>D){return false}return true},$panel:function e(){return this.$(".history-panel")},render:function A(D){D=(D!==undefined)?(D):("fast");var C=this.model?this.model.toJSON():{};this.$el.html(this.template(C));this.renderPanel(D);this.setUpBehaviors();return this},setUpBehaviors:function v(){},template:function w(D){D=D||{};var C=['<div class="panel-controls clear flex-row">',this.controlsLeftTemplate(),'<div class="pull-right">','<button class="delete-history btn btn-default">',D.deleted?_l("Undelete"):_l("Delete"),"</button>",'<button class="copy-history btn btn-default">',_l("Copy"),"</button>","</div>","</div>",'<div class="inner flex-row flex-column-container">','<div id="history-',D.id,'" class="history-column history-panel flex-column"></div>',"</div>"].join("");return $(C)},controlsLeftTemplate:function(){return(this.currentHistory)?['<div class="pull-left">','<button class="create-new btn btn-default">',_l("Create new"),"</button> ","</div>"].join(""):['<div class="pull-left">','<button class="switch-to btn btn-default">',_l("Switch to"),"</button>","</div>"].join("")},renderPanel:function h(C){C=(C!==undefined)?(C):("fast");this.panel.setElement(this.$panel()).render(C);return this},events:{"click .switch-to.btn":function(){this.model.setAsCurrent()},"click .delete-history.btn":function(){var C=this,D;if(this.model.get("deleted")){D=this.model.undelete()}else{D=this.model._delete()}D.fail(function(G,E,F){alert(_l("Could not delete the history")+":\n"+F)}).done(function(E){C.render()})},"click .copy-history.btn":"copy"},copy:function s(){g(this.model)},toString:function(){return"HistoryPanelColumn("+(this.panel?this.panel:"")+")"}});var m=Backbone.View.extend(z.LoggableMixin).extend({initialize:function c(C){C=C||{};this.log(this+".init",C);if(!C.currentHistoryId){throw new Error(this+" requires a currentHistoryId in the options")}this.currentHistoryId=C.currentHistoryId;this.options={columnWidth:312,borderWidth:1,columnGap:8,headerHeight:29,footerHeight:0,controlsHeight:20};this.order=C.order||"update";this.hdaQueue=new a.NamedAjaxQueue([],false);this.collection=null;this.setCollection(C.histories||[]);this.columnMap={};this.createColumns(C.columnOptions);this.setUpListeners()},setUpListeners:function f(){},setCollection:function y(D){var C=this;C.stopListening(C.collection);C.collection=D;C.sortCollection(C.order,{silent:true});C.setUpCollectionListeners();C.trigger("new-collection",C);return C},setUpCollectionListeners:function(){var C=this,D=C.collection;C.listenTo(D,{add:C.addAsCurrentColumn,"set-as-current":C.setCurrentHistory,"change:deleted":C.handleDeletedHistory,sort:function(){C.renderColumns(0)}})},setCurrentHistory:function p(D){var C=this.columnMap[this.currentHistoryId];if(C){C.currentHistory=false;C.$el.height("")}this.currentHistoryId=D.id;var E=this.columnMap[this.currentHistoryId];E.currentHistory=true;this.sortCollection();multipanel._recalcFirstColumnHeight();return E},handleDeletedHistory:function b(D){if(D.get("deleted")){this.log("handleDeletedHistory",this.collection.includeDeleted,D);var C=this;column=C.columnMap[D.id];if(!column){return}if(column.model.id===this.currentHistoryId){}else{if(!C.collection.includeDeleted){C.removeColumn(column)}}}},sortCollection:function(C,D){C=C||this.order;var E=this.currentHistoryId;switch(C){case"name":this.collection.comparator=function(F){return[F.id!==E,F.get("name").toLowerCase()]};break;case"size":this.collection.comparator=function(F){return[F.id!==E,F.get("size")]};break;default:this.collection.comparator=function(F){return[F.id!==E,Date(F.get("update_time"))]}}this.collection.sort(D);return this.collection},setOrder:function(C){if(["update","name","size"].indexOf(C)===-1){C="update"}this.order=C;this.sortCollection();return this},create:function(C){return this.collection.create({current:true})},createColumns:function r(D){D=D||{};var C=this;this.columnMap={};C.collection.each(function(E,F){var G=C.createColumn(E,D);C.columnMap[E.id]=G})},createColumn:function t(E,C){C=_.extend({},C,{model:E});var D=new B(C);if(E.id===this.currentHistoryId){D.currentHistory=true}this.setUpColumnListeners(D);return D},sortedFilteredColumns:function(C){C=C||this.filters;if(!C||!C.length){return this.sortedColumns()}var D=this;return D.sortedColumns().filter(function(G,F){var E=G.currentHistory||_.every(C.map(function(H){return H.call(G)}));return E})},sortedColumns:function(){var D=this;var C=this.collection.map(function(F,E){return D.columnMap[F.id]});return C},addColumn:function o(E,C){C=C!==undefined?C:true;var D=this.createColumn(E);this.columnMap[E.id]=D;if(C){this.renderColumns()}return D},addAsCurrentColumn:function o(E){var D=this,C=this.addColumn(E,false);this.setCurrentHistory(E);C.once("rendered",function(){D.queueHdaFetch(C)});return C},removeColumn:function x(E,D){D=D!==undefined?D:true;this.log("removeColumn",E);if(!E){return}var F=this,C=this.options.columnWidth+this.options.columnGap;E.$el.fadeOut("fast",function(){if(D){$(this).remove();F.$(".middle").width(F.$(".middle").width()-C);F.checkColumnsInView();F._recalcFirstColumnHeight()}F.stopListening(E.panel);F.stopListening(E);delete F.columnMap[E.model.id];E.remove()})},setUpColumnListeners:function n(C){var D=this;D.listenTo(C,{"in-view":D.queueHdaFetch});D.listenTo(C.panel,{"view:draggable:dragstart":function(H,F,E,G){D._dropData=JSON.parse(H.dataTransfer.getData("text"));D.currentColumnDropTargetOn()},"view:draggable:dragend":function(H,F,E,G){D._dropData=null;D.currentColumnDropTargetOff()},"droptarget:drop":function(G,H,F){var I=D._dropData.filter(function(J){return(_.isObject(J)&&J.id&&J.model_class==="HistoryDatasetAssociation")});D._dropData=null;var E=new a.NamedAjaxQueue();I.forEach(function(J){E.add({name:"copy-"+J.id,fn:function(){return F.model.contents.copy(J.id)}})});E.start();E.done(function(J){F.model.fetch()})}})},columnMapLength:function(){return Object.keys(this.columnMap).length},render:function A(D){D=D!==undefined?D:this.fxSpeed;var C=this;C.log(C+".render");C.$el.html(C.template(C.options));C.renderColumns(D);C.setUpBehaviors();C.trigger("rendered",C);return C},template:function w(C){C=C||{};var D=[];if(this.options.headerHeight){D=D.concat(['<div class="loading-overlay flex-row"><div class="loading-overlay-message">loading...</div></div>','<div class="header flex-column-container">','<div class="header-control header-control-left flex-column">','<button class="done btn btn-default">',_l("Done"),"</button>",'<button class="include-deleted btn btn-default"></button>','<div class="order btn-group">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',_l("Order histories by")+'... <span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">','<li><a href="javascript:void(0);" class="order-update">',_l("Time of last update"),"</a></li>",'<li><a href="javascript:void(0);" class="order-name">',_l("Name"),"</a></li>",'<li><a href="javascript:void(0);" class="order-size">',_l("Size"),"</a></li>","</ul>","</div>",'<div id="search-histories" class="header-search"></div>',"</div>",'<div class="header-control header-control-center flex-column">','<div class="header-info">',"</div>","</div>",'<div class="header-control header-control-right flex-column">','<div id="search-datasets" class="header-search"></div>','<button id="toggle-deleted" class="btn btn-default">',_l("Include deleted datasets"),"</button>",'<button id="toggle-hidden" class="btn btn-default">',_l("Include hidden datasets"),"</button>","</div>","</div>"])}D=D.concat(['<div class="outer-middle flex-row flex-row-container">','<div class="middle flex-column-container flex-row"></div>',"</div>",'<div class="footer flex-column-container">',"</div>"]);return $(D.join(""))},renderColumns:function j(F){F=F!==undefined?F:this.fxSpeed;var E=this,C=E.sortedFilteredColumns();E.$(".middle").width(C.length*(this.options.columnWidth+this.options.columnGap)+this.options.columnGap+16);var D=E.$(".middle");D.empty();C.forEach(function(H,G){H.$el.appendTo(D);H.delegateEvents();E.renderColumn(H,F)});if(this.searchFor&&C.length<=1){}else{E.checkColumnsInView();this._recalcFirstColumnHeight()}return C},renderColumn:function(C,D){D=D!==undefined?D:this.fxSpeed;return C.render(D)},queueHdaFetch:function i(E){if(E.model.contents.length===0&&!E.model.get("empty")){var C={},D=_.values(E.panel.storage.get("expandedIds")).join();if(D){C.dataset_details=D}this.hdaQueue.add({name:E.model.id,fn:function(){var F=E.model.contents.fetch({data:C,silent:true});return F.done(function(G){E.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},queueHdaFetchDetails:function(C){if((C.model.contents.length===0&&!C.model.get("empty"))||(!C.model.contents.haveDetails())){this.hdaQueue.add({name:C.model.id,fn:function(){var D=C.model.contents.fetch({data:{details:"all"},silent:true});return D.done(function(E){C.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},renderInfo:function(C){this.$(".header .header-info").text(C)},events:{"click .done.btn":"close","click .create-new.btn":"create","click .order .order-update":function(C){this.setOrder("update")},"click .order .order-name":function(C){this.setOrder("name")},"click .order .order-size":function(C){this.setOrder("size")}},close:function(D){var C="/";if(Galaxy&&Galaxy.options&&Galaxy.options.root){C=Galaxy.options.root}else{if(galaxy_config&&galaxy_config.root){C=galaxy_config.root}}window.location=C},includeDeletedHistories:function(){window.location+=(/\?/.test(window.location.toString()))?("&"):("?")+"include_deleted_histories=True"},excludeDeletedHistories:function(){window.location=window.location.toString().replace(/[&\?]include_deleted_histories=True/g,"")},setUpBehaviors:function(){var D=this;D.$(".include-deleted").modeButton({initialMode:this.collection.includeDeleted?"exclude":"include",switchModesOnClick:false,modes:[{mode:"include",html:_l("Include deleted histories"),onclick:_.bind(D.includeDeletedHistories,D)},{mode:"exclude",html:_l("Exclude deleted histories"),onclick:_.bind(D.excludeDeletedHistories,D)}]});D.$("#search-histories").searchInput({name:"search-histories",placeholder:_l("search histories"),onsearch:function(E){D.searchFor=E;D.filters=[function(){return this.model.matchesAll(D.searchFor)}];D.renderColumns(0)},onclear:function(E){D.searchFor=null;D.filters=[];D.renderColumns(0)}});D.$("#search-datasets").searchInput({name:"search-datasets",placeholder:_l("search all datasets"),onfirstsearch:function(E){D.hdaQueue.clear();D.$("#search-datasets").searchInput("toggle-loading");D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E);D.queueHdaFetchDetails(F)});D.hdaQueue.progress(function(F){D.renderInfo([_l("searching"),(F.curr+1),_l("of"),F.total].join(" "))});D.hdaQueue.deferred.done(function(){D.renderInfo("");D.$("#search-datasets").searchInput("toggle-loading")})},onsearch:function(E){D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E)})},onclear:function(E){D.searchFor=null;D.sortedFilteredColumns().forEach(function(F){F.panel.clearSearch()})}});D.$("#toggle-deleted").modeButton({initialMode:"include",modes:[{mode:"exclude",html:_l("Exclude deleted datasets")},{mode:"include",html:_l("Include deleted datasets")}]}).click(function(){var E=$(this).modeButton("getMode").mode==="exclude";D.sortedFilteredColumns().forEach(function(G,F){_.delay(function(){G.panel.toggleShowDeleted(E,false)},F*200)})});D.$("#toggle-hidden").modeButton({initialMode:"include",modes:[{mode:"exclude",html:_l("Exclude hidden datasets")},{mode:"include",html:_l("Include hidden datasets")}]}).click(function(){var E=$(this).modeButton("getMode").mode==="exclude";D.sortedFilteredColumns().forEach(function(G,F){_.delay(function(){G.panel.toggleShowHidden(E,false)},F*200)})});$(window).resize(function(){D._recalcFirstColumnHeight()});var C=_.debounce(_.bind(this.checkColumnsInView,this),100);this.$(".middle").parent().scroll(C)},_recalcFirstColumnHeight:function(){var C=this.$(".history-column").first(),E=this.$(".middle").height(),D=C.find(".panel-controls").height();C.height(E).find(".inner").height(E-D)},_viewport:function(){var C=this.$(".middle").parent().offset().left;return{left:C,right:C+this.$(".middle").parent().width()}},columnsInView:function(){var C=this._viewport();return this.sortedFilteredColumns().filter(function(D){return D.currentHistory||D.inView(C.left,C.right)})},checkColumnsInView:function(){this.columnsInView().forEach(function(C){C.trigger("in-view",C)})},currentColumnDropTargetOn:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=function(D){};C.panel.dropTargetOn()},currentColumnDropTargetOff:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=l.HistoryPanelEdit.prototype.dataDrop;C.panel.dropTargetOff()},toString:function(){return"MultiPanelColumns("+(this.columns?this.columns.length:0)+")"}});return{MultiPanelColumns:m}});
\ No newline at end of file
+define(["mvc/history/history-model","mvc/history/history-panel-edit","mvc/base-mvc","utils/ajax-queue","ui/mode-button","ui/search-input"],function(d,l,z,a){function g(I,E){E=E||{};if(!(Galaxy&&Galaxy.modal)){return I.copy()}var F=I.get("name"),C="Copy of '"+F+"'";function D(K){if(!K){if(!Galaxy.modal.$("#invalid-title").size()){var J=$("<p/>").attr("id","invalid-title").css({color:"red","margin-top":"8px"}).addClass("bg-danger").text(_l("Please enter a valid history title"));Galaxy.modal.$(".modal-body").append(J)}return false}return K}function G(J){var K=$('<p><span class="fa fa-spinner fa-spin"></span> Copying history...</p>').css("margin-top","8px");Galaxy.modal.$(".modal-body").append(K);I.copy(true,J).fail(function(){alert(_l("History could not be copied. Please contact a Galaxy administrator"))}).always(function(){Galaxy.modal.hide()})}function H(){var J=Galaxy.modal.$("#copy-modal-title").val();if(!D(J)){return}G(J)}Galaxy.modal.show(_.extend({title:_l("Copying history")+' "'+F+'"',body:$(['<label for="copy-modal-title">',_l("Enter a title for the copied history"),":","</label><br />",'<input id="copy-modal-title" class="form-control" style="width: 100%" value="',C,'" />'].join("")),buttons:{Cancel:function(){Galaxy.modal.hide()},Copy:H}},E));$("#copy-modal-title").focus().select();$("#copy-modal-title").on("keydown",function(J){if(J.keyCode===13){H()}})}var B=Backbone.View.extend(z.LoggableMixin).extend({tagName:"div",className:"history-column flex-column flex-row-container",id:function q(){if(!this.model){return""}return"history-column-"+this.model.get("id")},initialize:function c(C){C=C||{};this.panel=C.panel||this.createPanel(C);this.setUpListeners()},createPanel:function u(D){D=_.extend({model:this.model,dragItems:true},D);var C=new l.HistoryPanelEdit(D);C._renderEmptyMessage=this.__patch_renderEmptyMessage;return C},__patch_renderEmptyMessage:function(E){var D=this,F=_.chain(this.model.get("state_ids")).values().flatten().value().length,C=D.$emptyMessage(E);if(!_.isEmpty(D.hdaViews)){C.hide()}else{if(F&&!this.model.contents.length){C.empty().append($('<span class="fa fa-spinner fa-spin"></span><i>loading datasets...</i>')).show()}else{if(D.searchFor){C.text(D.noneFoundMsg).show()}else{C.text(D.emptyMsg).show()}}}return C},setUpListeners:function f(){var C=this;this.once("rendered",function(){C.trigger("rendered:initial",C)});this.setUpPanelListeners()},setUpPanelListeners:function k(){var C=this;this.listenTo(this.panel,{rendered:function(){C.trigger("rendered",C)}},this)},inView:function(C,D){var F=this.$el.offset().left,E=F+this.$el.width();if(E<C){return false}if(F>D){return false}return true},$panel:function e(){return this.$(".history-panel")},render:function A(D){D=(D!==undefined)?(D):("fast");var C=this.model?this.model.toJSON():{};this.$el.html(this.template(C));this.renderPanel(D);this.setUpBehaviors();return this},setUpBehaviors:function v(){},template:function w(D){D=D||{};var C=['<div class="panel-controls clear flex-row">',this.controlsLeftTemplate(),'<div class="pull-right">','<button class="delete-history btn btn-default">',D.deleted?_l("Undelete"):_l("Delete"),"</button>",'<button class="copy-history btn btn-default">',_l("Copy"),"</button>","</div>","</div>",'<div class="inner flex-row flex-column-container">','<div id="history-',D.id,'" class="history-column history-panel flex-column"></div>',"</div>"].join("");return $(C)},controlsLeftTemplate:function(){return(this.currentHistory)?['<div class="pull-left">','<strong class="current-label">',_l("Current History"),"</strong>","</div>"].join(""):['<div class="pull-left">','<button class="switch-to btn btn-default">',_l("Switch to"),"</button>","</div>"].join("")},renderPanel:function h(C){C=(C!==undefined)?(C):("fast");this.panel.setElement(this.$panel()).render(C);return this},events:{"click .switch-to.btn":function(){this.model.setAsCurrent()},"click .delete-history.btn":function(){var C=this,D;if(this.model.get("deleted")){D=this.model.undelete()}else{D=this.model._delete()}D.fail(function(G,E,F){alert(_l("Could not delete the history")+":\n"+F)}).done(function(E){C.render()})},"click .copy-history.btn":"copy"},copy:function s(){g(this.model)},toString:function(){return"HistoryPanelColumn("+(this.panel?this.panel:"")+")"}});var m=Backbone.View.extend(z.LoggableMixin).extend({className:"multi-history-columns",initialize:function c(C){C=C||{};this.log(this+".init",C);if(!C.currentHistoryId){throw new Error(this+" requires a currentHistoryId in the options")}this.currentHistoryId=C.currentHistoryId;this.options={columnWidth:312,borderWidth:1,columnGap:8,headerHeight:29,footerHeight:0,controlsHeight:20};this.order=C.order||"update";this.hdaQueue=new a.NamedAjaxQueue([],false);this.collection=null;this.setCollection(C.histories||[]);this.columnMap={};this.createColumns(C.columnOptions);this.setUpListeners()},setUpListeners:function f(){},setCollection:function y(D){var C=this;C.stopListening(C.collection);C.collection=D;C.sortCollection(C.order,{silent:true});C.setUpCollectionListeners();C.trigger("new-collection",C);return C},setUpCollectionListeners:function(){var C=this,D=C.collection;C.listenTo(D,{add:C.addAsCurrentColumn,"set-as-current":C.setCurrentHistory,"change:deleted":C.handleDeletedHistory,sort:function(){C.renderColumns(0)}})},setCurrentHistory:function p(D){var C=this.columnMap[this.currentHistoryId];if(C){C.currentHistory=false;C.$el.height("")}this.currentHistoryId=D.id;var E=this.columnMap[this.currentHistoryId];E.currentHistory=true;this.sortCollection();multipanel._recalcFirstColumnHeight();return E},handleDeletedHistory:function b(D){if(D.get("deleted")){this.log("handleDeletedHistory",this.collection.includeDeleted,D);var C=this;column=C.columnMap[D.id];if(!column){return}if(column.model.id===this.currentHistoryId){}else{if(!C.collection.includeDeleted){C.removeColumn(column)}}}},sortCollection:function(C,D){C=C||this.order;var E=this.currentHistoryId;switch(C){case"name":this.collection.comparator=function(F){return[F.id!==E,F.get("name").toLowerCase()]};break;case"size":this.collection.comparator=function(F){return[F.id!==E,F.get("size")]};break;default:this.collection.comparator=function(F){return[F.id!==E,Date(F.get("update_time"))]}}this.collection.sort(D);return this.collection},setOrder:function(C){if(["update","name","size"].indexOf(C)===-1){C="update"}this.order=C;this.trigger("order:change",C,this);this.$(".current-order").text(C);this.sortCollection();return this},create:function(C){return this.collection.create({current:true})},createColumns:function r(D){D=D||{};var C=this;this.columnMap={};C.collection.each(function(E,F){var G=C.createColumn(E,D);C.columnMap[E.id]=G})},createColumn:function t(E,C){C=_.extend({},C,{model:E});var D=new B(C);if(E.id===this.currentHistoryId){D.currentHistory=true}this.setUpColumnListeners(D);return D},sortedFilteredColumns:function(C){C=C||this.filters;if(!C||!C.length){return this.sortedColumns()}var D=this;return D.sortedColumns().filter(function(G,F){var E=G.currentHistory||_.every(C.map(function(H){return H.call(G)}));return E})},sortedColumns:function(){var D=this;var C=this.collection.map(function(F,E){return D.columnMap[F.id]});return C},addColumn:function o(E,C){C=C!==undefined?C:true;var D=this.createColumn(E);this.columnMap[E.id]=D;if(C){this.renderColumns()}return D},addAsCurrentColumn:function o(E){var D=this,C=this.addColumn(E,false);this.setCurrentHistory(E);C.once("rendered",function(){D.queueHdaFetch(C)});return C},removeColumn:function x(E,D){D=D!==undefined?D:true;this.log("removeColumn",E);if(!E){return}var F=this,C=this.options.columnWidth+this.options.columnGap;E.$el.fadeOut("fast",function(){if(D){$(this).remove();F.$(".middle").width(F.$(".middle").width()-C);F.checkColumnsInView();F._recalcFirstColumnHeight()}F.stopListening(E.panel);F.stopListening(E);delete F.columnMap[E.model.id];E.remove()})},setUpColumnListeners:function n(C){var D=this;D.listenTo(C,{"in-view":D.queueHdaFetch});D.listenTo(C.panel,{"view:draggable:dragstart":function(H,F,E,G){D._dropData=JSON.parse(H.dataTransfer.getData("text"));D.currentColumnDropTargetOn()},"view:draggable:dragend":function(H,F,E,G){D._dropData=null;D.currentColumnDropTargetOff()},"droptarget:drop":function(G,H,F){var I=D._dropData.filter(function(J){return(_.isObject(J)&&J.id&&J.model_class==="HistoryDatasetAssociation")});D._dropData=null;var E=new a.NamedAjaxQueue();I.forEach(function(J){E.add({name:"copy-"+J.id,fn:function(){return F.model.contents.copy(J.id)}})});E.start();E.done(function(J){F.model.fetch()})}})},columnMapLength:function(){return Object.keys(this.columnMap).length},render:function A(D){D=D!==undefined?D:this.fxSpeed;var C=this;C.log(C+".render");C.$el.html(C.mainTemplate(C));C.renderColumns(D);C.setUpBehaviors();C.trigger("rendered",C);return C},renderColumns:function j(F){F=F!==undefined?F:this.fxSpeed;var E=this,C=E.sortedFilteredColumns();E.$(".middle").width(C.length*(this.options.columnWidth+this.options.columnGap)+this.options.columnGap+16);var D=E.$(".middle");D.empty();C.forEach(function(H,G){H.$el.appendTo(D);H.delegateEvents();E.renderColumn(H,F)});if(this.searchFor&&C.length<=1){}else{E.checkColumnsInView();this._recalcFirstColumnHeight()}return C},renderColumn:function(C,D){D=D!==undefined?D:this.fxSpeed;return C.render(D)},queueHdaFetch:function i(E){if(E.model.contents.length===0&&!E.model.get("empty")){var C={},D=_.values(E.panel.storage.get("expandedIds")).join();if(D){C.dataset_details=D}this.hdaQueue.add({name:E.model.id,fn:function(){var F=E.model.contents.fetch({data:C,silent:true});return F.done(function(G){E.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},queueHdaFetchDetails:function(C){if((C.model.contents.length===0&&!C.model.get("empty"))||(!C.model.contents.haveDetails())){this.hdaQueue.add({name:C.model.id,fn:function(){var D=C.model.contents.fetch({data:{details:"all"},silent:true});return D.done(function(E){C.panel.renderItems()})}});if(!this.hdaQueue.running){this.hdaQueue.start()}}},renderInfo:function(C){this.$(".header .header-info").text(C)},events:{"click .done.btn":"close","click .create-new.btn":"create","click #include-deleted":"_clickToggleDeletedHistories","click .order .order-update":function(C){this.setOrder("update")},"click .order .order-name":function(C){this.setOrder("name")},"click .order .order-size":function(C){this.setOrder("size")},"click #toggle-deleted":"_clickToggleDeletedDatasets","click #toggle-hidden":"_clickToggleHiddenDatasets"},close:function(D){var C="/";if(Galaxy&&Galaxy.options&&Galaxy.options.root){C=Galaxy.options.root}else{if(galaxy_config&&galaxy_config.root){C=galaxy_config.root}}window.location=C},_clickToggleDeletedHistories:function(C){return this.toggleDeletedHistories($(C.currentTarget).is(":checked"))},toggleDeletedHistories:function(C){if(C){window.location=Galaxy.options.root+"history/view_multiple?include_deleted_histories=True"}else{window.location=Galaxy.options.root+"history/view_multiple"}},_clickToggleDeletedDatasets:function(C){return this.toggleDeletedDatasets($(C.currentTarget).is(":checked"))},toggleDeletedDatasets:function(C){C=C!==undefined?C:false;var D=this;D.sortedFilteredColumns().forEach(function(F,E){_.delay(function(){F.panel.toggleShowDeleted(C,false)},E*200)})},_clickToggleHiddenDatasets:function(C){return this.toggleHiddenDatasets($(C.currentTarget).is(":checked"))},toggleHiddenDatasets:function(C){C=C!==undefined?C:false;var D=this;D.sortedFilteredColumns().forEach(function(F,E){_.delay(function(){F.panel.toggleShowHidden(C,false)},E*200)})},setUpBehaviors:function(){var D=this;D._moreOptionsPopover();D.$("#search-histories").searchInput({name:"search-histories",placeholder:_l("search histories"),onsearch:function(E){D.searchFor=E;D.filters=[function(){return this.model.matchesAll(D.searchFor)}];D.renderColumns(0)},onclear:function(E){D.searchFor=null;D.filters=[];D.renderColumns(0)}});D.$("#search-datasets").searchInput({name:"search-datasets",placeholder:_l("search all datasets"),onfirstsearch:function(E){D.hdaQueue.clear();D.$("#search-datasets").searchInput("toggle-loading");D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E);D.queueHdaFetchDetails(F)});D.hdaQueue.progress(function(F){D.renderInfo([_l("searching"),(F.curr+1),_l("of"),F.total].join(" "))});D.hdaQueue.deferred.done(function(){D.renderInfo("");D.$("#search-datasets").searchInput("toggle-loading")})},onsearch:function(E){D.searchFor=E;D.sortedFilteredColumns().forEach(function(F){F.panel.searchItems(E)})},onclear:function(E){D.searchFor=null;D.sortedFilteredColumns().forEach(function(F){F.panel.clearSearch()})}});$(window).resize(function(){D._recalcFirstColumnHeight()});var C=_.debounce(_.bind(this.checkColumnsInView,this),100);this.$(".middle").parent().scroll(C)},_moreOptionsPopover:function(){return this.$(".open-more-options.btn").popover({container:".header",placement:"bottom",html:true,content:$(this.optionsPopoverTemplate(this))})},_recalcFirstColumnHeight:function(){var C=this.$(".history-column").first(),E=this.$(".middle").height(),D=C.find(".panel-controls").height();C.height(E).find(".inner").height(E-D)},_viewport:function(){var C=this.$(".middle").parent().offset().left;return{left:C,right:C+this.$(".middle").parent().width()}},columnsInView:function(){var C=this._viewport();return this.sortedFilteredColumns().filter(function(D){return D.currentHistory||D.inView(C.left,C.right)})},checkColumnsInView:function(){this.columnsInView().forEach(function(C){C.trigger("in-view",C)})},currentColumnDropTargetOn:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=function(D){};C.panel.dropTargetOn()},currentColumnDropTargetOff:function(){var C=this.columnMap[this.currentHistoryId];if(!C){return}C.panel.dataDropped=l.HistoryPanelEdit.prototype.dataDrop;C.panel.dropTargetOff()},toString:function(){return"MultiPanelColumns("+(this.columns?this.columns.length:0)+")"},mainTemplate:_.template(['<div class="header flex-column-container">','<div class="control-column control-column-left flex-column">','<button class="create-new btn btn-default">',_l("Create new"),"</button> ",'<div id="search-histories" class="search-control"></div>','<div id="search-datasets" class="search-control"></div>','<button class="open-more-options btn btn-default">','<span class="fa fa-ellipsis-h" title="More options"></span>',"</button>","</div>",'<div class="control-column control-column-center flex-column">','<div class="header-info">',"</div>","</div>",'<div class="control-column control-column-right flex-column">','<button class="done btn btn-default">',_l("Done"),"</button>","</div>","</div>",'<div class="outer-middle flex-row flex-row-container">','<div class="middle flex-column-container flex-row"></div>',"</div>",'<div class="footer flex-column-container">',"</div>"].join(""),{variable:"view"}),optionsPopoverTemplate:_.template(['<div class="more-options">','<div class="checkbox"><label><input id="include-deleted" type="checkbox"','<%= view.collection.includeDeleted? " checked" : "" %>>',_l("Include deleted histories"),"</label></div>",'<div class="order btn-group">','<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">',_l("Order histories by")+" ",'<span class="current-order"><%= view.order %></span> ','<span class="caret"></span>',"</button>",'<ul class="dropdown-menu" role="menu">','<li><a href="javascript:void(0);" class="order-update">',_l("Time of last update"),"</a></li>",'<li><a href="javascript:void(0);" class="order-name">',_l("Name"),"</a></li>",'<li><a href="javascript:void(0);" class="order-size">',_l("Size"),"</a></li>","</ul>","</div>",'<div class="checkbox"><label><input id="toggle-deleted" type="checkbox">',_l("Include deleted datasets"),"</label></div>",'<div class="checkbox"><label><input id="toggle-hidden" type="checkbox">',_l("Include hidden datasets"),"</label></div>","</div>"].join(""),{variable:"view"}),});return{MultiPanelColumns:m}});
\ No newline at end of file
diff -r 5b2f1eab281920eca6c9d1b84e6cebf02866ea09 -r a99aafec2a89d95795cf1296ddf43c9fd6a38c8e templates/webapps/galaxy/history/view_multiple.mako
--- a/templates/webapps/galaxy/history/view_multiple.mako
+++ b/templates/webapps/galaxy/history/view_multiple.mako
@@ -75,29 +75,36 @@
.flex-column {
}
+ /* ---------------------- header & footer */
.header, .footer {
width: 100%;
}
+ /* ---------------------- header */
.header {
background-color: lightgrey;
min-height: ${header_height}px;
max-height: ${header_height}px;
}
- .header-control {
+ .control-column {
margin-top: 4px;
}
- .header-control-right,
- .header-control-left {
+
+ .control-column-right,
+ .control-column-left {
margin-right: 8px;
margin-left: 8px;
+ /*background-color: green;*/
}
- .header-control-left > * {
+ .control-column-left > * {
margin: 0px 4px 4px 0px;
}
+ .more-options input[type=checkbox] {
+ margin-top: 3px;
+ }
- .header-control-center {
+ .control-column-center {
text-align: center;
max-height: 22px;
-webkit-flex: 0 1 auto;
@@ -117,26 +124,35 @@
}
- .header-control-right {
+ .control-column-right {
text-align: right;
}
- .header-control-right > * {
+ .control-column-right > * {
margin: 0px 0px 4px 4px;
}
- .header-search {
+ .search-control {
display: inline-block;
+ width: 40%;
}
- .header-search .search-clear,
- .header-search .search-loading {
+ .search-control .search-clear,
+ .search-control .search-loading {
margin-top: -22px;
}
+ .footer input.search-query,
.header input.search-query {
font-size: 90%;
height: 21px;
- padding: 2px;
+ line-height: normal;
+ padding: 2px 2px 1px 2px;
}
+ .open-more-options {
+ padding: 0 4px 0 4px;
+ font-size: 150%;
+ }
+
+ /* ---------------------- middle */
.outer-middle {
overflow: auto;
}
@@ -169,13 +185,18 @@
align-self: auto;
}
.header .btn,
+ .footer .btn,
.panel-controls .btn {
- height: ${controls_height}px;
- line-height: ${controls_height - 2}px;
+ height: 20px;
+ /*line-height: ${controls_height - 2}px;*/
+ line-height: normal;
font-size: 90%;
padding-top: 0px;
padding-bottom: 0px;
}
+ .header .btn {
+ height: 21px;
+ }
.panel-controls .pull-left .btn {
margin-right: 4px;
}
@@ -183,13 +204,14 @@
margin-left: 4px;
}
+ /* ---------------------- footer */
.footer {
min-height: ${footer_height}px;
max-height: ${footer_height}px;
- background-color: grey;
+ background-color: lightgrey;
}
- /* ---- columns */
+ /* ---------------------- columns */
.history-panel {
width: 100%;
margin-top: 4px;
@@ -230,6 +252,12 @@
vertical-align: middle;
}
+ .current-label {
+ display: inline-block;
+ color: grey;
+ padding-left: 2px;
+ margin-top: 2px;
+ }
</style></%def>
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_2015.01.13 for changeset 577b270034b4
by commits-noreply@bitbucket.org 12 Feb '15
by commits-noreply@bitbucket.org 12 Feb '15
12 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f1c89c016624/
Changeset: f1c89c016624
Branch: stable
User: natefoo
Date: 2015-02-12 14:00:26+00:00
Summary: Update tag latest_2015.01.13 for changeset 577b270034b4
Affected #: 1 file
diff -r 577b270034b48d90e58ffbea296e700d229545c9 -r f1c89c016624edd48edf604b14745d2a85b8402a .hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -22,4 +22,4 @@
2092948937ac30ef82f71463a235c66d34987088 release_2014.10.06
782fa60fc65488aea0c618d723e9a63d42caf865 latest_2014.10.06
2e8dd2949dd3eee0f56f9a3a5ebf1b2baca24aee release_2015.01.13
-644deef1a5789b788552a6db7f3d6fe07d81c79d latest_2015.01.13
+577b270034b48d90e58ffbea296e700d229545c9 latest_2015.01.13
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/1a4a65522d02/
Changeset: 1a4a65522d02
User: dannon
Date: 2015-02-12 12:57:51+00:00
Summary: Fix at least one error with zipfile downloads and file permissions not being set correctly.
Affected #: 1 file
diff -r 10a1ea8d9e153bd1abe30de07a64d3d043601889 -r 1a4a65522d02834212a3e05487ae1e97071bb6be lib/galaxy/eggs/__init__.py
--- a/lib/galaxy/eggs/__init__.py
+++ b/lib/galaxy/eggs/__init__.py
@@ -463,7 +463,7 @@
try:
for info in z.infolist():
name = info.filename
- perm = (info.external_attr >> 16L) & 0777
+ mode = (info.external_attr >> 16L) & 0777
# don't extract absolute paths or ones with .. in them
if name.startswith('/') or '..' in name:
continue
https://bitbucket.org/galaxy/galaxy-central/commits/5b2f1eab2819/
Changeset: 5b2f1eab2819
User: dannon
Date: 2015-02-12 13:28:37+00:00
Summary: Fix path manipulation during fetch_eggs. This getting an external version of pkg_resources (and not ours in lib/) is what is causing the weird egg fetching errors. Newer versions of pkg_resources create a mangled distribution string for some eggs with nonstandard version identifiers.
Affected #: 1 file
diff -r 1a4a65522d02834212a3e05487ae1e97071bb6be -r 5b2f1eab281920eca6c9d1b84e6cebf02866ea09 scripts/fetch_eggs.py
--- a/scripts/fetch_eggs.py
+++ b/scripts/fetch_eggs.py
@@ -32,7 +32,7 @@
root.addHandler( logging.StreamHandler( sys.stdout ) )
lib = os.path.abspath( os.path.join( os.path.dirname( __file__ ), "..", "lib" ) )
-sys.path.append( lib )
+sys.path.insert(1, lib)
from galaxy.eggs import Crate, EggNotFetchable
import pkg_resources
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: pep8 in eggs module while trying to fix eggnotfetchable bugs
by commits-noreply@bitbucket.org 12 Feb '15
by commits-noreply@bitbucket.org 12 Feb '15
12 Feb '15
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/10a1ea8d9e15/
Changeset: 10a1ea8d9e15
User: dannon
Date: 2015-02-12 12:55:52+00:00
Summary: pep8 in eggs module while trying to fix eggnotfetchable bugs
Affected #: 1 file
diff -r f2267bbdd40a22d21c0ee5763e68ae3f04c6e702 -r 10a1ea8d9e153bd1abe30de07a64d3d043601889 lib/galaxy/eggs/__init__.py
--- a/lib/galaxy/eggs/__init__.py
+++ b/lib/galaxy/eggs/__init__.py
@@ -2,37 +2,51 @@
Manage Galaxy eggs
"""
-import os, sys, shutil, glob, urllib, urllib2, ConfigParser, HTMLParser, zipimport, zipfile
+import ConfigParser
+import glob
+import HTMLParser
+import os
+import pkg_resources
+import shutil
+import sys
+import urllib
+import urllib2
+import zipfile
+import zipimport
import logging
log = logging.getLogger( __name__ )
log.addHandler( logging.NullHandler() )
-import pkg_resources
galaxy_dir = os.path.abspath( os.path.join( os.path.dirname( __file__ ), '..', '..', '..' ) )
eggs_dir = os.environ.get( 'GALAXY_EGGS_PATH', os.path.join( galaxy_dir, 'eggs' ) )
py = 'py%s' % sys.version[:3]
+
class EggNotFetchable( Exception ):
def __init__( self, eggs ):
if type( eggs ) in ( list, tuple ):
self.eggs = eggs
else:
self.eggs = [ eggs ]
+
def __str__( self ):
return ' '.join( self.eggs )
+
# need the options to remain case sensitive
class CaseSensitiveConfigParser( ConfigParser.SafeConfigParser ):
def optionxform( self, optionstr ):
return optionstr
+
# so we can actually detect failures
class URLRetriever( urllib.FancyURLopener ):
def http_error_default( *args ):
urllib.URLopener.http_error_default( *args )
+
class Egg( object ):
"""
Contains information about locating and downloading eggs.
@@ -49,11 +63,13 @@
self.removed_location = None
if self.name is not None and self.version is not None:
self.set_distribution()
+
def set_dir( self ):
global eggs_dir
self.dir = eggs_dir
if not os.path.exists( self.dir ):
os.makedirs( self.dir )
+
def set_distribution( self ):
"""
Stores a pkg_resources Distribution object for reference later
@@ -62,7 +78,8 @@
self.set_dir()
tag = self.tag or ''
self.distribution = pkg_resources.Distribution.from_filename(
- os.path.join( self.dir, '-'.join( ( self.name, self.version + tag, self.platform ) ) + '.egg' ) )
+ os.path.join( self.dir, '-'.join( ( self.name, self.version + tag, self.platform ) ) + '.egg' ) )
+
@property
def path( self ):
"""
@@ -71,6 +88,7 @@
if env[self.distribution.project_name]:
return env[self.distribution.project_name][0].location
return None
+
def fetch( self, requirement ):
"""
fetch() serves as the install method to pkg_resources.working_set.resolve()
@@ -86,9 +104,11 @@
def __init__( self ):
HTMLParser.HTMLParser.__init__( self )
self.links = []
+
def handle_starttag( self, tag, attrs ):
if tag == 'a' and 'href' in dict( attrs ):
self.links.append( dict( attrs )['href'] )
+
parser = LinkParser()
try:
parser.feed( urllib2.urlopen( self.url + '/' ).read() )
@@ -106,6 +126,7 @@
pkg_resources.compatible_platforms( tmp_dist.platform, pkg_resources.get_platform() ):
return file
return None
+
def _fetch():
if self.url is None:
return False
@@ -148,14 +169,16 @@
sys.path.remove( self.removed_location )
if rval is not None:
global env
- env = get_env() # reset the global Environment object now that we've obtained a new egg
+ env = get_env() # reset the global Environment object now that we've obtained a new egg
return rval
+
def unpack_if_needed( self ):
meta = pkg_resources.EggMetadata( zipimport.zipimporter( self.distribution.location ) )
if meta.has_metadata( 'not-zip-safe' ):
unpack_zipfile( self.distribution.location, self.distribution.location + "-tmp" )
os.remove( self.distribution.location )
os.rename( self.distribution.location + "-tmp", self.distribution.location )
+
def remove_doppelgangers( self ):
doppelgangers = glob.glob( os.path.join( self.dir, "%s-*-%s.egg" % ( self.name, self.platform ) ) )
if self.distribution.location in doppelgangers:
@@ -163,6 +186,7 @@
for doppelganger in doppelgangers:
remove_file_or_path( doppelganger )
log.debug( "Removed conflicting egg: %s" % doppelganger )
+
def resolve( self ):
try:
rval = []
@@ -195,6 +219,7 @@
raise
# there's a conflicting egg on the path, remove it
return self.version_conflict( e.args[0], e.args[1] )
+
def version_conflict( self, conflict_dist, conflict_req ):
# since this conflict may be for a dependent egg, find the correct egg from the crate
if conflict_dist.project_name == self.distribution.project_name:
@@ -234,6 +259,7 @@
pkg_resources.working_set.entries.append( location )
sys.path.append( location )
return r
+
def require( self ):
try:
dists = self.resolve()
@@ -244,11 +270,13 @@
except:
raise
+
class Crate( object ):
"""
Reads the eggs.ini file for use with checking and fetching.
"""
config_file = os.path.join( galaxy_dir, 'eggs.ini' )
+
def __init__( self, galaxy_config_file, platform=None ):
self.eggs = {}
self.config = CaseSensitiveConfigParser()
@@ -260,12 +288,14 @@
self.py_platform = platform.split( '-' )[0]
self.galaxy_config = GalaxyConfig( galaxy_config_file )
self.parse()
+
def parse( self ):
self.config.read( Crate.config_file )
self.repo = self.config.get( 'general', 'repository' )
self.no_auto = self.config.get( 'general', 'no_auto' ).split()
self.parse_egg_section( self.config.items( 'eggs:platform' ), self.config.items( 'tags' ), True )
self.parse_egg_section( self.config.items( 'eggs:noplatform' ), self.config.items( 'tags' ) )
+
def parse_egg_section( self, eggs, tags, full_platform=False, egg_class=Egg ):
for name, version in eggs:
tag = dict( tags ).get( name, '' )
@@ -276,6 +306,7 @@
platform = self.py_platform or py
egg = egg_class( name=name, version=version, tag=tag, url=url, platform=platform, crate=self )
self.eggs[name] = egg
+
@property
def config_missing( self ):
"""
@@ -286,6 +317,7 @@
if not egg.path:
return True
return False
+
@property
def all_missing( self ):
"""
@@ -295,6 +327,7 @@
if not os.path.exists( egg.distribution.location ):
return True
return False
+
@property
def config_names( self ):
"""
@@ -302,12 +335,14 @@
on the options set in the Galaxy config file.
"""
return [ egg.name for egg in self.config_eggs ]
+
@property
def all_names( self ):
"""
Return a list of names of all eggs in the crate.
"""
return [ egg.name for egg in self.all_eggs ]
+
@property
def config_eggs( self ):
"""
@@ -315,6 +350,7 @@
options set in the Galaxy config file.
"""
return [ egg for egg in self.eggs.values() if self.galaxy_config.check_conditional( egg.name ) ]
+
@property
def all_eggs( self ):
"""
@@ -326,12 +362,14 @@
continue
rval.append( egg )
return rval
+
def __getitem__( self, name ):
"""
Return a specific egg.
"""
name = name.replace( '-', '_' )
return self.eggs[name]
+
def resolve( self, all=False ):
"""
Try to resolve (e.g. fetch) all eggs in the crate.
@@ -350,8 +388,10 @@
if missing:
raise EggNotFetchable( missing )
+
class GalaxyConfig( object ):
always_conditional = ( 'pysam', 'ctypes', 'python_daemon' )
+
def __init__( self, config_file ):
if config_file is None:
self.config = None
@@ -359,6 +399,7 @@
self.config = ConfigParser.ConfigParser()
if self.config.read( config_file ) == []:
raise Exception( "error: unable to read Galaxy config from %s" % config_file )
+
def check_conditional( self, egg_name ):
def check_pysam():
# can't build pysam on solaris < 10
@@ -389,10 +430,11 @@
"python_daemon": lambda: sys.version_info[:2] >= ( 2, 5 ),
"pysam": lambda: check_pysam(),
"PyRods": lambda: self.config.get( "app:main", "object_store" ) == "irods"
- }.get( egg_name, lambda: True )()
+ }.get( egg_name, lambda: True )()
except:
return False
+
def get_env():
env = pkg_resources.Environment( search_path='', platform=pkg_resources.get_platform() )
for dist in pkg_resources.find_distributions( eggs_dir, False ):
@@ -400,6 +442,7 @@
return env
env = get_env()
+
def require( req_str ):
c = Crate( None )
req = pkg_resources.Requirement.parse( req_str )
@@ -414,6 +457,7 @@
raise EggNotFetchable( str( [ egg.name for egg in e.eggs ] ) )
pkg_resources.require = require
+
def unpack_zipfile( filename, extract_dir, ignores=[] ):
z = zipfile.ZipFile(filename)
try:
@@ -436,7 +480,7 @@
# file
pkg_resources.ensure_directory(target)
data = z.read(info.filename)
- f = open(target,'wb')
+ f = open(target, 'wb')
try:
f.write(data)
finally:
@@ -450,6 +494,7 @@
finally:
z.close()
+
def remove_file_or_path( f ):
if os.path.isdir( f ):
shutil.rmtree( f )
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