1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/89a685c87b0e/
Changeset: 89a685c87b0e
User: greg
Date: 2014-01-26 18:16:33
Summary: Fixes for the tool shed's install and test framework.
Affected #: 3 files
diff -r 196401191eb2556d92063fa5784eb57cd03aa5b1 -r 89a685c87b0ee5a04b36bb2e48c5b0fe00dd1e74 lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
@@ -228,6 +228,11 @@
package_version,
dependent_install_dir,
tool_dependency_type='package' )
+ if not can_install_tool_dependency:
+ log.debug( "Tool dependency %s version %s cannot be installed (it was probably previously installed), " % \
+ ( str( tool_dependency.name, str( tool_dependency.version ) ) ) )
+ log.debug( "so appending it to the list of handled tool dependencies." )
+ handled_tool_dependencies.append( tool_dependency )
else:
can_install_tool_dependency = True
if can_install_tool_dependency:
@@ -271,8 +276,6 @@
package_version=package_version,
tool_dependencies_config=config_to_use )
suc.remove_file( tmp_filename )
- else:
- handled_tool_dependencies.append( tool_dependency )
else:
message = "Unable to locate required tool shed repository named %s owned by %s with revision %s." % \
( str( required_repository_name ), str( required_repository_owner ), str( default_required_repository_changeset_revision ) )
@@ -345,6 +348,10 @@
package_version,
install_dir,
tool_dependency_type='package' )
+ if not can_install_tool_dependency:
+ log.debug( "Tool dependency %s version %s cannot be installed (it was probably previously installed), so returning it." % \
+ ( str( tool_dependency.name, str( tool_dependency.version ) ) ) )
+ return tool_dependency
else:
can_install_tool_dependency = True
if can_install_tool_dependency:
diff -r 196401191eb2556d92063fa5784eb57cd03aa5b1 -r 89a685c87b0ee5a04b36bb2e48c5b0fe00dd1e74 lib/tool_shed/util/repository_dependency_util.py
--- a/lib/tool_shed/util/repository_dependency_util.py
+++ b/lib/tool_shed/util/repository_dependency_util.py
@@ -26,6 +26,7 @@
relationships are defined in the repository_dependencies entry for each dictionary in the received list of repo_info_dicts. Each of
these dictionaries is associated with a repository in the received tool_shed_repositories list.
"""
+ log.debug( "Building repository dependency relationships..." )
for repo_info_dict in repo_info_dicts:
for name, repo_info_tuple in repo_info_dict.items():
description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, repository_dependencies, tool_dependencies = \
@@ -103,6 +104,7 @@
If the user elected to install repository dependencies, all items in the all_repo_info_dicts list will be processed. However, if repository
dependencies are not to be installed, only those items contained in the received repo_info_dicts list will be processed.
"""
+ log.debug( "Creating repository dependency objects..." )
# The following list will be maintained within this method to contain all created or updated tool shed repositories, including repository
# dependencies that may not be installed.
all_created_or_updated_tool_shed_repositories = []
@@ -140,8 +142,12 @@
trans.install_model.ToolShedRepository.installation_status.INSTALLING_REPOSITORY_DEPENDENCIES,
trans.install_model.ToolShedRepository.installation_status.INSTALLING_TOOL_DEPENDENCIES,
trans.install_model.ToolShedRepository.installation_status.LOADING_PROPRIETARY_DATATYPES ]:
- log.debug( "Skipping installation of tool_shed_repository '%s' because it's installation status is '%s'." % \
- ( str( repository_db_record.name ), str( repository_db_record.status ) ) )
+ debug_msg = "Skipping installation of revision %s of repository '%s' because it was installed " % \
+ ( str( changeset_revision ), str( repository_db_record.name ) )
+ debug_msg += "with the (possibly updated) revision %s and it's current installation status is '%s'." % \
+ ( str( installed_changeset_revision ), str( repository_db_record.status ) )
+ log.debug( debug_msg )
+ can_update_db_record = False
else:
if repository_db_record.status in [ trans.install_model.ToolShedRepository.installation_status.ERROR,
trans.install_model.ToolShedRepository.installation_status.NEW,
diff -r 196401191eb2556d92063fa5784eb57cd03aa5b1 -r 89a685c87b0ee5a04b36bb2e48c5b0fe00dd1e74 lib/tool_shed/util/tool_dependency_util.py
--- a/lib/tool_shed/util/tool_dependency_util.py
+++ b/lib/tool_shed/util/tool_dependency_util.py
@@ -43,7 +43,9 @@
return tool_dependencies
def create_or_update_tool_dependency( app, tool_shed_repository, name, version, type, status, set_status=True ):
- # Called from Galaxy (never the tool shed) when a new repository is being installed or when an uninstalled repository is being reinstalled.
+ """Create or update a tool_dependency record in the Galaxy database."""
+ # Called from Galaxy (never the tool shed) when a new repository is being installed or when an uninstalled
+ # repository is being reinstalled.
context = app.install_model.context
# First see if an appropriate tool_dependency record exists for the received tool_shed_repository.
if version:
@@ -51,7 +53,8 @@
else:
tool_dependency = get_tool_dependency_by_name_type_repository( app, tool_shed_repository, name, type )
if tool_dependency:
- # In some cases we should not override the current status of an existing tool_dependency, so do so only if set_status is True.
+ # In some cases we should not override the current status of an existing tool_dependency, so do so only
+ # if set_status is True.
if set_status:
if str( tool_dependency.status ) != str( status ):
debug_msg = 'Updating an existing record for version %s of tool dependency %s for revision %s of repository %s ' % \
@@ -584,7 +587,12 @@
# Shed's install and test framework is running. The Tool Shed's install and test framework which installs repositories
# in 2 stages, those of type tool_dependency_definition followed by those containing valid tools and tool functional
# test components.
- sa_session = app.install_model.context.current
+ log.debug( "Synchronizing the database with the file system..." )
+ try:
+ log.debug( "The value of app.config.running_functional_tests is: %s" % str( app.config.running_functional_tests ) )
+ except:
+ pass
+ sa_session = app.install_model.context
can_install_tool_dependency = False
tool_dependency = get_tool_dependency_by_name_version_type_repository( app,
tool_shed_repository,
@@ -618,9 +626,9 @@
# tool dependencies are not deleted by default, from the "install and test" framework..
tool_dependency.status = app.install_model.ToolDependency.installation_status.INSTALLED
else:
- error_message = 'The installation directory for this tool dependency had contents, but the database had no record. '
+ error_message = 'The installation directory for this tool dependency had contents but the database had no record. '
error_message += 'The installation log may show this tool dependency to be correctly installed, but due to the '
- error_message += 'missing database record, it is automatically set to Error.'
+ error_message += 'missing database record it is now being set to Error.'
tool_dependency.status = app.install_model.ToolDependency.installation_status.ERROR
tool_dependency.error_message = error_message
else:
@@ -637,6 +645,11 @@
can_install_tool_dependency = True
sa_session.add( tool_dependency )
sa_session.flush()
+ try:
+ log.debug( "Returning from sync_database_with_file_system with tool_dependency %s, can_install_tool_dependency %s." % \
+ ( str( tool_dependency.name ), str( can_install_tool_dependency ) ) )
+ except Exception, e:
+ log.debug( str( e ) )
return tool_dependency, can_install_tool_dependency
def tool_dependency_is_orphan( type, name, version, tools ):
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 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/196401191eb2/
Changeset: 196401191eb2
User: greg
Date: 2014-01-26 16:15:33
Summary: Fixes for 12257:9b337a87d6ec.
Affected #: 3 files
diff -r 51798d8a3c92a2290537f6dcfb8f93e6f1371509 -r 196401191eb2556d92063fa5784eb57cd03aa5b1 lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
@@ -171,7 +171,7 @@
return text
-def handle_complex_repository_dependency_for_package( app, elem, package_name, package_version, tool_shed_repository ):
+def handle_complex_repository_dependency_for_package( app, elem, package_name, package_version, tool_shed_repository, from_install_manager=False ):
"""
Inspect the repository defined by a complex repository dependency definition and take certain steps to enable installation
of the received package name and version to proceed. The received elem is the <repository> tag set which defines the complex
@@ -202,21 +202,32 @@
tool_dependency_version=package_version )
# Define this dependent repository's tool dependency installation directory that will contain the env.sh file with a path to the
# required repository's installed tool dependency package.
- dependent_install_dir = tool_dependency_util.get_tool_dependency_install_dir( app=app,
- repository_name=tool_shed_repository.name,
- repository_owner=tool_shed_repository.owner,
- repository_changeset_revision=tool_shed_repository.installed_changeset_revision,
- tool_dependency_type='package',
- tool_dependency_name=package_name,
- tool_dependency_version=package_version )
+ dependent_install_dir = \
+ tool_dependency_util.get_tool_dependency_install_dir( app=app,
+ repository_name=tool_shed_repository.name,
+ repository_owner=tool_shed_repository.owner,
+ repository_changeset_revision=tool_shed_repository.installed_changeset_revision,
+ tool_dependency_type='package',
+ tool_dependency_name=package_name,
+ tool_dependency_version=package_version )
if os.path.exists( dependent_install_dir ):
- # Notice that we'll throw away the following tool_dependency if it can be installed.
- tool_dependency, can_install_tool_dependency = tool_dependency_util.sync_database_with_file_system( app,
- tool_shed_repository,
- package_name,
- package_version,
- dependent_install_dir,
- tool_dependency_type='package' )
+ # The install manager handles tool migration stages and the sync_database_with_file_system() method handles two
+ # scenarios: (1) where a Galaxy file system environment related to installed tool shed repositories and tool dependencies
+ # has somehow (over time )gotten out of sync with the Galaxy database tables associated with these installed items, and
+ # (2) the Tool Shed's install and test framework which installs repositories in 2 stages, those of type
+ # tool_dependency_definition followed by those containing valid tools and tool functional test components. Neither of
+ # these scenarios apply when the install manager is running.
+ if from_install_manager:
+ can_install_tool_dependency = True
+ else:
+ # Notice that we'll throw away the following tool_dependency if it can be installed.
+ tool_dependency, can_install_tool_dependency = \
+ tool_dependency_util.sync_database_with_file_system( app,
+ tool_shed_repository,
+ package_name,
+ package_version,
+ dependent_install_dir,
+ tool_dependency_type='package' )
else:
can_install_tool_dependency = True
if can_install_tool_dependency:
@@ -300,7 +311,8 @@
package_elem,
package_name,
package_version,
- tool_shed_repository )
+ tool_shed_repository,
+ from_install_manager=from_install_manager )
for rd_tool_dependency in rd_tool_dependencies:
if rd_tool_dependency.status == app.install_model.ToolDependency.installation_status.ERROR:
# We'll log the error here, but continue installing packages since some may not require this dependency.
@@ -315,11 +327,17 @@
tool_dependency_type='package',
tool_dependency_name=package_name,
tool_dependency_version=package_version )
- can_install_tool_dependency = True
if os.path.exists( install_dir ):
- if not from_install_manager:
+ # The install manager handles tool migration stages and the sync_database_with_file_system() method handles two
+ # scenarios: (1) where a Galaxy file system environment related to installed tool shed repositories and tool dependencies
+ # has somehow (over time )gotten out of sync with the Galaxy database tables associated with these installed items, and
+ # (2) the Tool Shed's install and test framework which installs repositories in 2 stages, those of type
+ # tool_dependency_definition followed by those containing valid tools and tool functional test components. Neither of
+ # these scenarios apply when the install manager is running.
+ if from_install_manager:
+ can_install_tool_dependency = True
+ else:
# Notice that we'll throw away the following tool_dependency if it can be installed.
- print 'Calling sync_database_with_file_system 2'
tool_dependency, can_install_tool_dependency = \
tool_dependency_util.sync_database_with_file_system( app,
tool_shed_repository,
diff -r 51798d8a3c92a2290537f6dcfb8f93e6f1371509 -r 196401191eb2556d92063fa5784eb57cd03aa5b1 lib/tool_shed/util/common_install_util.py
--- a/lib/tool_shed/util/common_install_util.py
+++ b/lib/tool_shed/util/common_install_util.py
@@ -471,10 +471,12 @@
tool_dependency = tool_dependencies[ index ]
if tool_dependency.can_install:
# The database record is currently in a state that allows us to install the package on the file system.
+ log.debug( 'Attempting to install tool dependency package %s version %s.' % ( str( package_name ), str( package_version ) ) )
try:
dependencies_ignored = not app.toolbox.dependency_manager.uses_tool_shed_dependencies()
if dependencies_ignored:
- log.debug( "Skipping package %s because tool shed dependency resolver not enabled." % str( package_name ) )
+ log.debug( "Skipping installation of tool dependency package %s because tool shed dependency resolver not enabled." % \
+ str( package_name ) )
# Tool dependency resolves have been configured and they do not include the tool shed. Do not install package.
if app.toolbox.dependency_manager.find_dep( package_name, package_version, type='package') != INDETERMINATE_DEPENDENCY:
## TODO: Do something here such as marking it installed or
@@ -493,7 +495,7 @@
tool_dependencies=tool_dependencies,
from_install_manager=from_install_manager )
except Exception, e:
- error_message = "Error installing tool dependency %s version %s: %s" % ( str( package_name ), str( package_version ), str( e ) )
+ error_message = "Error installing tool dependency package %s version %s: %s" % ( str( package_name ), str( package_version ), str( e ) )
log.exception( error_message )
if tool_dependency:
# Since there was an installation error, update the tool dependency status to Error. The remove_installation_path option must
diff -r 51798d8a3c92a2290537f6dcfb8f93e6f1371509 -r 196401191eb2556d92063fa5784eb57cd03aa5b1 lib/tool_shed/util/tool_dependency_util.py
--- a/lib/tool_shed/util/tool_dependency_util.py
+++ b/lib/tool_shed/util/tool_dependency_util.py
@@ -581,7 +581,9 @@
"""
# This method should be reached very rarely. It implies that either the Galaxy environment became corrupted (i.e.,
# the database records for installed tool dependencies is not synchronized with tool dependencies on disk) or the Tool
- # Shed's install and test framework is running.
+ # Shed's install and test framework is running. The Tool Shed's install and test framework which installs repositories
+ # in 2 stages, those of type tool_dependency_definition followed by those containing valid tools and tool functional
+ # test components.
sa_session = app.install_model.context.current
can_install_tool_dependency = False
tool_dependency = get_tool_dependency_by_name_version_type_repository( app,
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 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/122fe556dc38/
Changeset: 122fe556dc38
User: guerler
Date: 2014-01-25 06:23:19
Summary: Upload: Allow backend to set file names
Affected #: 2 files
diff -r c5caf4ce55aa0102b85032805ddd50445cb03002 -r 122fe556dc384291119115d096210e4298e43f93 static/scripts/mvc/upload/upload-view.js
--- a/static/scripts/mvc/upload/upload-view.js
+++ b/static/scripts/mvc/upload/upload-view.js
@@ -372,7 +372,6 @@
tool_input = {};
tool_input['dbkey'] = genome;
tool_input['file_type'] = file_type;
- tool_input['files_0|NAME'] = file_name;
tool_input['files_0|type'] = 'upload_dataset';
tool_input['files_0|url_paste'] = url_paste;
tool_input['space_to_tabs'] = space_to_tabs;
diff -r c5caf4ce55aa0102b85032805ddd50445cb03002 -r 122fe556dc384291119115d096210e4298e43f93 static/scripts/packed/mvc/upload/upload-view.js
--- a/static/scripts/packed/mvc/upload/upload-view.js
+++ b/static/scripts/packed/mvc/upload/upload-view.js
@@ -1,1 +1,1 @@
-define(["galaxy.modal","utils/utils","mvc/upload/upload-model","mvc/upload/upload-row","mvc/ui","utils/uploadbox"],function(c,f,e,d){var b=Backbone.Model.extend({defaults:{percentage:0,icon:"fa-circle",label:"",status:""}});var a=Backbone.View.extend({model:null,initialize:function(h){var g=this;this.model=h;this.options=this.model.attributes;this.setElement(this._template(this.options));$(this.el).on("click",this.options.onclick);if(this.options.tooltip){$(this.el).tooltip({title:this.options.tooltip,placement:"bottom"})}this.model.on("change:percentage",function(){g._percentage(g.model.get("percentage"))});this.model.on("change:status",function(){g._status(g.model.get("status"))});var g=this;$(window).on("beforeunload",function(){var i="";if(g.options.onunload){i=g.options.onunload()}if(i!=""){return i}})},_status:function(h){var g=this.$el.find(".progress-bar");g.removeClass();g.addClass("progress-bar");g.addClass("progress-bar-notransition");if(h!=""){g.addClass("progress-bar-"+h)}},_percentage:function(h){var g=this.$el.find(".progress-bar");g.css({width:h+"%"})},_template:function(g){return'<div class="progress-button"><div class="progress"><div class="progress-bar"></div></div><div id="label" class="label"><div class="fa '+g.icon+'"></div> '+g.label+"</div></div>"}});return Backbone.View.extend({modal:null,button_show:null,uploadbox:null,current_history:null,upload_size:0,select_extension:[["Auto-detect","auto"]],select_genome:[["Unspecified (?)","?"]],collection:new e.Collection(),counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},options:{nginx_upload_path:""},initialize:function(h){var g=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){g.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}this.button_show=new b({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(i){if(i){g._eventShow(i)}},onunload:function(){if(g.counter.running>0){return"Several uploads are still processing."}}});$("#left .unified-panel-header-inner").append((new a(this.button_show)).$el);var g=this;f.jsonFromUrl(galaxy_config.root+"api/datatypes",function(i){for(key in i){g.select_extension.push([i[key],i[key]])}});f.jsonFromUrl(galaxy_config.root+"api/genomes",function(i){var j=g.select_genome[0];g.select_genome=[];for(key in i){if(i[key].length>1){if(i[key][1]!==j[1]){g.select_genome.push(i[key])}}}g.select_genome.sort(function(l,k){return l[0]>k[0]?1:l[0]<k[0]?-1:0});g.select_genome.unshift(j)});if(h){this.options=_.defaults(h,this.options)}this.collection.on("remove",function(i){g._eventRemove(i)});this.collection.on("change:genome",function(j){var i=j.get("genome");g.collection.each(function(k){if(k.get("status")=="init"&&k.get("genome")=="?"){k.set("genome",i)}})})},_eventShow:function(h){h.preventDefault();h.stopPropagation();if(!this.modal){var g=this;this.modal=new c.GalaxyModal({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose files":function(){g.uploadbox.select()},"Create file":function(){g._eventCreate()},Start:function(){g._eventStart()},Pause:function(){g._eventStop()},Reset:function(){g._eventReset()},Close:function(){g.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var g=this;this.uploadbox=this.$el.uploadbox({announce:function(i,j,k){g._eventAnnounce(i,j,k)},initialize:function(i,j,k){return g._eventInitialize(i,j,k)},progress:function(i,j,k){g._eventProgress(i,j,k)},success:function(i,j,k){g._eventSuccess(i,j,k)},error:function(i,j,k){g._eventError(i,j,k)},complete:function(){g._eventComplete()}});this._updateScreen()}this.modal.show()},_eventRemove:function(h){var g=h.get("status");if(g=="success"){this.counter.success--}else{if(g=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(h.id)},_eventAnnounce:function(g,h,j){this.counter.announce++;this._updateScreen();var i=new d(this,{id:g,file_name:h.name,file_size:h.size});this.collection.add(i.model);$(this.el).find("tbody:last").append(i.$el);i.render()},_eventInitialize:function(k,g,o){var i=this.collection.get(k);i.set("status","running");var h=i.get("extension");var l=i.get("file_name");var n=i.get("genome");var m=i.get("url_paste");var j=i.get("space_to_tabs");if(!m&&!(g.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path,paramname:"files_0|file_data"});tool_input={};tool_input.dbkey=n;tool_input.file_type=h;tool_input["files_0|NAME"]=l;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|url_paste"]=m;tool_input.space_to_tabs=j;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(h,i,g){var j=this.collection.get(h);j.set("percentage",g);this.button_show.set("percentage",this._upload_percentage(g,i.size))},_eventSuccess:function(h,i,k){var j=this.collection.get(h);j.set("status","success");var g=j.get("file_size");this.button_show.set("percentage",this._upload_percentage(100,g));this.upload_completed+=g*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshHdas()},_eventError:function(g,h,j){var i=this.collection.get(g);i.set("status","error");i.set("info",j);this.button_show.set("percentage",this._upload_percentage(100,h.size));this.button_show.set("status","danger");this.upload_completed+=h.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(g){if(g.get("status")=="queued"){g.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:-1}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var g=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(h){if(h.get("status")=="init"){h.set("status","queued");g.upload_size+=h.get("file_size")}});this.button_show.set("percentage",0);this.button_show.set("status","success");this.current_history=Galaxy.currHistoryPanel.model.get("id");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.button_show.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.button_show.set("percentage",0)}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose files");this.modal.enableButton("Create file")}else{this.modal.disableButton("Choose files");this.modal.disableButton("Create file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},_upload_percentage:function(g,h){return(this.upload_completed+(g*h))/this.upload_size},_template:function(h,g){return'<div id="'+h+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+g+'" class="upload-info"></h6>'}})});
\ No newline at end of file
+define(["galaxy.modal","utils/utils","mvc/upload/upload-model","mvc/upload/upload-row","mvc/ui","utils/uploadbox"],function(c,f,e,d){var b=Backbone.Model.extend({defaults:{percentage:0,icon:"fa-circle",label:"",status:""}});var a=Backbone.View.extend({model:null,initialize:function(h){var g=this;this.model=h;this.options=this.model.attributes;this.setElement(this._template(this.options));$(this.el).on("click",this.options.onclick);if(this.options.tooltip){$(this.el).tooltip({title:this.options.tooltip,placement:"bottom"})}this.model.on("change:percentage",function(){g._percentage(g.model.get("percentage"))});this.model.on("change:status",function(){g._status(g.model.get("status"))});var g=this;$(window).on("beforeunload",function(){var i="";if(g.options.onunload){i=g.options.onunload()}if(i!=""){return i}})},_status:function(h){var g=this.$el.find(".progress-bar");g.removeClass();g.addClass("progress-bar");g.addClass("progress-bar-notransition");if(h!=""){g.addClass("progress-bar-"+h)}},_percentage:function(h){var g=this.$el.find(".progress-bar");g.css({width:h+"%"})},_template:function(g){return'<div class="progress-button"><div class="progress"><div class="progress-bar"></div></div><div id="label" class="label"><div class="fa '+g.icon+'"></div> '+g.label+"</div></div>"}});return Backbone.View.extend({modal:null,button_show:null,uploadbox:null,current_history:null,upload_size:0,select_extension:[["Auto-detect","auto"]],select_genome:[["Unspecified (?)","?"]],collection:new e.Collection(),counter:{announce:0,success:0,error:0,running:0,reset:function(){this.announce=this.success=this.error=this.running=0}},options:{nginx_upload_path:""},initialize:function(h){var g=this;if(!Galaxy.currHistoryPanel||!Galaxy.currHistoryPanel.model){window.setTimeout(function(){g.initialize()},500);return}if(!Galaxy.currUser.get("id")){return}this.button_show=new b({icon:"fa-upload",tooltip:"Download from URL or upload files from disk",label:"Load Data",onclick:function(i){if(i){g._eventShow(i)}},onunload:function(){if(g.counter.running>0){return"Several uploads are still processing."}}});$("#left .unified-panel-header-inner").append((new a(this.button_show)).$el);var g=this;f.jsonFromUrl(galaxy_config.root+"api/datatypes",function(i){for(key in i){g.select_extension.push([i[key],i[key]])}});f.jsonFromUrl(galaxy_config.root+"api/genomes",function(i){var j=g.select_genome[0];g.select_genome=[];for(key in i){if(i[key].length>1){if(i[key][1]!==j[1]){g.select_genome.push(i[key])}}}g.select_genome.sort(function(l,k){return l[0]>k[0]?1:l[0]<k[0]?-1:0});g.select_genome.unshift(j)});if(h){this.options=_.defaults(h,this.options)}this.collection.on("remove",function(i){g._eventRemove(i)});this.collection.on("change:genome",function(j){var i=j.get("genome");g.collection.each(function(k){if(k.get("status")=="init"&&k.get("genome")=="?"){k.set("genome",i)}})})},_eventShow:function(h){h.preventDefault();h.stopPropagation();if(!this.modal){var g=this;this.modal=new c.GalaxyModal({title:"Download data directly from web or upload files from your disk",body:this._template("upload-box","upload-info"),buttons:{"Choose files":function(){g.uploadbox.select()},"Create file":function(){g._eventCreate()},Start:function(){g._eventStart()},Pause:function(){g._eventStop()},Reset:function(){g._eventReset()},Close:function(){g.modal.hide()},},height:"400",width:"900",closing_events:true});this.setElement("#upload-box");var g=this;this.uploadbox=this.$el.uploadbox({announce:function(i,j,k){g._eventAnnounce(i,j,k)},initialize:function(i,j,k){return g._eventInitialize(i,j,k)},progress:function(i,j,k){g._eventProgress(i,j,k)},success:function(i,j,k){g._eventSuccess(i,j,k)},error:function(i,j,k){g._eventError(i,j,k)},complete:function(){g._eventComplete()}});this._updateScreen()}this.modal.show()},_eventRemove:function(h){var g=h.get("status");if(g=="success"){this.counter.success--}else{if(g=="error"){this.counter.error--}else{this.counter.announce--}}this._updateScreen();this.uploadbox.remove(h.id)},_eventAnnounce:function(g,h,j){this.counter.announce++;this._updateScreen();var i=new d(this,{id:g,file_name:h.name,file_size:h.size});this.collection.add(i.model);$(this.el).find("tbody:last").append(i.$el);i.render()},_eventInitialize:function(k,g,o){var i=this.collection.get(k);i.set("status","running");var h=i.get("extension");var l=i.get("file_name");var n=i.get("genome");var m=i.get("url_paste");var j=i.get("space_to_tabs");if(!m&&!(g.size>0)){return null}this.uploadbox.configure({url:this.options.nginx_upload_path,paramname:"files_0|file_data"});tool_input={};tool_input.dbkey=n;tool_input.file_type=h;tool_input["files_0|type"]="upload_dataset";tool_input["files_0|url_paste"]=m;tool_input.space_to_tabs=j;data={};data.history_id=this.current_history;data.tool_id="upload1";data.inputs=JSON.stringify(tool_input);return data},_eventProgress:function(h,i,g){var j=this.collection.get(h);j.set("percentage",g);this.button_show.set("percentage",this._upload_percentage(g,i.size))},_eventSuccess:function(h,i,k){var j=this.collection.get(h);j.set("status","success");var g=j.get("file_size");this.button_show.set("percentage",this._upload_percentage(100,g));this.upload_completed+=g*100;this.counter.announce--;this.counter.success++;this._updateScreen();Galaxy.currHistoryPanel.refreshHdas()},_eventError:function(g,h,j){var i=this.collection.get(g);i.set("status","error");i.set("info",j);this.button_show.set("percentage",this._upload_percentage(100,h.size));this.button_show.set("status","danger");this.upload_completed+=h.size*100;this.counter.announce--;this.counter.error++;this._updateScreen()},_eventComplete:function(){this.collection.each(function(g){if(g.get("status")=="queued"){g.set("status","init")}});this.counter.running=0;this._updateScreen()},_eventCreate:function(){this.uploadbox.add([{name:"New File",size:-1}])},_eventStart:function(){if(this.counter.announce==0||this.counter.running>0){return}var g=this;this.upload_size=0;this.upload_completed=0;this.collection.each(function(h){if(h.get("status")=="init"){h.set("status","queued");g.upload_size+=h.get("file_size")}});this.button_show.set("percentage",0);this.button_show.set("status","success");this.current_history=Galaxy.currHistoryPanel.model.get("id");this.counter.running=this.counter.announce;this._updateScreen();this.uploadbox.start()},_eventStop:function(){if(this.counter.running==0){return}this.button_show.set("status","info");this.uploadbox.stop();$("#upload-info").html("Queue will pause after completing the current file...")},_eventReset:function(){if(this.counter.running==0){this.collection.reset();this.counter.reset();this._updateScreen();this.uploadbox.reset();this.button_show.set("percentage",0)}},_updateScreen:function(){if(this.counter.announce==0){if(this.uploadbox.compatible()){message="You can Drag & Drop files into this box."}else{message="Unfortunately, your browser does not support multiple file uploads or drag&drop.<br>Some supported browsers are: Firefox 4+, Chrome 7+, IE 10+, Opera 12+ or Safari 6+."}}else{if(this.counter.running==0){message="You added "+this.counter.announce+" file(s) to the queue. Add more files or click 'Start' to proceed."}else{message="Please wait..."+this.counter.announce+" out of "+this.counter.running+" remaining."}}$("#upload-info").html(message);if(this.counter.running==0&&this.counter.announce+this.counter.success+this.counter.error>0){this.modal.enableButton("Reset")}else{this.modal.disableButton("Reset")}if(this.counter.running==0&&this.counter.announce>0){this.modal.enableButton("Start")}else{this.modal.disableButton("Start")}if(this.counter.running>0){this.modal.enableButton("Pause")}else{this.modal.disableButton("Pause")}if(this.counter.running==0){this.modal.enableButton("Choose files");this.modal.enableButton("Create file")}else{this.modal.disableButton("Choose files");this.modal.disableButton("Create file")}if(this.counter.announce+this.counter.success+this.counter.error>0){$(this.el).find("table").show()}else{$(this.el).find("table").hide()}},_upload_percentage:function(g,h){return(this.upload_completed+(g*h))/this.upload_size},_template:function(h,g){return'<div id="'+h+'" class="upload-box"><table class="table table-striped" style="display: none;"><thead><tr><th>Name</th><th>Size</th><th>Type</th><th>Genome</th><th>Space→Tab</th><th>Status</th><th></th></tr></thead><tbody></tbody></table></div><h6 id="'+g+'" class="upload-info"></h6>'}})});
\ 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 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/c5caf4ce55aa/
Changeset: c5caf4ce55aa
User: guerler
Date: 2014-01-25 06:07:12
Summary: Webhelpers: Shorten time ago string
Affected #: 1 file
diff -r 4362d887f48fe1891f46fc1ee435045b79c3779a -r c5caf4ce55aa0102b85032805ddd50445cb03002 lib/galaxy/web/framework/helpers/__init__.py
--- a/lib/galaxy/web/framework/helpers/__init__.py
+++ b/lib/galaxy/web/framework/helpers/__init__.py
@@ -28,7 +28,8 @@
if (datetime.utcnow() - x) > delta: # Greater than a week difference
return x.strftime("%b %d, %Y")
else:
- return date.distance_of_time_in_words( x, datetime.utcnow() ).replace("about", "~") + " ago"
+ date_array = date.distance_of_time_in_words( x, datetime.utcnow() ).replace(",", "").split(" ")
+ return "~%s %s ago" % (date_array[0], date_array[1])
def iff( a, b, c ):
"""
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.