galaxy-commits
Threads by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 15302 discussions
02 May '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/888cd02028b3/
Changeset: 888cd02028b3
User: jmchilton
Date: 2014-05-02 18:21:10
Summary: Small fixes for LWR.
Things added/modified for parameter rewriting at tool evaluatino time that regressed when implementing message queue stuff I guess.
Affected #: 2 files
diff -r 42b9fb317fdd9248154216530883603110905301 -r 888cd02028b37f93beba8b175fec8c85a912ac9f lib/galaxy/jobs/runners/lwr_client/setup_handler.py
--- a/lib/galaxy/jobs/runners/lwr_client/setup_handler.py
+++ b/lib/galaxy/jobs/runners/lwr_client/setup_handler.py
@@ -32,7 +32,7 @@
def __init__(self, client, destination_args):
self.client = client
system_properties = self.__build_system_properties(destination_args)
- system_properties["sep"] = client.job_directory.separator
+ system_properties["separator"] = client.job_directory.separator
self.system_properties = system_properties
self.jobs_directory = destination_args["jobs_directory"]
diff -r 42b9fb317fdd9248154216530883603110905301 -r 888cd02028b37f93beba8b175fec8c85a912ac9f lib/galaxy/tools/evaluation.py
--- a/lib/galaxy/tools/evaluation.py
+++ b/lib/galaxy/tools/evaluation.py
@@ -251,7 +251,10 @@
if real_path in output_dataset_paths:
dataset_path = output_dataset_paths[ real_path ]
param_dict[name] = DatasetFilenameWrapper( hda, dataset_path=dataset_path )
- open( dataset_path.false_path, 'w' ).close()
+ try:
+ open( dataset_path.false_path, 'w' ).close()
+ except EnvironmentError:
+ pass # May well not exist - e.g. LWR.
else:
param_dict[name] = DatasetFilenameWrapper( hda )
# Provide access to a path to store additional files
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: martenson: data libraries: bugfix, better UI changes role handling (stilll not _good_ but better)
by commits-noreply@bitbucket.org 02 May '14
by commits-noreply@bitbucket.org 02 May '14
02 May '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/42b9fb317fdd/
Changeset: 42b9fb317fdd
User: martenson
Date: 2014-05-02 00:21:37
Summary: data libraries: bugfix, better UI changes role handling (stilll not _good_ but better)
Affected #: 8 files
diff -r bf94ed77f61a4fd6138ee098b675426f4a6fca97 -r 42b9fb317fdd9248154216530883603110905301 lib/galaxy/webapps/galaxy/api/folder_contents.py
--- a/lib/galaxy/webapps/galaxy/api/folder_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/folder_contents.py
@@ -212,7 +212,7 @@
dataset.api_type = 'file'
content_items.append( dataset )
else:
- can_access, folder_ids = trans.app.security_agent.can_access_dataset( current_user_roles, dataset.library_dataset_dataset_association.dataset )
+ can_access = trans.app.security_agent.can_access_dataset( current_user_roles, dataset.library_dataset_dataset_association.dataset )
if can_access:
dataset.api_type = 'file'
content_items.append( dataset )
diff -r bf94ed77f61a4fd6138ee098b675426f4a6fca97 -r 42b9fb317fdd9248154216530883603110905301 static/scripts/mvc/library/library-folderlist-view.js
--- a/static/scripts/mvc/library/library-folderlist-view.js
+++ b/static/scripts/mvc/library/library-folderlist-view.js
@@ -89,10 +89,6 @@
this.$el.html(template({ path: this.folderContainer.attributes.metadata.full_path, id: this.options.id, upper_folder_id: upper_folder_id, order: this.sort}));
- var fetched_metadata = this.folderContainer.attributes.metadata;
- fetched_metadata.contains_file = this.options.contains_file;
- Galaxy.libraries.folderToolbarView.configureElements(fetched_metadata);
-
// initialize the library tooltips
$("#center [data-toggle]").tooltip();
//hack to show scrollbars
@@ -100,6 +96,22 @@
},
/**
+ * Call this after all models are added to the collection
+ * to ensure that the folder toolbar will show proper options
+ * and that event will be bound on all subviews.
+ */
+ postRender: function(){
+ var fetched_metadata = this.folderContainer.attributes.metadata;
+ fetched_metadata.contains_file = typeof this.collection.findWhere({type: 'file'}) !== 'undefined';
+ Galaxy.libraries.folderToolbarView.configureElements(fetched_metadata);
+ $('.deleted_dataset').hover(function() {
+ $(this).find('.show_on_hover').show();
+ }, function () {
+ $(this).find('.show_on_hover').hide();
+ });
+ },
+
+ /**
* Adds all given models to the collection.
* @param {array of Item or FolderAsModel} array of models that should
* be added to the view's collection.
@@ -108,28 +120,23 @@
_.each(models.reverse(), function(model) {
Galaxy.libraries.folderListView.collection.add(model);
});
+
$("#center [data-toggle]").tooltip();
this.checkEmptiness();
- $('.deleted_dataset').hover(function() {
- $(this).find('.show_on_hover').show();
- }, function () {
- $(this).find('.show_on_hover').hide();
- });
+
+ this.postRender();
},
/**
- * Renders whole collection of models as views
+ * Iterates this view's collection and calls the render
+ * function for each. Also binds the hover behavior.
*/
renderAll: function(){
var that = this;
_.each(this.collection.models.reverse(), function(model) {
that.renderOne(model);
});
- $('.deleted_dataset').hover(function() {
- $(this).find('.show_on_hover').show();
- }, function () {
- $(this).find('.show_on_hover').hide();
- });
+ this.postRender();
},
/**
@@ -145,12 +152,16 @@
this.$el.find('#first_folder_item').after(rowView.el);
$('.deleted_dataset').hover(function() {
- $(this).find('.show_on_hover').show();
+ $(this).find('.show_on_hover').show();
}, function () {
- $(this).find('.show_on_hover').hide();
+ $(this).find('.show_on_hover').hide();
});
},
+ /**
+ * removes the view of the given model from the DOM
+ * @param {Item or FolderAsModel} model of the view that will be removed
+ */
removeOne: function(model){
this.$el.find('#' + model.id).remove();
},
diff -r bf94ed77f61a4fd6138ee098b675426f4a6fca97 -r 42b9fb317fdd9248154216530883603110905301 static/scripts/mvc/library/library-foldertoolbar-view.js
--- a/static/scripts/mvc/library/library-foldertoolbar-view.js
+++ b/static/scripts/mvc/library/library-foldertoolbar-view.js
@@ -40,23 +40,40 @@
render: function(options){
this.options = _.extend(this.options, options);
- var toolbar_template = this.templateToolBar();
var is_admin = false;
+ var is_anonym = true;
if (Galaxy.currUser){
is_admin = Galaxy.currUser.isAdmin();
+ is_anonym = Galaxy.currUser.isAnonymous();
}
- this.$el.html(toolbar_template({id: this.options.id, admin_user: is_admin}));
+ var toolbar_template = this.templateToolBar();
+ this.$el.html(toolbar_template({id: this.options.id, admin_user: is_admin, anonym: is_anonym}));
},
configureElements: function(options){
this.options = _.extend(this.options, options);
+
if (this.options.can_add_library_item === true){
- $('#toolbtn_create_folder').show();
- $('.toolbtn_add_files').show();
+ $('.add-library-items').show();
+ } else{
+ $('.add-library-items').hide();
}
if (this.options.contains_file === true){
- $('#toolbtn_bulk_import').show();
- $('#toolbtn_dl').show();
+ if (Galaxy.currUser){
+ if (!Galaxy.currUser.isAnonymous()){
+ $('.logged-dataset-manipulation').show();
+ $('.dataset-manipulation').show();
+ } else {
+ $('.dataset-manipulation').show();
+ $('.logged-dataset-manipulation').hide();
+ }
+ } else {
+ $('.logged-dataset-manipulation').hide();
+ $('.dataset-manipulation').hide();
+ }
+ } else {
+ $('.logged-dataset-manipulation').hide();
+ $('.dataset-manipulation').hide();
}
this.$el.find('[data-toggle]').tooltip();
},
@@ -495,13 +512,13 @@
tmpl_array.push('<div class="library_style_container">');
// TOOLBAR
tmpl_array.push('<div id="library_folder_toolbar">');
- tmpl_array.push('<span data-toggle="tooltip" data-placement="top" title="Include deleted datasets"><input id="include_deleted_datasets_chk" style="margin: 0;" type="checkbox"><span class="fa fa-trash-o fa-lg"></span></input></span>');
- tmpl_array.push('<div class="btn-group">');
- tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Create New Folder" id="toolbtn_create_folder" class="btn btn-default primary-button" type="button" style="display:none;"><span class="fa fa-plus"></span><span class="fa fa-folder"></span></button>');
- tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Add Datasets to Current Folder" id="toolbtn_add_files" class="btn btn-default toolbtn_add_files primary-button" type="button" style="display:none;"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></button>');
+ tmpl_array.push('<span data-toggle="tooltip" data-placement="top" class="logged-dataset-manipulation" title="Include deleted datasets" style="display:none;"><input id="include_deleted_datasets_chk" style="margin: 0;" type="checkbox"><span class="fa fa-trash-o fa-lg"></span></input></span>');
+ tmpl_array.push('<div class="btn-group add-library-items" style="display:none;">');
+ tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Create New Folder" id="toolbtn_create_folder" class="btn btn-default primary-button" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder"></span></button>');
+ tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Add Datasets to Current Folder" id="toolbtn_add_files" class="btn btn-default toolbtn_add_files primary-button" type="button"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></button>');
tmpl_array.push('</div>');
- tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Import selected datasets into history" id="toolbtn_bulk_import" class="primary-button" style="margin-left: 0.5em; " type="button"><span class="fa fa-book"></span> to history</button>');
- tmpl_array.push(' <div id="toolbtn_dl" class="btn-group" style="margin-left: 0.5em; ">');
+ tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Import selected datasets into history" id="toolbtn_bulk_import" class="primary-button dataset-manipulation" style="margin-left: 0.5em; display:none;" type="button"><span class="fa fa-book"></span> to history</button>');
+ tmpl_array.push(' <div id="toolbtn_dl" class="btn-group dataset-manipulation" style="margin-left: 0.5em; display:none; ">');
tmpl_array.push(' <button title="Download selected datasets as archive" id="drop_toggle" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');
tmpl_array.push(' <span class="fa fa-download"></span> download <span class="caret"></span>');
tmpl_array.push(' </button>');
@@ -511,7 +528,7 @@
tmpl_array.push(' <li id="download_archive"><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');
tmpl_array.push(' </ul>');
tmpl_array.push(' </div>');
- tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button" style="margin-left: 0.5em; " type="button"><span class="fa fa-times"></span> delete</button>');
+ tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button logged-dataset-manipulation" style="margin-left: 0.5em; display:none; " type="button"><span class="fa fa-times"></span> delete</button>');
tmpl_array.push(' </div>');
tmpl_array.push(' <div id="folder_items_element">');
// library items will append here
diff -r bf94ed77f61a4fd6138ee098b675426f4a6fca97 -r 42b9fb317fdd9248154216530883603110905301 static/scripts/mvc/library/library-librarytoolbar-view.js
--- a/static/scripts/mvc/library/library-librarytoolbar-view.js
+++ b/static/scripts/mvc/library/library-librarytoolbar-view.js
@@ -22,12 +22,10 @@
render: function(){
var toolbar_template = this.templateToolBar();
var is_admin = false;
- var is_anonym = false;
+ var is_anonym = true;
if (Galaxy.currUser){
is_admin = Galaxy.currUser.isAdmin();
is_anonym = Galaxy.currUser.isAnonymous();
- } else {
- is_anonym = true;
}
this.$el.html(toolbar_template({admin_user: is_admin, anon_user: is_anonym}));
if (is_admin){
diff -r bf94ed77f61a4fd6138ee098b675426f4a6fca97 -r 42b9fb317fdd9248154216530883603110905301 static/scripts/packed/galaxy.pages.js
--- a/static/scripts/packed/galaxy.pages.js
+++ b/static/scripts/packed/galaxy.pages.js
@@ -1,1 +1,1 @@
-var Galaxy={ITEM_HISTORY:"item_history",ITEM_DATASET:"item_dataset",ITEM_WORKFLOW:"item_workflow",ITEM_PAGE:"item_page",ITEM_VISUALIZATION:"item_visualization",DIALOG_HISTORY_LINK:"link_history",DIALOG_DATASET_LINK:"link_dataset",DIALOG_WORKFLOW_LINK:"link_workflow",DIALOG_PAGE_LINK:"link_page",DIALOG_VISUALIZATION_LINK:"link_visualization",DIALOG_EMBED_HISTORY:"embed_history",DIALOG_EMBED_DATASET:"embed_dataset",DIALOG_EMBED_WORKFLOW:"embed_workflow",DIALOG_EMBED_PAGE:"embed_page",DIALOG_EMBED_VISUALIZATION:"embed_visualization",DIALOG_HISTORY_ANNOTATE:"history_annotate",};function init_galaxy_elts(a){$(".annotation",a._doc.body).each(function(){$(this).click(function(){var b=a._doc.createRange();b.selectNodeContents(this);var d=window.getSelection();d.removeAllRanges();d.addRange(b);var c=""})})}function get_item_info(d){var f,c,b;switch(d){case (Galaxy.ITEM_HISTORY):f="History";c="Histories";b="history";item_class="History";break;case (Galaxy.ITEM_DATASET):f="Dataset";c="Datasets";b="dataset";item_class="HistoryDatasetAssociation";break;case (Galaxy.ITEM_WORKFLOW):f="Workflow";c="Workflows";b="workflow";item_class="StoredWorkflow";break;case (Galaxy.ITEM_PAGE):f="Page";c="Pages";b="page";item_class="Page";break;case (Galaxy.ITEM_VISUALIZATION):f="Visualization";c="Visualizations";b="visualization";item_class="Visualization";break}var e="list_"+c.toLowerCase()+"_for_selection";var a=list_objects_url.replace("LIST_ACTION",e);return{singular:f,plural:c,controller:b,iclass:item_class,list_ajax_url:a}}function make_item_importable(a,c,b){ajax_url=set_accessible_url.replace("ITEM_CONTROLLER",a);$.ajax({type:"POST",url:ajax_url,data:{id:c,accessible:"True"},error:function(){alert("Making "+b+" accessible failed")}})}WYMeditor.editor.prototype.dialog=function(i,e,g){var a=this;var b=a.uniqueStamp();var f=a.selected();function h(){$("#set_link_id").click(function(){$("#link_attribute_label").text("ID/Name");var k=$(".wym_href");k.addClass("wym_id").removeClass("wym_href");if(f){k.val($(f).attr("id"))}$(this).remove()})}if(i==WYMeditor.DIALOG_LINK){if(f){$(a._options.hrefSelector).val($(f).attr(WYMeditor.HREF));$(a._options.srcSelector).val($(f).attr(WYMeditor.SRC));$(a._options.titleSelector).val($(f).attr(WYMeditor.TITLE));$(a._options.altSelector).val($(f).attr(WYMeditor.ALT))}var c,d;if(f){c=$(f).attr("href");if(c==undefined){c=""}d=$(f).attr("title");if(d==undefined){d=""}}show_modal("Create Link","<div><div><label id='link_attribute_label'>URL <span style='float: right; font-size: 90%'><a href='#' id='set_link_id'>Create in-page anchor</a></span></label><br><input type='text' class='wym_href' value='"+c+"' size='40' /></div><div><label>Title</label><br><input type='text' class='wym_title' value='"+d+"' size='40' /></div><div>",{"Make link":function(){var m=$(a._options.hrefSelector).val()||"",k=$(".wym_id").val()||"",n=$(a._options.titleSelector).val()||"";if(m||k){a._exec(WYMeditor.CREATE_LINK,b);var l=$("a[href="+b+"]",a._doc.body);l.attr(WYMeditor.HREF,m).attr(WYMeditor.TITLE,n).attr("id",k);if(l.text().indexOf("wym-")===0){l.text(n)}}hide_modal()},Cancel:function(){hide_modal()}},{},h)}if(i==WYMeditor.DIALOG_IMAGE){if(a._selected_image){$(a._options.dialogImageSelector+" "+a._options.srcSelector).val($(a._selected_image).attr(WYMeditor.SRC));$(a._options.dialogImageSelector+" "+a._options.titleSelector).val($(a._selected_image).attr(WYMeditor.TITLE));$(a._options.dialogImageSelector+" "+a._options.altSelector).val($(a._selected_image).attr(WYMeditor.ALT))}show_modal("Image","<div class='row'><label>URL</label><br><input type='text' class='wym_src' value='' size='40' /></div><div class='row'><label>Alt text</label><br><input type='text' class='wym_alt' value='' size='40' /></div><div class='row'><label>Title</label><br><input type='text' class='wym_title' value='' size='40' /></div>",{Insert:function(){var k=$(a._options.srcSelector).val();if(k.length>0){a._exec(WYMeditor.INSERT_IMAGE,b);$("img[src$="+b+"]",a._doc.body).attr(WYMeditor.SRC,k).attr(WYMeditor.TITLE,$(a._options.titleSelector).val()).attr(WYMeditor.ALT,$(a._options.altSelector).val())}hide_modal()},Cancel:function(){hide_modal()}});return}if(i==WYMeditor.DIALOG_TABLE){show_modal("Table","<div class='row'><label>Caption</label><br><input type='text' class='wym_caption' value='' size='40' /></div><div class='row'><label>Summary</label><br><input type='text' class='wym_summary' value='' size='40' /></div><div class='row'><label>Number Of Rows<br></label><input type='text' class='wym_rows' value='3' size='3' /></div><div class='row'><label>Number Of Cols<br></label><input type='text' class='wym_cols' value='2' size='3' /></div>",{Insert:function(){var o=$(a._options.rowsSelector).val();var r=$(a._options.colsSelector).val();if(o>0&&r>0){var n=a._doc.createElement(WYMeditor.TABLE);var l=null;var q=null;var k=$(a._options.captionSelector).val();var p=n.createCaption();p.innerHTML=k;for(x=0;x<o;x++){l=n.insertRow(x);for(y=0;y<r;y++){l.insertCell(y)}}$(n).attr("summary",$(a._options.summarySelector).val());var m=$(a.findUp(a.container(),WYMeditor.MAIN_CONTAINERS)).get(0);if(!m||!m.parentNode){$(a._doc.body).append(n)}else{$(m).after(n)}}hide_modal()},Cancel:function(){hide_modal()}})}if(i==Galaxy.DIALOG_HISTORY_LINK||i==Galaxy.DIALOG_DATASET_LINK||i==Galaxy.DIALOG_WORKFLOW_LINK||i==Galaxy.DIALOG_PAGE_LINK||i==Galaxy.DIALOG_VISUALIZATION_LINK){var j;switch(i){case (Galaxy.DIALOG_HISTORY_LINK):j=get_item_info(Galaxy.ITEM_HISTORY);break;case (Galaxy.DIALOG_DATASET_LINK):j=get_item_info(Galaxy.ITEM_DATASET);break;case (Galaxy.DIALOG_WORKFLOW_LINK):j=get_item_info(Galaxy.ITEM_WORKFLOW);break;case (Galaxy.DIALOG_PAGE_LINK):j=get_item_info(Galaxy.ITEM_PAGE);break;case (Galaxy.DIALOG_VISUALIZATION_LINK):j=get_item_info(Galaxy.ITEM_VISUALIZATION);break}$.ajax({url:j.list_ajax_url,data:{},error:function(){alert("Failed to list "+j.plural.toLowerCase()+" for selection")},success:function(k){show_modal("Insert Link to "+j.singular,k+"<div><input id='make-importable' type='checkbox' checked/>Make the selected "+j.plural.toLowerCase()+" accessible so that they can viewed by everyone.</div>",{Insert:function(){var m=false;if($("#make-importable:checked").val()!==null){m=true}var l=new Array();$("input[name=id]:checked").each(function(){var n=$(this).val();if(m){make_item_importable(j.controller,n,j.singular)}url_template=get_name_and_link_url+n;ajax_url=url_template.replace("ITEM_CONTROLLER",j.controller);$.getJSON(ajax_url,function(p){a._exec(WYMeditor.CREATE_LINK,b);var o=$("a[href="+b+"]",a._doc.body).text();if(o==""||o==b){a.insert("<a href='"+p.link+"'>"+j.singular+" '"+p.name+"'</a>")}else{$("a[href="+b+"]",a._doc.body).attr(WYMeditor.HREF,p.link).attr(WYMeditor.TITLE,j.singular+n)}})});hide_modal()},Cancel:function(){hide_modal()}})}})}if(i==Galaxy.DIALOG_EMBED_HISTORY||i==Galaxy.DIALOG_EMBED_DATASET||i==Galaxy.DIALOG_EMBED_WORKFLOW||i==Galaxy.DIALOG_EMBED_PAGE||i==Galaxy.DIALOG_EMBED_VISUALIZATION){var j;switch(i){case (Galaxy.DIALOG_EMBED_HISTORY):j=get_item_info(Galaxy.ITEM_HISTORY);break;case (Galaxy.DIALOG_EMBED_DATASET):j=get_item_info(Galaxy.ITEM_DATASET);break;case (Galaxy.DIALOG_EMBED_WORKFLOW):j=get_item_info(Galaxy.ITEM_WORKFLOW);break;case (Galaxy.DIALOG_EMBED_PAGE):j=get_item_info(Galaxy.ITEM_PAGE);break;case (Galaxy.DIALOG_EMBED_VISUALIZATION):j=get_item_info(Galaxy.ITEM_VISUALIZATION);break}$.ajax({url:j.list_ajax_url,data:{},error:function(){alert("Failed to list "+j.plural.toLowerCase()+" for selection")},success:function(k){if(i==Galaxy.DIALOG_EMBED_HISTORY||i==Galaxy.DIALOG_EMBED_WORKFLOW||i==Galaxy.DIALOG_EMBED_VISUALIZATION){k=k+"<div><input id='make-importable' type='checkbox' checked/>Make the selected "+j.plural.toLowerCase()+" accessible so that they can viewed by everyone.</div>"}show_modal("Embed "+j.plural,k,{Embed:function(){var l=false;if($("#make-importable:checked").val()!=null){l=true}$("input[name=id]:checked").each(function(){var m=$(this).val();var p=$("label[for='"+m+"']:first").text();if(l){make_item_importable(j.controller,m,j.singular)}var n=j.iclass+"-"+m;var o=["<div id='",n,"' class='embedded-item ",j.singular.toLowerCase()," placeholder'>","<p class='title'>","Embedded Galaxy ",j.singular," '",p,"'","</p>","<p class='content'>","[Do not edit this block; Galaxy will fill it in with the annotated ",j.singular.toLowerCase()," when it is displayed.]","</p>","</div>"].join("");a.insert(o)});hide_modal()},Cancel:function(){hide_modal()}})}})}if(i==Galaxy.DIALOG_ANNOTATE_HISTORY){$.ajax({url:list_histories_for_selection_url,data:{},error:function(){alert("Grid refresh failed")},success:function(k){show_modal("Insert Link to History",k,{Annotate:function(){var l=new Array();$("input[name=id]:checked").each(function(){var m=$(this).val();$.ajax({url:get_history_annotation_table_url,data:{id:m},error:function(){alert("Grid refresh failed")},success:function(n){a.insert(n);init_galaxy_elts(a)}})});hide_modal()},Cancel:function(){hide_modal()}})}})}};$(function(){$(document).ajaxError(function(i,g){var h=g.responseText||g.statusText||"Could not connect to server";show_modal("Server error",h,{"Ignore error":hide_modal});return false});$("[name=page_content]").wymeditor({skin:"galaxy",basePath:editor_base_path,iframeBasePath:iframe_base_path,boxHtml:"<table class='wym_box' width='100%' height='100%'><tr><td><div class='wym_area_top'>"+WYMeditor.TOOLS+"</div></td></tr><tr height='100%'><td><div class='wym_area_main' style='height: 100%;'>"+WYMeditor.IFRAME+WYMeditor.STATUS+"</div></div></td></tr></table>",toolsItems:[{name:"Bold",title:"Strong",css:"wym_tools_strong"},{name:"Italic",title:"Emphasis",css:"wym_tools_emphasis"},{name:"Superscript",title:"Superscript",css:"wym_tools_superscript"},{name:"Subscript",title:"Subscript",css:"wym_tools_subscript"},{name:"InsertOrderedList",title:"Ordered_List",css:"wym_tools_ordered_list"},{name:"InsertUnorderedList",title:"Unordered_List",css:"wym_tools_unordered_list"},{name:"Indent",title:"Indent",css:"wym_tools_indent"},{name:"Outdent",title:"Outdent",css:"wym_tools_outdent"},{name:"Undo",title:"Undo",css:"wym_tools_undo"},{name:"Redo",title:"Redo",css:"wym_tools_redo"},{name:"CreateLink",title:"Link",css:"wym_tools_link"},{name:"Unlink",title:"Unlink",css:"wym_tools_unlink"},{name:"InsertImage",title:"Image",css:"wym_tools_image"},{name:"InsertTable",title:"Table",css:"wym_tools_table"},]});var d=$.wymeditors(0);var f=function(g){show_modal("Saving page","progress");$.ajax({url:save_url,type:"POST",data:{id:page_id,content:d.xhtml(),annotations:JSON.stringify(new Object()),_:"true"},success:function(){g()}})};$("#save-button").click(function(){f(function(){hide_modal()})});$("#close-button").click(function(){var h=false;if(h){var g=function(){window.onbeforeunload=undefined;window.document.location=page_list_url};show_modal("Close editor","There are unsaved changes to your page which will be lost.",{Cancel:hide_modal,"Save Changes":function(){f(g)}},{"Don't Save":g})}else{window.document.location=page_list_url}});var a=$("<div class='galaxy-page-editor-button'><a id='insert-galaxy-link' class='action-button popup' href='#'>Paragraph type</a></div>");$(".wym_area_top").append(a);var b={};$.each(d._options.containersItems,function(h,g){var i=g.name;b[g.title.replace("_"," ")]=function(){d.container(i)}});make_popupmenu(a,b);var c=$("<div><a id='insert-galaxy-link' class='action-button popup' href='#'>Insert Link to Galaxy Object</a></div>").addClass("galaxy-page-editor-button");$(".wym_area_top").append(c);make_popupmenu(c,{"Insert History Link":function(){d.dialog(Galaxy.DIALOG_HISTORY_LINK)},"Insert Dataset Link":function(){d.dialog(Galaxy.DIALOG_DATASET_LINK)},"Insert Workflow Link":function(){d.dialog(Galaxy.DIALOG_WORKFLOW_LINK)},"Insert Page Link":function(){d.dialog(Galaxy.DIALOG_PAGE_LINK)},"Insert Visualization Link":function(){d.dialog(Galaxy.DIALOG_VISUALIZATION_LINK)},});var e=$("<div><a id='embed-galaxy-object' class='action-button popup' href='#'>Embed Galaxy Object</a></div>").addClass("galaxy-page-editor-button");$(".wym_area_top").append(e);make_popupmenu(e,{"Embed History":function(){d.dialog(Galaxy.DIALOG_EMBED_HISTORY)},"Embed Dataset":function(){d.dialog(Galaxy.DIALOG_EMBED_DATASET)},"Embed Workflow":function(){d.dialog(Galaxy.DIALOG_EMBED_WORKFLOW)},"Embed Visualization":function(){d.dialog(Galaxy.DIALOG_EMBED_VISUALIZATION)},})});
\ No newline at end of file
+var Galaxy={ITEM_HISTORY:"item_history",ITEM_DATASET:"item_dataset",ITEM_WORKFLOW:"item_workflow",ITEM_PAGE:"item_page",ITEM_VISUALIZATION:"item_visualization",DIALOG_HISTORY_LINK:"link_history",DIALOG_DATASET_LINK:"link_dataset",DIALOG_WORKFLOW_LINK:"link_workflow",DIALOG_PAGE_LINK:"link_page",DIALOG_VISUALIZATION_LINK:"link_visualization",DIALOG_EMBED_HISTORY:"embed_history",DIALOG_EMBED_DATASET:"embed_dataset",DIALOG_EMBED_WORKFLOW:"embed_workflow",DIALOG_EMBED_PAGE:"embed_page",DIALOG_EMBED_VISUALIZATION:"embed_visualization"};function init_galaxy_elts(a){$(".annotation",a._doc.body).each(function(){$(this).click(function(){var b=a._doc.createRange();b.selectNodeContents(this);var d=window.getSelection();d.removeAllRanges();d.addRange(b);var c=""})})}function get_item_info(d){var f,c,b;switch(d){case (Galaxy.ITEM_HISTORY):f="History";c="Histories";b="history";item_class="History";break;case (Galaxy.ITEM_DATASET):f="Dataset";c="Datasets";b="dataset";item_class="HistoryDatasetAssociation";break;case (Galaxy.ITEM_WORKFLOW):f="Workflow";c="Workflows";b="workflow";item_class="StoredWorkflow";break;case (Galaxy.ITEM_PAGE):f="Page";c="Pages";b="page";item_class="Page";break;case (Galaxy.ITEM_VISUALIZATION):f="Visualization";c="Visualizations";b="visualization";item_class="Visualization";break}var e="list_"+c.toLowerCase()+"_for_selection";var a=list_objects_url.replace("LIST_ACTION",e);return{singular:f,plural:c,controller:b,iclass:item_class,list_ajax_url:a}}function make_item_importable(a,c,b){ajax_url=set_accessible_url.replace("ITEM_CONTROLLER",a);$.ajax({type:"POST",url:ajax_url,data:{id:c,accessible:"True"},error:function(){alert("Making "+b+" accessible failed")}})}WYMeditor.editor.prototype.dialog=function(i,e,g){var a=this;var b=a.uniqueStamp();var f=a.selected();function h(){$("#set_link_id").click(function(){$("#link_attribute_label").text("ID/Name");var k=$(".wym_href");k.addClass("wym_id").removeClass("wym_href");if(f){k.val($(f).attr("id"))}$(this).remove()})}if(i==WYMeditor.DIALOG_LINK){if(f){$(a._options.hrefSelector).val($(f).attr(WYMeditor.HREF));$(a._options.srcSelector).val($(f).attr(WYMeditor.SRC));$(a._options.titleSelector).val($(f).attr(WYMeditor.TITLE));$(a._options.altSelector).val($(f).attr(WYMeditor.ALT))}var c,d;if(f){c=$(f).attr("href");if(c==undefined){c=""}d=$(f).attr("title");if(d==undefined){d=""}}show_modal("Create Link","<div><div><label id='link_attribute_label'>URL <span style='float: right; font-size: 90%'><a href='#' id='set_link_id'>Create in-page anchor</a></span></label><br><input type='text' class='wym_href' value='"+c+"' size='40' /></div><div><label>Title</label><br><input type='text' class='wym_title' value='"+d+"' size='40' /></div><div>",{"Make link":function(){var m=$(a._options.hrefSelector).val()||"",k=$(".wym_id").val()||"",n=$(a._options.titleSelector).val()||"";if(m||k){a._exec(WYMeditor.CREATE_LINK,b);var l=$("a[href="+b+"]",a._doc.body);l.attr(WYMeditor.HREF,m).attr(WYMeditor.TITLE,n).attr("id",k);if(l.text().indexOf("wym-")===0){l.text(n)}}hide_modal()},Cancel:function(){hide_modal()}},{},h)}if(i==WYMeditor.DIALOG_IMAGE){if(a._selected_image){$(a._options.dialogImageSelector+" "+a._options.srcSelector).val($(a._selected_image).attr(WYMeditor.SRC));$(a._options.dialogImageSelector+" "+a._options.titleSelector).val($(a._selected_image).attr(WYMeditor.TITLE));$(a._options.dialogImageSelector+" "+a._options.altSelector).val($(a._selected_image).attr(WYMeditor.ALT))}show_modal("Image","<div class='row'><label>URL</label><br><input type='text' class='wym_src' value='' size='40' /></div><div class='row'><label>Alt text</label><br><input type='text' class='wym_alt' value='' size='40' /></div><div class='row'><label>Title</label><br><input type='text' class='wym_title' value='' size='40' /></div>",{Insert:function(){var k=$(a._options.srcSelector).val();if(k.length>0){a._exec(WYMeditor.INSERT_IMAGE,b);$("img[src$="+b+"]",a._doc.body).attr(WYMeditor.SRC,k).attr(WYMeditor.TITLE,$(a._options.titleSelector).val()).attr(WYMeditor.ALT,$(a._options.altSelector).val())}hide_modal()},Cancel:function(){hide_modal()}});return}if(i==WYMeditor.DIALOG_TABLE){show_modal("Table","<div class='row'><label>Caption</label><br><input type='text' class='wym_caption' value='' size='40' /></div><div class='row'><label>Summary</label><br><input type='text' class='wym_summary' value='' size='40' /></div><div class='row'><label>Number Of Rows<br></label><input type='text' class='wym_rows' value='3' size='3' /></div><div class='row'><label>Number Of Cols<br></label><input type='text' class='wym_cols' value='2' size='3' /></div>",{Insert:function(){var o=$(a._options.rowsSelector).val();var r=$(a._options.colsSelector).val();if(o>0&&r>0){var n=a._doc.createElement(WYMeditor.TABLE);var l=null;var q=null;var k=$(a._options.captionSelector).val();var p=n.createCaption();p.innerHTML=k;for(x=0;x<o;x++){l=n.insertRow(x);for(y=0;y<r;y++){l.insertCell(y)}}$(n).attr("summary",$(a._options.summarySelector).val());var m=$(a.findUp(a.container(),WYMeditor.MAIN_CONTAINERS)).get(0);if(!m||!m.parentNode){$(a._doc.body).append(n)}else{$(m).after(n)}}hide_modal()},Cancel:function(){hide_modal()}})}if(i==Galaxy.DIALOG_HISTORY_LINK||i==Galaxy.DIALOG_DATASET_LINK||i==Galaxy.DIALOG_WORKFLOW_LINK||i==Galaxy.DIALOG_PAGE_LINK||i==Galaxy.DIALOG_VISUALIZATION_LINK){var j;switch(i){case (Galaxy.DIALOG_HISTORY_LINK):j=get_item_info(Galaxy.ITEM_HISTORY);break;case (Galaxy.DIALOG_DATASET_LINK):j=get_item_info(Galaxy.ITEM_DATASET);break;case (Galaxy.DIALOG_WORKFLOW_LINK):j=get_item_info(Galaxy.ITEM_WORKFLOW);break;case (Galaxy.DIALOG_PAGE_LINK):j=get_item_info(Galaxy.ITEM_PAGE);break;case (Galaxy.DIALOG_VISUALIZATION_LINK):j=get_item_info(Galaxy.ITEM_VISUALIZATION);break}$.ajax({url:j.list_ajax_url,data:{},error:function(){alert("Failed to list "+j.plural.toLowerCase()+" for selection")},success:function(k){show_modal("Insert Link to "+j.singular,k+"<div><input id='make-importable' type='checkbox' checked/>Make the selected "+j.plural.toLowerCase()+" accessible so that they can viewed by everyone.</div>",{Insert:function(){var m=false;if($("#make-importable:checked").val()!==null){m=true}var l=new Array();$("input[name=id]:checked").each(function(){var n=$(this).val();if(m){make_item_importable(j.controller,n,j.singular)}url_template=get_name_and_link_url+n;ajax_url=url_template.replace("ITEM_CONTROLLER",j.controller);$.getJSON(ajax_url,function(p){a._exec(WYMeditor.CREATE_LINK,b);var o=$("a[href="+b+"]",a._doc.body).text();if(o==""||o==b){a.insert("<a href='"+p.link+"'>"+j.singular+" '"+p.name+"'</a>")}else{$("a[href="+b+"]",a._doc.body).attr(WYMeditor.HREF,p.link).attr(WYMeditor.TITLE,j.singular+n)}})});hide_modal()},Cancel:function(){hide_modal()}})}})}if(i==Galaxy.DIALOG_EMBED_HISTORY||i==Galaxy.DIALOG_EMBED_DATASET||i==Galaxy.DIALOG_EMBED_WORKFLOW||i==Galaxy.DIALOG_EMBED_PAGE||i==Galaxy.DIALOG_EMBED_VISUALIZATION){var j;switch(i){case (Galaxy.DIALOG_EMBED_HISTORY):j=get_item_info(Galaxy.ITEM_HISTORY);break;case (Galaxy.DIALOG_EMBED_DATASET):j=get_item_info(Galaxy.ITEM_DATASET);break;case (Galaxy.DIALOG_EMBED_WORKFLOW):j=get_item_info(Galaxy.ITEM_WORKFLOW);break;case (Galaxy.DIALOG_EMBED_PAGE):j=get_item_info(Galaxy.ITEM_PAGE);break;case (Galaxy.DIALOG_EMBED_VISUALIZATION):j=get_item_info(Galaxy.ITEM_VISUALIZATION);break}$.ajax({url:j.list_ajax_url,data:{},error:function(){alert("Failed to list "+j.plural.toLowerCase()+" for selection")},success:function(k){if(i==Galaxy.DIALOG_EMBED_HISTORY||i==Galaxy.DIALOG_EMBED_WORKFLOW||i==Galaxy.DIALOG_EMBED_VISUALIZATION){k=k+"<div><input id='make-importable' type='checkbox' checked/>Make the selected "+j.plural.toLowerCase()+" accessible so that they can viewed by everyone.</div>"}show_modal("Embed "+j.plural,k,{Embed:function(){var l=false;if($("#make-importable:checked").val()!=null){l=true}$("input[name=id]:checked").each(function(){var m=$(this).val();var p=$("label[for='"+m+"']:first").text();if(l){make_item_importable(j.controller,m,j.singular)}var n=j.iclass+"-"+m;var o=["<div id='",n,"' class='embedded-item ",j.singular.toLowerCase()," placeholder'>","<p class='title'>","Embedded Galaxy ",j.singular," '",p,"'","</p>","<p class='content'>","[Do not edit this block; Galaxy will fill it in with the annotated ",j.singular.toLowerCase()," when it is displayed.]","</p>","</div>"].join("");a.insert(o)});hide_modal()},Cancel:function(){hide_modal()}})}})}};$(function(){$(document).ajaxError(function(i,g){var h=g.responseText||g.statusText||"Could not connect to server";show_modal("Server error",h,{"Ignore error":hide_modal});return false});$("[name=page_content]").wymeditor({skin:"galaxy",basePath:editor_base_path,iframeBasePath:iframe_base_path,boxHtml:"<table class='wym_box' width='100%' height='100%'><tr><td><div class='wym_area_top'>"+WYMeditor.TOOLS+"</div></td></tr><tr height='100%'><td><div class='wym_area_main' style='height: 100%;'>"+WYMeditor.IFRAME+WYMeditor.STATUS+"</div></div></td></tr></table>",toolsItems:[{name:"Bold",title:"Strong",css:"wym_tools_strong"},{name:"Italic",title:"Emphasis",css:"wym_tools_emphasis"},{name:"Superscript",title:"Superscript",css:"wym_tools_superscript"},{name:"Subscript",title:"Subscript",css:"wym_tools_subscript"},{name:"InsertOrderedList",title:"Ordered_List",css:"wym_tools_ordered_list"},{name:"InsertUnorderedList",title:"Unordered_List",css:"wym_tools_unordered_list"},{name:"Indent",title:"Indent",css:"wym_tools_indent"},{name:"Outdent",title:"Outdent",css:"wym_tools_outdent"},{name:"Undo",title:"Undo",css:"wym_tools_undo"},{name:"Redo",title:"Redo",css:"wym_tools_redo"},{name:"CreateLink",title:"Link",css:"wym_tools_link"},{name:"Unlink",title:"Unlink",css:"wym_tools_unlink"},{name:"InsertImage",title:"Image",css:"wym_tools_image"},{name:"InsertTable",title:"Table",css:"wym_tools_table"},]});var d=$.wymeditors(0);var f=function(g){show_modal("Saving page","progress");$.ajax({url:save_url,type:"POST",data:{id:page_id,content:d.xhtml(),annotations:JSON.stringify(new Object()),_:"true"},success:function(){g()}})};$("#save-button").click(function(){f(function(){hide_modal()})});$("#close-button").click(function(){var h=false;if(h){var g=function(){window.onbeforeunload=undefined;window.document.location=page_list_url};show_modal("Close editor","There are unsaved changes to your page which will be lost.",{Cancel:hide_modal,"Save Changes":function(){f(g)}},{"Don't Save":g})}else{window.document.location=page_list_url}});var a=$("<div class='galaxy-page-editor-button'><a id='insert-galaxy-link' class='action-button popup' href='#'>Paragraph type</a></div>");$(".wym_area_top").append(a);var b={};$.each(d._options.containersItems,function(h,g){var i=g.name;b[g.title.replace("_"," ")]=function(){d.container(i)}});make_popupmenu(a,b);var c=$("<div><a id='insert-galaxy-link' class='action-button popup' href='#'>Insert Link to Galaxy Object</a></div>").addClass("galaxy-page-editor-button");$(".wym_area_top").append(c);make_popupmenu(c,{"Insert History Link":function(){d.dialog(Galaxy.DIALOG_HISTORY_LINK)},"Insert Dataset Link":function(){d.dialog(Galaxy.DIALOG_DATASET_LINK)},"Insert Workflow Link":function(){d.dialog(Galaxy.DIALOG_WORKFLOW_LINK)},"Insert Page Link":function(){d.dialog(Galaxy.DIALOG_PAGE_LINK)},"Insert Visualization Link":function(){d.dialog(Galaxy.DIALOG_VISUALIZATION_LINK)},});var e=$("<div><a id='embed-galaxy-object' class='action-button popup' href='#'>Embed Galaxy Object</a></div>").addClass("galaxy-page-editor-button");$(".wym_area_top").append(e);make_popupmenu(e,{"Embed History":function(){d.dialog(Galaxy.DIALOG_EMBED_HISTORY)},"Embed Dataset":function(){d.dialog(Galaxy.DIALOG_EMBED_DATASET)},"Embed Workflow":function(){d.dialog(Galaxy.DIALOG_EMBED_WORKFLOW)},"Embed Visualization":function(){d.dialog(Galaxy.DIALOG_EMBED_VISUALIZATION)},})});
\ No newline at end of file
diff -r bf94ed77f61a4fd6138ee098b675426f4a6fca97 -r 42b9fb317fdd9248154216530883603110905301 static/scripts/packed/mvc/library/library-folderlist-view.js
--- a/static/scripts/packed/mvc/library/library-folderlist-view.js
+++ b/static/scripts/packed/mvc/library/library-folderlist-view.js
@@ -1,1 +1,1 @@
-define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-folderrow-view"],function(c,e,f,d,a){var b=Backbone.View.extend({el:"#folder_items_element",defaults:{include_deleted:false},progress:0,progressStep:1,modal:null,folderContainer:null,sort:"asc",events:{"click #select-all-checkboxes":"selectAll","click .dataset_row":"selectClickedRow","click .sort-folder-link":"sort_clicked"},initialize:function(g){this.options=_.defaults(this.options||{},g);this.fetchFolder()},fetchFolder:function(g){var g=g||{};this.options.include_deleted=g.include_deleted;var h=this;this.collection=new d.Folder();this.listenTo(this.collection,"add",this.renderOne);this.listenTo(this.collection,"remove",this.removeOne);this.folderContainer=new d.FolderContainer({id:this.options.id});this.folderContainer.url=this.folderContainer.attributes.urlRoot+this.options.id+"/contents";if(this.options.include_deleted){this.folderContainer.url=this.folderContainer.url+"?include_deleted=true"}this.folderContainer.fetch({success:function(i){h.folder_container=i;h.render();h.addAll(i.get("folder").models)},error:function(j,i){if(typeof i.responseJSON!=="undefined"){f.error(i.responseJSON.err_msg)}else{f.error("An error ocurred :(")}}})},render:function(g){this.options=_.defaults(this.options,g);var i=this.templateFolder();var j=this.folderContainer.attributes.metadata.full_path;var k;if(j.length===1){k=0}else{k=j[j.length-2][0]}this.$el.html(i({path:this.folderContainer.attributes.metadata.full_path,id:this.options.id,upper_folder_id:k,order:this.sort}));var h=this.folderContainer.attributes.metadata;h.contains_file=this.options.contains_file;Galaxy.libraries.folderToolbarView.configureElements(h);$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},addAll:function(g){_.each(g.reverse(),function(h){Galaxy.libraries.folderListView.collection.add(h)});$("#center [data-toggle]").tooltip();this.checkEmptiness();$(".deleted_dataset").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},renderAll:function(){var g=this;_.each(this.collection.models.reverse(),function(h){g.renderOne(h)});$(".deleted_dataset").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},renderOne:function(h){if(h.get("data_type")!=="folder"){this.options.contains_file=true;h.set("readable_size",this.size_to_string(h.get("file_size")))}var g=new a.FolderRowView(h);this.$el.find("#first_folder_item").after(g.el);$(".deleted_dataset").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},removeOne:function(g){this.$el.find("#"+g.id).remove()},checkEmptiness:function(){if((this.$el.find(".dataset_row").length===0)&&(this.$el.find(".folder_row").length===0)){this.$el.find(".empty-folder-message").show()}else{this.$el.find(".empty-folder-message").hide()}},sort_clicked:function(g){g.preventDefault();if(this.sort==="asc"){this.sortFolder("name","desc");this.sort="desc"}else{this.sortFolder("name","asc");this.sort="asc"}this.render();this.renderAll()},sortFolder:function(h,g){if(h==="name"){if(g==="asc"){return this.collection.sortByNameAsc()}else{if(g==="desc"){return this.collection.sortByNameDesc()}}}},size_to_string:function(g){var h="";if(g>=100000000000){g=g/100000000000;h="TB"}else{if(g>=100000000){g=g/100000000;h="GB"}else{if(g>=100000){g=g/100000;h="MB"}else{if(g>=100){g=g/100;h="KB"}else{g=g*10;h="b"}}}}return(Math.round(g)/10)+h},selectAll:function(h){var g=h.target.checked;that=this;$(":checkbox","#folder_list_body").each(function(){this.checked=g;$row=$(this.parentElement.parentElement);if(g){that.makeDarkRow($row)}else{that.makeWhiteRow($row)}})},selectClickedRow:function(h){var j="";var g;var i;if(h.target.localName==="input"){j=h.target;g=$(h.target.parentElement.parentElement);i="input"}else{if(h.target.localName==="td"){j=$("#"+h.target.parentElement.id).find(":checkbox")[0];g=$(h.target.parentElement);i="td"}}if(j.checked){if(i==="td"){j.checked="";this.makeWhiteRow(g)}else{if(i==="input"){this.makeDarkRow(g)}}}else{if(i==="td"){j.checked="selected";this.makeDarkRow(g)}else{if(i==="input"){this.makeWhiteRow(g)}}}},makeDarkRow:function(g){g.removeClass("light");g.find("a").removeClass("light");g.addClass("dark");g.find("a").addClass("dark");g.find("span").removeClass("fa-file-o");g.find("span").addClass("fa-file")},makeWhiteRow:function(g){g.removeClass("dark");g.find("a").removeClass("dark");g.addClass("light");g.find("a").addClass("light");g.find("span").addClass("fa-file-o");g.find("span").removeClass("fa-file")},templateFolder:function(){var g=[];g.push('<ol class="breadcrumb">');g.push(' <li><a title="Return to the list of libraries" href="#">Libraries</a></li>');g.push(" <% _.each(path, function(path_item) { %>");g.push(" <% if (path_item[0] != id) { %>");g.push(' <li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a></li> ');g.push("<% } else { %>");g.push(' <li class="active"><span title="You are in this folder"><%- path_item[1] %></span></li>');g.push(" <% } %>");g.push(" <% }); %>");g.push("</ol>");g.push('<table id="folder_table" class="grid table table-condensed">');g.push(" <thead>");g.push(' <th class="button_heading"></th>');g.push(' <th style="text-align: center; width: 20px; " title="Check to select all datasets"><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>');g.push(' <th style="width:30%;"><a class="sort-folder-link" title="Click to reverse order" href="#">name</a><span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>');g.push(" <th>data type</th>");g.push(" <th>size</th>");g.push(" <th>time updated (UTC)</th>");g.push(' <th style="width:15%;"></th> ');g.push(" </thead>");g.push(' <tbody id="folder_list_body">');g.push(' <tr id="first_folder_item">');g.push(' <td><a href="#<% if (upper_folder_id !== 0){ print("folders/" + upper_folder_id)} %>" title="Go to parent folder" class="btn_open_folder btn btn-default btn-xs">..<a></td>');g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" </tr>");g.push(" </tbody>");g.push("</table>");g.push('<div class="empty-folder-message" style="display:none;">This folder is either empty or you do not have proper access permissions to see the contents.</div>');return _.template(g.join(""))}});return{FolderListView:b}});
\ No newline at end of file
+define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-folderrow-view"],function(c,e,f,d,a){var b=Backbone.View.extend({el:"#folder_items_element",defaults:{include_deleted:false},progress:0,progressStep:1,modal:null,folderContainer:null,sort:"asc",events:{"click #select-all-checkboxes":"selectAll","click .dataset_row":"selectClickedRow","click .sort-folder-link":"sort_clicked"},initialize:function(g){this.options=_.defaults(this.options||{},g);this.fetchFolder()},fetchFolder:function(g){var g=g||{};this.options.include_deleted=g.include_deleted;var h=this;this.collection=new d.Folder();this.listenTo(this.collection,"add",this.renderOne);this.listenTo(this.collection,"remove",this.removeOne);this.folderContainer=new d.FolderContainer({id:this.options.id});this.folderContainer.url=this.folderContainer.attributes.urlRoot+this.options.id+"/contents";if(this.options.include_deleted){this.folderContainer.url=this.folderContainer.url+"?include_deleted=true"}this.folderContainer.fetch({success:function(i){h.folder_container=i;h.render();h.addAll(i.get("folder").models)},error:function(j,i){if(typeof i.responseJSON!=="undefined"){f.error(i.responseJSON.err_msg)}else{f.error("An error ocurred :(")}}})},render:function(g){this.options=_.defaults(this.options,g);var h=this.templateFolder();var i=this.folderContainer.attributes.metadata.full_path;var j;if(i.length===1){j=0}else{j=i[i.length-2][0]}this.$el.html(h({path:this.folderContainer.attributes.metadata.full_path,id:this.options.id,upper_folder_id:j,order:this.sort}));$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},postRender:function(){var g=this.folderContainer.attributes.metadata;g.contains_file=typeof this.collection.findWhere({type:"file"})!=="undefined";Galaxy.libraries.folderToolbarView.configureElements(g);$(".deleted_dataset").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},addAll:function(g){_.each(g.reverse(),function(h){Galaxy.libraries.folderListView.collection.add(h)});$("#center [data-toggle]").tooltip();this.checkEmptiness();this.postRender()},renderAll:function(){var g=this;_.each(this.collection.models.reverse(),function(h){g.renderOne(h)});this.postRender()},renderOne:function(h){if(h.get("data_type")!=="folder"){this.options.contains_file=true;h.set("readable_size",this.size_to_string(h.get("file_size")))}var g=new a.FolderRowView(h);this.$el.find("#first_folder_item").after(g.el);$(".deleted_dataset").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},removeOne:function(g){this.$el.find("#"+g.id).remove()},checkEmptiness:function(){if((this.$el.find(".dataset_row").length===0)&&(this.$el.find(".folder_row").length===0)){this.$el.find(".empty-folder-message").show()}else{this.$el.find(".empty-folder-message").hide()}},sort_clicked:function(g){g.preventDefault();if(this.sort==="asc"){this.sortFolder("name","desc");this.sort="desc"}else{this.sortFolder("name","asc");this.sort="asc"}this.render();this.renderAll()},sortFolder:function(h,g){if(h==="name"){if(g==="asc"){return this.collection.sortByNameAsc()}else{if(g==="desc"){return this.collection.sortByNameDesc()}}}},size_to_string:function(g){var h="";if(g>=100000000000){g=g/100000000000;h="TB"}else{if(g>=100000000){g=g/100000000;h="GB"}else{if(g>=100000){g=g/100000;h="MB"}else{if(g>=100){g=g/100;h="KB"}else{g=g*10;h="b"}}}}return(Math.round(g)/10)+h},selectAll:function(h){var g=h.target.checked;that=this;$(":checkbox","#folder_list_body").each(function(){this.checked=g;$row=$(this.parentElement.parentElement);if(g){that.makeDarkRow($row)}else{that.makeWhiteRow($row)}})},selectClickedRow:function(h){var j="";var g;var i;if(h.target.localName==="input"){j=h.target;g=$(h.target.parentElement.parentElement);i="input"}else{if(h.target.localName==="td"){j=$("#"+h.target.parentElement.id).find(":checkbox")[0];g=$(h.target.parentElement);i="td"}}if(j.checked){if(i==="td"){j.checked="";this.makeWhiteRow(g)}else{if(i==="input"){this.makeDarkRow(g)}}}else{if(i==="td"){j.checked="selected";this.makeDarkRow(g)}else{if(i==="input"){this.makeWhiteRow(g)}}}},makeDarkRow:function(g){g.removeClass("light");g.find("a").removeClass("light");g.addClass("dark");g.find("a").addClass("dark");g.find("span").removeClass("fa-file-o");g.find("span").addClass("fa-file")},makeWhiteRow:function(g){g.removeClass("dark");g.find("a").removeClass("dark");g.addClass("light");g.find("a").addClass("light");g.find("span").addClass("fa-file-o");g.find("span").removeClass("fa-file")},templateFolder:function(){var g=[];g.push('<ol class="breadcrumb">');g.push(' <li><a title="Return to the list of libraries" href="#">Libraries</a></li>');g.push(" <% _.each(path, function(path_item) { %>");g.push(" <% if (path_item[0] != id) { %>");g.push(' <li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a></li> ');g.push("<% } else { %>");g.push(' <li class="active"><span title="You are in this folder"><%- path_item[1] %></span></li>');g.push(" <% } %>");g.push(" <% }); %>");g.push("</ol>");g.push('<table id="folder_table" class="grid table table-condensed">');g.push(" <thead>");g.push(' <th class="button_heading"></th>');g.push(' <th style="text-align: center; width: 20px; " title="Check to select all datasets"><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>');g.push(' <th style="width:30%;"><a class="sort-folder-link" title="Click to reverse order" href="#">name</a><span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>');g.push(" <th>data type</th>");g.push(" <th>size</th>");g.push(" <th>time updated (UTC)</th>");g.push(' <th style="width:15%;"></th> ');g.push(" </thead>");g.push(' <tbody id="folder_list_body">');g.push(' <tr id="first_folder_item">');g.push(' <td><a href="#<% if (upper_folder_id !== 0){ print("folders/" + upper_folder_id)} %>" title="Go to parent folder" class="btn_open_folder btn btn-default btn-xs">..<a></td>');g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" </tr>");g.push(" </tbody>");g.push("</table>");g.push('<div class="empty-folder-message" style="display:none;">This folder is either empty or you do not have proper access permissions to see the contents.</div>');return _.template(g.join(""))}});return{FolderListView:b}});
\ No newline at end of file
diff -r bf94ed77f61a4fd6138ee098b675426f4a6fca97 -r 42b9fb317fdd9248154216530883603110905301 static/scripts/packed/mvc/library/library-foldertoolbar-view.js
--- a/static/scripts/packed/mvc/library/library-foldertoolbar-view.js
+++ b/static/scripts/packed/mvc/library/library-foldertoolbar-view.js
@@ -1,1 +1,1 @@
-define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model"],function(b,d,e,c){var a=Backbone.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click .toolbtn_add_files":"addFilesToFolderModal","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_bulk_delete":"deleteSelectedDatasets"},defaults:{can_add_library_item:false,contains_file:false,chain_call_control:{total_number:0,failed_number:0}},modal:null,histories:null,initialize:function(f){this.options=_.defaults(f||{},this.defaults);this.render()},render:function(f){this.options=_.extend(this.options,f);var h=this.templateToolBar();var g=false;if(Galaxy.currUser){g=Galaxy.currUser.isAdmin()}this.$el.html(h({id:this.options.id,admin_user:g}))},configureElements:function(f){this.options=_.extend(this.options,f);if(this.options.can_add_library_item===true){$("#toolbtn_create_folder").show();$(".toolbtn_add_files").show()}if(this.options.contains_file===true){$("#toolbtn_bulk_import").show();$("#toolbtn_dl").show()}this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(){event.preventDefault();event.stopPropagation();var f=this;var g=this.templateNewFolderInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Folder",body:g(),buttons:{Create:function(){f.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var f=this.serialize_new_folder();if(this.validate_new_folder(f)){var g=new c.FolderAsModel();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];g.url=g.urlRoot+"/"+current_folder_id;g.save(f,{success:function(h){Galaxy.modal.hide();e.success("Folder created");h.set({type:"folder"});Galaxy.libraries.folderListView.collection.add(h)},error:function(i,h){Galaxy.modal.hide();if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})}else{e.error("Folder's name is missing")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(f){return f.name!==""},modalBulkImport:function(){var f=$("#folder_table").find(":checked");if(f.length===0){e.info("You have to select some datasets first")}else{this.refreshUserHistoriesList(function(g){var h=g.templateBulkImportInModal();g.modal=Galaxy.modal;g.modal.show({closing_events:true,title:"Import into History",body:h({histories:g.histories.models}),buttons:{Import:function(){g.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})}},refreshUserHistoriesList:function(g){var f=this;this.histories=new c.GalaxyHistories();this.histories.fetch({success:function(){g(f)},error:function(i,h){if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},importAllIntoHistory:function(){this.modal.disableButton("Import");this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var j=$("select[name=dataset_import_bulk] option:selected").val();this.options.last_used_history_id=j;var m=$("select[name=dataset_import_bulk] option:selected").text();var o=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){o.push(this.parentElement.parentElement.id)}});var n=this.templateImportIntoHistoryProgressBar();this.modal.$el.find(".modal-body").html(n({history_name:m}));var k=100/o.length;this.initProgress(k);var f=[];for(var g=o.length-1;g>=0;g--){var h=o[g];var l=new c.HistoryItem();l.url=l.urlRoot+j+"/contents";l.content=h;l.source="library";f.push(l)}this.options.chain_call_control.total_number=f.length;this.chainCall(f,m)},chainCall:function(g,j){var f=this;var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets imported into history")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were imported into history.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be imported into history")}}}Galaxy.modal.hide();return}var i=$.when(h.save({content:h.content,source:h.source}));i.done(function(){f.updateProgress();f.chainCall(g,j)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCall(g,j)})},initProgress:function(f){this.progress=0;this.progressStep=f},updateProgress:function(){this.progress+=this.progressStep;$(".progress-bar-import").width(Math.round(this.progress)+"%");txt_representation=Math.round(this.progress)+"% Complete";$(".completion_span").text(txt_representation)},download:function(f,j){var h=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){h.push(this.parentElement.parentElement.id)}});var g="/api/libraries/datasets/download/"+j;var i={ldda_ids:h};this.processDownload(g,i,"get")},processDownload:function(g,h,i){if(g&&h){h=typeof h==="string"?h:$.param(h);var f="";$.each(h.split("&"),function(){var j=this.split("=");f+='<input type="hidden" name="'+j[0]+'" value="'+j[1]+'" />'});$('<form action="'+g+'" method="'+(i||"post")+'">'+f+"</form>").appendTo("body").submit().remove();e.info("Your download will begin soon")}},addFilesToFolderModal:function(){this.refreshUserHistoriesList(function(f){f.modal=Galaxy.modal;var g=f.templateAddFilesInModal();f.modal.show({closing_events:true,title:"Add datasets from history to "+f.options.folder_name,body:g({histories:f.histories.models}),buttons:{Add:function(){f.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}}});if(f.histories.models.length>0){f.fetchAndDisplayHistoryContents(f.histories.models[0].id);$("#dataset_add_bulk").change(function(h){f.fetchAndDisplayHistoryContents(h.target.value)})}else{e.error("An error ocurred :(")}})},fetchAndDisplayHistoryContents:function(h){var g=new c.HistoryContents({id:h});var f=this;g.fetch({success:function(j){var i=f.templateHistoryContents();f.histories.get(h).set({contents:j});f.modal.$el.find("#selected_history_content").html(i({history_contents:j.models.reverse()}))},error:function(){e.error("An error ocurred :(")}})},addAllDatasetsFromHistory:function(){this.modal.disableButton("Add");this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var f=[];this.modal.$el.find("#selected_history_content").find(":checked").each(function(){var i=$(this.parentElement).data("id");if(i){f.push(i)}});var l=this.options.folder_name;var k=this.templateAddingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(k({folder_name:l}));this.progressStep=100/f.length;this.progress=0;var j=[];for(var h=f.length-1;h>=0;h--){history_dataset_id=f[h];var g=new c.Item();g.url="/api/folders/"+this.options.id+"/contents";g.set({from_hda_id:history_dataset_id});j.push(g)}this.options.chain_call_control.total_number=j.length;this.chainCallAddingHdas(j)},chainCallAddingHdas:function(g){var f=this;this.added_hdas=new c.Folder();var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets from history added to the folder")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were added to the folder.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be added to the folder")}}}Galaxy.modal.hide();return this.added_hdas}var i=$.when(h.save({from_hda_id:h.get("from_hda_id")}));i.done(function(j){Galaxy.libraries.folderListView.collection.add(j);f.updateProgress();f.chainCallAddingHdas(g)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallAddingHdas(g)})},checkIncludeDeleted:function(f){if(f.target.checked){Galaxy.libraries.folderListView.fetchFolder({include_deleted:true})}else{Galaxy.libraries.folderListView.fetchFolder({include_deleted:false})}},deleteSelectedDatasets:function(){var f=$("#folder_table").find(":checked");if(f.length===0){e.info("You have to select some datasets first")}else{var j=this.templateDeletingDatasetsProgressBar();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Deleting selected datasets",body:j({}),buttons:{Close:function(){Galaxy.modal.hide()}}});this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var g=[];f.each(function(){if(this.parentElement.parentElement.id!==""){g.push(this.parentElement.parentElement.id)}});this.progressStep=100/g.length;this.progress=0;var l=[];for(var h=g.length-1;h>=0;h--){var k=new c.Item({id:g[h]});l.push(k)}this.options.chain_call_control.total_number=g.length;this.chainCallDeletingHdas(l)}},chainCallDeletingHdas:function(g){var f=this;this.deleted_lddas=new c.Folder();var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets deleted")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were deleted.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be deleted")}}}Galaxy.modal.hide();return this.deleted_lddas}var i=$.when(h.destroy());i.done(function(k){Galaxy.libraries.folderListView.collection.remove(h.id);f.updateProgress();if(Galaxy.libraries.folderListView.options.include_deleted){var j=new c.Item(k);Galaxy.libraries.folderListView.collection.add(j)}f.chainCallDeletingHdas(g)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallDeletingHdas(g)})},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push('<div id="library_folder_toolbar">');tmpl_array.push('<span data-toggle="tooltip" data-placement="top" title="Include deleted datasets"><input id="include_deleted_datasets_chk" style="margin: 0;" type="checkbox"><span class="fa fa-trash-o fa-lg"></span></input></span>');tmpl_array.push('<div class="btn-group">');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Create New Folder" id="toolbtn_create_folder" class="btn btn-default primary-button" type="button" style="display:none;"><span class="fa fa-plus"></span><span class="fa fa-folder"></span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Add Datasets to Current Folder" id="toolbtn_add_files" class="btn btn-default toolbtn_add_files primary-button" type="button" style="display:none;"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></button>');tmpl_array.push("</div>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Import selected datasets into history" id="toolbtn_bulk_import" class="primary-button" style="margin-left: 0.5em; " type="button"><span class="fa fa-book"></span> to history</button>');tmpl_array.push(' <div id="toolbtn_dl" class="btn-group" style="margin-left: 0.5em; ">');tmpl_array.push(' <button title="Download selected datasets as archive" id="drop_toggle" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-download"></span> download <span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li id="download_archive"><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');tmpl_array.push(' <li id="download_archive"><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');tmpl_array.push(' <li id="download_archive"><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button" style="margin-left: 0.5em; " type="button"><span class="fa fa-times"></span> delete</button>');tmpl_array.push(" </div>");tmpl_array.push(' <div id="folder_items_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewFolderInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_folder_modal">');tmpl_array.push("<form>");tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push("</form>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateBulkImportInModal:function(){var f=[];f.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');f.push("Select history: ");f.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');f.push(" <% _.each(histories, function(history) { %>");f.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');f.push(" <% }); %>");f.push("</select>");f.push("</span>");return _.template(f.join(""))},templateImportIntoHistoryProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateAddingDatasetsProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("Adding selected datasets from history to library folder <b><%= _.escape(folder_name) %></b>");f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateDeletingDatasetsProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-delete" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateAddFilesInModal:function(){var f=[];f.push('<div id="add_files_modal">');f.push('<div id="history_modal_combo_bulk">');f.push("Select history: ");f.push('<select id="dataset_add_bulk" name="dataset_add_bulk" style="width:66%; "> ');f.push(" <% _.each(histories, function(history) { %>");f.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');f.push(" <% }); %>");f.push("</select>");f.push("</div>");f.push('<div id="selected_history_content">');f.push("</div>");f.push("</div>");return _.template(f.join(""))},templateHistoryContents:function(){var f=[];f.push("Choose the datasets to import:");f.push("<ul>");f.push(" <% _.each(history_contents, function(history_item) { %>");f.push(' <li data-id="<%= _.escape(history_item.get("id")) %>">');f.push(' <input style="margin: 0;" type="checkbox"><%= _.escape(history_item.get("hid")) %>: <%= _.escape(history_item.get("name")) %>');f.push(" </li>");f.push(" <% }); %>");f.push("</ul>");return _.template(f.join(""))}});return{FolderToolbarView:a}});
\ No newline at end of file
+define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model"],function(b,d,e,c){var a=Backbone.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click .toolbtn_add_files":"addFilesToFolderModal","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_bulk_delete":"deleteSelectedDatasets"},defaults:{can_add_library_item:false,contains_file:false,chain_call_control:{total_number:0,failed_number:0}},modal:null,histories:null,initialize:function(f){this.options=_.defaults(f||{},this.defaults);this.render()},render:function(g){this.options=_.extend(this.options,g);var i=false;var f=true;if(Galaxy.currUser){i=Galaxy.currUser.isAdmin();f=Galaxy.currUser.isAnonymous()}var h=this.templateToolBar();this.$el.html(h({id:this.options.id,admin_user:i,anonym:f}))},configureElements:function(f){this.options=_.extend(this.options,f);if(this.options.can_add_library_item===true){$(".add-library-items").show()}else{$(".add-library-items").hide()}if(this.options.contains_file===true){if(Galaxy.currUser){if(!Galaxy.currUser.isAnonymous()){$(".logged-dataset-manipulation").show();$(".dataset-manipulation").show()}else{$(".dataset-manipulation").show();$(".logged-dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(){event.preventDefault();event.stopPropagation();var f=this;var g=this.templateNewFolderInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Folder",body:g(),buttons:{Create:function(){f.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var f=this.serialize_new_folder();if(this.validate_new_folder(f)){var g=new c.FolderAsModel();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];g.url=g.urlRoot+"/"+current_folder_id;g.save(f,{success:function(h){Galaxy.modal.hide();e.success("Folder created");h.set({type:"folder"});Galaxy.libraries.folderListView.collection.add(h)},error:function(i,h){Galaxy.modal.hide();if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})}else{e.error("Folder's name is missing")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(f){return f.name!==""},modalBulkImport:function(){var f=$("#folder_table").find(":checked");if(f.length===0){e.info("You have to select some datasets first")}else{this.refreshUserHistoriesList(function(g){var h=g.templateBulkImportInModal();g.modal=Galaxy.modal;g.modal.show({closing_events:true,title:"Import into History",body:h({histories:g.histories.models}),buttons:{Import:function(){g.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})}},refreshUserHistoriesList:function(g){var f=this;this.histories=new c.GalaxyHistories();this.histories.fetch({success:function(){g(f)},error:function(i,h){if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},importAllIntoHistory:function(){this.modal.disableButton("Import");this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var j=$("select[name=dataset_import_bulk] option:selected").val();this.options.last_used_history_id=j;var m=$("select[name=dataset_import_bulk] option:selected").text();var o=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){o.push(this.parentElement.parentElement.id)}});var n=this.templateImportIntoHistoryProgressBar();this.modal.$el.find(".modal-body").html(n({history_name:m}));var k=100/o.length;this.initProgress(k);var f=[];for(var g=o.length-1;g>=0;g--){var h=o[g];var l=new c.HistoryItem();l.url=l.urlRoot+j+"/contents";l.content=h;l.source="library";f.push(l)}this.options.chain_call_control.total_number=f.length;this.chainCall(f,m)},chainCall:function(g,j){var f=this;var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets imported into history")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were imported into history.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be imported into history")}}}Galaxy.modal.hide();return}var i=$.when(h.save({content:h.content,source:h.source}));i.done(function(){f.updateProgress();f.chainCall(g,j)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCall(g,j)})},initProgress:function(f){this.progress=0;this.progressStep=f},updateProgress:function(){this.progress+=this.progressStep;$(".progress-bar-import").width(Math.round(this.progress)+"%");txt_representation=Math.round(this.progress)+"% Complete";$(".completion_span").text(txt_representation)},download:function(f,j){var h=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){h.push(this.parentElement.parentElement.id)}});var g="/api/libraries/datasets/download/"+j;var i={ldda_ids:h};this.processDownload(g,i,"get")},processDownload:function(g,h,i){if(g&&h){h=typeof h==="string"?h:$.param(h);var f="";$.each(h.split("&"),function(){var j=this.split("=");f+='<input type="hidden" name="'+j[0]+'" value="'+j[1]+'" />'});$('<form action="'+g+'" method="'+(i||"post")+'">'+f+"</form>").appendTo("body").submit().remove();e.info("Your download will begin soon")}},addFilesToFolderModal:function(){this.refreshUserHistoriesList(function(f){f.modal=Galaxy.modal;var g=f.templateAddFilesInModal();f.modal.show({closing_events:true,title:"Add datasets from history to "+f.options.folder_name,body:g({histories:f.histories.models}),buttons:{Add:function(){f.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}}});if(f.histories.models.length>0){f.fetchAndDisplayHistoryContents(f.histories.models[0].id);$("#dataset_add_bulk").change(function(h){f.fetchAndDisplayHistoryContents(h.target.value)})}else{e.error("An error ocurred :(")}})},fetchAndDisplayHistoryContents:function(h){var g=new c.HistoryContents({id:h});var f=this;g.fetch({success:function(j){var i=f.templateHistoryContents();f.histories.get(h).set({contents:j});f.modal.$el.find("#selected_history_content").html(i({history_contents:j.models.reverse()}))},error:function(){e.error("An error ocurred :(")}})},addAllDatasetsFromHistory:function(){this.modal.disableButton("Add");this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var f=[];this.modal.$el.find("#selected_history_content").find(":checked").each(function(){var i=$(this.parentElement).data("id");if(i){f.push(i)}});var l=this.options.folder_name;var k=this.templateAddingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(k({folder_name:l}));this.progressStep=100/f.length;this.progress=0;var j=[];for(var h=f.length-1;h>=0;h--){history_dataset_id=f[h];var g=new c.Item();g.url="/api/folders/"+this.options.id+"/contents";g.set({from_hda_id:history_dataset_id});j.push(g)}this.options.chain_call_control.total_number=j.length;this.chainCallAddingHdas(j)},chainCallAddingHdas:function(g){var f=this;this.added_hdas=new c.Folder();var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets from history added to the folder")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were added to the folder.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be added to the folder")}}}Galaxy.modal.hide();return this.added_hdas}var i=$.when(h.save({from_hda_id:h.get("from_hda_id")}));i.done(function(j){Galaxy.libraries.folderListView.collection.add(j);f.updateProgress();f.chainCallAddingHdas(g)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallAddingHdas(g)})},checkIncludeDeleted:function(f){if(f.target.checked){Galaxy.libraries.folderListView.fetchFolder({include_deleted:true})}else{Galaxy.libraries.folderListView.fetchFolder({include_deleted:false})}},deleteSelectedDatasets:function(){var f=$("#folder_table").find(":checked");if(f.length===0){e.info("You have to select some datasets first")}else{var j=this.templateDeletingDatasetsProgressBar();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Deleting selected datasets",body:j({}),buttons:{Close:function(){Galaxy.modal.hide()}}});this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var g=[];f.each(function(){if(this.parentElement.parentElement.id!==""){g.push(this.parentElement.parentElement.id)}});this.progressStep=100/g.length;this.progress=0;var l=[];for(var h=g.length-1;h>=0;h--){var k=new c.Item({id:g[h]});l.push(k)}this.options.chain_call_control.total_number=g.length;this.chainCallDeletingHdas(l)}},chainCallDeletingHdas:function(g){var f=this;this.deleted_lddas=new c.Folder();var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets deleted")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were deleted.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be deleted")}}}Galaxy.modal.hide();return this.deleted_lddas}var i=$.when(h.destroy());i.done(function(k){Galaxy.libraries.folderListView.collection.remove(h.id);f.updateProgress();if(Galaxy.libraries.folderListView.options.include_deleted){var j=new c.Item(k);Galaxy.libraries.folderListView.collection.add(j)}f.chainCallDeletingHdas(g)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallDeletingHdas(g)})},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push('<div id="library_folder_toolbar">');tmpl_array.push('<span data-toggle="tooltip" data-placement="top" class="logged-dataset-manipulation" title="Include deleted datasets" style="display:none;"><input id="include_deleted_datasets_chk" style="margin: 0;" type="checkbox"><span class="fa fa-trash-o fa-lg"></span></input></span>');tmpl_array.push('<div class="btn-group add-library-items" style="display:none;">');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Create New Folder" id="toolbtn_create_folder" class="btn btn-default primary-button" type="button"><span class="fa fa-plus"></span><span class="fa fa-folder"></span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Add Datasets to Current Folder" id="toolbtn_add_files" class="btn btn-default toolbtn_add_files primary-button" type="button"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></button>');tmpl_array.push("</div>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Import selected datasets into history" id="toolbtn_bulk_import" class="primary-button dataset-manipulation" style="margin-left: 0.5em; display:none;" type="button"><span class="fa fa-book"></span> to history</button>');tmpl_array.push(' <div id="toolbtn_dl" class="btn-group dataset-manipulation" style="margin-left: 0.5em; display:none; ">');tmpl_array.push(' <button title="Download selected datasets as archive" id="drop_toggle" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-download"></span> download <span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li id="download_archive"><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');tmpl_array.push(' <li id="download_archive"><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');tmpl_array.push(' <li id="download_archive"><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button logged-dataset-manipulation" style="margin-left: 0.5em; display:none; " type="button"><span class="fa fa-times"></span> delete</button>');tmpl_array.push(" </div>");tmpl_array.push(' <div id="folder_items_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewFolderInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_folder_modal">');tmpl_array.push("<form>");tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push("</form>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateBulkImportInModal:function(){var f=[];f.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');f.push("Select history: ");f.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');f.push(" <% _.each(histories, function(history) { %>");f.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');f.push(" <% }); %>");f.push("</select>");f.push("</span>");return _.template(f.join(""))},templateImportIntoHistoryProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateAddingDatasetsProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("Adding selected datasets from history to library folder <b><%= _.escape(folder_name) %></b>");f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateDeletingDatasetsProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-delete" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateAddFilesInModal:function(){var f=[];f.push('<div id="add_files_modal">');f.push('<div id="history_modal_combo_bulk">');f.push("Select history: ");f.push('<select id="dataset_add_bulk" name="dataset_add_bulk" style="width:66%; "> ');f.push(" <% _.each(histories, function(history) { %>");f.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');f.push(" <% }); %>");f.push("</select>");f.push("</div>");f.push('<div id="selected_history_content">');f.push("</div>");f.push("</div>");return _.template(f.join(""))},templateHistoryContents:function(){var f=[];f.push("Choose the datasets to import:");f.push("<ul>");f.push(" <% _.each(history_contents, function(history_item) { %>");f.push(' <li data-id="<%= _.escape(history_item.get("id")) %>">');f.push(' <input style="margin: 0;" type="checkbox"><%= _.escape(history_item.get("hid")) %>: <%= _.escape(history_item.get("name")) %>');f.push(" </li>");f.push(" <% }); %>");f.push("</ul>");return _.template(f.join(""))}});return{FolderToolbarView:a}});
\ No newline at end of file
diff -r bf94ed77f61a4fd6138ee098b675426f4a6fca97 -r 42b9fb317fdd9248154216530883603110905301 static/scripts/packed/mvc/library/library-librarytoolbar-view.js
--- a/static/scripts/packed/mvc/library/library-librarytoolbar-view.js
+++ b/static/scripts/packed/mvc/library/library-librarytoolbar-view.js
@@ -1,1 +1,1 @@
-define(["libs/toastr","mvc/library/library-model"],function(b,a){var c=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal","click #include_deleted_chk":"check_include_deleted"},initialize:function(){this.render()},render:function(){var f=this.templateToolBar();var e=false;var d=false;if(Galaxy.currUser){e=Galaxy.currUser.isAdmin();d=Galaxy.currUser.isAnonymous()}else{d=true}this.$el.html(f({admin_user:e,anon_user:d}));if(e){this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted")}},show_library_modal:function(e){e.preventDefault();e.stopPropagation();var d=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){d.create_new_library_event()},Close:function(){d.modal.hide()}}})},create_new_library_event:function(){var f=this.serialize_new_library();if(this.validate_new_library(f)){var e=new a.Library();var d=this;e.save(f,{success:function(g){Galaxy.libraries.libraryListView.collection.add(g);d.modal.hide();d.clear_library_modal();Galaxy.libraries.libraryListView.render();b.success("Library created")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){b.error(g.responseJSON.err_msg)}else{b.error("An error occured :(")}}})}else{b.error("Library's name is missing")}return false},clear_library_modal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serialize_new_library:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},validate_new_library:function(d){return d.name!==""},check_include_deleted:function(d){if(d.target.checked){Galaxy.libraries.preferences.set({with_deleted:true});Galaxy.libraries.libraryListView.render()}else{Galaxy.libraries.preferences.set({with_deleted:false});Galaxy.libraries.libraryListView.render()}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="toolbar_form" margin-top:0.5em; ">');tmpl_array.push(' <h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fol…" target="_blank">Trello</a>.</h3>');tmpl_array.push(" <% if(admin_user === true) { %>");tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Include deleted libraries"><input id="include_deleted_chk" style="margin: 0;" type="checkbox"><span class="fa fa-trash-o fa-lg"></span></input></span>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button><span>');tmpl_array.push(" </div>");tmpl_array.push(" <% } %>");tmpl_array.push(" </div>");tmpl_array.push(' <div id="libraries_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push(" <form>");tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push(" </form>");tmpl_array.push("</div>");return tmpl_array.join("")}});return{LibraryToolbarView:c}});
\ No newline at end of file
+define(["libs/toastr","mvc/library/library-model"],function(b,a){var c=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal","click #include_deleted_chk":"check_include_deleted"},initialize:function(){this.render()},render:function(){var f=this.templateToolBar();var e=false;var d=true;if(Galaxy.currUser){e=Galaxy.currUser.isAdmin();d=Galaxy.currUser.isAnonymous()}this.$el.html(f({admin_user:e,anon_user:d}));if(e){this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted")}},show_library_modal:function(e){e.preventDefault();e.stopPropagation();var d=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){d.create_new_library_event()},Close:function(){d.modal.hide()}}})},create_new_library_event:function(){var f=this.serialize_new_library();if(this.validate_new_library(f)){var e=new a.Library();var d=this;e.save(f,{success:function(g){Galaxy.libraries.libraryListView.collection.add(g);d.modal.hide();d.clear_library_modal();Galaxy.libraries.libraryListView.render();b.success("Library created")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){b.error(g.responseJSON.err_msg)}else{b.error("An error occured :(")}}})}else{b.error("Library's name is missing")}return false},clear_library_modal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serialize_new_library:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},validate_new_library:function(d){return d.name!==""},check_include_deleted:function(d){if(d.target.checked){Galaxy.libraries.preferences.set({with_deleted:true});Galaxy.libraries.libraryListView.render()}else{Galaxy.libraries.preferences.set({with_deleted:false});Galaxy.libraries.libraryListView.render()}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="toolbar_form" margin-top:0.5em; ">');tmpl_array.push(' <h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fol…" target="_blank">Trello</a>.</h3>');tmpl_array.push(" <% if(admin_user === true) { %>");tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Include deleted libraries"><input id="include_deleted_chk" style="margin: 0;" type="checkbox"><span class="fa fa-trash-o fa-lg"></span></input></span>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button><span>');tmpl_array.push(" </div>");tmpl_array.push(" <% } %>");tmpl_array.push(" </div>");tmpl_array.push(' <div id="libraries_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push(" <form>");tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push(" </form>");tmpl_array.push("</div>");return tmpl_array.join("")}});return{LibraryToolbarView:c}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: Charts: Heatmaps fix tab-spacing, code cleanup
by commits-noreply@bitbucket.org 01 May '14
by commits-noreply@bitbucket.org 01 May '14
01 May '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/bf94ed77f61a/
Changeset: bf94ed77f61a
User: guerler
Date: 2014-05-01 23:16:54
Summary: Charts: Heatmaps fix tab-spacing, code cleanup
Affected #: 1 file
diff -r a924f00f31589ab8568a7e9c3b1f4f27a5916d42 -r bf94ed77f61a4fd6138ee098b675426f4a6fca97 config/plugins/visualizations/charts/static/charts/heatmap/heatmap-plugin.js
--- a/config/plugins/visualizations/charts/static/charts/heatmap/heatmap-plugin.js
+++ b/config/plugins/visualizations/charts/static/charts/heatmap/heatmap-plugin.js
@@ -58,15 +58,21 @@
// data indexing
//
- // labels in alphabetical order
+ // labels (in alphabetical order)
this.rowLabel = [];
this.colLabel = [];
+ // index (order from original dataset)
+ this.rowIndex = [];
+ this.colIndex = [];
+
// unique keys (key indices are unique per label and indicate the labels rank in the alphabetical sorting)
this.colRank = {};
this.rowRank = {};
- // identify unqiue labels
+ //
+ // identify and parse labels
+ //
for (var i in this.data) {
var cell = this.data[i];
@@ -75,14 +81,20 @@
if (this.colRank[col_label] === undefined) {
this.colRank[col_label] = true;
this.colLabel.push(col_label);
+ this.colIndex.push(col_label);
}
var row_label = cell.row_label;
if (this.rowRank[row_label] === undefined) {
this.rowRank[row_label] = true;
this.rowLabel.push(row_label);
+ this.rowIndex.push(row_label);
}
}
+ //
+ // sort labels and update rank dictionary
+ //
+
// set sizes
this.rowNumber = this.rowLabel.length
this.colNumber = this.colLabel.length
@@ -92,29 +104,22 @@
this.colLabel.sort();
// generate sorted key list for rows
- this.rowIndex = []
for (var i in this.rowLabel) {
var row_label = this.rowLabel[i];
- var row_index = parseInt(i);
- this.rowRank[row_label] = row_index;
-
- // should contain clustering
- this.rowIndex.push(row_index);
+ var row_rank = parseInt(i);
+ this.rowRank[row_label] = row_rank;
}
// generate sorted key list for columns
- this.colIndex = []
for (var i in this.colLabel) {
var col_label = this.colLabel[i];
- var col_index = parseInt(i);
- this.colRank[col_label] = col_index;
-
- // should contain clustering
- this.colIndex.push(col_index);
+ var col_rank = parseInt(i);
+ this.colRank[col_label] = col_rank;
}
//
- // parse indexing to cells, identify data range
+ // parse indexing from rank dictionary to cells
+ // identify data range
//
// min/max
@@ -139,12 +144,26 @@
}
}
+ //
+ // translate original create cluster from order in original data
+ //
+
+ // generate sorted key list for columns
+ for (var i in this.colIndex) {
+ this.colIndex[i] = this.colRank[this.colIndex[i]];
+ }
+ // generate sorted key list for columns
+ for (var i in this.rowIndex) {
+ this.rowIndex[i] = this.rowRank[this.rowIndex[i]];
+ }
+
// middle
this.mid = (this.max + this.min) / 2;
//
// set colors
//
+
// identify buckets
this.nColors = this.options.colors.length;
@@ -166,11 +185,11 @@
// add event to select field
this.$select.on('change', function(){
- self._order(this.value);
+ self._sortByOrder(this.value);
});
//
- // draw
+ // finally draw the heatmap
//
this._draw();
},
@@ -217,6 +236,346 @@
this.heatMap = this._buildHeatMap();
this.legend = this._buildLegend();
},
+
+ // build legend
+ _buildLegend: function() {
+ // link this
+ var self = this;
+
+ // gather data
+ var cellSize = this.cellSize;
+ var height = this.height;
+ var legendCellWidth = this.width / this.nColors;
+
+ // create range labels
+ var dataRange = [];
+ for(var i = 0; i < this.nColors; i++) {
+ dataRange.push('');
+ }
+
+ // prepare indices
+ var dataRangeMin = 0;
+ var dataRangeMid = parseInt((dataRange.length - 1) / 2);
+ var dataRangeMax = dataRange.length - 1;
+
+ // add labels
+ dataRange[dataRangeMin] = this.min;
+ dataRange[dataRangeMid] = this.mid;
+ dataRange[dataRangeMax] = this.max;
+
+ // create legend
+ var legend = this.svg.selectAll(".legend")
+ .data(dataRange)
+ .enter().append("g")
+ .attr("class", "legend");
+
+ // add boxes
+ legend.append("rect")
+ .attr("x", function(d, i) {
+ return legendCellWidth * i;
+ })
+ .attr("y", height + cellSize)
+ .attr("width", legendCellWidth)
+ .attr("height", cellSize)
+ .style("fill", function(d, i) {
+ return self.options.colors[i];
+ });
+
+ // add text
+ legend.append("text")
+ .attr("class", "mono")
+ .text(function(d) {
+ return d;
+ })
+ .attr("width", legendCellWidth)
+ .attr("x", function(d, i) {
+ return legendCellWidth * i;
+ })
+ .attr("y", height + cellSize)
+ .style("font-size", cellSize + "px");
+ },
+
+ // build column labels
+ _buildColLabels: function() {
+ // link this
+ var self = this;
+
+ // gather data
+ var cellSize = this.cellSize;
+ var colIndex = this.colIndex;
+ var colLabel = this.colLabel;
+
+ // column labels
+ var colLabels = this.svg.append("g")
+ .selectAll(".colLabelg")
+ .data(colLabel)
+ .enter()
+ .append("text")
+ .text(function (d) {
+ return d;
+ })
+ .attr("x", 0)
+ .attr("y", function (d, i) {
+ return colIndex.indexOf(i) * cellSize;
+ })
+ .style("font-size", cellSize + "px")
+ .style("text-anchor", "left")
+ .attr("transform", "translate(" + cellSize / 2 + ", -17) rotate (-90)")
+ .attr("class", function (d, i) {
+ return "colLabel mono c" + i;
+ })
+ .on("mouseover", function(d) {
+ d3.select(this).classed("text-hover",true);
+ d3.select(this).style("font-size", parseInt(cellSize * 1.3) + "px");
+ })
+ .on("mouseout" , function(d) {
+ d3.select(this).classed("text-hover",false);
+ d3.select(this).style("font-size", parseInt(cellSize) + "px");
+ })
+ .on("click", function(d, i) {
+ self.colSortOrder=!self.colSortOrder;
+ self._sortByLabel("c", i, self.colSortOrder);
+ d3.select("#order").property("selectedIndex", 4).node().focus();
+ });
+ },
+
+ // build row labels
+ _buildRowLabels: function() {
+ // link this
+ var self = this;
+
+ // gather data
+ var cellSize = this.cellSize;
+ var rowIndex = this.rowIndex;
+ var rowLabel = this.rowLabel;
+
+ // draw labels
+ var rowLabels = this.svg.append("g")
+ .selectAll(".rowLabelg")
+ .data(rowLabel)
+ .enter()
+ .append("text")
+ .text(function (d) {
+ return d;
+ })
+ .attr("x", 0)
+ .attr("y", function (d, i) {
+ return rowIndex.indexOf(i) * cellSize;
+ })
+ .style("font-size", cellSize + "px")
+ .style("text-anchor", "end")
+ .attr("transform", "translate(-10," + cellSize / 1.5 + ")")
+ .attr("class", function (d, i) {
+ return "rowLabel mono r" + i;
+ } )
+ .on("mouseover", function(d) {
+ d3.select(this).classed("text-hover",true);
+ d3.select(this).style("font-size", parseInt(cellSize * 1.3) + "px");
+ })
+ .on("mouseout" , function(d) {
+ d3.select(this).classed("text-hover",false);
+ d3.select(this).style("font-size", parseInt(cellSize) + "px");
+ })
+ .on("click", function(d, i) {
+ self.rowSortOrder=!self.rowSortOrder;
+ self._sortByLabel("r", i, self.rowSortOrder);
+ d3.select("#order").property("selectedIndex", 4).node().focus();
+ });
+ },
+
+ // build heat map
+ _buildHeatMap: function() {
+ // link this
+ var self = this;
+
+ // gather data
+ var cellSize = this.cellSize;
+ var rowIndex = this.rowIndex;
+ var rowLabel = this.rowLabel;
+ var colIndex = this.colIndex;
+ var colLabel = this.colLabel;
+
+ // heat map
+ var heatMap = this.svg.append("g").attr("class","g3")
+ .selectAll(".cellg")
+ .data(self.data, function(d) {
+ return d.row_rank + ":" + d.col_rank;
+ })
+ .enter()
+ .append("rect")
+ .attr("x", function(d) {
+ return colIndex.indexOf(d.col_rank) * cellSize;
+ })
+ .attr("y", function(d) {
+ return rowIndex.indexOf(d.row_rank) * cellSize;
+ })
+ .attr("class", function(d){
+ return "cell cell-border cr" + d.row_rank + " cc" + d.col_rank;
+ })
+ .attr("width", cellSize)
+ .attr("height", cellSize)
+ .style("fill", function(d) {
+ return self.colorScale(d.value);
+ })
+ .on("mouseover", function(d){
+ // highlight text
+ d3.select(this).classed("cell-hover",true);
+ d3.selectAll(".rowLabel").classed("text-highlight",function(r,ri){ return ri==(d.row_rank);});
+ d3.selectAll(".colLabel").classed("text-highlight",function(c,ci){ return ci==(d.col_rank);});
+
+ // update the tooltip position and value
+ d3.select("#heatmap-tooltip")
+ .style("left", (d3.event.pageX+10) + "px")
+ .style("top", (d3.event.pageY-10) + "px")
+ .select("#value")
+ .text("Label: " + rowLabel[d.row_rank] + " | " + colLabel[d.col_rank] + ", Value: " + d.value);
+ // show the tooltip
+ d3.select("#heatmap-tooltip").classed("hidden", false);
+ })
+ .on("mouseout", function(){
+ d3.select(this).classed("cell-hover",false);
+ d3.selectAll(".rowLabel").classed("text-highlight",false);
+ d3.selectAll(".colLabel").classed("text-highlight",false);
+ d3.select("#heatmap-tooltip").classed("hidden", true);
+ });
+ },
+
+ // change ordering of cells
+ _sortByLabel: function(rORc, i, sortOrder) {
+ // get cell size
+ var cellSize = this.cellSize;
+
+ // define transition / prepare element
+ var t = this.svg.transition().duration(this.options.pace);
+
+ // collect cells
+ var cells=[];
+ t.selectAll(".c" + rORc + i)
+ .filter(function(ce){
+ cells.push(ce);
+ });
+
+ // sort cells
+ cells.sort(function(a, b) {
+ if (sortOrder) {
+ return b.value - a.value;
+ } else {
+ return a.value - b.value;
+ }
+ });
+
+ // rows or columns
+ if(rORc == "r") {
+ // get sorted key list
+ var sorted = [];
+ for (var i in cells) {
+ sorted.push(cells[i].col_rank);
+ }
+
+ // sort cells
+ t.selectAll(".cell")
+ .attr("x", function(d) {
+ return sorted.indexOf(d.col_rank) * cellSize;
+ });
+
+ // sort labels
+ t.selectAll(".colLabel")
+ .attr("y", function (d, i) {
+ return sorted.indexOf(i) * cellSize;
+ });
+ } else {
+ // get sorted key list
+ sorted = [];
+ for (var i in cells) {
+ sorted.push(cells[i].row_rank);
+ }
+
+ // sort cells
+ t.selectAll(".cell")
+ .attr("y", function(d) {
+ return sorted.indexOf(d.row_rank) * cellSize;
+ });
+
+ // sort labels
+ t.selectAll(".rowLabel")
+ .attr("y", function (d, i) {
+ return sorted.indexOf(i) * cellSize;
+ });
+ }
+ },
+
+ // sort function
+ _sortByOrder: function (value) {
+ // link this
+ var self = this;
+
+ // gather data
+ var cellSize = this.cellSize;
+ var rowIndex = this.rowIndex;
+ var rowLabel = this.rowLabel;
+ var colIndex = this.colIndex;
+ var colLabel = this.colLabel;
+
+ // set duration / select element
+ var t = this.svg.transition().duration(this.options.pace);
+ if(value=="hclust"){
+ t.selectAll(".cell")
+ .attr("x", function(d) {
+ return colIndex.indexOf(d.col_rank) * cellSize;
+ })
+ .attr("y", function(d) {
+ return rowIndex.indexOf(d.row_rank) * cellSize;
+ });
+
+ t.selectAll(".rowLabel")
+ .attr("y", function(d, i) {
+ return rowIndex.indexOf(i) * cellSize;
+ });
+
+ t.selectAll(".colLabel")
+ .attr("y", function(d, i) {
+ return colIndex.indexOf(i) * cellSize;
+ });
+
+ } else if (value=="byboth") {
+ t.selectAll(".cell")
+ .attr("x", function(d) {
+ return d.col_rank * cellSize;
+ })
+ .attr("y", function(d) {
+ return d.row_rank * cellSize;
+ });
+
+ t.selectAll(".rowLabel")
+ .attr("y", function (d, i) {
+ return i * cellSize;
+ });
+
+ t.selectAll(".colLabel")
+ .attr("y", function (d, i) {
+ return i * cellSize;
+ });
+ } else if (value=="byrow") {
+ t.selectAll(".cell")
+ .attr("y", function(d) {
+ return d.row_rank * cellSize;
+ });
+
+ t.selectAll(".rowLabel")
+ .attr("y", function (d, i) {
+ return i * cellSize;
+ });
+ } else if (value=="bycol"){
+ t.selectAll(".cell")
+ .attr("x", function(d) {
+ return d.col_rank * cellSize;
+ });
+ t.selectAll(".colLabel")
+ .attr("y", function (d, i) {
+ return i * cellSize;
+ });
+ }
+ },
// selection of cells
_addSelectionTool: function() {
@@ -224,455 +583,115 @@
// selection
//
var sa=d3.select(".g3")
- .on("mousedown", function() {
- if( !d3.event.altKey) {
- d3.selectAll(".cell-selected").classed("cell-selected", false);
- d3.selectAll(".rowLabel").classed("text-selected", false);
- d3.selectAll(".colLabel").classed("text-selected", false);
+ .on("mousedown", function() {
+ if( !d3.event.altKey) {
+ d3.selectAll(".cell-selected").classed("cell-selected", false);
+ d3.selectAll(".rowLabel").classed("text-selected", false);
+ d3.selectAll(".colLabel").classed("text-selected", false);
+ }
+ var p = d3.mouse(this);
+ sa.append("rect")
+ .attr({
+ rx : 0,
+ ry : 0,
+ class : "selection",
+ x : p[0],
+ y : p[1],
+ width : 1,
+ height : 1
+ })
+ })
+ .on("mousemove", function() {
+ var s = sa.select("rect.selection");
+
+ if(!s.empty()) {
+ var p = d3.mouse(this),
+ d = {
+ x : parseInt(s.attr("x"), 10),
+ y : parseInt(s.attr("y"), 10),
+ width : parseInt(s.attr("width"), 10),
+ height : parseInt(s.attr("height"), 10)
+ },
+ move = {
+ x : p[0] - d.x,
+ y : p[1] - d.y
+ };
+
+ if(move.x < 1 || (move.x*2<d.width)) {
+ d.x = p[0];
+ d.width -= move.x;
+ } else {
+ d.width = move.x;
}
- var p = d3.mouse(this);
- sa.append("rect")
- .attr({
- rx : 0,
- ry : 0,
- class : "selection",
- x : p[0],
- y : p[1],
- width : 1,
- height : 1
- })
- })
- .on("mousemove", function() {
- var s = sa.select("rect.selection");
-
- if(!s.empty()) {
- var p = d3.mouse(this),
- d = {
- x : parseInt(s.attr("x"), 10),
- y : parseInt(s.attr("y"), 10),
- width : parseInt(s.attr("width"), 10),
- height : parseInt(s.attr("height"), 10)
- },
- move = {
- x : p[0] - d.x,
- y : p[1] - d.y
- };
-
- if(move.x < 1 || (move.x*2<d.width)) {
- d.x = p[0];
- d.width -= move.x;
- } else {
- d.width = move.x;
- }
- if(move.y < 1 || (move.y*2<d.height)) {
- d.y = p[1];
- d.height -= move.y;
- } else {
- d.height = move.y;
- }
- s.attr(d);
-
- // deselect all temporary selected state objects
- d3.selectAll(".cell-selection.cell-selected").classed("cell-selected", false);
- d3.selectAll(".text-selection.text-selected").classed("text-selected",false);
- d3.selectAll(".cell").filter(function(cell_d, i) {
- if(!d3.select(this).classed("cell-selected") &&
- // inner circle inside selection frame
- (this.x.baseVal.value)+cellSize >= d.x && (this.x.baseVal.value)<=d.x+d.width &&
- (this.y.baseVal.value)+cellSize >= d.y && (this.y.baseVal.value)<=d.y+d.height)
- {
- d3.select(this)
- .classed("cell-selection", true)
- .classed("cell-selected", true);
+ if(move.y < 1 || (move.y*2<d.height)) {
+ d.y = p[1];
+ d.height -= move.y;
+ } else {
+ d.height = move.y;
+ }
+ s.attr(d);
+
+ // deselect all temporary selected state objects
+ d3.selectAll(".cell-selection.cell-selected").classed("cell-selected", false);
+ d3.selectAll(".text-selection.text-selected").classed("text-selected",false);
+ d3.selectAll(".cell").filter(function(cell_d, i) {
+ if(!d3.select(this).classed("cell-selected") &&
+ // inner circle inside selection frame
+ (this.x.baseVal.value)+cellSize >= d.x && (this.x.baseVal.value)<=d.x+d.width &&
+ (this.y.baseVal.value)+cellSize >= d.y && (this.y.baseVal.value)<=d.y+d.height)
+ {
+ d3.select(this)
+ .classed("cell-selection", true)
+ .classed("cell-selected", true);
- d3.select(".r"+(cell_d.row_rank))
- .classed("text-selection",true)
- .classed("text-selected",true);
+ d3.select(".r"+(cell_d.row_rank))
+ .classed("text-selection",true)
+ .classed("text-selected",true);
- d3.select(".c"+(cell_d.col_rank))
- .classed("text-selection",true)
- .classed("text-selected",true);
- }
- });
- }
- })
- .on("mouseup", function() {
+ d3.select(".c"+(cell_d.col_rank))
+ .classed("text-selection",true)
+ .classed("text-selected",true);
+ }
+ });
+ }
+ })
+ .on("mouseup", function() {
+ // remove selection frame
+ sa.selectAll("rect.selection").remove();
+
+ // remove temporary selection marker class
+ d3.selectAll(".cell-selection").classed("cell-selection", false);
+ d3.selectAll(".text-selection").classed("text-selection",false);
+ })
+ .on("mouseout", function() {
+ if(d3.event.relatedTarget.tagName=='html') {
// remove selection frame
sa.selectAll("rect.selection").remove();
-
+
// remove temporary selection marker class
d3.selectAll(".cell-selection").classed("cell-selection", false);
- d3.selectAll(".text-selection").classed("text-selection",false);
- })
- .on("mouseout", function() {
- if(d3.event.relatedTarget.tagName=='html') {
- // remove selection frame
- sa.selectAll("rect.selection").remove();
-
- // remove temporary selection marker class
- d3.selectAll(".cell-selection").classed("cell-selection", false);
- d3.selectAll(".rowLabel").classed("text-selected",false);
- d3.selectAll(".colLabel").classed("text-selected",false);
- }
- });
- },
-
- // build legend
- _buildLegend: function() {
- // link this
- var self = this;
-
- // gather data
- var cellSize = this.cellSize;
- var height = this.height;
- var legendCellWidth = this.width / this.nColors;
-
- // create range labels
- var dataRange = [];
- for(var i = 0; i < this.nColors; i++) {
- dataRange.push('');
+ d3.selectAll(".rowLabel").classed("text-selected",false);
+ d3.selectAll(".colLabel").classed("text-selected",false);
}
-
- // prepare indices
- var dataRangeMin = 0;
- var dataRangeMid = parseInt((dataRange.length - 1) / 2);
- var dataRangeMax = dataRange.length - 1;
-
- // add labels
- dataRange[dataRangeMin] = this.min;
- dataRange[dataRangeMid] = this.mid;
- dataRange[dataRangeMax] = this.max;
-
- // create legend
- var legend = this.svg.selectAll(".legend")
- .data(dataRange)
- .enter().append("g")
- .attr("class", "legend");
+ });
+ },
- // add boxes
- legend.append("rect")
- .attr("x", function(d, i) {
- return legendCellWidth * i;
- })
- .attr("y", height + cellSize)
- .attr("width", legendCellWidth)
- .attr("height", cellSize)
- .style("fill", function(d, i) {
- return self.options.colors[i];
- });
-
- // add text
- legend.append("text")
- .attr("class", "mono")
- .text(function(d) {
- return d;
- })
- .attr("width", legendCellWidth)
- .attr("x", function(d, i) {
- return legendCellWidth * i;
- })
- .attr("y", height + cellSize)
- .style("font-size", cellSize + "px");
- },
-
- // build column labels
- _buildColLabels: function() {
- // link this
- var self = this;
-
- // gather data
- var cellSize = this.cellSize;
- var colIndex = this.colIndex;
- var colLabel = this.colLabel;
-
- // column labels
- var colLabels = this.svg.append("g")
- .selectAll(".colLabelg")
- .data(colLabel)
- .enter()
- .append("text")
- .text(function (d) {
- return d;
- })
- .attr("x", 0)
- .attr("y", function (d, i) {
- return colIndex.indexOf(i) * cellSize;
- })
- .style("font-size", cellSize + "px")
- .style("text-anchor", "left")
- .attr("transform", "translate(" + cellSize / 2 + ", -17) rotate (-90)")
- .attr("class", function (d, i) {
- return "colLabel mono c" + i;
- })
- .on("mouseover", function(d) {
- d3.select(this).classed("text-hover",true);
- d3.select(this).style("font-size", parseInt(cellSize * 1.3) + "px");
- })
- .on("mouseout" , function(d) {
- d3.select(this).classed("text-hover",false);
- d3.select(this).style("font-size", parseInt(cellSize) + "px");
- })
- .on("click", function(d, i) {
- self.colSortOrder=!self.colSortOrder;
- self._sortByLabel("c", i, self.colSortOrder);
- d3.select("#order").property("selectedIndex", 4).node().focus();
- });
- },
-
- // build row labels
- _buildRowLabels: function() {
- // link this
- var self = this;
-
- // gather data
- var cellSize = this.cellSize;
- var rowIndex = this.rowIndex;
- var rowLabel = this.rowLabel;
-
- // draw labels
- var rowLabels = this.svg.append("g")
- .selectAll(".rowLabelg")
- .data(rowLabel)
- .enter()
- .append("text")
- .text(function (d) {
- return d;
- })
- .attr("x", 0)
- .attr("y", function (d, i) {
- return rowIndex.indexOf(i) * cellSize;
- })
- .style("font-size", cellSize + "px")
- .style("text-anchor", "end")
- .attr("transform", "translate(-10," + cellSize / 1.5 + ")")
- .attr("class", function (d, i) {
- return "rowLabel mono r" + i;
- } )
- .on("mouseover", function(d) {
- d3.select(this).classed("text-hover",true);
- d3.select(this).style("font-size", parseInt(cellSize * 1.3) + "px");
- })
- .on("mouseout" , function(d) {
- d3.select(this).classed("text-hover",false);
- d3.select(this).style("font-size", parseInt(cellSize) + "px");
- })
- .on("click", function(d, i) {
- self.rowSortOrder=!self.rowSortOrder;
- self._sortByLabel("r", i, self.rowSortOrder);
- d3.select("#order").property("selectedIndex", 4).node().focus();
- });
- },
-
- // build heat map
- _buildHeatMap: function() {
- // link this
- var self = this;
-
- // gather data
- var cellSize = this.cellSize;
- var rowIndex = this.rowIndex;
- var rowLabel = this.rowLabel;
- var colIndex = this.colIndex;
- var colLabel = this.colLabel;
-
- // heat map
- var heatMap = this.svg.append("g").attr("class","g3")
- .selectAll(".cellg")
- .data(self.data, function(d) {
- return d.row_rank + ":" + d.col_rank;
- })
- .enter()
- .append("rect")
- .attr("x", function(d) {
- return colIndex.indexOf(d.col_rank) * cellSize;
- })
- .attr("y", function(d) {
- return rowIndex.indexOf(d.row_rank) * cellSize;
- })
- .attr("class", function(d){
- return "cell cell-border cr" + d.row_rank + " cc" + d.col_rank;
- })
- .attr("width", cellSize)
- .attr("height", cellSize)
- .style("fill", function(d) {
- return self.colorScale(d.value);
- })
- .on("mouseover", function(d){
- // highlight text
- d3.select(this).classed("cell-hover",true);
- d3.selectAll(".rowLabel").classed("text-highlight",function(r,ri){ return ri==(d.row_rank);});
- d3.selectAll(".colLabel").classed("text-highlight",function(c,ci){ return ci==(d.col_rank);});
-
- // update the tooltip position and value
- d3.select("#heatmap-tooltip")
- .style("left", (d3.event.pageX+10) + "px")
- .style("top", (d3.event.pageY-10) + "px")
- .select("#value")
- .text("Label: " + rowLabel[d.row_rank] + " | " + colLabel[d.col_rank] + ", Value: " + d.value);
- // show the tooltip
- d3.select("#heatmap-tooltip").classed("hidden", false);
- })
- .on("mouseout", function(){
- d3.select(this).classed("cell-hover",false);
- d3.selectAll(".rowLabel").classed("text-highlight",false);
- d3.selectAll(".colLabel").classed("text-highlight",false);
- d3.select("#heatmap-tooltip").classed("hidden", true);
- });
- },
-
- // change ordering of cells
- _sortByLabel: function(rORc, i, sortOrder) {
- // get cell size
- var cellSize = this.cellSize;
-
- // define transition / prepare element
- var t = this.svg.transition().duration(this.options.pace);
-
- // collect cells
- var cells=[];
- t.selectAll(".c" + rORc + i)
- .filter(function(ce){
- cells.push(ce);
- });
-
- // sort cells
- cells.sort(function(a, b) {
- if (sortOrder) {
- return b.value - a.value;
- } else {
- return a.value - b.value;
- }
- });
-
- // rows or columns
- if(rORc == "r") {
- // get sorted key list
- var sorted = [];
- for (var i in cells) {
- sorted.push(cells[i].col_rank);
- }
-
- // sort cells
- t.selectAll(".cell")
- .attr("x", function(d) {
- return sorted.indexOf(d.col_rank) * cellSize;
- });
-
- // sort labels
- t.selectAll(".colLabel")
- .attr("y", function (d, i) {
- return sorted.indexOf(i) * cellSize;
- });
- } else {
- // get sorted key list
- sorted = [];
- for (var i in cells) {
- sorted.push(cells[i].row_rank);
- }
-
- // sort cells
- t.selectAll(".cell")
- .attr("y", function(d) {
- return sorted.indexOf(d.row_rank) * cellSize;
- });
-
- // sort labels
- t.selectAll(".rowLabel")
- .attr("y", function (d, i) {
- return sorted.indexOf(i) * cellSize;
- });
- }
- },
-
- // sort function
- _order: function (value) {
- // link this
- var self = this;
-
- // gather data
- var cellSize = this.cellSize;
- var rowIndex = this.rowIndex;
- var rowLabel = this.rowLabel;
- var colIndex = this.colIndex;
- var colLabel = this.colLabel;
-
- // set duration / select element
- var t = this.svg.transition().duration(this.options.pace);
- if(value=="hclust"){
- t.selectAll(".cell")
- .attr("x", function(d) {
- return colIndex.indexOf(d.col_rank) * cellSize;
- })
- .attr("y", function(d) {
- return rowIndex.indexOf(d.row_rank) * cellSize;
- });
-
- t.selectAll(".rowLabel")
- .attr("y", function(d, i) {
- return rowIndex.indexOf(i) * cellSize;
- });
-
- t.selectAll(".colLabel")
- .attr("y", function(d, i) {
- return colIndex.indexOf(i) * cellSize;
- });
-
- } else if (value=="byboth") {
- t.selectAll(".cell")
- .attr("x", function(d) {
- return d.col_rank * cellSize;
- })
- .attr("y", function(d) {
- return d.row_rank * cellSize;
- });
-
- t.selectAll(".rowLabel")
- .attr("y", function (d, i) {
- return i * cellSize;
- });
-
- t.selectAll(".colLabel")
- .attr("y", function (d, i) {
- return i * cellSize;
- });
- } else if (value=="byrow") {
- t.selectAll(".cell")
- .attr("y", function(d) {
- return d.row_rank * cellSize;
- });
-
- t.selectAll(".rowLabel")
- .attr("y", function (d, i) {
- return i * cellSize;
- });
- } else if (value=="bycol"){
- t.selectAll(".cell")
- .attr("x", function(d) {
- return d.col_rank * cellSize;
- });
- t.selectAll(".colLabel")
- .attr("y", function (d, i) {
- return i * cellSize;
- });
- }
- },
-
- // template
- _templateSelect: function() {
- return '<select id="order">' +
- '<option value="hclust">Cluster</option>' +
- '<option value="byboth">Sort by row and column</option>' +
- '<option value="byrow">Sort by row label</option>' +
- '<option value="bycol">Sort by column label</option>' +
- '</select>';
- },
-
- // template
- _templateTooltip: function() {
- return '<div id="heatmap-tooltip" class="hidden">' +
- '<p><span id="value"></p>'
- '</div>';
- }
- });
+ // template
+ _templateSelect: function() {
+ return '<select id="order">' +
+ '<option value="hclust">Cluster</option>' +
+ '<option value="byboth">Sort by row and column</option>' +
+ '<option value="byrow">Sort by row label</option>' +
+ '<option value="bycol">Sort by column label</option>' +
+ '</select>';
+ },
+
+ // template
+ _templateTooltip: function() {
+ return '<div id="heatmap-tooltip" class="hidden">' +
+ '<p><span id="value"></p>'
+ '</div>';
+ }
+});
});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Tweaks to the recent Tool Shed API enhancements, making them more RESTful.
by commits-noreply@bitbucket.org 01 May '14
by commits-noreply@bitbucket.org 01 May '14
01 May '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/a924f00f3158/
Changeset: a924f00f3158
User: greg
Date: 2014-05-01 22:44:44
Summary: Tweaks to the recent Tool Shed API enhancements, making them more RESTful.
Affected #: 5 files
diff -r f337aefda5c6c709760c51019df777c083b036bb -r a924f00f31589ab8568a7e9c3b1f4f27a5916d42 lib/galaxy/webapps/tool_shed/api/categories.py
--- a/lib/galaxy/webapps/tool_shed/api/categories.py
+++ b/lib/galaxy/webapps/tool_shed/api/categories.py
@@ -17,9 +17,9 @@
return value_mapper
@web.expose_api
- def create_category( self, trans, payload, **kwd ):
+ def create( self, trans, payload, **kwd ):
"""
- POST /api/categories/create_category
+ POST /api/categories
Returns a dictionary of information about the created category.
: param key: the current Galaxy admin user's API key
diff -r f337aefda5c6c709760c51019df777c083b036bb -r a924f00f31589ab8568a7e9c3b1f4f27a5916d42 lib/galaxy/webapps/tool_shed/api/users.py
--- a/lib/galaxy/webapps/tool_shed/api/users.py
+++ b/lib/galaxy/webapps/tool_shed/api/users.py
@@ -16,9 +16,9 @@
"""RESTful controller for interactions with users in the Tool Shed."""
@web.expose_api
- def create_user( self, trans, payload, **kwd ):
+ def create( self, trans, payload, **kwd ):
"""
- POST /api/users/create_user
+ POST /api/users
Returns a dictionary of information about the created user.
: param key: the current Galaxy admin user's API key
diff -r f337aefda5c6c709760c51019df777c083b036bb -r a924f00f31589ab8568a7e9c3b1f4f27a5916d42 lib/galaxy/webapps/tool_shed/buildapp.py
--- a/lib/galaxy/webapps/tool_shed/buildapp.py
+++ b/lib/galaxy/webapps/tool_shed/buildapp.py
@@ -85,7 +85,6 @@
controller='categories',
name_prefix='category_',
path_prefix='/api',
- new={ 'create_category' : 'POST' },
parent_resources=dict( member_name='category', collection_name='categories' ) )
webapp.mapper.resource( 'repository',
'repositories',
@@ -112,7 +111,6 @@
controller='users',
name_prefix='user_',
path_prefix='/api',
- new={ 'create_user' : 'POST' },
parent_resources=dict( member_name='user', collection_name='users' ) )
webapp.finalize_config()
# Wrap the webapp in some useful middleware
diff -r f337aefda5c6c709760c51019df777c083b036bb -r a924f00f31589ab8568a7e9c3b1f4f27a5916d42 lib/tool_shed/scripts/api/create_categories.py
--- a/lib/tool_shed/scripts/api/create_categories.py
+++ b/lib/tool_shed/scripts/api/create_categories.py
@@ -39,7 +39,7 @@
if name is not None and description is not None:
data = dict( name=name,
description=description )
- url = '%s/api/categories/new/create_category' % to_tool_shed
+ url = '%s/api/categories' % to_tool_shed
try:
response = submit( url, data, api_key )
except Exception, e:
diff -r f337aefda5c6c709760c51019df777c083b036bb -r a924f00f31589ab8568a7e9c3b1f4f27a5916d42 lib/tool_shed/scripts/api/create_users.py
--- a/lib/tool_shed/scripts/api/create_users.py
+++ b/lib/tool_shed/scripts/api/create_users.py
@@ -42,7 +42,7 @@
data = dict( email=email,
password=password,
username=username )
- url = '%s/api/users/new/create_user' % to_tool_shed
+ url = '%s/api/users' % to_tool_shed
try:
response = submit( url, data, api_key )
except Exception, e:
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
01 May '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f337aefda5c6/
Changeset: f337aefda5c6
User: greg
Date: 2014-05-01 22:07:48
Summary: Enhance the Tool Shed API to provide information about users that is public (i.e., public username) and to include a function for creating a new user. Add a Tool Shed API script that retrieves all of the pubic information about users from a Tool Shed, automatically generates test email accounts and test passwords, and creates the list of users in another Tool Shed. This script streamlines the process of populating a development Tool Shed with users, enabling import of a repository capsule exportied from the specified Tool Shed. This simplifies the process of developing new repository hierarchies in a local development Tool Shed.
Affected #: 5 files
diff -r f6561aae5484240c8b76cc32a7b4b1f501b0e660 -r f337aefda5c6c709760c51019df777c083b036bb lib/galaxy/webapps/tool_shed/api/users.py
--- /dev/null
+++ b/lib/galaxy/webapps/tool_shed/api/users.py
@@ -0,0 +1,128 @@
+import logging
+import os
+
+from galaxy import util
+from galaxy import web
+from galaxy.web.base.controller import BaseAPIController
+from galaxy.security.validate_user_input import validate_email
+from galaxy.security.validate_user_input import validate_publicname
+from galaxy.security.validate_user_input import validate_password
+import tool_shed.util.shed_util_common as suc
+
+log = logging.getLogger( __name__ )
+
+
+class UsersController( BaseAPIController ):
+ """RESTful controller for interactions with users in the Tool Shed."""
+
+ @web.expose_api
+ def create_user( self, trans, payload, **kwd ):
+ """
+ POST /api/users/create_user
+ Returns a dictionary of information about the created user.
+
+: param key: the current Galaxy admin user's API key
+
+ The following parameters are included in the payload.
+ :param username (required): the public username of the user
+ """
+ user_dict = dict( message = '',
+ status = 'ok' )
+ # Make sure the current user's API key proves he is an admin user in this Tool Shed.
+ if trans.user_is_admin():
+ # Get the information about the user to be created from the payload.
+ email = payload.get( 'email', '' )
+ password = payload.get( 'password', '' )
+ username = payload.get( 'username', '' )
+ message = self.__validate( trans,
+ email=email,
+ password=password,
+ confirm=password,
+ username=username )
+ if message:
+ message = 'email: %s, username: %s - %s' % ( email, username, message )
+ user_dict[ 'message' ] = message
+ user_dict[ 'status' ] = 'error'
+ else:
+ # Create the user.
+ user = self.__create_user( trans, email, username, password )
+ user_dict = user.to_dict( view='element',
+ value_mapper=self.__get_value_mapper( trans ) )
+ user_dict[ 'message' ] = "User '%s' has been created." % str( user.username )
+ user_dict[ 'url' ] = web.url_for( controller='users',
+ action='show',
+ id=trans.security.encode_id( user.id ) )
+ else:
+ user_dict[ 'message' ] = 'You are not authorized to create a user in this Tool Shed.'
+ user_dict[ 'status' ] = 'error'
+ return user_dict
+
+ def __create_user( self, trans, email, username, password ):
+ user = trans.app.model.User( email=email )
+ user.set_password_cleartext( password )
+ user.username = username
+ if trans.app.config.user_activation_on:
+ user.active = False
+ else:
+ user.active = True # Activation is off, every new user is active by default.
+ trans.sa_session.add( user )
+ trans.sa_session.flush()
+ trans.app.security_agent.create_private_user_role( user )
+ return user
+
+ def __get_value_mapper( self, trans ):
+ value_mapper = { 'id' : trans.security.encode_id }
+ return value_mapper
+
+ @web.expose_api_anonymous
+ def index( self, trans, deleted=False, **kwd ):
+ """
+ GET /api/users
+ Returns a list of dictionaries that contain information about each user.
+ """
+ # Example URL: http://localhost:9009/api/users
+ user_dicts = []
+ deleted = util.asbool( deleted )
+ for user in trans.sa_session.query( trans.app.model.User ) \
+ .filter( trans.app.model.User.table.c.deleted == deleted ) \
+ .order_by( trans.app.model.User.table.c.username ):
+ user_dict = user.to_dict( view='collection',
+ value_mapper=self.__get_value_mapper( trans ) )
+ user_dict[ 'url' ] = web.url_for( controller='users',
+ action='show',
+ id=trans.security.encode_id( user.id ) )
+ user_dicts.append( user_dict )
+ return user_dicts
+
+ @web.expose_api_anonymous
+ def show( self, trans, id, **kwd ):
+ """
+ GET /api/users/{encoded_user_id}
+ Returns a dictionary of information about a user.
+
+ :param id: the encoded id of the User object.
+ """
+ # Example URL: http://localhost:9009/api/users/f9cad7b01a472135
+ user = suc.get_user( trans, id )
+ if user is None:
+ user_dict = dict( message = 'Unable to locate user record for id %s.' % ( str( id ) ),
+ status = 'error' )
+ return user_dict
+ user_dict = user.to_dict( view='element',
+ value_mapper=self.__get_value_mapper( trans ) )
+ user_dict[ 'url' ] = web.url_for( controller='users',
+ action='show',
+ id=trans.security.encode_id( user.id ) )
+ return user_dict
+
+ def __validate( self, trans, email, password, confirm, username ):
+ if not username:
+ return "A public user name is required in the Tool Shed."
+ if username in [ 'repos' ]:
+ return "The term <b>%s</b> is a reserved word in the Tool Shed, so it cannot be used as a public user name." % username
+ message = validate_email( trans, email )
+ if not message:
+ message = validate_password( trans, password, confirm )
+ if not message and username:
+ message = validate_publicname( trans, username )
+ return message
diff -r f6561aae5484240c8b76cc32a7b4b1f501b0e660 -r f337aefda5c6c709760c51019df777c083b036bb lib/galaxy/webapps/tool_shed/buildapp.py
--- a/lib/galaxy/webapps/tool_shed/buildapp.py
+++ b/lib/galaxy/webapps/tool_shed/buildapp.py
@@ -107,6 +107,13 @@
name_prefix='repository_revision_',
path_prefix='/api',
parent_resources=dict( member_name='repository_revision', collection_name='repository_revisions' ) )
+ webapp.mapper.resource( 'user',
+ 'users',
+ controller='users',
+ name_prefix='user_',
+ path_prefix='/api',
+ new={ 'create_user' : 'POST' },
+ parent_resources=dict( member_name='user', collection_name='users' ) )
webapp.finalize_config()
# Wrap the webapp in some useful middleware
if kwargs.get( 'middleware', True ):
diff -r f6561aae5484240c8b76cc32a7b4b1f501b0e660 -r f337aefda5c6c709760c51019df777c083b036bb lib/galaxy/webapps/tool_shed/model/__init__.py
--- a/lib/galaxy/webapps/tool_shed/model/__init__.py
+++ b/lib/galaxy/webapps/tool_shed/model/__init__.py
@@ -20,8 +20,8 @@
class User( object, Dictifiable ):
- dict_collection_visible_keys = ( 'id', 'email' )
- dict_element_visible_keys = ( 'id', 'email', 'username' )
+ dict_collection_visible_keys = ( 'id', 'username' )
+ dict_element_visible_keys = ( 'id', 'username' )
def __init__( self, email=None, password=None ):
self.email = email
diff -r f6561aae5484240c8b76cc32a7b4b1f501b0e660 -r f337aefda5c6c709760c51019df777c083b036bb lib/tool_shed/scripts/api/create_categories.py
--- a/lib/tool_shed/scripts/api/create_categories.py
+++ b/lib/tool_shed/scripts/api/create_categories.py
@@ -9,10 +9,10 @@
This script is very useful for populating a new development Tool Shed with the set of categories that
currently exist in either the test or main public Galaxy Tool Sheds. This will streamline building
-new repository hierarchies in the development Tool Shed and exportin gthem into a capsule that can be
+new repository hierarchies in the development Tool Shed and exporting them into a capsule that can be
imported into one of the public Tool Sheds.
-Here is a working example of how to use this script to retrieve the current set of repositories that are
+Here is a working example of how to use this script to retrieve the current set of categories that are
available in the test public Tool Shed and create each of them in a local development Tool Shed.
./create_categories.py -a <api key> -f http://testtoolshed.g2.bx.psu.edu -t http://localhost:9009
diff -r f6561aae5484240c8b76cc32a7b4b1f501b0e660 -r f337aefda5c6c709760c51019df777c083b036bb lib/tool_shed/scripts/api/create_users.py
--- /dev/null
+++ b/lib/tool_shed/scripts/api/create_users.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python
+"""
+This script will retrieve a list of dictionaries (one for each user) from the Tool Shed defined
+by the --from_tool_shed parameter, which should be a base Tool Shed URL. It will retrieve the
+username from each dictionary and create a new user with that username in the Tool Shed defined
+by the --to_tool_shed parameter (a different base Tool Shed URL). An email and password value
+will automatically be provided for each user. Email addresses will be <username>@test.org and
+passwords will be testuser. Users that already exist with a specified username in the Tool Shed
+in which the users are being created will not be affected.
+
+This script is very useful for populating a new development Tool Shed with the set of users that
+currently exist in either the test or main public Galaxy Tool Sheds. This will streamline building
+new repository hierarchies in the development Tool Shed and exporting them into a capsule that can
+be imported into one of the public Tool Sheds.
+
+Here is a working example of how to use this script to retrieve the current set of users that
+are available in the test public Tool Shed and create each of them in a local development Tool Shed.
+
+./create_users.py -a <api key> -f http://testtoolshed.g2.bx.psu.edu -t http://localhost:9009
+"""
+
+import os
+import sys
+import argparse
+sys.path.insert( 0, os.path.dirname( __file__ ) )
+from common import get
+from common import submit
+
+def main( options ):
+ api_key = options.api
+ from_tool_shed = options.from_tool_shed.rstrip( '/' )
+ to_tool_shed = options.to_tool_shed.rstrip( '/' )
+ # Get the users from the specified Tool Shed.
+ url = '%s/api/users' % from_tool_shed
+ user_dicts = get( url )
+ create_response_dicts = []
+ for user_dict in user_dicts:
+ username = user_dict.get( 'username', None )
+ if username is not None:
+ email = '%s(a)test.org' % username
+ password = 'testuser'
+ data = dict( email=email,
+ password=password,
+ username=username )
+ url = '%s/api/users/new/create_user' % to_tool_shed
+ try:
+ response = submit( url, data, api_key )
+ except Exception, e:
+ response = str( e )
+ log.exception( str( e ) )
+ create_response_dict = dict( response=response )
+ create_response_dicts.append( create_response_dict )
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser( description='Retrieve a list of users from a Tool Shed and create them in another Tool Shed.' )
+ parser.add_argument( "-a", "--api", dest="api", required=True, help="API Key for Tool Shed in which users will be created" )
+ parser.add_argument( "-f", "--from_tool_shed", dest="from_tool_shed", required=True, help="URL of Tool Shed from which to retrieve the users" )
+ parser.add_argument( "-t", "--to_tool_shed", dest="to_tool_shed", required=True, help="URL of Tool Shed in which to create the users" )
+ options = parser.parse_args()
+ main( options )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: Charts: Heatmaps revised plugin code, now modularized and enabled for variable data
by commits-noreply@bitbucket.org 01 May '14
by commits-noreply@bitbucket.org 01 May '14
01 May '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f6561aae5484/
Changeset: f6561aae5484
User: guerler
Date: 2014-05-01 21:25:06
Summary: Charts: Heatmaps revised plugin code, now modularized and enabled for variable data
Affected #: 3 files
diff -r 5f89fecb2f0703ce237cc185b2ccbb2bc0fd2658 -r f6561aae5484240c8b76cc32a7b4b1f501b0e660 config/plugins/visualizations/charts/static/charts/heatmap/config.js
--- a/config/plugins/visualizations/charts/static/charts/heatmap/config.js
+++ b/config/plugins/visualizations/charts/static/charts/heatmap/config.js
@@ -4,6 +4,7 @@
title : 'Heatmap',
library : '',
tag : 'div',
+ use_panels : true,
columns : {
col_label : {
title : 'Columns',
diff -r 5f89fecb2f0703ce237cc185b2ccbb2bc0fd2658 -r f6561aae5484240c8b76cc32a7b4b1f501b0e660 config/plugins/visualizations/charts/static/charts/heatmap/heatmap-plugin.js
--- a/config/plugins/visualizations/charts/static/charts/heatmap/heatmap-plugin.js
+++ b/config/plugins/visualizations/charts/static/charts/heatmap/heatmap-plugin.js
@@ -20,313 +20,215 @@
cellSize: 0,
// color buckets
- colorBuckets: 0,
+ nColors: 0,
// default settings
optionsDefault: {
- margin : {
+ pace : 1000,
+ margin : {
top : 50,
right : 10,
bottom : 50,
left : 100
},
- colors : ['#005824','#1A693B','#347B53','#4F8D6B','#699F83','#83B09B','#9EC2B3','#B8D4CB','#D2E6E3','#EDF8FB','#FFFFFF','#F1EEF6','#E6D3E1','#DBB9CD','#D19EB9','#C684A4','#BB6990','#B14F7C','#A63467','#9B1A53','#91003F']
+ colors : ['#005824','#1A693B','#347B53','#4F8D6B','#699F83','#83B09B','#9EC2B3','#B8D4CB','#D2E6E3','#EDF8FB','#FFFFFF','#F1EEF6','#E6D3E1','#DBB9CD','#D19EB9','#C684A4','#BB6990','#B14F7C','#A63467','#9B1A53','#91003F']
},
// initialize
initialize: function(options) {
+ // link this
+ var self = this;
+
// load options
this.options = Utils.merge(options, this.optionsDefault)
- // add ui elements
- this.options.div.append(this._templateTooltip());
- this.options.div.append(this._templateSelect());
+ // check requirements
+ if (!this.options.data || !this.options.div) {
+ console.debug('FAILED - HeatMapPlugin::initialize() - Parameters (container and/or data) missing.');
+ return;
+ }
- // access data
- var data = this.options.data;
+ // link data
+ this.data = this.options.data;
- // identify unique labels
- var col_hash = {};
- var row_hash = {};
+ // set element
+ this.setElement(this.options.div);
- // create label indices
- this.colNumber = 0;
- this.rowNumber = 0;
- for (var i in data) {
- var cell = data[i];
+ //
+ // data indexing
+ //
+
+ // labels in alphabetical order
+ this.rowLabel = [];
+ this.colLabel = [];
+
+ // unique keys (key indices are unique per label and indicate the labels rank in the alphabetical sorting)
+ this.colRank = {};
+ this.rowRank = {};
+
+ // identify unqiue labels
+ for (var i in this.data) {
+ var cell = this.data[i];
// add label to index list
var col_label = cell.col_label;
- if (col_hash[col_label] === undefined) {
- col_hash[col_label] = ++this.colNumber;
+ if (this.colRank[col_label] === undefined) {
+ this.colRank[col_label] = true;
+ this.colLabel.push(col_label);
}
var row_label = cell.row_label;
- if (row_hash[row_label] === undefined) {
- row_hash[row_label] = ++this.rowNumber;
+ if (this.rowRank[row_label] === undefined) {
+ this.rowRank[row_label] = true;
+ this.rowLabel.push(row_label);
}
}
- // add indices to data
- for (var i in data) {
- var cell = data[i];
- cell.col = col_hash[cell.col_label];
- cell.row = row_hash[cell.row_label];
+ // set sizes
+ this.rowNumber = this.rowLabel.length
+ this.colNumber = this.colLabel.length
+
+ // sort labels alphabetical
+ this.rowLabel.sort();
+ this.colLabel.sort();
+
+ // generate sorted key list for rows
+ this.rowIndex = []
+ for (var i in this.rowLabel) {
+ var row_label = this.rowLabel[i];
+ var row_index = parseInt(i);
+ this.rowRank[row_label] = row_index;
+
+ // should contain clustering
+ this.rowIndex.push(row_index);
}
- // add row labels
- this.rowIndex = []
- for (var key in row_hash) {
- this.rowLabel.push(key);
- this.rowIndex.push(row_hash[key]);
+ // generate sorted key list for columns
+ this.colIndex = []
+ for (var i in this.colLabel) {
+ var col_label = this.colLabel[i];
+ var col_index = parseInt(i);
+ this.colRank[col_label] = col_index;
+
+ // should contain clustering
+ this.colIndex.push(col_index);
}
- // add col labels
- this.colIndex = []
- for (var key in col_hash) {
- this.colLabel.push(key);
- this.colIndex.push(col_hash[key]);
+ //
+ // parse indexing to cells, identify data range
+ //
+
+ // min/max
+ this.max = undefined;
+ this.min = undefined
+
+ // add indices to data
+ for (var i in this.data) {
+ // get cell data
+ var cell = this.data[i];
+
+ // add rank
+ cell.col_rank = this.colRank[cell.col_label];
+ cell.row_rank = this.rowRank[cell.row_label];
+
+ // identify max/min values
+ if (this.min == undefined || this.min > cell.value) {
+ this.min = cell.value;
+ }
+ if (this.max == undefined || this.max < cell.value) {
+ this.max = cell.value;
+ }
}
- console.log(this.rowIndex);
- console.log(this.colIndex);
+ // middle
+ this.mid = (this.max + this.min) / 2;
+
+ //
+ // set colors
+ //
// identify buckets
- this.colorBuckets = this.options.colors.length;
+ this.nColors = this.options.colors.length;
+ // color scale
+ this.colorScale = d3.scale.quantile()
+ .domain([this.min, this.mid, this.max])
+ .range(this.options.colors);
+
+ //
+ // add ui elements
+ //
+ // create ui elements
+ this.$tooltip = $(this._templateTooltip());
+ this.$select = $(this._templateSelect());
+
+ // append
+ this.$el.append(this.$tooltip);
+ this.$el.append(this.$select);
+
+ // add event to select field
+ this.$select.on('change', function(){
+ self._order(this.value);
+ });
+
+ //
// draw
- this._draw(this.options.div, this.options.data);
+ //
+ this._draw();
},
- _draw: function(container, data) {
+ _draw: function() {
+ // link this
+ var self = this;
+
+ // container
+ var container_width = this.$el.width();
+ var container_height = this.$el.height();
+
// get height
- this.width = parseInt(container.width()) - this.options.margin.left;
- this.height = parseInt(container.height()) - 2*this.options.margin.top;
+ this.width = this.$el.width() - this.options.margin.left - this.options.margin.right;
+ this.height = this.$el.height() - this.options.margin.top - this.options.margin.bottom;
// calculate cell size
- this.cellSize = Math.min( this.height / (this.rowNumber),
- this.width / (this.colNumber));
+ this.cellSize = Math.min(parseInt(this.height / this.rowNumber),
+ parseInt(this.width / this.colNumber));
// set width/height for plugin
- this.width = this.options.cellSize * this.colNumber;
- this.height = this.options.cellSize * this.rowNumber;
+ this.width = this.cellSize * this.colNumber;
+ this.height = this.cellSize * this.rowNumber;
- // set legend width
- this.legendElementWidth = this.options.cellSize * 2.5;
-
- // configure
- var margin = this.options.margin;
- var cellSize = this.cellSize;
- var colNumber = this.colNumber;
- var rowNumber = this.rowNumber;
- var colorBuckets = this.colorBuckets;
- var colors = this.options.colors;
- var rowIndex = this.rowIndex;
- var colIndex = this.colIndex;
- var colLabel = this.colLabel;
- var rowLabel = this.rowLabel;
- var width = this.width;
- var height = this.height;
- var legendElementWidth = this.legendElementWidth;
+ // get dimensions
+ var margin = this.options.margin;
+ var width = this.width;
+ var height = this.height;
- // color scale
- var colorScale = d3.scale.quantile()
- .domain([ -10, 0, 10])
- .range(colors);
-
- // add graph
- var svg = d3.select(container[0]).append('svg')
+ // add main group and translate
+ this.svg = d3.select(this.$el[0]).append('svg')
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.append("g")
- .attr("transform", "translate(" + margin.left + "," + margin.top + ")")
+ .attr("transform", "translate(" + (container_width - width) / 2 + "," + (container_height - height) / 2 + ")")
- // row labels
- var rowSortOrder=false;
- var colSortOrder=false;
- var rowLabels = svg.append("g")
- .selectAll(".rowLabelg")
- .data(rowLabel)
- .enter()
- .append("text")
- .text(function (d) { return d; })
- .attr("x", 0)
- .attr("y", function (d, i) { return rowIndex.indexOf(i+1) * cellSize; })
- .style("font-size", cellSize + "px")
- .style("text-anchor", "end")
- .attr("transform", "translate(-10," + cellSize / 1.5 + ")")
- .attr("class", function (d,i) { return "rowLabel mono r"+i;} )
- .on("mouseover", function(d) {
- d3.select(this).classed("text-hover",true);
- d3.select(this).style("font-size", parseInt(cellSize * 1.3) + "px");
- })
- .on("mouseout" , function(d) {
- d3.select(this).classed("text-hover",false);
- d3.select(this).style("font-size", parseInt(cellSize) + "px");
- })
- .on("click", function(d,i) {rowSortOrder=!rowSortOrder; sortbylabel("r",i,rowSortOrder);d3.select("#order").property("selectedIndex", 4).node().focus();;});
+ // reset sorting
+ this.rowSortOrder = false;
+ this.colSortOrder = false;
- // column labels
- var colLabels = svg.append("g")
- .selectAll(".colLabelg")
- .data(colLabel)
- .enter()
- .append("text")
- .text(function (d) { return d; })
- .attr("x", 0)
- .attr("y", function (d, i) { return colIndex.indexOf(i+1) * cellSize; })
- .style("font-size", cellSize + "px")
- .style("text-anchor", "left")
- .attr("transform", "translate("+cellSize/2 + ",-17) rotate (-90)")
- .attr("class", function (d,i) { return "colLabel mono c"+i;} )
- .on("mouseover", function(d) {
- d3.select(this).classed("text-hover",true);
- d3.select(this).style("font-size", parseInt(cellSize * 1.3) + "px");
- })
- .on("mouseout" , function(d) {
- d3.select(this).classed("text-hover",false);
- d3.select(this).style("font-size", parseInt(cellSize) + "px");
- })
- .on("click", function(d,i) {colSortOrder=!colSortOrder; sortbylabel("c",i,colSortOrder);d3.select("#order").property("selectedIndex", 4).node().focus();;});
-
- // heat map
- var heatMap = svg.append("g").attr("class","g3")
- .selectAll(".cellg")
- .data(data,function(d){return d.row+":"+d.col;})
- .enter()
- .append("rect")
- .attr("x", function(d) { return colIndex.indexOf(d.col) * cellSize; })
- .attr("y", function(d) { return rowIndex.indexOf(d.row) * cellSize; })
- .attr("class", function(d){return "cell cell-border cr"+(d.row-1)+" cc"+(d.col-1);})
- .attr("width", cellSize)
- .attr("height", cellSize)
- .style("fill", function(d) { return colorScale(d.value); })
- // .on("click", function(d) {
- // var rowtext=d3.select(".r"+(d.row-1));
- // if(rowtext.classed("text-selected")==false){
- // rowtext.classed("text-selected",true);
- // }else{
- // rowtext.classed("text-selected",false);
- // }
- //})
- .on("mouseover", function(d){
- //highlight text
- d3.select(this).classed("cell-hover",true);
- d3.selectAll(".rowLabel").classed("text-highlight",function(r,ri){ return ri==(d.row-1);});
- d3.selectAll(".colLabel").classed("text-highlight",function(c,ci){ return ci==(d.col-1);});
- //d3.selectAll(".colLabel").style("font-size", parseInt(cellSize * 1.3) + "px");
- //d3.selectAll(".rowLabel").style("font-size", parseInt(cellSize * 1.3) + "px");
-
- //Update the tooltip position and value
- d3.select("#heatmap-tooltip")
- .style("left", (d3.event.pageX+10) + "px")
- .style("top", (d3.event.pageY-10) + "px")
- .select("#value")
- .text("lables:"+rowLabel[d.row-1]+","+colLabel[d.col-1]+"\ndata:"+d.value+"\nrow-col-idx:"+d.col+","+d.row+"\ncell-xy "+this.x.baseVal.value+", "+this.y.baseVal.value);
- //Show the tooltip
- d3.select("#heatmap-tooltip").classed("hidden", false);
- })
- .on("mouseout", function(){
- d3.select(this).classed("cell-hover",false);
- d3.selectAll(".rowLabel").classed("text-highlight",false);
- d3.selectAll(".colLabel").classed("text-highlight",false);
- //d3.selectAll(".colLabel").style("font-size", parseInt(cellSize) + "px");
- //d3.selectAll(".rowLabel").style("font-size", parseInt(cellSize) + "px");
- d3.select("#heatmap-tooltip").classed("hidden", true);
- });
-
- var legend = svg.selectAll(".legend")
- .data([-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10])
- .enter().append("g")
- .attr("class", "legend");
-
- legend.append("rect")
- .attr("x", function(d, i) { return legendElementWidth * i; })
- .attr("y", height+(cellSize*2))
- .attr("width", legendElementWidth)
- .attr("height", cellSize)
- .style("fill", function(d, i) { return colors[i]; });
-
- legend.append("text")
- .attr("class", "mono")
- .text(function(d) { return d; })
- .attr("width", legendElementWidth)
- .attr("x", function(d, i) { return legendElementWidth * i; })
- .attr("y", height + (cellSize*4))
- .style("font-size", cellSize + "px");
-
- // change ordering of cells
- function sortbylabel(rORc,i,sortOrder) {
- var t = svg.transition().duration(3000);
- var values=[];
- var sorted; // sorted is zero-based index
- d3.selectAll(".c"+rORc+i)
- .filter(function(ce){
- values.push(ce.value);
- });
- if(rORc=="r"){ // sort valuesatio of a gene
- sorted=d3.range(colNumber).sort(function(a,b){ if(sortOrder){ return values[b]-values[a];}else{ return values[a]-values[b];}});
- t.selectAll(".cell")
- .attr("x", function(d) { return sorted.indexOf(d.col-1) * cellSize; });
- t.selectAll(".colLabel")
- .attr("y", function (d, i) { return sorted.indexOf(i) * cellSize; });
- } else { // sort valuesatio of a contrast
- sorted=d3.range(rowNumber).sort(function(a,b){if(sortOrder){ return values[b]-values[a];}else{ return values[a]-values[b];}});
- t.selectAll(".cell")
- .attr("y", function(d) { return sorted.indexOf(d.row-1) * cellSize; });
- t.selectAll(".rowLabel")
- .attr("y", function (d, i) { return sorted.indexOf(i) * cellSize; });
- }
- }
-
- d3.select("#order").on("change",function(){
- order(this.value);
- });
-
- function order(value) {
- if(value=="hclust"){
- var t = svg.transition().duration(3000);
- t.selectAll(".cell")
- .attr("x", function(d) { return colIndex.indexOf(d.col) * cellSize; })
- .attr("y", function(d) { return rowIndex.indexOf(d.row) * cellSize; });
-
- t.selectAll(".rowLabel")
- .attr("y", function (d, i) { return rowIndex.indexOf(i+1) * cellSize; });
-
- t.selectAll(".colLabel")
- .attr("y", function (d, i) { return colIndex.indexOf(i+1) * cellSize; });
-
- } else if (value=="probecontrast") {
- var t = svg.transition().duration(3000);
- t.selectAll(".cell")
- .attr("x", function(d) { return (d.col - 1) * cellSize; })
- .attr("y", function(d) { return (d.row - 1) * cellSize; });
-
- t.selectAll(".rowLabel")
- .attr("y", function (d, i) { return i * cellSize; });
-
- t.selectAll(".colLabel")
- .attr("y", function (d, i) { return i * cellSize; });
- } else if (value=="probe") {
- var t = svg.transition().duration(3000);
- t.selectAll(".cell")
- .attr("y", function(d) { return (d.row - 1) * cellSize; });
-
- t.selectAll(".rowLabel")
- .attr("y", function (d, i) { return i * cellSize; });
- } else if (value=="contrast"){
- var t = svg.transition().duration(3000);
- t.selectAll(".cell")
- .attr("x", function(d) { return (d.col - 1) * cellSize; });
- t.selectAll(".colLabel")
- .attr("y", function (d, i) { return i * cellSize; });
- }
- }
-
+ // build
+ this.rowLabels = this._buildRowLabels();
+ this.colLabels = this._buildColLabels();
+ this.heatMap = this._buildHeatMap();
+ this.legend = this._buildLegend();
+ },
+
+ // selection of cells
+ _addSelectionTool: function() {
+ //
+ // selection
+ //
var sa=d3.select(".g3")
.on("mousedown", function() {
if( !d3.event.altKey) {
- d3.selectAll(".cell-selected").classed("cell-selected",false);
- d3.selectAll(".rowLabel").classed("text-selected",false);
- d3.selectAll(".colLabel").classed("text-selected",false);
+ d3.selectAll(".cell-selected").classed("cell-selected", false);
+ d3.selectAll(".rowLabel").classed("text-selected", false);
+ d3.selectAll(".colLabel").classed("text-selected", false);
}
var p = d3.mouse(this);
sa.append("rect")
@@ -374,8 +276,7 @@
// deselect all temporary selected state objects
d3.selectAll(".cell-selection.cell-selected").classed("cell-selected", false);
d3.selectAll(".text-selection.text-selected").classed("text-selected",false);
-
- d3.selectAll('.cell').filter(function(cell_d, i) {
+ d3.selectAll(".cell").filter(function(cell_d, i) {
if(!d3.select(this).classed("cell-selected") &&
// inner circle inside selection frame
(this.x.baseVal.value)+cellSize >= d.x && (this.x.baseVal.value)<=d.x+d.width &&
@@ -385,11 +286,11 @@
.classed("cell-selection", true)
.classed("cell-selected", true);
- d3.select(".r"+(cell_d.row-1))
+ d3.select(".r"+(cell_d.row_rank))
.classed("text-selection",true)
.classed("text-selected",true);
- d3.select(".c"+(cell_d.col-1))
+ d3.select(".c"+(cell_d.col_rank))
.classed("text-selection",true)
.classed("text-selected",true);
}
@@ -417,14 +318,353 @@
});
},
+ // build legend
+ _buildLegend: function() {
+ // link this
+ var self = this;
+
+ // gather data
+ var cellSize = this.cellSize;
+ var height = this.height;
+ var legendCellWidth = this.width / this.nColors;
+
+ // create range labels
+ var dataRange = [];
+ for(var i = 0; i < this.nColors; i++) {
+ dataRange.push('');
+ }
+
+ // prepare indices
+ var dataRangeMin = 0;
+ var dataRangeMid = parseInt((dataRange.length - 1) / 2);
+ var dataRangeMax = dataRange.length - 1;
+
+ // add labels
+ dataRange[dataRangeMin] = this.min;
+ dataRange[dataRangeMid] = this.mid;
+ dataRange[dataRangeMax] = this.max;
+
+ // create legend
+ var legend = this.svg.selectAll(".legend")
+ .data(dataRange)
+ .enter().append("g")
+ .attr("class", "legend");
+
+ // add boxes
+ legend.append("rect")
+ .attr("x", function(d, i) {
+ return legendCellWidth * i;
+ })
+ .attr("y", height + cellSize)
+ .attr("width", legendCellWidth)
+ .attr("height", cellSize)
+ .style("fill", function(d, i) {
+ return self.options.colors[i];
+ });
+
+ // add text
+ legend.append("text")
+ .attr("class", "mono")
+ .text(function(d) {
+ return d;
+ })
+ .attr("width", legendCellWidth)
+ .attr("x", function(d, i) {
+ return legendCellWidth * i;
+ })
+ .attr("y", height + cellSize)
+ .style("font-size", cellSize + "px");
+ },
+
+ // build column labels
+ _buildColLabels: function() {
+ // link this
+ var self = this;
+
+ // gather data
+ var cellSize = this.cellSize;
+ var colIndex = this.colIndex;
+ var colLabel = this.colLabel;
+
+ // column labels
+ var colLabels = this.svg.append("g")
+ .selectAll(".colLabelg")
+ .data(colLabel)
+ .enter()
+ .append("text")
+ .text(function (d) {
+ return d;
+ })
+ .attr("x", 0)
+ .attr("y", function (d, i) {
+ return colIndex.indexOf(i) * cellSize;
+ })
+ .style("font-size", cellSize + "px")
+ .style("text-anchor", "left")
+ .attr("transform", "translate(" + cellSize / 2 + ", -17) rotate (-90)")
+ .attr("class", function (d, i) {
+ return "colLabel mono c" + i;
+ })
+ .on("mouseover", function(d) {
+ d3.select(this).classed("text-hover",true);
+ d3.select(this).style("font-size", parseInt(cellSize * 1.3) + "px");
+ })
+ .on("mouseout" , function(d) {
+ d3.select(this).classed("text-hover",false);
+ d3.select(this).style("font-size", parseInt(cellSize) + "px");
+ })
+ .on("click", function(d, i) {
+ self.colSortOrder=!self.colSortOrder;
+ self._sortByLabel("c", i, self.colSortOrder);
+ d3.select("#order").property("selectedIndex", 4).node().focus();
+ });
+ },
+
+ // build row labels
+ _buildRowLabels: function() {
+ // link this
+ var self = this;
+
+ // gather data
+ var cellSize = this.cellSize;
+ var rowIndex = this.rowIndex;
+ var rowLabel = this.rowLabel;
+
+ // draw labels
+ var rowLabels = this.svg.append("g")
+ .selectAll(".rowLabelg")
+ .data(rowLabel)
+ .enter()
+ .append("text")
+ .text(function (d) {
+ return d;
+ })
+ .attr("x", 0)
+ .attr("y", function (d, i) {
+ return rowIndex.indexOf(i) * cellSize;
+ })
+ .style("font-size", cellSize + "px")
+ .style("text-anchor", "end")
+ .attr("transform", "translate(-10," + cellSize / 1.5 + ")")
+ .attr("class", function (d, i) {
+ return "rowLabel mono r" + i;
+ } )
+ .on("mouseover", function(d) {
+ d3.select(this).classed("text-hover",true);
+ d3.select(this).style("font-size", parseInt(cellSize * 1.3) + "px");
+ })
+ .on("mouseout" , function(d) {
+ d3.select(this).classed("text-hover",false);
+ d3.select(this).style("font-size", parseInt(cellSize) + "px");
+ })
+ .on("click", function(d, i) {
+ self.rowSortOrder=!self.rowSortOrder;
+ self._sortByLabel("r", i, self.rowSortOrder);
+ d3.select("#order").property("selectedIndex", 4).node().focus();
+ });
+ },
+
+ // build heat map
+ _buildHeatMap: function() {
+ // link this
+ var self = this;
+
+ // gather data
+ var cellSize = this.cellSize;
+ var rowIndex = this.rowIndex;
+ var rowLabel = this.rowLabel;
+ var colIndex = this.colIndex;
+ var colLabel = this.colLabel;
+
+ // heat map
+ var heatMap = this.svg.append("g").attr("class","g3")
+ .selectAll(".cellg")
+ .data(self.data, function(d) {
+ return d.row_rank + ":" + d.col_rank;
+ })
+ .enter()
+ .append("rect")
+ .attr("x", function(d) {
+ return colIndex.indexOf(d.col_rank) * cellSize;
+ })
+ .attr("y", function(d) {
+ return rowIndex.indexOf(d.row_rank) * cellSize;
+ })
+ .attr("class", function(d){
+ return "cell cell-border cr" + d.row_rank + " cc" + d.col_rank;
+ })
+ .attr("width", cellSize)
+ .attr("height", cellSize)
+ .style("fill", function(d) {
+ return self.colorScale(d.value);
+ })
+ .on("mouseover", function(d){
+ // highlight text
+ d3.select(this).classed("cell-hover",true);
+ d3.selectAll(".rowLabel").classed("text-highlight",function(r,ri){ return ri==(d.row_rank);});
+ d3.selectAll(".colLabel").classed("text-highlight",function(c,ci){ return ci==(d.col_rank);});
+
+ // update the tooltip position and value
+ d3.select("#heatmap-tooltip")
+ .style("left", (d3.event.pageX+10) + "px")
+ .style("top", (d3.event.pageY-10) + "px")
+ .select("#value")
+ .text("Label: " + rowLabel[d.row_rank] + " | " + colLabel[d.col_rank] + ", Value: " + d.value);
+ // show the tooltip
+ d3.select("#heatmap-tooltip").classed("hidden", false);
+ })
+ .on("mouseout", function(){
+ d3.select(this).classed("cell-hover",false);
+ d3.selectAll(".rowLabel").classed("text-highlight",false);
+ d3.selectAll(".colLabel").classed("text-highlight",false);
+ d3.select("#heatmap-tooltip").classed("hidden", true);
+ });
+ },
+
+ // change ordering of cells
+ _sortByLabel: function(rORc, i, sortOrder) {
+ // get cell size
+ var cellSize = this.cellSize;
+
+ // define transition / prepare element
+ var t = this.svg.transition().duration(this.options.pace);
+
+ // collect cells
+ var cells=[];
+ t.selectAll(".c" + rORc + i)
+ .filter(function(ce){
+ cells.push(ce);
+ });
+
+ // sort cells
+ cells.sort(function(a, b) {
+ if (sortOrder) {
+ return b.value - a.value;
+ } else {
+ return a.value - b.value;
+ }
+ });
+
+ // rows or columns
+ if(rORc == "r") {
+ // get sorted key list
+ var sorted = [];
+ for (var i in cells) {
+ sorted.push(cells[i].col_rank);
+ }
+
+ // sort cells
+ t.selectAll(".cell")
+ .attr("x", function(d) {
+ return sorted.indexOf(d.col_rank) * cellSize;
+ });
+
+ // sort labels
+ t.selectAll(".colLabel")
+ .attr("y", function (d, i) {
+ return sorted.indexOf(i) * cellSize;
+ });
+ } else {
+ // get sorted key list
+ sorted = [];
+ for (var i in cells) {
+ sorted.push(cells[i].row_rank);
+ }
+
+ // sort cells
+ t.selectAll(".cell")
+ .attr("y", function(d) {
+ return sorted.indexOf(d.row_rank) * cellSize;
+ });
+
+ // sort labels
+ t.selectAll(".rowLabel")
+ .attr("y", function (d, i) {
+ return sorted.indexOf(i) * cellSize;
+ });
+ }
+ },
+
+ // sort function
+ _order: function (value) {
+ // link this
+ var self = this;
+
+ // gather data
+ var cellSize = this.cellSize;
+ var rowIndex = this.rowIndex;
+ var rowLabel = this.rowLabel;
+ var colIndex = this.colIndex;
+ var colLabel = this.colLabel;
+
+ // set duration / select element
+ var t = this.svg.transition().duration(this.options.pace);
+ if(value=="hclust"){
+ t.selectAll(".cell")
+ .attr("x", function(d) {
+ return colIndex.indexOf(d.col_rank) * cellSize;
+ })
+ .attr("y", function(d) {
+ return rowIndex.indexOf(d.row_rank) * cellSize;
+ });
+
+ t.selectAll(".rowLabel")
+ .attr("y", function(d, i) {
+ return rowIndex.indexOf(i) * cellSize;
+ });
+
+ t.selectAll(".colLabel")
+ .attr("y", function(d, i) {
+ return colIndex.indexOf(i) * cellSize;
+ });
+
+ } else if (value=="byboth") {
+ t.selectAll(".cell")
+ .attr("x", function(d) {
+ return d.col_rank * cellSize;
+ })
+ .attr("y", function(d) {
+ return d.row_rank * cellSize;
+ });
+
+ t.selectAll(".rowLabel")
+ .attr("y", function (d, i) {
+ return i * cellSize;
+ });
+
+ t.selectAll(".colLabel")
+ .attr("y", function (d, i) {
+ return i * cellSize;
+ });
+ } else if (value=="byrow") {
+ t.selectAll(".cell")
+ .attr("y", function(d) {
+ return d.row_rank * cellSize;
+ });
+
+ t.selectAll(".rowLabel")
+ .attr("y", function (d, i) {
+ return i * cellSize;
+ });
+ } else if (value=="bycol"){
+ t.selectAll(".cell")
+ .attr("x", function(d) {
+ return d.col_rank * cellSize;
+ });
+ t.selectAll(".colLabel")
+ .attr("y", function (d, i) {
+ return i * cellSize;
+ });
+ }
+ },
+
// template
_templateSelect: function() {
return '<select id="order">' +
- '<option value="hclust">by cluster</option>' +
- '<option value="probecontrast">by probe name and contrast name</option>' +
- '<option value="probe">by probe name</option>' +
- '<option value="contrast">by contrast name</option>' +
- '<option value="custom">by log2 ratio</option>' +
+ '<option value="hclust">Cluster</option>' +
+ '<option value="byboth">Sort by row and column</option>' +
+ '<option value="byrow">Sort by row label</option>' +
+ '<option value="bycol">Sort by column label</option>' +
'</select>';
},
diff -r 5f89fecb2f0703ce237cc185b2ccbb2bc0fd2658 -r f6561aae5484240c8b76cc32a7b4b1f501b0e660 config/plugins/visualizations/charts/static/charts/heatmap/heatmap.js
--- a/config/plugins/visualizations/charts/static/charts/heatmap/heatmap.js
+++ b/config/plugins/visualizations/charts/static/charts/heatmap/heatmap.js
@@ -1,5 +1,5 @@
// dependencies
-define(['utils/utils', 'plugin/charts/heatmap/heatmap-plugin'], function(Utils, Plugin) {
+define(['utils/utils', 'plugin/charts/heatmap/heatmap-plugin'], function(Utils, HeatmapPlugin) {
// widget
return Backbone.View.extend(
@@ -17,13 +17,17 @@
var self = this;
this.app.datasets.request(request_dictionary, function() {
- console.log(request_dictionary.groups);
+ // loop through data groups
+ for (var group_index in request_dictionary.groups) {
+ // get group
+ var group = request_dictionary.groups[group_index];
- // draw plot
- new Plugin({
- 'data' : request_dictionary.groups[0].values,
- 'div' : self.options.canvas[0]
- });
+ // draw plot
+ var heatmap = new HeatmapPlugin({
+ 'data' : group.values,
+ 'div' : self.options.canvas[group_index]
+ });
+ }
// set chart state
chart.state('ok', 'Heat map drawn.');
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: remove unused server templates history_common, history_item, and history_annotation_table; Pages: remove unused dialog for annotated histories
by commits-noreply@bitbucket.org 01 May '14
by commits-noreply@bitbucket.org 01 May '14
01 May '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/5f89fecb2f07/
Changeset: 5f89fecb2f07
User: carlfeberhard
Date: 2014-05-01 15:17:19
Summary: History: remove unused server templates history_common, history_item, and history_annotation_table; Pages: remove unused dialog for annotated histories
Affected #: 6 files
diff -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba -r 5f89fecb2f0703ce237cc185b2ccbb2bc0fd2658 lib/galaxy/webapps/galaxy/controllers/page.py
--- a/lib/galaxy/webapps/galaxy/controllers/page.py
+++ b/lib/galaxy/webapps/galaxy/controllers/page.py
@@ -697,16 +697,6 @@
return self._datasets_selection_grid( trans, **kwargs )
@web.expose
- @web.require_login("get annotation table for history")
- def get_history_annotation_table( self, trans, id ):
- """ Returns HTML for an annotation table for a history. """
- history = self.get_history( trans, id, False, True )
-
- if history:
- datasets = self.get_history_datasets( trans, history )
- return trans.fill_template( "page/history_annotation_table.mako", history=history, datasets=datasets, show_deleted=False )
-
- @web.expose
def get_editor_iframe( self, trans ):
""" Returns the document for the page editor's iframe. """
return trans.fill_template( "page/wymiframe.mako" )
diff -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba -r 5f89fecb2f0703ce237cc185b2ccbb2bc0fd2658 static/scripts/galaxy.pages.js
--- a/static/scripts/galaxy.pages.js
+++ b/static/scripts/galaxy.pages.js
@@ -20,10 +20,7 @@
DIALOG_EMBED_DATASET : "embed_dataset",
DIALOG_EMBED_WORKFLOW : "embed_workflow",
DIALOG_EMBED_PAGE : "embed_page",
- DIALOG_EMBED_VISUALIZATION : "embed_visualization",
-
- // Annotation dialogs.
- DIALOG_HISTORY_ANNOTATE : "history_annotate",
+ DIALOG_EMBED_VISUALIZATION : "embed_visualization"
};
// Initialize Galaxy elements.
@@ -464,25 +461,8 @@
"</div>" ].join( '' );
// Insert embedded item into document.
- //wym.insert(" "); // Needed to prevent insertion from occurring in child element in webkit browsers.
wym.insert(item_embed_html);
- // TODO: can we fix this?
- // Due to oddities of wym.insert() [likely due to inserting a <div> and/or a complete paragraph], an
- // empty paragraph (or two!) may be included either before an embedded item. Remove these paragraphs.
- //$("#" + item_elt_id, wym._doc.body).each( function() {
- // // Remove previous empty paragraphs.
- // var removing = true;
- // while (removing)
- // {
- // var prev_elt = $(this).prev();
- // if ( prev_elt.length != 0 && jQuery.trim(prev_elt.text()) == "" )
- // prev_elt.remove();
- // else
- // removing = false;
- // }
- //});
-
});
hide_modal();
},
@@ -495,55 +475,6 @@
}
});
}
-
- // ANNOTATE HISTORY DIALOG
- if ( dialogType == Galaxy.DIALOG_ANNOTATE_HISTORY ) {
- $.ajax(
- {
- url: list_histories_for_selection_url,
- data: {},
- error: function() { alert( "Grid refresh failed" ) },
- success: function(table_html)
- {
- show_modal(
- "Insert Link to History",
- table_html,
- {
- "Annotate": function()
- {
- // Insert links to history for each checked item.
- var item_ids = new Array();
- $('input[name=id]:checked').each(function() {
- var item_id = $(this).val();
-
- // Get annotation table for history.
- $.ajax(
- {
- url: get_history_annotation_table_url,
- data: { id : item_id },
- error: function() { alert( "Grid refresh failed" ) },
- success: function(result)
- {
- // Insert into document.
- wym.insert(result);
-
- init_galaxy_elts(wym);
-
- }
- });
- });
-
- hide_modal();
- },
- "Cancel": function()
- {
- hide_modal();
- }
- }
- );
- }
- });
- }
};
$(function(){
diff -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba -r 5f89fecb2f0703ce237cc185b2ccbb2bc0fd2658 templates/webapps/galaxy/page/editor.mako
--- a/templates/webapps/galaxy/page/editor.mako
+++ b/templates/webapps/galaxy/page/editor.mako
@@ -19,7 +19,6 @@
set_accessible_url = "${h.url_for( controller='ITEM_CONTROLLER', action='set_accessible_async' )}",
get_name_and_link_url = "${h.url_for( controller='ITEM_CONTROLLER', action='get_name_and_link_async' )}?id=",
list_histories_for_selection_url = "${h.url_for(controller='page', action='list_histories_for_selection' )}",
- get_history_annotation_table_url = "${h.url_for(controller='page', action='get_history_annotation_table' )}",
editor_base_path = "${h.url_for('/static/wymeditor')}/",
iframe_base_path = "${h.url_for('/static/wymeditor/iframe/galaxy')}/",
save_url = "${h.url_for(controller='page', action='save' )}";
diff -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba -r 5f89fecb2f0703ce237cc185b2ccbb2bc0fd2658 templates/webapps/galaxy/page/history_annotation_table.mako
--- a/templates/webapps/galaxy/page/history_annotation_table.mako
+++ /dev/null
@@ -1,61 +0,0 @@
-<%namespace file="../tagging_common.mako" import="render_tagging_element_html" />
-<%namespace file="../root/history_common.mako" import="render_dataset" />
-
-<div class="annotated_item">
- <table>
- ## Table header.
- <tr>
- <th colspan='2'>History '${history.get_display_name()}'</th>
- </tr>
- <tr>
- ## Status messages and tags.
- <td colspan='2'>
- %if history.deleted:
- <div class="warningmessagesmall">
- ${_('This is a deleted history.')}
- </div>
- %endif
- ## Tags come for free with community tagging, so not sure if this is necessary.
- ##%if trans.get_user() is not None:
- ## Tags: ${render_tagging_element_html( tags=history.tags, editable=False, use_toggle_link=False )}
- ##%endif
- </td>
- </tr>
- <tr>
- <td colspan="2" class="annotation" item_class="History" item_id="${trans.security.encode_id( history.id )}">Description of History:
- <ol>
- <li>What was the motivation for this history?
- <li>What is the outcome of this history?
- <li>What are unresolved questions from this history?
- <li>What new questions arise from this history?
- </ol>
- </td>
- </tr>
-
- ## Table body. For each dataset, there is an area to annotate the dataset.
- %if not datasets:
- <tr>
- <td>
- <div class="infomessagesmall" id="emptyHistoryMessage">
- ${_("Your history is empty. Click 'Get Data' on the left pane to start")}
- </div>
- </td>
- </tr>
- %else:
- ## Render requested datasets.
- %for data in datasets:
- %if data.visible:
- <tr>
- <td valign="top" class="annotation" item_class="HistoryDatasetAssociation" item_id="${trans.security.encode_id( data.id )}">Describe this step: why was it done? what data did it produce?</td>
- ##<td valign="top" class="annotation">Describe this step: why was it done? what data does it produce?</td>
- <td>
- <div class="historyItemContainer" id="historyItemContainer-${data.id}">
- ${render_dataset( data, data.hid, show_deleted_on_refresh = show_deleted, for_editing = False )}
- </div>
- </td>
- </tr>
- %endif
- %endfor
- %endif
- </table>
-</div>
\ No newline at end of file
diff -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba -r 5f89fecb2f0703ce237cc185b2ccbb2bc0fd2658 templates/webapps/galaxy/root/history_common.mako
--- a/templates/webapps/galaxy/root/history_common.mako
+++ /dev/null
@@ -1,337 +0,0 @@
-<% _=n_ %>
-
-<%def name="render_download_links( data, dataset_id )">
- <%
- from galaxy.datatypes.metadata import FileParameter
- %>
- %if not data.purged:
- ## Check for downloadable metadata files
- <% meta_files = [ k for k in data.metadata.spec.keys() if isinstance( data.metadata.spec[k].param, FileParameter ) ] %>
- %if meta_files:
- <div popupmenu="dataset-${dataset_id}-popup">
- <a class="action-button" href="${h.url_for( controller='dataset', action='display', dataset_id=dataset_id, \
- to_ext=data.ext )}">Download Dataset</a>
- <a>Additional Files</a>
- %for file_type in meta_files:
- <a class="action-button" href="${h.url_for( controller='/dataset', action='get_metadata_file', \
- hda_id=dataset_id, metadata_name=file_type )}">Download ${file_type}</a>
- %endfor
- </div>
- <div style="float:left;" class="menubutton split popup" id="dataset-${dataset_id}-popup">
- %endif
- <a href="${h.url_for( controller='/dataset', action='display', dataset_id=dataset_id, to_ext=data.ext )}" title='${_("Download")}' class="icon-button disk"></a>
- %if meta_files:
- </div>
- %endif
- %endif
-</%def>
-
-## Render the dataset `data` as history item, using `hid` as the displayed id
-<%def name="render_dataset( data, hid, show_deleted_on_refresh = False, for_editing = True, display_structured = False )">
- <%
- dataset_id = trans.security.encode_id( data.id )
-
- if data.state in ['no state','',None]:
- data_state = "queued"
- else:
- data_state = data.state
- current_user_roles = trans.get_current_user_roles()
- can_edit = not ( data.deleted or data.purged )
- %>
- %if not trans.user_is_admin() and not trans.app.security_agent.can_access_dataset( current_user_roles, data.dataset ):
- <div class="historyItemWrapper historyItem historyItem-${data_state} historyItem-noPermission" id="historyItem-${dataset_id}">
- %else:
- <div class="historyItemWrapper historyItem historyItem-${data_state}" id="historyItem-${dataset_id}">
- %endif
-
- %if data.deleted or data.purged or data.dataset.purged:
- <div class="warningmessagesmall"><strong>
- %if data.dataset.purged or data.purged:
- This dataset has been deleted and removed from disk.
- %else:
- This dataset has been deleted.
- %if for_editing:
- Click <a href="${h.url_for( controller='dataset', action='undelete', dataset_id=dataset_id )}" class="historyItemUndelete" id="historyItemUndeleter-${dataset_id}" target="galaxy_history">here</a> to undelete
- %if trans.app.config.allow_user_dataset_purge:
- or <a href="${h.url_for( controller='dataset', action='purge', dataset_id=dataset_id )}" class="historyItemPurge" id="historyItemPurger-${dataset_id}" target="galaxy_history">here</a> to immediately remove it from disk.
- %else:
- it.
- %endif
- %endif
- %endif
- </strong></div>
- %endif
-
- %if data.visible is False:
- <div class="warningmessagesmall">
- <strong>This dataset has been hidden. Click <a href="${h.url_for( controller='dataset', action='unhide', dataset_id=dataset_id )}" class="historyItemUnhide" id="historyItemUnhider-${dataset_id}" target="galaxy_history">here</a> to unhide.</strong>
- </div>
- %endif
-
- ## Header row for history items (name, state, action buttons)
- <div style="overflow: hidden;" class="historyItemTitleBar">
- <div class="historyItemButtons">
- %if data_state == "upload":
- ## TODO: Make these CSS, just adding a "disabled" class to the normal
- ## links should be enough. However the number of datasets being uploaded
- ## at a time is usually small so the impact of these images is also small.
- <span title='${_("Display Data")}' class='icon-button display_disabled'></span>
- %if for_editing:
- <span title='Edit Attributes' class='icon-button edit_disabled'></span>
- %endif
- %else:
- <%
- if for_editing:
- display_url = h.url_for( controller='dataset', action='display', dataset_id=dataset_id, preview=True, filename='' )
- else:
- # Get URL for display only.
- if data.history.user and data.history.user.username:
- display_url = h.url_for( controller='dataset', action='display_by_username_and_slug',
- username=data.history.user.username, slug=dataset_id, filename='' )
- else:
- # HACK: revert to for_editing display URL when there is no user/username. This should only happen when
- # there's no user/username because dataset is being displayed by history/view after error reported.
- # There are no security concerns here because both dataset/display and dataset/display_by_username_and_slug
- # check user permissions (to the same degree) before displaying.
- display_url = h.url_for( controller='dataset', action='display', dataset_id=dataset_id, preview=True, filename='' )
- %>
- %if data.purged:
- <span class="icon-button display_disabled" title="Cannot display datasets removed from disk"></span>
- %else:
- <a class="icon-button display" dataset_id="${dataset_id}" title='${_("View data")}' href="${display_url}"
- %if for_editing:
- target="galaxy_main"
- %endif
- ></a>
- %endif
-
- ## edit attr button
- %if for_editing:
- %if data.deleted and not data.purged:
- <span title="Undelete dataset to edit attributes" class="icon-button edit_disabled"></span>
- %elif data.purged:
- <span title="Cannot edit attributes of datasets removed from disk" class="icon-button edit_disabled"></span>
- %else:
- <a class="icon-button edit" title='${_("Edit attributes")}' href="${h.url_for( controller='dataset', action='edit', dataset_id=dataset_id )}" target="galaxy_main"></a>
- %endif
- %endif
-
- %endif
-
- ## delete button
- %if for_editing:
- %if can_edit:
- <a class="icon-button delete" title='${_("Delete")}' href="${h.url_for( controller='dataset', action='delete', dataset_id=dataset_id, show_deleted_on_refresh=show_deleted_on_refresh )}" id="historyItemDeleter-${dataset_id}"></a>
- %else:
- <span title="Dataset is already deleted" class="icon-button delete_disabled"></span>
- %endif
- %endif
- </div>
- ## Hack, do it in css
- %if data_state == "paused":
- <span class="fa fa-pause"></span>
- %else:
- <span class="state-icon"></span>
- %endif
- <span class="historyItemTitle">${hid}: ${data.display_name()}</span>
- </div>
-
- ## Body for history items, extra info and actions, data "peek"
-
- <div id="info${data.id}" class="historyItemBody">
- %if not trans.user_is_admin() and not trans.app.security_agent.can_access_dataset( current_user_roles, data.dataset ):
- <div>You do not have permission to view this dataset.</div>
- %elif data_state == "upload":
- <div>Dataset is uploading</div>
- %elif data_state == "queued":
- <div>${_('Job is waiting to run')}</div>
- <div>
- <a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
- %if for_editing:
- <a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
- %endif
- </div>
- %elif data_state == "paused":
- <div>
- ${_('Job is currently paused:')} <i>${data.display_info().strip().rstrip('.')}.</i> ${_('Use the history menu to resume.')}</div>
- <div>
- <a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
- %if for_editing:
- <a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
- %endif
- </div>
- %elif data_state == "running":
- <div>${_('Job is currently running')}</div>
- <div>
- <a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
- %if for_editing:
- <a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
- %endif
- </div>
- %elif data_state == "error":
- %if not data.purged:
- <div>${data.get_size( nice_size=True )}</div>
- %endif
- <div>
- An error occurred running this job: <i>${data.display_info().strip()}</i>
- </div>
- <div>
- %if for_editing:
- <a href="${h.url_for( controller='dataset', action='errors', id=data.id )}" target="galaxy_main" title="View or report this error" class="icon-button bug"></a>
- %endif
- %if data.has_data():
- ${render_download_links( data, dataset_id )}
- %endif
- <a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
- %if for_editing:
- <a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
- %endif
- </div>
- %elif data_state == "discarded":
- <div>
- The job creating this dataset was cancelled before completion.
- </div>
- <div>
- <a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
- %if for_editing:
- <a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
- %endif
- </div>
- %elif data_state == 'setting_metadata':
- <div>${_('Metadata is being Auto-Detected.')}</div>
- %elif data_state == "empty":
- <div>${_('No data: ')}<i>${data.display_info()}</i></div>
- <div>
- <a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
- %if for_editing:
- <a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
- %endif
- </div>
- %elif data_state in [ "ok", "failed_metadata" ]:
- %if data_state == "failed_metadata":
- <div class="warningmessagesmall" style="margin: 4px 0 4px 0">
- An error occurred setting the metadata for this dataset.
- %if can_edit:
- You may be able to <a href="${h.url_for( controller='dataset', action='edit', dataset_id=dataset_id )}" target="galaxy_main">set it manually or retry auto-detection</a>.
- %endif
- </div>
- %endif
- <div>
- ${data.blurb}<br />
- ${_("format: ")} <span class="${data.ext}">${data.ext}</span>,
- ${_("database: ")}
- %if data.dbkey == '?' and can_edit:
- <a href="${h.url_for( controller='dataset', action='edit', dataset_id=dataset_id )}" target="galaxy_main">${_(data.dbkey)}</a>
- %else:
- <span class="${data.dbkey}">${_(data.dbkey)}</span>
- %endif
- </div>
- %if data.display_info():
- <div class="info">${_('Info: ')}${data.display_info()}</div>
- %endif
- <div>
- %if data.has_data():
- ${render_download_links( data, dataset_id )}
-
- <a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
-
- %if for_editing:
- <a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
- ## Visualization icon + visualizations. Using anchor attributes is a HACK to encode needed
- ## information--URL base, dataset id, dbkey, visualizations--in anchor.
- <%
- visualizations = data.get_visualizations()
- %>
- %if visualizations:
- <a href="${h.url_for( controller='visualization' )}"
- class="icon-button chart_curve visualize-icon"
- title="Visualize"
- dataset_id="${dataset_id}"
- %if data.dbkey != '?':
- dbkey="${data.dbkey}"
- %endif
- visualizations="${','.join(visualizations)}"></a>
- %endif
- %if trans.user:
- %if not display_structured:
- <div style="float: right">
- <a href="${h.url_for( controller='tag', action='retag', item_class=data.__class__.__name__, item_id=dataset_id )}" target="galaxy_main" title="Edit dataset tags" class="icon-button tags"></a>
- <a href="${h.url_for( controller='dataset', action='annotate', id=dataset_id )}" target="galaxy_main" title="Edit dataset annotation" class="icon-button annotate"></a>
- </div>
- %endif
- <div style="clear: both"></div>
- <div class="tag-area" style="display: none">
- <strong>Tags:</strong>
- <div class="tag-elt"></div>
- </div>
- <div id="${dataset_id}-annotation-area" class="annotation-area" style="display: none">
- <strong>Annotation:</strong>
- <div id="${dataset_id}-annotation-elt" style="margin: 1px 0px 1px 0px" class="annotation-elt editable-text" title="Edit dataset annotation"></div>
- </div>
-
- %endif
- %else:
- ## When displaying datasets for viewing, this is often needed to prevent peek from overlapping
- ## icons.
- <div style="clear: both"></div>
- %endif
- <div style="clear: both"></div>
- %for display_app in data.datatype.get_display_types():
- <% target_frame, display_links = data.datatype.get_display_links( data, display_app, app, request.base ) %>
- %if len( display_links ) > 0:
- ${data.datatype.get_display_label(display_app)}
- %for display_name, display_link in display_links:
- <a target="${target_frame}" href="${display_link}">${_(display_name)}</a>
- %endfor
- <br />
- %endif
- %endfor
- %for display_app in data.get_display_applications( trans ).itervalues():
- ${display_app.name}
- %for link_app in display_app.links.itervalues():
- <a target="${link_app.url.get( 'target_frame', '_blank' )}" href="${link_app.get_display_url( data, trans )}">${_(link_app.name)}</a>
- %endfor
- <br />
- %endfor
- %elif for_editing:
- <a href="${h.url_for( controller='dataset', action='show_params', dataset_id=dataset_id )}" target="galaxy_main" title='${_("View Details")}' class="icon-button information"></a>
- <a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title='${_("Run this job again")}' class="icon-button arrow-circle"></a>
- %endif
-
- </div>
- %if data.peek != "no peek":
- <div><pre id="peek${data.id}" class="peek">${_(h.to_unicode(data.display_peek()))}</pre></div>
- %endif
- %else:
- <div>${_('Error: unknown dataset state "%s".') % data_state}</div>
- %endif
-
- ## Recurse for child datasets
-
- %if len( data.children ) > 0:
- ## FIXME: This should not be in the template, there should
- ## be a 'visible_children' method on dataset.
- <%
- children = []
- for child in data.children:
- if child.visible:
- children.append( child )
- %>
- %if len( children ) > 0:
- <div>
- There are ${len( children )} secondary datasets.
- %for idx, child in enumerate(children):
- ${render_dataset( child, idx + 1, show_deleted_on_refresh = show_deleted_on_refresh )}
- %endfor
- </div>
- %endif
- %endif
-
- <div style="clear: both;"></div>
-
- </div>
-
-
- </div>
-
-</%def>
diff -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba -r 5f89fecb2f0703ce237cc185b2ccbb2bc0fd2658 templates/webapps/galaxy/root/history_item.mako
--- a/templates/webapps/galaxy/root/history_item.mako
+++ /dev/null
@@ -1,3 +0,0 @@
-<%namespace file="history_common.mako" import="render_dataset" />
-
-${render_dataset( data, hid )}
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: Charts: Adding heat map basics
by commits-noreply@bitbucket.org 01 May '14
by commits-noreply@bitbucket.org 01 May '14
01 May '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/8ba0bd46e9fb/
Changeset: 8ba0bd46e9fb
User: guerler
Date: 2014-05-01 01:48:20
Summary: Charts: Adding heat map basics
Affected #: 10 files
diff -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba config/plugins/visualizations/charts/static/charts/heatmap/config.js
--- /dev/null
+++ b/config/plugins/visualizations/charts/static/charts/heatmap/config.js
@@ -0,0 +1,22 @@
+define([], function() {
+
+return {
+ title : 'Heatmap',
+ library : '',
+ tag : 'div',
+ columns : {
+ col_label : {
+ title : 'Columns',
+ is_label : true
+ },
+ row_label : {
+ title : 'Rows',
+ is_label : true
+ },
+ value : {
+ title : 'Observations'
+ },
+ }
+};
+
+});
\ No newline at end of file
diff -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba config/plugins/visualizations/charts/static/charts/heatmap/heatmap-plugin.js
--- /dev/null
+++ b/config/plugins/visualizations/charts/static/charts/heatmap/heatmap-plugin.js
@@ -0,0 +1,438 @@
+// dependencies
+define(['utils/utils'], function(Utils) {
+
+// widget
+return Backbone.View.extend(
+{
+ // number of columns and rows
+ colNumber: 0,
+ rowNumber: 0,
+
+ // indices
+ rowIndex: [],
+ colIndex: [],
+
+ // labels
+ rowLabel: [],
+ colLabel: [],
+
+ // cell size
+ cellSize: 0,
+
+ // color buckets
+ colorBuckets: 0,
+
+ // default settings
+ optionsDefault: {
+ margin : {
+ top : 50,
+ right : 10,
+ bottom : 50,
+ left : 100
+ },
+ colors : ['#005824','#1A693B','#347B53','#4F8D6B','#699F83','#83B09B','#9EC2B3','#B8D4CB','#D2E6E3','#EDF8FB','#FFFFFF','#F1EEF6','#E6D3E1','#DBB9CD','#D19EB9','#C684A4','#BB6990','#B14F7C','#A63467','#9B1A53','#91003F']
+ },
+
+ // initialize
+ initialize: function(options) {
+ // load options
+ this.options = Utils.merge(options, this.optionsDefault)
+
+ // add ui elements
+ this.options.div.append(this._templateTooltip());
+ this.options.div.append(this._templateSelect());
+
+ // access data
+ var data = this.options.data;
+
+ // identify unique labels
+ var col_hash = {};
+ var row_hash = {};
+
+ // create label indices
+ this.colNumber = 0;
+ this.rowNumber = 0;
+ for (var i in data) {
+ var cell = data[i];
+
+ // add label to index list
+ var col_label = cell.col_label;
+ if (col_hash[col_label] === undefined) {
+ col_hash[col_label] = ++this.colNumber;
+ }
+ var row_label = cell.row_label;
+ if (row_hash[row_label] === undefined) {
+ row_hash[row_label] = ++this.rowNumber;
+ }
+ }
+
+ // add indices to data
+ for (var i in data) {
+ var cell = data[i];
+ cell.col = col_hash[cell.col_label];
+ cell.row = row_hash[cell.row_label];
+ }
+
+ // add row labels
+ this.rowIndex = []
+ for (var key in row_hash) {
+ this.rowLabel.push(key);
+ this.rowIndex.push(row_hash[key]);
+ }
+
+ // add col labels
+ this.colIndex = []
+ for (var key in col_hash) {
+ this.colLabel.push(key);
+ this.colIndex.push(col_hash[key]);
+ }
+ console.log(this.rowIndex);
+ console.log(this.colIndex);
+
+ // identify buckets
+ this.colorBuckets = this.options.colors.length;
+
+ // draw
+ this._draw(this.options.div, this.options.data);
+ },
+
+ _draw: function(container, data) {
+ // get height
+ this.width = parseInt(container.width()) - this.options.margin.left;
+ this.height = parseInt(container.height()) - 2*this.options.margin.top;
+
+ // calculate cell size
+ this.cellSize = Math.min( this.height / (this.rowNumber),
+ this.width / (this.colNumber));
+
+ // set width/height for plugin
+ this.width = this.options.cellSize * this.colNumber;
+ this.height = this.options.cellSize * this.rowNumber;
+
+ // set legend width
+ this.legendElementWidth = this.options.cellSize * 2.5;
+
+ // configure
+ var margin = this.options.margin;
+ var cellSize = this.cellSize;
+ var colNumber = this.colNumber;
+ var rowNumber = this.rowNumber;
+ var colorBuckets = this.colorBuckets;
+ var colors = this.options.colors;
+ var rowIndex = this.rowIndex;
+ var colIndex = this.colIndex;
+ var colLabel = this.colLabel;
+ var rowLabel = this.rowLabel;
+ var width = this.width;
+ var height = this.height;
+ var legendElementWidth = this.legendElementWidth;
+
+ // color scale
+ var colorScale = d3.scale.quantile()
+ .domain([ -10, 0, 10])
+ .range(colors);
+
+ // add graph
+ var svg = d3.select(container[0]).append('svg')
+ .attr("width", width + margin.left + margin.right)
+ .attr("height", height + margin.top + margin.bottom)
+ .append("g")
+ .attr("transform", "translate(" + margin.left + "," + margin.top + ")")
+
+ // row labels
+ var rowSortOrder=false;
+ var colSortOrder=false;
+ var rowLabels = svg.append("g")
+ .selectAll(".rowLabelg")
+ .data(rowLabel)
+ .enter()
+ .append("text")
+ .text(function (d) { return d; })
+ .attr("x", 0)
+ .attr("y", function (d, i) { return rowIndex.indexOf(i+1) * cellSize; })
+ .style("font-size", cellSize + "px")
+ .style("text-anchor", "end")
+ .attr("transform", "translate(-10," + cellSize / 1.5 + ")")
+ .attr("class", function (d,i) { return "rowLabel mono r"+i;} )
+ .on("mouseover", function(d) {
+ d3.select(this).classed("text-hover",true);
+ d3.select(this).style("font-size", parseInt(cellSize * 1.3) + "px");
+ })
+ .on("mouseout" , function(d) {
+ d3.select(this).classed("text-hover",false);
+ d3.select(this).style("font-size", parseInt(cellSize) + "px");
+ })
+ .on("click", function(d,i) {rowSortOrder=!rowSortOrder; sortbylabel("r",i,rowSortOrder);d3.select("#order").property("selectedIndex", 4).node().focus();;});
+
+ // column labels
+ var colLabels = svg.append("g")
+ .selectAll(".colLabelg")
+ .data(colLabel)
+ .enter()
+ .append("text")
+ .text(function (d) { return d; })
+ .attr("x", 0)
+ .attr("y", function (d, i) { return colIndex.indexOf(i+1) * cellSize; })
+ .style("font-size", cellSize + "px")
+ .style("text-anchor", "left")
+ .attr("transform", "translate("+cellSize/2 + ",-17) rotate (-90)")
+ .attr("class", function (d,i) { return "colLabel mono c"+i;} )
+ .on("mouseover", function(d) {
+ d3.select(this).classed("text-hover",true);
+ d3.select(this).style("font-size", parseInt(cellSize * 1.3) + "px");
+ })
+ .on("mouseout" , function(d) {
+ d3.select(this).classed("text-hover",false);
+ d3.select(this).style("font-size", parseInt(cellSize) + "px");
+ })
+ .on("click", function(d,i) {colSortOrder=!colSortOrder; sortbylabel("c",i,colSortOrder);d3.select("#order").property("selectedIndex", 4).node().focus();;});
+
+ // heat map
+ var heatMap = svg.append("g").attr("class","g3")
+ .selectAll(".cellg")
+ .data(data,function(d){return d.row+":"+d.col;})
+ .enter()
+ .append("rect")
+ .attr("x", function(d) { return colIndex.indexOf(d.col) * cellSize; })
+ .attr("y", function(d) { return rowIndex.indexOf(d.row) * cellSize; })
+ .attr("class", function(d){return "cell cell-border cr"+(d.row-1)+" cc"+(d.col-1);})
+ .attr("width", cellSize)
+ .attr("height", cellSize)
+ .style("fill", function(d) { return colorScale(d.value); })
+ // .on("click", function(d) {
+ // var rowtext=d3.select(".r"+(d.row-1));
+ // if(rowtext.classed("text-selected")==false){
+ // rowtext.classed("text-selected",true);
+ // }else{
+ // rowtext.classed("text-selected",false);
+ // }
+ //})
+ .on("mouseover", function(d){
+ //highlight text
+ d3.select(this).classed("cell-hover",true);
+ d3.selectAll(".rowLabel").classed("text-highlight",function(r,ri){ return ri==(d.row-1);});
+ d3.selectAll(".colLabel").classed("text-highlight",function(c,ci){ return ci==(d.col-1);});
+ //d3.selectAll(".colLabel").style("font-size", parseInt(cellSize * 1.3) + "px");
+ //d3.selectAll(".rowLabel").style("font-size", parseInt(cellSize * 1.3) + "px");
+
+ //Update the tooltip position and value
+ d3.select("#heatmap-tooltip")
+ .style("left", (d3.event.pageX+10) + "px")
+ .style("top", (d3.event.pageY-10) + "px")
+ .select("#value")
+ .text("lables:"+rowLabel[d.row-1]+","+colLabel[d.col-1]+"\ndata:"+d.value+"\nrow-col-idx:"+d.col+","+d.row+"\ncell-xy "+this.x.baseVal.value+", "+this.y.baseVal.value);
+ //Show the tooltip
+ d3.select("#heatmap-tooltip").classed("hidden", false);
+ })
+ .on("mouseout", function(){
+ d3.select(this).classed("cell-hover",false);
+ d3.selectAll(".rowLabel").classed("text-highlight",false);
+ d3.selectAll(".colLabel").classed("text-highlight",false);
+ //d3.selectAll(".colLabel").style("font-size", parseInt(cellSize) + "px");
+ //d3.selectAll(".rowLabel").style("font-size", parseInt(cellSize) + "px");
+ d3.select("#heatmap-tooltip").classed("hidden", true);
+ });
+
+ var legend = svg.selectAll(".legend")
+ .data([-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10])
+ .enter().append("g")
+ .attr("class", "legend");
+
+ legend.append("rect")
+ .attr("x", function(d, i) { return legendElementWidth * i; })
+ .attr("y", height+(cellSize*2))
+ .attr("width", legendElementWidth)
+ .attr("height", cellSize)
+ .style("fill", function(d, i) { return colors[i]; });
+
+ legend.append("text")
+ .attr("class", "mono")
+ .text(function(d) { return d; })
+ .attr("width", legendElementWidth)
+ .attr("x", function(d, i) { return legendElementWidth * i; })
+ .attr("y", height + (cellSize*4))
+ .style("font-size", cellSize + "px");
+
+ // change ordering of cells
+ function sortbylabel(rORc,i,sortOrder) {
+ var t = svg.transition().duration(3000);
+ var values=[];
+ var sorted; // sorted is zero-based index
+ d3.selectAll(".c"+rORc+i)
+ .filter(function(ce){
+ values.push(ce.value);
+ });
+ if(rORc=="r"){ // sort valuesatio of a gene
+ sorted=d3.range(colNumber).sort(function(a,b){ if(sortOrder){ return values[b]-values[a];}else{ return values[a]-values[b];}});
+ t.selectAll(".cell")
+ .attr("x", function(d) { return sorted.indexOf(d.col-1) * cellSize; });
+ t.selectAll(".colLabel")
+ .attr("y", function (d, i) { return sorted.indexOf(i) * cellSize; });
+ } else { // sort valuesatio of a contrast
+ sorted=d3.range(rowNumber).sort(function(a,b){if(sortOrder){ return values[b]-values[a];}else{ return values[a]-values[b];}});
+ t.selectAll(".cell")
+ .attr("y", function(d) { return sorted.indexOf(d.row-1) * cellSize; });
+ t.selectAll(".rowLabel")
+ .attr("y", function (d, i) { return sorted.indexOf(i) * cellSize; });
+ }
+ }
+
+ d3.select("#order").on("change",function(){
+ order(this.value);
+ });
+
+ function order(value) {
+ if(value=="hclust"){
+ var t = svg.transition().duration(3000);
+ t.selectAll(".cell")
+ .attr("x", function(d) { return colIndex.indexOf(d.col) * cellSize; })
+ .attr("y", function(d) { return rowIndex.indexOf(d.row) * cellSize; });
+
+ t.selectAll(".rowLabel")
+ .attr("y", function (d, i) { return rowIndex.indexOf(i+1) * cellSize; });
+
+ t.selectAll(".colLabel")
+ .attr("y", function (d, i) { return colIndex.indexOf(i+1) * cellSize; });
+
+ } else if (value=="probecontrast") {
+ var t = svg.transition().duration(3000);
+ t.selectAll(".cell")
+ .attr("x", function(d) { return (d.col - 1) * cellSize; })
+ .attr("y", function(d) { return (d.row - 1) * cellSize; });
+
+ t.selectAll(".rowLabel")
+ .attr("y", function (d, i) { return i * cellSize; });
+
+ t.selectAll(".colLabel")
+ .attr("y", function (d, i) { return i * cellSize; });
+ } else if (value=="probe") {
+ var t = svg.transition().duration(3000);
+ t.selectAll(".cell")
+ .attr("y", function(d) { return (d.row - 1) * cellSize; });
+
+ t.selectAll(".rowLabel")
+ .attr("y", function (d, i) { return i * cellSize; });
+ } else if (value=="contrast"){
+ var t = svg.transition().duration(3000);
+ t.selectAll(".cell")
+ .attr("x", function(d) { return (d.col - 1) * cellSize; });
+ t.selectAll(".colLabel")
+ .attr("y", function (d, i) { return i * cellSize; });
+ }
+ }
+
+ var sa=d3.select(".g3")
+ .on("mousedown", function() {
+ if( !d3.event.altKey) {
+ d3.selectAll(".cell-selected").classed("cell-selected",false);
+ d3.selectAll(".rowLabel").classed("text-selected",false);
+ d3.selectAll(".colLabel").classed("text-selected",false);
+ }
+ var p = d3.mouse(this);
+ sa.append("rect")
+ .attr({
+ rx : 0,
+ ry : 0,
+ class : "selection",
+ x : p[0],
+ y : p[1],
+ width : 1,
+ height : 1
+ })
+ })
+ .on("mousemove", function() {
+ var s = sa.select("rect.selection");
+
+ if(!s.empty()) {
+ var p = d3.mouse(this),
+ d = {
+ x : parseInt(s.attr("x"), 10),
+ y : parseInt(s.attr("y"), 10),
+ width : parseInt(s.attr("width"), 10),
+ height : parseInt(s.attr("height"), 10)
+ },
+ move = {
+ x : p[0] - d.x,
+ y : p[1] - d.y
+ };
+
+ if(move.x < 1 || (move.x*2<d.width)) {
+ d.x = p[0];
+ d.width -= move.x;
+ } else {
+ d.width = move.x;
+ }
+
+ if(move.y < 1 || (move.y*2<d.height)) {
+ d.y = p[1];
+ d.height -= move.y;
+ } else {
+ d.height = move.y;
+ }
+ s.attr(d);
+
+ // deselect all temporary selected state objects
+ d3.selectAll(".cell-selection.cell-selected").classed("cell-selected", false);
+ d3.selectAll(".text-selection.text-selected").classed("text-selected",false);
+
+ d3.selectAll('.cell').filter(function(cell_d, i) {
+ if(!d3.select(this).classed("cell-selected") &&
+ // inner circle inside selection frame
+ (this.x.baseVal.value)+cellSize >= d.x && (this.x.baseVal.value)<=d.x+d.width &&
+ (this.y.baseVal.value)+cellSize >= d.y && (this.y.baseVal.value)<=d.y+d.height)
+ {
+ d3.select(this)
+ .classed("cell-selection", true)
+ .classed("cell-selected", true);
+
+ d3.select(".r"+(cell_d.row-1))
+ .classed("text-selection",true)
+ .classed("text-selected",true);
+
+ d3.select(".c"+(cell_d.col-1))
+ .classed("text-selection",true)
+ .classed("text-selected",true);
+ }
+ });
+ }
+ })
+ .on("mouseup", function() {
+ // remove selection frame
+ sa.selectAll("rect.selection").remove();
+
+ // remove temporary selection marker class
+ d3.selectAll(".cell-selection").classed("cell-selection", false);
+ d3.selectAll(".text-selection").classed("text-selection",false);
+ })
+ .on("mouseout", function() {
+ if(d3.event.relatedTarget.tagName=='html') {
+ // remove selection frame
+ sa.selectAll("rect.selection").remove();
+
+ // remove temporary selection marker class
+ d3.selectAll(".cell-selection").classed("cell-selection", false);
+ d3.selectAll(".rowLabel").classed("text-selected",false);
+ d3.selectAll(".colLabel").classed("text-selected",false);
+ }
+ });
+ },
+
+ // template
+ _templateSelect: function() {
+ return '<select id="order">' +
+ '<option value="hclust">by cluster</option>' +
+ '<option value="probecontrast">by probe name and contrast name</option>' +
+ '<option value="probe">by probe name</option>' +
+ '<option value="contrast">by contrast name</option>' +
+ '<option value="custom">by log2 ratio</option>' +
+ '</select>';
+ },
+
+ // template
+ _templateTooltip: function() {
+ return '<div id="heatmap-tooltip" class="hidden">' +
+ '<p><span id="value"></p>'
+ '</div>';
+ }
+ });
+});
\ No newline at end of file
diff -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba config/plugins/visualizations/charts/static/charts/heatmap/heatmap.js
--- /dev/null
+++ b/config/plugins/visualizations/charts/static/charts/heatmap/heatmap.js
@@ -0,0 +1,37 @@
+// dependencies
+define(['utils/utils', 'plugin/charts/heatmap/heatmap-plugin'], function(Utils, Plugin) {
+
+// widget
+return Backbone.View.extend(
+{
+ // initialize
+ initialize: function(app, options) {
+ this.app = app;
+ this.options = options;
+ },
+
+ // render
+ draw : function(process_id, chart, request_dictionary)
+ {
+ // request data
+ var self = this;
+ this.app.datasets.request(request_dictionary, function() {
+
+ console.log(request_dictionary.groups);
+
+ // draw plot
+ new Plugin({
+ 'data' : request_dictionary.groups[0].values,
+ 'div' : self.options.canvas[0]
+ });
+
+ // set chart state
+ chart.state('ok', 'Heat map drawn.');
+
+ // unregister process
+ chart.deferred.done(process_id);
+ });
+ }
+});
+
+});
\ No newline at end of file
diff -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba config/plugins/visualizations/charts/static/charts/highcharts_boxplot/config.js
--- a/config/plugins/visualizations/charts/static/charts/highcharts_boxplot/config.js
+++ b/config/plugins/visualizations/charts/static/charts/highcharts_boxplot/config.js
@@ -3,7 +3,7 @@
return {
title : 'Box plot',
library : 'highcharts.js',
- element : 'div',
+ tag : 'div',
execute : 'boxplot',
columns : {
y : {
diff -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba config/plugins/visualizations/charts/static/charts/types.js
--- a/config/plugins/visualizations/charts/static/charts/types.js
+++ b/config/plugins/visualizations/charts/static/charts/types.js
@@ -8,6 +8,7 @@
'plugin/charts/nvd3_scatterplot/config',
'plugin/charts/nvd3_stackedarea/config',
'plugin/charts/highcharts_boxplot/config',
+ 'plugin/charts/heatmap/config',
], function(nvd3_bardiagram,
nvd3_histogram,
nvd3_horizontal,
@@ -16,7 +17,8 @@
nvd3_piechart,
nvd3_scatterplot,
nvd3_stackedarea,
- highcharts_boxplot
+ highcharts_boxplot,
+ heatmap
) {
// widget
@@ -25,6 +27,7 @@
// types
defaults: {
'nvd3_bardiagram' : nvd3_bardiagram,
+ 'heatmap' : heatmap,
'nvd3_horizontal' : nvd3_horizontal,
'nvd3_histogram' : nvd3_histogram,
'nvd3_line' : nvd3_line,
diff -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba config/plugins/visualizations/charts/static/models/config.js
--- a/config/plugins/visualizations/charts/static/models/config.js
+++ b/config/plugins/visualizations/charts/static/models/config.js
@@ -6,7 +6,7 @@
{
// options
defaults : {
- query_limit : 1000,
+ query_limit : 5000,
query_timeout : 500
}
});
diff -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba config/plugins/visualizations/charts/static/plugins/heatmap/heatmap.css
--- /dev/null
+++ b/config/plugins/visualizations/charts/static/plugins/heatmap/heatmap.css
@@ -0,0 +1,76 @@
+<style>
+ /* disable text selection */
+ svg *::selection {
+ background : transparent;
+ }
+
+ svg *::-moz-selection {
+ background:transparent;
+ }
+
+ svg *::-webkit-selection {
+ background:transparent;
+ }
+ rect.selection {
+ stroke : #333;
+ stroke-dasharray: 4px;
+ stroke-opacity : 0.5;
+ fill : transparent;
+ }
+
+ rect.cell-border {
+ stroke: #eee;
+ stroke-width:0.3px;
+ }
+
+ rect.cell-selected {
+ stroke: rgb(51,102,153);
+ stroke-width:0.5px;
+ }
+
+ rect.cell-hover {
+ stroke: #F00;
+ stroke-width:0.3px;
+ }
+
+ text.mono {
+ font-size: 9pt;
+ font-family: Consolas, courier;
+ fill: #aaa;
+ }
+
+ text.text-selected {
+ fill: #000;
+ }
+
+ text.text-highlight {
+ fill: #c00;
+ }
+ text.text-hover {
+ fill: #00C;
+ }
+ #heatmap-tooltip {
+ position: absolute;
+ width: 200px;
+ height: auto;
+ padding: 10px;
+ background-color: white;
+ -webkit-border-radius: 10px;
+ -moz-border-radius: 10px;
+ border-radius: 10px;
+ -webkit-box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
+ -moz-box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
+ box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.4);
+ pointer-events: none;
+ }
+
+ #heatmap-tooltip.hidden {
+ display: none;
+ }
+
+ #heatmap-tooltip p {
+ margin: 0;
+ font-family: sans-serif;
+ font-size: 12px;
+ line-height: 20px;
+ }
\ No newline at end of file
diff -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba config/plugins/visualizations/charts/static/views/editor.js
--- a/config/plugins/visualizations/charts/static/views/editor.js
+++ b/config/plugins/visualizations/charts/static/views/editor.js
@@ -84,7 +84,6 @@
// make table header
this.table.addHeader('No.');
this.table.addHeader('Type');
- this.table.addHeader('Library');
this.table.addHeader('Processing*');
this.table.appendHeader();
@@ -95,7 +94,6 @@
var chart_type = types[id];
this.table.add (++types_n + '.');
this.table.add(chart_type.title);
- this.table.add(chart_type.library, '10%');
if (chart_type.execute) {
this.table.add(new Ui.Icon({icon: 'fa-check'}).$el, '10%', 'center');
} else {
@@ -134,7 +132,7 @@
$main.append(Utils.wrap((new Ui.Label({ title : 'Select a chart type:'})).$el));
$main.append(Utils.wrap(this.table.$el));
$main.append(new Ui.Text({
- title: '*Certain chart types pre-process data before rendering the visualization. The pre-processing is done using the chartskit available in the Toolshed.',
+ title: '*Certain chart types pre-process data before rendering the visualization. The pre-processing is done using the charts tool available in the Toolshed.',
cls: 'toolParamHelp'
}).$el);
diff -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba config/plugins/visualizations/charts/static/views/viewport.js
--- a/config/plugins/visualizations/charts/static/views/viewport.js
+++ b/config/plugins/visualizations/charts/static/views/viewport.js
@@ -26,7 +26,7 @@
this._fullscreen(this.$el, 80);
// create canvas element
- this._create_canvas('div');
+ this._createCanvas('div');
// events
var self = this;
@@ -86,7 +86,7 @@
},
// creates n canvas elements
- _create_canvas: function(tag, n) {
+ _createCanvas: function(tag, n) {
// check size of requested canvas elements
n = n || 1;
@@ -99,7 +99,7 @@
// create requested canvas elements
for (var i = 0; i < n; i++) {
// create element
- var canvas_el = $(this._template_canvas(tag, parseInt(100 / n)));
+ var canvas_el = $(this._templateCanvas(tag, parseInt(100 / n)));
// add to view
this.$el.append(canvas_el);
@@ -137,7 +137,7 @@
}
// create canvas element and add to canvas list
- this._create_canvas(this.chart_settings.tag, n_panels);
+ this._createCanvas(this.chart_settings.tag, n_panels);
// set chart state
chart.state('wait', 'Please wait...');
@@ -269,7 +269,7 @@
},
// template svg/div element
- _template_canvas: function(tag, width) {
+ _templateCanvas: function(tag, width) {
return '<' + tag + ' class="canvas" style="float: left; display: block; width:' + width + '%; height: 100%;"/>';
}
diff -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb -r 8ba0bd46e9fbd54fd6c525a276dd483daa9a79ba config/plugins/visualizations/charts/templates/charts.mako
--- a/config/plugins/visualizations/charts/templates/charts.mako
+++ b/config/plugins/visualizations/charts/templates/charts.mako
@@ -29,6 +29,9 @@
${h.javascript_link( app_root + "plugins/highcharts/highcharts.js" )}
${h.javascript_link( app_root + "plugins/highcharts/highcharts-more.js" )}
+ ## install heat map module
+ ${h.stylesheet_link( app_root + "plugins/heatmap/heatmap.css" )}
+
## install boxplot module
##${h.javascript_link( app_root + "plugins/box.js" )}
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: martenson: data libraries: streamlined deleting and undeleting datasets, filter to include deleted dataset on every folder, better errror handling, some refactoring
by commits-noreply@bitbucket.org 30 Apr '14
by commits-noreply@bitbucket.org 30 Apr '14
30 Apr '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/5bdc2e6d3287/
Changeset: 5bdc2e6d3287
User: martenson
Date: 2014-04-30 22:38:56
Summary: data libraries: streamlined deleting and undeleting datasets, filter to include deleted dataset on every folder, better errror handling, some refactoring
Affected #: 15 files
diff -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb lib/galaxy/webapps/galaxy/api/lda_datasets.py
--- a/lib/galaxy/webapps/galaxy/api/lda_datasets.py
+++ b/lib/galaxy/webapps/galaxy/api/lda_datasets.py
@@ -80,6 +80,7 @@
trans.sa_session.flush()
rval = dataset.to_dict()
+ rval['update_time'] = dataset.update_time.strftime( "%Y-%m-%d %I:%M %p" )
rval['deleted'] = dataset.deleted
rval['id'] = trans.security.encode_id(rval['id'])
rval['ldda_id'] = trans.security.encode_id(rval['ldda_id'])
diff -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb static/scripts/mvc/library/library-folderlist-view.js
--- a/static/scripts/mvc/library/library-folderlist-view.js
+++ b/static/scripts/mvc/library/library-folderlist-view.js
@@ -35,9 +35,7 @@
initialize : function(options){
this.options = _.defaults(this.options || {}, options);
- this.collection = new mod_library_model.Folder();
- // start to listen if someone adds a model to the collection
- this.listenTo(this.collection, 'add', this.renderOne);
+
this.fetchFolder();
},
@@ -46,6 +44,14 @@
var options = options || {};
this.options.include_deleted = options.include_deleted;
var that = this;
+
+ this.collection = new mod_library_model.Folder();
+
+ // start to listen if someone adds a model to the collection
+ this.listenTo(this.collection, 'add', this.renderOne);
+
+ this.listenTo(this.collection, 'remove', this.removeOne);
+
this.folderContainer = new mod_library_model.FolderContainer({id: this.options.id});
this.folderContainer.url = this.folderContainer.attributes.urlRoot + this.options.id + '/contents';
if (this.options.include_deleted){
@@ -137,7 +143,16 @@
}
var rowView = new mod_library_folderrow_view.FolderRowView(model);
this.$el.find('#first_folder_item').after(rowView.el);
- // this.checkEmptiness();
+
+ $('.deleted_dataset').hover(function() {
+ $(this).find('.show_on_hover').show();
+ }, function () {
+ $(this).find('.show_on_hover').hide();
+ });
+ },
+
+ removeOne: function(model){
+ this.$el.find('#' + model.id).remove();
},
/** Checks whether the list is empty and adds/removes the message */
diff -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb static/scripts/mvc/library/library-folderrow-view.js
--- a/static/scripts/mvc/library/library-folderrow-view.js
+++ b/static/scripts/mvc/library/library-folderrow-view.js
@@ -187,22 +187,54 @@
historyItem.url = historyItem.urlRoot + history_id + '/contents';
// save the dataset into selected history
- historyItem.save({ content : library_dataset_id, source : 'library' }, { success : function(){
+ historyItem.save({ content : library_dataset_id, source : 'library' }, {
+ success : function(){
mod_toastr.success('Dataset imported');
//enable the buttons
self.modal.enableButton('Import');
self.modal.enableButton('Download');
- }, error : function(){
- mod_toastr.error('An error occured! Dataset not imported. Please try again.');
+ },
+ error : function(model, response){
+ if (typeof response.responseJSON !== "undefined"){
+ mod_toastr.error('Dataset not imported. ' + response.responseJSON.err_msg);
+ } else {
+ mod_toastr.error('An error occured! Dataset not imported. Please try again.');
+ }
//enable the buttons
self.modal.enableButton('Import');
self.modal.enableButton('Download');
- }
+ }
});
},
+ /**
+ * Undeletes the dataset on server and renders it again.
+ */
undelete_dataset : function(event){
- alert('undelete dataset');
+ /**
+ * need to hide manually because of the element removal
+ * bug in tooltip
+ */
+ $(".tooltip").hide();
+
+ var dataset_id = $(event.target).closest('tr')[0].id;
+ var dataset = Galaxy.libraries.folderListView.collection.get(dataset_id);
+ dataset.url = dataset.urlRoot + dataset.id + '?undelete=true';
+ dataset.destroy({
+ success : function(model, response){
+ Galaxy.libraries.folderListView.collection.remove(dataset_id);
+ var updated_dataset = new mod_library_model.Item(response);
+ Galaxy.libraries.folderListView.collection.add(updated_dataset)
+ mod_toastr.success('Dataset undeleted');
+ },
+ error : function(model, response){
+ if (typeof response.responseJSON !== "undefined"){
+ mod_toastr.error('Dataset was not undeleted. ' + response.responseJSON.err_msg);
+ } else {
+ mod_toastr.error('An error occured! Dataset was not undeleted. Please try again.');
+ }
+ }
+ });
},
templateRowFolder: function() {
diff -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb static/scripts/mvc/library/library-foldertoolbar-view.js
--- a/static/scripts/mvc/library/library-foldertoolbar-view.js
+++ b/static/scripts/mvc/library/library-foldertoolbar-view.js
@@ -379,9 +379,9 @@
}
var promise = $.when(popped_item.save({from_hda_id: popped_item.get('from_hda_id')}));
- promise.done(function(a1){
+ promise.done(function(model){
// we are fine
- Galaxy.libraries.folderListView.collection.add(a1);
+ Galaxy.libraries.folderListView.collection.add(model);
self.updateProgress();
self.chainCallAddingHdas(hdas_set);
})
@@ -398,12 +398,8 @@
*/
checkIncludeDeleted: function(event){
if (event.target.checked){
- Galaxy.libraries.folderListView.collection = new mod_library_model.Folder();
- Galaxy.libraries.folderListView.listenTo(Galaxy.libraries.folderListView.collection, 'add', Galaxy.libraries.folderListView.renderOne);
Galaxy.libraries.folderListView.fetchFolder({include_deleted: true});
} else{
- Galaxy.libraries.folderListView.collection = new mod_library_model.Folder();
- Galaxy.libraries.folderListView.listenTo(Galaxy.libraries.folderListView.collection, 'add', Galaxy.libraries.folderListView.renderOne);
Galaxy.libraries.folderListView.fetchFolder({include_deleted: false});
}
},
@@ -468,19 +464,26 @@
Galaxy.modal.hide();
return this.deleted_lddas;
}
- var promise = $.when(popped_item.destroy({undelete: false}));
+ var promise = $.when(popped_item.destroy());
promise.done(function(dataset){
// we are fine
- self.$el.find('#' + popped_item.id).remove();
+ // self.$el.find('#' + popped_item.id).remove();
+ Galaxy.libraries.folderListView.collection.remove(popped_item.id);
self.updateProgress();
- Galaxy.libraries.folderListView.collection.add(dataset);
+ // add the deleted dataset to collection, triggers rendering
+ if (Galaxy.libraries.folderListView.options.include_deleted){
+ var updated_dataset = new mod_library_model.Item(dataset);
+ Galaxy.libraries.folderListView.collection.add(updated_dataset);
+ }
+ // execute next request
self.chainCallDeletingHdas(lddas_set);
})
.fail(function(){
// we have a problem
self.options.chain_call_control.failed_number += 1;
self.updateProgress();
+ // execute next request
self.chainCallDeletingHdas(lddas_set);
});
},
@@ -490,7 +493,6 @@
// CONTAINER
tmpl_array.push('<div class="library_style_container">');
- tmpl_array.push('<h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fol…" target="_blank">Trello</a>.</h3>');
// TOOLBAR
tmpl_array.push('<div id="library_folder_toolbar">');
tmpl_array.push('<span data-toggle="tooltip" data-placement="top" title="Include deleted datasets"><input id="include_deleted_datasets_chk" style="margin: 0;" type="checkbox"><span class="fa fa-trash-o fa-lg"></span></input></span>');
@@ -509,7 +511,7 @@
tmpl_array.push(' <li id="download_archive"><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');
tmpl_array.push(' </ul>');
tmpl_array.push(' </div>');
- tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button" style="margin-left: 0.5em; " type="button"><span class="fa fa-trash-o"></span> delete</button>');
+ tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button" style="margin-left: 0.5em; " type="button"><span class="fa fa-times"></span> delete</button>');
tmpl_array.push(' </div>');
tmpl_array.push(' <div id="folder_items_element">');
// library items will append here
diff -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb static/scripts/mvc/library/library-librarylist-view.js
--- a/static/scripts/mvc/library/library-librarylist-view.js
+++ b/static/scripts/mvc/library/library-librarylist-view.js
@@ -39,8 +39,12 @@
success: function(){
viewContext.render();
},
- error: function(){
- mod_toastr.error('An error occured. Please try again.');
+ error: function(model, response){
+ if (typeof response.responseJSON !== "undefined"){
+ mod_toastr.error(response.responseJSON.err_msg);
+ } else {
+ mod_toastr.error('An error ocurred :(');
+ }
}
});
},
diff -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb static/scripts/mvc/library/library-libraryrow-view.js
--- a/static/scripts/mvc/library/library-libraryrow-view.js
+++ b/static/scripts/mvc/library/library-libraryrow-view.js
@@ -15,7 +15,6 @@
'click .save_library_btn' : 'save_library_modification',
'click .delete_library_btn' : 'delete_library',
'click .undelete_library_btn' : 'undelete_library',
- 'click .upload_library_btn' : 'upload_to_library',
'click .permission_library_btn' : 'permissions_on_library'
},
@@ -60,7 +59,11 @@
/* now we attach new tooltips to the newly created row element */
this.$el.find("[data-toggle]").tooltip();
},
-
+
+ /**
+ * Function modifies the visibility of buttons for
+ * the filling of the row template of given library.
+ */
prepareButtons: function(library){
vis_config = this.element_visibility_config;
@@ -69,12 +72,10 @@
vis_config.cancel_library_btn = false;
vis_config.delete_library_btn = false;
if (library.get('deleted') === true ){
- // if (Galaxy.currUser.isAdmin()){
vis_config.undelete_library_btn = true;
vis_config.upload_library_btn = false;
vis_config.edit_library_btn = false;
vis_config.permission_library_btn = false;
- // }
} else if (library.get('deleted') === false ) {
vis_config.save_library_btn = false;
vis_config.cancel_library_btn = false;
@@ -96,15 +97,12 @@
vis_config.save_library_btn = true;
vis_config.cancel_library_btn = true;
vis_config.delete_library_btn = true;
+ vis_config.undelete_library_btn = false;
}
this.element_visibility_config = vis_config;
},
- upload_to_library: function(){
- mod_toastr.info('Coming soon. Stay tuned.');
- },
-
permissions_on_library: function(){
mod_toastr.info('Coming soon. Stay tuned.');
},
@@ -159,8 +157,12 @@
row_view.repaint(library);
mod_toastr.success('Changes to library saved');
},
- error: function(){
- mod_toastr.error('An error occured during updating the library :(');
+ error: function(model, response){
+ if (typeof response.responseJSON !== "undefined"){
+ mod_toastr.error(response.responseJSON.err_msg);
+ } else {
+ mod_toastr.error('An error occured during updating the library :(');
+ }
}
});
} else {
@@ -188,8 +190,12 @@
}
mod_toastr.success('Library has been marked deleted');
},
- error: function(){
- mod_toastr.error('An error occured during deleting the library :(');
+ error: function(model, response){
+ if (typeof response.responseJSON !== "undefined"){
+ mod_toastr.error(response.responseJSON.err_msg);
+ } else {
+ mod_toastr.error('An error occured during deleting the library :(');
+ }
}
});
},
@@ -210,8 +216,12 @@
row_view.repaint(library);
mod_toastr.success('Library has been undeleted');
},
- error: function(){
- mod_toastr.error('An error occured while undeleting the library :(');
+ error: function(model, response){
+ if (typeof response.responseJSON !== "undefined"){
+ mod_toastr.error(response.responseJSON.err_msg);
+ } else {
+ mod_toastr.error('An error occured while undeleting the library :(');
+ }
}
});
},
@@ -237,12 +247,11 @@
tmpl_array.push(' <% if( (library.get("public")) && (library.get("deleted") === false) ) { %>');
tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Public" style="color:grey;" class="fa fa-globe fa-lg public_lib_ico"></span>');
tmpl_array.push(' <% }%>');
- // tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Upload to library" class="primary-button btn-xs upload_library_btn" type="button" style="<% if(button_config.upload_library_btn === false) { print("display:none;") } %>"><span class="fa fa-upload"></span></button>');
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Modify <%- library.get("name") %>" class="primary-button btn-xs edit_library_btn" type="button" style="<% if(button_config.edit_library_btn === false) { print("display:none;") } %>"><span class="fa fa-pencil"></span></button>');
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Modify permissions" class="primary-button btn-xs permission_library_btn" type="button" style="<% if(button_config.permission_library_btn === false) { print("display:none;") } %>"><span class="fa fa-group"></span></button>');
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Save changes" class="primary-button btn-xs save_library_btn" type="button" style="<% if(button_config.save_library_btn === false) { print("display:none;") } %>"><span class="fa fa-floppy-o"> Save</span></button>');
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Discard changes" class="primary-button btn-xs cancel_library_btn" type="button" style="<% if(button_config.cancel_library_btn === false) { print("display:none;") } %>"><span class="fa fa-times"> Cancel</span></button>');
- tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Delete library (can be undeleted later)" class="primary-button btn-xs delete_library_btn" type="button" style="<% if(button_config.delete_library_btn === false) { print("display:none;") } %>"><span class="fa fa-trash-o"> Delete</span></button>');
+ tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Delete <%- library.get("name") %>" class="primary-button btn-xs delete_library_btn" type="button" style="<% if(button_config.delete_library_btn === false) { print("display:none;") } %>"><span class="fa fa-trash-o"> Delete</span></button>');
tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Undelete <%- library.get("name") %> " class="primary-button btn-xs undelete_library_btn" type="button" style="<% if(button_config.undelete_library_btn === false) { print("display:none;") } %>"><span class="fa fa-unlock"> Undelete</span></button>');
tmpl_array.push(' </td>');
tmpl_array.push(' </tr>');
diff -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb static/scripts/mvc/library/library-librarytoolbar-view.js
--- a/static/scripts/mvc/library/library-librarytoolbar-view.js
+++ b/static/scripts/mvc/library/library-librarytoolbar-view.js
@@ -66,8 +66,12 @@
Galaxy.libraries.libraryListView.render();
mod_toastr.success('Library created');
},
- error: function(){
- mod_toastr.error('An error occured :(');
+ error: function(model, response){
+ if (typeof response.responseJSON !== "undefined"){
+ mod_toastr.error(response.responseJSON.err_msg);
+ } else {
+ mod_toastr.error('An error occured :(');
+ }
}
});
} else {
diff -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb static/scripts/mvc/library/library-model.js
--- a/static/scripts/mvc/library/library-model.js
+++ b/static/scripts/mvc/library/library-model.js
@@ -84,7 +84,7 @@
// FOLDER RELATED MODELS
var Item = Backbone.Model.extend({
- urlRoot : '/api/libraries/datasets'
+ urlRoot : '/api/libraries/datasets/'
});
var FolderAsModel = Backbone.Model.extend({
diff -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb static/scripts/packed/mvc/library/library-folderlist-view.js
--- a/static/scripts/packed/mvc/library/library-folderlist-view.js
+++ b/static/scripts/packed/mvc/library/library-folderlist-view.js
@@ -1,1 +1,1 @@
-define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-folderrow-view"],function(c,e,f,d,a){var b=Backbone.View.extend({el:"#folder_items_element",defaults:{include_deleted:false},progress:0,progressStep:1,modal:null,folderContainer:null,sort:"asc",events:{"click #select-all-checkboxes":"selectAll","click .dataset_row":"selectClickedRow","click .sort-folder-link":"sort_clicked"},initialize:function(g){this.options=_.defaults(this.options||{},g);this.collection=new d.Folder();this.listenTo(this.collection,"add",this.renderOne);this.fetchFolder()},fetchFolder:function(g){var g=g||{};this.options.include_deleted=g.include_deleted;var h=this;this.folderContainer=new d.FolderContainer({id:this.options.id});this.folderContainer.url=this.folderContainer.attributes.urlRoot+this.options.id+"/contents";if(this.options.include_deleted){this.folderContainer.url=this.folderContainer.url+"?include_deleted=true"}this.folderContainer.fetch({success:function(i){h.folder_container=i;h.render();h.addAll(i.get("folder").models)},error:function(j,i){if(typeof i.responseJSON!=="undefined"){f.error(i.responseJSON.err_msg)}else{f.error("An error ocurred :(")}}})},render:function(g){this.options=_.defaults(this.options,g);var i=this.templateFolder();var j=this.folderContainer.attributes.metadata.full_path;var k;if(j.length===1){k=0}else{k=j[j.length-2][0]}this.$el.html(i({path:this.folderContainer.attributes.metadata.full_path,id:this.options.id,upper_folder_id:k,order:this.sort}));var h=this.folderContainer.attributes.metadata;h.contains_file=this.options.contains_file;Galaxy.libraries.folderToolbarView.configureElements(h);$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},addAll:function(g){_.each(g.reverse(),function(h){Galaxy.libraries.folderListView.collection.add(h)});$("#center [data-toggle]").tooltip();this.checkEmptiness();$(".deleted_dataset").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},renderAll:function(){var g=this;_.each(this.collection.models.reverse(),function(h){g.renderOne(h)});$(".deleted_dataset").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},renderOne:function(h){if(h.get("data_type")!=="folder"){this.options.contains_file=true;h.set("readable_size",this.size_to_string(h.get("file_size")))}var g=new a.FolderRowView(h);this.$el.find("#first_folder_item").after(g.el)},checkEmptiness:function(){if((this.$el.find(".dataset_row").length===0)&&(this.$el.find(".folder_row").length===0)){this.$el.find(".empty-folder-message").show()}else{this.$el.find(".empty-folder-message").hide()}},sort_clicked:function(g){g.preventDefault();if(this.sort==="asc"){this.sortFolder("name","desc");this.sort="desc"}else{this.sortFolder("name","asc");this.sort="asc"}this.render();this.renderAll()},sortFolder:function(h,g){if(h==="name"){if(g==="asc"){return this.collection.sortByNameAsc()}else{if(g==="desc"){return this.collection.sortByNameDesc()}}}},size_to_string:function(g){var h="";if(g>=100000000000){g=g/100000000000;h="TB"}else{if(g>=100000000){g=g/100000000;h="GB"}else{if(g>=100000){g=g/100000;h="MB"}else{if(g>=100){g=g/100;h="KB"}else{g=g*10;h="b"}}}}return(Math.round(g)/10)+h},selectAll:function(h){var g=h.target.checked;that=this;$(":checkbox","#folder_list_body").each(function(){this.checked=g;$row=$(this.parentElement.parentElement);if(g){that.makeDarkRow($row)}else{that.makeWhiteRow($row)}})},selectClickedRow:function(h){var j="";var g;var i;if(h.target.localName==="input"){j=h.target;g=$(h.target.parentElement.parentElement);i="input"}else{if(h.target.localName==="td"){j=$("#"+h.target.parentElement.id).find(":checkbox")[0];g=$(h.target.parentElement);i="td"}}if(j.checked){if(i==="td"){j.checked="";this.makeWhiteRow(g)}else{if(i==="input"){this.makeDarkRow(g)}}}else{if(i==="td"){j.checked="selected";this.makeDarkRow(g)}else{if(i==="input"){this.makeWhiteRow(g)}}}},makeDarkRow:function(g){g.removeClass("light");g.find("a").removeClass("light");g.addClass("dark");g.find("a").addClass("dark");g.find("span").removeClass("fa-file-o");g.find("span").addClass("fa-file")},makeWhiteRow:function(g){g.removeClass("dark");g.find("a").removeClass("dark");g.addClass("light");g.find("a").addClass("light");g.find("span").addClass("fa-file-o");g.find("span").removeClass("fa-file")},templateFolder:function(){var g=[];g.push('<ol class="breadcrumb">');g.push(' <li><a title="Return to the list of libraries" href="#">Libraries</a></li>');g.push(" <% _.each(path, function(path_item) { %>");g.push(" <% if (path_item[0] != id) { %>");g.push(' <li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a></li> ');g.push("<% } else { %>");g.push(' <li class="active"><span title="You are in this folder"><%- path_item[1] %></span></li>');g.push(" <% } %>");g.push(" <% }); %>");g.push("</ol>");g.push('<table id="folder_table" class="grid table table-condensed">');g.push(" <thead>");g.push(' <th class="button_heading"></th>');g.push(' <th style="text-align: center; width: 20px; " title="Check to select all datasets"><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>');g.push(' <th style="width:30%;"><a class="sort-folder-link" title="Click to reverse order" href="#">name</a><span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>');g.push(" <th>data type</th>");g.push(" <th>size</th>");g.push(" <th>time updated (UTC)</th>");g.push(' <th style="width:15%;"></th> ');g.push(" </thead>");g.push(' <tbody id="folder_list_body">');g.push(' <tr id="first_folder_item">');g.push(' <td><a href="#<% if (upper_folder_id !== 0){ print("folders/" + upper_folder_id)} %>" title="Go to parent folder" class="btn_open_folder btn btn-default btn-xs">..<a></td>');g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" </tr>");g.push(" </tbody>");g.push("</table>");g.push('<div class="empty-folder-message" style="display:none;">This folder is either empty or you do not have proper access permissions to see the contents.</div>');return _.template(g.join(""))}});return{FolderListView:b}});
\ No newline at end of file
+define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-folderrow-view"],function(c,e,f,d,a){var b=Backbone.View.extend({el:"#folder_items_element",defaults:{include_deleted:false},progress:0,progressStep:1,modal:null,folderContainer:null,sort:"asc",events:{"click #select-all-checkboxes":"selectAll","click .dataset_row":"selectClickedRow","click .sort-folder-link":"sort_clicked"},initialize:function(g){this.options=_.defaults(this.options||{},g);this.fetchFolder()},fetchFolder:function(g){var g=g||{};this.options.include_deleted=g.include_deleted;var h=this;this.collection=new d.Folder();this.listenTo(this.collection,"add",this.renderOne);this.listenTo(this.collection,"remove",this.removeOne);this.folderContainer=new d.FolderContainer({id:this.options.id});this.folderContainer.url=this.folderContainer.attributes.urlRoot+this.options.id+"/contents";if(this.options.include_deleted){this.folderContainer.url=this.folderContainer.url+"?include_deleted=true"}this.folderContainer.fetch({success:function(i){h.folder_container=i;h.render();h.addAll(i.get("folder").models)},error:function(j,i){if(typeof i.responseJSON!=="undefined"){f.error(i.responseJSON.err_msg)}else{f.error("An error ocurred :(")}}})},render:function(g){this.options=_.defaults(this.options,g);var i=this.templateFolder();var j=this.folderContainer.attributes.metadata.full_path;var k;if(j.length===1){k=0}else{k=j[j.length-2][0]}this.$el.html(i({path:this.folderContainer.attributes.metadata.full_path,id:this.options.id,upper_folder_id:k,order:this.sort}));var h=this.folderContainer.attributes.metadata;h.contains_file=this.options.contains_file;Galaxy.libraries.folderToolbarView.configureElements(h);$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},addAll:function(g){_.each(g.reverse(),function(h){Galaxy.libraries.folderListView.collection.add(h)});$("#center [data-toggle]").tooltip();this.checkEmptiness();$(".deleted_dataset").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},renderAll:function(){var g=this;_.each(this.collection.models.reverse(),function(h){g.renderOne(h)});$(".deleted_dataset").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},renderOne:function(h){if(h.get("data_type")!=="folder"){this.options.contains_file=true;h.set("readable_size",this.size_to_string(h.get("file_size")))}var g=new a.FolderRowView(h);this.$el.find("#first_folder_item").after(g.el);$(".deleted_dataset").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},removeOne:function(g){this.$el.find("#"+g.id).remove()},checkEmptiness:function(){if((this.$el.find(".dataset_row").length===0)&&(this.$el.find(".folder_row").length===0)){this.$el.find(".empty-folder-message").show()}else{this.$el.find(".empty-folder-message").hide()}},sort_clicked:function(g){g.preventDefault();if(this.sort==="asc"){this.sortFolder("name","desc");this.sort="desc"}else{this.sortFolder("name","asc");this.sort="asc"}this.render();this.renderAll()},sortFolder:function(h,g){if(h==="name"){if(g==="asc"){return this.collection.sortByNameAsc()}else{if(g==="desc"){return this.collection.sortByNameDesc()}}}},size_to_string:function(g){var h="";if(g>=100000000000){g=g/100000000000;h="TB"}else{if(g>=100000000){g=g/100000000;h="GB"}else{if(g>=100000){g=g/100000;h="MB"}else{if(g>=100){g=g/100;h="KB"}else{g=g*10;h="b"}}}}return(Math.round(g)/10)+h},selectAll:function(h){var g=h.target.checked;that=this;$(":checkbox","#folder_list_body").each(function(){this.checked=g;$row=$(this.parentElement.parentElement);if(g){that.makeDarkRow($row)}else{that.makeWhiteRow($row)}})},selectClickedRow:function(h){var j="";var g;var i;if(h.target.localName==="input"){j=h.target;g=$(h.target.parentElement.parentElement);i="input"}else{if(h.target.localName==="td"){j=$("#"+h.target.parentElement.id).find(":checkbox")[0];g=$(h.target.parentElement);i="td"}}if(j.checked){if(i==="td"){j.checked="";this.makeWhiteRow(g)}else{if(i==="input"){this.makeDarkRow(g)}}}else{if(i==="td"){j.checked="selected";this.makeDarkRow(g)}else{if(i==="input"){this.makeWhiteRow(g)}}}},makeDarkRow:function(g){g.removeClass("light");g.find("a").removeClass("light");g.addClass("dark");g.find("a").addClass("dark");g.find("span").removeClass("fa-file-o");g.find("span").addClass("fa-file")},makeWhiteRow:function(g){g.removeClass("dark");g.find("a").removeClass("dark");g.addClass("light");g.find("a").addClass("light");g.find("span").addClass("fa-file-o");g.find("span").removeClass("fa-file")},templateFolder:function(){var g=[];g.push('<ol class="breadcrumb">');g.push(' <li><a title="Return to the list of libraries" href="#">Libraries</a></li>');g.push(" <% _.each(path, function(path_item) { %>");g.push(" <% if (path_item[0] != id) { %>");g.push(' <li><a title="Return to this folder" href="#/folders/<%- path_item[0] %>"><%- path_item[1] %></a></li> ');g.push("<% } else { %>");g.push(' <li class="active"><span title="You are in this folder"><%- path_item[1] %></span></li>');g.push(" <% } %>");g.push(" <% }); %>");g.push("</ol>");g.push('<table id="folder_table" class="grid table table-condensed">');g.push(" <thead>");g.push(' <th class="button_heading"></th>');g.push(' <th style="text-align: center; width: 20px; " title="Check to select all datasets"><input id="select-all-checkboxes" style="margin: 0;" type="checkbox"></th>');g.push(' <th style="width:30%;"><a class="sort-folder-link" title="Click to reverse order" href="#">name</a><span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>');g.push(" <th>data type</th>");g.push(" <th>size</th>");g.push(" <th>time updated (UTC)</th>");g.push(' <th style="width:15%;"></th> ');g.push(" </thead>");g.push(' <tbody id="folder_list_body">');g.push(' <tr id="first_folder_item">');g.push(' <td><a href="#<% if (upper_folder_id !== 0){ print("folders/" + upper_folder_id)} %>" title="Go to parent folder" class="btn_open_folder btn btn-default btn-xs">..<a></td>');g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" <td></td>");g.push(" </tr>");g.push(" </tbody>");g.push("</table>");g.push('<div class="empty-folder-message" style="display:none;">This folder is either empty or you do not have proper access permissions to see the contents.</div>');return _.template(g.join(""))}});return{FolderListView:b}});
\ No newline at end of file
diff -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb static/scripts/packed/mvc/library/library-folderrow-view.js
--- a/static/scripts/packed/mvc/library/library-folderrow-view.js
+++ b/static/scripts/packed/mvc/library/library-folderrow-view.js
@@ -1,1 +1,1 @@
-define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model"],function(b,d,e,c){var a=Backbone.View.extend({lastSelectedHistory:"",events:{"click .library-dataset":"showDatasetDetails","click .undelete_dataset_btn":"undelete_dataset"},options:{type:null},initialize:function(f){this.render(f)},render:function(f){var g=null;if(f.get("type")==="folder"){this.options.type="folder";g=this.templateRowFolder()}else{this.options.type="file";if(f.get("deleted")){g=this.templateRowDeletedFile()}else{g=this.templateRowFile()}}this.setElement(g({content_item:f}));this.$el.show();return this},showDatasetDetails:function(i){i.preventDefault();var j=this.id;var h=new c.Item();var g=new c.GalaxyHistories();h.id=j;var f=this;h.fetch({success:function(k){g.fetch({success:function(l){f.renderModalAfterFetch(k,l)},error:function(m,l){if(typeof l.responseJSON!=="undefined"){e.error(l.responseJSON.err_msg)}else{e.error("An error occured during fetching histories:(")}f.renderModalAfterFetch(k)}})},error:function(l,k){if(typeof k.responseJSON!=="undefined"){e.error(k.responseJSON.err_msg)}else{e.error("An error occured during loading dataset details :(")}}})},renderModalAfterFetch:function(k,h){var i=this.size_to_string(k.get("file_size"));var j=_.template(this.templateDatasetModal(),{item:k,size:i});var g=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Dataset Details",body:j,buttons:{Import:function(){g.importCurrentIntoHistory()},Download:function(){g.downloadCurrent()},Close:function(){g.modal.hide()}}});$(".peek").html(k.get("peek"));if(typeof history.models!==undefined){var f=_.template(this.templateHistorySelectInModal(),{histories:h.models});$(this.modal.elMain).find(".buttons").prepend(f);if(g.lastSelectedHistory.length>0){$(this.modal.elMain).find("#dataset_import_single").val(g.lastSelectedHistory)}}},size_to_string:function(f){var g="";if(f>=100000000000){f=f/100000000000;g="TB"}else{if(f>=100000000){f=f/100000000;g="GB"}else{if(f>=100000){f=f/100000;g="MB"}else{if(f>=100){f=f/100;g="KB"}else{f=f*10;g="b"}}}}return(Math.round(f)/10)+g},downloadCurrent:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var f=[];f.push($("#id_row").attr("data-id"));var g="/api/libraries/datasets/download/uncompressed";var h={ldda_ids:f};this.processDownload(g,h);this.modal.enableButton("Import");this.modal.enableButton("Download")},processDownload:function(g,h,i){if(g&&h){h=typeof h=="string"?h:$.param(h);var f="";$.each(h.split("&"),function(){var j=this.split("=");f+='<input type="hidden" name="'+j[0]+'" value="'+j[1]+'" />'});$('<form action="'+g+'" method="'+(i||"post")+'">'+f+"</form>").appendTo("body").submit().remove();e.info("Your download will begin soon")}},importCurrentIntoHistory:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var h=$(this.modal.elMain).find("select[name=dataset_import_single] option:selected").val();this.lastSelectedHistory=h;var f=$("#id_row").attr("data-id");var i=new c.HistoryItem();var g=this;i.url=i.urlRoot+h+"/contents";i.save({content:f,source:"library"},{success:function(){e.success("Dataset imported");g.modal.enableButton("Import");g.modal.enableButton("Download")},error:function(){e.error("An error occured! Dataset not imported. Please try again.");g.modal.enableButton("Import");g.modal.enableButton("Download")}})},undelete_dataset:function(f){alert("undelete dataset")},templateRowFolder:function(){tmpl_array=[];tmpl_array.push('<tr class="folder_row light" id="<%- content_item.id %>">');tmpl_array.push(" <td>");tmpl_array.push(' <span title="Folder" class="fa fa-folder-o"></span>');tmpl_array.push(" </td>");tmpl_array.push(" <td></td>");tmpl_array.push(" <td>");tmpl_array.push(' <a href="#folders/<%- content_item.id %>"><%- content_item.get("name") %></a>');tmpl_array.push(' <% if (content_item.get("item_count") === 0) { %>');tmpl_array.push(" <span>(empty folder)</span>");tmpl_array.push(" <% } %>");tmpl_array.push(" </td>");tmpl_array.push(" <td>folder</td>");tmpl_array.push(" <td></td>");tmpl_array.push(' <td><%= _.escape(content_item.get("update_time")) %></td>');tmpl_array.push(" <td></td>");tmpl_array.push("</tr>");return _.template(tmpl_array.join(""))},templateRowFile:function(){tmpl_array=[];tmpl_array.push('<tr class="dataset_row light" id="<%- content_item.id %>">');tmpl_array.push(" <td>");tmpl_array.push(' <span title="Dataset" class="fa fa-file-o"></span>');tmpl_array.push(" </td>");tmpl_array.push(' <td style="text-align: center; "><input style="margin: 0;" type="checkbox"></td>');tmpl_array.push(' <td><a href="#" class="library-dataset"><%- content_item.get("name") %><a></td>');tmpl_array.push(' <td><%= _.escape(content_item.get("data_type")) %></td>');tmpl_array.push(' <td><%= _.escape(content_item.get("readable_size")) %></td>');tmpl_array.push(' <td><%= _.escape(content_item.get("update_time")) %></td>');tmpl_array.push(" <td></td>");tmpl_array.push("</tr>");return _.template(tmpl_array.join(""))},templateRowDeletedFile:function(){tmpl_array=[];tmpl_array.push('<tr class="active deleted_dataset" id="<%- content_item.id %>">');tmpl_array.push(" <td>");tmpl_array.push(' <span title="Dataset" class="fa fa-file-o"></span>');tmpl_array.push(" </td>");tmpl_array.push(' <td><span data-toggle="tooltip" data-placement="top" title="Marked deleted" style="color:grey;" class="fa fa-ban fa-lg"></span></td>');tmpl_array.push(' <td style="color:grey;"><%- content_item.get("name") %></td>');tmpl_array.push(' <td><%= _.escape(content_item.get("data_type")) %></td>');tmpl_array.push(' <td><%= _.escape(content_item.get("readable_size")) %></td>');tmpl_array.push(' <td><%= _.escape(content_item.get("update_time")) %></td>');tmpl_array.push(' <td class="right-center"><button data-toggle="tooltip" data-placement="top" title="Undelete <%- content_item.get("name") %>" class="primary-button btn-xs undelete_dataset_btn show_on_hover" type="button" style="display:none;"><span class="fa fa-unlock"> Undelete</span></button></td>');tmpl_array.push("</tr>");return _.template(tmpl_array.join(""))},templateDatasetModal:function(){var f=[];f.push('<div class="modal_table">');f.push(' <table class="grid table table-striped table-condensed">');f.push(" <tr>");f.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');f.push(' <td><%= _.escape(item.get("name")) %></td>');f.push(" </tr>");f.push(" <tr>");f.push(' <th scope="row">Data type</th>');f.push(' <td><%= _.escape(item.get("data_type")) %></td>');f.push(" </tr>");f.push(" <tr>");f.push(' <th scope="row">Genome build</th>');f.push(' <td><%= _.escape(item.get("genome_build")) %></td>');f.push(" </tr>");f.push(' <th scope="row">Size</th>');f.push(" <td><%= _.escape(size) %></td>");f.push(" </tr>");f.push(" <tr>");f.push(' <th scope="row">Date uploaded (UTC)</th>');f.push(' <td><%= _.escape(item.get("date_uploaded")) %></td>');f.push(" </tr>");f.push(" <tr>");f.push(' <th scope="row">Uploaded by</th>');f.push(' <td><%= _.escape(item.get("uploaded_by")) %></td>');f.push(" </tr>");f.push(' <tr scope="row">');f.push(' <th scope="row">Data Lines</th>');f.push(' <td scope="row"><%= _.escape(item.get("metadata_data_lines")) %></td>');f.push(" </tr>");f.push(' <th scope="row">Comment Lines</th>');f.push(' <% if (item.get("metadata_comment_lines") === "") { %>');f.push(' <td scope="row"><%= _.escape(item.get("metadata_comment_lines")) %></td>');f.push(" <% } else { %>");f.push(' <td scope="row">unknown</td>');f.push(" <% } %>");f.push(" </tr>");f.push(" <tr>");f.push(' <th scope="row">Number of Columns</th>');f.push(' <td scope="row"><%= _.escape(item.get("metadata_columns")) %></td>');f.push(" </tr>");f.push(" <tr>");f.push(' <th scope="row">Column Types</th>');f.push(' <td scope="row"><%= _.escape(item.get("metadata_column_types")) %></td>');f.push(" </tr>");f.push(" <tr>");f.push(' <th scope="row">Miscellaneous information</th>');f.push(' <td scope="row"><%= _.escape(item.get("misc_blurb")) %></td>');f.push(" </tr>");f.push(" </table>");f.push(' <pre class="peek">');f.push(" </pre>");f.push("</div>");return f.join("")},templateHistorySelectInModal:function(){var f=[];f.push('<span id="history_modal_combo" style="width:100%; margin-left: 1em; margin-right: 1em; ">');f.push("Select history: ");f.push('<select id="dataset_import_single" name="dataset_import_single" style="width:40%; margin-bottom: 1em; "> ');f.push(" <% _.each(histories, function(history) { %>");f.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');f.push(" <% }); %>");f.push("</select>");f.push("</span>");return f.join("")}});return{FolderRowView:a}});
\ No newline at end of file
+define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model"],function(b,d,e,c){var a=Backbone.View.extend({lastSelectedHistory:"",events:{"click .library-dataset":"showDatasetDetails","click .undelete_dataset_btn":"undelete_dataset"},options:{type:null},initialize:function(f){this.render(f)},render:function(f){var g=null;if(f.get("type")==="folder"){this.options.type="folder";g=this.templateRowFolder()}else{this.options.type="file";if(f.get("deleted")){g=this.templateRowDeletedFile()}else{g=this.templateRowFile()}}this.setElement(g({content_item:f}));this.$el.show();return this},showDatasetDetails:function(i){i.preventDefault();var j=this.id;var h=new c.Item();var g=new c.GalaxyHistories();h.id=j;var f=this;h.fetch({success:function(k){g.fetch({success:function(l){f.renderModalAfterFetch(k,l)},error:function(m,l){if(typeof l.responseJSON!=="undefined"){e.error(l.responseJSON.err_msg)}else{e.error("An error occured during fetching histories:(")}f.renderModalAfterFetch(k)}})},error:function(l,k){if(typeof k.responseJSON!=="undefined"){e.error(k.responseJSON.err_msg)}else{e.error("An error occured during loading dataset details :(")}}})},renderModalAfterFetch:function(k,h){var i=this.size_to_string(k.get("file_size"));var j=_.template(this.templateDatasetModal(),{item:k,size:i});var g=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Dataset Details",body:j,buttons:{Import:function(){g.importCurrentIntoHistory()},Download:function(){g.downloadCurrent()},Close:function(){g.modal.hide()}}});$(".peek").html(k.get("peek"));if(typeof history.models!==undefined){var f=_.template(this.templateHistorySelectInModal(),{histories:h.models});$(this.modal.elMain).find(".buttons").prepend(f);if(g.lastSelectedHistory.length>0){$(this.modal.elMain).find("#dataset_import_single").val(g.lastSelectedHistory)}}},size_to_string:function(f){var g="";if(f>=100000000000){f=f/100000000000;g="TB"}else{if(f>=100000000){f=f/100000000;g="GB"}else{if(f>=100000){f=f/100000;g="MB"}else{if(f>=100){f=f/100;g="KB"}else{f=f*10;g="b"}}}}return(Math.round(f)/10)+g},downloadCurrent:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var f=[];f.push($("#id_row").attr("data-id"));var g="/api/libraries/datasets/download/uncompressed";var h={ldda_ids:f};this.processDownload(g,h);this.modal.enableButton("Import");this.modal.enableButton("Download")},processDownload:function(g,h,i){if(g&&h){h=typeof h=="string"?h:$.param(h);var f="";$.each(h.split("&"),function(){var j=this.split("=");f+='<input type="hidden" name="'+j[0]+'" value="'+j[1]+'" />'});$('<form action="'+g+'" method="'+(i||"post")+'">'+f+"</form>").appendTo("body").submit().remove();e.info("Your download will begin soon")}},importCurrentIntoHistory:function(){this.modal.disableButton("Import");this.modal.disableButton("Download");var h=$(this.modal.elMain).find("select[name=dataset_import_single] option:selected").val();this.lastSelectedHistory=h;var f=$("#id_row").attr("data-id");var i=new c.HistoryItem();var g=this;i.url=i.urlRoot+h+"/contents";i.save({content:f,source:"library"},{success:function(){e.success("Dataset imported");g.modal.enableButton("Import");g.modal.enableButton("Download")},error:function(k,j){if(typeof j.responseJSON!=="undefined"){e.error("Dataset not imported. "+j.responseJSON.err_msg)}else{e.error("An error occured! Dataset not imported. Please try again.")}g.modal.enableButton("Import");g.modal.enableButton("Download")}})},undelete_dataset:function(g){$(".tooltip").hide();var f=$(g.target).closest("tr")[0].id;var h=Galaxy.libraries.folderListView.collection.get(f);h.url=h.urlRoot+h.id+"?undelete=true";h.destroy({success:function(j,i){Galaxy.libraries.folderListView.collection.remove(f);var k=new c.Item(i);Galaxy.libraries.folderListView.collection.add(k);e.success("Dataset undeleted")},error:function(j,i){if(typeof i.responseJSON!=="undefined"){e.error("Dataset was not undeleted. "+i.responseJSON.err_msg)}else{e.error("An error occured! Dataset was not undeleted. Please try again.")}}})},templateRowFolder:function(){tmpl_array=[];tmpl_array.push('<tr class="folder_row light" id="<%- content_item.id %>">');tmpl_array.push(" <td>");tmpl_array.push(' <span title="Folder" class="fa fa-folder-o"></span>');tmpl_array.push(" </td>");tmpl_array.push(" <td></td>");tmpl_array.push(" <td>");tmpl_array.push(' <a href="#folders/<%- content_item.id %>"><%- content_item.get("name") %></a>');tmpl_array.push(' <% if (content_item.get("item_count") === 0) { %>');tmpl_array.push(" <span>(empty folder)</span>");tmpl_array.push(" <% } %>");tmpl_array.push(" </td>");tmpl_array.push(" <td>folder</td>");tmpl_array.push(" <td></td>");tmpl_array.push(' <td><%= _.escape(content_item.get("update_time")) %></td>');tmpl_array.push(" <td></td>");tmpl_array.push("</tr>");return _.template(tmpl_array.join(""))},templateRowFile:function(){tmpl_array=[];tmpl_array.push('<tr class="dataset_row light" id="<%- content_item.id %>">');tmpl_array.push(" <td>");tmpl_array.push(' <span title="Dataset" class="fa fa-file-o"></span>');tmpl_array.push(" </td>");tmpl_array.push(' <td style="text-align: center; "><input style="margin: 0;" type="checkbox"></td>');tmpl_array.push(' <td><a href="#" class="library-dataset"><%- content_item.get("name") %><a></td>');tmpl_array.push(' <td><%= _.escape(content_item.get("data_type")) %></td>');tmpl_array.push(' <td><%= _.escape(content_item.get("readable_size")) %></td>');tmpl_array.push(' <td><%= _.escape(content_item.get("update_time")) %></td>');tmpl_array.push(" <td></td>");tmpl_array.push("</tr>");return _.template(tmpl_array.join(""))},templateRowDeletedFile:function(){tmpl_array=[];tmpl_array.push('<tr class="active deleted_dataset" id="<%- content_item.id %>">');tmpl_array.push(" <td>");tmpl_array.push(' <span title="Dataset" class="fa fa-file-o"></span>');tmpl_array.push(" </td>");tmpl_array.push(' <td><span data-toggle="tooltip" data-placement="top" title="Marked deleted" style="color:grey;" class="fa fa-ban fa-lg"></span></td>');tmpl_array.push(' <td style="color:grey;"><%- content_item.get("name") %></td>');tmpl_array.push(' <td><%= _.escape(content_item.get("data_type")) %></td>');tmpl_array.push(' <td><%= _.escape(content_item.get("readable_size")) %></td>');tmpl_array.push(' <td><%= _.escape(content_item.get("update_time")) %></td>');tmpl_array.push(' <td class="right-center"><button data-toggle="tooltip" data-placement="top" title="Undelete <%- content_item.get("name") %>" class="primary-button btn-xs undelete_dataset_btn show_on_hover" type="button" style="display:none;"><span class="fa fa-unlock"> Undelete</span></button></td>');tmpl_array.push("</tr>");return _.template(tmpl_array.join(""))},templateDatasetModal:function(){var f=[];f.push('<div class="modal_table">');f.push(' <table class="grid table table-striped table-condensed">');f.push(" <tr>");f.push(' <th scope="row" id="id_row" data-id="<%= _.escape(item.get("ldda_id")) %>">Name</th>');f.push(' <td><%= _.escape(item.get("name")) %></td>');f.push(" </tr>");f.push(" <tr>");f.push(' <th scope="row">Data type</th>');f.push(' <td><%= _.escape(item.get("data_type")) %></td>');f.push(" </tr>");f.push(" <tr>");f.push(' <th scope="row">Genome build</th>');f.push(' <td><%= _.escape(item.get("genome_build")) %></td>');f.push(" </tr>");f.push(' <th scope="row">Size</th>');f.push(" <td><%= _.escape(size) %></td>");f.push(" </tr>");f.push(" <tr>");f.push(' <th scope="row">Date uploaded (UTC)</th>');f.push(' <td><%= _.escape(item.get("date_uploaded")) %></td>');f.push(" </tr>");f.push(" <tr>");f.push(' <th scope="row">Uploaded by</th>');f.push(' <td><%= _.escape(item.get("uploaded_by")) %></td>');f.push(" </tr>");f.push(' <tr scope="row">');f.push(' <th scope="row">Data Lines</th>');f.push(' <td scope="row"><%= _.escape(item.get("metadata_data_lines")) %></td>');f.push(" </tr>");f.push(' <th scope="row">Comment Lines</th>');f.push(' <% if (item.get("metadata_comment_lines") === "") { %>');f.push(' <td scope="row"><%= _.escape(item.get("metadata_comment_lines")) %></td>');f.push(" <% } else { %>");f.push(' <td scope="row">unknown</td>');f.push(" <% } %>");f.push(" </tr>");f.push(" <tr>");f.push(' <th scope="row">Number of Columns</th>');f.push(' <td scope="row"><%= _.escape(item.get("metadata_columns")) %></td>');f.push(" </tr>");f.push(" <tr>");f.push(' <th scope="row">Column Types</th>');f.push(' <td scope="row"><%= _.escape(item.get("metadata_column_types")) %></td>');f.push(" </tr>");f.push(" <tr>");f.push(' <th scope="row">Miscellaneous information</th>');f.push(' <td scope="row"><%= _.escape(item.get("misc_blurb")) %></td>');f.push(" </tr>");f.push(" </table>");f.push(' <pre class="peek">');f.push(" </pre>");f.push("</div>");return f.join("")},templateHistorySelectInModal:function(){var f=[];f.push('<span id="history_modal_combo" style="width:100%; margin-left: 1em; margin-right: 1em; ">');f.push("Select history: ");f.push('<select id="dataset_import_single" name="dataset_import_single" style="width:40%; margin-bottom: 1em; "> ');f.push(" <% _.each(histories, function(history) { %>");f.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');f.push(" <% }); %>");f.push("</select>");f.push("</span>");return f.join("")}});return{FolderRowView:a}});
\ No newline at end of file
diff -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb static/scripts/packed/mvc/library/library-foldertoolbar-view.js
--- a/static/scripts/packed/mvc/library/library-foldertoolbar-view.js
+++ b/static/scripts/packed/mvc/library/library-foldertoolbar-view.js
@@ -1,1 +1,1 @@
-define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model"],function(b,d,e,c){var a=Backbone.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click .toolbtn_add_files":"addFilesToFolderModal","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_bulk_delete":"deleteSelectedDatasets"},defaults:{can_add_library_item:false,contains_file:false,chain_call_control:{total_number:0,failed_number:0}},modal:null,histories:null,initialize:function(f){this.options=_.defaults(f||{},this.defaults);this.render()},render:function(f){this.options=_.extend(this.options,f);var h=this.templateToolBar();var g=false;if(Galaxy.currUser){g=Galaxy.currUser.isAdmin()}this.$el.html(h({id:this.options.id,admin_user:g}))},configureElements:function(f){this.options=_.extend(this.options,f);if(this.options.can_add_library_item===true){$("#toolbtn_create_folder").show();$(".toolbtn_add_files").show()}if(this.options.contains_file===true){$("#toolbtn_bulk_import").show();$("#toolbtn_dl").show()}this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(){event.preventDefault();event.stopPropagation();var f=this;var g=this.templateNewFolderInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Folder",body:g(),buttons:{Create:function(){f.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var f=this.serialize_new_folder();if(this.validate_new_folder(f)){var g=new c.FolderAsModel();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];g.url=g.urlRoot+"/"+current_folder_id;g.save(f,{success:function(h){Galaxy.modal.hide();e.success("Folder created");h.set({type:"folder"});Galaxy.libraries.folderListView.collection.add(h)},error:function(i,h){Galaxy.modal.hide();if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})}else{e.error("Folder's name is missing")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(f){return f.name!==""},modalBulkImport:function(){var f=$("#folder_table").find(":checked");if(f.length===0){e.info("You have to select some datasets first")}else{this.refreshUserHistoriesList(function(g){var h=g.templateBulkImportInModal();g.modal=Galaxy.modal;g.modal.show({closing_events:true,title:"Import into History",body:h({histories:g.histories.models}),buttons:{Import:function(){g.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})}},refreshUserHistoriesList:function(g){var f=this;this.histories=new c.GalaxyHistories();this.histories.fetch({success:function(){g(f)},error:function(i,h){if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},importAllIntoHistory:function(){this.modal.disableButton("Import");this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var j=$("select[name=dataset_import_bulk] option:selected").val();this.options.last_used_history_id=j;var m=$("select[name=dataset_import_bulk] option:selected").text();var o=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){o.push(this.parentElement.parentElement.id)}});var n=this.templateImportIntoHistoryProgressBar();this.modal.$el.find(".modal-body").html(n({history_name:m}));var k=100/o.length;this.initProgress(k);var f=[];for(var g=o.length-1;g>=0;g--){var h=o[g];var l=new c.HistoryItem();l.url=l.urlRoot+j+"/contents";l.content=h;l.source="library";f.push(l)}this.options.chain_call_control.total_number=f.length;this.chainCall(f,m)},chainCall:function(g,j){var f=this;var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets imported into history")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were imported into history.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be imported into history")}}}Galaxy.modal.hide();return}var i=$.when(h.save({content:h.content,source:h.source}));i.done(function(){f.updateProgress();f.chainCall(g,j)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCall(g,j)})},initProgress:function(f){this.progress=0;this.progressStep=f},updateProgress:function(){this.progress+=this.progressStep;$(".progress-bar-import").width(Math.round(this.progress)+"%");txt_representation=Math.round(this.progress)+"% Complete";$(".completion_span").text(txt_representation)},download:function(f,j){var h=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){h.push(this.parentElement.parentElement.id)}});var g="/api/libraries/datasets/download/"+j;var i={ldda_ids:h};this.processDownload(g,i,"get")},processDownload:function(g,h,i){if(g&&h){h=typeof h==="string"?h:$.param(h);var f="";$.each(h.split("&"),function(){var j=this.split("=");f+='<input type="hidden" name="'+j[0]+'" value="'+j[1]+'" />'});$('<form action="'+g+'" method="'+(i||"post")+'">'+f+"</form>").appendTo("body").submit().remove();e.info("Your download will begin soon")}},addFilesToFolderModal:function(){this.refreshUserHistoriesList(function(f){f.modal=Galaxy.modal;var g=f.templateAddFilesInModal();f.modal.show({closing_events:true,title:"Add datasets from history to "+f.options.folder_name,body:g({histories:f.histories.models}),buttons:{Add:function(){f.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}}});if(f.histories.models.length>0){f.fetchAndDisplayHistoryContents(f.histories.models[0].id);$("#dataset_add_bulk").change(function(h){f.fetchAndDisplayHistoryContents(h.target.value)})}else{e.error("An error ocurred :(")}})},fetchAndDisplayHistoryContents:function(h){var g=new c.HistoryContents({id:h});var f=this;g.fetch({success:function(j){var i=f.templateHistoryContents();f.histories.get(h).set({contents:j});f.modal.$el.find("#selected_history_content").html(i({history_contents:j.models.reverse()}))},error:function(){e.error("An error ocurred :(")}})},addAllDatasetsFromHistory:function(){this.modal.disableButton("Add");this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var f=[];this.modal.$el.find("#selected_history_content").find(":checked").each(function(){var i=$(this.parentElement).data("id");if(i){f.push(i)}});var l=this.options.folder_name;var k=this.templateAddingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(k({folder_name:l}));this.progressStep=100/f.length;this.progress=0;var j=[];for(var h=f.length-1;h>=0;h--){history_dataset_id=f[h];var g=new c.Item();g.url="/api/folders/"+this.options.id+"/contents";g.set({from_hda_id:history_dataset_id});j.push(g)}this.options.chain_call_control.total_number=j.length;this.chainCallAddingHdas(j)},chainCallAddingHdas:function(g){var f=this;this.added_hdas=new c.Folder();var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets from history added to the folder")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were added to the folder.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be added to the folder")}}}Galaxy.modal.hide();return this.added_hdas}var i=$.when(h.save({from_hda_id:h.get("from_hda_id")}));i.done(function(j){Galaxy.libraries.folderListView.collection.add(j);f.updateProgress();f.chainCallAddingHdas(g)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallAddingHdas(g)})},checkIncludeDeleted:function(f){if(f.target.checked){Galaxy.libraries.folderListView.collection=new c.Folder();Galaxy.libraries.folderListView.listenTo(Galaxy.libraries.folderListView.collection,"add",Galaxy.libraries.folderListView.renderOne);Galaxy.libraries.folderListView.fetchFolder({include_deleted:true})}else{Galaxy.libraries.folderListView.collection=new c.Folder();Galaxy.libraries.folderListView.listenTo(Galaxy.libraries.folderListView.collection,"add",Galaxy.libraries.folderListView.renderOne);Galaxy.libraries.folderListView.fetchFolder({include_deleted:false})}},deleteSelectedDatasets:function(){var f=$("#folder_table").find(":checked");if(f.length===0){e.info("You have to select some datasets first")}else{var j=this.templateDeletingDatasetsProgressBar();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Deleting selected datasets",body:j({}),buttons:{Close:function(){Galaxy.modal.hide()}}});this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var g=[];f.each(function(){if(this.parentElement.parentElement.id!==""){g.push(this.parentElement.parentElement.id)}});this.progressStep=100/g.length;this.progress=0;var l=[];for(var h=g.length-1;h>=0;h--){var k=new c.Item({id:g[h]});l.push(k)}this.options.chain_call_control.total_number=g.length;this.chainCallDeletingHdas(l)}},chainCallDeletingHdas:function(g){var f=this;this.deleted_lddas=new c.Folder();var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets deleted")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were deleted.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be deleted")}}}Galaxy.modal.hide();return this.deleted_lddas}var i=$.when(h.destroy({undelete:false}));i.done(function(j){f.$el.find("#"+h.id).remove();f.updateProgress();Galaxy.libraries.folderListView.collection.add(j);f.chainCallDeletingHdas(g)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallDeletingHdas(g)})},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push('<h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fol…" target="_blank">Trello</a>.</h3>');tmpl_array.push('<div id="library_folder_toolbar">');tmpl_array.push('<span data-toggle="tooltip" data-placement="top" title="Include deleted datasets"><input id="include_deleted_datasets_chk" style="margin: 0;" type="checkbox"><span class="fa fa-trash-o fa-lg"></span></input></span>');tmpl_array.push('<div class="btn-group">');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Create New Folder" id="toolbtn_create_folder" class="btn btn-default primary-button" type="button" style="display:none;"><span class="fa fa-plus"></span><span class="fa fa-folder"></span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Add Datasets to Current Folder" id="toolbtn_add_files" class="btn btn-default toolbtn_add_files primary-button" type="button" style="display:none;"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></button>');tmpl_array.push("</div>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Import selected datasets into history" id="toolbtn_bulk_import" class="primary-button" style="margin-left: 0.5em; " type="button"><span class="fa fa-book"></span> to history</button>');tmpl_array.push(' <div id="toolbtn_dl" class="btn-group" style="margin-left: 0.5em; ">');tmpl_array.push(' <button title="Download selected datasets as archive" id="drop_toggle" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-download"></span> download <span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li id="download_archive"><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');tmpl_array.push(' <li id="download_archive"><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');tmpl_array.push(' <li id="download_archive"><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button" style="margin-left: 0.5em; " type="button"><span class="fa fa-trash-o"></span> delete</button>');tmpl_array.push(" </div>");tmpl_array.push(' <div id="folder_items_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewFolderInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_folder_modal">');tmpl_array.push("<form>");tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push("</form>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateBulkImportInModal:function(){var f=[];f.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');f.push("Select history: ");f.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');f.push(" <% _.each(histories, function(history) { %>");f.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');f.push(" <% }); %>");f.push("</select>");f.push("</span>");return _.template(f.join(""))},templateImportIntoHistoryProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateAddingDatasetsProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("Adding selected datasets from history to library folder <b><%= _.escape(folder_name) %></b>");f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateDeletingDatasetsProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-delete" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateAddFilesInModal:function(){var f=[];f.push('<div id="add_files_modal">');f.push('<div id="history_modal_combo_bulk">');f.push("Select history: ");f.push('<select id="dataset_add_bulk" name="dataset_add_bulk" style="width:66%; "> ');f.push(" <% _.each(histories, function(history) { %>");f.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');f.push(" <% }); %>");f.push("</select>");f.push("</div>");f.push('<div id="selected_history_content">');f.push("</div>");f.push("</div>");return _.template(f.join(""))},templateHistoryContents:function(){var f=[];f.push("Choose the datasets to import:");f.push("<ul>");f.push(" <% _.each(history_contents, function(history_item) { %>");f.push(' <li data-id="<%= _.escape(history_item.get("id")) %>">');f.push(' <input style="margin: 0;" type="checkbox"><%= _.escape(history_item.get("hid")) %>: <%= _.escape(history_item.get("name")) %>');f.push(" </li>");f.push(" <% }); %>");f.push("</ul>");return _.template(f.join(""))}});return{FolderToolbarView:a}});
\ No newline at end of file
+define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model"],function(b,d,e,c){var a=Backbone.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click .toolbtn_add_files":"addFilesToFolderModal","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_bulk_delete":"deleteSelectedDatasets"},defaults:{can_add_library_item:false,contains_file:false,chain_call_control:{total_number:0,failed_number:0}},modal:null,histories:null,initialize:function(f){this.options=_.defaults(f||{},this.defaults);this.render()},render:function(f){this.options=_.extend(this.options,f);var h=this.templateToolBar();var g=false;if(Galaxy.currUser){g=Galaxy.currUser.isAdmin()}this.$el.html(h({id:this.options.id,admin_user:g}))},configureElements:function(f){this.options=_.extend(this.options,f);if(this.options.can_add_library_item===true){$("#toolbtn_create_folder").show();$(".toolbtn_add_files").show()}if(this.options.contains_file===true){$("#toolbtn_bulk_import").show();$("#toolbtn_dl").show()}this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(){event.preventDefault();event.stopPropagation();var f=this;var g=this.templateNewFolderInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Folder",body:g(),buttons:{Create:function(){f.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var f=this.serialize_new_folder();if(this.validate_new_folder(f)){var g=new c.FolderAsModel();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];g.url=g.urlRoot+"/"+current_folder_id;g.save(f,{success:function(h){Galaxy.modal.hide();e.success("Folder created");h.set({type:"folder"});Galaxy.libraries.folderListView.collection.add(h)},error:function(i,h){Galaxy.modal.hide();if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})}else{e.error("Folder's name is missing")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(f){return f.name!==""},modalBulkImport:function(){var f=$("#folder_table").find(":checked");if(f.length===0){e.info("You have to select some datasets first")}else{this.refreshUserHistoriesList(function(g){var h=g.templateBulkImportInModal();g.modal=Galaxy.modal;g.modal.show({closing_events:true,title:"Import into History",body:h({histories:g.histories.models}),buttons:{Import:function(){g.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})}},refreshUserHistoriesList:function(g){var f=this;this.histories=new c.GalaxyHistories();this.histories.fetch({success:function(){g(f)},error:function(i,h){if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},importAllIntoHistory:function(){this.modal.disableButton("Import");this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var j=$("select[name=dataset_import_bulk] option:selected").val();this.options.last_used_history_id=j;var m=$("select[name=dataset_import_bulk] option:selected").text();var o=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){o.push(this.parentElement.parentElement.id)}});var n=this.templateImportIntoHistoryProgressBar();this.modal.$el.find(".modal-body").html(n({history_name:m}));var k=100/o.length;this.initProgress(k);var f=[];for(var g=o.length-1;g>=0;g--){var h=o[g];var l=new c.HistoryItem();l.url=l.urlRoot+j+"/contents";l.content=h;l.source="library";f.push(l)}this.options.chain_call_control.total_number=f.length;this.chainCall(f,m)},chainCall:function(g,j){var f=this;var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets imported into history")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were imported into history.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be imported into history")}}}Galaxy.modal.hide();return}var i=$.when(h.save({content:h.content,source:h.source}));i.done(function(){f.updateProgress();f.chainCall(g,j)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCall(g,j)})},initProgress:function(f){this.progress=0;this.progressStep=f},updateProgress:function(){this.progress+=this.progressStep;$(".progress-bar-import").width(Math.round(this.progress)+"%");txt_representation=Math.round(this.progress)+"% Complete";$(".completion_span").text(txt_representation)},download:function(f,j){var h=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){h.push(this.parentElement.parentElement.id)}});var g="/api/libraries/datasets/download/"+j;var i={ldda_ids:h};this.processDownload(g,i,"get")},processDownload:function(g,h,i){if(g&&h){h=typeof h==="string"?h:$.param(h);var f="";$.each(h.split("&"),function(){var j=this.split("=");f+='<input type="hidden" name="'+j[0]+'" value="'+j[1]+'" />'});$('<form action="'+g+'" method="'+(i||"post")+'">'+f+"</form>").appendTo("body").submit().remove();e.info("Your download will begin soon")}},addFilesToFolderModal:function(){this.refreshUserHistoriesList(function(f){f.modal=Galaxy.modal;var g=f.templateAddFilesInModal();f.modal.show({closing_events:true,title:"Add datasets from history to "+f.options.folder_name,body:g({histories:f.histories.models}),buttons:{Add:function(){f.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}}});if(f.histories.models.length>0){f.fetchAndDisplayHistoryContents(f.histories.models[0].id);$("#dataset_add_bulk").change(function(h){f.fetchAndDisplayHistoryContents(h.target.value)})}else{e.error("An error ocurred :(")}})},fetchAndDisplayHistoryContents:function(h){var g=new c.HistoryContents({id:h});var f=this;g.fetch({success:function(j){var i=f.templateHistoryContents();f.histories.get(h).set({contents:j});f.modal.$el.find("#selected_history_content").html(i({history_contents:j.models.reverse()}))},error:function(){e.error("An error ocurred :(")}})},addAllDatasetsFromHistory:function(){this.modal.disableButton("Add");this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var f=[];this.modal.$el.find("#selected_history_content").find(":checked").each(function(){var i=$(this.parentElement).data("id");if(i){f.push(i)}});var l=this.options.folder_name;var k=this.templateAddingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(k({folder_name:l}));this.progressStep=100/f.length;this.progress=0;var j=[];for(var h=f.length-1;h>=0;h--){history_dataset_id=f[h];var g=new c.Item();g.url="/api/folders/"+this.options.id+"/contents";g.set({from_hda_id:history_dataset_id});j.push(g)}this.options.chain_call_control.total_number=j.length;this.chainCallAddingHdas(j)},chainCallAddingHdas:function(g){var f=this;this.added_hdas=new c.Folder();var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets from history added to the folder")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were added to the folder.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be added to the folder")}}}Galaxy.modal.hide();return this.added_hdas}var i=$.when(h.save({from_hda_id:h.get("from_hda_id")}));i.done(function(j){Galaxy.libraries.folderListView.collection.add(j);f.updateProgress();f.chainCallAddingHdas(g)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallAddingHdas(g)})},checkIncludeDeleted:function(f){if(f.target.checked){Galaxy.libraries.folderListView.fetchFolder({include_deleted:true})}else{Galaxy.libraries.folderListView.fetchFolder({include_deleted:false})}},deleteSelectedDatasets:function(){var f=$("#folder_table").find(":checked");if(f.length===0){e.info("You have to select some datasets first")}else{var j=this.templateDeletingDatasetsProgressBar();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Deleting selected datasets",body:j({}),buttons:{Close:function(){Galaxy.modal.hide()}}});this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var g=[];f.each(function(){if(this.parentElement.parentElement.id!==""){g.push(this.parentElement.parentElement.id)}});this.progressStep=100/g.length;this.progress=0;var l=[];for(var h=g.length-1;h>=0;h--){var k=new c.Item({id:g[h]});l.push(k)}this.options.chain_call_control.total_number=g.length;this.chainCallDeletingHdas(l)}},chainCallDeletingHdas:function(g){var f=this;this.deleted_lddas=new c.Folder();var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets deleted")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were deleted.")}else{if(this.options.chain_call_control.failed_number<this.options.chain_call_control.total_number){e.warning("Some of the datasets could not be deleted")}}}Galaxy.modal.hide();return this.deleted_lddas}var i=$.when(h.destroy());i.done(function(k){Galaxy.libraries.folderListView.collection.remove(h.id);f.updateProgress();if(Galaxy.libraries.folderListView.options.include_deleted){var j=new c.Item(k);Galaxy.libraries.folderListView.collection.add(j)}f.chainCallDeletingHdas(g)}).fail(function(){f.options.chain_call_control.failed_number+=1;f.updateProgress();f.chainCallDeletingHdas(g)})},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push('<div id="library_folder_toolbar">');tmpl_array.push('<span data-toggle="tooltip" data-placement="top" title="Include deleted datasets"><input id="include_deleted_datasets_chk" style="margin: 0;" type="checkbox"><span class="fa fa-trash-o fa-lg"></span></input></span>');tmpl_array.push('<div class="btn-group">');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Create New Folder" id="toolbtn_create_folder" class="btn btn-default primary-button" type="button" style="display:none;"><span class="fa fa-plus"></span><span class="fa fa-folder"></span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Add Datasets to Current Folder" id="toolbtn_add_files" class="btn btn-default toolbtn_add_files primary-button" type="button" style="display:none;"><span class="fa fa-plus"></span><span class="fa fa-file"></span></span></button>');tmpl_array.push("</div>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Import selected datasets into history" id="toolbtn_bulk_import" class="primary-button" style="margin-left: 0.5em; " type="button"><span class="fa fa-book"></span> to history</button>');tmpl_array.push(' <div id="toolbtn_dl" class="btn-group" style="margin-left: 0.5em; ">');tmpl_array.push(' <button title="Download selected datasets as archive" id="drop_toggle" type="button" class="primary-button dropdown-toggle" data-toggle="dropdown">');tmpl_array.push(' <span class="fa fa-download"></span> download <span class="caret"></span>');tmpl_array.push(" </button>");tmpl_array.push(' <ul class="dropdown-menu" role="menu">');tmpl_array.push(' <li id="download_archive"><a href="#/folders/<%= id %>/download/tgz">.tar.gz</a></li>');tmpl_array.push(' <li id="download_archive"><a href="#/folders/<%= id %>/download/tbz">.tar.bz</a></li>');tmpl_array.push(' <li id="download_archive"><a href="#/folders/<%= id %>/download/zip">.zip</a></li>');tmpl_array.push(" </ul>");tmpl_array.push(" </div>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Mark selected datasets deleted" id="toolbtn_bulk_delete" class="primary-button" style="margin-left: 0.5em; " type="button"><span class="fa fa-times"></span> delete</button>');tmpl_array.push(" </div>");tmpl_array.push(' <div id="folder_items_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewFolderInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_folder_modal">');tmpl_array.push("<form>");tmpl_array.push('<input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push('<input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push("</form>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateBulkImportInModal:function(){var f=[];f.push('<span id="history_modal_combo_bulk" style="width:90%; margin-left: 1em; margin-right: 1em; ">');f.push("Select history: ");f.push('<select id="dataset_import_bulk" name="dataset_import_bulk" style="width:50%; margin-bottom: 1em; "> ');f.push(" <% _.each(histories, function(history) { %>");f.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');f.push(" <% }); %>");f.push("</select>");f.push("</span>");return _.template(f.join(""))},templateImportIntoHistoryProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("Importing selected datasets to history <b><%= _.escape(history_name) %></b>");f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateAddingDatasetsProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("Adding selected datasets from history to library folder <b><%= _.escape(folder_name) %></b>");f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-import" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateDeletingDatasetsProgressBar:function(){var f=[];f.push('<div class="import_text">');f.push("</div>");f.push('<div class="progress">');f.push(' <div class="progress-bar progress-bar-delete" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 00%;">');f.push(' <span class="completion_span">0% Complete</span>');f.push(" </div>");f.push("</div>");f.push("");return _.template(f.join(""))},templateAddFilesInModal:function(){var f=[];f.push('<div id="add_files_modal">');f.push('<div id="history_modal_combo_bulk">');f.push("Select history: ");f.push('<select id="dataset_add_bulk" name="dataset_add_bulk" style="width:66%; "> ');f.push(" <% _.each(histories, function(history) { %>");f.push(' <option value="<%= _.escape(history.get("id")) %>"><%= _.escape(history.get("name")) %></option>');f.push(" <% }); %>");f.push("</select>");f.push("</div>");f.push('<div id="selected_history_content">');f.push("</div>");f.push("</div>");return _.template(f.join(""))},templateHistoryContents:function(){var f=[];f.push("Choose the datasets to import:");f.push("<ul>");f.push(" <% _.each(history_contents, function(history_item) { %>");f.push(' <li data-id="<%= _.escape(history_item.get("id")) %>">');f.push(' <input style="margin: 0;" type="checkbox"><%= _.escape(history_item.get("hid")) %>: <%= _.escape(history_item.get("name")) %>');f.push(" </li>");f.push(" <% }); %>");f.push("</ul>");return _.template(f.join(""))}});return{FolderToolbarView:a}});
\ No newline at end of file
diff -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb static/scripts/packed/mvc/library/library-librarylist-view.js
--- a/static/scripts/packed/mvc/library/library-librarylist-view.js
+++ b/static/scripts/packed/mvc/library/library-librarylist-view.js
@@ -1,1 +1,1 @@
-define(["galaxy.masthead","mvc/base-mvc","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-libraryrow-view"],function(b,g,d,e,c,a){var f=Backbone.View.extend({el:"#libraries_element",events:{"click .sort-libraries-link":"sort_clicked"},modal:null,collection:null,rowViews:{},initialize:function(i){this.options=_.defaults(this.options||{},i);var h=this;this.rowViews={};this.collection=new c.Libraries();this.collection.fetch({success:function(){h.render()},error:function(){e.error("An error occured. Please try again.")}})},render:function(i){var j=this.templateLibraryList();var k=null;var h=Galaxy.libraries.preferences.get("with_deleted");var l=null;if(typeof i!=="undefined"){h=typeof i.with_deleted!=="undefined"?i.with_deleted:false;l=typeof i.models!=="undefined"?i.models:null}if(this.collection!==null&&l===null){this.sortLibraries();if(h){k=this.collection.models}else{k=this.collection.where({deleted:false})}}else{if(l!==null){k=l}else{k=[]}}this.$el.html(j({length:k.length,order:Galaxy.libraries.preferences.get("sort_order")}));if(k.length>0){this.renderRows(k)}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},renderRows:function(l){for(var k=0;k<l.length;k++){var j=l[k];var h=_.findWhere(this.rowViews,{id:j.get("id")});if(h!==undefined&&this instanceof Backbone.View){h.delegateEvents();this.$el.find("#library_list_body").append(h.el)}else{this.renderOne({library:j})}}},renderOne:function(j){var i=j.library;var h=new a.LibraryRowView(i);if(j.prepend){this.$el.find("#library_list_body").prepend(h.el)}else{this.$el.find("#library_list_body").append(h.el)}this.rowViews[i.get("id")]=h},sort_clicked:function(){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){Galaxy.libraries.preferences.set({sort_order:"desc"})}else{Galaxy.libraries.preferences.set({sort_order:"asc"})}this.render()},sortLibraries:function(){if(Galaxy.libraries.preferences.get("sort_by")==="name"){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){this.collection.sortByNameAsc()}else{if(Galaxy.libraries.preferences.get("sort_order")==="desc"){this.collection.sortByNameDesc()}}}},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div class="library_container table-responsive">');tmpl_array.push("<% if(length === 0) { %>");tmpl_array.push('<div>There are no libraries visible to you. If you expected some to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity">library security wikipage</a>.</div>');tmpl_array.push("<% } else{ %>");tmpl_array.push('<table class="grid table table-condensed">');tmpl_array.push(" <thead>");tmpl_array.push(' <th style="width:30%;"><a class="sort-libraries-link" title="Click to reverse order" href="#">name</a><span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>');tmpl_array.push(' <th style="width:22%;">description</th>');tmpl_array.push(' <th style="width:22%;">synopsis</th> ');tmpl_array.push(' <th style="width:26%;"></th> ');tmpl_array.push(" </thead>");tmpl_array.push(' <tbody id="library_list_body">');tmpl_array.push(" </tbody>");tmpl_array.push("</table>");tmpl_array.push("<% }%>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},});return{LibraryListView:f}});
\ No newline at end of file
+define(["galaxy.masthead","mvc/base-mvc","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-libraryrow-view"],function(b,g,d,e,c,a){var f=Backbone.View.extend({el:"#libraries_element",events:{"click .sort-libraries-link":"sort_clicked"},modal:null,collection:null,rowViews:{},initialize:function(i){this.options=_.defaults(this.options||{},i);var h=this;this.rowViews={};this.collection=new c.Libraries();this.collection.fetch({success:function(){h.render()},error:function(k,j){if(typeof j.responseJSON!=="undefined"){e.error(j.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},render:function(i){var j=this.templateLibraryList();var k=null;var h=Galaxy.libraries.preferences.get("with_deleted");var l=null;if(typeof i!=="undefined"){h=typeof i.with_deleted!=="undefined"?i.with_deleted:false;l=typeof i.models!=="undefined"?i.models:null}if(this.collection!==null&&l===null){this.sortLibraries();if(h){k=this.collection.models}else{k=this.collection.where({deleted:false})}}else{if(l!==null){k=l}else{k=[]}}this.$el.html(j({length:k.length,order:Galaxy.libraries.preferences.get("sort_order")}));if(k.length>0){this.renderRows(k)}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},renderRows:function(l){for(var k=0;k<l.length;k++){var j=l[k];var h=_.findWhere(this.rowViews,{id:j.get("id")});if(h!==undefined&&this instanceof Backbone.View){h.delegateEvents();this.$el.find("#library_list_body").append(h.el)}else{this.renderOne({library:j})}}},renderOne:function(j){var i=j.library;var h=new a.LibraryRowView(i);if(j.prepend){this.$el.find("#library_list_body").prepend(h.el)}else{this.$el.find("#library_list_body").append(h.el)}this.rowViews[i.get("id")]=h},sort_clicked:function(){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){Galaxy.libraries.preferences.set({sort_order:"desc"})}else{Galaxy.libraries.preferences.set({sort_order:"asc"})}this.render()},sortLibraries:function(){if(Galaxy.libraries.preferences.get("sort_by")==="name"){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){this.collection.sortByNameAsc()}else{if(Galaxy.libraries.preferences.get("sort_order")==="desc"){this.collection.sortByNameDesc()}}}},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div class="library_container table-responsive">');tmpl_array.push("<% if(length === 0) { %>");tmpl_array.push('<div>There are no libraries visible to you. If you expected some to show up please consult the <a href="https://wiki.galaxyproject.org/Admin/DataLibraries/LibrarySecurity">library security wikipage</a>.</div>');tmpl_array.push("<% } else{ %>");tmpl_array.push('<table class="grid table table-condensed">');tmpl_array.push(" <thead>");tmpl_array.push(' <th style="width:30%;"><a class="sort-libraries-link" title="Click to reverse order" href="#">name</a><span title="Sorted alphabetically" class="fa fa-sort-alpha-<%- order %>"></span></th>');tmpl_array.push(' <th style="width:22%;">description</th>');tmpl_array.push(' <th style="width:22%;">synopsis</th> ');tmpl_array.push(' <th style="width:26%;"></th> ');tmpl_array.push(" </thead>");tmpl_array.push(' <tbody id="library_list_body">');tmpl_array.push(" </tbody>");tmpl_array.push("</table>");tmpl_array.push("<% }%>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},});return{LibraryListView:f}});
\ No newline at end of file
diff -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb static/scripts/packed/mvc/library/library-libraryrow-view.js
--- a/static/scripts/packed/mvc/library/library-libraryrow-view.js
+++ b/static/scripts/packed/mvc/library/library-libraryrow-view.js
@@ -1,1 +1,1 @@
-define(["galaxy.masthead","utils/utils","libs/toastr"],function(b,c,d){var a=Backbone.View.extend({events:{"click .edit_library_btn":"edit_button_clicked","click .cancel_library_btn":"cancel_library_modification","click .save_library_btn":"save_library_modification","click .delete_library_btn":"delete_library","click .undelete_library_btn":"undelete_library","click .upload_library_btn":"upload_to_library","click .permission_library_btn":"permissions_on_library"},edit_mode:false,element_visibility_config:{upload_library_btn:false,edit_library_btn:false,permission_library_btn:false,save_library_btn:false,cancel_library_btn:false,delete_library_btn:false,undelete_library_btn:false},initialize:function(e){this.render(e)},render:function(f){if(typeof f==="undefined"){f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"))}this.prepareButtons(f);var e=this.templateRow();this.setElement(e({library:f,button_config:this.element_visibility_config,edit_mode:this.edit_mode}));this.$el.show();return this},repaint:function(e){$(".tooltip").hide();var f=this.$el;this.render(e);f.replaceWith(this.$el);this.$el.find("[data-toggle]").tooltip()},prepareButtons:function(e){vis_config=this.element_visibility_config;if(this.edit_mode===false){vis_config.save_library_btn=false;vis_config.cancel_library_btn=false;vis_config.delete_library_btn=false;if(e.get("deleted")===true){vis_config.undelete_library_btn=true;vis_config.upload_library_btn=false;vis_config.edit_library_btn=false;vis_config.permission_library_btn=false}else{if(e.get("deleted")===false){vis_config.save_library_btn=false;vis_config.cancel_library_btn=false;vis_config.undelete_library_btn=false;if(e.get("can_user_add")===true){vis_config.upload_library_btn=true}if(e.get("can_user_modify")===true){vis_config.edit_library_btn=true}if(e.get("can_user_manage")===true){vis_config.permission_library_btn=true}}}}else{if(this.edit_mode===true){vis_config.upload_library_btn=false;vis_config.edit_library_btn=false;vis_config.permission_library_btn=false;vis_config.save_library_btn=true;vis_config.cancel_library_btn=true;vis_config.delete_library_btn=true}}this.element_visibility_config=vis_config},upload_to_library:function(){d.info("Coming soon. Stay tuned.")},permissions_on_library:function(){d.info("Coming soon. Stay tuned.")},edit_button_clicked:function(){this.edit_mode=true;this.repaint()},cancel_library_modification:function(){d.info("Modifications canceled");this.edit_mode=false;this.repaint()},save_library_modification:function(){var f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var g=false;var i=this.$el.find(".input_library_name").val();if(typeof i!=="undefined"&&i!==f.get("name")){if(i.length>2){f.set("name",i);g=true}else{d.warning("Library name has to be at least 3 characters long");return}}var h=this.$el.find(".input_library_description").val();if(typeof h!=="undefined"&&h!==f.get("description")){f.set("description",h);g=true}var j=this.$el.find(".input_library_synopsis").val();if(typeof j!=="undefined"&&j!==f.get("synopsis")){f.set("synopsis",j);g=true}if(g){var e=this;f.save(null,{patch:true,success:function(k){e.edit_mode=false;e.repaint(k);d.success("Changes to library saved")},error:function(){d.error("An error occured during updating the library :(")}})}else{this.edit_mode=false;this.repaint(f);d.info("Nothing has changed")}},delete_library:function(){var f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var e=this;f.destroy({success:function(g){g.set("deleted",true);Galaxy.libraries.libraryListView.collection.add(g);e.edit_mode=false;if(Galaxy.libraries.preferences.get("with_deleted")===false){$(".tooltip").hide();e.$el.remove()}else{if(Galaxy.libraries.preferences.get("with_deleted")===true){e.repaint(g)}}d.success("Library has been marked deleted")},error:function(){d.error("An error occured during deleting the library :(")}})},undelete_library:function(){var f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var e=this;f.url=f.urlRoot+f.id+"?undelete=true";f.destroy({success:function(g){g.set("deleted",false);Galaxy.libraries.libraryListView.collection.add(g);e.edit_mode=false;e.repaint(g);d.success("Library has been undeleted")},error:function(){d.error("An error occured while undeleting the library :(")}})},templateRow:function(){tmpl_array=[];tmpl_array.push(' <tr class="<% if(library.get("deleted") === true) { print("active") } %>" style="display:none;" data-id="<%- library.get("id") %>">');tmpl_array.push(" <% if(!edit_mode) { %>");tmpl_array.push(' <% if(library.get("deleted")) { %>');tmpl_array.push(' <td style="color:grey;"><span data-toggle="tooltip" data-placement="top" title="Marked deleted" style="color:grey;" class="fa fa-ban fa-lg deleted_lib_ico"></span><%- library.get("name") %></td>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <td><a href="#folders/<%- library.get("root_folder_id") %>"><%- library.get("name") %></a></td>');tmpl_array.push(" <% } %>");tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');tmpl_array.push(" <% } else if(edit_mode){ %>");tmpl_array.push(' <td><input type="text" class="form-control input_library_name" placeholder="name" value="<%- library.get("name") %>"></td>');tmpl_array.push(' <td><input type="text" class="form-control input_library_description" placeholder="description" value="<%- library.get("description") %>"></td>');tmpl_array.push(' <td><input type="text" class="form-control input_library_synopsis" placeholder="synopsis" value="<%- library.get("synopsis") %>"></td>');tmpl_array.push(" <% } %>");tmpl_array.push(' <td class="right-center">');tmpl_array.push(' <% if( (library.get("public")) && (library.get("deleted") === false) ) { %>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Public" style="color:grey;" class="fa fa-globe fa-lg public_lib_ico"></span>');tmpl_array.push(" <% }%>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Modify <%- library.get("name") %>" class="primary-button btn-xs edit_library_btn" type="button" style="<% if(button_config.edit_library_btn === false) { print("display:none;") } %>"><span class="fa fa-pencil"></span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Modify permissions" class="primary-button btn-xs permission_library_btn" type="button" style="<% if(button_config.permission_library_btn === false) { print("display:none;") } %>"><span class="fa fa-group"></span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Save changes" class="primary-button btn-xs save_library_btn" type="button" style="<% if(button_config.save_library_btn === false) { print("display:none;") } %>"><span class="fa fa-floppy-o"> Save</span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Discard changes" class="primary-button btn-xs cancel_library_btn" type="button" style="<% if(button_config.cancel_library_btn === false) { print("display:none;") } %>"><span class="fa fa-times"> Cancel</span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Delete library (can be undeleted later)" class="primary-button btn-xs delete_library_btn" type="button" style="<% if(button_config.delete_library_btn === false) { print("display:none;") } %>"><span class="fa fa-trash-o"> Delete</span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Undelete <%- library.get("name") %> " class="primary-button btn-xs undelete_library_btn" type="button" style="<% if(button_config.undelete_library_btn === false) { print("display:none;") } %>"><span class="fa fa-unlock"> Undelete</span></button>');tmpl_array.push(" </td>");tmpl_array.push(" </tr>");return _.template(tmpl_array.join(""))}});return{LibraryRowView:a}});
\ No newline at end of file
+define(["galaxy.masthead","utils/utils","libs/toastr"],function(b,c,d){var a=Backbone.View.extend({events:{"click .edit_library_btn":"edit_button_clicked","click .cancel_library_btn":"cancel_library_modification","click .save_library_btn":"save_library_modification","click .delete_library_btn":"delete_library","click .undelete_library_btn":"undelete_library","click .permission_library_btn":"permissions_on_library"},edit_mode:false,element_visibility_config:{upload_library_btn:false,edit_library_btn:false,permission_library_btn:false,save_library_btn:false,cancel_library_btn:false,delete_library_btn:false,undelete_library_btn:false},initialize:function(e){this.render(e)},render:function(f){if(typeof f==="undefined"){f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"))}this.prepareButtons(f);var e=this.templateRow();this.setElement(e({library:f,button_config:this.element_visibility_config,edit_mode:this.edit_mode}));this.$el.show();return this},repaint:function(e){$(".tooltip").hide();var f=this.$el;this.render(e);f.replaceWith(this.$el);this.$el.find("[data-toggle]").tooltip()},prepareButtons:function(e){vis_config=this.element_visibility_config;if(this.edit_mode===false){vis_config.save_library_btn=false;vis_config.cancel_library_btn=false;vis_config.delete_library_btn=false;if(e.get("deleted")===true){vis_config.undelete_library_btn=true;vis_config.upload_library_btn=false;vis_config.edit_library_btn=false;vis_config.permission_library_btn=false}else{if(e.get("deleted")===false){vis_config.save_library_btn=false;vis_config.cancel_library_btn=false;vis_config.undelete_library_btn=false;if(e.get("can_user_add")===true){vis_config.upload_library_btn=true}if(e.get("can_user_modify")===true){vis_config.edit_library_btn=true}if(e.get("can_user_manage")===true){vis_config.permission_library_btn=true}}}}else{if(this.edit_mode===true){vis_config.upload_library_btn=false;vis_config.edit_library_btn=false;vis_config.permission_library_btn=false;vis_config.save_library_btn=true;vis_config.cancel_library_btn=true;vis_config.delete_library_btn=true;vis_config.undelete_library_btn=false}}this.element_visibility_config=vis_config},permissions_on_library:function(){d.info("Coming soon. Stay tuned.")},edit_button_clicked:function(){this.edit_mode=true;this.repaint()},cancel_library_modification:function(){d.info("Modifications canceled");this.edit_mode=false;this.repaint()},save_library_modification:function(){var f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var g=false;var i=this.$el.find(".input_library_name").val();if(typeof i!=="undefined"&&i!==f.get("name")){if(i.length>2){f.set("name",i);g=true}else{d.warning("Library name has to be at least 3 characters long");return}}var h=this.$el.find(".input_library_description").val();if(typeof h!=="undefined"&&h!==f.get("description")){f.set("description",h);g=true}var j=this.$el.find(".input_library_synopsis").val();if(typeof j!=="undefined"&&j!==f.get("synopsis")){f.set("synopsis",j);g=true}if(g){var e=this;f.save(null,{patch:true,success:function(k){e.edit_mode=false;e.repaint(k);d.success("Changes to library saved")},error:function(l,k){if(typeof k.responseJSON!=="undefined"){d.error(k.responseJSON.err_msg)}else{d.error("An error occured during updating the library :(")}}})}else{this.edit_mode=false;this.repaint(f);d.info("Nothing has changed")}},delete_library:function(){var f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var e=this;f.destroy({success:function(g){g.set("deleted",true);Galaxy.libraries.libraryListView.collection.add(g);e.edit_mode=false;if(Galaxy.libraries.preferences.get("with_deleted")===false){$(".tooltip").hide();e.$el.remove()}else{if(Galaxy.libraries.preferences.get("with_deleted")===true){e.repaint(g)}}d.success("Library has been marked deleted")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg)}else{d.error("An error occured during deleting the library :(")}}})},undelete_library:function(){var f=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var e=this;f.url=f.urlRoot+f.id+"?undelete=true";f.destroy({success:function(g){g.set("deleted",false);Galaxy.libraries.libraryListView.collection.add(g);e.edit_mode=false;e.repaint(g);d.success("Library has been undeleted")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg)}else{d.error("An error occured while undeleting the library :(")}}})},templateRow:function(){tmpl_array=[];tmpl_array.push(' <tr class="<% if(library.get("deleted") === true) { print("active") } %>" style="display:none;" data-id="<%- library.get("id") %>">');tmpl_array.push(" <% if(!edit_mode) { %>");tmpl_array.push(' <% if(library.get("deleted")) { %>');tmpl_array.push(' <td style="color:grey;"><span data-toggle="tooltip" data-placement="top" title="Marked deleted" style="color:grey;" class="fa fa-ban fa-lg deleted_lib_ico"></span><%- library.get("name") %></td>');tmpl_array.push(" <% } else { %>");tmpl_array.push(' <td><a href="#folders/<%- library.get("root_folder_id") %>"><%- library.get("name") %></a></td>');tmpl_array.push(" <% } %>");tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');tmpl_array.push(" <% } else if(edit_mode){ %>");tmpl_array.push(' <td><input type="text" class="form-control input_library_name" placeholder="name" value="<%- library.get("name") %>"></td>');tmpl_array.push(' <td><input type="text" class="form-control input_library_description" placeholder="description" value="<%- library.get("description") %>"></td>');tmpl_array.push(' <td><input type="text" class="form-control input_library_synopsis" placeholder="synopsis" value="<%- library.get("synopsis") %>"></td>');tmpl_array.push(" <% } %>");tmpl_array.push(' <td class="right-center">');tmpl_array.push(' <% if( (library.get("public")) && (library.get("deleted") === false) ) { %>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Public" style="color:grey;" class="fa fa-globe fa-lg public_lib_ico"></span>');tmpl_array.push(" <% }%>");tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Modify <%- library.get("name") %>" class="primary-button btn-xs edit_library_btn" type="button" style="<% if(button_config.edit_library_btn === false) { print("display:none;") } %>"><span class="fa fa-pencil"></span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Modify permissions" class="primary-button btn-xs permission_library_btn" type="button" style="<% if(button_config.permission_library_btn === false) { print("display:none;") } %>"><span class="fa fa-group"></span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Save changes" class="primary-button btn-xs save_library_btn" type="button" style="<% if(button_config.save_library_btn === false) { print("display:none;") } %>"><span class="fa fa-floppy-o"> Save</span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Discard changes" class="primary-button btn-xs cancel_library_btn" type="button" style="<% if(button_config.cancel_library_btn === false) { print("display:none;") } %>"><span class="fa fa-times"> Cancel</span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Delete <%- library.get("name") %>" class="primary-button btn-xs delete_library_btn" type="button" style="<% if(button_config.delete_library_btn === false) { print("display:none;") } %>"><span class="fa fa-trash-o"> Delete</span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Undelete <%- library.get("name") %> " class="primary-button btn-xs undelete_library_btn" type="button" style="<% if(button_config.undelete_library_btn === false) { print("display:none;") } %>"><span class="fa fa-unlock"> Undelete</span></button>');tmpl_array.push(" </td>");tmpl_array.push(" </tr>");return _.template(tmpl_array.join(""))}});return{LibraryRowView:a}});
\ No newline at end of file
diff -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb static/scripts/packed/mvc/library/library-librarytoolbar-view.js
--- a/static/scripts/packed/mvc/library/library-librarytoolbar-view.js
+++ b/static/scripts/packed/mvc/library/library-librarytoolbar-view.js
@@ -1,1 +1,1 @@
-define(["libs/toastr","mvc/library/library-model"],function(b,a){var c=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal","click #include_deleted_chk":"check_include_deleted"},initialize:function(){this.render()},render:function(){var f=this.templateToolBar();var e=false;var d=false;if(Galaxy.currUser){e=Galaxy.currUser.isAdmin();d=Galaxy.currUser.isAnonymous()}else{d=true}this.$el.html(f({admin_user:e,anon_user:d}));if(e){this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted")}},show_library_modal:function(e){e.preventDefault();e.stopPropagation();var d=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){d.create_new_library_event()},Close:function(){d.modal.hide()}}})},create_new_library_event:function(){var f=this.serialize_new_library();if(this.validate_new_library(f)){var e=new a.Library();var d=this;e.save(f,{success:function(g){Galaxy.libraries.libraryListView.collection.add(g);d.modal.hide();d.clear_library_modal();Galaxy.libraries.libraryListView.render();b.success("Library created")},error:function(){b.error("An error occured :(")}})}else{b.error("Library's name is missing")}return false},clear_library_modal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serialize_new_library:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},validate_new_library:function(d){return d.name!==""},check_include_deleted:function(d){if(d.target.checked){Galaxy.libraries.preferences.set({with_deleted:true});Galaxy.libraries.libraryListView.render()}else{Galaxy.libraries.preferences.set({with_deleted:false});Galaxy.libraries.libraryListView.render()}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="toolbar_form" margin-top:0.5em; ">');tmpl_array.push(' <h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fol…" target="_blank">Trello</a>.</h3>');tmpl_array.push(" <% if(admin_user === true) { %>");tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Include deleted libraries"><input id="include_deleted_chk" style="margin: 0;" type="checkbox"><span class="fa fa-trash-o fa-lg"></span></input></span>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button><span>');tmpl_array.push(" </div>");tmpl_array.push(" <% } %>");tmpl_array.push(" </div>");tmpl_array.push(' <div id="libraries_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push(" <form>");tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push(" </form>");tmpl_array.push("</div>");return tmpl_array.join("")}});return{LibraryToolbarView:c}});
\ No newline at end of file
+define(["libs/toastr","mvc/library/library-model"],function(b,a){var c=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal","click #include_deleted_chk":"check_include_deleted"},initialize:function(){this.render()},render:function(){var f=this.templateToolBar();var e=false;var d=false;if(Galaxy.currUser){e=Galaxy.currUser.isAdmin();d=Galaxy.currUser.isAnonymous()}else{d=true}this.$el.html(f({admin_user:e,anon_user:d}));if(e){this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted")}},show_library_modal:function(e){e.preventDefault();e.stopPropagation();var d=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){d.create_new_library_event()},Close:function(){d.modal.hide()}}})},create_new_library_event:function(){var f=this.serialize_new_library();if(this.validate_new_library(f)){var e=new a.Library();var d=this;e.save(f,{success:function(g){Galaxy.libraries.libraryListView.collection.add(g);d.modal.hide();d.clear_library_modal();Galaxy.libraries.libraryListView.render();b.success("Library created")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){b.error(g.responseJSON.err_msg)}else{b.error("An error occured :(")}}})}else{b.error("Library's name is missing")}return false},clear_library_modal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serialize_new_library:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},validate_new_library:function(d){return d.name!==""},check_include_deleted:function(d){if(d.target.checked){Galaxy.libraries.preferences.set({with_deleted:true});Galaxy.libraries.libraryListView.render()}else{Galaxy.libraries.preferences.set({with_deleted:false});Galaxy.libraries.libraryListView.render()}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div class="library_style_container">');tmpl_array.push(' <div id="toolbar_form" margin-top:0.5em; ">');tmpl_array.push(' <h3>Data Libraries Beta Test. This is work in progress. Please report problems & ideas via <a href="mailto:galaxy-bugs@bx.psu.edu?Subject=DataLibrariesBeta_Feedback" target="_blank">email</a> and <a href="https://trello.com/c/nwYQNFPK/56-data-library-ui-progressive-display-of-fol…" target="_blank">Trello</a>.</h3>');tmpl_array.push(" <% if(admin_user === true) { %>");tmpl_array.push(' <div id="library_toolbar">');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Include deleted libraries"><input id="include_deleted_chk" style="margin: 0;" type="checkbox"><span class="fa fa-trash-o fa-lg"></span></input></span>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Create New Library"><button id="create_new_library_btn" class="primary-button btn-xs" type="button"><span class="fa fa-plus"></span> New Library</button><span>');tmpl_array.push(" </div>");tmpl_array.push(" <% } %>");tmpl_array.push(" </div>");tmpl_array.push(' <div id="libraries_element">');tmpl_array.push(" </div>");tmpl_array.push("</div>");return _.template(tmpl_array.join(""))},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('<div id="new_library_modal">');tmpl_array.push(" <form>");tmpl_array.push(' <input type="text" name="Name" value="" placeholder="Name">');tmpl_array.push(' <input type="text" name="Description" value="" placeholder="Description">');tmpl_array.push(' <input type="text" name="Synopsis" value="" placeholder="Synopsis">');tmpl_array.push(" </form>");tmpl_array.push("</div>");return tmpl_array.join("")}});return{LibraryToolbarView:c}});
\ No newline at end of file
diff -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 -r 5bdc2e6d3287848d5f42fd3009920767ba39e7fb static/scripts/packed/mvc/library/library-model.js
--- a/static/scripts/packed/mvc/library/library-model.js
+++ b/static/scripts/packed/mvc/library/library-model.js
@@ -1,1 +1,1 @@
-define([],function(){var f=Backbone.Model.extend({urlRoot:"/api/libraries/",isVisible:function(l){var k=true;if((!l)&&(this.get("deleted"))){k=false}return k}});var i=Backbone.Collection.extend({url:"/api/libraries",model:f,sort_key:"name",sort_order:null,initialize:function(k){k=k||{}},getVisible:function(l,m){m=m||[];var k=new i(this.filter(function(n){return n.isVisible(l)}));return k},sortByNameAsc:function(){this.comparator=function(l,k){if(l.get("name").toLowerCase()>k.get("name").toLowerCase()){return 1}if(k.get("name").toLowerCase()>l.get("name").toLowerCase()){return -1}return 0};this.sort();return this},sortByNameDesc:function(){this.comparator=function(l,k){if(l.get("name").toLowerCase()>k.get("name").toLowerCase()){return -1}if(k.get("name").toLowerCase()>l.get("name").toLowerCase()){return 1}return 0};this.sort();return this}});var g=Backbone.Model.extend({urlRoot:"/api/libraries/datasets"});var a=Backbone.Model.extend({urlRoot:"/api/folders"});var c=Backbone.Collection.extend({model:g,sortByNameAsc:function(){this.comparator=function(l,k){if(l.get("type")===k.get("type")){if(l.get("name").toLowerCase()>k.get("name").toLowerCase()){return 1}if(k.get("name").toLowerCase()>l.get("name").toLowerCase()){return -1}return 0}else{if(l.get("type")==="folder"){return -1}else{return 1}}};this.sort();return this},sortByNameDesc:function(){this.comparator=function(l,k){if(l.get("type")===k.get("type")){if(l.get("name").toLowerCase()>k.get("name").toLowerCase()){return -1}if(k.get("name").toLowerCase()>l.get("name").toLowerCase()){return 1}return 0}else{if(l.get("type")==="folder"){return -1}else{return 1}}};this.sort();return this}});var e=Backbone.Model.extend({defaults:{folder:new c(),urlRoot:"/api/folders/",id:"unknown"},parse:function(k){this.get("folder").reset(k.folder_contents);return k}});var b=Backbone.Model.extend({urlRoot:"/api/histories/"});var d=Backbone.Collection.extend({urlRoot:"/api/histories/",initialize:function(k){this.id=k.id},url:function(){return this.urlRoot+this.id+"/contents"},model:b});var h=Backbone.Model.extend({urlRoot:"/api/histories/"});var j=Backbone.Collection.extend({url:"/api/histories",model:h});return{Library:f,FolderAsModel:a,Libraries:i,Item:g,Folder:c,FolderContainer:e,HistoryItem:b,HistoryContents:d,GalaxyHistory:h,GalaxyHistories:j}});
\ No newline at end of file
+define([],function(){var f=Backbone.Model.extend({urlRoot:"/api/libraries/",isVisible:function(l){var k=true;if((!l)&&(this.get("deleted"))){k=false}return k}});var i=Backbone.Collection.extend({url:"/api/libraries",model:f,sort_key:"name",sort_order:null,initialize:function(k){k=k||{}},getVisible:function(l,m){m=m||[];var k=new i(this.filter(function(n){return n.isVisible(l)}));return k},sortByNameAsc:function(){this.comparator=function(l,k){if(l.get("name").toLowerCase()>k.get("name").toLowerCase()){return 1}if(k.get("name").toLowerCase()>l.get("name").toLowerCase()){return -1}return 0};this.sort();return this},sortByNameDesc:function(){this.comparator=function(l,k){if(l.get("name").toLowerCase()>k.get("name").toLowerCase()){return -1}if(k.get("name").toLowerCase()>l.get("name").toLowerCase()){return 1}return 0};this.sort();return this}});var g=Backbone.Model.extend({urlRoot:"/api/libraries/datasets/"});var a=Backbone.Model.extend({urlRoot:"/api/folders"});var c=Backbone.Collection.extend({model:g,sortByNameAsc:function(){this.comparator=function(l,k){if(l.get("type")===k.get("type")){if(l.get("name").toLowerCase()>k.get("name").toLowerCase()){return 1}if(k.get("name").toLowerCase()>l.get("name").toLowerCase()){return -1}return 0}else{if(l.get("type")==="folder"){return -1}else{return 1}}};this.sort();return this},sortByNameDesc:function(){this.comparator=function(l,k){if(l.get("type")===k.get("type")){if(l.get("name").toLowerCase()>k.get("name").toLowerCase()){return -1}if(k.get("name").toLowerCase()>l.get("name").toLowerCase()){return 1}return 0}else{if(l.get("type")==="folder"){return -1}else{return 1}}};this.sort();return this}});var e=Backbone.Model.extend({defaults:{folder:new c(),urlRoot:"/api/folders/",id:"unknown"},parse:function(k){this.get("folder").reset(k.folder_contents);return k}});var b=Backbone.Model.extend({urlRoot:"/api/histories/"});var d=Backbone.Collection.extend({urlRoot:"/api/histories/",initialize:function(k){this.id=k.id},url:function(){return this.urlRoot+this.id+"/contents"},model:b});var h=Backbone.Model.extend({urlRoot:"/api/histories/"});var j=Backbone.Collection.extend({url:"/api/histories",model:h});return{Library:f,FolderAsModel:a,Libraries:i,Item:g,Folder:c,FolderContainer:e,HistoryItem:b,HistoryContents:d,GalaxyHistory:h,GalaxyHistories:j}});
\ 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
30 Apr '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/5582e58fa7a2/
Changeset: 5582e58fa7a2
User: greg
Date: 2014-04-30 21:49:31
Summary: Enhance the tool dependency package installation framework's InstallEnvironment object to have pointers to the root installation directory of both the repository and the tool dependency package. Enhance the prepare_step()_ functions in the various tool dependency package installation classes to receive the install_environment rather than just the package install_dir. This allows these functions to substitute reserved words like $REPOSITORY_INSTALL_DIR and $INSTALL_DIR used in recipes with the values of these paths retrieved from the install_environment. These reserved words can now hopefully be safely used in any action type, including "move_file" and "move_directory".
Affected #: 5 files
diff -r c05ab2ae3a58938e07c33193a7a52a89cbd43056 -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/fabric_util.py
@@ -24,14 +24,19 @@
if int( version.split( "." )[ 0 ] ) < 1:
raise NotImplementedError( "Install Fabric version 1.0 or later." )
-def install_and_build_package( app, tool_dependency, actions_dict ):
+def get_tool_shed_repository_install_dir( app, tool_shed_repository ):
+ return os.path.abspath( tool_shed_repository.repo_files_directory( app ) )
+
+def install_and_build_package( app, tool_shed_repository, tool_dependency, actions_dict ):
"""Install a Galaxy tool dependency package either via a url or a mercurial or git clone command."""
+ tool_shed_repository_install_dir = get_tool_shed_repository_install_dir( app, tool_shed_repository )
install_dir = actions_dict[ 'install_dir' ]
package_name = actions_dict[ 'package_name' ]
actions = actions_dict.get( 'actions', None )
filtered_actions = []
env_file_builder = EnvFileBuilder( install_dir )
- install_environment = InstallEnvironment()
+ install_environment = InstallEnvironment( tool_shed_repository_install_dir=tool_shed_repository_install_dir,
+ install_dir=install_dir )
recipe_manager = RecipeManager()
if actions:
with install_environment.make_tmp_dir() as work_dir:
@@ -58,7 +63,6 @@
env_file_builder=env_file_builder,
install_environment=install_environment,
work_dir=work_dir,
- install_dir=install_dir,
current_dir=None,
initial_download=True )
else:
@@ -85,7 +89,6 @@
env_file_builder=env_file_builder,
install_environment=install_environment,
work_dir=work_dir,
- install_dir=install_dir,
current_dir=current_dir,
initial_download=False )
if tool_dependency.status in [ app.install_model.ToolDependency.installation_status.ERROR ]:
diff -r c05ab2ae3a58938e07c33193a7a52a89cbd43056 -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py
@@ -8,6 +8,7 @@
import fabric_util
import td_common_util
from tool_shed.galaxy_install.tool_dependencies.recipe.recipe_manager import EnvFileBuilder
+from tool_shed.galaxy_install.tool_dependencies.recipe.recipe_manager import InstallEnvironment
from tool_shed.galaxy_install.tool_dependencies.recipe.recipe_manager import RecipeManager
import tool_shed.util.shed_util_common as suc
from tool_shed.util import common_util
@@ -161,9 +162,6 @@
return tool_shed_repository
return None
-def get_tool_shed_repository_install_dir( app, tool_shed_repository ):
- return os.path.abspath( tool_shed_repository.repo_files_directory( app ) )
-
def get_updated_changeset_revisions_from_tool_shed( app, tool_shed_url, name, owner, changeset_revision ):
"""
Get all appropriate newer changeset revisions for the repository defined by
@@ -291,11 +289,11 @@
raise Exception( message )
return handled_tool_dependencies
-def install_and_build_package_via_fabric( app, tool_dependency, actions_dict ):
+def install_and_build_package_via_fabric( app, tool_shed_repository, tool_dependency, actions_dict ):
sa_session = app.install_model.context
try:
# There is currently only one fabric method.
- tool_dependency = fabric_util.install_and_build_package( app, tool_dependency, actions_dict )
+ tool_dependency = fabric_util.install_and_build_package( app, tool_shed_repository, tool_dependency, actions_dict )
except Exception, e:
log.exception( 'Error installing tool dependency %s version %s.', str( tool_dependency.name ), str( tool_dependency.version ) )
# Since there was an installation error, update the tool dependency status to Error. The remove_installation_path option must
@@ -369,13 +367,14 @@
can_install_tool_dependency = True
if can_install_tool_dependency:
package_install_version = package_elem.get( 'version', '1.0' )
+ status = app.install_model.ToolDependency.installation_status.INSTALLING
tool_dependency = \
tool_dependency_util.create_or_update_tool_dependency( app=app,
tool_shed_repository=tool_shed_repository,
name=package_name,
version=package_version,
type='package',
- status=app.install_model.ToolDependency.installation_status.INSTALLING,
+ status=status,
set_status=True )
# Get the information about the current platform in case the tool dependency definition includes tag sets
# for installing compiled binaries.
@@ -412,11 +411,12 @@
if binary_installed:
continue
# No platform-specific <actions> recipe has yet resulted in a successful installation.
- tool_dependency = install_via_fabric( app,
- tool_dependency,
- install_dir,
- package_name=package_name,
- actions_elem=actions_elem,
+ tool_dependency = install_via_fabric( app,
+ tool_shed_repository,
+ tool_dependency,
+ install_dir,
+ package_name=package_name,
+ actions_elem=actions_elem,
action_elem=None )
if tool_dependency.status == app.install_model.ToolDependency.installation_status.INSTALLED:
# If an <actions> tag was found that matches the current platform, and the
@@ -453,31 +453,34 @@
# tag set that defines the recipe to install and compile from source.
log.debug( 'Proceeding with install and compile recipe for tool dependency %s.' % \
str( tool_dependency.name ) )
- tool_dependency = install_via_fabric( app,
- tool_dependency,
- install_dir,
- package_name=package_name,
- actions_elem=actions_elem,
+ tool_dependency = install_via_fabric( app,
+ tool_shed_repository,
+ tool_dependency,
+ install_dir,
+ package_name=package_name,
+ actions_elem=actions_elem,
action_elem=None )
if actions_elem.tag == 'action' and tool_dependency.status != app.install_model.ToolDependency.installation_status.ERROR:
# If the tool dependency is not in an error state, perform any final actions that have been
# defined within the actions_group tag set, but outside of an <actions> tag, which defines
# the recipe for installing and compiling from source.
- tool_dependency = install_via_fabric( app,
- tool_dependency,
- install_dir,
- package_name=package_name,
- actions_elem=None,
+ tool_dependency = install_via_fabric( app,
+ tool_shed_repository,
+ tool_dependency,
+ install_dir,
+ package_name=package_name,
+ actions_elem=None,
action_elem=actions_elem )
else:
# Checks for "os" and "architecture" attributes are not made for any <actions> tag sets outside of
# an <actions_group> tag set. If the attributes are defined, they will be ignored. All <actions> tags
# outside of an <actions_group> tag set will always be processed.
- tool_dependency = install_via_fabric( app,
- tool_dependency,
- install_dir,
- package_name=package_name,
- actions_elem=actions_elems,
+ tool_dependency = install_via_fabric( app,
+ tool_shed_repository,
+ tool_dependency,
+ install_dir,
+ package_name=package_name,
+ actions_elem=actions_elems,
action_elem=None )
if tool_dependency.status != app.install_model.ToolDependency.installation_status.ERROR:
log.debug( 'Tool dependency %s version %s has been installed in %s.' % \
@@ -509,7 +512,7 @@
# print 'Installing tool dependencies via fabric script ', custom_fabfile_path
return tool_dependency
-def install_via_fabric( app, tool_dependency, install_dir, package_name=None, custom_fabfile_path=None,
+def install_via_fabric( app, tool_shed_repository, tool_dependency, install_dir, package_name=None, custom_fabfile_path=None,
actions_elem=None, action_elem=None, **kwd ):
"""
Parse a tool_dependency.xml file's <actions> tag set to gather information for installation using the
@@ -534,25 +537,28 @@
else:
elems = []
recipe_manager = RecipeManager()
+ tool_shed_repository_install_dir = fabric_util.get_tool_shed_repository_install_dir( app, tool_shed_repository )
+ install_environment = InstallEnvironment( tool_shed_repository_install_dir, install_dir )
for action_elem in elems:
# Make sure to skip all comments, since they are now included in the XML tree.
if action_elem.tag != 'action':
continue
action_dict = {}
- action_type = action_elem.get( 'type', 'shell_command' )
- action_dict = recipe_manager.prepare_step( app=app,
- tool_dependency=tool_dependency,
- action_type=action_type,
- action_elem=action_elem,
- action_dict=action_dict,
- install_dir=install_dir,
- is_binary_download=is_binary_download )
- action_tuple = ( action_type, action_dict )
- if action_type == 'set_environment':
- if action_tuple not in actions:
+ action_type = action_elem.get( 'type', None )
+ if action_type is not None:
+ action_dict = recipe_manager.prepare_step( app=app,
+ tool_dependency=tool_dependency,
+ action_type=action_type,
+ action_elem=action_elem,
+ action_dict=action_dict,
+ install_environment=install_environment,
+ is_binary_download=is_binary_download )
+ action_tuple = ( action_type, action_dict )
+ if action_type == 'set_environment':
+ if action_tuple not in actions:
+ actions.append( action_tuple )
+ else:
actions.append( action_tuple )
- else:
- actions.append( action_tuple )
if actions:
actions_dict[ 'actions' ] = actions
if custom_fabfile_path is not None:
@@ -560,7 +566,7 @@
# execute_custom_fabric_script( app, elem, custom_fabfile_path, install_dir, package_name=package_name )
raise Exception( 'Tool dependency installation using proprietary fabric scripts is not yet supported.' )
else:
- tool_dependency = install_and_build_package_via_fabric( app, tool_dependency, actions_dict )
+ tool_dependency = install_and_build_package_via_fabric( app, tool_shed_repository, tool_dependency, actions_dict )
return tool_dependency
def execute_custom_fabric_script( app, elem, custom_fabfile_path, install_dir, package_name=None, **kwd ):
@@ -622,8 +628,9 @@
def set_environment( app, elem, tool_shed_repository, attr_tups_of_dependencies_for_install ):
"""
- Create a ToolDependency to set an environment variable. This is different from the process used to set an environment variable that is associated
- with a package. An example entry in a tool_dependencies.xml file is::
+ Create a ToolDependency to set an environment variable. This is different from the process used to
+ set an environment variable that is associated with a package. An example entry in a tool_dependencies.xml
+ file is::
<set_environment version="1.0"><environment_variable name="R_SCRIPT_PATH" action="set_to">$REPOSITORY_INSTALL_DIR</environment_variable>
@@ -655,8 +662,10 @@
tool_dependency_type='set_environment',
tool_dependency_name=env_var_name,
tool_dependency_version=None )
- tool_shed_repository_install_dir = get_tool_shed_repository_install_dir( app, tool_shed_repository )
- env_var_dict = td_common_util.create_env_var_dict( env_var_elem, tool_shed_repository_install_dir=tool_shed_repository_install_dir )
+ tool_shed_repository_install_dir = fabric_util.get_tool_shed_repository_install_dir( app, tool_shed_repository )
+ env_var_dict = td_common_util.create_env_var_dict( elem=env_var_elem,
+ tool_dependency_install_dir=install_dir,
+ tool_shed_repository_install_dir=tool_shed_repository_install_dir )
if env_var_dict:
if not os.path.exists( install_dir ):
os.makedirs( install_dir )
diff -r c05ab2ae3a58938e07c33193a7a52a89cbd43056 -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 lib/tool_shed/galaxy_install/tool_dependencies/recipe/recipe_manager.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/recipe_manager.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/recipe_manager.py
@@ -153,11 +153,18 @@
"""Object describing the environment built up as part of the process of building and installing a package."""
- def __init__( self ):
+ def __init__( self, tool_shed_repository_install_dir, install_dir ):
+ """
+ The value of the received tool_shed_repository_install_dir is the root installation directory
+ of the repository containing the tool dependency, and the value of the received install_dir is
+ the root installation directory of the tool dependency.
+ """
self.env_shell_file_paths = []
+ self.install_dir = install_dir
+ self.tool_shed_repository_install_dir = tool_shed_repository_install_dir
- def __call__( self, install_dir ):
- with settings( warn_only=True, **td_common_util.get_env_var_values( install_dir ) ):
+ def __call__( self ):
+ with settings( warn_only=True, **td_common_util.get_env_var_values( self ) ):
with prefix( self.__setup_environment() ):
yield
@@ -233,12 +240,12 @@
log.debug( 'Invalid file %s specified, ignoring template_command action.' % str( env_shell_file_path ) )
return env_vars
- def handle_command( self, app, tool_dependency, install_dir, cmd, return_output=False ):
+ def handle_command( self, app, tool_dependency, cmd, return_output=False ):
"""Handle a command and log the results."""
context = app.install_model.context
command = str( cmd )
output = self.handle_complex_command( command )
- self.log_results( cmd, output, os.path.join( install_dir, td_common_util.INSTALLATION_LOG ) )
+ self.log_results( cmd, output, os.path.join( self.install_dir, td_common_util.INSTALLATION_LOG ) )
stdout = output.stdout
stderr = output.stderr
if len( stdout ) > DATABASE_MAX_STRING_SIZE:
@@ -395,7 +402,7 @@
return self.step_handlers_by_type.get( type, None )
def execute_step( self, app, tool_dependency, package_name, actions, action_type, action_dict, filtered_actions,
- env_file_builder, install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ env_file_builder, install_environment, work_dir, current_dir=None, initial_download=False ):
if actions:
step_handler = self.get_step_handler_by_type( action_type )
tool_dependency, filtered_actions, dir = step_handler.execute_step( app=app,
@@ -407,7 +414,6 @@
env_file_builder=env_file_builder,
install_environment=install_environment,
work_dir=work_dir,
- install_dir=install_dir,
current_dir=current_dir,
initial_download=initial_download )
else:
@@ -439,7 +445,7 @@
template_command=step_handler.TemplateCommand() )
return step_handlers_by_type
- def prepare_step( self, app, tool_dependency, action_type, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_type, action_elem, action_dict, install_environment, is_binary_download ):
"""
Prepare the recipe step for later execution. This generally alters the received action_dict
with new information needed during this step's execution.
@@ -450,7 +456,7 @@
tool_dependency=tool_dependency,
action_elem=action_elem,
action_dict=action_dict,
- install_dir=install_dir,
+ install_environment=install_environment,
is_binary_download=is_binary_download )
return action_dict
diff -r c05ab2ae3a58938e07c33193a7a52a89cbd43056 -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/recipe/step_handler.py
@@ -30,10 +30,10 @@
"""Abstract class that defines a standard format for handling recipe steps when installing packages."""
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
raise "Unimplemented Method"
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
raise "Unimplemented Method"
@@ -43,7 +43,7 @@
self.type = 'assert_directory_executable'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Make sure a symbolic link or directory on disk exists and is executable, but is not a file.
Since this class is not used in the initial download stage, no recipe step filtering is
@@ -63,10 +63,10 @@
remove_from_disk=False )
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# <action type="assert_executable">$INSTALL_DIR/mira/my_file</action>
if action_elem.text:
- action_dict[ 'full_path' ] = td_common_util.evaluate_template( action_elem.text, install_dir )
+ action_dict[ 'full_path' ] = td_common_util.evaluate_template( action_elem.text, install_environment )
return action_dict
@@ -76,7 +76,7 @@
self.type = 'assert_directory_exists'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Make sure a a symbolic link or directory on disk exists, but is not a file. Since this
class is not used in the initial download stage, no recipe step filtering is performed
@@ -96,10 +96,10 @@
remove_from_disk=False )
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# <action type="make_directory">$INSTALL_DIR/mira</action>
if action_elem.text:
- action_dict[ 'full_path' ] = td_common_util.evaluate_template( action_elem.text, install_dir )
+ action_dict[ 'full_path' ] = td_common_util.evaluate_template( action_elem.text, install_environment )
return action_dict
@@ -109,7 +109,7 @@
self.type = 'assert_file_executable'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Make sure a symbolic link or file on disk exists and is executable, but is not a directory.
Since this class is not used in the initial download stage, no recipe step filtering is
@@ -129,10 +129,10 @@
remove_from_disk=False )
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# <action type="assert_executable">$INSTALL_DIR/mira/my_file</action>
if action_elem.text:
- action_dict[ 'full_path' ] = td_common_util.evaluate_template( action_elem.text, install_dir )
+ action_dict[ 'full_path' ] = td_common_util.evaluate_template( action_elem.text, install_environment )
return action_dict
@@ -142,7 +142,7 @@
self.type = 'assert_file_exists'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Make sure a symbolic link or file on disk exists, but is not a directory. Since this
class is not used in the initial download stage, no recipe step filtering is performed
@@ -162,10 +162,10 @@
remove_from_disk=False )
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# <action type="assert_on_path">$INSTALL_DIR/mira/my_file</action>
if action_elem.text:
- action_dict[ 'full_path' ] = td_common_util.evaluate_template( action_elem.text, install_dir )
+ action_dict[ 'full_path' ] = td_common_util.evaluate_template( action_elem.text, install_environment )
return action_dict
@@ -175,7 +175,7 @@
self.type = 'autoconf'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Handle configure, make and make install in a shell, allowing for configuration options. Since this
class is not used in the initial download stage, no recipe step filtering is performed here, and None
@@ -187,16 +187,19 @@
pre_cmd = './configure %s && make && make install' % configure_opts
else:
pre_cmd = './configure --prefix=$INSTALL_DIR %s && make && make install' % configure_opts
- cmd = install_environment.build_command( td_common_util.evaluate_template( pre_cmd, install_dir ) )
- return_code = install_environment.handle_command( app, tool_dependency, install_dir, cmd )
+ cmd = install_environment.build_command( td_common_util.evaluate_template( pre_cmd, install_environment ) )
+ return_code = install_environment.handle_command( app=app,
+ tool_dependency=tool_dependency,
+ cmd=cmd,
+ return_output=False )
# The caller should check the status of the returned tool_dependency since this function
# does nothing with the return_code.
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# Handle configure, make and make install allow providing configuration options
if action_elem.text:
- configure_opts = td_common_util.evaluate_template( action_elem.text, install_dir )
+ configure_opts = td_common_util.evaluate_template( action_elem.text, install_environment )
action_dict[ 'configure_opts' ] = configure_opts
return action_dict
@@ -207,7 +210,7 @@
self.type = 'change_directory'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Change the working directory in a shell. Since this class is not used in the initial download stage,
no recipe step filtering is performed here and a None value is return for filtered_actions. However,
@@ -225,7 +228,7 @@
dir = current_dir
return tool_dependency, None, dir
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# <action type="change_directory">PHYLIP-3.6b</action>
if action_elem.text:
action_dict[ 'directory' ] = action_elem.text
@@ -238,7 +241,7 @@
self.type = 'chmod'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Change the mode setting for certain files in the installation environment. Since this class is not
used in the initial download stage, no recipe step filtering is performed here, and None values are
@@ -251,7 +254,7 @@
log.debug( 'Invalid file %s specified, ignoring %s action.', target_file, action_type )
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# Change the read, write, and execute bits on a file.
# <action type="chmod">
# <file mode="750">$INSTALL_DIR/bin/faToTwoBit</file>
@@ -271,7 +274,7 @@
received_mode = int( file_elem.get( 'mode', 600 ), base=8 )
# For added security, ensure that the setuid and setgid bits are not set.
mode = received_mode & ~( stat.S_ISUID | stat.S_ISGID )
- file = td_common_util.evaluate_template( file_elem.text, install_dir )
+ file = td_common_util.evaluate_template( file_elem.text, install_environment )
chmod_tuple = ( file, mode )
chmod_actions.append( chmod_tuple )
if chmod_actions:
@@ -294,7 +297,7 @@
return filtered_actions
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Download a binary file. If the value of initial_download is True, the recipe steps will be
filtered and returned and the installation directory (i.e., dir) will be defined and returned.
@@ -326,14 +329,15 @@
# any errors in the move step are correctly sent to the tool dependency error handler.
if downloaded_filename and os.path.exists( os.path.join( work_dir, downloaded_filename ) ):
if target_directory:
- target_directory = os.path.realpath( os.path.normpath( os.path.join( install_dir, target_directory ) ) )
+ target_directory = os.path.realpath( os.path.normpath( os.path.join( install_environment.install_dir,
+ target_directory ) ) )
# Make sure the target directory is not outside of $INSTALL_DIR.
- if target_directory.startswith( os.path.realpath( install_dir ) ):
- full_path_to_dir = os.path.abspath( os.path.join( install_dir, target_directory ) )
+ if target_directory.startswith( os.path.realpath( install_environment.install_dir ) ):
+ full_path_to_dir = os.path.abspath( os.path.join( install_environment.install_dir, target_directory ) )
else:
- full_path_to_dir = os.path.abspath( install_dir )
+ full_path_to_dir = os.path.abspath( install_environment.install_dir )
else:
- full_path_to_dir = os.path.abspath( install_dir )
+ full_path_to_dir = os.path.abspath( install_environment.install_dir )
td_common_util.move_file( current_dir=work_dir,
source=downloaded_filename,
destination=full_path_to_dir )
@@ -343,7 +347,7 @@
return tool_dependency, filtered_actions, dir
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
platform_info_dict = tool_dependency_util.get_platform_info_dict()
platform_info_dict[ 'name' ] = str( tool_dependency.name )
platform_info_dict[ 'version' ] = str( tool_dependency.version )
@@ -370,7 +374,7 @@
self.type = 'download_by_url'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Download a file via HTTP. If the value of initial_download is True, the recipe steps will be
filtered and returned and the installation directory (i.e., dir) will be defined and returned.
@@ -392,7 +396,7 @@
downloaded_filename = os.path.split( url )[ -1 ]
dir = td_common_util.url_download( work_dir, downloaded_filename, url, extract=True )
if is_binary:
- log_file = os.path.join( install_dir, td_common_util.INSTALLATION_LOG )
+ log_file = os.path.join( install_environment.install_dir, td_common_util.INSTALLATION_LOG )
if os.path.exists( log_file ):
logfile = open( log_file, 'ab' )
else:
@@ -404,7 +408,7 @@
return tool_dependency, filtered_actions, dir
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# <action type="download_by_url">
# http://sourceforge.net/projects/samtools/files/samtools/0.1.18/samtools-0.1…
# </action>
@@ -424,7 +428,7 @@
self.type = 'download_file'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Download a file. If the value of initial_download is True, the recipe steps will be
filtered and returned and the installation directory (i.e., dir) will be defined and returned.
@@ -449,7 +453,7 @@
return tool_dependency, filtered_actions, dir
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# <action type="download_file">http://effectors.org/download/version/TTSS_GUI-1.0.1.jar</action>
if action_elem.text:
action_dict[ 'url' ] = action_elem.text
@@ -466,7 +470,7 @@
self.type = 'make_directory'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Make a directory on disk. Since this class is not used in the initial download stage, no recipe step
filtering is performed here, and None values are always returned for filtered_actions and dir.
@@ -478,10 +482,10 @@
td_common_util.make_directory( full_path=full_path )
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# <action type="make_directory">$INSTALL_DIR/lib/python</action>
if action_elem.text:
- action_dict[ 'full_path' ] = td_common_util.evaluate_template( action_elem.text, install_dir )
+ action_dict[ 'full_path' ] = td_common_util.evaluate_template( action_elem.text, install_environment )
return action_dict
@@ -491,7 +495,7 @@
self.type = 'make_install'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Execute a make_install command in a shell. Since this class is not used in the initial download stage,
no recipe step filtering is performed here, and None values are always returned for filtered_actions and dir.
@@ -500,15 +504,18 @@
with settings( warn_only=True ):
make_opts = action_dict.get( 'make_opts', '' )
cmd = install_environment.build_command( 'make %s && make install' % make_opts )
- return_code = install_environment.handle_command( app, tool_dependency, install_dir, cmd )
+ return_code = install_environment.handle_command( app=app,
+ tool_dependency=tool_dependency,
+ cmd=cmd,
+ return_output=False )
# The caller should check the status of the returned tool_dependency since this function
# does nothing with the return_code.
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# make; make install; allow providing make options
if action_elem.text:
- make_opts = td_common_util.evaluate_template( action_elem.text, install_dir )
+ make_opts = td_common_util.evaluate_template( action_elem.text, install_environment )
action_dict[ 'make_opts' ] = make_opts
return action_dict
@@ -519,7 +526,7 @@
self.type = 'move_directory_files'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Move a directory of files. Since this class is not used in the initial download stage, no recipe step
filtering is performed here, and None values are always returned for filtered_actions and dir.
@@ -529,13 +536,13 @@
destination_dir=os.path.join( action_dict[ 'destination_directory' ] ) )
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# <action type="move_directory_files">
# <source_directory>bin</source_directory>
# <destination_directory>$INSTALL_DIR/bin</destination_directory>
# </action>
for move_elem in action_elem:
- move_elem_text = td_common_util.evaluate_template( move_elem.text, install_dir )
+ move_elem_text = td_common_util.evaluate_template( move_elem.text, install_environment )
if move_elem_text:
action_dict[ move_elem.tag ] = move_elem_text
return action_dict
@@ -547,7 +554,7 @@
self.type = 'move_file'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Move a file on disk. Since this class is not used in the initial download stage, no recipe step
filtering is performed here, and None values are always returned for filtered_actions and dir.
@@ -558,13 +565,13 @@
rename_to=action_dict[ 'rename_to' ] )
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# <action type="move_file" rename_to="new_file_name">
# <source>misc/some_file</source>
# <destination>$INSTALL_DIR/bin</destination>
# </action>
- action_dict[ 'source' ] = td_common_util.evaluate_template( action_elem.find( 'source' ).text, install_dir )
- action_dict[ 'destination' ] = td_common_util.evaluate_template( action_elem.find( 'destination' ).text, install_dir )
+ action_dict[ 'source' ] = td_common_util.evaluate_template( action_elem.find( 'source' ).text, install_environment )
+ action_dict[ 'destination' ] = td_common_util.evaluate_template( action_elem.find( 'destination' ).text, install_environment )
action_dict[ 'rename_to' ] = action_elem.get( 'rename_to' )
return action_dict
@@ -575,7 +582,7 @@
self.type = 'set_environment'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Configure an install environment. Since this class is not used in the initial download stage,
no recipe step filtering is performed here, and None values are always returned for filtered_actions
@@ -583,13 +590,12 @@
"""
# Currently the only action supported in this category is "environment_variable".
cmds = install_environment.environment_commands( 'set_environment' )
- env_var_dicts = action_dict[ 'environment_variable' ]
+ env_var_dicts = action_dict.get( 'environment_variable', [] )
for env_var_dict in env_var_dicts:
# Check for the presence of the $ENV[] key string and populate it if possible.
env_var_dict = self.handle_environment_variables( app=app,
install_environment=install_environment,
tool_dependency=tool_dependency,
- install_dir=install_dir,
env_var_dict=env_var_dict,
set_prior_environment_commands=cmds )
env_file_builder.append_line( **env_var_dict )
@@ -598,7 +604,7 @@
return_code = env_file_builder.return_code
return tool_dependency, None, None
- def handle_environment_variables( self, app, install_environment, tool_dependency, install_dir, env_var_dict,
+ def handle_environment_variables( self, app, install_environment, tool_dependency, env_var_dict,
set_prior_environment_commands ):
"""
This method works with with a combination of three tool dependency definition tag sets, which are defined
@@ -681,7 +687,10 @@
set_prior_environment_commands.append( 'echo %s: $%s' % ( inherited_env_var_name, inherited_env_var_name ) )
command = ' ; '.join( set_prior_environment_commands )
# Run the command and capture the output.
- command_return = install_environment.handle_command( app, tool_dependency, install_dir, command, return_output=True )
+ command_return = install_environment.handle_command( app=app,
+ tool_dependency=tool_dependency,
+ cmd=command,
+ return_output=True )
# And extract anything labeled with the name of the environment variable we're populating here.
if '%s: ' % inherited_env_var_name in command_return:
environment_variable_value = command_return.split( '\n' )
@@ -697,7 +706,7 @@
env_var_dict[ 'value' ] = env_var_value
return env_var_dict
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# <action type="set_environment">
# <environment_variable name="PYTHONPATH" action="append_to">$INSTALL_DIR/lib/python</environment_variable>
# <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR/bin</environment_variable>
@@ -705,7 +714,10 @@
env_var_dicts = []
for env_elem in action_elem:
if env_elem.tag == 'environment_variable':
- env_var_dict = td_common_util.create_env_var_dict( env_elem, tool_dependency_install_dir=install_dir )
+ env_var_dict = \
+ td_common_util.create_env_var_dict( elem=env_elem,
+ tool_dependency_install_dir=install_environment.install_dir,
+ tool_shed_repository_install_dir=install_environment.tool_shed_repository_install_dir )
if env_var_dict:
env_var_dicts.append( env_var_dict )
if env_var_dicts:
@@ -720,7 +732,7 @@
self.type = 'set_environment_for_install'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Configure an environment for compiling a package. Since this class is not used in the initial
download stage, no recipe step filtering is performed here, and None values are always returned
@@ -730,10 +742,11 @@
# dependency env.sh files, the environment setting in each of which will be injected into the
# environment for all <action type="shell_command"> tags that follow this
# <action type="set_environment_for_install"> tag set in the tool_dependencies.xml file.
- install_environment.add_env_shell_file_paths( action_dict[ 'env_shell_file_paths' ] )
+ env_shell_file_paths = action_dict.get( 'env_shell_file_paths', [] )
+ install_environment.add_env_shell_file_paths( env_shell_file_paths )
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# <action type="set_environment_for_install">
# <repository toolshed="http://localhost:9009/" name="package_numpy_1_7" owner="test" changeset_revision="c84c6a8be056">
# <package name="numpy" version="1.7.1" />
@@ -751,8 +764,7 @@
env_shell_file_paths = td_common_util.get_env_shell_file_paths( app, env_elem )
if env_shell_file_paths:
all_env_shell_file_paths.extend( env_shell_file_paths )
- if all_env_shell_file_paths:
- action_dict[ 'env_shell_file_paths' ] = all_env_shell_file_paths
+ action_dict[ 'env_shell_file_paths' ] = all_env_shell_file_paths
return action_dict
@@ -762,7 +774,7 @@
self.type = 'setup_purl_environment'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Initialize the environment for installing Perl packages. The class is called during the initial
download stage when installing packages, so the value of initial_download will generally be True.
@@ -819,8 +831,11 @@
return tool_dependency, filtered_actions, dir
return tool_dependency, None, None
with lcd( tmp_work_dir ):
- cmd = install_environment.build_command( td_common_util.evaluate_template( cmd, install_dir ) )
- return_code = install_environment.handle_command( app, tool_dependency, install_dir, cmd )
+ cmd = install_environment.build_command( td_common_util.evaluate_template( cmd, install_environment ) )
+ return_code = install_environment.handle_command( app=app,
+ tool_dependency=tool_dependency,
+ cmd=cmd,
+ return_output=False )
if return_code:
if initial_download:
return tool_dependency, filtered_actions, dir
@@ -829,8 +844,11 @@
# perl package from CPAN without version number.
# cpanm should be installed with the parent perl distribution, otherwise this will not work.
cmd += '''cpanm --local-lib=$INSTALL_DIR %s''' % ( perl_package )
- cmd = install_environment.build_command( td_common_util.evaluate_template( cmd, install_dir ) )
- return_code = install_environment.handle_command( app, tool_dependency, install_dir, cmd )
+ cmd = install_environment.build_command( td_common_util.evaluate_template( cmd, install_environment ) )
+ return_code = install_environment.handle_command( app=app,
+ tool_dependency=tool_dependency,
+ cmd=cmd,
+ return_output=False )
if return_code:
if initial_download:
return tool_dependency, filtered_actions, dir
@@ -838,8 +856,12 @@
# Pull in perl dependencies (runtime).
env_file_builder.handle_action_shell_file_paths( env_file_builder, action_dict )
# Recursively add dependent PERL5LIB and PATH to env.sh & anything else needed.
- env_file_builder.append_line( name="PERL5LIB", action="prepend_to", value=os.path.join( install_dir, 'lib', 'perl5' ) )
- env_file_builder.append_line( name="PATH", action="prepend_to", value=os.path.join( install_dir, 'bin' ) )
+ env_file_builder.append_line( name="PERL5LIB",
+ action="prepend_to",
+ value=os.path.join( install_environment.install_dir, 'lib', 'perl5' ) )
+ env_file_builder.append_line( name="PATH",
+ action="prepend_to",
+ value=os.path.join( install_environment.install_dir, 'bin' ) )
return_code = env_file_builder.return_code
if return_code:
if initial_download:
@@ -849,7 +871,7 @@
return tool_dependency, filtered_actions, dir
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# setup a Perl environment.
# <action type="setup_perl_environment">
# <repository name="package_perl_5_18" owner="bgruening">
@@ -887,7 +909,7 @@
self.type = 'setup_r_environment'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Initialize the environment for installing R packages. The class is called during the initial
download stage when installing packages, so the value of initial_download will generally be True.
@@ -931,8 +953,11 @@
cmd = r'''PATH=$PATH:$R_HOME/bin; export PATH; R_LIBS=$INSTALL_DIR; export R_LIBS;
Rscript -e "install.packages(c('%s'),lib='$INSTALL_DIR', repos=NULL, dependencies=FALSE)"''' % \
( str( tarball_name ) )
- cmd = install_environment.build_command( td_common_util.evaluate_template( cmd, install_dir ) )
- return_code = install_environment.handle_command( app, tool_dependency, install_dir, cmd )
+ cmd = install_environment.build_command( td_common_util.evaluate_template( cmd, install_environment ) )
+ return_code = install_environment.handle_command( app=app,
+ tool_dependency=tool_dependency,
+ cmd=cmd,
+ return_output=False )
if return_code:
if initial_download:
return tool_dependency, filtered_actions, dir
@@ -940,7 +965,7 @@
# R libraries are installed to $INSTALL_DIR (install_dir), we now set the R_LIBS path to that directory
# Pull in R environment (runtime).
env_file_builder.handle_action_shell_file_paths( action_dict )
- env_file_builder.append_line( name="R_LIBS", action="prepend_to", value=install_dir )
+ env_file_builder.append_line( name="R_LIBS", action="prepend_to", value=install_environment.install_dir )
return_code = env_file_builder.return_code
if return_code:
if initial_download:
@@ -950,7 +975,7 @@
return tool_dependency, filtered_actions, dir
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# setup an R environment.
# <action type="setup_r_environment">
# <repository name="package_r_3_0_1" owner="bgruening">
@@ -982,7 +1007,7 @@
self.type = 'setup_ruby_environment'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Initialize the environment for installing Ruby packages. The class is called during the initial
download stage when installing packages, so the value of initial_download will generally be True.
@@ -1043,16 +1068,23 @@
# no version number given
cmd = '''PATH=$PATH:$RUBY_HOME/bin; export PATH; GEM_HOME=$INSTALL_DIR; export GEM_HOME;
gem install %s''' % ( gem )
- cmd = install_environment.build_command( td_common_util.evaluate_template( cmd, install_dir ) )
- return_code = install_environment.handle_command( app, tool_dependency, install_dir, cmd )
+ cmd = install_environment.build_command( td_common_util.evaluate_template( cmd, install_environment ) )
+ return_code = install_environment.handle_command( app=app,
+ tool_dependency=tool_dependency,
+ cmd=cmd,
+ return_output=False )
if return_code:
if initial_download:
return tool_dependency, filtered_actions, dir
return tool_dependency, None, None
# Pull in ruby dependencies (runtime).
env_file_builder.handle_action_shell_file_paths( env_file_builder, action_dict )
- env_file_builder.append_line( name="GEM_PATH", action="prepend_to", value=install_dir )
- env_file_builder.append_line( name="PATH", action="prepend_to", value=os.path.join(install_dir, 'bin') )
+ env_file_builder.append_line( name="GEM_PATH",
+ action="prepend_to",
+ value=install_environment.install_dir )
+ env_file_builder.append_line( name="PATH",
+ action="prepend_to",
+ value=os.path.join( install_environment.install_dir, 'bin' ) )
return_code = env_file_builder.return_code
if return_code:
if initial_download:
@@ -1062,7 +1094,7 @@
return tool_dependency, filtered_actions, dir
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# setup a Ruby environment.
# <action type="setup_ruby_environment">
# <repository name="package_ruby_2_0" owner="bgruening">
@@ -1109,7 +1141,7 @@
self.type = 'setup_virtualenv'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Initialize a virtual environment for installing packages. If initial_download is True, the recipe
steps will be filtered and returned and the installation directory (i.e., dir) will be defined and
@@ -1124,15 +1156,15 @@
log.debug( 'Unable to install virtualenv' )
return tool_dependency, None, None
requirements = action_dict[ 'requirements' ]
- if os.path.exists( os.path.join( install_dir, requirements ) ):
+ if os.path.exists( os.path.join( install_environment.install_dir, requirements ) ):
# requirements specified as path to a file
requirements_path = requirements
else:
# requirements specified directly in XML, create a file with these for pip.
- requirements_path = os.path.join( install_dir, "requirements.txt" )
+ requirements_path = os.path.join( install_environment.install_dir, "requirements.txt" )
with open( requirements_path, "w" ) as f:
f.write( requirements )
- venv_directory = os.path.join( install_dir, "venv" )
+ venv_directory = os.path.join( install_environment.install_dir, "venv" )
python_cmd = action_dict[ 'python' ]
# TODO: Consider making --no-site-packages optional.
setup_command = "%s %s/virtualenv.py --no-site-packages '%s'" % ( python_cmd, venv_src_directory, venv_directory )
@@ -1140,7 +1172,10 @@
# and well defined behavior in bash/zsh.
activate_command = "POSIXLY_CORRECT=1; . %s" % os.path.join( venv_directory, "bin", "activate" )
if action_dict[ 'use_requirements_file' ]:
- install_command = "python '%s' install -r '%s' --log '%s'" % ( os.path.join( venv_directory, "bin", "pip" ), requirements_path, os.path.join( install_dir, 'pip_install.log' ) )
+ install_command = "python '%s' install -r '%s' --log '%s'" % \
+ ( os.path.join( venv_directory, "bin", "pip" ),
+ requirements_path,
+ os.path.join( install_environment.install_dir, 'pip_install.log' ) )
else:
install_command = ''
with open( requirements_path, "rb" ) as f:
@@ -1150,18 +1185,29 @@
break
line = line.strip()
if line:
- line_install_command = "python '%s' install %s --log '%s'" % ( os.path.join( venv_directory, "bin", "pip" ), line, os.path.join( install_dir, 'pip_install_%s.log' % ( line ) ) )
+ line_install_command = "python '%s' install %s --log '%s'" % \
+ ( os.path.join( venv_directory, "bin", "pip" ),
+ line,
+ os.path.join( install_environment.install_dir, 'pip_install_%s.log' % ( line ) ) )
if not install_command:
install_command = line_install_command
else:
install_command = "%s && %s" % ( install_command, line_install_command )
full_setup_command = "%s; %s; %s" % ( setup_command, activate_command, install_command )
- return_code = install_environment.handle_command( app, tool_dependency, install_dir, full_setup_command )
+ return_code = install_environment.handle_command( app=app,
+ tool_dependency=tool_dependency,
+ cmd=full_setup_command,
+ return_output=False )
if return_code:
log.error( "Failed to do setup_virtualenv install, exit code='%s'", return_code )
# would it be better to try to set env variables anway, instead of returning here?
return tool_dependency, None, None
- site_packages_directory, site_packages_directory_list = self.__get_site_packages_directory( install_environment, app, tool_dependency, install_dir, python_cmd, venv_directory )
+ site_packages_directory, site_packages_directory_list = \
+ self.__get_site_packages_directory( install_environment,
+ app,
+ tool_dependency,
+ python_cmd,
+ venv_directory )
env_file_builder.append_line( name="PATH", action="prepend_to", value=os.path.join( venv_directory, "bin" ) )
if site_packages_directory is None:
log.error( "virtualenv's site-packages directory '%s' does not exist", site_packages_directory_list )
@@ -1185,7 +1231,7 @@
shutil.move( full_path_to_dir, venv_dir )
return True
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# <action type="setup_virtualenv" />
## Install requirements from file requirements.txt of downloaded bundle - or -
# <action type="setup_virtualenv">tools/requirements.txt</action>
@@ -1194,11 +1240,11 @@
# lxml==2.3.0</action>
## Manually specify contents of requirements.txt file to create dynamically.
action_dict[ 'use_requirements_file' ] = asbool( action_elem.get( 'use_requirements_file', True ) )
- action_dict[ 'requirements' ] = td_common_util.evaluate_template( action_elem.text or 'requirements.txt', install_dir )
+ action_dict[ 'requirements' ] = td_common_util.evaluate_template( action_elem.text or 'requirements.txt', install_environment )
action_dict[ 'python' ] = action_elem.get( 'python', 'python' )
return action_dict
- def __get_site_packages_directory( self, install_environment, app, tool_dependency, install_dir, python_cmd, venv_directory ):
+ def __get_site_packages_directory( self, install_environment, app, tool_dependency, python_cmd, venv_directory ):
lib_dir = os.path.join( venv_directory, "lib" )
rval = os.path.join( lib_dir, python_cmd, 'site-packages' )
site_packages_directory_list = [ rval ]
@@ -1220,7 +1266,10 @@
os.path.join( venv_directory, "bin", "python" ),
r"""%s -c 'import os, sys; print os.path.join( sys.prefix, "lib", "python" + sys.version[:3], "site-packages" )'""" % \
os.path.join( venv_directory, "bin", "python" ) ]:
- output = install_environment.handle_command( app, tool_dependency, install_dir, site_packages_command, return_output=True )
+ output = install_environment.handle_command( app=app,
+ tool_dependency=tool_dependency,
+ cmd=site_packages_command,
+ return_output=True )
site_packages_directory_list.append( output.stdout )
if not output.return_code and os.path.exists( output.stdout ):
return ( output.stdout, site_packages_directory_list )
@@ -1232,7 +1281,7 @@
self.type = 'shell_command'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Execute a command in a shell. If the value of initial_download is True, the recipe steps will
be filtered and returned and the installation directory (i.e., dir) will be defined and returned.
@@ -1252,14 +1301,17 @@
with settings( warn_only=True ):
# The caller should check the status of the returned tool_dependency since this function
# does nothing with return_code.
- return_code = install_environment.handle_command( app, tool_dependency, install_dir, cmd )
+ return_code = install_environment.handle_command( app=app,
+ tool_dependency=tool_dependency,
+ cmd=cmd,
+ return_output=False )
if initial_download:
return tool_dependency, filtered_actions, dir
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# <action type="shell_command">make</action>
- action_elem_text = td_common_util.evaluate_template( action_elem.text, install_dir )
+ action_elem_text = td_common_util.evaluate_template( action_elem.text, install_environment )
if action_elem_text:
action_dict[ 'command' ] = action_elem_text
return action_dict
@@ -1271,7 +1323,7 @@
self.type = 'template_command'
def execute_step( self, app, tool_dependency, package_name, actions, action_dict, filtered_actions, env_file_builder,
- install_environment, work_dir, install_dir, current_dir=None, initial_download=False ):
+ install_environment, work_dir, current_dir=None, initial_download=False ):
"""
Execute a template command in a shell. If the value of initial_download is True, the recipe steps
will be filtered and returned and the installation directory (i.e., dir) will be defined and returned.
@@ -1280,7 +1332,8 @@
"""
env_vars = dict()
env_vars = install_environment.environment_dict()
- env_vars.update( td_common_util.get_env_var_values( install_dir ) )
+ tool_shed_repository = tool_depenedncy.tool_shed_repository
+ env_vars.update( td_common_util.get_env_var_values( install_environment ) )
language = action_dict[ 'language' ]
with settings( warn_only=True, **env_vars ):
if language == 'cheetah':
@@ -1288,10 +1341,13 @@
cmd = fill_template( '#from fabric.api import env\n%s' % action_dict[ 'command' ], context=env_vars )
# The caller should check the status of the returned tool_dependency since this function
# does nothing with return_code.
- return_code = install_environment.handle_command( app, tool_dependency, install_dir, cmd )
+ return_code = install_environment.handle_command( app=app,
+ tool_dependency=tool_dependency,
+ cmd=cmd,
+ return_output=False )
return tool_dependency, None, None
- def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_dir, is_binary_download ):
+ def prepare_step( self, app, tool_dependency, action_elem, action_dict, install_environment, is_binary_download ):
# Default to Cheetah as it's the first template language supported.
language = action_elem.get( 'language', 'cheetah' ).lower()
if language == 'cheetah':
diff -r c05ab2ae3a58938e07c33193a7a52a89cbd43056 -r 5582e58fa7a27364f25cd66f54f373ed2e108a11 lib/tool_shed/galaxy_install/tool_dependencies/td_common_util.py
--- a/lib/tool_shed/galaxy_install/tool_dependencies/td_common_util.py
+++ b/lib/tool_shed/galaxy_install/tool_dependencies/td_common_util.py
@@ -187,9 +187,10 @@
env_var_text = elem.text.replace( '$INSTALL_DIR', tool_shed_repository_install_dir )
return dict( name=env_var_name, action=env_var_action, value=env_var_text )
if elem.text:
- # Allow for environment variables that contain neither REPOSITORY_INSTALL_DIR nor INSTALL_DIR since there may be command line
- # parameters that are tuned for a Galaxy instance. Allowing them to be set in one location rather than being hard coded into
- # each tool config is the best approach. For example:
+ # Allow for environment variables that contain neither REPOSITORY_INSTALL_DIR nor INSTALL_DIR
+ # since there may be command line parameters that are tuned for a Galaxy instance. Allowing them
+ # to be set in one location rather than being hard coded into each tool config is the best approach.
+ # For example:
# <environment_variable name="GATK2_SITE_OPTIONS" action="set_to">
# "--num_threads 4 --num_cpu_threads_per_data_thread 3 --phone_home STANDARD"
# </environment_variable>
@@ -213,9 +214,14 @@
regex = regex.replace( r"\'", "'" )
return regex
-def evaluate_template( text, install_dir ):
- """ Substitute variables defined in XML blocks from dependencies file."""
- return Template( text ).safe_substitute( get_env_var_values( install_dir ) )
+def evaluate_template( text, install_environment ):
+ """
+ Substitute variables defined in XML blocks from dependencies file. The value of the received
+ repository_install_dir is the root installation directory of the repository that contains the
+ tool dependency. The value of the received install_dir is the root installation directory of
+ the tool_dependency.
+ """
+ return Template( text ).safe_substitute( get_env_var_values( install_environment ) )
def format_traceback():
ex_type, ex, tb = sys.exc_info()
@@ -320,10 +326,18 @@
action_dict[ 'action_shell_file_paths' ] = env_shell_file_paths
return action_dict
-def get_env_var_values( install_dir ):
+def get_env_var_values( install_environment ):
+ """
+ Return a dictionary of values, some of which enable substitution of reserved words for the values.
+ The received install_enviroment object has 2 important attributes for reserved word substitution:
+ install_environment.tool_shed_repository_install_dir is the root installation directory of the repository
+ that contains the tool dependency being installed, and install_environment.install_dir is the root
+ installation directory of the tool dependency.
+ """
env_var_dict = {}
- env_var_dict[ 'INSTALL_DIR' ] = install_dir
- env_var_dict[ 'system_install' ] = install_dir
+ env_var_dict[ 'REPOSITORY_INSTALL_DIR' ] = install_environment.tool_shed_repository_install_dir
+ env_var_dict[ 'INSTALL_DIR' ] = install_environment.install_dir
+ env_var_dict[ 'system_install' ] = install_environment.install_dir
# If the Python interpreter is 64bit then we can safely assume that the underlying system is also 64bit.
env_var_dict[ '__is64bit__' ] = sys.maxsize > 2**32
return env_var_dict
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0