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
December 2013
- 1 participants
- 207 discussions
commit/galaxy-central: dan: Fix for using GALAXY_TEST_DB_TEMPLATE with htTp not specified in all lower case.
by commits-noreply@bitbucket.org 10 Dec '13
by commits-noreply@bitbucket.org 10 Dec '13
10 Dec '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/738839e77188/
Changeset: 738839e77188
User: dan
Date: 2013-12-10 16:54:51
Summary: Fix for using GALAXY_TEST_DB_TEMPLATE with htTp not specified in all lower case.
Affected #: 1 file
diff -r 340344bf17e72072f268d21f420585e76af3ce70 -r 738839e77188c2f42d956998f38daea619f3c35e scripts/functional_tests.py
--- a/scripts/functional_tests.py
+++ b/scripts/functional_tests.py
@@ -182,7 +182,7 @@
if os.path.exists( source ):
shutil.copy( source, db_path )
assert os.path.exists( db_path )
- elif source.startswith("http"):
+ elif source.lower().startswith( "http" ):
urllib.urlretrieve( source, db_path )
else:
raise Exception( "Failed to copy database template from source %s" % source )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: History panel: pass link target to create_scatterplot_action_fn
by commits-noreply@bitbucket.org 10 Dec '13
by commits-noreply@bitbucket.org 10 Dec '13
10 Dec '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/340344bf17e7/
Changeset: 340344bf17e7
User: carlfeberhard
Date: 2013-12-10 16:46:20
Summary: History panel: pass link target to create_scatterplot_action_fn
Affected #: 2 files
diff -r 3bf805dfa14eb150e90c1aab565eb22b8ab3d9b8 -r 340344bf17e72072f268d21f420585e76af3ce70 static/scripts/mvc/dataset/hda-edit.js
--- a/static/scripts/mvc/dataset/hda-edit.js
+++ b/static/scripts/mvc/dataset/hda-edit.js
@@ -190,13 +190,14 @@
// map a function to each visualization in the icon's attributes
// create a popupmenu from that map
+ var hdaView = this;
/** @inner */
function create_viz_action( visualization ) {
switch( visualization ){
case 'trackster':
return create_trackster_action_fn( visualization_url, params, dbkey );
case 'scatterplot':
- return create_scatterplot_action_fn( visualization_url, params );
+ return create_scatterplot_action_fn( visualization_url, params, hdaView.linkTarget );
default:
return function(){// add widget
Galaxy.frame.add(
@@ -368,15 +369,13 @@
* @returns function that loads the scatterplot
*/
//TODO: should be imported from scatterplot.js OR abstracted to 'load this in the galaxy_main frame'
-function create_scatterplot_action_fn( url, params ){
+function create_scatterplot_action_fn( url, params, target ){
action = function() {
- // add widget
- Galaxy.frame.add(
- {
+ Galaxy.frame.add({
title : "Scatterplot",
type : "url",
content : url + '/scatterplot?' + $.param(params),
- target : this.linkTarget,
+ target : target,
scratchbook : true
});
diff -r 3bf805dfa14eb150e90c1aab565eb22b8ab3d9b8 -r 340344bf17e72072f268d21f420585e76af3ce70 static/scripts/packed/mvc/dataset/hda-edit.js
--- a/static/scripts/packed/mvc/dataset/hda-edit.js
+++ b/static/scripts/packed/mvc/dataset/hda-edit.js
@@ -1,1 +1,1 @@
-define(["mvc/dataset/hda-model","mvc/dataset/hda-base"],function(d,a){var f=a.HDABaseView.extend(LoggableMixin).extend({initialize:function(g){a.HDABaseView.prototype.initialize.call(this,g);this.hasUser=g.hasUser;this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton,this._render_rerunButton]},_render_titleButtons:function(){return a.HDABaseView.prototype._render_titleButtons.call(this).concat([this._render_editButton(),this._render_deleteButton()])},_render_editButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.DISCARDED)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var i=this.model.get("purged"),g=this.model.get("deleted"),h={title:_l("Edit Attributes"),href:this.urls.edit,target:this.linkTarget,classes:"dataset-edit"};if(g||i){h.disabled=true;if(i){h.title=_l("Cannot edit attributes of datasets removed from disk")}else{if(g){h.title=_l("Undelete dataset to edit attributes")}}}else{if(this.model.get("state")===d.HistoryDatasetAssociation.STATES.UPLOAD){h.disabled=true;h.title=_l("This dataset must finish uploading before it can be edited")}}h.faIcon="fa-pencil";return faIconButton(h)},_render_deleteButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var g=this,h={title:_l("Delete"),classes:"dataset-delete",onclick:function(){g.$el.find(".icon-btn.dataset-delete").trigger("mouseout");g.model["delete"]()}};if(this.model.get("deleted")||this.model.get("purged")){h={title:_l("Dataset is already deleted"),disabled:true}}h.faIcon="fa-times";return faIconButton(h)},_render_errButton:function(){if(this.model.get("state")!==d.HistoryDatasetAssociation.STATES.ERROR){return null}return faIconButton({title:_l("View or report this error"),href:this.urls.report_error,target:this.linkTarget,faIcon:"fa-bug"})},_render_rerunButton:function(){return faIconButton({title:_l("Run this job again"),href:this.urls.rerun,target:this.linkTarget,faIcon:"fa-refresh"})},_render_visualizationsButton:function(){var g=this.model.get("visualizations");if((!this.hasUser)||(!this.model.hasData())||(_.isEmpty(g))){return null}if(_.isObject(g[0])){return this._render_visualizationsFrameworkButton(g)}if(!this.urls.visualization){return null}var i=this.model.get("dbkey"),l=this.urls.visualization,j={},m={dataset_id:this.model.get("id"),hda_ldda:"hda"};if(i){m.dbkey=i}var h=faIconButton({title:_l("Visualize"),href:this.urls.visualization,faIcon:"fa-bar-chart-o"});function k(n){switch(n){case"trackster":return b(l,m,i);case"scatterplot":return e(l,m);default:return function(){Galaxy.frame.add({title:"Visualization",type:"url",content:l+"/"+n+"?"+$.param(m)})}}}if(g.length===1){h.attr("data-original-title",g[0]);h.click(k(g[0]))}else{_.each(g,function(o){var n=o.charAt(0).toUpperCase()+o.slice(1);j[_l(n)]=k(o)});make_popupmenu(h,j)}return h},_render_visualizationsFrameworkButton:function(g){if(!(this.model.hasData())||!(g&&!_.isEmpty(g))){return null}var i=faIconButton({title:_l("Visualize"),faIcon:"fa-bar-chart-o"});i.addClass("visualize-icon");if(_.keys(g).length===1){i.attr("title",_.keys(g)[0]);i.attr("href",_.values(g)[0])}else{var j=[];_.each(g,function(k){j.push(k)});var h=new PopupMenu(i,j)}return i},_render_body_failed_metadata:function(){var h=$("<a/>").attr({href:this.urls.edit,target:this.linkTarget}).text(_l("set it manually or retry auto-detection")),g=$("<span/>").text(". "+_l("You may be able to")+" ").append(h),i=a.HDABaseView.prototype._render_body_failed_metadata.call(this);i.find(".warningmessagesmall strong").append(g);return i},_render_body_error:function(){var g=a.HDABaseView.prototype._render_body_error.call(this);g.find(".dataset-actions .left").prepend(this._render_errButton());return g},_render_body_ok:function(){var g=a.HDABaseView.prototype._render_body_ok.call(this);if(this.model.isDeletedOrPurged()){return g}this.makeDbkeyEditLink(g);if(this.hasUser){g.find(".dataset-actions .left").append(this._render_visualizationsButton());this._renderTags(g);this._renderAnnotation(g)}return g},_renderTags:function(g){this.tagsEditor=new TagsEditor({model:this.model,el:g.find(".tags-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit dataset tags"),classes:"dataset-tag-btn",faIcon:"fa-tags"}).appendTo(g.find(".dataset-actions .right"))})},_renderAnnotation:function(g){this.annotationEditor=new AnnotationEditor({model:this.model,el:g.find(".annotation-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit dataset annotation"),classes:"dataset-annotate-btn",faIcon:"fa-comment"}).appendTo(g.find(".dataset-actions .right"))})},makeDbkeyEditLink:function(g){if(this.model.get("metadata_dbkey")==="?"&&!this.model.isDeletedOrPurged()){g.find(".dataset-dbkey .value").replaceWith($('<a target="'+this.linkTarget+'">?</a>').attr("href",this.urls.edit))}},events:_.extend(_.clone(a.HDABaseView.prototype.events),{"click .dataset-undelete":function(g){this.model.undelete();return false},"click .dataset-unhide":function(g){this.model.unhide();return false},"click .dataset-purge":"confirmPurge"}),confirmPurge:function c(g){this.model.purge();return false},toString:function(){var g=(this.model)?(this.model+""):("(no model)");return"HDAView("+g+")"}});function e(g,h){action=function(){Galaxy.frame.add({title:"Scatterplot",type:"url",content:g+"/scatterplot?"+$.param(h),target:this.linkTarget,scratchbook:true});$("div.popmenu-wrapper").remove();return false};return action}function b(g,i,h){return function(){var j={};if(h){j["f-dbkey"]=h}$.ajax({url:g+"/list_tracks?"+$.param(j),dataType:"html",error:function(){alert(("Could not add this dataset to browser")+".")},success:function(k){var l=window.parent;l.Galaxy.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){l.Galaxy.modal.hide()},"View in saved visualization":function(){l.Galaxy.modal.show({title:"Add Data to Saved Visualization",body:k,buttons:{Cancel:function(){l.Galaxy.modal.hide()},"Add to visualization":function(){$(l.document).find("input[name=id]:checked").each(function(){l.Galaxy.modal.hide();var m=$(this).val();i.id=m;l.Galaxy.frame.add({title:"Trackster",type:"url",content:g+"/trackster?"+$.param(i),scratchbook:true})})}}})},"View in new visualization":function(){l.Galaxy.modal.hide();var m=g+"/trackster?"+$.param(i);l.Galaxy.frame.add({title:"Trackster",type:"url",content:m,scratchbook:true})}}})}});return false}}return{HDAEditView:f}});
\ No newline at end of file
+define(["mvc/dataset/hda-model","mvc/dataset/hda-base"],function(d,a){var f=a.HDABaseView.extend(LoggableMixin).extend({initialize:function(g){a.HDABaseView.prototype.initialize.call(this,g);this.hasUser=g.hasUser;this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton,this._render_rerunButton]},_render_titleButtons:function(){return a.HDABaseView.prototype._render_titleButtons.call(this).concat([this._render_editButton(),this._render_deleteButton()])},_render_editButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.DISCARDED)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var i=this.model.get("purged"),g=this.model.get("deleted"),h={title:_l("Edit Attributes"),href:this.urls.edit,target:this.linkTarget,classes:"dataset-edit"};if(g||i){h.disabled=true;if(i){h.title=_l("Cannot edit attributes of datasets removed from disk")}else{if(g){h.title=_l("Undelete dataset to edit attributes")}}}else{if(this.model.get("state")===d.HistoryDatasetAssociation.STATES.UPLOAD){h.disabled=true;h.title=_l("This dataset must finish uploading before it can be edited")}}h.faIcon="fa-pencil";return faIconButton(h)},_render_deleteButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var g=this,h={title:_l("Delete"),classes:"dataset-delete",onclick:function(){g.$el.find(".icon-btn.dataset-delete").trigger("mouseout");g.model["delete"]()}};if(this.model.get("deleted")||this.model.get("purged")){h={title:_l("Dataset is already deleted"),disabled:true}}h.faIcon="fa-times";return faIconButton(h)},_render_errButton:function(){if(this.model.get("state")!==d.HistoryDatasetAssociation.STATES.ERROR){return null}return faIconButton({title:_l("View or report this error"),href:this.urls.report_error,target:this.linkTarget,faIcon:"fa-bug"})},_render_rerunButton:function(){return faIconButton({title:_l("Run this job again"),href:this.urls.rerun,target:this.linkTarget,faIcon:"fa-refresh"})},_render_visualizationsButton:function(){var g=this.model.get("visualizations");if((!this.hasUser)||(!this.model.hasData())||(_.isEmpty(g))){return null}if(_.isObject(g[0])){return this._render_visualizationsFrameworkButton(g)}if(!this.urls.visualization){return null}var i=this.model.get("dbkey"),m=this.urls.visualization,j={},n={dataset_id:this.model.get("id"),hda_ldda:"hda"};if(i){n.dbkey=i}var h=faIconButton({title:_l("Visualize"),href:this.urls.visualization,faIcon:"fa-bar-chart-o"});var l=this;function k(o){switch(o){case"trackster":return b(m,n,i);case"scatterplot":return e(m,n,l.linkTarget);default:return function(){Galaxy.frame.add({title:"Visualization",type:"url",content:m+"/"+o+"?"+$.param(n)})}}}if(g.length===1){h.attr("data-original-title",g[0]);h.click(k(g[0]))}else{_.each(g,function(p){var o=p.charAt(0).toUpperCase()+p.slice(1);j[_l(o)]=k(p)});make_popupmenu(h,j)}return h},_render_visualizationsFrameworkButton:function(g){if(!(this.model.hasData())||!(g&&!_.isEmpty(g))){return null}var i=faIconButton({title:_l("Visualize"),faIcon:"fa-bar-chart-o"});i.addClass("visualize-icon");if(_.keys(g).length===1){i.attr("title",_.keys(g)[0]);i.attr("href",_.values(g)[0])}else{var j=[];_.each(g,function(k){j.push(k)});var h=new PopupMenu(i,j)}return i},_render_body_failed_metadata:function(){var h=$("<a/>").attr({href:this.urls.edit,target:this.linkTarget}).text(_l("set it manually or retry auto-detection")),g=$("<span/>").text(". "+_l("You may be able to")+" ").append(h),i=a.HDABaseView.prototype._render_body_failed_metadata.call(this);i.find(".warningmessagesmall strong").append(g);return i},_render_body_error:function(){var g=a.HDABaseView.prototype._render_body_error.call(this);g.find(".dataset-actions .left").prepend(this._render_errButton());return g},_render_body_ok:function(){var g=a.HDABaseView.prototype._render_body_ok.call(this);if(this.model.isDeletedOrPurged()){return g}this.makeDbkeyEditLink(g);if(this.hasUser){g.find(".dataset-actions .left").append(this._render_visualizationsButton());this._renderTags(g);this._renderAnnotation(g)}return g},_renderTags:function(g){this.tagsEditor=new TagsEditor({model:this.model,el:g.find(".tags-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit dataset tags"),classes:"dataset-tag-btn",faIcon:"fa-tags"}).appendTo(g.find(".dataset-actions .right"))})},_renderAnnotation:function(g){this.annotationEditor=new AnnotationEditor({model:this.model,el:g.find(".annotation-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit dataset annotation"),classes:"dataset-annotate-btn",faIcon:"fa-comment"}).appendTo(g.find(".dataset-actions .right"))})},makeDbkeyEditLink:function(g){if(this.model.get("metadata_dbkey")==="?"&&!this.model.isDeletedOrPurged()){g.find(".dataset-dbkey .value").replaceWith($('<a target="'+this.linkTarget+'">?</a>').attr("href",this.urls.edit))}},events:_.extend(_.clone(a.HDABaseView.prototype.events),{"click .dataset-undelete":function(g){this.model.undelete();return false},"click .dataset-unhide":function(g){this.model.unhide();return false},"click .dataset-purge":"confirmPurge"}),confirmPurge:function c(g){this.model.purge();return false},toString:function(){var g=(this.model)?(this.model+""):("(no model)");return"HDAView("+g+")"}});function e(g,i,h){action=function(){Galaxy.frame.add({title:"Scatterplot",type:"url",content:g+"/scatterplot?"+$.param(i),target:h,scratchbook:true});$("div.popmenu-wrapper").remove();return false};return action}function b(g,i,h){return function(){var j={};if(h){j["f-dbkey"]=h}$.ajax({url:g+"/list_tracks?"+$.param(j),dataType:"html",error:function(){alert(("Could not add this dataset to browser")+".")},success:function(k){var l=window.parent;l.Galaxy.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){l.Galaxy.modal.hide()},"View in saved visualization":function(){l.Galaxy.modal.show({title:"Add Data to Saved Visualization",body:k,buttons:{Cancel:function(){l.Galaxy.modal.hide()},"Add to visualization":function(){$(l.document).find("input[name=id]:checked").each(function(){l.Galaxy.modal.hide();var m=$(this).val();i.id=m;l.Galaxy.frame.add({title:"Trackster",type:"url",content:g+"/trackster?"+$.param(i),scratchbook:true})})}}})},"View in new visualization":function(){l.Galaxy.modal.hide();var m=g+"/trackster?"+$.param(i);l.Galaxy.frame.add({title:"Trackster",type:"url",content:m,scratchbook:true})}}})}});return false}}return{HDAEditView:f}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Always return a list for the value of the tool_test_results column in the Tool Shed's repository_metadata table.
by commits-noreply@bitbucket.org 10 Dec '13
by commits-noreply@bitbucket.org 10 Dec '13
10 Dec '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/3bf805dfa14e/
Changeset: 3bf805dfa14e
User: greg
Date: 2013-12-10 16:38:45
Summary: Always return a list for the value of the tool_test_results column in the Tool Shed's repository_metadata table.
Affected #: 1 file
diff -r 6c8d175a4c241a192962bf40f578b223bf3299f1 -r 3bf805dfa14eb150e90c1aab565eb22b8ab3d9b8 test/install_and_test_tool_shed_repositories/functional_tests.py
--- a/test/install_and_test_tool_shed_repositories/functional_tests.py
+++ b/test/install_and_test_tool_shed_repositories/functional_tests.py
@@ -49,6 +49,7 @@
from datetime import datetime
from galaxy.app import UniverseApplication
from galaxy.util import asbool
+from galaxy.util import listify
from galaxy.util import unicodify
from galaxy.util.json import from_json_string
from galaxy.util.json import to_json_string
@@ -465,7 +466,9 @@
repository_metadata, error_message = json_from_url( api_url )
if error_message:
return None, error_message
- tool_test_results = repository_metadata.get( 'tool_test_results', [] )
+ # The tool_test_results used to be stored as a single dictionary rather than a list, but we currently
+ # return a list.
+ tool_test_results = listify( repository_metadata.get( 'tool_test_results', [] ) )
return tool_test_results, error_message
def get_webapp_global_conf():
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: History panel: allow a default link target to replace hard-coded 'galaxy_main'
by commits-noreply@bitbucket.org 10 Dec '13
by commits-noreply@bitbucket.org 10 Dec '13
10 Dec '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/6c8d175a4c24/
Changeset: 6c8d175a4c24
User: carlfeberhard
Date: 2013-12-10 16:22:19
Summary: History panel: allow a default link target to replace hard-coded 'galaxy_main'
Affected #: 8 files
diff -r 98eff59e4510c3a3137de7e5df38120bcda9be7f -r 6c8d175a4c241a192962bf40f578b223bf3299f1 static/scripts/mvc/dataset/hda-base.js
--- a/static/scripts/mvc/dataset/hda-base.js
+++ b/static/scripts/mvc/dataset/hda-base.js
@@ -39,9 +39,11 @@
this.defaultPrimaryActionButtonRenderers = [
this._render_showParamsButton
];
+
+ /** where should pages from links be displayed? (default to new tab/window) */
+ this.linkTarget = attributes.linkTarget || '_blank';
/** is the view currently in selection mode? */
- //this.selectable = attributes.selectable || false;
this.selectable = attributes.selectable || false;
/** is the view currently selected? */
this.selected = attributes.selected || false;
@@ -160,7 +162,7 @@
}
var displayBtnData = {
- target : 'galaxy_main',
+ target : this.linkTarget,
classes : 'dataset-display'
};
@@ -183,12 +185,13 @@
// add frame manager option onclick event
var self = this;
displayBtnData.onclick = function(){
- Galaxy.frame.add({
- title : "Data Viewer: " + self.model.get('name'),
- type : "url",
- target : "galaxy_main",
- content : self.urls.display
- });
+ if( Galaxy.frame && Galaxy.frame.active ){
+ Galaxy.frame.add({
+ title : "Data Viewer: " + self.model.get('name'),
+ type : "url",
+ content : self.urls.display
+ });
+ }
};
}
displayBtnData.faIcon = 'fa-eye';
@@ -251,7 +254,7 @@
return faIconButton({
title : _l( 'View details' ),
href : this.urls.show_params,
- target : 'galaxy_main',
+ target : this.linkTarget,
faIcon : 'fa-info-circle'
});
},
diff -r 98eff59e4510c3a3137de7e5df38120bcda9be7f -r 6c8d175a4c241a192962bf40f578b223bf3299f1 static/scripts/mvc/dataset/hda-edit.js
--- a/static/scripts/mvc/dataset/hda-edit.js
+++ b/static/scripts/mvc/dataset/hda-edit.js
@@ -69,7 +69,7 @@
editBtnData = {
title : _l( 'Edit Attributes' ),
href : this.urls.edit,
- target : 'galaxy_main',
+ target : this.linkTarget,
classes : 'dataset-edit'
};
@@ -133,7 +133,7 @@
return faIconButton({
title : _l( 'View or report this error' ),
href : this.urls.report_error,
- target : 'galaxy_main',
+ target : this.linkTarget,
faIcon : 'fa-bug'
});
},
@@ -145,7 +145,7 @@
return faIconButton({
title : _l( 'Run this job again' ),
href : this.urls.rerun,
- target : 'galaxy_main',
+ target : this.linkTarget,
faIcon : 'fa-refresh'
});
},
@@ -262,7 +262,7 @@
*/
_render_body_failed_metadata : function(){
// add a message box about the failure at the top of the body then render the remaining body as STATES.OK
- var $link = $( '<a/>' ).attr({ href: this.urls.edit, target: 'galaxy_main' })
+ var $link = $( '<a/>' ).attr({ href: this.urls.edit, target: this.linkTarget })
.text( _l( 'set it manually or retry auto-detection' ) ),
$span = $( '<span/>' ).text( '. ' + _l( 'You may be able to' ) + ' ' ).append( $link ),
$body = hdaBase.HDABaseView.prototype._render_body_failed_metadata.call( this );
@@ -332,7 +332,7 @@
if( this.model.get( 'metadata_dbkey' ) === '?'
&& !this.model.isDeletedOrPurged() ){
$body.find( '.dataset-dbkey .value' ).replaceWith(
- $( '<a target="galaxy_main">?</a>' ).attr( 'href', this.urls.edit ) );
+ $( '<a target="' + this.linkTarget + '">?</a>' ).attr( 'href', this.urls.edit ) );
}
},
@@ -376,7 +376,7 @@
title : "Scatterplot",
type : "url",
content : url + '/scatterplot?' + $.param(params),
- target : 'galaxy_main',
+ target : this.linkTarget,
scratchbook : true
});
diff -r 98eff59e4510c3a3137de7e5df38120bcda9be7f -r 6c8d175a4c241a192962bf40f578b223bf3299f1 static/scripts/mvc/history/history-panel.js
--- a/static/scripts/mvc/history/history-panel.js
+++ b/static/scripts/mvc/history/history-panel.js
@@ -109,6 +109,10 @@
this.log( this + '.initialize:', attributes );
//TODO: pass show_del'd/hidden through
+ /** where should pages from links be displayed? (default to new tab/window) */
+ this.linkTarget = attributes.linkTarget || '_blank';
+
+ // set up (non-model related) event handlers
this._setUpListeners();
// ---- set up instance vars
@@ -719,6 +723,7 @@
expanded = this.storage.get( 'expandedHdas' )[ hdaId ],
hdaView = new this.HDAView({
model : hda,
+ linkTarget : this.linkTarget,
expanded : expanded,
selectable : this.selecting,
hasUser : this.model.hasUser(),
diff -r 98eff59e4510c3a3137de7e5df38120bcda9be7f -r 6c8d175a4c241a192962bf40f578b223bf3299f1 static/scripts/packed/mvc/dataset/hda-base.js
--- a/static/scripts/packed/mvc/dataset/hda-base.js
+++ b/static/scripts/packed/mvc/dataset/hda-base.js
@@ -1,1 +1,1 @@
-define(["mvc/dataset/hda-model"],function(b){var a=Backbone.View.extend(LoggableMixin).extend({tagName:"div",className:"dataset hda history-panel-hda",id:function(){return"hda-"+this.model.get("id")},fxSpeed:"fast",initialize:function(c){if(c.logger){this.logger=this.model.logger=c.logger}this.log(this+".initialize:",c);this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton];this.selectable=c.selectable||false;this.selected=c.selected||false;this.expanded=c.expanded||false;this.draggable=c.draggable||false;this._setUpListeners()},_setUpListeners:function(){this.model.on("change",function(d,c){if(this.model.changedAttributes().state&&this.model.inReadyState()&&this.expanded&&!this.model.hasDetails()){this.model.fetch()}else{this.render()}},this)},render:function(e){e=(e===undefined)?(true):(e);var c=this;this.$el.find("[title]").tooltip("destroy");this.urls=this.model.urls();var d=$(a.templates.skeleton(this.model.toJSON()));d.find(".dataset-primary-actions").append(this._render_titleButtons());d.children(".dataset-body").replaceWith(this._render_body());this._setUpBehaviors(d);if(e){$(c).queue(function(f){this.$el.fadeOut(c.fxSpeed,f)})}$(c).queue(function(f){this.$el.empty().attr("class",c.className).addClass("state-"+c.model.get("state")).append(d.children());if(this.selectable){this.showSelector(0)}f()});if(e){$(c).queue(function(f){this.$el.fadeIn(c.fxSpeed,f)})}$(c).queue(function(f){this.trigger("rendered",c);if(this.model.inReadyState()){this.trigger("rendered:ready",c)}if(this.draggable){this.draggableOn()}f()});return this},_setUpBehaviors:function(c){c=c||this.$el;make_popup_menus(c);c.find("[title]").tooltip({placement:"bottom"})},_render_titleButtons:function(){return[this._render_displayButton()]},_render_displayButton:function(){if((this.model.get("state")===b.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(this.model.get("state")===b.HistoryDatasetAssociation.STATES.DISCARDED)||(this.model.get("state")===b.HistoryDatasetAssociation.STATES.NEW)||(!this.model.get("accessible"))){return null}var d={target:"galaxy_main",classes:"dataset-display"};if(this.model.get("purged")){d.disabled=true;d.title=_l("Cannot display datasets removed from disk")}else{if(this.model.get("state")===b.HistoryDatasetAssociation.STATES.UPLOAD){d.disabled=true;d.title=_l("This dataset must finish uploading before it can be viewed")}else{d.title=_l("View data");d.href=this.urls.display;var c=this;d.onclick=function(){Galaxy.frame.add({title:"Data Viewer: "+c.model.get("name"),type:"url",target:"galaxy_main",content:c.urls.display})}}}d.faIcon="fa-eye";return faIconButton(d)},_render_downloadButton:function(){if(this.model.get("purged")||!this.model.hasData()){return null}var d=this.urls,e=this.model.get("meta_files");if(_.isEmpty(e)){return $(['<a href="'+d.download+'" title="'+_l("Download")+'" class="icon-btn">','<span class="fa fa-floppy-o"></span>',"</a>"].join(""))}var f="dataset-"+this.model.get("id")+"-popup",c=['<div popupmenu="'+f+'">','<a href="'+d.download+'">',_l("Download Dataset"),"</a>","<a>"+_l("Additional Files")+"</a>",_.map(e,function(g){return['<a class="action-button" href="',d.meta_download+g.file_type,'">',_l("Download")," ",g.file_type,"</a>"].join("")}).join("\n"),"</div>",'<div class="icon-btn-group">','<a href="'+d.download+'" title="'+_l("Download")+'" class="icon-btn">','<span class="fa fa-floppy-o"></span>','</a><a class="icon-btn popup" id="'+f+'">','<span class="fa fa-caret-down"></span>',"</a>","</div>"].join("\n");return $(c)},_render_showParamsButton:function(){return faIconButton({title:_l("View details"),href:this.urls.show_params,target:"galaxy_main",faIcon:"fa-info-circle"})},_render_body:function(){var d=$('<div>Error: unknown dataset state "'+this.model.get("state")+'".</div>'),c=this["_render_body_"+this.model.get("state")];if(_.isFunction(c)){d=c.call(this)}this._setUpBehaviors(d);if(this.expanded){d.show()}return d},_render_stateBodyHelper:function(c,f){f=f||[];var d=this,e=$(a.templates.body(_.extend(this.model.toJSON(),{body:c})));e.find(".dataset-actions .left").append(_.map(f,function(g){return g.call(d)}));return e},_render_body_new:function(){return this._render_stateBodyHelper("<div>"+_l("This is a new dataset and not all of its data are available yet")+"</div>")},_render_body_noPermission:function(){return this._render_stateBodyHelper("<div>"+_l("You do not have permission to view this dataset")+"</div>")},_render_body_discarded:function(){return this._render_stateBodyHelper("<div>"+_l("The job creating this dataset was cancelled before completion")+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_queued:function(){return this._render_stateBodyHelper("<div>"+_l("This job is waiting to run")+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_upload:function(){return this._render_stateBodyHelper("<div>"+_l("This dataset is currently uploading")+"</div>")},_render_body_setting_metadata:function(){return this._render_stateBodyHelper("<div>"+_l("Metadata is being auto-detected")+"</div>")},_render_body_running:function(){return this._render_stateBodyHelper("<div>"+_l("This job is currently running")+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_paused:function(){return this._render_stateBodyHelper("<div>"+_l('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume')+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_error:function(){var c=['<span class="help-text">',_l("An error occurred with this dataset"),":</span>",'<div class="job-error-text">',$.trim(this.model.get("misc_info")),"</div>"].join("");if(!this.model.get("purged")){c="<div>"+this.model.get("misc_blurb")+"</div>"+c}return this._render_stateBodyHelper(c,this.defaultPrimaryActionButtonRenderers.concat([this._render_downloadButton]))},_render_body_empty:function(){return this._render_stateBodyHelper("<div>"+_l("No data")+": <i>"+this.model.get("misc_blurb")+"</i></div>",this.defaultPrimaryActionButtonRenderers)},_render_body_failed_metadata:function(){var c=$('<div class="warningmessagesmall"></div>').append($("<strong/>").text(_l("An error occurred setting the metadata for this dataset"))),d=this._render_body_ok();d.prepend(c);return d},_render_body_ok:function(){var c=this,e=$(a.templates.body(this.model.toJSON())),d=[this._render_downloadButton].concat(this.defaultPrimaryActionButtonRenderers);e.find(".dataset-actions .left").append(_.map(d,function(f){return f.call(c)}));if(this.model.isDeletedOrPurged()){return e}return e},events:{"click .dataset-title-bar":"toggleBodyVisibility","keydown .dataset-title-bar":"toggleBodyVisibility","click .dataset-selector":"toggleSelect",},toggleBodyVisibility:function(f,d){var c=32,e=13;if((f.type==="keydown")&&!(f.keyCode===c||f.keyCode===e)){return true}var g=this.$el.find(".dataset-body");d=(d===undefined)?(!g.is(":visible")):(d);if(d){this.expandBody()}else{this.collapseBody()}return false},expandBody:function(){var c=this;function d(){c.$el.children(".dataset-body").replaceWith(c._render_body());c.$el.children(".dataset-body").slideDown(c.fxSpeed,function(){c.expanded=true;c.trigger("body-expanded",c.model.get("id"))})}if(this.model.inReadyState()&&!this.model.hasDetails()){this.model.fetch({silent:true}).always(function(e){d()})}else{d()}},collapseBody:function(){var c=this;this.$el.children(".dataset-body").slideUp(c.fxSpeed,function(){c.expanded=false;c.trigger("body-collapsed",c.model.get("id"))})},showSelector:function(e){if(this.$el.find(".dataset-selector").css("display")!=="none"){return}e=(e!==undefined)?(e):(this.fxSpeed);if(this.selected){this.select(null,true)}var d=this,c=32;if(e){this.$el.queue("fx",function(f){$(this).find(".dataset-primary-actions").fadeOut(e,f)});this.$el.queue("fx",function(f){$(this).find(".dataset-selector").show().animate({width:c},e,f);$(this).find(".dataset-title-bar").animate({"margin-left":c},e,f);d.selectable=true;d.trigger("selectable",true,d)})}else{this.$el.find(".dataset-primary-actions").hide();this.$el.find(".dataset-selector").show().css({width:c});this.$el.find(".dataset-title-bar").show().css({"margin-left":c});d.selectable=true;d.trigger("selectable",true,d)}},hideSelector:function(c){c=(c!==undefined)?(c):(this.fxSpeed);this.selectable=false;this.trigger("selectable",false,this);if(c){this.$el.queue("fx",function(d){$(this).find(".dataset-title-bar").show().css({"margin-left":"0"});$(this).find(".dataset-selector").animate({width:"0px"},c,function(){$(this).hide();d()})});this.$el.queue("fx",function(d){$(this).find(".dataset-primary-actions").fadeIn(c,d)})}else{$(this).find(".dataset-selector").css({width:"0px"}).hide();$(this).find(".dataset-primary-actions").show()}},toggleSelector:function(c){if(!this.$el.find(".dataset-selector").is(":visible")){this.showSelector(c)}else{this.hideSelector(c)}},select:function(c){this.$el.find(".dataset-selector span").removeClass("fa-square-o").addClass("fa-check-square-o");if(!this.selected){this.trigger("selected",this);this.selected=true}return false},deselect:function(c){this.$el.find(".dataset-selector span").removeClass("fa-check-square-o").addClass("fa-square-o");if(this.selected){this.trigger("de-selected",this);this.selected=false}return false},toggleSelect:function(c){if(this.selected){this.deselect(c)}else{this.select(c)}},draggableOn:function(){this.draggable=true;this.dragStartHandler=_.bind(this._dragStartHandler,this);this.dragEndHandler=_.bind(this._dragEndHandler,this);var c=this.$el.find(".dataset-title-bar").attr("draggable",true).get(0);c.addEventListener("dragstart",this.dragStartHandler,false);c.addEventListener("dragend",this.dragEndHandler,false)},draggableOff:function(){this.draggable=false;var c=this.$el.find(".dataset-title-bar").attr("draggable",false).get(0);c.removeEventListener("dragstart",this.dragStartHandler,false);c.removeEventListener("dragend",this.dragEndHandler,false)},toggleDraggable:function(){if(this.draggable){this.draggableOff()}else{this.draggableOn()}},_dragStartHandler:function(c){this.trigger("dragstart",this);c.dataTransfer.effectAllowed="move";c.dataTransfer.setData("text",JSON.stringify(this.model.toJSON()));return false},_dragEndHandler:function(c){this.trigger("dragend",this);return false},remove:function(d){var c=this;this.$el.fadeOut(c.fxSpeed,function(){c.$el.remove();c.off();if(d){d()}})},toString:function(){var c=(this.model)?(this.model+""):("(no model)");return"HDABaseView("+c+")"}});a.templates={skeleton:Handlebars.templates["template-hda-skeleton"],body:Handlebars.templates["template-hda-body"]};return{HDABaseView:a}});
\ No newline at end of file
+define(["mvc/dataset/hda-model"],function(b){var a=Backbone.View.extend(LoggableMixin).extend({tagName:"div",className:"dataset hda history-panel-hda",id:function(){return"hda-"+this.model.get("id")},fxSpeed:"fast",initialize:function(c){if(c.logger){this.logger=this.model.logger=c.logger}this.log(this+".initialize:",c);this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton];this.linkTarget=c.linkTarget||"_blank";this.selectable=c.selectable||false;this.selected=c.selected||false;this.expanded=c.expanded||false;this.draggable=c.draggable||false;this._setUpListeners()},_setUpListeners:function(){this.model.on("change",function(d,c){if(this.model.changedAttributes().state&&this.model.inReadyState()&&this.expanded&&!this.model.hasDetails()){this.model.fetch()}else{this.render()}},this)},render:function(e){e=(e===undefined)?(true):(e);var c=this;this.$el.find("[title]").tooltip("destroy");this.urls=this.model.urls();var d=$(a.templates.skeleton(this.model.toJSON()));d.find(".dataset-primary-actions").append(this._render_titleButtons());d.children(".dataset-body").replaceWith(this._render_body());this._setUpBehaviors(d);if(e){$(c).queue(function(f){this.$el.fadeOut(c.fxSpeed,f)})}$(c).queue(function(f){this.$el.empty().attr("class",c.className).addClass("state-"+c.model.get("state")).append(d.children());if(this.selectable){this.showSelector(0)}f()});if(e){$(c).queue(function(f){this.$el.fadeIn(c.fxSpeed,f)})}$(c).queue(function(f){this.trigger("rendered",c);if(this.model.inReadyState()){this.trigger("rendered:ready",c)}if(this.draggable){this.draggableOn()}f()});return this},_setUpBehaviors:function(c){c=c||this.$el;make_popup_menus(c);c.find("[title]").tooltip({placement:"bottom"})},_render_titleButtons:function(){return[this._render_displayButton()]},_render_displayButton:function(){if((this.model.get("state")===b.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(this.model.get("state")===b.HistoryDatasetAssociation.STATES.DISCARDED)||(this.model.get("state")===b.HistoryDatasetAssociation.STATES.NEW)||(!this.model.get("accessible"))){return null}var d={target:this.linkTarget,classes:"dataset-display"};if(this.model.get("purged")){d.disabled=true;d.title=_l("Cannot display datasets removed from disk")}else{if(this.model.get("state")===b.HistoryDatasetAssociation.STATES.UPLOAD){d.disabled=true;d.title=_l("This dataset must finish uploading before it can be viewed")}else{d.title=_l("View data");d.href=this.urls.display;var c=this;d.onclick=function(){if(Galaxy.frame&&Galaxy.frame.active){Galaxy.frame.add({title:"Data Viewer: "+c.model.get("name"),type:"url",content:c.urls.display})}}}}d.faIcon="fa-eye";return faIconButton(d)},_render_downloadButton:function(){if(this.model.get("purged")||!this.model.hasData()){return null}var d=this.urls,e=this.model.get("meta_files");if(_.isEmpty(e)){return $(['<a href="'+d.download+'" title="'+_l("Download")+'" class="icon-btn">','<span class="fa fa-floppy-o"></span>',"</a>"].join(""))}var f="dataset-"+this.model.get("id")+"-popup",c=['<div popupmenu="'+f+'">','<a href="'+d.download+'">',_l("Download Dataset"),"</a>","<a>"+_l("Additional Files")+"</a>",_.map(e,function(g){return['<a class="action-button" href="',d.meta_download+g.file_type,'">',_l("Download")," ",g.file_type,"</a>"].join("")}).join("\n"),"</div>",'<div class="icon-btn-group">','<a href="'+d.download+'" title="'+_l("Download")+'" class="icon-btn">','<span class="fa fa-floppy-o"></span>','</a><a class="icon-btn popup" id="'+f+'">','<span class="fa fa-caret-down"></span>',"</a>","</div>"].join("\n");return $(c)},_render_showParamsButton:function(){return faIconButton({title:_l("View details"),href:this.urls.show_params,target:this.linkTarget,faIcon:"fa-info-circle"})},_render_body:function(){var d=$('<div>Error: unknown dataset state "'+this.model.get("state")+'".</div>'),c=this["_render_body_"+this.model.get("state")];if(_.isFunction(c)){d=c.call(this)}this._setUpBehaviors(d);if(this.expanded){d.show()}return d},_render_stateBodyHelper:function(c,f){f=f||[];var d=this,e=$(a.templates.body(_.extend(this.model.toJSON(),{body:c})));e.find(".dataset-actions .left").append(_.map(f,function(g){return g.call(d)}));return e},_render_body_new:function(){return this._render_stateBodyHelper("<div>"+_l("This is a new dataset and not all of its data are available yet")+"</div>")},_render_body_noPermission:function(){return this._render_stateBodyHelper("<div>"+_l("You do not have permission to view this dataset")+"</div>")},_render_body_discarded:function(){return this._render_stateBodyHelper("<div>"+_l("The job creating this dataset was cancelled before completion")+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_queued:function(){return this._render_stateBodyHelper("<div>"+_l("This job is waiting to run")+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_upload:function(){return this._render_stateBodyHelper("<div>"+_l("This dataset is currently uploading")+"</div>")},_render_body_setting_metadata:function(){return this._render_stateBodyHelper("<div>"+_l("Metadata is being auto-detected")+"</div>")},_render_body_running:function(){return this._render_stateBodyHelper("<div>"+_l("This job is currently running")+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_paused:function(){return this._render_stateBodyHelper("<div>"+_l('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume')+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_error:function(){var c=['<span class="help-text">',_l("An error occurred with this dataset"),":</span>",'<div class="job-error-text">',$.trim(this.model.get("misc_info")),"</div>"].join("");if(!this.model.get("purged")){c="<div>"+this.model.get("misc_blurb")+"</div>"+c}return this._render_stateBodyHelper(c,this.defaultPrimaryActionButtonRenderers.concat([this._render_downloadButton]))},_render_body_empty:function(){return this._render_stateBodyHelper("<div>"+_l("No data")+": <i>"+this.model.get("misc_blurb")+"</i></div>",this.defaultPrimaryActionButtonRenderers)},_render_body_failed_metadata:function(){var c=$('<div class="warningmessagesmall"></div>').append($("<strong/>").text(_l("An error occurred setting the metadata for this dataset"))),d=this._render_body_ok();d.prepend(c);return d},_render_body_ok:function(){var c=this,e=$(a.templates.body(this.model.toJSON())),d=[this._render_downloadButton].concat(this.defaultPrimaryActionButtonRenderers);e.find(".dataset-actions .left").append(_.map(d,function(f){return f.call(c)}));if(this.model.isDeletedOrPurged()){return e}return e},events:{"click .dataset-title-bar":"toggleBodyVisibility","keydown .dataset-title-bar":"toggleBodyVisibility","click .dataset-selector":"toggleSelect",},toggleBodyVisibility:function(f,d){var c=32,e=13;if((f.type==="keydown")&&!(f.keyCode===c||f.keyCode===e)){return true}var g=this.$el.find(".dataset-body");d=(d===undefined)?(!g.is(":visible")):(d);if(d){this.expandBody()}else{this.collapseBody()}return false},expandBody:function(){var c=this;function d(){c.$el.children(".dataset-body").replaceWith(c._render_body());c.$el.children(".dataset-body").slideDown(c.fxSpeed,function(){c.expanded=true;c.trigger("body-expanded",c.model.get("id"))})}if(this.model.inReadyState()&&!this.model.hasDetails()){this.model.fetch({silent:true}).always(function(e){d()})}else{d()}},collapseBody:function(){var c=this;this.$el.children(".dataset-body").slideUp(c.fxSpeed,function(){c.expanded=false;c.trigger("body-collapsed",c.model.get("id"))})},showSelector:function(e){if(this.$el.find(".dataset-selector").css("display")!=="none"){return}e=(e!==undefined)?(e):(this.fxSpeed);if(this.selected){this.select(null,true)}var d=this,c=32;if(e){this.$el.queue("fx",function(f){$(this).find(".dataset-primary-actions").fadeOut(e,f)});this.$el.queue("fx",function(f){$(this).find(".dataset-selector").show().animate({width:c},e,f);$(this).find(".dataset-title-bar").animate({"margin-left":c},e,f);d.selectable=true;d.trigger("selectable",true,d)})}else{this.$el.find(".dataset-primary-actions").hide();this.$el.find(".dataset-selector").show().css({width:c});this.$el.find(".dataset-title-bar").show().css({"margin-left":c});d.selectable=true;d.trigger("selectable",true,d)}},hideSelector:function(c){c=(c!==undefined)?(c):(this.fxSpeed);this.selectable=false;this.trigger("selectable",false,this);if(c){this.$el.queue("fx",function(d){$(this).find(".dataset-title-bar").show().css({"margin-left":"0"});$(this).find(".dataset-selector").animate({width:"0px"},c,function(){$(this).hide();d()})});this.$el.queue("fx",function(d){$(this).find(".dataset-primary-actions").fadeIn(c,d)})}else{$(this).find(".dataset-selector").css({width:"0px"}).hide();$(this).find(".dataset-primary-actions").show()}},toggleSelector:function(c){if(!this.$el.find(".dataset-selector").is(":visible")){this.showSelector(c)}else{this.hideSelector(c)}},select:function(c){this.$el.find(".dataset-selector span").removeClass("fa-square-o").addClass("fa-check-square-o");if(!this.selected){this.trigger("selected",this);this.selected=true}return false},deselect:function(c){this.$el.find(".dataset-selector span").removeClass("fa-check-square-o").addClass("fa-square-o");if(this.selected){this.trigger("de-selected",this);this.selected=false}return false},toggleSelect:function(c){if(this.selected){this.deselect(c)}else{this.select(c)}},draggableOn:function(){this.draggable=true;this.dragStartHandler=_.bind(this._dragStartHandler,this);this.dragEndHandler=_.bind(this._dragEndHandler,this);var c=this.$el.find(".dataset-title-bar").attr("draggable",true).get(0);c.addEventListener("dragstart",this.dragStartHandler,false);c.addEventListener("dragend",this.dragEndHandler,false)},draggableOff:function(){this.draggable=false;var c=this.$el.find(".dataset-title-bar").attr("draggable",false).get(0);c.removeEventListener("dragstart",this.dragStartHandler,false);c.removeEventListener("dragend",this.dragEndHandler,false)},toggleDraggable:function(){if(this.draggable){this.draggableOff()}else{this.draggableOn()}},_dragStartHandler:function(c){this.trigger("dragstart",this);c.dataTransfer.effectAllowed="move";c.dataTransfer.setData("text",JSON.stringify(this.model.toJSON()));return false},_dragEndHandler:function(c){this.trigger("dragend",this);return false},remove:function(d){var c=this;this.$el.fadeOut(c.fxSpeed,function(){c.$el.remove();c.off();if(d){d()}})},toString:function(){var c=(this.model)?(this.model+""):("(no model)");return"HDABaseView("+c+")"}});a.templates={skeleton:Handlebars.templates["template-hda-skeleton"],body:Handlebars.templates["template-hda-body"]};return{HDABaseView:a}});
\ No newline at end of file
diff -r 98eff59e4510c3a3137de7e5df38120bcda9be7f -r 6c8d175a4c241a192962bf40f578b223bf3299f1 static/scripts/packed/mvc/dataset/hda-edit.js
--- a/static/scripts/packed/mvc/dataset/hda-edit.js
+++ b/static/scripts/packed/mvc/dataset/hda-edit.js
@@ -1,1 +1,1 @@
-define(["mvc/dataset/hda-model","mvc/dataset/hda-base"],function(d,a){var f=a.HDABaseView.extend(LoggableMixin).extend({initialize:function(g){a.HDABaseView.prototype.initialize.call(this,g);this.hasUser=g.hasUser;this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton,this._render_rerunButton]},_render_titleButtons:function(){return a.HDABaseView.prototype._render_titleButtons.call(this).concat([this._render_editButton(),this._render_deleteButton()])},_render_editButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.DISCARDED)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var i=this.model.get("purged"),g=this.model.get("deleted"),h={title:_l("Edit Attributes"),href:this.urls.edit,target:"galaxy_main",classes:"dataset-edit"};if(g||i){h.disabled=true;if(i){h.title=_l("Cannot edit attributes of datasets removed from disk")}else{if(g){h.title=_l("Undelete dataset to edit attributes")}}}else{if(this.model.get("state")===d.HistoryDatasetAssociation.STATES.UPLOAD){h.disabled=true;h.title=_l("This dataset must finish uploading before it can be edited")}}h.faIcon="fa-pencil";return faIconButton(h)},_render_deleteButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var g=this,h={title:_l("Delete"),classes:"dataset-delete",onclick:function(){g.$el.find(".icon-btn.dataset-delete").trigger("mouseout");g.model["delete"]()}};if(this.model.get("deleted")||this.model.get("purged")){h={title:_l("Dataset is already deleted"),disabled:true}}h.faIcon="fa-times";return faIconButton(h)},_render_errButton:function(){if(this.model.get("state")!==d.HistoryDatasetAssociation.STATES.ERROR){return null}return faIconButton({title:_l("View or report this error"),href:this.urls.report_error,target:"galaxy_main",faIcon:"fa-bug"})},_render_rerunButton:function(){return faIconButton({title:_l("Run this job again"),href:this.urls.rerun,target:"galaxy_main",faIcon:"fa-refresh"})},_render_visualizationsButton:function(){var g=this.model.get("visualizations");if((!this.hasUser)||(!this.model.hasData())||(_.isEmpty(g))){return null}if(_.isObject(g[0])){return this._render_visualizationsFrameworkButton(g)}if(!this.urls.visualization){return null}var i=this.model.get("dbkey"),l=this.urls.visualization,j={},m={dataset_id:this.model.get("id"),hda_ldda:"hda"};if(i){m.dbkey=i}var h=faIconButton({title:_l("Visualize"),href:this.urls.visualization,faIcon:"fa-bar-chart-o"});function k(n){switch(n){case"trackster":return b(l,m,i);case"scatterplot":return e(l,m);default:return function(){Galaxy.frame.add({title:"Visualization",type:"url",content:l+"/"+n+"?"+$.param(m)})}}}if(g.length===1){h.attr("data-original-title",g[0]);h.click(k(g[0]))}else{_.each(g,function(o){var n=o.charAt(0).toUpperCase()+o.slice(1);j[_l(n)]=k(o)});make_popupmenu(h,j)}return h},_render_visualizationsFrameworkButton:function(g){if(!(this.model.hasData())||!(g&&!_.isEmpty(g))){return null}var i=faIconButton({title:_l("Visualize"),faIcon:"fa-bar-chart-o"});i.addClass("visualize-icon");if(_.keys(g).length===1){i.attr("title",_.keys(g)[0]);i.attr("href",_.values(g)[0])}else{var j=[];_.each(g,function(k){j.push(k)});var h=new PopupMenu(i,j)}return i},_render_body_failed_metadata:function(){var h=$("<a/>").attr({href:this.urls.edit,target:"galaxy_main"}).text(_l("set it manually or retry auto-detection")),g=$("<span/>").text(". "+_l("You may be able to")+" ").append(h),i=a.HDABaseView.prototype._render_body_failed_metadata.call(this);i.find(".warningmessagesmall strong").append(g);return i},_render_body_error:function(){var g=a.HDABaseView.prototype._render_body_error.call(this);g.find(".dataset-actions .left").prepend(this._render_errButton());return g},_render_body_ok:function(){var g=a.HDABaseView.prototype._render_body_ok.call(this);if(this.model.isDeletedOrPurged()){return g}this.makeDbkeyEditLink(g);if(this.hasUser){g.find(".dataset-actions .left").append(this._render_visualizationsButton());this._renderTags(g);this._renderAnnotation(g)}return g},_renderTags:function(g){this.tagsEditor=new TagsEditor({model:this.model,el:g.find(".tags-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit dataset tags"),classes:"dataset-tag-btn",faIcon:"fa-tags"}).appendTo(g.find(".dataset-actions .right"))})},_renderAnnotation:function(g){this.annotationEditor=new AnnotationEditor({model:this.model,el:g.find(".annotation-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit dataset annotation"),classes:"dataset-annotate-btn",faIcon:"fa-comment"}).appendTo(g.find(".dataset-actions .right"))})},makeDbkeyEditLink:function(g){if(this.model.get("metadata_dbkey")==="?"&&!this.model.isDeletedOrPurged()){g.find(".dataset-dbkey .value").replaceWith($('<a target="galaxy_main">?</a>').attr("href",this.urls.edit))}},events:_.extend(_.clone(a.HDABaseView.prototype.events),{"click .dataset-undelete":function(g){this.model.undelete();return false},"click .dataset-unhide":function(g){this.model.unhide();return false},"click .dataset-purge":"confirmPurge"}),confirmPurge:function c(g){this.model.purge();return false},toString:function(){var g=(this.model)?(this.model+""):("(no model)");return"HDAView("+g+")"}});function e(g,h){action=function(){Galaxy.frame.add({title:"Scatterplot",type:"url",content:g+"/scatterplot?"+$.param(h),target:"galaxy_main",scratchbook:true});$("div.popmenu-wrapper").remove();return false};return action}function b(g,i,h){return function(){var j={};if(h){j["f-dbkey"]=h}$.ajax({url:g+"/list_tracks?"+$.param(j),dataType:"html",error:function(){alert(("Could not add this dataset to browser")+".")},success:function(k){var l=window.parent;l.Galaxy.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){l.Galaxy.modal.hide()},"View in saved visualization":function(){l.Galaxy.modal.show({title:"Add Data to Saved Visualization",body:k,buttons:{Cancel:function(){l.Galaxy.modal.hide()},"Add to visualization":function(){$(l.document).find("input[name=id]:checked").each(function(){l.Galaxy.modal.hide();var m=$(this).val();i.id=m;l.Galaxy.frame.add({title:"Trackster",type:"url",content:g+"/trackster?"+$.param(i),scratchbook:true})})}}})},"View in new visualization":function(){l.Galaxy.modal.hide();var m=g+"/trackster?"+$.param(i);l.Galaxy.frame.add({title:"Trackster",type:"url",content:m,scratchbook:true})}}})}});return false}}return{HDAEditView:f}});
\ No newline at end of file
+define(["mvc/dataset/hda-model","mvc/dataset/hda-base"],function(d,a){var f=a.HDABaseView.extend(LoggableMixin).extend({initialize:function(g){a.HDABaseView.prototype.initialize.call(this,g);this.hasUser=g.hasUser;this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton,this._render_rerunButton]},_render_titleButtons:function(){return a.HDABaseView.prototype._render_titleButtons.call(this).concat([this._render_editButton(),this._render_deleteButton()])},_render_editButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.DISCARDED)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var i=this.model.get("purged"),g=this.model.get("deleted"),h={title:_l("Edit Attributes"),href:this.urls.edit,target:this.linkTarget,classes:"dataset-edit"};if(g||i){h.disabled=true;if(i){h.title=_l("Cannot edit attributes of datasets removed from disk")}else{if(g){h.title=_l("Undelete dataset to edit attributes")}}}else{if(this.model.get("state")===d.HistoryDatasetAssociation.STATES.UPLOAD){h.disabled=true;h.title=_l("This dataset must finish uploading before it can be edited")}}h.faIcon="fa-pencil";return faIconButton(h)},_render_deleteButton:function(){if((this.model.get("state")===d.HistoryDatasetAssociation.STATES.NEW)||(this.model.get("state")===d.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(!this.model.get("accessible"))){return null}var g=this,h={title:_l("Delete"),classes:"dataset-delete",onclick:function(){g.$el.find(".icon-btn.dataset-delete").trigger("mouseout");g.model["delete"]()}};if(this.model.get("deleted")||this.model.get("purged")){h={title:_l("Dataset is already deleted"),disabled:true}}h.faIcon="fa-times";return faIconButton(h)},_render_errButton:function(){if(this.model.get("state")!==d.HistoryDatasetAssociation.STATES.ERROR){return null}return faIconButton({title:_l("View or report this error"),href:this.urls.report_error,target:this.linkTarget,faIcon:"fa-bug"})},_render_rerunButton:function(){return faIconButton({title:_l("Run this job again"),href:this.urls.rerun,target:this.linkTarget,faIcon:"fa-refresh"})},_render_visualizationsButton:function(){var g=this.model.get("visualizations");if((!this.hasUser)||(!this.model.hasData())||(_.isEmpty(g))){return null}if(_.isObject(g[0])){return this._render_visualizationsFrameworkButton(g)}if(!this.urls.visualization){return null}var i=this.model.get("dbkey"),l=this.urls.visualization,j={},m={dataset_id:this.model.get("id"),hda_ldda:"hda"};if(i){m.dbkey=i}var h=faIconButton({title:_l("Visualize"),href:this.urls.visualization,faIcon:"fa-bar-chart-o"});function k(n){switch(n){case"trackster":return b(l,m,i);case"scatterplot":return e(l,m);default:return function(){Galaxy.frame.add({title:"Visualization",type:"url",content:l+"/"+n+"?"+$.param(m)})}}}if(g.length===1){h.attr("data-original-title",g[0]);h.click(k(g[0]))}else{_.each(g,function(o){var n=o.charAt(0).toUpperCase()+o.slice(1);j[_l(n)]=k(o)});make_popupmenu(h,j)}return h},_render_visualizationsFrameworkButton:function(g){if(!(this.model.hasData())||!(g&&!_.isEmpty(g))){return null}var i=faIconButton({title:_l("Visualize"),faIcon:"fa-bar-chart-o"});i.addClass("visualize-icon");if(_.keys(g).length===1){i.attr("title",_.keys(g)[0]);i.attr("href",_.values(g)[0])}else{var j=[];_.each(g,function(k){j.push(k)});var h=new PopupMenu(i,j)}return i},_render_body_failed_metadata:function(){var h=$("<a/>").attr({href:this.urls.edit,target:this.linkTarget}).text(_l("set it manually or retry auto-detection")),g=$("<span/>").text(". "+_l("You may be able to")+" ").append(h),i=a.HDABaseView.prototype._render_body_failed_metadata.call(this);i.find(".warningmessagesmall strong").append(g);return i},_render_body_error:function(){var g=a.HDABaseView.prototype._render_body_error.call(this);g.find(".dataset-actions .left").prepend(this._render_errButton());return g},_render_body_ok:function(){var g=a.HDABaseView.prototype._render_body_ok.call(this);if(this.model.isDeletedOrPurged()){return g}this.makeDbkeyEditLink(g);if(this.hasUser){g.find(".dataset-actions .left").append(this._render_visualizationsButton());this._renderTags(g);this._renderAnnotation(g)}return g},_renderTags:function(g){this.tagsEditor=new TagsEditor({model:this.model,el:g.find(".tags-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit dataset tags"),classes:"dataset-tag-btn",faIcon:"fa-tags"}).appendTo(g.find(".dataset-actions .right"))})},_renderAnnotation:function(g){this.annotationEditor=new AnnotationEditor({model:this.model,el:g.find(".annotation-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit dataset annotation"),classes:"dataset-annotate-btn",faIcon:"fa-comment"}).appendTo(g.find(".dataset-actions .right"))})},makeDbkeyEditLink:function(g){if(this.model.get("metadata_dbkey")==="?"&&!this.model.isDeletedOrPurged()){g.find(".dataset-dbkey .value").replaceWith($('<a target="'+this.linkTarget+'">?</a>').attr("href",this.urls.edit))}},events:_.extend(_.clone(a.HDABaseView.prototype.events),{"click .dataset-undelete":function(g){this.model.undelete();return false},"click .dataset-unhide":function(g){this.model.unhide();return false},"click .dataset-purge":"confirmPurge"}),confirmPurge:function c(g){this.model.purge();return false},toString:function(){var g=(this.model)?(this.model+""):("(no model)");return"HDAView("+g+")"}});function e(g,h){action=function(){Galaxy.frame.add({title:"Scatterplot",type:"url",content:g+"/scatterplot?"+$.param(h),target:this.linkTarget,scratchbook:true});$("div.popmenu-wrapper").remove();return false};return action}function b(g,i,h){return function(){var j={};if(h){j["f-dbkey"]=h}$.ajax({url:g+"/list_tracks?"+$.param(j),dataType:"html",error:function(){alert(("Could not add this dataset to browser")+".")},success:function(k){var l=window.parent;l.Galaxy.modal.show({title:"View Data in a New or Saved Visualization",buttons:{Cancel:function(){l.Galaxy.modal.hide()},"View in saved visualization":function(){l.Galaxy.modal.show({title:"Add Data to Saved Visualization",body:k,buttons:{Cancel:function(){l.Galaxy.modal.hide()},"Add to visualization":function(){$(l.document).find("input[name=id]:checked").each(function(){l.Galaxy.modal.hide();var m=$(this).val();i.id=m;l.Galaxy.frame.add({title:"Trackster",type:"url",content:g+"/trackster?"+$.param(i),scratchbook:true})})}}})},"View in new visualization":function(){l.Galaxy.modal.hide();var m=g+"/trackster?"+$.param(i);l.Galaxy.frame.add({title:"Trackster",type:"url",content:m,scratchbook:true})}}})}});return false}}return{HDAEditView:f}});
\ No newline at end of file
diff -r 98eff59e4510c3a3137de7e5df38120bcda9be7f -r 6c8d175a4c241a192962bf40f578b223bf3299f1 static/scripts/packed/mvc/history/history-panel.js
--- a/static/scripts/packed/mvc/history/history-panel.js
+++ b/static/scripts/packed/mvc/history/history-panel.js
@@ -1,1 +1,1 @@
-define(["mvc/history/history-model","mvc/dataset/hda-model","mvc/dataset/hda-base","mvc/dataset/hda-edit"],function(g,d,b,a){var c=SessionStorageModel.extend({defaults:{expandedHdas:{},show_deleted:false,show_hidden:false},addExpandedHda:function(h){this.save("expandedHdas",_.extend(this.get("expandedHdas"),_.object([h],[true])))},removeExpandedHda:function(h){this.save("expandedHdas",_.omit(this.get("expandedHdas"),h))},toString:function(){return"HistoryPanelPrefs("+this.id+")"}});c.historyStorageKey=function f(h){if(!h){throw new Error("HistoryPanelPrefs.historyStorageKey needs valid id: "+h)}return("history:"+h)};var e=Backbone.View.extend(LoggableMixin).extend({HDAView:a.HDAEditView,tagName:"div",className:"history-panel",fxSpeed:"fast",datasetsSelector:".datasets-list",emptyMsgSelector:".empty-history-message",msgsSelector:".message-container",initialize:function(h){h=h||{};if(h.logger){this.logger=h.logger}this.log(this+".initialize:",h);this._setUpListeners();this.hdaViews={};this.indicator=new LoadingIndicator(this.$el);this.filters=[];this.searching=h.searching||false;this.selecting=h.selecting||false;if(this.model){this._setUpWebStorage(h.initiallyExpanded,h.show_deleted,h.show_hidden);this._setUpModelEventHandlers()}if(h.onready){h.onready.call(this)}},_setUpListeners:function(){this.on("error",function(i,l,h,k,j){this.errorHandler(i,l,h,k,j)});this.on("loading-history",function(){this.showLoadingIndicator("loading history...")});this.on("loading-done",function(){this.hideLoadingIndicator()});this.once("rendered",function(){this.trigger("rendered:initial",this);return false});this.on("switched-history current-history new-history",function(){if(_.isEmpty(this.hdaViews)){this.trigger("empty-history",this)}});if(this.logger){this.on("all",function(h){this.log(this+"",arguments)},this)}},errorHandler:function(j,m,i,l,k){var h=this._parseErrorMessage(j,m,i,l,k);if(m&&m.status===0&&m.readyState===0){}else{if(m&&m.status===502){}else{if(!this.$el.find(this.msgsSelector).is(":visible")){this.once("rendered",function(){this.displayMessage("error",h.message,h.details)})}else{this.displayMessage("error",h.message,h.details)}}}},_parseErrorMessage:function(k,o,j,n,m){var i=Galaxy.currUser,h={message:this._bePolite(n),details:{user:(i instanceof User)?(i.toJSON()):(i+""),source:(k instanceof Backbone.Model)?(k.toJSON()):(k+""),xhr:o,options:(o)?(_.omit(j,"xhr")):(j)}};_.extend(h.details,m||{});if(o&&_.isFunction(o.getAllResponseHeaders)){var l=o.getAllResponseHeaders();l=_.compact(l.split("\n"));l=_.map(l,function(p){return p.split(": ")});h.details.xhr.responseHeaders=_.object(l)}return h},_bePolite:function(h){h=h||_l("An error occurred while getting updates from the server");return h+". "+_l("Please contact a Galaxy administrator if the problem persists.")},loadCurrentHistory:function(i){var h=this;return this.loadHistoryWithHDADetails("current",i).then(function(k,j){h.trigger("current-history",h)})},switchToHistory:function(k,j){var h=this,i=function(){return jQuery.post(galaxy_config.root+"api/histories/"+k+"/set_as_current")};return this.loadHistoryWithHDADetails(k,j,i).then(function(m,l){h.trigger("switched-history",h)})},createNewHistory:function(j){if(!Galaxy||!Galaxy.currUser||Galaxy.currUser.isAnonymous()){this.displayMessage("error",_l("You must be logged in to create histories"));return $.when()}var h=this,i=function(){return jQuery.post(galaxy_config.root+"api/histories",{current:true})};return this.loadHistory(undefined,j,i).then(function(l,k){h.trigger("new-history",h)})},loadHistoryWithHDADetails:function(k,j,i,m){var h=this,l=function(n){return h.getExpandedHdaIds(n.id)};return this.loadHistory(k,j,i,m,l)},loadHistory:function(k,j,i,n,l){this.trigger("loading-history",this);j=j||{};var h=this;var m=g.History.getHistoryData(k,{historyFn:i,hdaFn:n,hdaDetailIds:j.initiallyExpanded||l});return this._loadHistoryFromXHR(m,j).fail(function(q,o,p){h.trigger("error",h,q,j,_l("An error was encountered while "+o),{historyId:k,history:p||{}})}).always(function(){h.trigger("loading-done",h)})},_loadHistoryFromXHR:function(j,i){var h=this;j.then(function(k,l){h.setModel(k,l,i)});j.fail(function(l,k){h.render()});return j},setModel:function(j,h,i){i=i||{};if(this.model){this.model.clearUpdateTimeout();this.stopListening(this.model);this.stopListening(this.model.hdas)}this.hdaViews={};if(Galaxy&&Galaxy.currUser){j.user=Galaxy.currUser.toJSON()}this.model=new g.History(j,h,i);this._setUpWebStorage(i.initiallyExpanded,i.show_deleted,i.show_hidden);this._setUpModelEventHandlers();this.trigger("new-model",this);this.render();return this},_setUpWebStorage:function(i,h,j){this.storage=new c({id:c.historyStorageKey(this.model.get("id"))});if(_.isObject(i)){this.storage.set("exandedHdas",i)}if(_.isBoolean(h)){this.storage.set("show_deleted",h)}if(_.isBoolean(j)){this.storage.set("show_hidden",j)}this.trigger("new-storage",this.storage,this);this.log(this+" (init'd) storage:",this.storage.get())},clearWebStorage:function(){for(var h in sessionStorage){if(h.indexOf("history:")===0){sessionStorage.removeItem(h)}}},getStoredOptions:function(i){if(!i||i==="current"){return(this.storage)?(this.storage.get()):({})}var h=sessionStorage.getItem(c.historyStorageKey(i));return(h===null)?({}):(JSON.parse(h))},getExpandedHdaIds:function(h){var i=this.getStoredOptions(h).expandedHdas;return((_.isEmpty(i))?([]):(_.keys(i)))},_setUpModelEventHandlers:function(){this.model.on("error error:hdas",function(i,k,h,j){this.errorHandler(i,k,h,j)},this);this.model.on("change:nice_size",this.updateHistoryDiskSize,this);if(Galaxy&&Galaxy.quotaMeter){this.listenTo(this.model,"change:nice_size",function(){Galaxy.quotaMeter.update()})}this.model.hdas.on("add",this.addHdaView,this);this.model.hdas.on("change:deleted",this.handleHdaDeletionChange,this);this.model.hdas.on("change:visible",this.handleHdaVisibleChange,this);this.model.hdas.on("change:purged",function(h){this.model.fetch()},this);this.model.hdas.on("state:ready",function(i,j,h){if((!i.get("visible"))&&(!this.storage.get("show_hidden"))){this.removeHdaView(this.hdaViews[i.id])}},this)},render:function(j,k){j=(j===undefined)?(this.fxSpeed):(j);var h=this,i;if(this.model){i=this.renderModel()}else{i=this.renderWithoutModel()}$(h).queue("fx",[function(l){if(j&&h.$el.is(":visible")){h.$el.fadeOut(j,l)}else{l()}},function(l){h.$el.empty();if(i){h.$el.append(i.children())}l()},function(l){if(j&&!h.$el.is(":visible")){h.$el.fadeIn(j,l)}else{l()}},function(l){if(k){k.call(this)}h.trigger("rendered",this);l()}]);return this},renderWithoutModel:function(){var h=$("<div/>"),i=$("<div/>").addClass("message-container").css({"margin-left":"4px","margin-right":"4px"});return h.append(i)},renderModel:function(){var h=$("<div/>");if(!Galaxy||!Galaxy.currUser||Galaxy.currUser.isAnonymous()){h.append(e.templates.anonHistoryPanel(this.model.toJSON()))}else{h.append(e.templates.historyPanel(this.model.toJSON()));this._renderTags(h);this._renderAnnotation(h)}h.find(".history-secondary-actions").prepend(this._renderSearchButton());this._setUpBehaviours(h);this.renderHdas(h);return h},_renderTags:function(h){this.tagsEditor=new TagsEditor({model:this.model,el:h.find(".history-controls .tags-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit history tags"),classes:"history-tag-btn",faIcon:"fa-tags"}).appendTo(h.find(".history-secondary-actions"))})},_renderAnnotation:function(h){this.annotationEditor=new AnnotationEditor({model:this.model,el:h.find(".history-controls .annotation-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit history tags"),classes:"history-annotate-btn",faIcon:"fa-comment"}).appendTo(h.find(".history-secondary-actions"))})},_renderSearchButton:function(h){return faIconButton({title:_l("Search datasets"),classes:"history-search-btn",faIcon:"fa-search"})},_renderSelectButton:function(h){return faIconButton({title:_l("Operations on multiple datasets"),classes:"history-select-btn",faIcon:"fa-check-square-o"})},_setUpBehaviours:function(h){h=h||this.$el;h.find("[title]").tooltip({placement:"bottom"});if(!this.model||!Galaxy.currUser||Galaxy.currUser.isAnonymous()){return}var i=this;h.find(".history-name").make_text_editable({on_finish:function(j){h.find(".history-name").text(j);i.model.save({name:j}).fail(function(){h.find(".history-name").text(i.model.previous("name"))})}});this._setUpDatasetActionsPopup(h)},_setUpDatasetActionsPopup:function(h){var i=this;(new PopupMenu(h.find(".history-dataset-action-popup-btn"),[{html:_l("Hide datasets"),func:function(){var j=d.HistoryDatasetAssociation.prototype.hide;i.getSelectedHdaCollection().ajaxQueue(j)}},{html:_l("Unhide datasets"),func:function(){var j=d.HistoryDatasetAssociation.prototype.unhide;i.getSelectedHdaCollection().ajaxQueue(j)}},{html:_l("Delete datasets"),func:function(){var j=d.HistoryDatasetAssociation.prototype["delete"];i.getSelectedHdaCollection().ajaxQueue(j)}},{html:_l("Undelete datasets"),func:function(){var j=d.HistoryDatasetAssociation.prototype.undelete;i.getSelectedHdaCollection().ajaxQueue(j)}},{html:_l("Permanently delete datasets"),func:function(){if(confirm(_l("This will permanently remove the data in your datasets. Are you sure?"))){var j=d.HistoryDatasetAssociation.prototype.purge;i.getSelectedHdaCollection().ajaxQueue(j)}}}]))},refreshHdas:function(i,h){if(this.model){return this.model.refresh(i,h)}return $.when()},addHdaView:function(k){this.log("add."+this,k);var i=this;if(!k.isVisible(this.storage.get("show_deleted"),this.storage.get("show_hidden"))){return}$({}).queue([function j(m){var l=i.$el.find(i.emptyMsgSelector);if(l.is(":visible")){l.fadeOut(i.fxSpeed,m)}else{m()}},function h(m){i.scrollToTop();var l=i.$el.find(i.datasetsSelector);i.createHdaView(k).$el.hide().prependTo(l).slideDown(i.fxSpeed)}])},createHdaView:function(j){var i=j.get("id"),h=this.storage.get("expandedHdas")[i],k=new this.HDAView({model:j,expanded:h,selectable:this.selecting,hasUser:this.model.hasUser(),logger:this.logger});this._setUpHdaListeners(k);this.hdaViews[i]=k;return k.render()},_setUpHdaListeners:function(i){var h=this;i.on("body-expanded",function(j){h.storage.addExpandedHda(j)});i.on("body-collapsed",function(j){h.storage.removeExpandedHda(j)});i.on("error",function(k,m,j,l){h.errorHandler(k,m,j,l)})},handleHdaDeletionChange:function(h){if(h.get("deleted")&&!this.storage.get("show_deleted")){this.removeHdaView(this.hdaViews[h.id])}},handleHdaVisibleChange:function(h){if(h.hidden()&&!this.storage.get("show_hidden")){this.removeHdaView(this.hdaViews[h.id])}},removeHdaView:function(i){if(!i){return}var h=this;i.$el.fadeOut(h.fxSpeed,function(){i.off();i.remove();delete h.hdaViews[i.model.id];if(_.isEmpty(h.hdaViews)){h.$el.find(h.emptyMsgSelector).fadeIn(h.fxSpeed,function(){h.trigger("empty-history",h)})}})},renderHdas:function(j){j=j||this.$el;this.hdaViews={};var i=this,h=j.find(this.datasetsSelector),k=this.model.hdas.getVisible(this.storage.get("show_deleted"),this.storage.get("show_hidden"),this.filters);h.empty();if(k.length){k.each(function(l){h.prepend(i.createHdaView(l).$el)});j.find(this.emptyMsgSelector).hide()}else{j.find(this.emptyMsgSelector).show()}return this.hdaViews},events:{"click .message-container":"clearMessages","click .history-search-btn":"toggleSearchControls","click .history-select-btn":function(h){this.toggleSelect(this.fxSpeed)},"click .history-select-all-datasets-btn":"selectAllDatasets"},updateHistoryDiskSize:function(){this.$el.find(".history-size").text(this.model.get("nice_size"))},collapseAllHdaBodies:function(){_.each(this.hdaViews,function(h){h.toggleBodyVisibility(null,false)});this.storage.set("expandedHdas",{})},toggleShowDeleted:function(){this.storage.set("show_deleted",!this.storage.get("show_deleted"));this.renderHdas();return this.storage.get("show_deleted")},toggleShowHidden:function(){this.storage.set("show_hidden",!this.storage.get("show_hidden"));this.renderHdas();return this.storage.get("show_hidden")},renderSearchControls:function(i){var j=this;function l(m){j.searchFor=m;j.filters=[function(n){return n.matchesAll(j.searchFor)}];j.trigger("search:searching",m,j);j.renderHdas()}function h(m){j.$el.find(".history-search-controls").searchInput("toggle-loading");j.model.hdas.fetchAllDetails({silent:true}).always(function(){j.$el.find(".history-search-controls").searchInput("toggle-loading")}).done(function(){l(m)})}function k(){j.searchFor="";j.filters=[];j.trigger("search:clear",j);j.renderHdas()}return i.searchInput({initialVal:j.searchFor,name:"history-search",placeholder:"search datasets",classes:"history-search",onfirstsearch:h,onsearch:l,onclear:k})},toggleSearchControls:function(){var h=this.$el.find(".history-search-controls");if(!h.children().size()){h=this.renderSearchControls(h).hide()}h.slideToggle(this.fxSpeed,function(){if($(this).is(":visible")){this.searching=true;$(this).find("input").focus()}else{this.searching=false}})},showSelectors:function(h){this.selecting=true;this.$el.find(".history-dataset-actions").slideDown(h);_.each(this.hdaViews,function(i){i.showSelector(h)})},hideSelectors:function(h){this.selecting=false;this.$el.find(".history-dataset-actions").slideUp(h);_.each(this.hdaViews,function(i){i.hideSelector(h)})},toggleSelect:function(h){if(!this.selecting){this.showSelectors(h)}else{this.hideSelectors(h)}},selectAllDatasets:function(i){var h=this.$el.find(".history-select-all-datasets-btn");currMode=h.data("mode");if(currMode==="select"){_.each(this.hdaViews,function(j){j.select(i)});h.data("mode","deselect");h.text(_l("De-select all"))}else{if(currMode==="deselect"){_.each(this.hdaViews,function(j){j.deselect(i)});h.data("mode","select");h.text(_l("Select all"))}}},getSelectedHdaViews:function(){return _.filter(this.hdaViews,function(h){return h.selected})},getSelectedHdaCollection:function(){return new d.HDACollection(_.map(this.getSelectedHdaViews(),function(h){return h.model}),{historyId:this.model.id})},showLoadingIndicator:function(i,h,j){h=(h!==undefined)?(h):(this.fxSpeed);if(!this.indicator){this.indicator=new LoadingIndicator(this.$el,this.$el.parent())}if(!this.$el.is(":visible")){this.indicator.show(0,j)}else{this.$el.fadeOut(h);this.indicator.show(i,h,j)}},hideLoadingIndicator:function(h,i){h=(h!==undefined)?(h):(this.fxSpeed);if(this.indicator){this.indicator.hide(h,i)}},displayMessage:function(m,n,l){var j=this;this.scrollToTop();var k=this.$el.find(this.msgsSelector),h=$("<div/>").addClass(m+"message").html(n);if(!_.isEmpty(l)){var i=$('<a href="javascript:void(0)">Details</a>').click(function(){Galaxy.modal.show(j.messageToModalOptions(m,n,l));return false});h.append(" ",i)}return k.html(h)},messageToModalOptions:function(l,n,k){var h=this,m=$("<div/>"),j={title:"Details"};function i(o){o=_.omit(o,_.functions(o));return["<table>",_.map(o,function(q,p){q=(_.isObject(q))?(i(q)):(q);return'<tr><td style="vertical-align: top; color: grey">'+p+'</td><td style="padding-left: 8px">'+q+"</td></tr>"}).join(""),"</table>"].join("")}if(_.isObject(k)){j.body=m.append(i(k))}else{j.body=m.html(k)}j.buttons={Ok:function(){Galaxy.modal.hide();h.clearMessages()}};return j},clearMessages:function(){var h=this.$el.find(this.msgsSelector);h.empty()},scrollPosition:function(){return this.$el.parent().scrollTop()},scrollTo:function(h){this.$el.parent().scrollTop(h)},scrollToTop:function(){this.$el.parent().scrollTop(0);return this},scrollIntoView:function(i,j){if(!j){this.$el.parent().parent().scrollTop(i);return this}var h=window,k=this.$el.parent().parent(),m=$(h).innerHeight(),l=(m/2)-(j/2);$(k).scrollTop(i-l);return this},scrollToId:function(i){if((!i)||(!this.hdaViews[i])){return this}var h=this.hdaViews[i].$el;this.scrollIntoView(h.offset().top,h.outerHeight());return this},scrollToHid:function(h){var i=this.model.hdas.getByHid(h);if(!i){return this}return this.scrollToId(i.id)},connectToQuotaMeter:function(h){if(!h){return this}this.listenTo(h,"quota:over",this.showQuotaMessage);this.listenTo(h,"quota:under",this.hideQuotaMessage);this.on("rendered rendered:initial",function(){if(h&&h.isOverQuota()){this.showQuotaMessage()}});return this},showQuotaMessage:function(){var h=this.$el.find(".quota-message");if(h.is(":hidden")){h.slideDown(this.fxSpeed)}},hideQuotaMessage:function(){var h=this.$el.find(".quota-message");if(!h.is(":hidden")){h.slideUp(this.fxSpeed)}},connectToOptionsMenu:function(h){if(!h){return this}this.on("new-storage",function(j,i){if(h&&j){h.findItemByHtml(_l("Include Deleted Datasets")).checked=j.get("show_deleted");h.findItemByHtml(_l("Include Hidden Datasets")).checked=j.get("show_hidden")}});return this},toString:function(){return"HistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});e.templates={historyPanel:Handlebars.templates["template-history-historyPanel"],anonHistoryPanel:Handlebars.templates["template-history-historyPanel-anon"]};return{HistoryPanel:e}});
\ No newline at end of file
+define(["mvc/history/history-model","mvc/dataset/hda-model","mvc/dataset/hda-base","mvc/dataset/hda-edit"],function(g,d,b,a){var c=SessionStorageModel.extend({defaults:{expandedHdas:{},show_deleted:false,show_hidden:false},addExpandedHda:function(h){this.save("expandedHdas",_.extend(this.get("expandedHdas"),_.object([h],[true])))},removeExpandedHda:function(h){this.save("expandedHdas",_.omit(this.get("expandedHdas"),h))},toString:function(){return"HistoryPanelPrefs("+this.id+")"}});c.historyStorageKey=function f(h){if(!h){throw new Error("HistoryPanelPrefs.historyStorageKey needs valid id: "+h)}return("history:"+h)};var e=Backbone.View.extend(LoggableMixin).extend({HDAView:a.HDAEditView,tagName:"div",className:"history-panel",fxSpeed:"fast",datasetsSelector:".datasets-list",emptyMsgSelector:".empty-history-message",msgsSelector:".message-container",initialize:function(h){h=h||{};if(h.logger){this.logger=h.logger}this.log(this+".initialize:",h);this.linkTarget=h.linkTarget||"_blank";this._setUpListeners();this.hdaViews={};this.indicator=new LoadingIndicator(this.$el);this.filters=[];this.searching=h.searching||false;this.selecting=h.selecting||false;if(this.model){this._setUpWebStorage(h.initiallyExpanded,h.show_deleted,h.show_hidden);this._setUpModelEventHandlers()}if(h.onready){h.onready.call(this)}},_setUpListeners:function(){this.on("error",function(i,l,h,k,j){this.errorHandler(i,l,h,k,j)});this.on("loading-history",function(){this.showLoadingIndicator("loading history...")});this.on("loading-done",function(){this.hideLoadingIndicator()});this.once("rendered",function(){this.trigger("rendered:initial",this);return false});this.on("switched-history current-history new-history",function(){if(_.isEmpty(this.hdaViews)){this.trigger("empty-history",this)}});if(this.logger){this.on("all",function(h){this.log(this+"",arguments)},this)}},errorHandler:function(j,m,i,l,k){var h=this._parseErrorMessage(j,m,i,l,k);if(m&&m.status===0&&m.readyState===0){}else{if(m&&m.status===502){}else{if(!this.$el.find(this.msgsSelector).is(":visible")){this.once("rendered",function(){this.displayMessage("error",h.message,h.details)})}else{this.displayMessage("error",h.message,h.details)}}}},_parseErrorMessage:function(k,o,j,n,m){var i=Galaxy.currUser,h={message:this._bePolite(n),details:{user:(i instanceof User)?(i.toJSON()):(i+""),source:(k instanceof Backbone.Model)?(k.toJSON()):(k+""),xhr:o,options:(o)?(_.omit(j,"xhr")):(j)}};_.extend(h.details,m||{});if(o&&_.isFunction(o.getAllResponseHeaders)){var l=o.getAllResponseHeaders();l=_.compact(l.split("\n"));l=_.map(l,function(p){return p.split(": ")});h.details.xhr.responseHeaders=_.object(l)}return h},_bePolite:function(h){h=h||_l("An error occurred while getting updates from the server");return h+". "+_l("Please contact a Galaxy administrator if the problem persists.")},loadCurrentHistory:function(i){var h=this;return this.loadHistoryWithHDADetails("current",i).then(function(k,j){h.trigger("current-history",h)})},switchToHistory:function(k,j){var h=this,i=function(){return jQuery.post(galaxy_config.root+"api/histories/"+k+"/set_as_current")};return this.loadHistoryWithHDADetails(k,j,i).then(function(m,l){h.trigger("switched-history",h)})},createNewHistory:function(j){if(!Galaxy||!Galaxy.currUser||Galaxy.currUser.isAnonymous()){this.displayMessage("error",_l("You must be logged in to create histories"));return $.when()}var h=this,i=function(){return jQuery.post(galaxy_config.root+"api/histories",{current:true})};return this.loadHistory(undefined,j,i).then(function(l,k){h.trigger("new-history",h)})},loadHistoryWithHDADetails:function(k,j,i,m){var h=this,l=function(n){return h.getExpandedHdaIds(n.id)};return this.loadHistory(k,j,i,m,l)},loadHistory:function(k,j,i,n,l){this.trigger("loading-history",this);j=j||{};var h=this;var m=g.History.getHistoryData(k,{historyFn:i,hdaFn:n,hdaDetailIds:j.initiallyExpanded||l});return this._loadHistoryFromXHR(m,j).fail(function(q,o,p){h.trigger("error",h,q,j,_l("An error was encountered while "+o),{historyId:k,history:p||{}})}).always(function(){h.trigger("loading-done",h)})},_loadHistoryFromXHR:function(j,i){var h=this;j.then(function(k,l){h.setModel(k,l,i)});j.fail(function(l,k){h.render()});return j},setModel:function(j,h,i){i=i||{};if(this.model){this.model.clearUpdateTimeout();this.stopListening(this.model);this.stopListening(this.model.hdas)}this.hdaViews={};if(Galaxy&&Galaxy.currUser){j.user=Galaxy.currUser.toJSON()}this.model=new g.History(j,h,i);this._setUpWebStorage(i.initiallyExpanded,i.show_deleted,i.show_hidden);this._setUpModelEventHandlers();this.trigger("new-model",this);this.render();return this},_setUpWebStorage:function(i,h,j){this.storage=new c({id:c.historyStorageKey(this.model.get("id"))});if(_.isObject(i)){this.storage.set("exandedHdas",i)}if(_.isBoolean(h)){this.storage.set("show_deleted",h)}if(_.isBoolean(j)){this.storage.set("show_hidden",j)}this.trigger("new-storage",this.storage,this);this.log(this+" (init'd) storage:",this.storage.get())},clearWebStorage:function(){for(var h in sessionStorage){if(h.indexOf("history:")===0){sessionStorage.removeItem(h)}}},getStoredOptions:function(i){if(!i||i==="current"){return(this.storage)?(this.storage.get()):({})}var h=sessionStorage.getItem(c.historyStorageKey(i));return(h===null)?({}):(JSON.parse(h))},getExpandedHdaIds:function(h){var i=this.getStoredOptions(h).expandedHdas;return((_.isEmpty(i))?([]):(_.keys(i)))},_setUpModelEventHandlers:function(){this.model.on("error error:hdas",function(i,k,h,j){this.errorHandler(i,k,h,j)},this);this.model.on("change:nice_size",this.updateHistoryDiskSize,this);if(Galaxy&&Galaxy.quotaMeter){this.listenTo(this.model,"change:nice_size",function(){Galaxy.quotaMeter.update()})}this.model.hdas.on("add",this.addHdaView,this);this.model.hdas.on("change:deleted",this.handleHdaDeletionChange,this);this.model.hdas.on("change:visible",this.handleHdaVisibleChange,this);this.model.hdas.on("change:purged",function(h){this.model.fetch()},this);this.model.hdas.on("state:ready",function(i,j,h){if((!i.get("visible"))&&(!this.storage.get("show_hidden"))){this.removeHdaView(this.hdaViews[i.id])}},this)},render:function(j,k){j=(j===undefined)?(this.fxSpeed):(j);var h=this,i;if(this.model){i=this.renderModel()}else{i=this.renderWithoutModel()}$(h).queue("fx",[function(l){if(j&&h.$el.is(":visible")){h.$el.fadeOut(j,l)}else{l()}},function(l){h.$el.empty();if(i){h.$el.append(i.children())}l()},function(l){if(j&&!h.$el.is(":visible")){h.$el.fadeIn(j,l)}else{l()}},function(l){if(k){k.call(this)}h.trigger("rendered",this);l()}]);return this},renderWithoutModel:function(){var h=$("<div/>"),i=$("<div/>").addClass("message-container").css({"margin-left":"4px","margin-right":"4px"});return h.append(i)},renderModel:function(){var h=$("<div/>");if(!Galaxy||!Galaxy.currUser||Galaxy.currUser.isAnonymous()){h.append(e.templates.anonHistoryPanel(this.model.toJSON()))}else{h.append(e.templates.historyPanel(this.model.toJSON()));this._renderTags(h);this._renderAnnotation(h)}h.find(".history-secondary-actions").prepend(this._renderSearchButton());this._setUpBehaviours(h);this.renderHdas(h);return h},_renderTags:function(h){this.tagsEditor=new TagsEditor({model:this.model,el:h.find(".history-controls .tags-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit history tags"),classes:"history-tag-btn",faIcon:"fa-tags"}).appendTo(h.find(".history-secondary-actions"))})},_renderAnnotation:function(h){this.annotationEditor=new AnnotationEditor({model:this.model,el:h.find(".history-controls .annotation-display"),onshowFirstTime:function(){this.render()},$activator:faIconButton({title:_l("Edit history tags"),classes:"history-annotate-btn",faIcon:"fa-comment"}).appendTo(h.find(".history-secondary-actions"))})},_renderSearchButton:function(h){return faIconButton({title:_l("Search datasets"),classes:"history-search-btn",faIcon:"fa-search"})},_renderSelectButton:function(h){return faIconButton({title:_l("Operations on multiple datasets"),classes:"history-select-btn",faIcon:"fa-check-square-o"})},_setUpBehaviours:function(h){h=h||this.$el;h.find("[title]").tooltip({placement:"bottom"});if(!this.model||!Galaxy.currUser||Galaxy.currUser.isAnonymous()){return}var i=this;h.find(".history-name").make_text_editable({on_finish:function(j){h.find(".history-name").text(j);i.model.save({name:j}).fail(function(){h.find(".history-name").text(i.model.previous("name"))})}});this._setUpDatasetActionsPopup(h)},_setUpDatasetActionsPopup:function(h){var i=this;(new PopupMenu(h.find(".history-dataset-action-popup-btn"),[{html:_l("Hide datasets"),func:function(){var j=d.HistoryDatasetAssociation.prototype.hide;i.getSelectedHdaCollection().ajaxQueue(j)}},{html:_l("Unhide datasets"),func:function(){var j=d.HistoryDatasetAssociation.prototype.unhide;i.getSelectedHdaCollection().ajaxQueue(j)}},{html:_l("Delete datasets"),func:function(){var j=d.HistoryDatasetAssociation.prototype["delete"];i.getSelectedHdaCollection().ajaxQueue(j)}},{html:_l("Undelete datasets"),func:function(){var j=d.HistoryDatasetAssociation.prototype.undelete;i.getSelectedHdaCollection().ajaxQueue(j)}},{html:_l("Permanently delete datasets"),func:function(){if(confirm(_l("This will permanently remove the data in your datasets. Are you sure?"))){var j=d.HistoryDatasetAssociation.prototype.purge;i.getSelectedHdaCollection().ajaxQueue(j)}}}]))},refreshHdas:function(i,h){if(this.model){return this.model.refresh(i,h)}return $.when()},addHdaView:function(k){this.log("add."+this,k);var i=this;if(!k.isVisible(this.storage.get("show_deleted"),this.storage.get("show_hidden"))){return}$({}).queue([function j(m){var l=i.$el.find(i.emptyMsgSelector);if(l.is(":visible")){l.fadeOut(i.fxSpeed,m)}else{m()}},function h(m){i.scrollToTop();var l=i.$el.find(i.datasetsSelector);i.createHdaView(k).$el.hide().prependTo(l).slideDown(i.fxSpeed)}])},createHdaView:function(j){var i=j.get("id"),h=this.storage.get("expandedHdas")[i],k=new this.HDAView({model:j,linkTarget:this.linkTarget,expanded:h,selectable:this.selecting,hasUser:this.model.hasUser(),logger:this.logger});this._setUpHdaListeners(k);this.hdaViews[i]=k;return k.render()},_setUpHdaListeners:function(i){var h=this;i.on("body-expanded",function(j){h.storage.addExpandedHda(j)});i.on("body-collapsed",function(j){h.storage.removeExpandedHda(j)});i.on("error",function(k,m,j,l){h.errorHandler(k,m,j,l)})},handleHdaDeletionChange:function(h){if(h.get("deleted")&&!this.storage.get("show_deleted")){this.removeHdaView(this.hdaViews[h.id])}},handleHdaVisibleChange:function(h){if(h.hidden()&&!this.storage.get("show_hidden")){this.removeHdaView(this.hdaViews[h.id])}},removeHdaView:function(i){if(!i){return}var h=this;i.$el.fadeOut(h.fxSpeed,function(){i.off();i.remove();delete h.hdaViews[i.model.id];if(_.isEmpty(h.hdaViews)){h.$el.find(h.emptyMsgSelector).fadeIn(h.fxSpeed,function(){h.trigger("empty-history",h)})}})},renderHdas:function(j){j=j||this.$el;this.hdaViews={};var i=this,h=j.find(this.datasetsSelector),k=this.model.hdas.getVisible(this.storage.get("show_deleted"),this.storage.get("show_hidden"),this.filters);h.empty();if(k.length){k.each(function(l){h.prepend(i.createHdaView(l).$el)});j.find(this.emptyMsgSelector).hide()}else{j.find(this.emptyMsgSelector).show()}return this.hdaViews},events:{"click .message-container":"clearMessages","click .history-search-btn":"toggleSearchControls","click .history-select-btn":function(h){this.toggleSelect(this.fxSpeed)},"click .history-select-all-datasets-btn":"selectAllDatasets"},updateHistoryDiskSize:function(){this.$el.find(".history-size").text(this.model.get("nice_size"))},collapseAllHdaBodies:function(){_.each(this.hdaViews,function(h){h.toggleBodyVisibility(null,false)});this.storage.set("expandedHdas",{})},toggleShowDeleted:function(){this.storage.set("show_deleted",!this.storage.get("show_deleted"));this.renderHdas();return this.storage.get("show_deleted")},toggleShowHidden:function(){this.storage.set("show_hidden",!this.storage.get("show_hidden"));this.renderHdas();return this.storage.get("show_hidden")},renderSearchControls:function(i){var j=this;function l(m){j.searchFor=m;j.filters=[function(n){return n.matchesAll(j.searchFor)}];j.trigger("search:searching",m,j);j.renderHdas()}function h(m){j.$el.find(".history-search-controls").searchInput("toggle-loading");j.model.hdas.fetchAllDetails({silent:true}).always(function(){j.$el.find(".history-search-controls").searchInput("toggle-loading")}).done(function(){l(m)})}function k(){j.searchFor="";j.filters=[];j.trigger("search:clear",j);j.renderHdas()}return i.searchInput({initialVal:j.searchFor,name:"history-search",placeholder:"search datasets",classes:"history-search",onfirstsearch:h,onsearch:l,onclear:k})},toggleSearchControls:function(){var h=this.$el.find(".history-search-controls");if(!h.children().size()){h=this.renderSearchControls(h).hide()}h.slideToggle(this.fxSpeed,function(){if($(this).is(":visible")){this.searching=true;$(this).find("input").focus()}else{this.searching=false}})},showSelectors:function(h){this.selecting=true;this.$el.find(".history-dataset-actions").slideDown(h);_.each(this.hdaViews,function(i){i.showSelector(h)})},hideSelectors:function(h){this.selecting=false;this.$el.find(".history-dataset-actions").slideUp(h);_.each(this.hdaViews,function(i){i.hideSelector(h)})},toggleSelect:function(h){if(!this.selecting){this.showSelectors(h)}else{this.hideSelectors(h)}},selectAllDatasets:function(i){var h=this.$el.find(".history-select-all-datasets-btn");currMode=h.data("mode");if(currMode==="select"){_.each(this.hdaViews,function(j){j.select(i)});h.data("mode","deselect");h.text(_l("De-select all"))}else{if(currMode==="deselect"){_.each(this.hdaViews,function(j){j.deselect(i)});h.data("mode","select");h.text(_l("Select all"))}}},getSelectedHdaViews:function(){return _.filter(this.hdaViews,function(h){return h.selected})},getSelectedHdaCollection:function(){return new d.HDACollection(_.map(this.getSelectedHdaViews(),function(h){return h.model}),{historyId:this.model.id})},showLoadingIndicator:function(i,h,j){h=(h!==undefined)?(h):(this.fxSpeed);if(!this.indicator){this.indicator=new LoadingIndicator(this.$el,this.$el.parent())}if(!this.$el.is(":visible")){this.indicator.show(0,j)}else{this.$el.fadeOut(h);this.indicator.show(i,h,j)}},hideLoadingIndicator:function(h,i){h=(h!==undefined)?(h):(this.fxSpeed);if(this.indicator){this.indicator.hide(h,i)}},displayMessage:function(m,n,l){var j=this;this.scrollToTop();var k=this.$el.find(this.msgsSelector),h=$("<div/>").addClass(m+"message").html(n);if(!_.isEmpty(l)){var i=$('<a href="javascript:void(0)">Details</a>').click(function(){Galaxy.modal.show(j.messageToModalOptions(m,n,l));return false});h.append(" ",i)}return k.html(h)},messageToModalOptions:function(l,n,k){var h=this,m=$("<div/>"),j={title:"Details"};function i(o){o=_.omit(o,_.functions(o));return["<table>",_.map(o,function(q,p){q=(_.isObject(q))?(i(q)):(q);return'<tr><td style="vertical-align: top; color: grey">'+p+'</td><td style="padding-left: 8px">'+q+"</td></tr>"}).join(""),"</table>"].join("")}if(_.isObject(k)){j.body=m.append(i(k))}else{j.body=m.html(k)}j.buttons={Ok:function(){Galaxy.modal.hide();h.clearMessages()}};return j},clearMessages:function(){var h=this.$el.find(this.msgsSelector);h.empty()},scrollPosition:function(){return this.$el.parent().scrollTop()},scrollTo:function(h){this.$el.parent().scrollTop(h)},scrollToTop:function(){this.$el.parent().scrollTop(0);return this},scrollIntoView:function(i,j){if(!j){this.$el.parent().parent().scrollTop(i);return this}var h=window,k=this.$el.parent().parent(),m=$(h).innerHeight(),l=(m/2)-(j/2);$(k).scrollTop(i-l);return this},scrollToId:function(i){if((!i)||(!this.hdaViews[i])){return this}var h=this.hdaViews[i].$el;this.scrollIntoView(h.offset().top,h.outerHeight());return this},scrollToHid:function(h){var i=this.model.hdas.getByHid(h);if(!i){return this}return this.scrollToId(i.id)},connectToQuotaMeter:function(h){if(!h){return this}this.listenTo(h,"quota:over",this.showQuotaMessage);this.listenTo(h,"quota:under",this.hideQuotaMessage);this.on("rendered rendered:initial",function(){if(h&&h.isOverQuota()){this.showQuotaMessage()}});return this},showQuotaMessage:function(){var h=this.$el.find(".quota-message");if(h.is(":hidden")){h.slideDown(this.fxSpeed)}},hideQuotaMessage:function(){var h=this.$el.find(".quota-message");if(!h.is(":hidden")){h.slideUp(this.fxSpeed)}},connectToOptionsMenu:function(h){if(!h){return this}this.on("new-storage",function(j,i){if(h&&j){h.findItemByHtml(_l("Include Deleted Datasets")).checked=j.get("show_deleted");h.findItemByHtml(_l("Include Hidden Datasets")).checked=j.get("show_hidden")}});return this},toString:function(){return"HistoryPanel("+((this.model)?(this.model.get("name")):(""))+")"}});e.templates={historyPanel:Handlebars.templates["template-history-historyPanel"],anonHistoryPanel:Handlebars.templates["template-history-historyPanel-anon"]};return{HistoryPanel:e}});
\ No newline at end of file
diff -r 98eff59e4510c3a3137de7e5df38120bcda9be7f -r 6c8d175a4c241a192962bf40f578b223bf3299f1 templates/webapps/galaxy/history/history_panel.mako
--- a/templates/webapps/galaxy/history/history_panel.mako
+++ b/templates/webapps/galaxy/history/history_panel.mako
@@ -11,6 +11,7 @@
show_deleted : ${ 'true' if show_deleted == True else ( 'null' if show_deleted == None else 'false' ) },
show_hidden : ${ 'true' if show_hidden == True else ( 'null' if show_hidden == None else 'false' ) },
el : $( "${selector_to_attach_to}" ),
+ linkTarget : 'galaxy_main',
onready : function loadAsCurrentHistoryPanel(){
var panel = this;
this.connectToQuotaMeter( Galaxy.quotaMeter ).connectToOptionsMenu( Galaxy.historyOptionsMenu );
diff -r 98eff59e4510c3a3137de7e5df38120bcda9be7f -r 6c8d175a4c241a192962bf40f578b223bf3299f1 templates/webapps/galaxy/root/history.mako
--- a/templates/webapps/galaxy/root/history.mako
+++ b/templates/webapps/galaxy/root/history.mako
@@ -44,8 +44,6 @@
<script type="text/javascript">
function onModuleReady( historyPanel ){
- // attach a panel to selector_to_attach_to and use a history model with bootstrapped data
-
// history module is already in the dpn chain from the panel. We can re-scope it here.
var historyModel = require( 'mvc/history/history-model' ),
debugging = JSON.parse( sessionStorage.getItem( 'debugging' ) ) || false,
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: Masthead: move Galaxy.currUser out of ready function (bootstrap)
by commits-noreply@bitbucket.org 10 Dec '13
by commits-noreply@bitbucket.org 10 Dec '13
10 Dec '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/98eff59e4510/
Changeset: 98eff59e4510
User: carlfeberhard
Date: 2013-12-10 16:00:22
Summary: Masthead: move Galaxy.currUser out of ready function (bootstrap)
Affected #: 1 file
diff -r 4fbe7028d3a9104d0ad313cadb766ec64c877295 -r 98eff59e4510c3a3137de7e5df38120bcda9be7f templates/webapps/galaxy/galaxy.masthead.mako
--- a/templates/webapps/galaxy/galaxy.masthead.mako
+++ b/templates/webapps/galaxy/galaxy.masthead.mako
@@ -68,6 +68,11 @@
## load the frame manager
<script type="text/javascript">
+ if( !window.Galaxy ){
+ window.Galaxy = {};
+ }
+ ## fetch the current user data from trans
+ Galaxy.currUser = new User(${ h.to_json_string( get_user_json(), indent=2 ) });
## load additional style sheet
if (window != window.top)
@@ -85,9 +90,6 @@
## get configuration
var masthead_config = ${ h.to_json_string( masthead_config ) };
- ## set up the quota meter (And fetch the current user data from trans)
- Galaxy.currUser = new User(masthead_config.user.json);
-
## load global galaxy objects
Galaxy.masthead = new mod_masthead.GalaxyMasthead(masthead_config);
Galaxy.modal = new mod_modal.GalaxyModal();
@@ -102,6 +104,7 @@
## add upload plugin
##Galaxy.upload = new mod_upload.GalaxyUpload(masthead_config);
+ ## set up the quota meter (And fetch the current user data from trans)
## add quota meter to masthead
Galaxy.quotaMeter = new UserQuotaMeter({
model : Galaxy.currUser,
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: greg: Further restrict when the tool_functionally_correct column will be set to False in the Tool Shed's repository_metadata table.
by commits-noreply@bitbucket.org 10 Dec '13
by commits-noreply@bitbucket.org 10 Dec '13
10 Dec '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/4fbe7028d3a9/
Changeset: 4fbe7028d3a9
User: greg
Date: 2013-12-10 15:48:50
Summary: Further restrict when the tool_functionally_correct column will be set to False in the Tool Shed's repository_metadata table.
Affected #: 1 file
diff -r f7d0ed0413ea4f8ff4473b7bc97a49e8fb16b8f5 -r 4fbe7028d3a9104d0ad313cadb766ec64c877295 lib/tool_shed/scripts/check_repositories_for_functional_tests.py
--- a/lib/tool_shed/scripts/check_repositories_for_functional_tests.py
+++ b/lib/tool_shed/scripts/check_repositories_for_functional_tests.py
@@ -282,11 +282,10 @@
# In the install and test script, this behavior is slightly different, since we do want to always run functional
# tests on the most recent downloadable changeset revision.
if should_set_do_not_test_flag( app, repository, changeset_revision, testable_revision ):
- print "# Setting do_not_test to True on revision %s of repository %s because it is missing test components" % \
- ( changeset_revision, name )
+ print "# Setting do_not_test to True on revision %s of %s owned by %s because it is missing test components" % \
+ ( changeset_revision, name, owner )
print "# and it is not the latest downloadable revision."
repository_metadata.do_not_test = True
- repository_metadata.tools_functionally_correct = False
if not testable_revision:
# Even though some tools may be missing test components, it may be possible to test other tools. Since the
# install and test framework filters out repositories marked as missing test components, we'll set it only if
@@ -294,6 +293,9 @@
print '# Setting missing_test_components to True for revision %s of %s owned by %s because all tools are missing test components.' % \
( changeset_revision, name, owner )
repository_metadata.missing_test_components = True
+ print "# Setting tools_functionally_correct to False on revision %s of %s owned by %s because it is missing test components" % \
+ ( changeset_revision, name, owner )
+ repository_metadata.tools_functionally_correct = False
tool_test_results_dict[ 'missing_test_components' ] = missing_test_components
# Store only the configured number of test runs.
num_tool_test_results_saved = int( app.config.num_tool_test_results_saved )
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
5 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/3f05316ce541/
Changeset: 3f05316ce541
Branch: fretn/fix-for-two-issues-the-secondary-user-1385478183593
User: fretn
Date: 2013-11-26 16:04:57
Summary: Fix for two issues
- The secondary user groups are not assigned to the user
- When the json file is on a NFS share where root access is not allowed this script fails with a "error: JobTemplate file (/path/to/jsonfile) doesn't exist" error
To fix the first we have to go through all the groups of the user in set_user(uid) and assign them with os.setgroups()
The second one is fixed by removing the check if the json file exists in the function validate_paramters and move that check to a new function which is called after set_user(uid). Because its possible that the new user (the one in uid) has access to that file but root hasn't
Affected #: 1 file
diff -r 359a822b2e5da89973ce042942a9a10dd2b229e1 -r 3f05316ce541248c18ebc0700e1bb64e77e23e79 scripts/drmaa_external_runner.py
--- a/scripts/drmaa_external_runner.py
+++ b/scripts/drmaa_external_runner.py
@@ -53,6 +53,14 @@
sys.stderr.write("error: User name (%s) is not valid.\n" % username)
exit(1)
return pw.pw_uid
+
+def json_file_exists(json_filename):
+ if not os.path.exists(json_filename):
+ sys.stderr.write("error: JobTemplate file (%s) doesn't exist\n" % ( json_filename ) )
+ exit(1)
+
+ return True
+
def validate_paramters():
if len(sys.argv)<3:
sys.stderr.write("usage: %s [USER-ID] [JSON-JOB-TEMPLATE-FILE]\n" % sys.argv[0])
@@ -70,10 +78,6 @@
sys.stderr.write("error: userid must not be 0 (root)\n")
exit(1)
- if not os.path.exists(json_filename):
- sys.stderr.write("error: JobTemplate file (%s) doesn't exist\n" % ( json_filename ) )
- exit(1)
-
return uid, json_filename
def set_user(uid):
@@ -81,8 +85,15 @@
# Get user's default group and set it to current process to make sure file permissions are inherited correctly
# Solves issue with permission denied for JSON files
gid = pwd.getpwuid(uid).pw_gid
+ import grp
os.setgid(gid)
+ # Added lines to assure read/write permission for groups
+ user = pwd.getpwuid(uid).pw_name
+ groups = [g.gr_gid for g in grp.getgrall() if user in g.gr_mem]
+
+ os.setgroups(groups)
os.setuid(uid)
+
except OSError, e:
if e.errno == errno.EPERM:
sys.stderr.write("error: setuid(%d) failed: permission denied. Did you setup 'sudo' correctly for this script?\n" % uid )
@@ -97,7 +108,8 @@
exit(1)
def main():
userid, json_filename = validate_paramters()
- set_user(userid)
+ set_user(userid)
+ json_file_exists(json_filename)
s = drmaa.Session()
s.initialize()
jt = s.createJobTemplate()
https://bitbucket.org/galaxy/galaxy-central/commits/9368ca5624c8/
Changeset: 9368ca5624c8
User: jmchilton
Date: 2013-12-10 15:29:16
Summary: Merge pull request #267.
Affected #: 1 file
diff -r 292d68d7e6a101b4a8df06a9f09aa3d16403e14e -r 9368ca5624c8d7a2a84a6007e3a53a317a3e6a91 scripts/drmaa_external_runner.py
--- a/scripts/drmaa_external_runner.py
+++ b/scripts/drmaa_external_runner.py
@@ -53,6 +53,14 @@
sys.stderr.write("error: User name (%s) is not valid.\n" % username)
exit(1)
return pw.pw_uid
+
+def json_file_exists(json_filename):
+ if not os.path.exists(json_filename):
+ sys.stderr.write("error: JobTemplate file (%s) doesn't exist\n" % ( json_filename ) )
+ exit(1)
+
+ return True
+
def validate_paramters():
if len(sys.argv)<3:
sys.stderr.write("usage: %s [USER-ID] [JSON-JOB-TEMPLATE-FILE]\n" % sys.argv[0])
@@ -70,10 +78,6 @@
sys.stderr.write("error: userid must not be 0 (root)\n")
exit(1)
- if not os.path.exists(json_filename):
- sys.stderr.write("error: JobTemplate file (%s) doesn't exist\n" % ( json_filename ) )
- exit(1)
-
return uid, json_filename
def set_user(uid):
@@ -81,8 +85,15 @@
# Get user's default group and set it to current process to make sure file permissions are inherited correctly
# Solves issue with permission denied for JSON files
gid = pwd.getpwuid(uid).pw_gid
+ import grp
os.setgid(gid)
+ # Added lines to assure read/write permission for groups
+ user = pwd.getpwuid(uid).pw_name
+ groups = [g.gr_gid for g in grp.getgrall() if user in g.gr_mem]
+
+ os.setgroups(groups)
os.setuid(uid)
+
except OSError, e:
if e.errno == errno.EPERM:
sys.stderr.write("error: setuid(%d) failed: permission denied. Did you setup 'sudo' correctly for this script?\n" % uid )
@@ -97,7 +108,8 @@
exit(1)
def main():
userid, json_filename = validate_paramters()
- set_user(userid)
+ set_user(userid)
+ json_file_exists(json_filename)
s = drmaa.Session()
s.initialize()
jt = s.createJobTemplate()
https://bitbucket.org/galaxy/galaxy-central/commits/14487c8ad2ac/
Changeset: 14487c8ad2ac
User: jmchilton
Date: 2013-12-10 15:02:17
Summary: PEP-8 fixes for scripts/drmaa_external_runner.py.
Affected #: 1 file
diff -r 9368ca5624c8d7a2a84a6007e3a53a317a3e6a91 -r 14487c8ad2ac94bc51e62b3bb1c8ad5b37c8bc89 scripts/drmaa_external_runner.py
--- a/scripts/drmaa_external_runner.py
+++ b/scripts/drmaa_external_runner.py
@@ -14,7 +14,7 @@
#import simplejson as json
#import drmaa
new_path = [ os.path.join( os.getcwd(), "lib" ) ]
-new_path.extend( sys.path[1:] ) # remove scripts/ from the path
+new_path.extend( sys.path[1:] ) # remove scripts/ from the path
sys.path = new_path
from galaxy import eggs
@@ -25,27 +25,30 @@
import drmaa
DRMAA_jobTemplate_attributes = [ 'args', 'remoteCommand', 'outputPath', 'errorPath', 'nativeSpecification',
- 'jobName','email','project' ]
+ 'jobName', 'email', 'project' ]
+
def load_job_template_from_file(jt, filename):
- f = open(filename,'r')
+ f = open(filename, 'r')
data = json.load(f)
for attr in DRMAA_jobTemplate_attributes:
if attr in data:
setattr(jt, attr, data[attr])
+
def valid_numeric_userid(userid):
try:
uid = int(userid)
except:
return False
try:
- pw = pwd.getpwuid(uid)
+ pwd.getpwuid(uid)
except KeyError:
sys.stderr.write("error: User-ID (%d) is not valid.\n" % uid)
exit(1)
return True
+
def get_user_id_by_name(username):
try:
pw = pwd.getpwnam(username)
@@ -53,16 +56,19 @@
sys.stderr.write("error: User name (%s) is not valid.\n" % username)
exit(1)
return pw.pw_uid
-
+
+
def json_file_exists(json_filename):
if not os.path.exists(json_filename):
sys.stderr.write("error: JobTemplate file (%s) doesn't exist\n" % ( json_filename ) )
exit(1)
-
+
return True
+
def validate_paramters():
- if len(sys.argv)<3:
+
+ if len(sys.argv) < 3:
sys.stderr.write("usage: %s [USER-ID] [JSON-JOB-TEMPLATE-FILE]\n" % sys.argv[0])
exit(1)
@@ -80,6 +86,7 @@
return uid, json_filename
+
def set_user(uid):
try:
# Get user's default group and set it to current process to make sure file permissions are inherited correctly
@@ -96,16 +103,20 @@
except OSError, e:
if e.errno == errno.EPERM:
- sys.stderr.write("error: setuid(%d) failed: permission denied. Did you setup 'sudo' correctly for this script?\n" % uid )
+ sys.stderr.write( "error: setuid(%d) failed: permission denied. Did you setup 'sudo' correctly for this script?\n" % uid )
exit(1)
else:
pass
- if os.getuid()==0:
- sys.stderr.write("error: UID is 0 (root) after changing user. This script should not be run as root. aborting.\n" )
+
+ if os.getuid() == 0:
+ sys.stderr.write( "error: UID is 0 (root) after changing user. This script should not be run as root. aborting.\n" )
exit(1)
- if os.geteuid()==0:
- sys.stderr.write("error: EUID is 0 (root) after changing user. This script should not be run as root. aborting.\n" )
+
+ if os.geteuid() == 0:
+ sys.stderr.write( "error: EUID is 0 (root) after changing user. This script should not be run as root. aborting.\n" )
exit(1)
+
+
def main():
userid, json_filename = validate_paramters()
set_user(userid)
@@ -124,4 +135,3 @@
if __name__ == "__main__":
main()
-
https://bitbucket.org/galaxy/galaxy-central/commits/f7d0ed0413ea/
Changeset: f7d0ed0413ea
User: jmchilton
Date: 2013-12-10 15:26:22
Summary: Rework contribution from pull request #267 to be optional.
To obtain the behavior (assigning all groups for a given user for each job submission) change the property - 'drmaa_external_runjob_script' from 'scripts/drmaa_external_runner.py' to 'scripts/drmaa_external_runner.py --assign_all_groups'.
Making this optional because my concern is that this could be an expensive operation on some clusters.
Affected #: 2 files
diff -r 14487c8ad2ac94bc51e62b3bb1c8ad5b37c8bc89 -r f7d0ed0413ea4f8ff4473b7bc97a49e8fb16b8f5 lib/galaxy/jobs/runners/drmaa.py
--- a/lib/galaxy/jobs/runners/drmaa.py
+++ b/lib/galaxy/jobs/runners/drmaa.py
@@ -302,7 +302,15 @@
The external script will be run with sudo, and will setuid() to the specified user.
Effectively, will QSUB as a different user (then the one used by Galaxy).
"""
- p = subprocess.Popen([ '/usr/bin/sudo', '-E', self.external_runJob_script, str(username), jobtemplate_filename ],
+ script_parts = self.external_runJob_script.split()
+ script = script_parts[0]
+ command = [ '/usr/bin/sudo', '-E', script]
+ for script_argument in script_parts[1:]:
+ command.append(script_argument)
+
+ command.extend( [ str(username), jobtemplate_filename ] )
+ log.info("Running command %s" % command)
+ p = subprocess.Popen(command,
shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(stdoutdata, stderrdata) = p.communicate()
exitcode = p.returncode
diff -r 14487c8ad2ac94bc51e62b3bb1c8ad5b37c8bc89 -r f7d0ed0413ea4f8ff4473b7bc97a49e8fb16b8f5 scripts/drmaa_external_runner.py
--- a/scripts/drmaa_external_runner.py
+++ b/scripts/drmaa_external_runner.py
@@ -67,6 +67,10 @@
def validate_paramters():
+ assign_all_groups = False
+ if "--assign_all_groups" in sys.argv:
+ assign_all_groups = True
+ sys.argv.remove("--assign_all_groups")
if len(sys.argv) < 3:
sys.stderr.write("usage: %s [USER-ID] [JSON-JOB-TEMPLATE-FILE]\n" % sys.argv[0])
@@ -84,21 +88,22 @@
sys.stderr.write("error: userid must not be 0 (root)\n")
exit(1)
- return uid, json_filename
+ return uid, json_filename, assign_all_groups
-def set_user(uid):
+def set_user(uid, assign_all_groups):
try:
# Get user's default group and set it to current process to make sure file permissions are inherited correctly
# Solves issue with permission denied for JSON files
gid = pwd.getpwuid(uid).pw_gid
import grp
os.setgid(gid)
- # Added lines to assure read/write permission for groups
- user = pwd.getpwuid(uid).pw_name
- groups = [g.gr_gid for g in grp.getgrall() if user in g.gr_mem]
+ if assign_all_groups:
+ # Added lines to assure read/write permission for groups
+ user = pwd.getpwuid(uid).pw_name
+ groups = [g.gr_gid for g in grp.getgrall() if user in g.gr_mem]
- os.setgroups(groups)
+ os.setgroups(groups)
os.setuid(uid)
except OSError, e:
@@ -118,8 +123,8 @@
def main():
- userid, json_filename = validate_paramters()
- set_user(userid)
+ userid, json_filename, assign_all_groups = validate_paramters()
+ set_user(userid, assign_all_groups)
json_file_exists(json_filename)
s = drmaa.Session()
s.initialize()
https://bitbucket.org/galaxy/galaxy-central/commits/b8efe5c848f0/
Changeset: b8efe5c848f0
Branch: fretn/fix-for-two-issues-the-secondary-user-1385478183593
User: jmchilton
Date: 2013-12-10 15:36:12
Summary: Close branch.
Affected #: 0 files
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
5 new commits in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/e9c37e7632c6/
Changeset: e9c37e7632c6
User: jmchilton
Date: 2013-12-10 00:14:39
Summary: Update LWR client through LWR changeset 295fbb09de58.
Main addition here is introduction of logic for handling of implicit working directory files - namely those needed for variable count outputs (should work immediately) and setting metadata externally (requires additional changes).
Fixes bugs related to uploading empty working directory files (cannot mmap empty file) and incorrectly cleaning up of sucessful jobs when cleanup_job=never. As well as various readibility-centric refactorings.
Most interesting LWR commits this covers includes:
https://bitbucket.org/jmchilton/lwr/commits/1886ad1c0951605d2bc1a6e167f84f5…
https://bitbucket.org/jmchilton/lwr/commits/295fbb09de582a369e72d4331708be3…
https://bitbucket.org/jmchilton/lwr/commits/45f0c818b91adfd63a9a4b3488a4a0d…
Affected #: 6 files
diff -r 142006369d22f60a12c4573a782bbb30c58efbb9 -r e9c37e7632c66a555cfeabb3d1dfa30d8b621881 lib/galaxy/jobs/runners/lwr.py
--- a/lib/galaxy/jobs/runners/lwr.py
+++ b/lib/galaxy/jobs/runners/lwr.py
@@ -12,6 +12,7 @@
from .lwr_client import ClientManager, url_to_destination_params
from .lwr_client import finish_job as lwr_finish_job
from .lwr_client import submit_job as lwr_submit_job
+from .lwr_client import ClientJobDescription
log = logging.getLogger( __name__ )
@@ -78,12 +79,15 @@
try:
client = self.get_client_from_wrapper(job_wrapper)
- output_files = self.get_output_files(job_wrapper)
- input_files = job_wrapper.get_input_fnames()
- working_directory = job_wrapper.working_directory
- tool = job_wrapper.tool
- config_files = job_wrapper.extra_filenames
- job_id = lwr_submit_job(client, tool, command_line, config_files, input_files, output_files, working_directory)
+ client_job_description = ClientJobDescription(
+ command_line=command_line,
+ output_files=self.get_output_files(job_wrapper),
+ input_files=job_wrapper.get_input_fnames(),
+ working_directory=job_wrapper.working_directory,
+ tool=job_wrapper.tool,
+ config_files=job_wrapper.extra_filenames,
+ )
+ job_id = lwr_submit_job(client, client_job_description)
log.info("lwr job submitted with job_id %s" % job_id)
job_wrapper.set_job_destination( job_destination, job_id )
job_wrapper.change_state( model.Job.states.QUEUED )
diff -r 142006369d22f60a12c4573a782bbb30c58efbb9 -r e9c37e7632c66a555cfeabb3d1dfa30d8b621881 lib/galaxy/jobs/runners/lwr_client/__init__.py
--- a/lib/galaxy/jobs/runners/lwr_client/__init__.py
+++ b/lib/galaxy/jobs/runners/lwr_client/__init__.py
@@ -6,9 +6,9 @@
"""
-from .stager import submit_job, finish_job
+from .stager import submit_job, finish_job, ClientJobDescription
from .client import OutputNotFoundException
from .manager import ClientManager
from .destination import url_to_destination_params
-__all__ = [ClientManager, OutputNotFoundException, url_to_destination_params, finish_job, submit_job]
+__all__ = [ClientManager, OutputNotFoundException, url_to_destination_params, finish_job, submit_job, ClientJobDescription]
diff -r 142006369d22f60a12c4573a782bbb30c58efbb9 -r e9c37e7632c66a555cfeabb3d1dfa30d8b621881 lib/galaxy/jobs/runners/lwr_client/client.py
--- a/lib/galaxy/jobs/runners/lwr_client/client.py
+++ b/lib/galaxy/jobs/runners/lwr_client/client.py
@@ -50,8 +50,7 @@
return "No remote output found for path %s" % self.path
-# TODO: Rename to job client.
-class Client(object):
+class JobClient(object):
"""
Objects of this client class perform low-level communication with a remote LWR server.
@@ -162,25 +161,23 @@
raise Exception("Unknown output_type returned from LWR server %s" % output_type)
return output_path
- def fetch_work_dir_output(self, source, working_directory, output_path, action='transfer'):
+ def fetch_work_dir_output(self, name, working_directory, output_path, action='transfer'):
"""
Download an output dataset specified with from_work_dir from the
remote server.
**Parameters**
- source : str
+ name : str
Path in job's working_directory to find output in.
working_directory : str
Local working_directory for the job.
output_path : str
Full path to output dataset.
"""
- output = open(output_path, "wb")
- name = os.path.basename(source)
if action == 'transfer':
- self.__raw_download_output(name, self.job_id, "work_dir", output)
- elif action == 'copy':
+ self.__raw_download_output(name, self.job_id, "work_dir", output_path)
+ else: # Even if action is none - LWR has a different work_dir so this needs to be copied.
lwr_path = self._output_path(name, self.job_id, 'work_dir')['path']
self._copy(lwr_path, output_path)
@@ -286,13 +283,13 @@
shutil.copyfile(source, destination)
-class InputCachingClient(Client):
+class InputCachingJobClient(JobClient):
"""
Beta client that cache's staged files to prevent duplication.
"""
def __init__(self, destination_params, job_id, job_manager_interface, client_cacher):
- super(InputCachingClient, self).__init__(destination_params, job_id, job_manager_interface)
+ super(InputCachingJobClient, self).__init__(destination_params, job_id, job_manager_interface)
self.client_cacher = client_cacher
@parseJson()
diff -r 142006369d22f60a12c4573a782bbb30c58efbb9 -r e9c37e7632c66a555cfeabb3d1dfa30d8b621881 lib/galaxy/jobs/runners/lwr_client/manager.py
--- a/lib/galaxy/jobs/runners/lwr_client/manager.py
+++ b/lib/galaxy/jobs/runners/lwr_client/manager.py
@@ -18,7 +18,8 @@
except ImportError:
from galaxy.util import unicodify as text_type
-from .client import Client, InputCachingClient
+from .client import JobClient
+from .client import InputCachingJobClient
from .client import ObjectStoreClient
from .transport import get_transport
from .util import TransferEventManager
@@ -51,11 +52,11 @@
if cache:
log.info("Setting LWR client class to caching variant.")
self.client_cacher = ClientCacher(**kwds)
- self.client_class = InputCachingClient
+ self.client_class = InputCachingJobClient
self.extra_client_kwds = {"client_cacher": self.client_cacher}
else:
log.info("Setting LWR client class to standard, non-caching variant.")
- self.client_class = Client
+ self.client_class = JobClient
self.extra_client_kwds = {}
def get_client(self, destination_params, job_id):
diff -r 142006369d22f60a12c4573a782bbb30c58efbb9 -r e9c37e7632c66a555cfeabb3d1dfa30d8b621881 lib/galaxy/jobs/runners/lwr_client/stager.py
--- a/lib/galaxy/jobs/runners/lwr_client/stager.py
+++ b/lib/galaxy/jobs/runners/lwr_client/stager.py
@@ -1,6 +1,7 @@
from os.path import abspath, basename, join, exists
from os import listdir, sep
from re import findall
+from re import compile
from io import open
from .action_mapper import FileActionMapper
@@ -8,6 +9,12 @@
from logging import getLogger
log = getLogger(__name__)
+# All output files marked with from_work_dir attributes will copied or downloaded
+# this pattern picks up attiditional files to copy back - such as those
+# associated with multiple outputs and metadata configuration. Set to .* to just
+# copy everything
+COPY_FROM_WORKING_DIRECTORY_PATTERN = compile(r"primary_.*|galaxy.json|metadata_.*")
+
class JobInputs(object):
"""
@@ -157,35 +164,24 @@
**Parameters**
- client : Client
+ client : JobClient
LWR client object.
- command_line : str
- The local command line to execute, this will be rewritten for the remote server.
- config_files : list
- List of Galaxy 'configfile's produced for this job. These will be rewritten and sent to remote server.
- input_files : list
- List of input files used by job. These will be transferred and references rewritten.
- output_files : list
- List of output_files produced by job.
- tool_dir : str
- Directory containing tool to execute (if a wrapper is used, it will be transferred to remote server).
- working_directory : str
- Local path created by Galaxy for running this job.
-
+ client_job_description : client_job_description
+ Description of client view of job to stage and execute remotely.
"""
- def __init__(self, client, tool, command_line, config_files, input_files, output_files, working_directory):
+ def __init__(self, client, client_job_description, job_config):
"""
"""
self.client = client
- self.command_line = command_line
- self.config_files = config_files
- self.input_files = input_files
- self.output_files = output_files
- self.tool_id = tool.id
- self.tool_version = tool.version
- self.tool_dir = abspath(tool.tool_dir)
- self.working_directory = working_directory
+ self.command_line = client_job_description.command_line
+ self.config_files = client_job_description.config_files
+ self.input_files = client_job_description.input_files
+ self.output_files = client_job_description.output_files
+ self.tool_id = client_job_description.tool.id
+ self.tool_version = client_job_description.tool.version
+ self.tool_dir = abspath(client_job_description.tool.tool_dir)
+ self.working_directory = client_job_description.working_directory
# Setup job inputs, these will need to be rewritten before
# shipping off to remote LWR server.
@@ -193,7 +189,7 @@
self.transfer_tracker = TransferTracker(client, self.job_inputs)
- self.__handle_setup()
+ self.__handle_setup(job_config)
self.__initialize_referenced_tool_files()
self.__upload_tool_files()
self.__upload_input_files()
@@ -204,8 +200,9 @@
self.__handle_rewrites()
self.__upload_rewritten_config_files()
- def __handle_setup(self):
- job_config = self.client.setup(self.tool_id, self.tool_version)
+ def __handle_setup(self, job_config):
+ if not job_config:
+ job_config = self.client.setup(self.tool_id, self.tool_version)
self.new_working_directory = job_config['working_directory']
self.new_outputs_directory = job_config['outputs_directory']
@@ -297,32 +294,49 @@
return self.job_inputs.rewritten_command_line
-def finish_job(client, cleanup_job, job_completed_normally, working_directory, work_dir_outputs, output_files):
+def finish_job(client, cleanup_job, job_completed_normally, working_directory, work_dir_outputs, output_files, working_directory_contents=[]):
"""
"""
action_mapper = FileActionMapper(client)
download_failure_exceptions = []
+ downloaded_working_directory_files = []
if job_completed_normally:
+ # Fetch explicit working directory outputs.
for source_file, output_file in work_dir_outputs:
+ name = basename(source_file)
try:
action = action_mapper.action(output_file, 'output')
- client.fetch_work_dir_output(source_file, working_directory, output_file, action[0])
+ client.fetch_work_dir_output(name, working_directory, output_file, action[0])
+ downloaded_working_directory_files.append(name)
except Exception as e:
download_failure_exceptions.append(e)
# Remove from full output_files list so don't try to download directly.
output_files.remove(output_file)
+
+ # Fetch output files.
for output_file in output_files:
try:
action = action_mapper.action(output_file, 'output')
client.fetch_output(output_file, working_directory=working_directory, action=action[0])
except Exception as e:
download_failure_exceptions.append(e)
+
+ # Fetch remaining working directory outputs of interest.
+ for name in working_directory_contents:
+ if name in downloaded_working_directory_files:
+ continue
+ if COPY_FROM_WORKING_DIRECTORY_PATTERN.match(name):
+ output_file = join(working_directory, name)
+ action = action_mapper.action(output_file, 'output')
+ client.fetch_work_dir_output(name, working_directory, output_file, action=action[0])
+ downloaded_working_directory_files.append(name)
+
return __clean(download_failure_exceptions, cleanup_job, client)
def __clean(download_failure_exceptions, cleanup_job, client):
failed = (len(download_failure_exceptions) > 0)
- if not failed or cleanup_job == "always":
+ if (not failed and cleanup_job != "never") or cleanup_job == "always":
try:
client.clean()
except:
@@ -330,10 +344,10 @@
return failed
-def submit_job(client, tool, command_line, config_files, input_files, output_files, working_directory):
+def submit_job(client, client_job_description, job_config=None):
"""
"""
- file_stager = FileStager(client, tool, command_line, config_files, input_files, output_files, working_directory)
+ file_stager = FileStager(client, client_job_description, job_config)
rebuilt_command_line = file_stager.get_rewritten_command_line()
job_id = file_stager.job_id
client.launch(rebuilt_command_line)
@@ -351,4 +365,33 @@
finally:
input.close()
-__all__ = [submit_job, finish_job]
+
+class ClientJobDescription(object):
+ """ A description of how client views job - command_line, inputs, etc..
+
+ **Parameters**
+
+ command_line : str
+ The local command line to execute, this will be rewritten for the remote server.
+ config_files : list
+ List of Galaxy 'configfile's produced for this job. These will be rewritten and sent to remote server.
+ input_files : list
+ List of input files used by job. These will be transferred and references rewritten.
+ output_files : list
+ List of output_files produced by job.
+ tool_dir : str
+ Directory containing tool to execute (if a wrapper is used, it will be transferred to remote server).
+ working_directory : str
+ Local path created by Galaxy for running this job.
+ """
+
+ def __init__(self, tool, command_line, config_files, input_files, output_files, working_directory):
+ self.tool = tool
+ self.command_line = command_line
+ self.config_files = config_files
+ self.input_files = input_files
+ self.output_files = output_files
+ self.working_directory = working_directory
+
+
+__all__ = [submit_job, ClientJobDescription, finish_job]
diff -r 142006369d22f60a12c4573a782bbb30c58efbb9 -r e9c37e7632c66a555cfeabb3d1dfa30d8b621881 lib/galaxy/jobs/runners/lwr_client/transport/standard.py
--- a/lib/galaxy/jobs/runners/lwr_client/transport/standard.py
+++ b/lib/galaxy/jobs/runners/lwr_client/transport/standard.py
@@ -2,6 +2,7 @@
LWR HTTP Client layer based on Python Standard Library (urllib2)
"""
from __future__ import with_statement
+from os.path import getsize
import mmap
try:
from urllib2 import urlopen
@@ -23,8 +24,11 @@
input = None
try:
if input_path:
- input = open(input_path, 'rb')
- data = mmap.mmap(input.fileno(), 0, access=mmap.ACCESS_READ)
+ if getsize(input_path):
+ input = open(input_path, 'rb')
+ data = mmap.mmap(input.fileno(), 0, access=mmap.ACCESS_READ)
+ else:
+ data = b""
response = self._url_open(request, data)
finally:
if input:
https://bitbucket.org/galaxy/galaxy-central/commits/36d360516828/
Changeset: 36d360516828
User: jmchilton
Date: 2013-12-10 00:14:39
Summary: Allow command_factory.build_command to pass in metadata kwds.
Add unit tests both for the old default parameters and the ability to replace these defaults.
This is all in case one wants to run the set metadata command on a remote server with different galaxy path, output paths, etc....
Affected #: 2 files
diff -r e9c37e7632c66a555cfeabb3d1dfa30d8b621881 -r 36d3605168283f888bf7f415a60805de11e0bd3e lib/galaxy/jobs/command_factory.py
--- a/lib/galaxy/jobs/command_factory.py
+++ b/lib/galaxy/jobs/command_factory.py
@@ -2,7 +2,7 @@
from os.path import abspath
-def build_command( job, job_wrapper, include_metadata=False, include_work_dir_outputs=True ):
+def build_command( job, job_wrapper, include_metadata=False, include_work_dir_outputs=True, metadata_kwds={} ):
"""
Compose the sequence of commands necessary to execute a job. This will
currently include:
@@ -55,11 +55,15 @@
# Append metadata setting commands, we don't want to overwrite metadata
# that was copied over in init_meta(), as per established behavior
if include_metadata and job_wrapper.requires_setting_metadata:
+ exec_dir = metadata_kwds.get( 'exec_dir', abspath( getcwd() ) )
+ tmp_dir = metadata_kwds.get( 'tmp_dir', job_wrapper.working_directory )
+ dataset_files_path = metadata_kwds.get( 'dataset_files_path', job.app.model.Dataset.file_path )
+ output_fnames = metadata_kwds.get( 'output_fnames', job_wrapper.get_output_fnames() )
metadata_command = job_wrapper.setup_external_metadata(
- exec_dir=abspath( getcwd() ),
- tmp_dir=job_wrapper.working_directory,
- dataset_files_path=job.app.model.Dataset.file_path,
- output_fnames=job_wrapper.get_output_fnames(),
+ exec_dir=exec_dir,
+ tmp_dir=tmp_dir,
+ dataset_files_path=dataset_files_path,
+ output_fnames=output_fnames,
set_extension=False,
kwds={ 'overwrite' : False }
) or ''
diff -r e9c37e7632c66a555cfeabb3d1dfa30d8b621881 -r 36d3605168283f888bf7f415a60805de11e0bd3e test/unit/test_command_factory.py
--- a/test/unit/test_command_factory.py
+++ b/test/unit/test_command_factory.py
@@ -5,13 +5,15 @@
from galaxy.util.bunch import Bunch
MOCK_COMMAND_LINE = "/opt/galaxy/tools/bowtie /mnt/galaxyData/files/000/input000.dat"
+TEST_METADATA_LINE = "set_metadata_and_stuff.sh"
+TEST_FILES_PATH = "file_path"
class TestCommandFactory(TestCase):
def setUp(self):
self.job_wrapper = MockJobWrapper()
- self.job = Bunch(app=Bunch(model=Bunch(Dataset=Bunch(file_path="file_path"))))
+ self.job = Bunch(app=Bunch(model=Bunch(Dataset=Bunch(file_path=TEST_FILES_PATH))))
self.include_metadata = False
self.include_work_dir_outputs = True
@@ -40,9 +42,8 @@
def _test_set_metadata(self):
self.include_metadata = True
self.include_work_dir_outputs = False
- metadata_line = "set_metadata_and_stuff.sh"
- self.job_wrapper.metadata_line = metadata_line
- expected_command = '%s; return_code=$?; cd %s; %s; sh -c "exit $return_code"' % (MOCK_COMMAND_LINE, getcwd(), metadata_line)
+ self.job_wrapper.metadata_line = TEST_METADATA_LINE
+ expected_command = '%s; return_code=$?; cd %s; %s; sh -c "exit $return_code"' % (MOCK_COMMAND_LINE, getcwd(), TEST_METADATA_LINE)
self.__assert_command_is( expected_command )
def test_empty_metadata(self):
@@ -55,18 +56,47 @@
# Empty metadata command do not touch command line.
expected_command = '%s' % (MOCK_COMMAND_LINE)
self.__assert_command_is( expected_command )
-
-
- def __assert_command_is(self, expected_command):
- command = self.__command()
+
+ def test_metadata_kwd_defaults(self):
+ configured_kwds = self.__set_metadata_with_kwds()
+ assert configured_kwds['exec_dir'] == getcwd()
+ assert configured_kwds['tmp_dir'] == self.job_wrapper.working_directory
+ assert configured_kwds['dataset_files_path'] == TEST_FILES_PATH
+ assert configured_kwds['output_fnames'] == ['output1']
+
+ def test_metadata_kwds_overrride(self):
+ configured_kwds = self.__set_metadata_with_kwds(
+ exec_dir="/path/to/remote/galaxy",
+ tmp_dir="/path/to/remote/staging/directory/job1",
+ dataset_files_path="/path/to/remote/datasets/",
+ output_fnames=['/path/to/remote_output1'],
+ )
+ assert configured_kwds['exec_dir'] == "/path/to/remote/galaxy"
+ assert configured_kwds['tmp_dir'] == "/path/to/remote/staging/directory/job1"
+ assert configured_kwds['dataset_files_path'] == "/path/to/remote/datasets/"
+ assert configured_kwds['output_fnames'] == ['/path/to/remote_output1']
+
+ def __set_metadata_with_kwds(self, **kwds):
+ self.include_metadata = True
+ self.include_work_dir_outputs = False
+ self.job_wrapper.metadata_line = TEST_METADATA_LINE
+ if kwds:
+ self.__command(metadata_kwds=kwds)
+ else:
+ self.__command()
+ return self.job_wrapper.configured_external_metadata_kwds
+
+ def __assert_command_is(self, expected_command, **command_kwds):
+ command = self.__command(**command_kwds)
self.assertEqual(command, expected_command)
- def __command(self):
+ def __command(self, **extra_kwds):
kwds = dict(
job=self.job,
job_wrapper=self.job_wrapper,
include_metadata=self.include_metadata,
include_work_dir_outputs=self.include_work_dir_outputs,
+ **extra_kwds
)
return build_command(**kwds)
@@ -78,6 +108,7 @@
self.command_line = MOCK_COMMAND_LINE
self.dependency_shell_commands = []
self.metadata_line = None
+ self.configured_external_metadata_kwds = None
self.working_directory = "job1"
def get_command_line(self):
@@ -88,10 +119,11 @@
return self.metadata_line is not None
def setup_external_metadata(self, *args, **kwds):
+ self.configured_external_metadata_kwds = kwds
return self.metadata_line
def get_output_fnames(self):
- return []
+ return ["output1"]
class MockJob(object):
https://bitbucket.org/galaxy/galaxy-central/commits/2be38856ea2d/
Changeset: 2be38856ea2d
User: jmchilton
Date: 2013-12-10 00:14:39
Summary: Eliminate non-specific exception catching in LWR runner.
This is a Python anti-pattern that should probably be eliminated throughout Galaxy.
Affected #: 1 file
diff -r 36d3605168283f888bf7f415a60805de11e0bd3e -r 2be38856ea2d50f04931f3c7343630a5211385f4 lib/galaxy/jobs/runners/lwr.py
--- a/lib/galaxy/jobs/runners/lwr.py
+++ b/lib/galaxy/jobs/runners/lwr.py
@@ -67,7 +67,7 @@
raise Exception('Error running file staging command: %s' % cmd)
job_wrapper.prepare_input_files_cmds = None # prevent them from being used in-line
command_line = self.build_command_line( job_wrapper, include_metadata=False, include_work_dir_outputs=False )
- except:
+ except Exception:
job_wrapper.fail( "failure preparing job", exception=True )
log.exception("failure running job %d" % job_wrapper.job_id)
return
@@ -91,7 +91,7 @@
log.info("lwr job submitted with job_id %s" % job_id)
job_wrapper.set_job_destination( job_destination, job_id )
job_wrapper.change_state( model.Job.states.QUEUED )
- except:
+ except Exception:
job_wrapper.fail( "failure running job", exception=True )
log.exception("failure running job %d" % job_wrapper.job_id)
return
@@ -152,7 +152,7 @@
if failed:
job_wrapper.fail("Failed to find or download one or more job outputs from remote server.", exception=True)
- except:
+ except Exception:
message = "Failed to communicate with remote job server."
job_wrapper.fail( message, exception=True )
log.exception("failure running job %d" % job_wrapper.job_id)
@@ -161,7 +161,7 @@
# Finish the job
try:
job_wrapper.finish( stdout, stderr )
- except:
+ except Exception:
log.exception("Job wrapper finish method failed")
job_wrapper.fail("Unable to finish job", exception=True)
https://bitbucket.org/galaxy/galaxy-central/commits/0ed67d508ba3/
Changeset: 0ed67d508ba3
User: jmchilton
Date: 2013-12-10 00:14:39
Summary: Refactor queue_job in LWR job runner to more managable pieces.
Affected #: 1 file
diff -r 2be38856ea2d50f04931f3c7343630a5211385f4 -r 0ed67d508ba30090453b793bee5283b6a87c9c6d lib/galaxy/jobs/runners/lwr.py
--- a/lib/galaxy/jobs/runners/lwr.py
+++ b/lib/galaxy/jobs/runners/lwr.py
@@ -55,30 +55,14 @@
return job_state
def queue_job(self, job_wrapper):
- command_line = ''
job_destination = job_wrapper.job_destination
- try:
- job_wrapper.prepare()
- if hasattr(job_wrapper, 'prepare_input_files_cmds') and job_wrapper.prepare_input_files_cmds is not None:
- for cmd in job_wrapper.prepare_input_files_cmds: # run the commands to stage the input files
- #log.debug( 'executing: %s' % cmd )
- if 0 != os.system(cmd):
- raise Exception('Error running file staging command: %s' % cmd)
- job_wrapper.prepare_input_files_cmds = None # prevent them from being used in-line
- command_line = self.build_command_line( job_wrapper, include_metadata=False, include_work_dir_outputs=False )
- except Exception:
- job_wrapper.fail( "failure preparing job", exception=True )
- log.exception("failure running job %d" % job_wrapper.job_id)
- return
+ command_line, client = self.__prepare_job( job_wrapper, job_destination )
- # If we were able to get a command line, run the job
if not command_line:
- job_wrapper.finish( '', '' )
return
try:
- client = self.get_client_from_wrapper(job_wrapper)
client_job_description = ClientJobDescription(
command_line=command_line,
output_files=self.get_output_files(job_wrapper),
@@ -104,6 +88,37 @@
lwr_job_state.job_destination = job_destination
self.monitor_job(lwr_job_state)
+ def __prepare_job(self, job_wrapper, job_destination):
+ """ Build command-line and LWR client for this job. """
+ command_line = None
+ client = None
+
+ try:
+ job_wrapper.prepare()
+ self.__prepare_input_files_locally(job_wrapper)
+ command_line = self.build_command_line( job_wrapper, include_metadata=False, include_work_dir_outputs=False )
+ client = self.get_client_from_wrapper(job_wrapper)
+ except Exception:
+ job_wrapper.fail( "failure preparing job", exception=True )
+ log.exception("failure running job %d" % job_wrapper.job_id)
+ return
+
+ # If we were able to get a command line, run the job
+ if not command_line:
+ job_wrapper.finish( '', '' )
+ return
+
+ return command_line, client
+
+ def __prepare_input_files_locally(self, job_wrapper):
+ """Run task splitting commands locally."""
+ prepare_input_files_cmds = getattr(job_wrapper, 'prepare_input_files_cmds', None)
+ if prepare_input_files_cmds is not None:
+ for cmd in prepare_input_files_cmds: # run the commands to stage the input files
+ if 0 != os.system(cmd):
+ raise Exception('Error running file staging command: %s' % cmd)
+ job_wrapper.prepare_input_files_cmds = None # prevent them from being used in-line
+
def get_output_files(self, job_wrapper):
output_fnames = job_wrapper.get_output_fnames()
return [ str( o ) for o in output_fnames ]
https://bitbucket.org/galaxy/galaxy-central/commits/292d68d7e6a1/
Changeset: 292d68d7e6a1
User: jmchilton
Date: 2013-12-10 00:14:39
Summary: Allow setting metadata remotely with the LWR.
Must be running against very new LWR server which has been configured with a GALAXY_HOME variable.
The LWR job runner is reorganized to fetch the remote job config earlier and the LWR passes more information during this setup phase (namely galaxy_home - that is used when building the metadata setting command).
There is a new destination parameter - use_remote_datatypes. This can be true or false - defaulting to false. When false - the local Galaxy integrated datatypes will be sent over to the remote LWR server and used in conjuction with the galaxy server configured remotely. When true - the remote LWR job manager should be configured with a 'galaxy_datatypes_config_file' parameters and this datatypes config file will be used when setting metadata externally.
Since both options are subtley broken because there is no guarentee the remote and local Galaxy instances have the same datatypes available - I guess I would personally recommend continuing to set metadata on the galaxy server in conjunction with the LWR.
Affected #: 3 files
diff -r 0ed67d508ba30090453b793bee5283b6a87c9c6d -r 292d68d7e6a101b4a8df06a9f09aa3d16403e14e lib/galaxy/jobs/command_factory.py
--- a/lib/galaxy/jobs/command_factory.py
+++ b/lib/galaxy/jobs/command_factory.py
@@ -2,7 +2,7 @@
from os.path import abspath
-def build_command( job, job_wrapper, include_metadata=False, include_work_dir_outputs=True, metadata_kwds={} ):
+def build_command( job, job_wrapper, include_metadata=False, include_work_dir_outputs=True, metadata_kwds={}, job_working_directory=None ):
"""
Compose the sequence of commands necessary to execute a job. This will
currently include:
@@ -43,7 +43,7 @@
# Append commands to copy job outputs based on from_work_dir attribute.
if include_work_dir_outputs:
- work_dir_outputs = job.get_work_dir_outputs( job_wrapper )
+ work_dir_outputs = job.get_work_dir_outputs( job_wrapper, job_working_directory=job_working_directory )
if work_dir_outputs:
if not captured_return_code:
commands += capture_return_code_command
@@ -59,12 +59,18 @@
tmp_dir = metadata_kwds.get( 'tmp_dir', job_wrapper.working_directory )
dataset_files_path = metadata_kwds.get( 'dataset_files_path', job.app.model.Dataset.file_path )
output_fnames = metadata_kwds.get( 'output_fnames', job_wrapper.get_output_fnames() )
+ config_root = metadata_kwds.get( 'config_root', None )
+ config_file = metadata_kwds.get( 'config_file', None )
+ datatypes_config = metadata_kwds.get( 'datatypes_config', None )
metadata_command = job_wrapper.setup_external_metadata(
exec_dir=exec_dir,
tmp_dir=tmp_dir,
dataset_files_path=dataset_files_path,
output_fnames=output_fnames,
set_extension=False,
+ config_root=config_root,
+ config_file=config_file,
+ datatypes_config=datatypes_config,
kwds={ 'overwrite' : False }
) or ''
metadata_command = metadata_command.strip()
@@ -72,7 +78,7 @@
if not captured_return_code:
commands += capture_return_code_command
captured_return_code = True
- commands += "; cd %s; %s" % (abspath( getcwd() ), metadata_command)
+ commands += "; cd %s; %s" % (exec_dir, metadata_command)
if captured_return_code:
commands += '; sh -c "exit $return_code"'
diff -r 0ed67d508ba30090453b793bee5283b6a87c9c6d -r 292d68d7e6a101b4a8df06a9f09aa3d16403e14e lib/galaxy/jobs/runners/__init__.py
--- a/lib/galaxy/jobs/runners/__init__.py
+++ b/lib/galaxy/jobs/runners/__init__.py
@@ -146,11 +146,13 @@
def build_command_line( self, job_wrapper, include_metadata=False, include_work_dir_outputs=True ):
return build_command( self, job_wrapper, include_metadata=include_metadata, include_work_dir_outputs=include_work_dir_outputs )
- def get_work_dir_outputs( self, job_wrapper ):
+ def get_work_dir_outputs( self, job_wrapper, job_working_directory=None ):
"""
Returns list of pairs (source_file, destination) describing path
to work_dir output file and ultimate destination.
"""
+ if not job_working_directory:
+ job_working_directory = os.path.abspath( job_wrapper.working_directory )
def in_directory( file, directory ):
"""
@@ -186,7 +188,7 @@
if hda_tool_output and hda_tool_output.from_work_dir:
# Copy from working dir to HDA.
# TODO: move instead of copy to save time?
- source_file = os.path.join( os.path.abspath( job_wrapper.working_directory ), hda_tool_output.from_work_dir )
+ source_file = os.path.join( job_working_directory, hda_tool_output.from_work_dir )
destination = job_wrapper.get_output_destination( output_paths[ dataset.dataset_id ] )
if in_directory( source_file, job_wrapper.working_directory ):
output_pairs.append( ( source_file, destination ) )
diff -r 0ed67d508ba30090453b793bee5283b6a87c9c6d -r 292d68d7e6a101b4a8df06a9f09aa3d16403e14e lib/galaxy/jobs/runners/lwr.py
--- a/lib/galaxy/jobs/runners/lwr.py
+++ b/lib/galaxy/jobs/runners/lwr.py
@@ -3,7 +3,9 @@
from galaxy import model
from galaxy.jobs.runners import AsynchronousJobState, AsynchronousJobRunner
from galaxy.jobs import JobDestination
+from galaxy.jobs.command_factory import build_command
from galaxy.util import string_as_bool_or_none
+from galaxy.util.bunch import Bunch
import errno
from time import sleep
@@ -18,6 +20,9 @@
__all__ = [ 'LwrJobRunner' ]
+NO_REMOTE_GALAXY_FOR_METADATA_MESSAGE = "LWR misconfiguration - LWR client configured to set metadata remotely, but remote LWR isn't properly configured with a galaxy_home directory."
+NO_REMOTE_DATATYPES_CONFIG = "LWR client is configured to use remote datatypes configuration when setting metadata externally, but LWR is not configured with this information. Defaulting to datatypes_conf.xml."
+
class LwrJobRunner( AsynchronousJobRunner ):
"""
@@ -57,7 +62,7 @@
def queue_job(self, job_wrapper):
job_destination = job_wrapper.job_destination
- command_line, client = self.__prepare_job( job_wrapper, job_destination )
+ command_line, client, remote_job_config = self.__prepare_job( job_wrapper, job_destination )
if not command_line:
return
@@ -71,7 +76,7 @@
tool=job_wrapper.tool,
config_files=job_wrapper.extra_filenames,
)
- job_id = lwr_submit_job(client, client_job_description)
+ job_id = lwr_submit_job(client, client_job_description, remote_job_config)
log.info("lwr job submitted with job_id %s" % job_id)
job_wrapper.set_job_destination( job_destination, job_id )
job_wrapper.change_state( model.Job.states.QUEUED )
@@ -92,23 +97,33 @@
""" Build command-line and LWR client for this job. """
command_line = None
client = None
-
+ remote_job_config = None
try:
job_wrapper.prepare()
self.__prepare_input_files_locally(job_wrapper)
- command_line = self.build_command_line( job_wrapper, include_metadata=False, include_work_dir_outputs=False )
client = self.get_client_from_wrapper(job_wrapper)
+ tool = job_wrapper.tool
+ remote_job_config = client.setup(tool.id, tool.version)
+ remote_metadata = LwrJobRunner.__remote_metadata( client )
+ remote_work_dir_copy = LwrJobRunner.__remote_work_dir_copy( client )
+ metadata_kwds = self.__build_metadata_configuration(client, job_wrapper, remote_metadata, remote_job_config)
+ command_line = build_command(
+ self,
+ job_wrapper=job_wrapper,
+ include_metadata=remote_metadata,
+ include_work_dir_outputs=remote_work_dir_copy,
+ metadata_kwds=metadata_kwds,
+ job_working_directory=remote_job_config['working_directory']
+ )
except Exception:
job_wrapper.fail( "failure preparing job", exception=True )
log.exception("failure running job %d" % job_wrapper.job_id)
- return
# If we were able to get a command line, run the job
if not command_line:
job_wrapper.finish( '', '' )
- return
- return command_line, client
+ return command_line, client, remote_job_config
def __prepare_input_files_locally(self, job_wrapper):
"""Run task splitting commands locally."""
@@ -149,20 +164,27 @@
run_results = client.raw_check_complete()
stdout = run_results.get('stdout', '')
stderr = run_results.get('stderr', '')
-
+ working_directory_contents = run_results.get('working_directory_contents', [])
# Use LWR client code to transfer/copy files back
# and cleanup job if needed.
completed_normally = \
job_wrapper.get_state() not in [ model.Job.states.ERROR, model.Job.states.DELETED ]
cleanup_job = self.app.config.cleanup_job
- work_dir_outputs = self.get_work_dir_outputs( job_wrapper )
+ remote_work_dir_copy = LwrJobRunner.__remote_work_dir_copy( client )
+ if not remote_work_dir_copy:
+ work_dir_outputs = self.get_work_dir_outputs( job_wrapper )
+ else:
+ # They have already been copied over to look like regular outputs remotely,
+ # no need to handle them differently here.
+ work_dir_outputs = []
output_files = self.get_output_files( job_wrapper )
finish_args = dict( client=client,
working_directory=job_wrapper.working_directory,
job_completed_normally=completed_normally,
cleanup_job=cleanup_job,
work_dir_outputs=work_dir_outputs,
- output_files=output_files )
+ output_files=output_files,
+ working_directory_contents=working_directory_contents )
failed = lwr_finish_job( **finish_args )
if failed:
@@ -172,7 +194,8 @@
job_wrapper.fail( message, exception=True )
log.exception("failure running job %d" % job_wrapper.job_id)
return
- self._handle_metadata_externally( job_wrapper )
+ if not LwrJobRunner.__remote_metadata( client ):
+ self._handle_metadata_externally( job_wrapper )
# Finish the job
try:
job_wrapper.finish( stdout, stderr )
@@ -244,3 +267,64 @@
job_state.old_state = True
job_state.running = state == model.Job.states.RUNNING
self.monitor_queue.put( job_state )
+
+ @staticmethod
+ def __remote_metadata( lwr_client ):
+ remote_metadata = string_as_bool_or_none( lwr_client.destination_params.get( "remote_metadata", False ) )
+ return remote_metadata
+
+ @staticmethod
+ def __remote_work_dir_copy( lwr_client ):
+ # Right now remote metadata handling assumes from_work_dir outputs
+ # have been copied over before it runs. So do that remotely. This is
+ # not the default though because adding it to the command line is not
+ # cross-platform (no cp on Windows) and its un-needed work outside
+ # the context of metadata settting (just as easy to download from
+ # either place.)
+ return LwrJobRunner.__remote_metadata( lwr_client )
+
+ @staticmethod
+ def __use_remote_datatypes_conf( lwr_client ):
+ """ When setting remote metadata, use integrated datatypes from this
+ Galaxy instance or use the datatypes config configured via the remote
+ LWR.
+
+ Both options are broken in different ways for same reason - datatypes
+ may not match. One can push the local datatypes config to the remote
+ server - but there is no guarentee these datatypes will be defined
+ there. Alternatively, one can use the remote datatype config - but
+ there is no guarentee that it will contain all the datatypes available
+ to this Galaxy.
+ """
+ use_remote_datatypes = string_as_bool_or_none( lwr_client.destination_params.get( "use_remote_datatypes", False ) )
+ return use_remote_datatypes
+
+ def __build_metadata_configuration(self, client, job_wrapper, remote_metadata, remote_job_config):
+ metadata_kwds = {}
+ if remote_metadata:
+ remote_system_properties = remote_job_config.get("system_properties", {})
+ remote_galaxy_home = remote_system_properties.get("galaxy_home", None)
+ if not remote_galaxy_home:
+ raise Exception(NO_REMOTE_GALAXY_FOR_METADATA_MESSAGE)
+ metadata_kwds['exec_dir'] = remote_galaxy_home
+ outputs_directory = remote_job_config['outputs_directory']
+ configs_directory = remote_job_config['configs_directory']
+ outputs = [Bunch(false_path=os.path.join(outputs_directory, os.path.basename(path)), real_path=path) for path in self.get_output_files(job_wrapper)]
+ metadata_kwds['output_fnames'] = outputs
+ metadata_kwds['config_root'] = remote_galaxy_home
+ default_config_file = os.path.join(remote_galaxy_home, 'universe_wsgi.ini')
+ metadata_kwds['config_file'] = remote_system_properties.get('galaxy_config_file', default_config_file)
+ metadata_kwds['dataset_files_path'] = remote_system_properties.get('galaxy_dataset_files_path', None)
+ if LwrJobRunner.__use_remote_datatypes_conf( client ):
+ remote_datatypes_config = remote_system_properties.get('galaxy_datatypes_config_file', None)
+ if not remote_datatypes_config:
+ log.warn(NO_REMOTE_DATATYPES_CONFIG)
+ remote_datatypes_config = os.path.join(remote_galaxy_home, 'datatypes_conf.xml')
+ metadata_kwds['datatypes_config'] = remote_datatypes_config
+ else:
+ integrates_datatypes_config = self.app.datatypes_registry.integrated_datatypes_configs
+ # Ensure this file gets pushed out to the remote config dir.
+ job_wrapper.extra_filenames.append(integrates_datatypes_config)
+
+ metadata_kwds['datatypes_config'] = os.path.join(configs_directory, os.path.basename(integrates_datatypes_config))
+ return metadata_kwds
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: History panel: allow HDAs to be draggable
by commits-noreply@bitbucket.org 09 Dec '13
by commits-noreply@bitbucket.org 09 Dec '13
09 Dec '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/142006369d22/
Changeset: 142006369d22
User: carlfeberhard
Date: 2013-12-09 21:46:59
Summary: History panel: allow HDAs to be draggable
Affected #: 2 files
diff -r 44c9f3a305ccbf31b7338d966a62f06f94e10a07 -r 142006369d22f60a12c4573a782bbb30c58efbb9 static/scripts/mvc/dataset/hda-base.js
--- a/static/scripts/mvc/dataset/hda-base.js
+++ b/static/scripts/mvc/dataset/hda-base.js
@@ -47,6 +47,9 @@
this.selected = attributes.selected || false;
/** is the body of this hda view expanded/not. */
this.expanded = attributes.expanded || false;
+ /** is the body of this hda view expanded/not. */
+ this.draggable = attributes.draggable || false;
+
this._setUpListeners();
},
@@ -118,6 +121,7 @@
if( this.model.inReadyState() ){
this.trigger( 'rendered:ready', view );
}
+ if( this.draggable ){ this.draggableOn(); }
next();
});
return this;
@@ -399,7 +403,11 @@
'click .dataset-title-bar' : 'toggleBodyVisibility',
'keydown .dataset-title-bar' : 'toggleBodyVisibility',
// toggle selected state
- 'click .dataset-selector' : 'toggleSelect'
+ 'click .dataset-selector' : 'toggleSelect',
+
+ // dragging - don't work, originalEvent === null
+ //'dragstart .dataset-title-bar' : 'dragStartHandler',
+ //'dragend .dataset-title-bar' : 'dragEndHandler'
},
/** Show or hide the body/details of an HDA.
@@ -573,6 +581,48 @@
}
},
+ // ......................................................................... drag/drop
+ draggableOn : function(){
+ this.draggable = true;
+ //TODO: I have no idea why this doesn't work with the events hash or jq.on()...
+ //this.$el.find( '.dataset-title-bar' )
+ // .attr( 'draggable', true )
+ // .bind( 'dragstart', this.dragStartHandler, false )
+ // .bind( 'dragend', this.dragEndHandler, false );
+ this.dragStartHandler = _.bind( this._dragStartHandler, this );
+ this.dragEndHandler = _.bind( this._dragEndHandler, this );
+
+ var titleBar = this.$el.find( '.dataset-title-bar' ).attr( 'draggable', true ).get(0);
+ titleBar.addEventListener( 'dragstart', this.dragStartHandler, false );
+ titleBar.addEventListener( 'dragend', this.dragEndHandler, false );
+ },
+ draggableOff : function(){
+ this.draggable = false;
+ var titleBar = this.$el.find( '.dataset-title-bar' ).attr( 'draggable', false ).get(0);
+ titleBar.removeEventListener( 'dragstart', this.dragStartHandler, false );
+ titleBar.removeEventListener( 'dragend', this.dragEndHandler, false );
+ },
+ toggleDraggable : function(){
+ if( this.draggable ){
+ this.draggableOff();
+ } else {
+ this.draggableOn();
+ }
+ },
+ _dragStartHandler : function( event ){
+ //console.debug( 'dragStartHandler:', this, event, arguments )
+ this.trigger( 'dragstart', this );
+ event.dataTransfer.effectAllowed = 'move';
+ //TODO: all except IE: should be 'application/json', IE: must be 'text'
+ event.dataTransfer.setData( 'text', JSON.stringify( this.model.toJSON() ) );
+ return false;
+ },
+ _dragEndHandler : function( event ){
+ this.trigger( 'dragend', this );
+ //console.debug( 'dragEndHandler:', event )
+ return false;
+ },
+
// ......................................................................... removal
/** Remove this view's html from the DOM and remove all event listeners.
* @param {Function} callback an optional function called when removal is done
diff -r 44c9f3a305ccbf31b7338d966a62f06f94e10a07 -r 142006369d22f60a12c4573a782bbb30c58efbb9 static/scripts/packed/mvc/dataset/hda-base.js
--- a/static/scripts/packed/mvc/dataset/hda-base.js
+++ b/static/scripts/packed/mvc/dataset/hda-base.js
@@ -1,1 +1,1 @@
-define(["mvc/dataset/hda-model"],function(b){var a=Backbone.View.extend(LoggableMixin).extend({tagName:"div",className:"dataset hda history-panel-hda",id:function(){return"hda-"+this.model.get("id")},fxSpeed:"fast",initialize:function(c){if(c.logger){this.logger=this.model.logger=c.logger}this.log(this+".initialize:",c);this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton];this.selectable=c.selectable||false;this.selected=c.selected||false;this.expanded=c.expanded||false;this._setUpListeners()},_setUpListeners:function(){this.model.on("change",function(d,c){if(this.model.changedAttributes().state&&this.model.inReadyState()&&this.expanded&&!this.model.hasDetails()){this.model.fetch()}else{this.render()}},this)},render:function(e){e=(e===undefined)?(true):(e);var c=this;this.$el.find("[title]").tooltip("destroy");this.urls=this.model.urls();var d=$(a.templates.skeleton(this.model.toJSON()));d.find(".dataset-primary-actions").append(this._render_titleButtons());d.children(".dataset-body").replaceWith(this._render_body());this._setUpBehaviors(d);if(e){$(c).queue(function(f){this.$el.fadeOut(c.fxSpeed,f)})}$(c).queue(function(f){this.$el.empty().attr("class",c.className).addClass("state-"+c.model.get("state")).append(d.children());if(this.selectable){this.showSelector(0)}f()});if(e){$(c).queue(function(f){this.$el.fadeIn(c.fxSpeed,f)})}$(c).queue(function(f){this.trigger("rendered",c);if(this.model.inReadyState()){this.trigger("rendered:ready",c)}f()});return this},_setUpBehaviors:function(c){c=c||this.$el;make_popup_menus(c);c.find("[title]").tooltip({placement:"bottom"})},_render_titleButtons:function(){return[this._render_displayButton()]},_render_displayButton:function(){if((this.model.get("state")===b.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(this.model.get("state")===b.HistoryDatasetAssociation.STATES.DISCARDED)||(this.model.get("state")===b.HistoryDatasetAssociation.STATES.NEW)||(!this.model.get("accessible"))){return null}var d={target:"galaxy_main",classes:"dataset-display"};if(this.model.get("purged")){d.disabled=true;d.title=_l("Cannot display datasets removed from disk")}else{if(this.model.get("state")===b.HistoryDatasetAssociation.STATES.UPLOAD){d.disabled=true;d.title=_l("This dataset must finish uploading before it can be viewed")}else{d.title=_l("View data");d.href=this.urls.display;var c=this;d.onclick=function(){Galaxy.frame.add({title:"Data Viewer: "+c.model.get("name"),type:"url",target:"galaxy_main",content:c.urls.display})}}}d.faIcon="fa-eye";return faIconButton(d)},_render_downloadButton:function(){if(this.model.get("purged")||!this.model.hasData()){return null}var d=this.urls,e=this.model.get("meta_files");if(_.isEmpty(e)){return $(['<a href="'+d.download+'" title="'+_l("Download")+'" class="icon-btn">','<span class="fa fa-floppy-o"></span>',"</a>"].join(""))}var f="dataset-"+this.model.get("id")+"-popup",c=['<div popupmenu="'+f+'">','<a href="'+d.download+'">',_l("Download Dataset"),"</a>","<a>"+_l("Additional Files")+"</a>",_.map(e,function(g){return['<a class="action-button" href="',d.meta_download+g.file_type,'">',_l("Download")," ",g.file_type,"</a>"].join("")}).join("\n"),"</div>",'<div class="icon-btn-group">','<a href="'+d.download+'" title="'+_l("Download")+'" class="icon-btn">','<span class="fa fa-floppy-o"></span>','</a><a class="icon-btn popup" id="'+f+'">','<span class="fa fa-caret-down"></span>',"</a>","</div>"].join("\n");return $(c)},_render_showParamsButton:function(){return faIconButton({title:_l("View details"),href:this.urls.show_params,target:"galaxy_main",faIcon:"fa-info-circle"})},_render_body:function(){var d=$('<div>Error: unknown dataset state "'+this.model.get("state")+'".</div>'),c=this["_render_body_"+this.model.get("state")];if(_.isFunction(c)){d=c.call(this)}this._setUpBehaviors(d);if(this.expanded){d.show()}return d},_render_stateBodyHelper:function(c,f){f=f||[];var d=this,e=$(a.templates.body(_.extend(this.model.toJSON(),{body:c})));e.find(".dataset-actions .left").append(_.map(f,function(g){return g.call(d)}));return e},_render_body_new:function(){return this._render_stateBodyHelper("<div>"+_l("This is a new dataset and not all of its data are available yet")+"</div>")},_render_body_noPermission:function(){return this._render_stateBodyHelper("<div>"+_l("You do not have permission to view this dataset")+"</div>")},_render_body_discarded:function(){return this._render_stateBodyHelper("<div>"+_l("The job creating this dataset was cancelled before completion")+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_queued:function(){return this._render_stateBodyHelper("<div>"+_l("This job is waiting to run")+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_upload:function(){return this._render_stateBodyHelper("<div>"+_l("This dataset is currently uploading")+"</div>")},_render_body_setting_metadata:function(){return this._render_stateBodyHelper("<div>"+_l("Metadata is being auto-detected")+"</div>")},_render_body_running:function(){return this._render_stateBodyHelper("<div>"+_l("This job is currently running")+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_paused:function(){return this._render_stateBodyHelper("<div>"+_l('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume')+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_error:function(){var c=['<span class="help-text">',_l("An error occurred with this dataset"),":</span>",'<div class="job-error-text">',$.trim(this.model.get("misc_info")),"</div>"].join("");if(!this.model.get("purged")){c="<div>"+this.model.get("misc_blurb")+"</div>"+c}return this._render_stateBodyHelper(c,this.defaultPrimaryActionButtonRenderers.concat([this._render_downloadButton]))},_render_body_empty:function(){return this._render_stateBodyHelper("<div>"+_l("No data")+": <i>"+this.model.get("misc_blurb")+"</i></div>",this.defaultPrimaryActionButtonRenderers)},_render_body_failed_metadata:function(){var c=$('<div class="warningmessagesmall"></div>').append($("<strong/>").text(_l("An error occurred setting the metadata for this dataset"))),d=this._render_body_ok();d.prepend(c);return d},_render_body_ok:function(){var c=this,e=$(a.templates.body(this.model.toJSON())),d=[this._render_downloadButton].concat(this.defaultPrimaryActionButtonRenderers);e.find(".dataset-actions .left").append(_.map(d,function(f){return f.call(c)}));if(this.model.isDeletedOrPurged()){return e}return e},events:{"click .dataset-title-bar":"toggleBodyVisibility","keydown .dataset-title-bar":"toggleBodyVisibility","click .dataset-selector":"toggleSelect"},toggleBodyVisibility:function(f,d){var c=32,e=13;if((f.type==="keydown")&&!(f.keyCode===c||f.keyCode===e)){return true}var g=this.$el.find(".dataset-body");d=(d===undefined)?(!g.is(":visible")):(d);if(d){this.expandBody()}else{this.collapseBody()}return false},expandBody:function(){var c=this;function d(){c.$el.children(".dataset-body").replaceWith(c._render_body());c.$el.children(".dataset-body").slideDown(c.fxSpeed,function(){c.expanded=true;c.trigger("body-expanded",c.model.get("id"))})}if(this.model.inReadyState()&&!this.model.hasDetails()){this.model.fetch({silent:true}).always(function(e){d()})}else{d()}},collapseBody:function(){var c=this;this.$el.children(".dataset-body").slideUp(c.fxSpeed,function(){c.expanded=false;c.trigger("body-collapsed",c.model.get("id"))})},showSelector:function(e){if(this.$el.find(".dataset-selector").css("display")!=="none"){return}e=(e!==undefined)?(e):(this.fxSpeed);if(this.selected){this.select(null,true)}var d=this,c=32;if(e){this.$el.queue("fx",function(f){$(this).find(".dataset-primary-actions").fadeOut(e,f)});this.$el.queue("fx",function(f){$(this).find(".dataset-selector").show().animate({width:c},e,f);$(this).find(".dataset-title-bar").animate({"margin-left":c},e,f);d.selectable=true;d.trigger("selectable",true,d)})}else{this.$el.find(".dataset-primary-actions").hide();this.$el.find(".dataset-selector").show().css({width:c});this.$el.find(".dataset-title-bar").show().css({"margin-left":c});d.selectable=true;d.trigger("selectable",true,d)}},hideSelector:function(c){c=(c!==undefined)?(c):(this.fxSpeed);this.selectable=false;this.trigger("selectable",false,this);if(c){this.$el.queue("fx",function(d){$(this).find(".dataset-title-bar").show().css({"margin-left":"0"});$(this).find(".dataset-selector").animate({width:"0px"},c,function(){$(this).hide();d()})});this.$el.queue("fx",function(d){$(this).find(".dataset-primary-actions").fadeIn(c,d)})}else{$(this).find(".dataset-selector").css({width:"0px"}).hide();$(this).find(".dataset-primary-actions").show()}},toggleSelector:function(c){if(!this.$el.find(".dataset-selector").is(":visible")){this.showSelector(c)}else{this.hideSelector(c)}},select:function(c){this.$el.find(".dataset-selector span").removeClass("fa-square-o").addClass("fa-check-square-o");if(!this.selected){this.trigger("selected",this);this.selected=true}return false},deselect:function(c){this.$el.find(".dataset-selector span").removeClass("fa-check-square-o").addClass("fa-square-o");if(this.selected){this.trigger("de-selected",this);this.selected=false}return false},toggleSelect:function(c){if(this.selected){this.deselect(c)}else{this.select(c)}},remove:function(d){var c=this;this.$el.fadeOut(c.fxSpeed,function(){c.$el.remove();c.off();if(d){d()}})},toString:function(){var c=(this.model)?(this.model+""):("(no model)");return"HDABaseView("+c+")"}});a.templates={skeleton:Handlebars.templates["template-hda-skeleton"],body:Handlebars.templates["template-hda-body"]};return{HDABaseView:a}});
\ No newline at end of file
+define(["mvc/dataset/hda-model"],function(b){var a=Backbone.View.extend(LoggableMixin).extend({tagName:"div",className:"dataset hda history-panel-hda",id:function(){return"hda-"+this.model.get("id")},fxSpeed:"fast",initialize:function(c){if(c.logger){this.logger=this.model.logger=c.logger}this.log(this+".initialize:",c);this.defaultPrimaryActionButtonRenderers=[this._render_showParamsButton];this.selectable=c.selectable||false;this.selected=c.selected||false;this.expanded=c.expanded||false;this.draggable=c.draggable||false;this._setUpListeners()},_setUpListeners:function(){this.model.on("change",function(d,c){if(this.model.changedAttributes().state&&this.model.inReadyState()&&this.expanded&&!this.model.hasDetails()){this.model.fetch()}else{this.render()}},this)},render:function(e){e=(e===undefined)?(true):(e);var c=this;this.$el.find("[title]").tooltip("destroy");this.urls=this.model.urls();var d=$(a.templates.skeleton(this.model.toJSON()));d.find(".dataset-primary-actions").append(this._render_titleButtons());d.children(".dataset-body").replaceWith(this._render_body());this._setUpBehaviors(d);if(e){$(c).queue(function(f){this.$el.fadeOut(c.fxSpeed,f)})}$(c).queue(function(f){this.$el.empty().attr("class",c.className).addClass("state-"+c.model.get("state")).append(d.children());if(this.selectable){this.showSelector(0)}f()});if(e){$(c).queue(function(f){this.$el.fadeIn(c.fxSpeed,f)})}$(c).queue(function(f){this.trigger("rendered",c);if(this.model.inReadyState()){this.trigger("rendered:ready",c)}if(this.draggable){this.draggableOn()}f()});return this},_setUpBehaviors:function(c){c=c||this.$el;make_popup_menus(c);c.find("[title]").tooltip({placement:"bottom"})},_render_titleButtons:function(){return[this._render_displayButton()]},_render_displayButton:function(){if((this.model.get("state")===b.HistoryDatasetAssociation.STATES.NOT_VIEWABLE)||(this.model.get("state")===b.HistoryDatasetAssociation.STATES.DISCARDED)||(this.model.get("state")===b.HistoryDatasetAssociation.STATES.NEW)||(!this.model.get("accessible"))){return null}var d={target:"galaxy_main",classes:"dataset-display"};if(this.model.get("purged")){d.disabled=true;d.title=_l("Cannot display datasets removed from disk")}else{if(this.model.get("state")===b.HistoryDatasetAssociation.STATES.UPLOAD){d.disabled=true;d.title=_l("This dataset must finish uploading before it can be viewed")}else{d.title=_l("View data");d.href=this.urls.display;var c=this;d.onclick=function(){Galaxy.frame.add({title:"Data Viewer: "+c.model.get("name"),type:"url",target:"galaxy_main",content:c.urls.display})}}}d.faIcon="fa-eye";return faIconButton(d)},_render_downloadButton:function(){if(this.model.get("purged")||!this.model.hasData()){return null}var d=this.urls,e=this.model.get("meta_files");if(_.isEmpty(e)){return $(['<a href="'+d.download+'" title="'+_l("Download")+'" class="icon-btn">','<span class="fa fa-floppy-o"></span>',"</a>"].join(""))}var f="dataset-"+this.model.get("id")+"-popup",c=['<div popupmenu="'+f+'">','<a href="'+d.download+'">',_l("Download Dataset"),"</a>","<a>"+_l("Additional Files")+"</a>",_.map(e,function(g){return['<a class="action-button" href="',d.meta_download+g.file_type,'">',_l("Download")," ",g.file_type,"</a>"].join("")}).join("\n"),"</div>",'<div class="icon-btn-group">','<a href="'+d.download+'" title="'+_l("Download")+'" class="icon-btn">','<span class="fa fa-floppy-o"></span>','</a><a class="icon-btn popup" id="'+f+'">','<span class="fa fa-caret-down"></span>',"</a>","</div>"].join("\n");return $(c)},_render_showParamsButton:function(){return faIconButton({title:_l("View details"),href:this.urls.show_params,target:"galaxy_main",faIcon:"fa-info-circle"})},_render_body:function(){var d=$('<div>Error: unknown dataset state "'+this.model.get("state")+'".</div>'),c=this["_render_body_"+this.model.get("state")];if(_.isFunction(c)){d=c.call(this)}this._setUpBehaviors(d);if(this.expanded){d.show()}return d},_render_stateBodyHelper:function(c,f){f=f||[];var d=this,e=$(a.templates.body(_.extend(this.model.toJSON(),{body:c})));e.find(".dataset-actions .left").append(_.map(f,function(g){return g.call(d)}));return e},_render_body_new:function(){return this._render_stateBodyHelper("<div>"+_l("This is a new dataset and not all of its data are available yet")+"</div>")},_render_body_noPermission:function(){return this._render_stateBodyHelper("<div>"+_l("You do not have permission to view this dataset")+"</div>")},_render_body_discarded:function(){return this._render_stateBodyHelper("<div>"+_l("The job creating this dataset was cancelled before completion")+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_queued:function(){return this._render_stateBodyHelper("<div>"+_l("This job is waiting to run")+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_upload:function(){return this._render_stateBodyHelper("<div>"+_l("This dataset is currently uploading")+"</div>")},_render_body_setting_metadata:function(){return this._render_stateBodyHelper("<div>"+_l("Metadata is being auto-detected")+"</div>")},_render_body_running:function(){return this._render_stateBodyHelper("<div>"+_l("This job is currently running")+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_paused:function(){return this._render_stateBodyHelper("<div>"+_l('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume')+"</div>",this.defaultPrimaryActionButtonRenderers)},_render_body_error:function(){var c=['<span class="help-text">',_l("An error occurred with this dataset"),":</span>",'<div class="job-error-text">',$.trim(this.model.get("misc_info")),"</div>"].join("");if(!this.model.get("purged")){c="<div>"+this.model.get("misc_blurb")+"</div>"+c}return this._render_stateBodyHelper(c,this.defaultPrimaryActionButtonRenderers.concat([this._render_downloadButton]))},_render_body_empty:function(){return this._render_stateBodyHelper("<div>"+_l("No data")+": <i>"+this.model.get("misc_blurb")+"</i></div>",this.defaultPrimaryActionButtonRenderers)},_render_body_failed_metadata:function(){var c=$('<div class="warningmessagesmall"></div>').append($("<strong/>").text(_l("An error occurred setting the metadata for this dataset"))),d=this._render_body_ok();d.prepend(c);return d},_render_body_ok:function(){var c=this,e=$(a.templates.body(this.model.toJSON())),d=[this._render_downloadButton].concat(this.defaultPrimaryActionButtonRenderers);e.find(".dataset-actions .left").append(_.map(d,function(f){return f.call(c)}));if(this.model.isDeletedOrPurged()){return e}return e},events:{"click .dataset-title-bar":"toggleBodyVisibility","keydown .dataset-title-bar":"toggleBodyVisibility","click .dataset-selector":"toggleSelect",},toggleBodyVisibility:function(f,d){var c=32,e=13;if((f.type==="keydown")&&!(f.keyCode===c||f.keyCode===e)){return true}var g=this.$el.find(".dataset-body");d=(d===undefined)?(!g.is(":visible")):(d);if(d){this.expandBody()}else{this.collapseBody()}return false},expandBody:function(){var c=this;function d(){c.$el.children(".dataset-body").replaceWith(c._render_body());c.$el.children(".dataset-body").slideDown(c.fxSpeed,function(){c.expanded=true;c.trigger("body-expanded",c.model.get("id"))})}if(this.model.inReadyState()&&!this.model.hasDetails()){this.model.fetch({silent:true}).always(function(e){d()})}else{d()}},collapseBody:function(){var c=this;this.$el.children(".dataset-body").slideUp(c.fxSpeed,function(){c.expanded=false;c.trigger("body-collapsed",c.model.get("id"))})},showSelector:function(e){if(this.$el.find(".dataset-selector").css("display")!=="none"){return}e=(e!==undefined)?(e):(this.fxSpeed);if(this.selected){this.select(null,true)}var d=this,c=32;if(e){this.$el.queue("fx",function(f){$(this).find(".dataset-primary-actions").fadeOut(e,f)});this.$el.queue("fx",function(f){$(this).find(".dataset-selector").show().animate({width:c},e,f);$(this).find(".dataset-title-bar").animate({"margin-left":c},e,f);d.selectable=true;d.trigger("selectable",true,d)})}else{this.$el.find(".dataset-primary-actions").hide();this.$el.find(".dataset-selector").show().css({width:c});this.$el.find(".dataset-title-bar").show().css({"margin-left":c});d.selectable=true;d.trigger("selectable",true,d)}},hideSelector:function(c){c=(c!==undefined)?(c):(this.fxSpeed);this.selectable=false;this.trigger("selectable",false,this);if(c){this.$el.queue("fx",function(d){$(this).find(".dataset-title-bar").show().css({"margin-left":"0"});$(this).find(".dataset-selector").animate({width:"0px"},c,function(){$(this).hide();d()})});this.$el.queue("fx",function(d){$(this).find(".dataset-primary-actions").fadeIn(c,d)})}else{$(this).find(".dataset-selector").css({width:"0px"}).hide();$(this).find(".dataset-primary-actions").show()}},toggleSelector:function(c){if(!this.$el.find(".dataset-selector").is(":visible")){this.showSelector(c)}else{this.hideSelector(c)}},select:function(c){this.$el.find(".dataset-selector span").removeClass("fa-square-o").addClass("fa-check-square-o");if(!this.selected){this.trigger("selected",this);this.selected=true}return false},deselect:function(c){this.$el.find(".dataset-selector span").removeClass("fa-check-square-o").addClass("fa-square-o");if(this.selected){this.trigger("de-selected",this);this.selected=false}return false},toggleSelect:function(c){if(this.selected){this.deselect(c)}else{this.select(c)}},draggableOn:function(){this.draggable=true;this.dragStartHandler=_.bind(this._dragStartHandler,this);this.dragEndHandler=_.bind(this._dragEndHandler,this);var c=this.$el.find(".dataset-title-bar").attr("draggable",true).get(0);c.addEventListener("dragstart",this.dragStartHandler,false);c.addEventListener("dragend",this.dragEndHandler,false)},draggableOff:function(){this.draggable=false;var c=this.$el.find(".dataset-title-bar").attr("draggable",false).get(0);c.removeEventListener("dragstart",this.dragStartHandler,false);c.removeEventListener("dragend",this.dragEndHandler,false)},toggleDraggable:function(){if(this.draggable){this.draggableOff()}else{this.draggableOn()}},_dragStartHandler:function(c){this.trigger("dragstart",this);c.dataTransfer.effectAllowed="move";c.dataTransfer.setData("text",JSON.stringify(this.model.toJSON()));return false},_dragEndHandler:function(c){this.trigger("dragend",this);return false},remove:function(d){var c=this;this.$el.fadeOut(c.fxSpeed,function(){c.$el.remove();c.off();if(d){d()}})},toString:function(){var c=(this.model)?(this.model+""):("(no model)");return"HDABaseView("+c+")"}});a.templates={skeleton:Handlebars.templates["template-hda-skeleton"],body:Handlebars.templates["template-hda-body"]};return{HDABaseView:a}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: History page: register panel in Galaxy object
by commits-noreply@bitbucket.org 09 Dec '13
by commits-noreply@bitbucket.org 09 Dec '13
09 Dec '13
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/44c9f3a305cc/
Changeset: 44c9f3a305cc
User: carlfeberhard
Date: 2013-12-09 17:36:20
Summary: History page: register panel in Galaxy object
Affected #: 1 file
diff -r 7bdadc81eee2640002b8fa1ed56cc92249a8abac -r 44c9f3a305ccbf31b7338d966a62f06f94e10a07 templates/webapps/galaxy/root/history.mako
--- a/templates/webapps/galaxy/root/history.mako
+++ b/templates/webapps/galaxy/root/history.mako
@@ -4,7 +4,8 @@
${_('Galaxy History')}
</%def>
-<%namespace file="/history/history_panel.mako" import="bootstrapped_history_panel" />
+<%namespace file="/history/history_panel.mako" import="history_panel_javascripts" />
+<%namespace file="/galaxy.masthead.mako" import="get_user_json" />
## -----------------------------------------------------------------------------
<%def name="stylesheets()">
@@ -27,20 +28,47 @@
"mvc/user/user-model"
)}
${h.templates( "helpers-common-templates" )}
+
<script type="text/javascript">
- <%
- user_data = trans.webapp.api_controllers[ 'users' ].show( trans, 'current' )
- #HACK - the above sets the response type
- trans.response.set_content_type( "text/html" )
- %>
- ## bc this is in it's own frame we can't reference the global Galaxy obj or the quotameter's User obj
- window.Galaxy = {};
- Galaxy.currUser = new User(${user_data});
+ if( !window.Galaxy ){
+ window.Galaxy = {};
+ Galaxy.currUser = new User(${h.to_json_string( get_user_json() )});
+ }
+
$(function(){
$( 'body' ).addClass( 'historyPage' ).addClass( 'history-panel' );
});
</script>
-${bootstrapped_history_panel( history, hdas, selector_to_attach_to='body.historyPage', \
- show_deleted=show_deleted, show_hidden=show_hidden, hda_id=hda_id )}
+${history_panel_javascripts()}
+
+<script type="text/javascript">
+function onModuleReady( historyPanel ){
+ // attach a panel to selector_to_attach_to and use a history model with bootstrapped data
+
+ // history module is already in the dpn chain from the panel. We can re-scope it here.
+ var historyModel = require( 'mvc/history/history-model' ),
+ debugging = JSON.parse( sessionStorage.getItem( 'debugging' ) ) || false,
+ historyJSON = ${h.to_json_string( history )},
+ hdaJSON = ${h.to_json_string( hdas )};
+
+ var history = new historyModel.History( historyJSON, hdaJSON, {
+ logger: ( debugging )?( console ):( null )
+ });
+
+ var panel = new historyPanel.HistoryPanel({
+ show_deleted : ${ 'true' if show_deleted == True else ( 'null' if show_deleted == None else 'false' ) },
+ show_hidden : ${ 'true' if show_hidden == True else ( 'null' if show_hidden == None else 'false' ) },
+ el : $( "body.historyPage" ),
+ model : history,
+ onready : function(){
+ this.render();
+ if( Galaxy ){
+ Galaxy.currHistoryPanel = this;
+ }
+ }
+ });
+}
+</script>
+
</%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