galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
April 2014
- 1 participants
- 261 discussions
commit/galaxy-central: greg: Upon import, handle problematic prior_installation_required attribute incorrectly added (and set to "False") to the <repository> tag when a repository was exported.
by commits-noreply@bitbucket.org 03 Apr '14
by commits-noreply@bitbucket.org 03 Apr '14
03 Apr '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/59bd7349a128/
Changeset: 59bd7349a128
User: greg
Date: 2014-04-03 16:19:46
Summary: Upon import, handle problematic prior_installation_required attribute incorrectly added (and set to "False") to the <repository> tag when a repository was exported.
Affected #: 1 file
diff -r 6b7678540ee434a7a305cf43d1a663c8f2fde30c -r 59bd7349a128f06de64f6656f553887b09f18ea2 lib/tool_shed/util/commit_util.py
--- a/lib/tool_shed/util/commit_util.py
+++ b/lib/tool_shed/util/commit_util.py
@@ -292,6 +292,12 @@
revised = False
toolshed = elem.get( 'toolshed' )
changeset_revision = elem.get( 'changeset_revision' )
+ # Over a short period of time a bug existed which caused the prior_installation_required attribute
+ # to be set to False and included in the <repository> tag when a repository was exported along with
+ # its dependencies. The following will eliminate this problematic attribute upon import.
+ prior_installation_required = elem.get( 'prior_installation_required' )
+ if prior_installation_required is not None and not asbool( prior_installation_required ):
+ del elem.attrib[ 'prior_installation_required' ]
sub_elems = [ child_elem for child_elem in list( elem ) ]
if len( sub_elems ) > 0:
# At this point, a <repository> tag will point only to a package.
@@ -310,7 +316,8 @@
# Set to None.
sub_elements = None
if unpopulate:
- # We're exporting the repository, so eliminate all toolshed and changeset_revision attributes from the <repository> tag.
+ # We're exporting the repository, so eliminate all toolshed and changeset_revision attributes from the
+ # <repository> tag.
if toolshed or changeset_revision:
attributes = odict()
attributes[ 'name' ] = name
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: davebgx: Use correct revisions of best_regression_subsets and weightedaverage.
by commits-noreply@bitbucket.org 03 Apr '14
by commits-noreply@bitbucket.org 03 Apr '14
03 Apr '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/6b7678540ee4/
Changeset: 6b7678540ee4
User: davebgx
Date: 2014-04-03 15:45:51
Summary: Use correct revisions of best_regression_subsets and weightedaverage.
Affected #: 1 file
diff -r 773578e65580e3488fadc144739d82f86d9b30f3 -r 6b7678540ee434a7a305cf43d1a663c8f2fde30c scripts/migrate_tools/0010_tools.xml
--- a/scripts/migrate_tools/0010_tools.xml
+++ b/scripts/migrate_tools/0010_tools.xml
@@ -6,7 +6,7 @@
<repository owner="devteam" name="basecoverage" changeset_revision="1e6a9e97fa41" description="Base Coverage of all intervals"><tool id="gops_basecoverage_1" version="0.0.1" file="new_operations/basecoverage.xml" /></repository>
- <repository owner="devteam" name="best_regression_subsets" changeset_revision="54c7a01a2cc7" description="Perform Best-subsets Regression">
+ <repository owner="devteam" name="best_regression_subsets" changeset_revision="e769cde223a5" description="Perform Best-subsets Regression"><tool id="BestSubsetsRegression1" version="0.0.1" file="regVariation/best_regression_subsets.xml" /></repository><repository owner="devteam" name="cluster" changeset_revision="d5677eecbad4" description="Cluster">
@@ -132,7 +132,7 @@
<repository owner="devteam" name="variants_validate" changeset_revision="7e1ecaa64370" description="Validate Variants"><tool id="gatk_validate_variants" version="0.0.4" file="gatk/variants_validate.xml" /></repository>
- <repository owner="devteam" name="weightedaverage" changeset_revision="9b7b4009f2c0" description="Assign weighted-average of the values of features overlapping an interval">
+ <repository owner="devteam" name="weightedaverage" changeset_revision="90611e86a998" description="Assign weighted-average of the values of features overlapping an interval"><tool id="wtavg" version="1.0.0" file="regVariation/WeightedAverage.xml" /></repository><repository owner="devteam" name="windowsplitter" changeset_revision="e5490ea33640" description="Make windows">
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: Don't add unnecessary (and problematic) prior_installation_required attributes to repository dependency definitions when exporting a repository and its dependencies into a capsule.
by commits-noreply@bitbucket.org 03 Apr '14
by commits-noreply@bitbucket.org 03 Apr '14
03 Apr '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/773578e65580/
Changeset: 773578e65580
User: greg
Date: 2014-04-03 15:31:43
Summary: Don't add unnecessary (and problematic) prior_installation_required attributes to repository dependency definitions when exporting a repository and its dependencies into a capsule.
Affected #: 1 file
diff -r 66c39a2810164cff95a3e4099319a4a5a65e94b1 -r 773578e65580e3488fadc144739d82f86d9b30f3 lib/tool_shed/util/commit_util.py
--- a/lib/tool_shed/util/commit_util.py
+++ b/lib/tool_shed/util/commit_util.py
@@ -6,8 +6,8 @@
import shutil
import struct
import tempfile
-from galaxy import util
from galaxy.datatypes import checkers
+from galaxy.util import asbool
from galaxy.util import json
from galaxy.util.odict import odict
from galaxy.web import url_for
@@ -315,7 +315,9 @@
attributes = odict()
attributes[ 'name' ] = name
attributes[ 'owner' ] = owner
- attributes[ 'prior_installation_required' ] = elem.get( 'prior_installation_required', 'False' )
+ prior_installation_required = elem.get( 'prior_installation_required' )
+ if asbool( prior_installation_required ):
+ attributes[ 'prior_installation_required' ] = 'True'
elem = xml_util.create_element( 'repository', attributes=attributes, sub_elements=sub_elements )
revised = True
return revised, elem, error_message
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: libraries: removed unused and deprecated function
by commits-noreply@bitbucket.org 02 Apr '14
by commits-noreply@bitbucket.org 02 Apr '14
02 Apr '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/66c39a281016/
Changeset: 66c39a281016
User: martenson
Date: 2014-04-02 23:21:06
Summary: libraries: removed unused and deprecated function
Affected #: 2 files
diff -r 3c169a33c5107c242d7cc455cce8b30d17437894 -r 66c39a2810164cff95a3e4099319a4a5a65e94b1 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
@@ -218,50 +218,6 @@
});
},
- toggle_library_modification: function($library_row){
- var library = this.collection.get($library_row.data('id'));
-
- $library_row.find('.public_lib_ico').toggle();
- $library_row.find('.deleted_lib_ico').toggle();
- $library_row.find('.edit_library_btn').toggle();
- $library_row.find('.upload_library_btn').toggle();
- $library_row.find('.permission_library_btn').toggle();
- $library_row.find('.save_library_btn').toggle();
- $library_row.find('.cancel_library_btn').toggle();
- if (library.get('deleted')){
- } else {
- $library_row.find('.delete_library_btn').toggle();
- }
-
- if ($library_row.find('.edit_library_btn').is(':hidden')){
- // library name
- var current_library_name = library.get('name');
- var new_html = '<input type="text" class="form-control input_library_name" placeholder="name">';
- $library_row.children('td').eq(0).html(new_html);
- if (typeof current_library_name !== undefined){
- $library_row.find('.input_library_name').val(current_library_name);
- }
- // library description
- var current_library_description = library.get('description');
- var new_html = '<input type="text" class="form-control input_library_description" placeholder="description">';
- $library_row.children('td').eq(1).html(new_html);
- if (typeof current_library_description !== undefined){
- $library_row.find('.input_library_description').val(current_library_description);
- }
- // library synopsis
- var current_library_synopsis = library.get('synopsis');
- var new_html = '<input type="text" class="form-control input_library_synopsis" placeholder="synopsis">';
- $library_row.children('td').eq(2).html(new_html);
- if (typeof current_library_synopsis !== undefined){
- $library_row.find('.input_library_synopsis').val(current_library_synopsis);
- }
- } else {
- $library_row.children('td').eq(0).html(library.get('name'));
- $library_row.children('td').eq(1).html(library.get('description'));
- $library_row.children('td').eq(2).html(library.get('synopsis'));
- }
- },
-
templateRow: function() {
tmpl_array = [];
diff -r 3c169a33c5107c242d7cc455cce8b30d17437894 -r 66c39a2810164cff95a3e4099319a4a5a65e94b1 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","mvc/library/library-model"],function(b,d,e,c){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"},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(f){this.render(f)},render:function(g){if(typeof g==="undefined"){var g=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"))}this.prepareButtons(g);var f=this.templateRow();this.setElement(f({library:g,button_config:this.element_visibility_config,edit_mode:this.edit_mode}));this.$el.show();return this},repaint:function(f){$(".tooltip").hide();var g=this.$el;this.render(f);g.replaceWith(this.$el);this.$el.find("[data-toggle]").tooltip()},prepareButtons:function(f){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(f.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(f.get("deleted")===false){vis_config.save_library_btn=false;vis_config.cancel_library_btn=false;vis_config.undelete_library_btn=false;if(f.get("can_user_add")===true){vis_config.upload_library_btn=true}if(f.get("can_user_modify")===true){vis_config.edit_library_btn=true}if(f.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},edit_button_clicked:function(){this.edit_mode=true;this.repaint()},cancel_library_modification:function(){e.info("Modifications canceled");this.edit_mode=false;this.repaint()},save_library_modification:function(){var g=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var h=false;var j=this.$el.find(".input_library_name").val();if(typeof j!=="undefined"&&j!==g.get("name")){if(j.length>2){g.set("name",j);h=true}else{e.warning("Library name has to be at least 3 characters long");return}}var i=this.$el.find(".input_library_description").val();if(typeof i!=="undefined"&&i!==g.get("description")){g.set("description",i);h=true}var k=this.$el.find(".input_library_synopsis").val();if(typeof k!=="undefined"&&k!==g.get("synopsis")){g.set("synopsis",k);h=true}if(h){var f=this;g.save(null,{patch:true,success:function(l){f.edit_mode=false;f.repaint(l);e.success("Changes to library saved")},error:function(m,l){e.error("An error occured during updating the library :(")}})}else{this.edit_mode=false;this.repaint(g);e.info("Nothing has changed")}},delete_library:function(){var g=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var f=this;g.destroy({success:function(h){h.set("deleted",true);Galaxy.libraries.libraryListView.collection.add(h);f.edit_mode=false;if(Galaxy.libraries.preferences.get("with_deleted")===false){$(".tooltip").hide();f.$el.remove()}else{if(Galaxy.libraries.preferences.get("with_deleted")===true){f.repaint(h)}}e.success("Library has been marked deleted")},error:function(){e.error("An error occured during deleting the library :(")}})},undelete_library:function(){var g=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var f=this;g.url=g.urlRoot+g.id+"?undelete=true";g.destroy({success:function(h){h.set("deleted",false);Galaxy.libraries.libraryListView.collection.add(h);f.edit_mode=false;f.repaint(h);e.success("Library has been undeleted")},error:function(){e.error("An error occured while undeleting the library :(")}})},toggle_library_modification:function(i){var f=this.collection.get(i.data("id"));i.find(".public_lib_ico").toggle();i.find(".deleted_lib_ico").toggle();i.find(".edit_library_btn").toggle();i.find(".upload_library_btn").toggle();i.find(".permission_library_btn").toggle();i.find(".save_library_btn").toggle();i.find(".cancel_library_btn").toggle();if(f.get("deleted")){}else{i.find(".delete_library_btn").toggle()}if(i.find(".edit_library_btn").is(":hidden")){var g=f.get("name");var k='<input type="text" class="form-control input_library_name" placeholder="name">';i.children("td").eq(0).html(k);if(typeof g!==undefined){i.find(".input_library_name").val(g)}var h=f.get("description");var k='<input type="text" class="form-control input_library_description" placeholder="description">';i.children("td").eq(1).html(k);if(typeof h!==undefined){i.find(".input_library_description").val(h)}var j=f.get("synopsis");var k='<input type="text" class="form-control input_library_synopsis" placeholder="synopsis">';i.children("td").eq(2).html(k);if(typeof j!==undefined){i.find(".input_library_synopsis").val(j)}}else{i.children("td").eq(0).html(f.get("name"));i.children("td").eq(1).html(f.get("description"));i.children("td").eq(2).html(f.get("synopsis"))}},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(' <td><a href="#folders/<%- library.get("root_folder_id") %>"><%- library.get("name") %></a></td>');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("deleted") === true) { %>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Marked deleted" style="color:grey;" class="fa fa-ban fa-lg deleted_lib_ico"></span>');tmpl_array.push(' <% } else if(library.get("public") === true) { %>');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" 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" 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","mvc/library/library-model"],function(b,d,e,c){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(f){this.render(f)},render:function(g){if(typeof g==="undefined"){var g=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"))}this.prepareButtons(g);var f=this.templateRow();this.setElement(f({library:g,button_config:this.element_visibility_config,edit_mode:this.edit_mode}));this.$el.show();return this},repaint:function(f){$(".tooltip").hide();var g=this.$el;this.render(f);g.replaceWith(this.$el);this.$el.find("[data-toggle]").tooltip()},prepareButtons:function(f){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(f.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(f.get("deleted")===false){vis_config.save_library_btn=false;vis_config.cancel_library_btn=false;vis_config.undelete_library_btn=false;if(f.get("can_user_add")===true){vis_config.upload_library_btn=true}if(f.get("can_user_modify")===true){vis_config.edit_library_btn=true}if(f.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(){e.info("Coming soon. Stay tuned.")},permissions_on_library:function(){e.info("Coming soon. Stay tuned.")},edit_button_clicked:function(){this.edit_mode=true;this.repaint()},cancel_library_modification:function(){e.info("Modifications canceled");this.edit_mode=false;this.repaint()},save_library_modification:function(){var g=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var h=false;var j=this.$el.find(".input_library_name").val();if(typeof j!=="undefined"&&j!==g.get("name")){if(j.length>2){g.set("name",j);h=true}else{e.warning("Library name has to be at least 3 characters long");return}}var i=this.$el.find(".input_library_description").val();if(typeof i!=="undefined"&&i!==g.get("description")){g.set("description",i);h=true}var k=this.$el.find(".input_library_synopsis").val();if(typeof k!=="undefined"&&k!==g.get("synopsis")){g.set("synopsis",k);h=true}if(h){var f=this;g.save(null,{patch:true,success:function(l){f.edit_mode=false;f.repaint(l);e.success("Changes to library saved")},error:function(m,l){e.error("An error occured during updating the library :(")}})}else{this.edit_mode=false;this.repaint(g);e.info("Nothing has changed")}},delete_library:function(){var g=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var f=this;g.destroy({success:function(h){h.set("deleted",true);Galaxy.libraries.libraryListView.collection.add(h);f.edit_mode=false;if(Galaxy.libraries.preferences.get("with_deleted")===false){$(".tooltip").hide();f.$el.remove()}else{if(Galaxy.libraries.preferences.get("with_deleted")===true){f.repaint(h)}}e.success("Library has been marked deleted")},error:function(){e.error("An error occured during deleting the library :(")}})},undelete_library:function(){var g=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var f=this;g.url=g.urlRoot+g.id+"?undelete=true";g.destroy({success:function(h){h.set("deleted",false);Galaxy.libraries.libraryListView.collection.add(h);f.edit_mode=false;f.repaint(h);e.success("Library has been undeleted")},error:function(){e.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(' <td><a href="#folders/<%- library.get("root_folder_id") %>"><%- library.get("name") %></a></td>');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("deleted") === true) { %>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Marked deleted" style="color:grey;" class="fa fa-ban fa-lg deleted_lib_ico"></span>');tmpl_array.push(' <% } else if(library.get("public") === true) { %>');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" 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" 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
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: libraries: more refactoring fun; full UI for permissions handling; repainting from cache
by commits-noreply@bitbucket.org 02 Apr '14
by commits-noreply@bitbucket.org 02 Apr '14
02 Apr '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/3c169a33c510/
Changeset: 3c169a33c510
User: martenson
Date: 2014-04-02 23:18:51
Summary: libraries: more refactoring fun; full UI for permissions handling; repainting from cache
should be ready for stable
Affected #: 4 files
diff -r 1344876d770a4441864bc58e33e50eba860ef7b3 -r 3c169a33c5107c242d7cc455cce8b30d17437894 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
@@ -18,11 +18,6 @@
el: '#libraries_element',
events: {
- 'click .edit_library_btn' : 'edit_button_event',
- 'click .save_library_btn' : 'save_library_modification',
- 'click .cancel_library_btn' : 'cancel_library_modification',
- 'click .delete_library_btn' : 'delete_library',
- 'click .undelete_library_btn' : 'undelete_library',
'click .sort-libraries-link' : 'sort_clicked'
},
@@ -90,7 +85,8 @@
for (var i = 0; i < libraries_to_render.length; i++) {
var library = libraries_to_render[i];
var cachedView = _.findWhere(this.rowViews, {id: library.get('id')});
- if (cachedView !== undefined){
+ if (cachedView !== undefined && this instanceof Backbone.View){
+ cachedView.delegateEvents();
this.$el.find('#library_list_body').append(cachedView.el);
} else {
var rowView = new mod_library_libraryrow_view.LibraryRowView(library);
@@ -101,18 +97,6 @@
};
},
- /** Handle the user toggling the deleted visibility by:
- * (1) storing the new value in the persistent storage
- * (2) re-rendering the list
- * @returns {Boolean} new show_hidden setting
- */
- // toggleShowHidden : function( show ){
- // show = ( show !== undefined )?( show ):( !this.storage.get( 'show_hidden' ) );
- // this.storage.set( 'show_hidden', show );
- // this.renderRows();
- // return this.storage.get( 'show_hidden' );
- // },
-
sort_clicked : function(){
if (Galaxy.libraries.preferences.get('sort_order') === 'asc'){
this.sortLibraries('name','desc');
@@ -145,7 +129,6 @@
}
this.collection.sort();
}
-
},
// MMMMMMMMMMMMMMMMMM
@@ -175,7 +158,6 @@
return _.template(tmpl_array.join(''));
},
-
templateNewLibraryInModal: function(){
tmpl_array = [];
@@ -191,153 +173,6 @@
return tmpl_array.join('');
},
- save_library_modification: function(event){
- var $library_row = $(event.target).closest('tr');
- var library = this.collection.get($library_row.data('id'));
-
- var is_changed = false;
-
- var new_name = $library_row.find('.input_library_name').val();
- if (typeof new_name !== 'undefined' && new_name !== library.get('name') ){
- if (new_name.length > 2){
- library.set("name", new_name);
- is_changed = true;
- } else{
- mod_toastr.warning('Library name has to be at least 3 characters long');
- return
- }
- }
-
- var new_description = $library_row.find('.input_library_description').val();
- if (typeof new_description !== 'undefined' && new_description !== library.get('description') ){
- library.set("description", new_description);
- is_changed = true;
- }
-
- var new_synopsis = $library_row.find('.input_library_synopsis').val();
- if (typeof new_synopsis !== 'undefined' && new_synopsis !== library.get('synopsis') ){
- library.set("synopsis", new_synopsis);
- is_changed = true;
- }
-
- if (is_changed){
- library.save(null, {
- patch: true,
- success: function(library) {
- mod_toastr.success('Changes to library saved');
- Galaxy.libraries.libraryListView.toggle_library_modification($library_row);
- },
- error: function(model, response){
- mod_toastr.error('An error occured during updating the library :(');
- }
- });
- }
- },
-
- edit_button_event: function(event){
- this.toggle_library_modification($(event.target).closest('tr'));
- },
-
- toggle_library_modification: function($library_row){
- var library = this.collection.get($library_row.data('id'));
-
- $library_row.find('.public_lib_ico').toggle();
- $library_row.find('.deleted_lib_ico').toggle();
- $library_row.find('.edit_library_btn').toggle();
- $library_row.find('.upload_library_btn').toggle();
- $library_row.find('.permission_library_btn').toggle();
- $library_row.find('.save_library_btn').toggle();
- $library_row.find('.cancel_library_btn').toggle();
- if (library.get('deleted')){
- // $library_row.find('.undelete_library_btn').toggle();
- } else {
- $library_row.find('.delete_library_btn').toggle();
- }
-
- if ($library_row.find('.edit_library_btn').is(':hidden')){
- // library name
- var current_library_name = library.get('name');
- var new_html = '<input type="text" class="form-control input_library_name" placeholder="name">';
- $library_row.children('td').eq(0).html(new_html);
- if (typeof current_library_name !== undefined){
- $library_row.find('.input_library_name').val(current_library_name);
- }
- // library description
- var current_library_description = library.get('description');
- var new_html = '<input type="text" class="form-control input_library_description" placeholder="description">';
- $library_row.children('td').eq(1).html(new_html);
- if (typeof current_library_description !== undefined){
- $library_row.find('.input_library_description').val(current_library_description);
- }
- // library synopsis
- var current_library_synopsis = library.get('synopsis');
- var new_html = '<input type="text" class="form-control input_library_synopsis" placeholder="synopsis">';
- $library_row.children('td').eq(2).html(new_html);
- if (typeof current_library_synopsis !== undefined){
- $library_row.find('.input_library_synopsis').val(current_library_synopsis);
- }
- } else {
- // missing ICON + LINK....needs refactoring to separate view
- $library_row.children('td').eq(0).html(library.get('name'));
- $library_row.children('td').eq(1).html(library.get('description'));
- $library_row.children('td').eq(2).html(library.get('synopsis'));
- }
-
- },
-
- cancel_library_modification: function(event){
- var $library_row = $(event.target).closest('tr');
- var library = this.collection.get($library_row.data('id'));
- this.toggle_library_modification($library_row);
-
- $library_row.children('td').eq(0).html(library.get('name'));
- $library_row.children('td').eq(1).html(library.get('description'));
- $library_row.children('td').eq(2).html(library.get('synopsis'));
- },
-
- undelete_library: function(event){
- var $library_row = $(event.target).closest('tr');
- var library = this.collection.get($library_row.data('id'));
- this.toggle_library_modification($library_row);
-
- // mark the library undeleted
- library.url = library.urlRoot + library.id + '?undelete=true';
- library.destroy({
- success: function (library) {
- // add the newly undeleted library back to the collection
- // backbone does not accept changes through destroy, so update it too
- library.set('deleted', false);
- Galaxy.libraries.libraryListView.collection.add(library);
- $library_row.removeClass('active');
- mod_toastr.success('Library has been undeleted');
- },
- error: function(){
- mod_toastr.error('An error occured while undeleting the library :(');
- }
- });
- },
-
- delete_library: function(event){
- var $library_row = $(event.target).closest('tr');
- var library = this.collection.get($library_row.data('id'));
- this.toggle_library_modification($library_row);
-
- // mark the library deleted
- library.destroy({
- success: function (library) {
- // add the new deleted library back to the collection
- $library_row.remove();
- library.set('deleted', true);
- Galaxy.libraries.libraryListView.collection.add(library);
- mod_toastr.success('Library has been marked deleted');
- },
- error: function(){
- mod_toastr.error('An error occured during deleting the library :(');
- }
- });
-
- },
-
redirectToHome: function(){
window.location = '../';
},
diff -r 1344876d770a4441864bc58e33e50eba860ef7b3 -r 3c169a33c5107c242d7cc455cce8b30d17437894 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
@@ -11,6 +11,17 @@
// galaxy library row view
var LibraryRowView = 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,
@@ -27,42 +38,243 @@
},
render: function(library){
+ if (typeof library === 'undefined'){
+ var library = Galaxy.libraries.libraryListView.collection.get(this.$el.data('id'));
+ }
+ this.prepareButtons(library);
var tmpl = this.templateRow();
- this.prepareButtons(library);
- this.setElement(tmpl({library:library, button_config: this.element_visibility_config}));
+ this.setElement(tmpl({library:library, button_config: this.element_visibility_config, edit_mode: this.edit_mode}));
this.$el.show();
- // this.set_up_visual_features(library);
+ return this;
+ },
+
+ repaint: function(library){
+ /* need to hide manually because of the element removal in setElement
+ invoked in render() */
+ $(".tooltip").hide();
+ /* we need to store the old element to be able to replace it with
+ new one */
+ var old_element = this.$el;
+ /* if user canceled the library param is undefined,
+ if user saved and succeeded the updated library is rendered */
+ this.render(library);
+ old_element.replaceWith(this.$el);
+ /* now we attach new tooltips to the newly created row element */
+ this.$el.find("[data-toggle]").tooltip();
},
prepareButtons: function(library){
- if (library.get('deleted') === true ){
- if (Galaxy.currUser.isAdmin()){
- this.element_visibility_config.undelete_library_btn = true;
- this.element_visibility_config.upload_library_btn = false;
- this.element_visibility_config.edit_library_btn = false;
- this.element_visibility_config.permission_library_btn = false;
+ 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 (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;
+ vis_config.undelete_library_btn = false;
+ if (library.get('can_user_add') === true){
+ vis_config.upload_library_btn = true;
+ }
+ if (library.get('can_user_modify') === true){
+ vis_config.edit_library_btn = true;
+ }
+ if (library.get('can_user_manage') === true){
+ vis_config.permission_library_btn = true;
+ }
}
- } else if (library.get('deleted') === false ) {
- this.element_visibility_config.undelete_library_btn = false;
- if (library.get('can_user_add') === true){
- this.element_visibility_config.upload_library_btn = true;
- }
- if (library.get('can_user_modify') === true){
- this.element_visibility_config.edit_library_btn = true;
- }
- if (library.get('can_user_manage') === true){
- this.element_visibility_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(){
+ mod_toastr.info('Coming soon. Stay tuned.');
+ },
+
+ permissions_on_library: function(){
+ mod_toastr.info('Coming soon. Stay tuned.');
+ },
+
+ /* User clicked the 'edit' button on row so we render a new row
+ that allows editing */
+ edit_button_clicked: function(){
+ this.edit_mode = true;
+ this.repaint();
+ },
+
+ /* User clicked the 'cancel' button so we render normal rowView */
+ cancel_library_modification: function(){
+ mod_toastr.info('Modifications canceled');
+ this.edit_mode = false;
+ this.repaint();
+ },
+
+ save_library_modification: function(){
+ var library = Galaxy.libraries.libraryListView.collection.get(this.$el.data('id'));
+ var is_changed = false;
+
+ var new_name = this.$el.find('.input_library_name').val();
+ if (typeof new_name !== 'undefined' && new_name !== library.get('name') ){
+ if (new_name.length > 2){
+ library.set("name", new_name);
+ is_changed = true;
+ } else{
+ mod_toastr.warning('Library name has to be at least 3 characters long');
+ return
+ }
+ }
+
+ var new_description = this.$el.find('.input_library_description').val();
+ if (typeof new_description !== 'undefined' && new_description !== library.get('description') ){
+ library.set("description", new_description);
+ is_changed = true;
+ }
+
+ var new_synopsis = this.$el.find('.input_library_synopsis').val();
+ if (typeof new_synopsis !== 'undefined' && new_synopsis !== library.get('synopsis') ){
+ library.set("synopsis", new_synopsis);
+ is_changed = true;
+ }
+
+ if (is_changed){
+ var row_view = this;
+ library.save(null, {
+ patch: true,
+ success: function(library) {
+ row_view.edit_mode = false;
+ row_view.repaint(library);
+ mod_toastr.success('Changes to library saved');
+ },
+ error: function(model, response){
+ mod_toastr.error('An error occured during updating the library :(');
+ }
+ });
+ } else {
+ this.edit_mode = false;
+ this.repaint(library);
+ mod_toastr.info('Nothing has changed');
+ }
+ },
+
+ delete_library: function(){
+ var library = Galaxy.libraries.libraryListView.collection.get(this.$el.data('id'));
+ var row_view = this;
+ // mark the library deleted
+ library.destroy({
+ success: function (library) {
+ library.set('deleted', true);
+ // add the new deleted library back to the collection (Galaxy specialty)
+ Galaxy.libraries.libraryListView.collection.add(library);
+ row_view.edit_mode = false;
+ if (Galaxy.libraries.preferences.get('with_deleted') === false){
+ $(".tooltip").hide();
+ row_view.$el.remove();
+ } else if (Galaxy.libraries.preferences.get('with_deleted') === true){
+ row_view.repaint(library);
+ }
+ mod_toastr.success('Library has been marked deleted');
+ },
+ error: function(){
+ mod_toastr.error('An error occured during deleting the library :(');
+ }
+ });
+ },
+
+ undelete_library: function(){
+ var library = Galaxy.libraries.libraryListView.collection.get(this.$el.data('id'));
+ var row_view = this;
+
+ // mark the library undeleted
+ library.url = library.urlRoot + library.id + '?undelete=true';
+ library.destroy({
+ success: function (library) {
+ // add the newly undeleted library back to the collection
+ // backbone does not accept changes through destroy, so update it too
+ library.set('deleted', false);
+ Galaxy.libraries.libraryListView.collection.add(library);
+ row_view.edit_mode = false;
+ row_view.repaint(library);
+ mod_toastr.success('Library has been undeleted');
+ },
+ error: function(){
+ mod_toastr.error('An error occured while undeleting the library :(');
+ }
+ });
+ },
+
+ toggle_library_modification: function($library_row){
+ var library = this.collection.get($library_row.data('id'));
+
+ $library_row.find('.public_lib_ico').toggle();
+ $library_row.find('.deleted_lib_ico').toggle();
+ $library_row.find('.edit_library_btn').toggle();
+ $library_row.find('.upload_library_btn').toggle();
+ $library_row.find('.permission_library_btn').toggle();
+ $library_row.find('.save_library_btn').toggle();
+ $library_row.find('.cancel_library_btn').toggle();
+ if (library.get('deleted')){
+ } else {
+ $library_row.find('.delete_library_btn').toggle();
+ }
+
+ if ($library_row.find('.edit_library_btn').is(':hidden')){
+ // library name
+ var current_library_name = library.get('name');
+ var new_html = '<input type="text" class="form-control input_library_name" placeholder="name">';
+ $library_row.children('td').eq(0).html(new_html);
+ if (typeof current_library_name !== undefined){
+ $library_row.find('.input_library_name').val(current_library_name);
+ }
+ // library description
+ var current_library_description = library.get('description');
+ var new_html = '<input type="text" class="form-control input_library_description" placeholder="description">';
+ $library_row.children('td').eq(1).html(new_html);
+ if (typeof current_library_description !== undefined){
+ $library_row.find('.input_library_description').val(current_library_description);
+ }
+ // library synopsis
+ var current_library_synopsis = library.get('synopsis');
+ var new_html = '<input type="text" class="form-control input_library_synopsis" placeholder="synopsis">';
+ $library_row.children('td').eq(2).html(new_html);
+ if (typeof current_library_synopsis !== undefined){
+ $library_row.find('.input_library_synopsis').val(current_library_synopsis);
+ }
+ } else {
+ $library_row.children('td').eq(0).html(library.get('name'));
+ $library_row.children('td').eq(1).html(library.get('description'));
+ $library_row.children('td').eq(2).html(library.get('synopsis'));
+ }
},
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(' <td><a href="#folders/<%- library.get("root_folder_id") %>"><%- library.get("name") %></a></td>');
- tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');
- tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');
+ tmpl_array.push(' <% if(!edit_mode) { %>');
+ tmpl_array.push(' <td><a href="#folders/<%- library.get("root_folder_id") %>"><%- library.get("name") %></a></td>');
+ 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("deleted") === true) { %>');
tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Marked deleted" style="color:grey;" class="fa fa-ban fa-lg deleted_lib_ico"></span>');
diff -r 1344876d770a4441864bc58e33e50eba860ef7b3 -r 3c169a33c5107c242d7cc455cce8b30d17437894 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 .edit_library_btn":"edit_button_event","click .save_library_btn":"save_library_modification","click .cancel_library_btn":"cancel_library_modification","click .delete_library_btn":"delete_library","click .undelete_library_btn":"undelete_library","click .sort-libraries-link":"sort_clicked"},modal:null,collection:null,rowViews:{},initialize:function(){var h=this;this.rowViews={};this.collection=new c.Libraries();this.collection.fetch({success:function(i){h.render()},error:function(j,i){e.error("An error occured. Please try again.")}})},render:function(i){var j=this.templateLibraryList();var k=null;var h=true;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){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")}));this.renderRows(k);$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},renderRows:function(m){for(var l=0;l<m.length;l++){var k=m[l];var j=_.findWhere(this.rowViews,{id:k.get("id")});if(j!==undefined){this.$el.find("#library_list_body").append(j.el)}else{var h=new a.LibraryRowView(k);this.$el.find("#library_list_body").append(h.el);this.rowViews[k.get("id")]=h}}},sort_clicked:function(){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){this.sortLibraries("name","desc");Galaxy.libraries.preferences.set({sort_order:"desc"})}else{this.sortLibraries("name","asc");Galaxy.libraries.preferences.set({sort_order:"asc"})}this.render()},sortLibraries:function(i,h){if(i==="name"){if(h==="asc"){this.collection.comparator=function(k,j){if(k.get("name").toLowerCase()>j.get("name").toLowerCase()){return 1}if(j.get("name").toLowerCase()>k.get("name").toLowerCase()){return -1}return 0}}else{if(h==="desc"){this.collection.comparator=function(k,j){if(k.get("name").toLowerCase()>j.get("name").toLowerCase()){return -1}if(j.get("name").toLowerCase()>k.get("name").toLowerCase()){return 1}return 0}}}this.collection.sort()}},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div class="library_container table-responsive">');tmpl_array.push("<% if(length === 0) { %>");tmpl_array.push("<div>I see no libraries. Why don't you create one?</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(""))},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("")},save_library_modification:function(k){var j=$(k.target).closest("tr");var h=this.collection.get(j.data("id"));var i=false;var m=j.find(".input_library_name").val();if(typeof m!=="undefined"&&m!==h.get("name")){if(m.length>2){h.set("name",m);i=true}else{e.warning("Library name has to be at least 3 characters long");return}}var l=j.find(".input_library_description").val();if(typeof l!=="undefined"&&l!==h.get("description")){h.set("description",l);i=true}var n=j.find(".input_library_synopsis").val();if(typeof n!=="undefined"&&n!==h.get("synopsis")){h.set("synopsis",n);i=true}if(i){h.save(null,{patch:true,success:function(o){e.success("Changes to library saved");Galaxy.libraries.libraryListView.toggle_library_modification(j)},error:function(p,o){e.error("An error occured during updating the library :(")}})}},edit_button_event:function(h){this.toggle_library_modification($(h.target).closest("tr"))},toggle_library_modification:function(k){var h=this.collection.get(k.data("id"));k.find(".public_lib_ico").toggle();k.find(".deleted_lib_ico").toggle();k.find(".edit_library_btn").toggle();k.find(".upload_library_btn").toggle();k.find(".permission_library_btn").toggle();k.find(".save_library_btn").toggle();k.find(".cancel_library_btn").toggle();if(h.get("deleted")){}else{k.find(".delete_library_btn").toggle()}if(k.find(".edit_library_btn").is(":hidden")){var i=h.get("name");var m='<input type="text" class="form-control input_library_name" placeholder="name">';k.children("td").eq(0).html(m);if(typeof i!==undefined){k.find(".input_library_name").val(i)}var j=h.get("description");var m='<input type="text" class="form-control input_library_description" placeholder="description">';k.children("td").eq(1).html(m);if(typeof j!==undefined){k.find(".input_library_description").val(j)}var l=h.get("synopsis");var m='<input type="text" class="form-control input_library_synopsis" placeholder="synopsis">';k.children("td").eq(2).html(m);if(typeof l!==undefined){k.find(".input_library_synopsis").val(l)}}else{k.children("td").eq(0).html(h.get("name"));k.children("td").eq(1).html(h.get("description"));k.children("td").eq(2).html(h.get("synopsis"))}},cancel_library_modification:function(j){var i=$(j.target).closest("tr");var h=this.collection.get(i.data("id"));this.toggle_library_modification(i);i.children("td").eq(0).html(h.get("name"));i.children("td").eq(1).html(h.get("description"));i.children("td").eq(2).html(h.get("synopsis"))},undelete_library:function(j){var i=$(j.target).closest("tr");var h=this.collection.get(i.data("id"));this.toggle_library_modification(i);h.url=h.urlRoot+h.id+"?undelete=true";h.destroy({success:function(k){k.set("deleted",false);Galaxy.libraries.libraryListView.collection.add(k);i.removeClass("active");e.success("Library has been undeleted")},error:function(){e.error("An error occured while undeleting the library :(")}})},delete_library:function(j){var i=$(j.target).closest("tr");var h=this.collection.get(i.data("id"));this.toggle_library_modification(i);h.destroy({success:function(k){i.remove();k.set("deleted",true);Galaxy.libraries.libraryListView.collection.add(k);e.success("Library has been marked deleted")},error:function(){e.error("An error occured during deleting the library :(")}})},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},show_library_modal:function(i){i.preventDefault();i.stopPropagation();var h=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){h.create_new_library_event()},Close:function(){h.modal.hide()}}})},create_new_library_event:function(){var j=this.serialize_new_library();if(this.validate_new_library(j)){var i=new c.Library();var h=this;i.save(j,{success:function(k){h.collection.add(k);h.modal.hide();h.clear_library_modal();h.render();e.success("Library created")},error:function(){e.error("An error occured :(")}})}else{e.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(h){return h.name!==""}});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(){var h=this;this.rowViews={};this.collection=new c.Libraries();this.collection.fetch({success:function(i){h.render()},error:function(j,i){e.error("An error occured. Please try again.")}})},render:function(i){var j=this.templateLibraryList();var k=null;var h=true;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){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")}));this.renderRows(k);$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},renderRows:function(m){for(var l=0;l<m.length;l++){var k=m[l];var j=_.findWhere(this.rowViews,{id:k.get("id")});if(j!==undefined&&this instanceof Backbone.View){j.delegateEvents();this.$el.find("#library_list_body").append(j.el)}else{var h=new a.LibraryRowView(k);this.$el.find("#library_list_body").append(h.el);this.rowViews[k.get("id")]=h}}},sort_clicked:function(){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){this.sortLibraries("name","desc");Galaxy.libraries.preferences.set({sort_order:"desc"})}else{this.sortLibraries("name","asc");Galaxy.libraries.preferences.set({sort_order:"asc"})}this.render()},sortLibraries:function(i,h){if(i==="name"){if(h==="asc"){this.collection.comparator=function(k,j){if(k.get("name").toLowerCase()>j.get("name").toLowerCase()){return 1}if(j.get("name").toLowerCase()>k.get("name").toLowerCase()){return -1}return 0}}else{if(h==="desc"){this.collection.comparator=function(k,j){if(k.get("name").toLowerCase()>j.get("name").toLowerCase()){return -1}if(j.get("name").toLowerCase()>k.get("name").toLowerCase()){return 1}return 0}}}this.collection.sort()}},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div class="library_container table-responsive">');tmpl_array.push("<% if(length === 0) { %>");tmpl_array.push("<div>I see no libraries. Why don't you create one?</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(""))},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("")},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},show_library_modal:function(i){i.preventDefault();i.stopPropagation();var h=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){h.create_new_library_event()},Close:function(){h.modal.hide()}}})},create_new_library_event:function(){var j=this.serialize_new_library();if(this.validate_new_library(j)){var i=new c.Library();var h=this;i.save(j,{success:function(k){h.collection.add(k);h.modal.hide();h.clear_library_modal();h.render();e.success("Library created")},error:function(){e.error("An error occured :(")}})}else{e.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(h){return h.name!==""}});return{LibraryListView:f}});
\ No newline at end of file
diff -r 1344876d770a4441864bc58e33e50eba860ef7b3 -r 3c169a33c5107c242d7cc455cce8b30d17437894 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","mvc/library/library-model"],function(b,d,e,c){var a=Backbone.View.extend({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(f){this.render(f)},render:function(g){var f=this.templateRow();this.prepareButtons(g);this.setElement(f({library:g,button_config:this.element_visibility_config}));this.$el.show()},prepareButtons:function(f){if(f.get("deleted")===true){if(Galaxy.currUser.isAdmin()){this.element_visibility_config.undelete_library_btn=true;this.element_visibility_config.upload_library_btn=false;this.element_visibility_config.edit_library_btn=false;this.element_visibility_config.permission_library_btn=false}}else{if(f.get("deleted")===false){this.element_visibility_config.undelete_library_btn=false;if(f.get("can_user_add")===true){this.element_visibility_config.upload_library_btn=true}if(f.get("can_user_modify")===true){this.element_visibility_config.edit_library_btn=true}if(f.get("can_user_manage")===true){this.element_visibility_config.permission_library_btn=true}}}},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(' <td><a href="#folders/<%- library.get("root_folder_id") %>"><%- library.get("name") %></a></td>');tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');tmpl_array.push(' <td class="right-center">');tmpl_array.push(' <% if(library.get("deleted") === true) { %>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Marked deleted" style="color:grey;" class="fa fa-ban fa-lg deleted_lib_ico"></span>');tmpl_array.push(' <% } else if(library.get("public") === true) { %>');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" 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" 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","mvc/library/library-model"],function(b,d,e,c){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"},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(f){this.render(f)},render:function(g){if(typeof g==="undefined"){var g=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"))}this.prepareButtons(g);var f=this.templateRow();this.setElement(f({library:g,button_config:this.element_visibility_config,edit_mode:this.edit_mode}));this.$el.show();return this},repaint:function(f){$(".tooltip").hide();var g=this.$el;this.render(f);g.replaceWith(this.$el);this.$el.find("[data-toggle]").tooltip()},prepareButtons:function(f){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(f.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(f.get("deleted")===false){vis_config.save_library_btn=false;vis_config.cancel_library_btn=false;vis_config.undelete_library_btn=false;if(f.get("can_user_add")===true){vis_config.upload_library_btn=true}if(f.get("can_user_modify")===true){vis_config.edit_library_btn=true}if(f.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},edit_button_clicked:function(){this.edit_mode=true;this.repaint()},cancel_library_modification:function(){e.info("Modifications canceled");this.edit_mode=false;this.repaint()},save_library_modification:function(){var g=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var h=false;var j=this.$el.find(".input_library_name").val();if(typeof j!=="undefined"&&j!==g.get("name")){if(j.length>2){g.set("name",j);h=true}else{e.warning("Library name has to be at least 3 characters long");return}}var i=this.$el.find(".input_library_description").val();if(typeof i!=="undefined"&&i!==g.get("description")){g.set("description",i);h=true}var k=this.$el.find(".input_library_synopsis").val();if(typeof k!=="undefined"&&k!==g.get("synopsis")){g.set("synopsis",k);h=true}if(h){var f=this;g.save(null,{patch:true,success:function(l){f.edit_mode=false;f.repaint(l);e.success("Changes to library saved")},error:function(m,l){e.error("An error occured during updating the library :(")}})}else{this.edit_mode=false;this.repaint(g);e.info("Nothing has changed")}},delete_library:function(){var g=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var f=this;g.destroy({success:function(h){h.set("deleted",true);Galaxy.libraries.libraryListView.collection.add(h);f.edit_mode=false;if(Galaxy.libraries.preferences.get("with_deleted")===false){$(".tooltip").hide();f.$el.remove()}else{if(Galaxy.libraries.preferences.get("with_deleted")===true){f.repaint(h)}}e.success("Library has been marked deleted")},error:function(){e.error("An error occured during deleting the library :(")}})},undelete_library:function(){var g=Galaxy.libraries.libraryListView.collection.get(this.$el.data("id"));var f=this;g.url=g.urlRoot+g.id+"?undelete=true";g.destroy({success:function(h){h.set("deleted",false);Galaxy.libraries.libraryListView.collection.add(h);f.edit_mode=false;f.repaint(h);e.success("Library has been undeleted")},error:function(){e.error("An error occured while undeleting the library :(")}})},toggle_library_modification:function(i){var f=this.collection.get(i.data("id"));i.find(".public_lib_ico").toggle();i.find(".deleted_lib_ico").toggle();i.find(".edit_library_btn").toggle();i.find(".upload_library_btn").toggle();i.find(".permission_library_btn").toggle();i.find(".save_library_btn").toggle();i.find(".cancel_library_btn").toggle();if(f.get("deleted")){}else{i.find(".delete_library_btn").toggle()}if(i.find(".edit_library_btn").is(":hidden")){var g=f.get("name");var k='<input type="text" class="form-control input_library_name" placeholder="name">';i.children("td").eq(0).html(k);if(typeof g!==undefined){i.find(".input_library_name").val(g)}var h=f.get("description");var k='<input type="text" class="form-control input_library_description" placeholder="description">';i.children("td").eq(1).html(k);if(typeof h!==undefined){i.find(".input_library_description").val(h)}var j=f.get("synopsis");var k='<input type="text" class="form-control input_library_synopsis" placeholder="synopsis">';i.children("td").eq(2).html(k);if(typeof j!==undefined){i.find(".input_library_synopsis").val(j)}}else{i.children("td").eq(0).html(f.get("name"));i.children("td").eq(1).html(f.get("description"));i.children("td").eq(2).html(f.get("synopsis"))}},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(' <td><a href="#folders/<%- library.get("root_folder_id") %>"><%- library.get("name") %></a></td>');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("deleted") === true) { %>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Marked deleted" style="color:grey;" class="fa fa-ban fa-lg deleted_lib_ico"></span>');tmpl_array.push(' <% } else if(library.get("public") === true) { %>');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" 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" 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
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: davebgx: Corrected an error in the analyze_covariates tool shed repository.
by commits-noreply@bitbucket.org 02 Apr '14
by commits-noreply@bitbucket.org 02 Apr '14
02 Apr '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/1344876d770a/
Changeset: 1344876d770a
User: davebgx
Date: 2014-04-02 22:05:57
Summary: Corrected an error in the analyze_covariates tool shed repository.
Affected #: 1 file
diff -r e7b2e3c626322294668c5aab56c830d5a2eb5139 -r 1344876d770a4441864bc58e33e50eba860ef7b3 scripts/migrate_tools/0010_tools.xml
--- a/scripts/migrate_tools/0010_tools.xml
+++ b/scripts/migrate_tools/0010_tools.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?><toolshed name="toolshed.g2.bx.psu.edu">
- <repository owner="devteam" name="analyze_covariates" changeset_revision="be6bede22459" description="Analyze Covariates">
+ <repository owner="devteam" name="analyze_covariates" changeset_revision="738bc749f9a3" description="Analyze Covariates"><tool id="gatk_analyze_covariates" version="0.0.5" file="gatk/analyze_covariates.xml" /></repository><repository owner="devteam" name="basecoverage" changeset_revision="1e6a9e97fa41" description="Base Coverage of all intervals">
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
02 Apr '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/e7b2e3c62632/
Changeset: e7b2e3c62632
User: greg
Date: 2014-04-02 21:18:40
Summary: Add a new RepositoryGridFilterManager to the Tool Shed framework to support filtering the repositories displayed in the many Tool Shed grids. The current filters are CERTIFIED_LEVEL_ONE, CERTIFIED_LEVEL_ONE_SUITE and CERTIFIED_LEVEL_TWO, CERTIFIED_LEVEL_TWO_SUITE. The "level one" filters display repositories or suites that have been certified by the Tool Shed's install and test framework. The "level two" filters are not yet supported (the query enhancements are trivial, but not yet done) since no repositories in the test or main Tool Shed have been certified at this level (this level requires reviews and approvals by IUC members). When set, filters are stored in session cookies. Filters are easy to set. The Javascript event handler (e.g. checking a filter checkbox) would make a call something like: trans.app.repository_grid_filter_manager.set_filter( trans.app.repository_grid_filter_manager.filters.CERTIFIED_LEVEL_ONE ).
Affected #: 7 files
diff -r 55c0a99ff035b9d11adef3a931312c64bb99a45b -r e7b2e3c626322294668c5aab56c830d5a2eb5139 lib/galaxy/webapps/tool_shed/app.py
--- a/lib/galaxy/webapps/tool_shed/app.py
+++ b/lib/galaxy/webapps/tool_shed/app.py
@@ -1,4 +1,5 @@
-import sys, config
+import config
+import sys
from galaxy import tools
import galaxy.tools.data
import galaxy.quota
@@ -7,52 +8,61 @@
from galaxy.openid.providers import OpenIDProviders
from galaxy.web import security
from galaxy.tags.tag_handler import CommunityTagHandler
+from tool_shed.grids.util import RepositoryGridFilterManager
import tool_shed.repository_types.registry
+
class UniverseApplication( object ):
"""Encapsulates the state of a Universe application"""
- def __init__( self, **kwargs ):
+
+ def __init__( self, **kwd ):
print >> sys.stderr, "python path is: " + ", ".join( sys.path )
self.name = "tool_shed"
- # Read config file and check for errors
- self.config = config.Configuration( **kwargs )
+ # Read the tool_shed_wsgi.ini configuration file and check for errors.
+ self.config = config.Configuration( **kwd )
self.config.check()
config.configure_logging( self.config )
- # Set up datatypes registry
+ # Initialize the Galaxy datatypes registry.
self.datatypes_registry = galaxy.datatypes.registry.Registry()
self.datatypes_registry.load_datatypes( self.config.root, self.config.datatypes_config )
- # Set up the repository_types registry.
+ # Initialize the Tool Shed repository_types registry.
self.repository_types_registry = tool_shed.repository_types.registry.Registry()
- # Determine the database url
+ # Initialize the RepositoryGridFilterManager.
+ self.repository_grid_filter_manager = RepositoryGridFilterManager()
+ # Determine the Tool Shed database connection string.
if self.config.database_connection:
db_url = self.config.database_connection
else:
db_url = "sqlite:///%s?isolation_level=IMMEDIATE" % self.config.database
- # Initialize database / check for appropriate schema version
+ # Initialize the Tool Shed database and check for appropriate schema version.
from galaxy.webapps.tool_shed.model.migrate.check import create_or_verify_database
create_or_verify_database( db_url, self.config.database_engine_options )
- # Setup the database engine and ORM
+ # Set up the Tool Shed database engine and ORM.
from galaxy.webapps.tool_shed.model import mapping
self.model = mapping.init( self.config.file_path,
db_url,
self.config.database_engine_options )
- # Security helper
+ # Initialize the Tool SHed security helper.
self.security = security.SecurityHelper( id_secret=self.config.id_secret )
- # Tag handler
+ # initialize the Tool Shed tag handler.
self.tag_handler = CommunityTagHandler()
- # Tool data tables - never pass a config file here because the tool shed should always have an empty dictionary!
+ # Initialize the Tool Shed tool data tables. Never pass a configuration file here
+ # because the Tool Shed should always have an empty dictionary!
self.tool_data_tables = galaxy.tools.data.ToolDataTableManager( self.config.tool_data_path )
- # The tool shed has no toolbox, but this attribute is still required.
+ # The Tool Shed makes no use of a Galaxy toolbox, but this attribute is still required.
self.toolbox = tools.ToolBox( [], self.config.tool_path, self )
- # Load security policy
+ # Initialize the Tool Shed security agent.
self.security_agent = self.model.security_agent
+ # The Tool Shed makes no use of a quota, but this attribute is still required.
self.quota_agent = galaxy.quota.NoQuotaAgent( self.model )
# TODO: Add OpenID support
self.openid_providers = OpenIDProviders()
+ # Initialize the baseline Tool Shed statistics component.
self.shed_counter = self.model.shed_counter
- # Let the HgwebConfigManager know where the hgweb.config file is located.
+ # Let the Tool Shed's HgwebConfigManager know where the hgweb.config file is located.
self.hgweb_config_manager = self.model.hgweb_config_manager
self.hgweb_config_manager.hgweb_config_dir = self.config.hgweb_config_dir
print >> sys.stderr, "Tool shed hgweb.config file is: ", self.hgweb_config_manager.hgweb_config
+
def shutdown( self ):
pass
diff -r 55c0a99ff035b9d11adef3a931312c64bb99a45b -r e7b2e3c626322294668c5aab56c830d5a2eb5139 lib/galaxy/webapps/tool_shed/controllers/repository.py
--- a/lib/galaxy/webapps/tool_shed/controllers/repository.py
+++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py
@@ -115,6 +115,10 @@
return trans.response.send_redirect( web.url_for( controller='repository',
action='browse_repositories',
**kwd ) )
+ title = trans.app.repository_grid_filter_manager.get_grid_title( trans,
+ trailing_string='by Category',
+ default='Categories' )
+ self.category_grid.title = title
return self.category_grid( trans, **kwd )
@web.expose
@@ -400,12 +404,16 @@
operation='view_or_manage_repository',
id=trans.security.encode_id( repository.id ),
changeset_revision=selected_changeset_revision ) )
+ title = trans.app.repository_grid_filter_manager.get_grid_title( trans,
+ trailing_string='',
+ default='Repositories' )
+ self.repository_grid.title = title
return self.repository_grid( trans, **kwd )
@web.expose
def browse_repositories_by_user( self, trans, **kwd ):
"""Display the list of repositories owned by a specified user."""
- # Eliminate the current filters if any exist.
+ # Eliminate the current search filters if any exist.
for k, v in kwd.items():
if k.startswith( 'f-' ):
del kwd[ k ]
@@ -433,7 +441,15 @@
changeset_revision=selected_changeset_revision ) )
if user_id:
user = suc.get_user( trans, user_id )
- self.repositories_by_user_grid.title = "Repositories owned by %s" % user.username
+ trailing_string = 'Owned by %s' % str( user.username )
+ default = 'Repositories Owned by %s' % str( user.username )
+ else:
+ trailing_string = ''
+ default='Repositories'
+ title = trans.app.repository_grid_filter_manager.get_grid_title( trans,
+ trailing_string=trailing_string,
+ default=default )
+ self.repositories_by_user_grid.title = title
return self.repositories_by_user_grid( trans, **kwd )
@web.expose
@@ -519,7 +535,15 @@
if category_id:
category = suc.get_category( trans, category_id )
if category:
- self.repositories_in_category_grid.title = 'Category %s' % str( category.name )
+ trailing_string = 'in Category %s' % str( category.name )
+ else:
+ trailing_string = 'in Category'
+ else:
+ trailing_string = 'in Category'
+ title = trans.app.repository_grid_filter_manager.get_grid_title( trans,
+ trailing_string=trailing_string,
+ default='Repositories' )
+ self.repositories_in_category_grid.title = title
return self.repositories_in_category_grid( trans, **kwd )
@web.expose
@@ -767,6 +791,7 @@
@web.expose
def browse_valid_categories( self, trans, **kwd ):
+ """Filter repositories per category by those that are valid for installing into Galaxy."""
# The request came from Galaxy, so restrict category links to display only valid repository changeset revisions.
galaxy_url = suc.handle_galaxy_url( trans, **kwd )
if galaxy_url:
@@ -797,10 +822,15 @@
return trans.response.send_redirect( web.url_for( controller='repository',
action='browse_valid_repositories',
**kwd ) )
+ title = trans.app.repository_grid_filter_manager.get_grid_title( trans,
+ trailing_string='by Category',
+ default='Categories of Valid Repositories' )
+ self.valid_category_grid.title = title
return self.valid_category_grid( trans, **kwd )
@web.expose
def browse_valid_repositories( self, trans, **kwd ):
+ """Filter repositories to those that are installable into Galaxy."""
galaxy_url = suc.handle_galaxy_url( trans, **kwd )
if galaxy_url:
kwd[ 'galaxy_url' ] = galaxy_url
@@ -843,6 +873,10 @@
url_args=url_args,
allow_multiple=False,
async_compatible=False ) ]
+ title = trans.app.repository_grid_filter_manager.get_grid_title( trans,
+ trailing_string='',
+ default='Valid Repositories' )
+ self.valid_repository_grid.title = title
return self.valid_repository_grid( trans, **kwd )
@web.expose
@@ -1962,7 +1996,7 @@
repository_metadata = trans.sa_session.query( trans.model.RepositoryMetadata ).first()
current_user = trans.user
# TODO: move the following to some in-memory register so these queries can be done once
- # at startup. The in-memory registe can then be managed during the current session.
+ # at startup. The in-memory register can then be managed during the current session.
can_administer_repositories = False
has_reviewed_repositories = False
has_deprecated_repositories = False
diff -r 55c0a99ff035b9d11adef3a931312c64bb99a45b -r e7b2e3c626322294668c5aab56c830d5a2eb5139 lib/tool_shed/grids/repository_grids.py
--- a/lib/tool_shed/grids/repository_grids.py
+++ b/lib/tool_shed/grids/repository_grids.py
@@ -41,11 +41,28 @@
class RepositoriesColumn( grids.TextColumn ):
def get_value( self, trans, grid, category ):
+ # TODO: we should probably keep an in-memory register to improve speed here.
if category.repositories:
viewable_repositories = 0
for rca in category.repositories:
- if not rca.repository.deleted and not rca.repository.deprecated:
- viewable_repositories += 1
+ repository = rca.repository
+ filter = trans.app.repository_grid_filter_manager.get_filter( trans )
+ if filter == trans.app.repository_grid_filter_manager.filters.CERTIFIED_LEVEL_ONE:
+ if not repository.deprecated:
+ is_level_one_certified_tuple = metadata_util.is_level_one_certified( trans, repository )
+ latest_installable_changeset_revision, is_level_one_certified = is_level_one_certified_tuple
+ if is_level_one_certified:
+ viewable_repositories += 1
+ elif filter == trans.app.repository_grid_filter_manager.filters.CERTIFIED_LEVEL_ONE_SUITES:
+ if repository.type == rt_util.REPOSITORY_SUITE_DEFINITION and not repository.deprecated:
+ is_level_one_certified_tuple = metadata_util.is_level_one_certified( trans, repository )
+ latest_installable_changeset_revision, is_level_one_certified = is_level_one_certified_tuple
+ if is_level_one_certified:
+ viewable_repositories += 1
+ else:
+ # The value filter is None.
+ if not repository.deleted and not repository.deprecated:
+ viewable_repositories += 1
return viewable_repositories
return 0
@@ -305,82 +322,32 @@
use_paging = False
def build_initial_query( self, trans, **kwd ):
- return trans.sa_session.query( model.Repository ) \
- .filter( and_( model.Repository.table.c.deleted == False,
- model.Repository.table.c.deprecated == False ) ) \
- .join( model.User.table ) \
- .outerjoin( model.RepositoryCategoryAssociation.table ) \
- .outerjoin( model.Category.table )
-
-
-class CertifiedLevelOneRepositoryGrid( RepositoryGrid ):
- columns = [ c for c in RepositoryGrid.columns ]
-
- def build_initial_query( self, trans, **kwd ):
- clause_list = []
- for repository in trans.sa_session.query( model.Repository ) \
- .filter( and_( model.Repository.table.c.deleted == False,
- model.Repository.table.c.deprecated == False ) ):
- repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) )
- # Get the list of latest installable changeset revision for each repository since that is all
- # that is currently configured for testing.
- if repository.type in [ rt_util.REPOSITORY_SUITE_DEFINITION, rt_util.TOOL_DEPENDENCY_DEFINITION ]:
- # We can use the changelog tip.
- latest_changeset_revision = str( repo.changectx( repo.changelog.tip() ) )
- else:
- latest_changeset_revision = suc.get_latest_downloadable_changeset_revision( trans, repository, repo )
- if latest_changeset_revision not in [ None, suc.INITIAL_CHANGELOG_HASH ]:
- encoded_repository_id = trans.security.encode_id( repository.id )
- repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans,
- encoded_repository_id,
- latest_changeset_revision )
- # Filter out repository revisions that have not been tested.
- if repository_metadata.time_last_tested is not None and repository_metadata.tool_test_results is not None:
- if repository.type in [ rt_util.REPOSITORY_SUITE_DEFINITION, rt_util.TOOL_DEPENDENCY_DEFINITION ]:
- # Look in the tool_test_results dictionary for installation errors.
- try:
- tool_test_results_dict = repository_metadata.tool_test_results[ -1 ]
- except Exception, e:
- # The repository is not certified.
- continue
- if 'installation_errors' in tool_test_results_dict:
- continue
- # The revision is level 1 certified
- clause_list.append( "%s=%d and %s='%s'" % ( model.RepositoryMetadata.table.c.repository_id,
- repository.id,
- model.RepositoryMetadata.table.c.changeset_revision,
- changeset_revision ) )
- else:
- # We have an unrestricted repository.
- if latest_changeset_revision.includes_tools:
- if latest_changeset_revision.tools_functionally_correct:
- # The revision is level 1 certified
- clause_list.append( "%s=%d and %s='%s'" % ( model.RepositoryMetadata.table.c.repository_id,
- repository.id,
- model.RepositoryMetadata.table.c.changeset_revision,
- changeset_revision ) )
- else:
- # Look in the tool_test_results dictionary for installation errors.
- try:
- tool_test_results_dict = repository_metadata.tool_test_results[ -1 ]
- except Exception, e:
- # The repository is not certified.
- continue
- if 'installation_errors' in tool_test_results_dict:
- continue
- # The revision is level 1 certified
- clause_list.append( "%s=%d and %s='%s'" % ( model.RepositoryMetadata.table.c.repository_id,
- repository.id,
- model.RepositoryMetadata.table.c.changeset_revision,
- changeset_revision ) )
- return trans.sa_session.query( model.Repository ) \
- .filter( and_( model.Repository.table.c.deleted == False,
- model.Repository.table.c.deprecated == False ) ) \
- .join( model.RepositoryMetadata.table ) \
- .filter( or_( *clause_list ) ) \
- .join( model.User.table ) \
- .outerjoin( model.RepositoryCategoryAssociation.table ) \
- .outerjoin( model.Category.table )
+ filter = trans.app.repository_grid_filter_manager.get_filter( trans )
+ if filter == trans.app.repository_grid_filter_manager.filters.CERTIFIED_LEVEL_ONE:
+ clause_list = get_certified_level_one_clause_list( trans )
+ return trans.sa_session.query( model.Repository ) \
+ .join( model.RepositoryMetadata.table ) \
+ .filter( or_( *clause_list ) ) \
+ .join( model.User.table ) \
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table )
+ if filter == trans.app.repository_grid_filter_manager.filters.CERTIFIED_LEVEL_ONE_SUITES:
+ clause_list = get_certified_level_one_clause_list( trans )
+ return trans.sa_session.query( model.Repository ) \
+ .filter( model.Repository.type == rt_util.REPOSITORY_SUITE_DEFINITION ) \
+ .join( model.RepositoryMetadata.table ) \
+ .filter( or_( *clause_list ) ) \
+ .join( model.User.table ) \
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table )
+ else:
+ # The filter is None.
+ return trans.sa_session.query( model.Repository ) \
+ .filter( and_( model.Repository.table.c.deleted == False,
+ model.Repository.table.c.deprecated == False ) ) \
+ .join( model.User.table ) \
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table )
class EmailAlertsRepositoryGrid( RepositoryGrid ):
@@ -566,13 +533,35 @@
def build_initial_query( self, trans, **kwd ):
decoded_user_id = trans.security.decode_id( kwd[ 'user_id' ] )
- return trans.sa_session.query( model.Repository ) \
- .filter( and_( model.Repository.table.c.deleted == False,
- model.Repository.table.c.deprecated == False,
- model.Repository.table.c.user_id == decoded_user_id ) ) \
- .join( model.User.table ) \
- .outerjoin( model.RepositoryCategoryAssociation.table ) \
- .outerjoin( model.Category.table )
+ filter = trans.app.repository_grid_filter_manager.get_filter( trans )
+ if filter == trans.app.repository_grid_filter_manager.filters.CERTIFIED_LEVEL_ONE:
+ clause_list = get_certified_level_one_clause_list( trans )
+ return trans.sa_session.query( model.Repository ) \
+ .filter( model.Repository.table.c.user_id == decoded_user_id ) \
+ .join( model.RepositoryMetadata.table ) \
+ .filter( or_( *clause_list ) ) \
+ .join( model.User.table ) \
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table )
+ if filter == trans.app.repository_grid_filter_manager.filters.CERTIFIED_LEVEL_ONE_SUITES:
+ clause_list = get_certified_level_one_clause_list( trans )
+ return trans.sa_session.query( model.Repository ) \
+ .filter( and_( model.Repository.type == rt_util.REPOSITORY_SUITE_DEFINITION,
+ model.Repository.table.c.user_id == decoded_user_id ) ) \
+ .join( model.RepositoryMetadata.table ) \
+ .filter( or_( *clause_list ) ) \
+ .join( model.User.table ) \
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table )
+ else:
+ # The value of filter is None.
+ return trans.sa_session.query( model.Repository ) \
+ .filter( and_( model.Repository.table.c.deleted == False,
+ model.Repository.table.c.deprecated == False,
+ model.Repository.table.c.user_id == decoded_user_id ) ) \
+ .join( model.User.table ) \
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table )
class RepositoriesInCategoryGrid( RepositoryGrid ):
@@ -610,22 +599,63 @@
def build_initial_query( self, trans, **kwd ):
category_id = kwd.get( 'id', None )
- if category_id:
- category = suc.get_category( trans, category_id )
- if category:
- return trans.sa_session.query( model.Repository ) \
- .filter( and_( model.Repository.table.c.deleted == False,
- model.Repository.table.c.deprecated == False ) ) \
- .join( model.User.table ) \
- .outerjoin( model.RepositoryCategoryAssociation.table ) \
- .outerjoin( model.Category.table ) \
- .filter( model.Category.table.c.name == category.name )
- return trans.sa_session.query( model.Repository ) \
- .filter( and_( model.Repository.table.c.deleted == False,
- model.Repository.table.c.deprecated == False ) ) \
- .join( model.User.table ) \
- .outerjoin( model.RepositoryCategoryAssociation.table ) \
- .outerjoin( model.Category.table )
+ filter = trans.app.repository_grid_filter_manager.get_filter( trans )
+ if filter == trans.app.repository_grid_filter_manager.filters.CERTIFIED_LEVEL_ONE:
+ clause_list = get_certified_level_one_clause_list( trans )
+ if category_id:
+ category = suc.get_category( trans, category_id )
+ if category:
+ return trans.sa_session.query( model.Repository ) \
+ .join( model.RepositoryMetadata.table ) \
+ .filter( or_( *clause_list ) ) \
+ .join( model.User.table ) \
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table ) \
+ .filter( model.Category.table.c.name == category.name )
+ return trans.sa_session.query( model.Repository ) \
+ .join( model.RepositoryMetadata.table ) \
+ .filter( or_( *clause_list ) ) \
+ .join( model.User.table ) \
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table )
+ if filter == trans.app.repository_grid_filter_manager.filters.CERTIFIED_LEVEL_ONE_SUITES:
+ clause_list = get_certified_level_one_clause_list( trans )
+ if category_id:
+ category = suc.get_category( trans, category_id )
+ if category:
+ return trans.sa_session.query( model.Repository ) \
+ .filter( model.Repository.type == rt_util.REPOSITORY_SUITE_DEFINITION ) \
+ .join( model.RepositoryMetadata.table ) \
+ .filter( or_( *clause_list ) ) \
+ .join( model.User.table ) \
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table ) \
+ .filter( model.Category.table.c.name == category.name )
+ return trans.sa_session.query( model.Repository ) \
+ .filter( model.Repository.type == rt_util.REPOSITORY_SUITE_DEFINITION ) \
+ .join( model.RepositoryMetadata.table ) \
+ .filter( or_( *clause_list ) ) \
+ .join( model.User.table ) \
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table )
+ else:
+ # The value of filter is None.
+ if category_id:
+ category = suc.get_category( trans, category_id )
+ if category:
+ return trans.sa_session.query( model.Repository ) \
+ .filter( and_( model.Repository.table.c.deleted == False,
+ model.Repository.table.c.deprecated == False ) ) \
+ .join( model.User.table ) \
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table ) \
+ .filter( model.Category.table.c.name == category.name )
+ return trans.sa_session.query( model.Repository ) \
+ .filter( and_( model.Repository.table.c.deleted == False,
+ model.Repository.table.c.deprecated == False ) ) \
+ .join( model.User.table ) \
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table )
class RepositoriesIOwnGrid( RepositoryGrid ):
@@ -767,8 +797,8 @@
if username in allow_push_usernames:
user_clause_list.append( model.Repository.table.c.id == repository.id )
if user_clause_list:
- # We have the list of repositories that the current user is authorized to update, so filter further by latest installable revisions that contain
- # tools with missing tool test components.
+ # We have the list of repositories that the current user is authorized to update, so filter
+ # further by latest installable revisions that contain tools with missing tool test components.
revision_clause_list = []
for repository in trans.sa_session.query( model.Repository ) \
.filter( and_( model.Repository.table.c.deprecated == False,
@@ -854,8 +884,8 @@
if username in allow_push_usernames:
user_clause_list.append( model.Repository.table.c.id == repository.id )
if user_clause_list:
- # We have the list of repositories that the current user is authorized to update, so filter further by latest installable revisions that contain
- # tools with missing tool test components.
+ # We have the list of repositories that the current user is authorized to update, so filter
+ # further by latest installable revisions that contain tools with missing tool test components.
revision_clause_list = []
for repository in trans.sa_session.query( model.Repository ) \
.filter( and_( model.Repository.table.c.deprecated == False,
@@ -941,8 +971,8 @@
if username in allow_push_usernames:
user_clause_list.append( model.Repository.table.c.id == repository.id )
if user_clause_list:
- # We have the list of repositories that the current user is authorized to update, so filter further by latest installable revisions that contain
- # tools with missing tool test components.
+ # We have the list of repositories that the current user is authorized to update, so filter
+ # further by latest installable revisions that contain tools with missing tool test components.
revision_clause_list = []
for repository in trans.sa_session.query( model.Repository ) \
.filter( and_( model.Repository.table.c.deprecated == False,
@@ -1060,8 +1090,8 @@
if username in allow_push_usernames:
user_clause_list.append( model.Repository.table.c.id == repository.id )
if user_clause_list:
- # We have the list of repositories that the current user is authorized to update, so filter further by latest installable revisions that contain
- # tools with at least 1 failing tool test.
+ # We have the list of repositories that the current user is authorized to update, so filter
+ # further by latest installable revisions that contain tools with at least 1 failing tool test.
revision_clause_list = []
for repository in trans.sa_session.query( model.Repository ) \
.filter( and_( model.Repository.table.c.deprecated == False,
@@ -1107,8 +1137,8 @@
use_paging = False
def build_initial_query( self, trans, **kwd ):
- # We have the list of repositories that the current user is authorized to update, so filter further by latest installable revisions that contain
- # tools with at least 1 failing tool test.
+ # We have the list of repositories that the current user is authorized to update, so filter
+ # further by latest installable revisions that contain tools with at least 1 failing tool test.
revision_clause_list = []
for repository in trans.sa_session.query( model.Repository ) \
.filter( and_( model.Repository.table.c.deprecated == False,
@@ -1148,8 +1178,9 @@
if username in allow_push_usernames:
user_clause_list.append( model.Repository.table.c.id == repository.id )
if user_clause_list:
- # We have the list of repositories that the current user is authorized to update, so filter further by latest installable revisions that contain
- # at least 1 tool, no missing tool test components, and no failing tool tests.
+ # We have the list of repositories that the current user is authorized to update, so filter
+ # further by latest installable revisions that contain at least 1 tool, no missing tool test
+ # components, and no failing tool tests.
revision_clause_list = []
for repository in trans.sa_session.query( model.Repository ) \
.filter( and_( model.Repository.table.c.deprecated == False,
@@ -1254,8 +1285,8 @@
if username in allow_push_usernames:
user_clause_list.append( model.Repository.table.c.id == repository.id )
if user_clause_list:
- # We have the list of repositories that the current user is authorized to update, so filter further by latest metadata revisions that contain
- # invalid tools.
+ # We have the list of repositories that the current user is authorized to update, so filter
+ # further by latest metadata revisions that contain invalid tools.
revision_clause_list = []
for repository in trans.sa_session.query( model.Repository ) \
.filter( and_( model.Repository.table.c.deprecated == False,
@@ -1709,16 +1740,33 @@
class RepositoriesColumn( grids.TextColumn ):
def get_value( self, trans, grid, category ):
+ # TODO: We should probably keep in in-memory register for speed improvements.
if category.repositories:
viewable_repositories = 0
for rca in category.repositories:
repository = rca.repository
- if not repository.deleted and not repository.deprecated and repository.downloadable_revisions:
- viewable_repositories += 1
+ filter = trans.app.repository_grid_filter_manager.get_filter( trans )
+ if filter == trans.app.repository_grid_filter_manager.filters.CERTIFIED_LEVEL_ONE:
+ if not repository.deprecated and repository.downloadable_revisions:
+ is_level_one_certified_tuple = metadata_util.is_level_one_certified( trans, repository )
+ latest_installable_changeset_revision, is_level_one_certified = is_level_one_certified_tuple
+ if is_level_one_certified:
+ viewable_repositories += 1
+ if filter == trans.app.repository_grid_filter_manager.filters.CERTIFIED_LEVEL_ONE_SUITES:
+ if repository.type == rt_util.REPOSITORY_SUITE_DEFINITION and \
+ not repository.deprecated and repository.downloadable_revisions:
+ is_level_one_certified_tuple = metadata_util.is_level_one_certified( trans, repository )
+ latest_installable_changeset_revision, is_level_one_certified = is_level_one_certified_tuple
+ if is_level_one_certified:
+ viewable_repositories += 1
+ else:
+ # The value of filter is None.
+ if not repository.deleted and not repository.deprecated and repository.downloadable_revisions:
+ viewable_repositories += 1
return viewable_repositories
return 0
- title = "Categories of valid repositories"
+ title = "Categories of Valid Repositories"
model_class = model.Category
template='/webapps/tool_shed/category/valid_grid.mako'
default_sort_key = "name"
@@ -1786,7 +1834,7 @@
return select_field.options[ 0 ][ 0 ]
return ''
- title = "Valid repositories"
+ title = "Valid Repositories"
columns = [
RepositoryGrid.NameColumn( "Name",
key="name",
@@ -1815,26 +1863,72 @@
use_paging = False
def build_initial_query( self, trans, **kwd ):
+ filter = trans.app.repository_grid_filter_manager.get_filter( trans )
if 'id' in kwd:
- # The user is browsing categories of valid repositories, so filter the request by the received id, which is a category id.
+ # The user is browsing categories of valid repositories, so filter the request by the received id,
+ # which is a category id.
+ if filter == trans.app.repository_grid_filter_manager.filters.CERTIFIED_LEVEL_ONE:
+ clause_list = get_certified_level_one_clause_list( trans )
+ return trans.sa_session.query( model.Repository ) \
+ .join( model.RepositoryMetadata.table ) \
+ .filter( or_( *clause_list ) ) \
+ .join( model.User.table ) \
+ .join( model.RepositoryCategoryAssociation.table ) \
+ .join( model.Category.table ) \
+ .filter( and_( model.Category.table.c.id == trans.security.decode_id( kwd[ 'id' ] ),
+ model.RepositoryMetadata.table.c.downloadable == True ) )
+ if filter == trans.app.repository_grid_filter_manager.filters.CERTIFIED_LEVEL_ONE_SUITES:
+ clause_list = get_certified_level_one_clause_list( trans )
+ return trans.sa_session.query( model.Repository ) \
+ .filter( model.Repository.type == rt_util.REPOSITORY_SUITE_DEFINITION ) \
+ .join( model.RepositoryMetadata.table ) \
+ .filter( or_( *clause_list ) ) \
+ .join( model.User.table ) \
+ .join( model.RepositoryCategoryAssociation.table ) \
+ .join( model.Category.table ) \
+ .filter( and_( model.Category.table.c.id == trans.security.decode_id( kwd[ 'id' ] ),
+ model.RepositoryMetadata.table.c.downloadable == True ) )
+ else:
+ # The value of filter is None.
+ return trans.sa_session.query( model.Repository ) \
+ .filter( and_( model.Repository.table.c.deleted == False,
+ model.Repository.table.c.deprecated == False ) ) \
+ .join( model.RepositoryMetadata.table ) \
+ .join( model.User.table ) \
+ .join( model.RepositoryCategoryAssociation.table ) \
+ .join( model.Category.table ) \
+ .filter( and_( model.Category.table.c.id == trans.security.decode_id( kwd[ 'id' ] ),
+ model.RepositoryMetadata.table.c.downloadable == True ) )
+ # The user performed a free text search on the ValidCategoryGrid.
+ if filter == trans.app.repository_grid_filter_manager.filters.CERTIFIED_LEVEL_ONE:
+ clause_list = get_certified_level_one_clause_list( trans )
+ return trans.sa_session.query( model.Repository ) \
+ .join( model.RepositoryMetadata.table ) \
+ .filter( or_( *clause_list ) ) \
+ .join( model.User.table ) \
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table ) \
+ .filter( model.RepositoryMetadata.table.c.downloadable == True )
+ if filter == trans.app.repository_grid_filter_manager.filters.CERTIFIED_LEVEL_ONE_SUITES:
+ clause_list = get_certified_level_one_clause_list( trans )
+ return trans.sa_session.query( model.Repository ) \
+ .filter( model.Repository.type == rt_util.REPOSITORY_SUITE_DEFINITION ) \
+ .join( model.RepositoryMetadata.table ) \
+ .filter( or_( *clause_list ) ) \
+ .join( model.User.table ) \
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table ) \
+ .filter( model.RepositoryMetadata.table.c.downloadable == True )
+ else:
+ # The value of filter is None.
return trans.sa_session.query( model.Repository ) \
.filter( and_( model.Repository.table.c.deleted == False,
model.Repository.table.c.deprecated == False ) ) \
.join( model.RepositoryMetadata.table ) \
.join( model.User.table ) \
- .join( model.RepositoryCategoryAssociation.table ) \
- .join( model.Category.table ) \
- .filter( and_( model.Category.table.c.id == trans.security.decode_id( kwd[ 'id' ] ),
- model.RepositoryMetadata.table.c.downloadable == True ) )
- # The user performed a free text search on the ValidCategoryGrid.
- return trans.sa_session.query( model.Repository ) \
- .filter( and_( model.Repository.table.c.deleted == False,
- model.Repository.table.c.deprecated == False ) ) \
- .join( model.RepositoryMetadata.table ) \
- .join( model.User.table ) \
- .outerjoin( model.RepositoryCategoryAssociation.table ) \
- .outerjoin( model.Category.table ) \
- .filter( model.RepositoryMetadata.table.c.downloadable == True )
+ .outerjoin( model.RepositoryCategoryAssociation.table ) \
+ .outerjoin( model.Category.table ) \
+ .filter( model.RepositoryMetadata.table.c.downloadable == True )
# ------ utility methods -------------------
@@ -1914,6 +2008,20 @@
return repository_metadata.changeset_revision
return None
+def get_certified_level_one_clause_list( trans ):
+ clause_list = []
+ for repository in trans.sa_session.query( model.Repository ) \
+ .filter( and_( model.Repository.table.c.deleted == False,
+ model.Repository.table.c.deprecated == False ) ):
+ is_level_one_certified_tuple = metadata_util.is_level_one_certified( trans, repository )
+ latest_installable_changeset_revision, is_level_one_certified = is_level_one_certified_tuple
+ if is_level_one_certified:
+ clause_list.append( "%s=%d and %s='%s'" % ( model.RepositoryMetadata.table.c.repository_id,
+ repository.id,
+ model.RepositoryMetadata.table.c.changeset_revision,
+ latest_installable_changeset_revision ) )
+ return clause_list
+
def get_latest_downloadable_repository_metadata( trans, repository ):
"""
Return the latest downloadable repository_metadata record for the received repository. This will
diff -r 55c0a99ff035b9d11adef3a931312c64bb99a45b -r e7b2e3c626322294668c5aab56c830d5a2eb5139 lib/tool_shed/grids/util.py
--- a/lib/tool_shed/grids/util.py
+++ b/lib/tool_shed/grids/util.py
@@ -1,7 +1,52 @@
-import os, logging
+import logging
+import os
import tool_shed.util.shed_util_common as suc
import tool_shed.util.metadata_util as metadata_util
from galaxy.web.form_builder import SelectField
+from galaxy.util.bunch import Bunch
+
+log = logging.getLogger( __name__ )
+
+
+class RepositoryGridFilterManager( object ):
+ """Provides filtered views of the many Tool SHed repository grids."""
+
+ filters = Bunch( CERTIFIED_LEVEL_ONE = 'certified_level_one',
+ CERTIFIED_LEVEL_TWO = 'certified_level_two',
+ CERTIFIED_LEVEL_ONE_SUITES = 'certified_level_one_suites',
+ CERTIFIED_LEVEL_TWO_SUITES = 'certified_level_two_suites' )
+
+ def get_grid_title( self, trans, trailing_string='', default='' ):
+ filter = self.get_filter( trans )
+ if filter == self.filters.CERTIFIED_LEVEL_ONE:
+ return "Certified 1 Repositories %s" % trailing_string
+ if filter == self.filters.CERTIFIED_LEVEL_TWO:
+ return "Certified 2 Repositories %s" % trailing_string
+ if filter == self.filters.CERTIFIED_LEVEL_ONE_SUITES:
+ return "Certified 1 Repository Suites %s" % trailing_string
+ if filter == self.filters.CERTIFIED_LEVEL_TWO_SUITES:
+ return "Certified 2 Repository Suites %s" % trailing_string
+ return "%s" % default
+
+ def get_filter( self, trans ):
+ filter = trans.get_cookie( name='toolshedrepogridfilter' )
+ return filter or None
+
+ def is_valid_filter( self, filter ):
+ if filter is None:
+ return True
+ for valid_key, valid_filter in self.filters.items():
+ if filter == valid_filter:
+ return True
+ return False
+
+ def set_filter( self, trans, **kwd ):
+ # Set a session cookie value with the selected filter.
+ filter = kwd.get( 'filter', None )
+ if filter is not None and self.is_valid_filter( filter ):
+ trans.set_cookie( value=filter, name='toolshedrepogridfilter' )
+ # if the filter is not valid, expire the cookie.
+ trans.set_cookie( value=filter,name='toolshedrepogridfilter', age=-1 )
def build_approved_select_field( trans, name, selected_value=None, for_component=True ):
options = [ ( 'No', trans.model.ComponentReview.approved_states.NO ),
@@ -18,7 +63,10 @@
def build_changeset_revision_select_field( trans, repository, selected_value=None, add_id_to_name=True,
downloadable=False, reviewed=False, not_reviewed=False ):
- """Build a SelectField whose options are the changeset_rev strings of certain revisions of the received repository."""
+ """
+ Build a SelectField whose options are the changeset_rev strings of certain revisions of the
+ received repository.
+ """
options = []
changeset_tups = []
refresh_on_change_values = []
diff -r 55c0a99ff035b9d11adef3a931312c64bb99a45b -r e7b2e3c626322294668c5aab56c830d5a2eb5139 lib/tool_shed/util/metadata_util.py
--- a/lib/tool_shed/util/metadata_util.py
+++ b/lib/tool_shed/util/metadata_util.py
@@ -1349,6 +1349,63 @@
return True
return False
+def is_level_one_certified( trans, repository ):
+ """
+ Return True if the latest installable changeset_revision of the received repository is level one certified.
+ """
+ if repository.deleted:
+ return ( None, False )
+ repo = hg.repository( suc.get_configured_ui(), repository.repo_path( trans.app ) )
+ # Get the latest installable changeset revision since that is all that is currently configured for testing.
+ latest_installable_changeset_revision = suc.get_latest_downloadable_changeset_revision( trans, repository, repo )
+ if latest_installable_changeset_revision not in [ None, suc.INITIAL_CHANGELOG_HASH ]:
+ encoded_repository_id = trans.security.encode_id( repository.id )
+ repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans,
+ encoded_repository_id,
+ latest_installable_changeset_revision )
+ if repository_metadata:
+ # Filter out repository revisions that have not been tested.
+ if repository_metadata.time_last_tested is not None and repository_metadata.tool_test_results is not None:
+ if repository.type in [ rt_util.REPOSITORY_SUITE_DEFINITION, rt_util.TOOL_DEPENDENCY_DEFINITION ]:
+ # Look in the tool_test_results dictionary for installation errors.
+ try:
+ tool_test_results_dict = repository_metadata.tool_test_results[ 0 ]
+ except Exception, e:
+ message = 'Error attempting to retrieve install and test results for repository %s:\n' % str( repository.name )
+ message += '%s' % str( e )
+ log.exception( message )
+ return ( latest_installable_changeset_revision, False )
+ if 'installation_errors' in tool_test_results_dict:
+ return ( latest_installable_changeset_revision, False )
+ return ( latest_installable_changeset_revision, True )
+ else:
+ # We have a repository with type Unrestricted.
+ if repository_metadata.includes_tools:
+ if repository_metadata.tools_functionally_correct:
+ return ( latest_installable_changeset_revision, True )
+ return ( latest_installable_changeset_revision, False )
+ else:
+ # Look in the tool_test_results dictionary for installation errors.
+ try:
+ tool_test_results_dict = repository_metadata.tool_test_results[ 0 ]
+ except Exception, e:
+ message = 'Error attempting to retrieve install and test results for repository %s:\n' % str( repository.name )
+ message += '%s' % str( e )
+ log.exception( message )
+ return ( latest_installable_changeset_revision, False )
+ if 'installation_errors' in tool_test_results_dict:
+ return ( latest_installable_changeset_revision, False )
+ return ( latest_installable_changeset_revision, True )
+ else:
+ # No test results.
+ return ( latest_installable_changeset_revision, False )
+ else:
+ # No repository_metadata.
+ return ( latest_installable_changeset_revision, False )
+ else:
+ # No installable changeset_revision.
+ return ( None, False )
+
def new_datatypes_metadata_required( trans, repository_metadata, metadata_dict ):
"""
Compare the last saved metadata for each datatype in the repository with the new metadata in metadata_dict to determine if a new
diff -r 55c0a99ff035b9d11adef3a931312c64bb99a45b -r e7b2e3c626322294668c5aab56c830d5a2eb5139 templates/webapps/tool_shed/category/grid.mako
--- a/templates/webapps/tool_shed/category/grid.mako
+++ b/templates/webapps/tool_shed/category/grid.mako
@@ -3,11 +3,11 @@
<%namespace name="grid_common" file="../common/grid_common.mako" import="*" /><%def name="insert()">
-<%
- from tool_shed.grids.repository_grids import RepositoryGrid
- repo_grid = RepositoryGrid()
- grid_common.render_grid_filters(repo_grid)
-%>
+ <%
+ from tool_shed.grids.repository_grids import RepositoryGrid
+ repo_grid = RepositoryGrid()
+ grid_common.render_grid_filters(repo_grid)
+ %></%def>
-${grid_base.load(False, capture(self.insert))}
\ No newline at end of file
+${grid_base.load(False, capture(self.insert))}
diff -r 55c0a99ff035b9d11adef3a931312c64bb99a45b -r e7b2e3c626322294668c5aab56c830d5a2eb5139 test/tool_shed/functional/test_0420_citable_urls_for_repositories.py
--- a/test/tool_shed/functional/test_0420_citable_urls_for_repositories.py
+++ b/test/tool_shed/functional/test_0420_citable_urls_for_repositories.py
@@ -207,7 +207,7 @@
strings_displayed = [ '/repository', 'browse_repositories', 'user1' ]
strings_displayed.extend( [ 'list+of+repositories+owned', 'does+not+include+one+named', '%21%21invalid%21%21', 'status=error' ] )
strings_displayed_in_iframe = [ 'user1', 'filtering_0420' ]
- strings_displayed_in_iframe.append( 'Repositories owned by user1' )
+ strings_displayed_in_iframe.append( 'Repositories Owned by user1' )
strings_displayed_in_iframe.append( tip_revision )
self.load_citable_url( username='user1',
repository_name='!!invalid!!',
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: dan: When a tool dependency has failed to install, display the error message as pretty escaped html.
by commits-noreply@bitbucket.org 02 Apr '14
by commits-noreply@bitbucket.org 02 Apr '14
02 Apr '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/55c0a99ff035/
Changeset: 55c0a99ff035
User: dan
Date: 2014-04-02 21:15:00
Summary: When a tool dependency has failed to install, display the error message as pretty escaped html.
Affected #: 1 file
diff -r 36410a555b2a9e587f4f24ea4ddfc120fde76fd5 -r 55c0a99ff035b9d11adef3a931312c64bb99a45b templates/admin/tool_shed_repository/manage_repository_tool_dependencies.mako
--- a/templates/admin/tool_shed_repository/manage_repository_tool_dependencies.mako
+++ b/templates/admin/tool_shed_repository/manage_repository_tool_dependencies.mako
@@ -31,7 +31,8 @@
%for tool_dependency in repository.tool_dependencies:
<%
if tool_dependency.error_message:
- error_message = tool_dependency.error_message
+ from tool_shed.util.shed_util_common import to_html_string
+ error_message = to_html_string( tool_dependency.error_message )
else:
error_message = ''
if not can_install:
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: libraries: more refactoring; basic UI based on role handling; attaching to global Galaxy object; persistent lib preferences
by commits-noreply@bitbucket.org 02 Apr '14
by commits-noreply@bitbucket.org 02 Apr '14
02 Apr '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/36410a555b2a/
Changeset: 36410a555b2a
User: martenson
Date: 2014-04-02 17:07:04
Summary: libraries: more refactoring; basic UI based on role handling; attaching to global Galaxy object; persistent lib preferences
Affected #: 11 files
diff -r 9d91895363591d3c1eb8f18fac8fa6511aa19e52 -r 36410a555b2a9e587f4f24ea4ddfc120fde76fd5 static/scripts/galaxy.library.js
--- a/static/scripts/galaxy.library.js
+++ b/static/scripts/galaxy.library.js
@@ -10,6 +10,7 @@
"galaxy.masthead",
"utils/utils",
"libs/toastr",
+ "mvc/base-mvc",
"mvc/library/library-model",
"mvc/library/library-folderlist-view",
"mvc/library/library-librarylist-view",
@@ -17,6 +18,7 @@
function(mod_masthead,
mod_utils,
mod_toastr,
+ mod_baseMVC,
mod_library_model,
mod_folderlist_view,
mod_librarylist_view,
@@ -32,40 +34,51 @@
}
});
+// ============================================================================
+/** session storage for library preferences */
+var LibraryPrefs = mod_baseMVC.SessionStorageModel.extend({
+ defaults : {
+ with_deleted : false,
+ sort_order : 'asc',
+ sort_by : 'name'
+ }
+});
+
// galaxy library wrapper View
var GalaxyLibrary = Backbone.View.extend({
+ toolbarView: null,
+ libraryListView: null,
+ library_router: null,
+ folderContentView: null,
+ initialize : function(){
+ Galaxy.libraries = this;
- initialize : function(){
- // toolbarView = new mod_librarytoolbar_view.ToolbarView();
- toolbarView = null;
- // libraryListView = new mod_librarylist_view.LibraryListView();
- libraryListView = null;
- library_router = new LibraryRouter();
+ this.preferences = new LibraryPrefs( {id: 'global-lib-prefs'} );
- folderContentView = null;
+ this.library_router = new LibraryRouter();
- library_router.on('route:libraries', function() {
+ this.library_router.on('route:libraries', function() {
// initialize and render the toolbar first
- toolbarView = new mod_librarytoolbar_view.ToolbarView();
+ Galaxy.libraries.toolbarView = new mod_librarytoolbar_view.ToolbarView();
// initialize and render libraries second
- libraryListView = new mod_librarylist_view.LibraryListView();
+ Galaxy.libraries.libraryListView = new mod_librarylist_view.LibraryListView();
});
- library_router.on('route:folder_content', function(id) {
+ this.library_router.on('route:folder_content', function(id) {
// render folder contents
- if (!folderContentView) {folderContentView = new mod_folderlist_view.FolderContentView();}
- folderContentView.render({id: id});
+ if (!Galaxy.libraries.folderContentView) {Galaxy.libraries.folderContentView = new mod_folderlist_view.FolderContentView();}
+ Galaxy.libraries.folderContentView.render({id: id});
});
- library_router.on('route:download', function(folder_id, format) {
+ this.library_router.on('route:download', function(folder_id, format) {
if ($('#center').find(':checked').length === 0) {
// this happens rarely when there is a server/data error and client gets an actual response instead of an attachment
// we don't know what was selected so we can't download again, we redirect to the folder provided
- library_router.navigate('folders/' + folder_id, {trigger: true, replace: true});
+ Galaxy.libraries.library_router.navigate('folders/' + folder_id, {trigger: true, replace: true});
} else {
// send download stream
- folderContentView.download(folder_id, format);
- library_router.navigate('folders/' + folder_id, {trigger: false, replace: true});
+ Galaxy.libraries.folderContentView.download(folder_id, format);
+ Galaxy.libraries.library_router.navigate('folders/' + folder_id, {trigger: false, replace: true});
}
});
diff -r 9d91895363591d3c1eb8f18fac8fa6511aa19e52 -r 36410a555b2a9e587f4f24ea4ddfc120fde76fd5 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
@@ -13,14 +13,6 @@
mod_library_model,
mod_library_libraryrow_view) {
-// ============================================================================
-/** session storage for library preferences */
-var LibraryPrefs = mod_baseMVC.SessionStorageModel.extend({
- defaults : {
- with_deleted : false
- }
-});
-
// galaxy library view
var LibraryListView = Backbone.View.extend({
el: '#libraries_element',
@@ -38,8 +30,6 @@
collection: null,
- preferences: null,
-
// map of library model ids to library views = cache
rowViews: {},
@@ -49,8 +39,6 @@
this.rowViews = {};
- this.preferences = new LibraryPrefs({id: 'global-lib-prefs'});
-
this.collection = new mod_library_model.Libraries();
this.collection.fetch({
@@ -69,7 +57,8 @@
render: function (options) {
var template = this.templateLibraryList();
var libraries_to_render = null;
- var include_deleted = this.preferences.get('with_deleted');
+ var include_deleted = true;
+ var include_deleted = Galaxy.libraries.preferences.get('with_deleted');
var models = null
if (typeof options !== 'undefined'){
include_deleted = typeof options.with_deleted !== 'undefined' ? options.with_deleted : false;
@@ -88,7 +77,7 @@
libraries_to_render = [];
}
- this.$el.html(template({length: libraries_to_render.length, order: this.collection.sort_order}));
+ this.$el.html(template({length: libraries_to_render.length, order: Galaxy.libraries.preferences.get('sort_order') }));
this.renderRows(libraries_to_render);
// initialize the library tooltips
@@ -125,10 +114,12 @@
// },
sort_clicked : function(){
- if (this.collection.sort_order == 'asc'){
+ if (Galaxy.libraries.preferences.get('sort_order') === 'asc'){
this.sortLibraries('name','desc');
+ Galaxy.libraries.preferences.set({'sort_order': 'desc'});
} else {
this.sortLibraries('name','asc');
+ Galaxy.libraries.preferences.set({'sort_order': 'asc'});
}
this.render();
},
@@ -138,14 +129,14 @@
sortLibraries: function(sort_by, order){
if (sort_by === 'name'){
if (order === 'asc'){
- this.collection.sort_order = 'asc';
+ // this.collection.sort_order = 'asc';
this.collection.comparator = function(libraryA, libraryB){
if (libraryA.get('name').toLowerCase() > libraryB.get('name').toLowerCase()) return 1; // after
if (libraryB.get('name').toLowerCase() > libraryA.get('name').toLowerCase()) return -1; // before
return 0; // equal
}
} else if (order === 'desc'){
- this.collection.sort_order = 'desc';
+ // this.collection.sort_order = 'desc';
this.collection.comparator = function(libraryA, libraryB){
if (libraryA.get('name').toLowerCase() > libraryB.get('name').toLowerCase()) return -1; // before
if (libraryB.get('name').toLowerCase() > libraryA.get('name').toLowerCase()) return 1; // after
@@ -234,7 +225,7 @@
patch: true,
success: function(library) {
mod_toastr.success('Changes to library saved');
- galaxyLibraryview.toggle_library_modification($library_row);
+ Galaxy.libraries.libraryListView.toggle_library_modification($library_row);
},
error: function(model, response){
mod_toastr.error('An error occured during updating the library :(');
@@ -316,7 +307,7 @@
// add the newly undeleted library back to the collection
// backbone does not accept changes through destroy, so update it too
library.set('deleted', false);
- galaxyLibraryview.collection.add(library);
+ Galaxy.libraries.libraryListView.collection.add(library);
$library_row.removeClass('active');
mod_toastr.success('Library has been undeleted');
},
@@ -337,7 +328,7 @@
// add the new deleted library back to the collection
$library_row.remove();
library.set('deleted', true);
- galaxyLibraryview.collection.add(library);
+ Galaxy.libraries.libraryListView.collection.add(library);
mod_toastr.success('Library has been marked deleted');
},
error: function(){
diff -r 9d91895363591d3c1eb8f18fac8fa6511aa19e52 -r 36410a555b2a9e587f4f24ea4ddfc120fde76fd5 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
@@ -12,34 +12,54 @@
// galaxy library row view
var LibraryRowView = Backbone.View.extend({
+ 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(library){
this.render(library);
},
render: function(library){
var tmpl = this.templateRow();
- this.setElement(tmpl({library:library}));
- this.set_up_visual_features(library);
+ this.prepareButtons(library);
+ this.setElement(tmpl({library:library, button_config: this.element_visibility_config}));
+ this.$el.show();
+ // this.set_up_visual_features(library);
},
- set_up_visual_features: function(library, options){
- if (library.get('deleted') === true){
- this.$el.addClass('active');
- this.$el.find('.public_lib_ico').hide();
- this.$el.find('.undelete_library_btn').show();
- this.$el.find('.upload_library_btn').hide();
- this.$el.find('.edit_library_btn').hide();
- this.$el.find('.permission_library_btn').hide();
- this.$el.find('.cancel_library_btn').hide();
- this.$el.find('.delete_library_btn').hide();
+ prepareButtons: function(library){
+ if (library.get('deleted') === true ){
+ if (Galaxy.currUser.isAdmin()){
+ this.element_visibility_config.undelete_library_btn = true;
+ this.element_visibility_config.upload_library_btn = false;
+ this.element_visibility_config.edit_library_btn = false;
+ this.element_visibility_config.permission_library_btn = false;
+ }
+ } else if (library.get('deleted') === false ) {
+ this.element_visibility_config.undelete_library_btn = false;
+ if (library.get('can_user_add') === true){
+ this.element_visibility_config.upload_library_btn = true;
+ }
+ if (library.get('can_user_modify') === true){
+ this.element_visibility_config.edit_library_btn = true;
+ }
+ if (library.get('can_user_manage') === true){
+ this.element_visibility_config.permission_library_btn = true;
+ }
}
- this.$el.show();
},
templateRow: function() {
tmpl_array = [];
- tmpl_array.push(' <tr style="display:none;" data-id="<%- library.get("id") %>">');
+ tmpl_array.push(' <tr class="<% if(library.get("deleted") === true) { print("active") } %>" style="display:none;" data-id="<%- library.get("id") %>">');
tmpl_array.push(' <td><a href="#folders/<%- library.get("root_folder_id") %>"><%- library.get("name") %></a></td>');
tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');
tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');
@@ -49,13 +69,13 @@
tmpl_array.push(' <% } else if(library.get("public") === true) { %>');
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"><span class="fa fa-upload"></span></button>');
- tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Modify library" class="primary-button btn-xs edit_library_btn" type="button"><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"><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="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="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="display:none;"><span class="fa fa-trash-o"> Delete</span></button>');
- tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Undelete library" class="primary-button btn-xs undelete_library_btn" type="button" style="display:none;"><span class="fa fa-unlock"> Undelete</span></button>');
+ 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" 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" 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 9d91895363591d3c1eb8f18fac8fa6511aa19e52 -r 36410a555b2a9e587f4f24ea4ddfc120fde76fd5 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,23 +22,26 @@
},
render: function(){
- var toolbar_template = this.templateToolBar()
+ var toolbar_template = this.templateToolBar();
this.$el.html(toolbar_template({admin_user: Galaxy.currUser.isAdmin(), anon_user: Galaxy.currUser.isAnonymous()}))
+ if (Galaxy.currUser.isAdmin() === true){
+ this.$el.find('#include_deleted_chk')[0].checked = Galaxy.libraries.preferences.get('with_deleted');
+ }
},
delegate_modal: function(event){
// probably should refactor to have this functionality in this view, not in the library view
- libraryListView.show_library_modal(event);
+ Galaxy.libraries.libraryListView.show_library_modal(event);
},
// include or exclude deleted libraries from the view
check_include_deleted: function(event){
if (event.target.checked){
- libraryListView.preferences.set({'with_deleted': true});
- libraryListView.render();
+ Galaxy.libraries.preferences.set({'with_deleted': true});
+ Galaxy.libraries.libraryListView.render();
} else{
- libraryListView.preferences.set({'with_deleted': false});
- libraryListView.render();
+ Galaxy.libraries.preferences.set({'with_deleted': false});
+ Galaxy.libraries.libraryListView.render();
}
},
@@ -51,8 +54,8 @@
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(' <input id="include_deleted_chk" style="margin: 0;" type="checkbox">include deleted</input>');
- tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Create New Library" id="create_new_library_btn" class="primary-button" type="button"><span class="fa fa-plus"></span> New Library</button>');
+ 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>');
diff -r 9d91895363591d3c1eb8f18fac8fa6511aa19e52 -r 36410a555b2a9e587f4f24ea4ddfc120fde76fd5 static/scripts/packed/galaxy.library.js
--- a/static/scripts/packed/galaxy.library.js
+++ b/static/scripts/packed/galaxy.library.js
@@ -1,1 +1,1 @@
-var library_router=null;define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-folderlist-view","mvc/library/library-librarylist-view","mvc/library/library-librarytoolbar-view"],function(e,c,g,h,a,f,d){var i=Backbone.Router.extend({routes:{"":"libraries","sort/:sort_by/:order":"sort_libraries","folders/:id":"folder_content","folders/:folder_id/download/:format":"download"}});var b=Backbone.View.extend({initialize:function(){toolbarView=null;libraryListView=null;library_router=new i();folderContentView=null;library_router.on("route:libraries",function(){toolbarView=new d.ToolbarView();libraryListView=new f.LibraryListView()});library_router.on("route:folder_content",function(j){if(!folderContentView){folderContentView=new a.FolderContentView()}folderContentView.render({id:j})});library_router.on("route:download",function(j,k){if($("#center").find(":checked").length===0){library_router.navigate("folders/"+j,{trigger:true,replace:true})}else{folderContentView.download(j,k);library_router.navigate("folders/"+j,{trigger:false,replace:true})}});Backbone.history.start({pushState:false})}});return{GalaxyApp:b}});
\ No newline at end of file
+var library_router=null;define(["galaxy.masthead","utils/utils","libs/toastr","mvc/base-mvc","mvc/library/library-model","mvc/library/library-folderlist-view","mvc/library/library-librarylist-view","mvc/library/library-librarytoolbar-view"],function(e,c,g,j,h,a,f,d){var k=Backbone.Router.extend({routes:{"":"libraries","sort/:sort_by/:order":"sort_libraries","folders/:id":"folder_content","folders/:folder_id/download/:format":"download"}});var i=j.SessionStorageModel.extend({defaults:{with_deleted:false,sort_order:"asc",sort_by:"name"}});var b=Backbone.View.extend({toolbarView:null,libraryListView:null,library_router:null,folderContentView:null,initialize:function(){Galaxy.libraries=this;this.preferences=new i({id:"global-lib-prefs"});this.library_router=new k();this.library_router.on("route:libraries",function(){Galaxy.libraries.toolbarView=new d.ToolbarView();Galaxy.libraries.libraryListView=new f.LibraryListView()});this.library_router.on("route:folder_content",function(l){if(!Galaxy.libraries.folderContentView){Galaxy.libraries.folderContentView=new a.FolderContentView()}Galaxy.libraries.folderContentView.render({id:l})});this.library_router.on("route:download",function(l,m){if($("#center").find(":checked").length===0){Galaxy.libraries.library_router.navigate("folders/"+l,{trigger:true,replace:true})}else{Galaxy.libraries.folderContentView.download(l,m);Galaxy.libraries.library_router.navigate("folders/"+l,{trigger:false,replace:true})}});Backbone.history.start({pushState:false})}});return{GalaxyApp:b}});
\ No newline at end of file
diff -r 9d91895363591d3c1eb8f18fac8fa6511aa19e52 -r 36410a555b2a9e587f4f24ea4ddfc120fde76fd5 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(c,h,e,f,d,a){var b=h.SessionStorageModel.extend({defaults:{with_deleted:false}});var g=Backbone.View.extend({el:"#libraries_element",events:{"click .edit_library_btn":"edit_button_event","click .save_library_btn":"save_library_modification","click .cancel_library_btn":"cancel_library_modification","click .delete_library_btn":"delete_library","click .undelete_library_btn":"undelete_library","click .sort-libraries-link":"sort_clicked"},modal:null,collection:null,preferences:null,rowViews:{},initialize:function(){var i=this;this.rowViews={};this.preferences=new b({id:"global-lib-prefs"});this.collection=new d.Libraries();this.collection.fetch({success:function(j){i.render()},error:function(k,j){f.error("An error occured. Please try again.")}})},render:function(j){var k=this.templateLibraryList();var l=null;var i=this.preferences.get("with_deleted");var m=null;if(typeof j!=="undefined"){i=typeof j.with_deleted!=="undefined"?j.with_deleted:false;m=typeof j.models!=="undefined"?j.models:null}if(this.collection!==null&&m===null){if(i){l=this.collection.models}else{l=this.collection.where({deleted:false})}}else{if(m!==null){l=m}else{l=[]}}this.$el.html(k({length:l.length,order:this.collection.sort_order}));this.renderRows(l);$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},renderRows:function(n){for(var m=0;m<n.length;m++){var l=n[m];var k=_.findWhere(this.rowViews,{id:l.get("id")});if(k!==undefined){this.$el.find("#library_list_body").append(k.el)}else{var j=new a.LibraryRowView(l);this.$el.find("#library_list_body").append(j.el);this.rowViews[l.get("id")]=j}}},sort_clicked:function(){if(this.collection.sort_order=="asc"){this.sortLibraries("name","desc")}else{this.sortLibraries("name","asc")}this.render()},sortLibraries:function(j,i){if(j==="name"){if(i==="asc"){this.collection.sort_order="asc";this.collection.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}}else{if(i==="desc"){this.collection.sort_order="desc";this.collection.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.collection.sort()}},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div class="library_container table-responsive">');tmpl_array.push("<% if(length === 0) { %>");tmpl_array.push("<div>I see no libraries. Why don't you create one?</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(""))},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("")},save_library_modification:function(l){var k=$(l.target).closest("tr");var i=this.collection.get(k.data("id"));var j=false;var n=k.find(".input_library_name").val();if(typeof n!=="undefined"&&n!==i.get("name")){if(n.length>2){i.set("name",n);j=true}else{f.warning("Library name has to be at least 3 characters long");return}}var m=k.find(".input_library_description").val();if(typeof m!=="undefined"&&m!==i.get("description")){i.set("description",m);j=true}var o=k.find(".input_library_synopsis").val();if(typeof o!=="undefined"&&o!==i.get("synopsis")){i.set("synopsis",o);j=true}if(j){i.save(null,{patch:true,success:function(p){f.success("Changes to library saved");galaxyLibraryview.toggle_library_modification(k)},error:function(q,p){f.error("An error occured during updating the library :(")}})}},edit_button_event:function(i){this.toggle_library_modification($(i.target).closest("tr"))},toggle_library_modification:function(l){var i=this.collection.get(l.data("id"));l.find(".public_lib_ico").toggle();l.find(".deleted_lib_ico").toggle();l.find(".edit_library_btn").toggle();l.find(".upload_library_btn").toggle();l.find(".permission_library_btn").toggle();l.find(".save_library_btn").toggle();l.find(".cancel_library_btn").toggle();if(i.get("deleted")){}else{l.find(".delete_library_btn").toggle()}if(l.find(".edit_library_btn").is(":hidden")){var j=i.get("name");var n='<input type="text" class="form-control input_library_name" placeholder="name">';l.children("td").eq(0).html(n);if(typeof j!==undefined){l.find(".input_library_name").val(j)}var k=i.get("description");var n='<input type="text" class="form-control input_library_description" placeholder="description">';l.children("td").eq(1).html(n);if(typeof k!==undefined){l.find(".input_library_description").val(k)}var m=i.get("synopsis");var n='<input type="text" class="form-control input_library_synopsis" placeholder="synopsis">';l.children("td").eq(2).html(n);if(typeof m!==undefined){l.find(".input_library_synopsis").val(m)}}else{l.children("td").eq(0).html(i.get("name"));l.children("td").eq(1).html(i.get("description"));l.children("td").eq(2).html(i.get("synopsis"))}},cancel_library_modification:function(k){var j=$(k.target).closest("tr");var i=this.collection.get(j.data("id"));this.toggle_library_modification(j);j.children("td").eq(0).html(i.get("name"));j.children("td").eq(1).html(i.get("description"));j.children("td").eq(2).html(i.get("synopsis"))},undelete_library:function(k){var j=$(k.target).closest("tr");var i=this.collection.get(j.data("id"));this.toggle_library_modification(j);i.url=i.urlRoot+i.id+"?undelete=true";i.destroy({success:function(l){l.set("deleted",false);galaxyLibraryview.collection.add(l);j.removeClass("active");f.success("Library has been undeleted")},error:function(){f.error("An error occured while undeleting the library :(")}})},delete_library:function(k){var j=$(k.target).closest("tr");var i=this.collection.get(j.data("id"));this.toggle_library_modification(j);i.destroy({success:function(l){j.remove();l.set("deleted",true);galaxyLibraryview.collection.add(l);f.success("Library has been marked deleted")},error:function(){f.error("An error occured during deleting the library :(")}})},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},show_library_modal:function(j){j.preventDefault();j.stopPropagation();var i=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){i.create_new_library_event()},Close:function(){i.modal.hide()}}})},create_new_library_event:function(){var k=this.serialize_new_library();if(this.validate_new_library(k)){var j=new d.Library();var i=this;j.save(k,{success:function(l){i.collection.add(l);i.modal.hide();i.clear_library_modal();i.render();f.success("Library created")},error:function(){f.error("An error occured :(")}})}else{f.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(i){return i.name!==""}});return{LibraryListView:g}});
\ 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 .edit_library_btn":"edit_button_event","click .save_library_btn":"save_library_modification","click .cancel_library_btn":"cancel_library_modification","click .delete_library_btn":"delete_library","click .undelete_library_btn":"undelete_library","click .sort-libraries-link":"sort_clicked"},modal:null,collection:null,rowViews:{},initialize:function(){var h=this;this.rowViews={};this.collection=new c.Libraries();this.collection.fetch({success:function(i){h.render()},error:function(j,i){e.error("An error occured. Please try again.")}})},render:function(i){var j=this.templateLibraryList();var k=null;var h=true;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){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")}));this.renderRows(k);$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},renderRows:function(m){for(var l=0;l<m.length;l++){var k=m[l];var j=_.findWhere(this.rowViews,{id:k.get("id")});if(j!==undefined){this.$el.find("#library_list_body").append(j.el)}else{var h=new a.LibraryRowView(k);this.$el.find("#library_list_body").append(h.el);this.rowViews[k.get("id")]=h}}},sort_clicked:function(){if(Galaxy.libraries.preferences.get("sort_order")==="asc"){this.sortLibraries("name","desc");Galaxy.libraries.preferences.set({sort_order:"desc"})}else{this.sortLibraries("name","asc");Galaxy.libraries.preferences.set({sort_order:"asc"})}this.render()},sortLibraries:function(i,h){if(i==="name"){if(h==="asc"){this.collection.comparator=function(k,j){if(k.get("name").toLowerCase()>j.get("name").toLowerCase()){return 1}if(j.get("name").toLowerCase()>k.get("name").toLowerCase()){return -1}return 0}}else{if(h==="desc"){this.collection.comparator=function(k,j){if(k.get("name").toLowerCase()>j.get("name").toLowerCase()){return -1}if(j.get("name").toLowerCase()>k.get("name").toLowerCase()){return 1}return 0}}}this.collection.sort()}},templateLibraryList:function(){tmpl_array=[];tmpl_array.push('<div class="library_container table-responsive">');tmpl_array.push("<% if(length === 0) { %>");tmpl_array.push("<div>I see no libraries. Why don't you create one?</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(""))},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("")},save_library_modification:function(k){var j=$(k.target).closest("tr");var h=this.collection.get(j.data("id"));var i=false;var m=j.find(".input_library_name").val();if(typeof m!=="undefined"&&m!==h.get("name")){if(m.length>2){h.set("name",m);i=true}else{e.warning("Library name has to be at least 3 characters long");return}}var l=j.find(".input_library_description").val();if(typeof l!=="undefined"&&l!==h.get("description")){h.set("description",l);i=true}var n=j.find(".input_library_synopsis").val();if(typeof n!=="undefined"&&n!==h.get("synopsis")){h.set("synopsis",n);i=true}if(i){h.save(null,{patch:true,success:function(o){e.success("Changes to library saved");Galaxy.libraries.libraryListView.toggle_library_modification(j)},error:function(p,o){e.error("An error occured during updating the library :(")}})}},edit_button_event:function(h){this.toggle_library_modification($(h.target).closest("tr"))},toggle_library_modification:function(k){var h=this.collection.get(k.data("id"));k.find(".public_lib_ico").toggle();k.find(".deleted_lib_ico").toggle();k.find(".edit_library_btn").toggle();k.find(".upload_library_btn").toggle();k.find(".permission_library_btn").toggle();k.find(".save_library_btn").toggle();k.find(".cancel_library_btn").toggle();if(h.get("deleted")){}else{k.find(".delete_library_btn").toggle()}if(k.find(".edit_library_btn").is(":hidden")){var i=h.get("name");var m='<input type="text" class="form-control input_library_name" placeholder="name">';k.children("td").eq(0).html(m);if(typeof i!==undefined){k.find(".input_library_name").val(i)}var j=h.get("description");var m='<input type="text" class="form-control input_library_description" placeholder="description">';k.children("td").eq(1).html(m);if(typeof j!==undefined){k.find(".input_library_description").val(j)}var l=h.get("synopsis");var m='<input type="text" class="form-control input_library_synopsis" placeholder="synopsis">';k.children("td").eq(2).html(m);if(typeof l!==undefined){k.find(".input_library_synopsis").val(l)}}else{k.children("td").eq(0).html(h.get("name"));k.children("td").eq(1).html(h.get("description"));k.children("td").eq(2).html(h.get("synopsis"))}},cancel_library_modification:function(j){var i=$(j.target).closest("tr");var h=this.collection.get(i.data("id"));this.toggle_library_modification(i);i.children("td").eq(0).html(h.get("name"));i.children("td").eq(1).html(h.get("description"));i.children("td").eq(2).html(h.get("synopsis"))},undelete_library:function(j){var i=$(j.target).closest("tr");var h=this.collection.get(i.data("id"));this.toggle_library_modification(i);h.url=h.urlRoot+h.id+"?undelete=true";h.destroy({success:function(k){k.set("deleted",false);Galaxy.libraries.libraryListView.collection.add(k);i.removeClass("active");e.success("Library has been undeleted")},error:function(){e.error("An error occured while undeleting the library :(")}})},delete_library:function(j){var i=$(j.target).closest("tr");var h=this.collection.get(i.data("id"));this.toggle_library_modification(i);h.destroy({success:function(k){i.remove();k.set("deleted",true);Galaxy.libraries.libraryListView.collection.add(k);e.success("Library has been marked deleted")},error:function(){e.error("An error occured during deleting the library :(")}})},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},show_library_modal:function(i){i.preventDefault();i.stopPropagation();var h=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){h.create_new_library_event()},Close:function(){h.modal.hide()}}})},create_new_library_event:function(){var j=this.serialize_new_library();if(this.validate_new_library(j)){var i=new c.Library();var h=this;i.save(j,{success:function(k){h.collection.add(k);h.modal.hide();h.clear_library_modal();h.render();e.success("Library created")},error:function(){e.error("An error occured :(")}})}else{e.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(h){return h.name!==""}});return{LibraryListView:f}});
\ No newline at end of file
diff -r 9d91895363591d3c1eb8f18fac8fa6511aa19e52 -r 36410a555b2a9e587f4f24ea4ddfc120fde76fd5 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","mvc/library/library-model"],function(b,d,e,c){var a=Backbone.View.extend({initialize:function(f){this.render(f)},render:function(g){var f=this.templateRow();this.setElement(f({library:g}));this.set_up_visual_features(g)},set_up_visual_features:function(f,g){if(f.get("deleted")===true){this.$el.addClass("active");this.$el.find(".public_lib_ico").hide();this.$el.find(".undelete_library_btn").show();this.$el.find(".upload_library_btn").hide();this.$el.find(".edit_library_btn").hide();this.$el.find(".permission_library_btn").hide();this.$el.find(".cancel_library_btn").hide();this.$el.find(".delete_library_btn").hide()}this.$el.show()},templateRow:function(){tmpl_array=[];tmpl_array.push(' <tr style="display:none;" data-id="<%- library.get("id") %>">');tmpl_array.push(' <td><a href="#folders/<%- library.get("root_folder_id") %>"><%- library.get("name") %></a></td>');tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');tmpl_array.push(' <td class="right-center">');tmpl_array.push(' <% if(library.get("deleted") === true) { %>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Marked deleted" style="color:grey;" class="fa fa-ban fa-lg deleted_lib_ico"></span>');tmpl_array.push(' <% } else if(library.get("public") === true) { %>');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"><span class="fa fa-upload"></span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Modify library" class="primary-button btn-xs edit_library_btn" type="button"><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"><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="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="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="display:none;"><span class="fa fa-trash-o"> Delete</span></button>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Undelete library" class="primary-button btn-xs undelete_library_btn" type="button" style="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","mvc/library/library-model"],function(b,d,e,c){var a=Backbone.View.extend({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(f){this.render(f)},render:function(g){var f=this.templateRow();this.prepareButtons(g);this.setElement(f({library:g,button_config:this.element_visibility_config}));this.$el.show()},prepareButtons:function(f){if(f.get("deleted")===true){if(Galaxy.currUser.isAdmin()){this.element_visibility_config.undelete_library_btn=true;this.element_visibility_config.upload_library_btn=false;this.element_visibility_config.edit_library_btn=false;this.element_visibility_config.permission_library_btn=false}}else{if(f.get("deleted")===false){this.element_visibility_config.undelete_library_btn=false;if(f.get("can_user_add")===true){this.element_visibility_config.upload_library_btn=true}if(f.get("can_user_modify")===true){this.element_visibility_config.edit_library_btn=true}if(f.get("can_user_manage")===true){this.element_visibility_config.permission_library_btn=true}}}},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(' <td><a href="#folders/<%- library.get("root_folder_id") %>"><%- library.get("name") %></a></td>');tmpl_array.push(' <td><%= _.escape(library.get("description")) %></td>');tmpl_array.push(' <td><%= _.escape(library.get("synopsis")) %></td>');tmpl_array.push(' <td class="right-center">');tmpl_array.push(' <% if(library.get("deleted") === true) { %>');tmpl_array.push(' <span data-toggle="tooltip" data-placement="top" title="Marked deleted" style="color:grey;" class="fa fa-ban fa-lg deleted_lib_ico"></span>');tmpl_array.push(' <% } else if(library.get("public") === true) { %>');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" 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" 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 9d91895363591d3c1eb8f18fac8fa6511aa19e52 -r 36410a555b2a9e587f4f24ea4ddfc120fde76fd5 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(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model"],function(a,d,e,c){var b=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"delegate_modal","click #include_deleted_chk":"check_include_deleted"},initialize:function(){this.render()},render:function(){var f=this.templateToolBar();this.$el.html(f({admin_user:Galaxy.currUser.isAdmin(),anon_user:Galaxy.currUser.isAnonymous()}))},delegate_modal:function(f){libraryListView.show_library_modal(f)},check_include_deleted:function(f){if(f.target.checked){libraryListView.preferences.set({with_deleted:true});libraryListView.render()}else{libraryListView.preferences.set({with_deleted:false});libraryListView.render()}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('<div id="libraries_container" style="width: 90%; margin: auto; margin-top:2em; overflow: auto !important; ">');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(' <input id="include_deleted_chk" style="margin: 0;" type="checkbox">include deleted</input>');tmpl_array.push(' <button data-toggle="tooltip" data-placement="top" title="Create New Library" id="create_new_library_btn" class="primary-button" type="button"><span class="fa fa-plus"></span> New Library</button>');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(""))}});return{ToolbarView:b}});
\ No newline at end of file
+define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model"],function(a,d,e,c){var b=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"delegate_modal","click #include_deleted_chk":"check_include_deleted"},initialize:function(){this.render()},render:function(){var f=this.templateToolBar();this.$el.html(f({admin_user:Galaxy.currUser.isAdmin(),anon_user:Galaxy.currUser.isAnonymous()}));if(Galaxy.currUser.isAdmin()===true){this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted")}},delegate_modal:function(f){Galaxy.libraries.libraryListView.show_library_modal(f)},check_include_deleted:function(f){if(f.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 id="libraries_container" style="width: 90%; margin: auto; margin-top:2em; overflow: auto !important; ">');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(""))}});return{ToolbarView:b}});
\ No newline at end of file
diff -r 9d91895363591d3c1eb8f18fac8fa6511aa19e52 -r 36410a555b2a9e587f4f24ea4ddfc120fde76fd5 static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -1309,7 +1309,7 @@
.modal_table td{border:none !important}
th.button_heading{width:2em}
#library_folder_toolbar{margin-bottom:1em}
-#library_toolbar{margin-bottom:1em}
+#library_toolbar{margin-bottom:1em}#library_toolbar span{margin-right:0.2em}
img.expanderIcon{padding-right:4px}
input.datasetCheckbox,li,ul{padding:0;margin:0}
.rowTitle{padding:2px}
diff -r 9d91895363591d3c1eb8f18fac8fa6511aa19e52 -r 36410a555b2a9e587f4f24ea4ddfc120fde76fd5 static/style/blue/library.css
--- a/static/style/blue/library.css
+++ b/static/style/blue/library.css
@@ -20,7 +20,7 @@
.modal_table td{border:none !important}
th.button_heading{width:2em}
#library_folder_toolbar{margin-bottom:1em}
-#library_toolbar{margin-bottom:1em}
+#library_toolbar{margin-bottom:1em}#library_toolbar span{margin-right:0.2em}
img.expanderIcon{padding-right:4px}
input.datasetCheckbox,li,ul{padding:0;margin:0}
.rowTitle{padding:2px}
diff -r 9d91895363591d3c1eb8f18fac8fa6511aa19e52 -r 36410a555b2a9e587f4f24ea4ddfc120fde76fd5 static/style/src/less/library.less
--- a/static/style/src/less/library.less
+++ b/static/style/src/less/library.less
@@ -96,6 +96,9 @@
}
#library_toolbar {
margin-bottom: 1em;
+ span {
+ margin-right: 0.2em;
+ }
}
img.expanderIcon {
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: Jeremy Goecks: Circster fixes: (a) make compatible with new config object; (b) fix formatting issue with negative values; and (c) clean up debugging statements. Pack scripts.
by commits-noreply@bitbucket.org 02 Apr '14
by commits-noreply@bitbucket.org 02 Apr '14
02 Apr '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/9d9189536359/
Changeset: 9d9189536359
User: Jeremy Goecks
Date: 2014-04-02 16:15:54
Summary: Circster fixes: (a) make compatible with new config object; (b) fix formatting issue with negative values; and (c) clean up debugging statements. Pack scripts.
Affected #: 4 files
diff -r fd24924488a575516696595a8e61e276d795f2b5 -r 9d91895363591d3c1eb8f18fac8fa6511aa19e52 static/scripts/packed/viz/circster.js
--- a/static/scripts/packed/viz/circster.js
+++ b/static/scripts/packed/viz/circster.js
@@ -1,1 +1,1 @@
-define(["utils/utils","libs/underscore","libs/d3","viz/visualization","utils/config"],function(h,i,n,k,c){h.cssLoadFile("static/style/circster.css");var o=Backbone.Model.extend({is_visible:function(s,p){var q=s.getBoundingClientRect(),r=$("svg")[0].getBoundingClientRect();if(q.right<0||q.left>r.right||q.bottom<0||q.top>r.bottom){return false}return true}});var j={drawTicks:function(t,s,x,r,p){var w=t.append("g").selectAll("g").data(s).enter().append("g").selectAll("g").data(x).enter().append("g").attr("class","tick").attr("transform",function(y){return"rotate("+(y.angle*180/Math.PI-90)+")translate("+y.radius+",0)"});var v=[],u=[],q=function(y){return y.angle>Math.PI?"end":null};if(p){v=[0,0,0,-4];u=[4,0,"",".35em"];q=null}else{v=[1,0,4,0];u=[0,4,".35em",""]}w.append("line").attr("x1",v[0]).attr("y1",v[1]).attr("x2",v[2]).attr("y1",v[3]).style("stroke","#000");w.append("text").attr("x",u[0]).attr("y",u[1]).attr("dx",u[2]).attr("dy",u[3]).attr("text-anchor",q).attr("transform",r).text(function(y){return y.label})},formatNum:function(q,p){if(p===undefined){p=2}if(q===null){return null}var s=null;if(q<1){s=q.toPrecision(p)}else{var r=Math.round(q.toPrecision(p));if(q<1000){s=r}else{if(q<1000000){s=Math.round((r/1000).toPrecision(3)).toFixed(0)+"K"}else{if(q<1000000000){s=Math.round((r/1000000).toPrecision(3)).toFixed(0)+"M"}}}}return s}};var d=Backbone.Model.extend({});var a=Backbone.View.extend({className:"circster",initialize:function(p){this.genome=p.genome;this.label_arc_height=50;this.scale=1;this.circular_views=null;this.chords_views=null;this.model.get("drawables").on("add",this.add_track,this);this.model.get("drawables").on("remove",this.remove_track,this);var q=this.model.get("config");q.get("arc_dataset_height").on("change:value",this.update_track_bounds,this);q.get("track_gap").on("change:value",this.update_track_bounds,this)},get_circular_tracks:function(){return this.model.get("drawables").filter(function(p){return p.get("track_type")!=="DiagonalHeatmapTrack"})},get_chord_tracks:function(){return this.model.get("drawables").filter(function(p){return p.get("track_type")==="DiagonalHeatmapTrack"})},get_tracks_bounds:function(){var r=this.get_circular_tracks(),t=this.model.get("config").get_value("arc_dataset_height"),s=this.model.get("config").get_value("track_gap"),p=Math.min(this.$el.width(),this.$el.height())-20,v=p/2-r.length*(t+s)+s-this.label_arc_height,u=n.range(v,p/2,t+s);var q=this;return i.map(u,function(w){return[w,w+t]})},render:function(){var y=this,p=y.$el.width(),x=y.$el.height(),u=this.get_circular_tracks(),s=this.get_chord_tracks(),r=y.model.get("config").get_value("total_gap"),t=this.get_tracks_bounds(),q=n.select(y.$el[0]).append("svg").attr("width",p).attr("height",x).attr("pointer-events","all").append("svg:g").call(n.behavior.zoom().on("zoom",function(){var z=n.event.scale;q.attr("transform","translate("+n.event.translate+") scale("+z+")");if(y.scale!==z){if(y.zoom_drag_timeout){clearTimeout(y.zoom_drag_timeout)}y.zoom_drag_timeout=setTimeout(function(){},400)}})).attr("transform","translate("+p/2+","+x/2+")").append("svg:g").attr("class","tracks");this.circular_views=u.map(function(A,B){var z=new e({el:q.append("g")[0],track:A,radius_bounds:t[B],genome:y.genome,total_gap:r});z.render();return z});this.chords_views=s.map(function(A){var z=new l({el:q.append("g")[0],track:A,radius_bounds:t[0],genome:y.genome,total_gap:r});z.render();return z});var w=this.circular_views[this.circular_views.length-1].radius_bounds[1],v=[w,w+this.label_arc_height];this.label_track_view=new b({el:q.append("g")[0],track:new d(),radius_bounds:v,genome:y.genome,total_gap:r});this.label_track_view.render()},add_track:function(v){var q=this.model.get("config").get_value("total_gap");if(v.get("track_type")==="DiagonalHeatmapTrack"){var r=this.circular_views[0].radius_bounds,u=new l({el:n.select("g.tracks").append("g")[0],track:v,radius_bounds:r,genome:this.genome,total_gap:q});u.render();this.chords_views.push(u)}else{var t=this.get_tracks_bounds();i.each(this.circular_views,function(w,x){w.update_radius_bounds(t[x])});i.each(this.chords_views,function(w){w.update_radius_bounds(t[0])});var s=this.circular_views.length,p=new e({el:n.select("g.tracks").append("g")[0],track:v,radius_bounds:t[s],genome:this.genome,total_gap:q});p.render();this.circular_views.push(p)}},remove_track:function(q,s,r){var p=this.circular_views[r.index];this.circular_views.splice(r.index,1);p.$el.remove();var t=this.get_tracks_bounds();i.each(this.circular_views,function(u,v){u.update_radius_bounds(t[v])})},update_track_bounds:function(){var p=this.get_tracks_bounds();i.each(this.circular_views,function(q,r){q.update_radius_bounds(p[r])});i.each(this.chords_views,function(q){q.update_radius_bounds(p[0])})}});var m=Backbone.View.extend({tagName:"g",initialize:function(p){this.bg_stroke="ddd";this.loading_bg_fill="ffc";this.bg_fill="ddd";this.total_gap=p.total_gap;this.track=p.track;this.radius_bounds=p.radius_bounds;this.genome=p.genome;this.chroms_layout=this._chroms_layout();this.data_bounds=[];this.scale=1;this.parent_elt=n.select(this.$el[0])},get_fill_color:function(){var p=this.track.get("config").get_value("block_color");if(!p){p=this.track.get("config").get_value("color")}return p},render:function(){var t=this.parent_elt;if(!t){console.log("no parent elt")}var s=this.chroms_layout,v=n.svg.arc().innerRadius(this.radius_bounds[0]).outerRadius(this.radius_bounds[1]),p=t.selectAll("g").data(s).enter().append("svg:g"),r=p.append("path").attr("d",v).attr("class","chrom-background").style("stroke",this.bg_stroke).style("fill",this.loading_bg_fill);r.append("title").text(function(x){return x.data.chrom});var q=this,u=q.track.get("data_manager"),w=(u?u.data_is_ready():true);$.when(w).then(function(){$.when(q._render_data(t)).then(function(){r.style("fill",q.bg_fill);q.render_labels()})})},render_labels:function(){},update_radius_bounds:function(q){this.radius_bounds=q;var p=n.svg.arc().innerRadius(this.radius_bounds[0]).outerRadius(this.radius_bounds[1]);this.parent_elt.selectAll("g>path.chrom-background").transition().duration(1000).attr("d",p);this._transition_chrom_data();this._transition_labels()},update_scale:function(s){var r=this.scale;this.scale=s;if(s<=r){return}var q=this,p=new o();this.parent_elt.selectAll("path.chrom-data").filter(function(u,t){return p.is_visible(this)}).each(function(z,v){var y=n.select(this),u=y.attr("chrom"),x=q.genome.get_chrom_region(u),w=q.track.get("data_manager"),t;if(!w.can_get_more_detailed_data(x)){return}t=q.track.get("data_manager").get_more_detailed_data(x,"Coverage",0,s);$.when(t).then(function(C){y.remove();q._update_data_bounds();var B=i.find(q.chroms_layout,function(D){return D.data.chrom===u});var A=q.get_fill_color();q._render_chrom_data(q.parent_elt,B,C).style("stroke",A).style("fill",A)})});return q},_transition_chrom_data:function(){var q=this.track,s=this.chroms_layout,p=this.parent_elt.selectAll("g>path.chrom-data"),t=p[0].length;if(t>0){var r=this;$.when(q.get("data_manager").get_genome_wide_data(this.genome)).then(function(v){var u=i.reject(i.map(v,function(w,x){var y=null,z=r._get_path_function(s[x],w);if(z){y=z(w.data)}return y}),function(w){return w===null});p.each(function(x,w){n.select(this).transition().duration(1000).attr("d",u[w])})})}},_transition_labels:function(){},_update_data_bounds:function(){var p=this.data_bounds;this.data_bounds=this.get_data_bounds(this.track.get("data_manager").get_genome_wide_data(this.genome));if(this.data_bounds[0]<p[0]||this.data_bounds[1]>p[1]){this._transition_chrom_data()}},_render_data:function(s){var r=this,q=this.chroms_layout,p=this.track,t=$.Deferred();$.when(p.get("data_manager").get_genome_wide_data(this.genome)).then(function(v){r.data_bounds=r.get_data_bounds(v);layout_and_data=i.zip(q,v),chroms_data_layout=i.map(layout_and_data,function(w){var x=w[0],y=w[1];return r._render_chrom_data(s,x,y)});var u=r.get_fill_color();r.parent_elt.selectAll("path.chrom-data").style("stroke",u).style("fill",u);t.resolve(s)});return t},_render_chrom_data:function(p,q,r){},_get_path_function:function(q,p){},_chroms_layout:function(){var q=this.genome.get_chroms_info(),s=n.layout.pie().value(function(u){return u.len}).sort(null),t=s(q),p=2*Math.PI*this.total_gap/q.length,r=i.map(t,function(w,v){var u=w.endAngle-p;w.endAngle=(u>w.startAngle?u:w.startAngle);return w});return r}});var b=m.extend({initialize:function(p){m.prototype.initialize.call(this,p);this.innerRadius=this.radius_bounds[0];this.radius_bounds[0]=this.radius_bounds[1];this.bg_stroke="fff";this.bg_fill="fff";this.min_arc_len=0.05},_render_data:function(r){var q=this,p=r.selectAll("g");p.selectAll("path").attr("id",function(v){return"label-"+v.data.chrom});p.append("svg:text").filter(function(v){return v.endAngle-v.startAngle>q.min_arc_len}).attr("text-anchor","middle").append("svg:textPath").attr("class","chrom-label").attr("xlink:href",function(v){return"#label-"+v.data.chrom}).attr("startOffset","25%").text(function(v){return v.data.chrom});var s=function(x){var v=(x.endAngle-x.startAngle)/x.value,w=n.range(0,x.value,25000000).map(function(y,z){return{radius:q.innerRadius,angle:y*v+x.startAngle,label:z===0?0:(z%3?null:q.formatNum(y))}});if(w.length<4){w[w.length-1].label=q.formatNum(Math.round((w[w.length-1].angle-x.startAngle)/v))}return w};var u=function(v){return v.angle>Math.PI?"rotate(180)translate(-16)":null};var t=i.filter(this.chroms_layout,function(v){return v.endAngle-v.startAngle>q.min_arc_len});this.drawTicks(this.parent_elt,t,s,u)}});i.extend(b.prototype,j);var g=m.extend({_quantile:function(q,p){q.sort(n.ascending);return n.quantile(q,p)},_render_chrom_data:function(p,s,q){var t=this._get_path_function(s,q);if(!t){return null}var r=p.datum(q.data),u=r.append("path").attr("class","chrom-data").attr("chrom",s.data.chrom).attr("d",t);return u},_get_path_function:function(s,r){if(typeof r==="string"||!r.data||r.data.length===0){return null}var p=n.scale.linear().domain(this.data_bounds).range(this.radius_bounds).clamp(true);var t=n.scale.linear().domain([0,r.data.length]).range([s.startAngle,s.endAngle]);var q=n.svg.line.radial().interpolate("linear").radius(function(u){return p(u[1])}).angle(function(v,u){return t(u)});return n.svg.area.radial().interpolate(q.interpolate()).innerRadius(p(0)).outerRadius(q.radius()).angle(q.angle())},render_labels:function(){var p=this,q=function(){return"rotate(90)"};this.drawTicks(this.parent_elt,[this.chroms_layout[0]],this._data_bounds_ticks_fn(),q,true)},_transition_labels:function(){if(this.data_bounds.length===0){return}var q=this,s=i.filter(this.chroms_layout,function(t){return t.endAngle-t.startAngle>0.08}),r=i.filter(s,function(u,t){return t%3===0}),p=i.flatten(i.map(r,function(t){return q._data_bounds_ticks_fn()(t)}));this.parent_elt.selectAll("g.tick").data(p).transition().attr("transform",function(t){return"rotate("+(t.angle*180/Math.PI-90)+")translate("+t.radius+",0)"})},_data_bounds_ticks_fn:function(){var p=this;visibleChroms=0;return function(q){return[{radius:p.radius_bounds[0],angle:q.startAngle,label:p.formatNum(p.data_bounds[0])},{radius:p.radius_bounds[1],angle:q.startAngle,label:p.formatNum(p.data_bounds[1])}]}},get_data_bounds:function(p){}});i.extend(g.prototype,j);var e=g.extend({get_data_bounds:function(q){var p=i.flatten(i.map(q,function(r){if(r){return i.map(r.data,function(s){return parseInt(s[1],10)||0})}else{return 0}}));return[i.min(p),this._quantile(p,0.5)||i.max(p)]}});var l=m.extend({render:function(){var p=this;$.when(p.track.get("data_manager").data_is_ready()).then(function(){$.when(p.track.get("data_manager").get_genome_wide_data(p.genome)).then(function(s){var r=[],q=p.genome.get_chroms_info();i.each(s,function(w,v){var t=q[v].chrom;var u=i.map(w.data,function(y){var x=p._get_region_angle(t,y[1]),z=p._get_region_angle(y[3],y[4]);return{source:{startAngle:x,endAngle:x+0.01},target:{startAngle:z,endAngle:z+0.01}}});r=r.concat(u)});p.parent_elt.append("g").attr("class","chord").selectAll("path").data(r).enter().append("path").style("fill",p.get_fill_color()).attr("d",n.svg.chord().radius(p.radius_bounds[0])).style("opacity",1)})})},update_radius_bounds:function(p){this.radius_bounds=p;this.parent_elt.selectAll("path").transition().attr("d",n.svg.chord().radius(this.radius_bounds[0]))},_get_region_angle:function(r,p){var q=i.find(this.chroms_layout,function(s){return s.data.chrom===r});return q.endAngle-((q.endAngle-q.startAngle)*(q.data.len-p)/q.data.len)}});var f=Backbone.View.extend({initialize:function(){var p=new k.Genome(galaxy_config.app.genome),q=new k.GenomeVisualization(galaxy_config.app.viz_config);q.get("config").add([{key:"arc_dataset_height",label:"Arc Dataset Height",type:"int",value:25,view:"circster"},{key:"track_gap",label:"Gap Between Tracks",type:"int",value:5,view:"circster"},{key:"total_gap",label:"Gap [0-1]",type:"float",value:0.4,view:"circster",hidden:true}]);var s=new a({el:$("#center .unified-panel-body"),genome:p,model:q});s.render();$("#center .unified-panel-header-inner").append(galaxy_config.app.viz_config.title+" "+galaxy_config.app.viz_config.dbkey);var r=create_icon_buttons_menu([{icon_class:"plus-button",title:"Add tracks",on_click:function(){k.select_datasets(galaxy_config.root+"visualization/list_current_history_datasets",galaxy_config.root+"api/datasets",q.get("dbkey"),function(t){q.add_tracks(t)})}},{icon_class:"gear",title:"Settings",on_click:function(){var t=new c.ConfigSettingCollectionView({collection:q.get("config")});t.render_in_modal("Configure Visualization")}},{icon_class:"disk--arrow",title:"Save",on_click:function(){Galaxy.modal.show({title:"Saving...",body:"progress"});$.ajax({url:galaxy_config.root+"visualization/save",type:"POST",dataType:"json",data:{id:q.get("vis_id"),title:q.get("title"),dbkey:q.get("dbkey"),type:"trackster",vis_json:JSON.stringify(q)}}).success(function(t){Galaxy.modal.hide();q.set("vis_id",t.vis_id)}).error(function(){Galaxy.modal.show({title:"Could Not Save",body:"Could not save visualization. Please try again later.",buttons:{Cancel:function(){Galaxy.modal.hide()}}})})}},{icon_class:"cross-circle",title:"Close",on_click:function(){window.location=galaxy_config.root+"visualization/list"}}],{tooltip_config:{placement:"bottom"}});r.$el.attr("style","float: right");$("#center .unified-panel-header-inner").append(r.$el);$(".menu-button").tooltip({placement:"bottom"})}});return{GalaxyApp:f}});
\ No newline at end of file
+define(["utils/utils","libs/underscore","libs/d3","viz/visualization","utils/config"],function(h,i,n,k,c){h.cssLoadFile("static/style/circster.css");var o=Backbone.Model.extend({is_visible:function(s,p){var q=s.getBoundingClientRect(),r=$("svg")[0].getBoundingClientRect();if(q.right<0||q.left>r.right||q.bottom<0||q.top>r.bottom){return false}return true}});var j={drawTicks:function(t,s,x,r,p){var w=t.append("g").selectAll("g").data(s).enter().append("g").selectAll("g").data(x).enter().append("g").attr("class","tick").attr("transform",function(y){return"rotate("+(y.angle*180/Math.PI-90)+")translate("+y.radius+",0)"});var v=[],u=[],q=function(y){return y.angle>Math.PI?"end":null};if(p){v=[0,0,0,-4];u=[4,0,"",".35em"];q=null}else{v=[1,0,4,0];u=[0,4,".35em",""]}w.append("line").attr("x1",v[0]).attr("y1",v[1]).attr("x2",v[2]).attr("y1",v[3]).style("stroke","#000");w.append("text").attr("x",u[0]).attr("y",u[1]).attr("dx",u[2]).attr("dy",u[3]).attr("text-anchor",q).attr("transform",r).text(function(y){return y.label})},formatNum:function(q,p){if(p===undefined){p=2}if(q===null){return null}var s=null;if(Math.abs(q)<1){s=q.toPrecision(p)}else{var r=Math.round(q.toPrecision(p));q=Math.abs(q);if(q<1000){s=r}else{if(q<1000000){s=Math.round((r/1000).toPrecision(3)).toFixed(0)+"K"}else{if(q<1000000000){s=Math.round((r/1000000).toPrecision(3)).toFixed(0)+"M"}}}}return s}};var d=Backbone.Model.extend({});var a=Backbone.View.extend({className:"circster",initialize:function(p){this.genome=p.genome;this.label_arc_height=50;this.scale=1;this.circular_views=null;this.chords_views=null;this.model.get("drawables").on("add",this.add_track,this);this.model.get("drawables").on("remove",this.remove_track,this);var q=this.model.get("config");q.get("arc_dataset_height").on("change:value",this.update_track_bounds,this);q.get("track_gap").on("change:value",this.update_track_bounds,this)},get_circular_tracks:function(){return this.model.get("drawables").filter(function(p){return p.get("track_type")!=="DiagonalHeatmapTrack"})},get_chord_tracks:function(){return this.model.get("drawables").filter(function(p){return p.get("track_type")==="DiagonalHeatmapTrack"})},get_tracks_bounds:function(){var r=this.get_circular_tracks(),t=this.model.get("config").get_value("arc_dataset_height"),s=this.model.get("config").get_value("track_gap"),p=Math.min(this.$el.width(),this.$el.height())-20,v=p/2-r.length*(t+s)+s-this.label_arc_height,u=n.range(v,p/2,t+s);var q=this;return i.map(u,function(w){return[w,w+t]})},render:function(){var y=this,p=y.$el.width(),x=y.$el.height(),u=this.get_circular_tracks(),s=this.get_chord_tracks(),r=y.model.get("config").get_value("total_gap"),t=this.get_tracks_bounds(),q=n.select(y.$el[0]).append("svg").attr("width",p).attr("height",x).attr("pointer-events","all").append("svg:g").call(n.behavior.zoom().on("zoom",function(){var z=n.event.scale;q.attr("transform","translate("+n.event.translate+") scale("+z+")");if(y.scale!==z){if(y.zoom_drag_timeout){clearTimeout(y.zoom_drag_timeout)}y.zoom_drag_timeout=setTimeout(function(){},400)}})).attr("transform","translate("+p/2+","+x/2+")").append("svg:g").attr("class","tracks");this.circular_views=u.map(function(A,B){var z=new e({el:q.append("g")[0],track:A,radius_bounds:t[B],genome:y.genome,total_gap:r});z.render();return z});this.chords_views=s.map(function(A){var z=new l({el:q.append("g")[0],track:A,radius_bounds:t[0],genome:y.genome,total_gap:r});z.render();return z});var w=this.circular_views[this.circular_views.length-1].radius_bounds[1],v=[w,w+this.label_arc_height];this.label_track_view=new b({el:q.append("g")[0],track:new d(),radius_bounds:v,genome:y.genome,total_gap:r});this.label_track_view.render()},add_track:function(v){var q=this.model.get("config").get_value("total_gap");if(v.get("track_type")==="DiagonalHeatmapTrack"){var r=this.circular_views[0].radius_bounds,u=new l({el:n.select("g.tracks").append("g")[0],track:v,radius_bounds:r,genome:this.genome,total_gap:q});u.render();this.chords_views.push(u)}else{var t=this.get_tracks_bounds();i.each(this.circular_views,function(w,x){w.update_radius_bounds(t[x])});i.each(this.chords_views,function(w){w.update_radius_bounds(t[0])});var s=this.circular_views.length,p=new e({el:n.select("g.tracks").append("g")[0],track:v,radius_bounds:t[s],genome:this.genome,total_gap:q});p.render();this.circular_views.push(p)}},remove_track:function(q,s,r){var p=this.circular_views[r.index];this.circular_views.splice(r.index,1);p.$el.remove();var t=this.get_tracks_bounds();i.each(this.circular_views,function(u,v){u.update_radius_bounds(t[v])})},update_track_bounds:function(){var p=this.get_tracks_bounds();i.each(this.circular_views,function(q,r){q.update_radius_bounds(p[r])});i.each(this.chords_views,function(q){q.update_radius_bounds(p[0])})}});var m=Backbone.View.extend({tagName:"g",initialize:function(p){this.bg_stroke="ddd";this.loading_bg_fill="ffc";this.bg_fill="ddd";this.total_gap=p.total_gap;this.track=p.track;this.radius_bounds=p.radius_bounds;this.genome=p.genome;this.chroms_layout=this._chroms_layout();this.data_bounds=[];this.scale=1;this.parent_elt=n.select(this.$el[0])},get_fill_color:function(){var p=this.track.get("config").get_value("block_color");if(!p){p=this.track.get("config").get_value("color")}return p},render:function(){var t=this.parent_elt;var s=this.chroms_layout,v=n.svg.arc().innerRadius(this.radius_bounds[0]).outerRadius(this.radius_bounds[1]),p=t.selectAll("g").data(s).enter().append("svg:g"),r=p.append("path").attr("d",v).attr("class","chrom-background").style("stroke",this.bg_stroke).style("fill",this.loading_bg_fill);r.append("title").text(function(x){return x.data.chrom});var q=this,u=q.track.get("data_manager"),w=(u?u.data_is_ready():true);$.when(w).then(function(){$.when(q._render_data(t)).then(function(){r.style("fill",q.bg_fill);q.render_labels()})})},render_labels:function(){},update_radius_bounds:function(q){this.radius_bounds=q;var p=n.svg.arc().innerRadius(this.radius_bounds[0]).outerRadius(this.radius_bounds[1]);this.parent_elt.selectAll("g>path.chrom-background").transition().duration(1000).attr("d",p);this._transition_chrom_data();this._transition_labels()},update_scale:function(s){var r=this.scale;this.scale=s;if(s<=r){return}var q=this,p=new o();this.parent_elt.selectAll("path.chrom-data").filter(function(u,t){return p.is_visible(this)}).each(function(z,v){var y=n.select(this),u=y.attr("chrom"),x=q.genome.get_chrom_region(u),w=q.track.get("data_manager"),t;if(!w.can_get_more_detailed_data(x)){return}t=q.track.get("data_manager").get_more_detailed_data(x,"Coverage",0,s);$.when(t).then(function(C){y.remove();q._update_data_bounds();var B=i.find(q.chroms_layout,function(D){return D.data.chrom===u});var A=q.get_fill_color();q._render_chrom_data(q.parent_elt,B,C).style("stroke",A).style("fill",A)})});return q},_transition_chrom_data:function(){var q=this.track,s=this.chroms_layout,p=this.parent_elt.selectAll("g>path.chrom-data"),t=p[0].length;if(t>0){var r=this;$.when(q.get("data_manager").get_genome_wide_data(this.genome)).then(function(v){var u=i.reject(i.map(v,function(w,x){var y=null,z=r._get_path_function(s[x],w);if(z){y=z(w.data)}return y}),function(w){return w===null});p.each(function(x,w){n.select(this).transition().duration(1000).attr("d",u[w])})})}},_transition_labels:function(){},_update_data_bounds:function(){var p=this.data_bounds;this.data_bounds=this.get_data_bounds(this.track.get("data_manager").get_genome_wide_data(this.genome));if(this.data_bounds[0]<p[0]||this.data_bounds[1]>p[1]){this._transition_chrom_data()}},_render_data:function(s){var r=this,q=this.chroms_layout,p=this.track,t=$.Deferred();$.when(p.get("data_manager").get_genome_wide_data(this.genome)).then(function(v){r.data_bounds=r.get_data_bounds(v);layout_and_data=i.zip(q,v),chroms_data_layout=i.map(layout_and_data,function(w){var x=w[0],y=w[1];return r._render_chrom_data(s,x,y)});var u=r.get_fill_color();r.parent_elt.selectAll("path.chrom-data").style("stroke",u).style("fill",u);t.resolve(s)});return t},_render_chrom_data:function(p,q,r){},_get_path_function:function(q,p){},_chroms_layout:function(){var q=this.genome.get_chroms_info(),s=n.layout.pie().value(function(u){return u.len}).sort(null),t=s(q),p=2*Math.PI*this.total_gap/q.length,r=i.map(t,function(w,v){var u=w.endAngle-p;w.endAngle=(u>w.startAngle?u:w.startAngle);return w});return r}});var b=m.extend({initialize:function(p){m.prototype.initialize.call(this,p);this.innerRadius=this.radius_bounds[0];this.radius_bounds[0]=this.radius_bounds[1];this.bg_stroke="fff";this.bg_fill="fff";this.min_arc_len=0.05},_render_data:function(r){var q=this,p=r.selectAll("g");p.selectAll("path").attr("id",function(v){return"label-"+v.data.chrom});p.append("svg:text").filter(function(v){return v.endAngle-v.startAngle>q.min_arc_len}).attr("text-anchor","middle").append("svg:textPath").attr("class","chrom-label").attr("xlink:href",function(v){return"#label-"+v.data.chrom}).attr("startOffset","25%").text(function(v){return v.data.chrom});var s=function(x){var v=(x.endAngle-x.startAngle)/x.value,w=n.range(0,x.value,25000000).map(function(y,z){return{radius:q.innerRadius,angle:y*v+x.startAngle,label:z===0?0:(z%3?null:q.formatNum(y))}});if(w.length<4){w[w.length-1].label=q.formatNum(Math.round((w[w.length-1].angle-x.startAngle)/v))}return w};var u=function(v){return v.angle>Math.PI?"rotate(180)translate(-16)":null};var t=i.filter(this.chroms_layout,function(v){return v.endAngle-v.startAngle>q.min_arc_len});this.drawTicks(this.parent_elt,t,s,u)}});i.extend(b.prototype,j);var g=m.extend({_quantile:function(q,p){q.sort(n.ascending);return n.quantile(q,p)},_render_chrom_data:function(p,s,q){var t=this._get_path_function(s,q);if(!t){return null}var r=p.datum(q.data),u=r.append("path").attr("class","chrom-data").attr("chrom",s.data.chrom).attr("d",t);return u},_get_path_function:function(s,r){if(typeof r==="string"||!r.data||r.data.length===0){return null}var p=n.scale.linear().domain(this.data_bounds).range(this.radius_bounds).clamp(true);var t=n.scale.linear().domain([0,r.data.length]).range([s.startAngle,s.endAngle]);var q=n.svg.line.radial().interpolate("linear").radius(function(u){return p(u[1])}).angle(function(v,u){return t(u)});return n.svg.area.radial().interpolate(q.interpolate()).innerRadius(p(0)).outerRadius(q.radius()).angle(q.angle())},render_labels:function(){var p=this,q=function(){return"rotate(90)"};this.drawTicks(this.parent_elt,[this.chroms_layout[0]],this._data_bounds_ticks_fn(),q,true)},_transition_labels:function(){if(this.data_bounds.length===0){return}var q=this,s=i.filter(this.chroms_layout,function(t){return t.endAngle-t.startAngle>0.08}),r=i.filter(s,function(u,t){return t%3===0}),p=i.flatten(i.map(r,function(t){return q._data_bounds_ticks_fn()(t)}));this.parent_elt.selectAll("g.tick").data(p).transition().attr("transform",function(t){return"rotate("+(t.angle*180/Math.PI-90)+")translate("+t.radius+",0)"})},_data_bounds_ticks_fn:function(){var p=this;visibleChroms=0;return function(q){return[{radius:p.radius_bounds[0],angle:q.startAngle,label:p.formatNum(p.data_bounds[0])},{radius:p.radius_bounds[1],angle:q.startAngle,label:p.formatNum(p.data_bounds[1])}]}},get_data_bounds:function(p){}});i.extend(g.prototype,j);var e=g.extend({get_data_bounds:function(q){var p=i.flatten(i.map(q,function(r){if(r){return i.map(r.data,function(s){return parseInt(s[1],10)||0})}else{return 0}}));return[i.min(p),this._quantile(p,0.5)||i.max(p)]}});var l=m.extend({render:function(){var p=this;$.when(p.track.get("data_manager").data_is_ready()).then(function(){$.when(p.track.get("data_manager").get_genome_wide_data(p.genome)).then(function(s){var r=[],q=p.genome.get_chroms_info();i.each(s,function(w,v){var t=q[v].chrom;var u=i.map(w.data,function(y){var x=p._get_region_angle(t,y[1]),z=p._get_region_angle(y[3],y[4]);return{source:{startAngle:x,endAngle:x+0.01},target:{startAngle:z,endAngle:z+0.01}}});r=r.concat(u)});p.parent_elt.append("g").attr("class","chord").selectAll("path").data(r).enter().append("path").style("fill",p.get_fill_color()).attr("d",n.svg.chord().radius(p.radius_bounds[0])).style("opacity",1)})})},update_radius_bounds:function(p){this.radius_bounds=p;this.parent_elt.selectAll("path").transition().attr("d",n.svg.chord().radius(this.radius_bounds[0]))},_get_region_angle:function(r,p){var q=i.find(this.chroms_layout,function(s){return s.data.chrom===r});return q.endAngle-((q.endAngle-q.startAngle)*(q.data.len-p)/q.data.len)}});var f=Backbone.View.extend({initialize:function(){var p=new k.Genome(galaxy_config.app.genome),q=new k.GenomeVisualization(galaxy_config.app.viz_config);q.get("config").add([{key:"arc_dataset_height",label:"Arc Dataset Height",type:"int",value:25,view:"circster"},{key:"track_gap",label:"Gap Between Tracks",type:"int",value:5,view:"circster"},{key:"total_gap",label:"Gap [0-1]",type:"float",value:0.4,view:"circster",hidden:true}]);var s=new a({el:$("#center .unified-panel-body"),genome:p,model:q});s.render();$("#center .unified-panel-header-inner").append(galaxy_config.app.viz_config.title+" "+galaxy_config.app.viz_config.dbkey);var r=create_icon_buttons_menu([{icon_class:"plus-button",title:"Add tracks",on_click:function(){k.select_datasets(galaxy_config.root+"visualization/list_current_history_datasets",galaxy_config.root+"api/datasets",q.get("dbkey"),function(t){q.add_tracks(t)})}},{icon_class:"gear",title:"Settings",on_click:function(){var t=new c.ConfigSettingCollectionView({collection:q.get("config")});t.render_in_modal("Configure Visualization")}},{icon_class:"disk--arrow",title:"Save",on_click:function(){Galaxy.modal.show({title:"Saving...",body:"progress"});$.ajax({url:galaxy_config.root+"visualization/save",type:"POST",dataType:"json",data:{id:q.get("vis_id"),title:q.get("title"),dbkey:q.get("dbkey"),type:"trackster",vis_json:JSON.stringify(q)}}).success(function(t){Galaxy.modal.hide();q.set("vis_id",t.vis_id)}).error(function(){Galaxy.modal.show({title:"Could Not Save",body:"Could not save visualization. Please try again later.",buttons:{Cancel:function(){Galaxy.modal.hide()}}})})}},{icon_class:"cross-circle",title:"Close",on_click:function(){window.location=galaxy_config.root+"visualization/list"}}],{tooltip_config:{placement:"bottom"}});r.$el.attr("style","float: right");$("#center .unified-panel-header-inner").append(r.$el);$(".menu-button").tooltip({placement:"bottom"})}});return{GalaxyApp:f}});
\ No newline at end of file
diff -r fd24924488a575516696595a8e61e276d795f2b5 -r 9d91895363591d3c1eb8f18fac8fa6511aa19e52 static/scripts/packed/viz/visualization.js
--- a/static/scripts/packed/viz/visualization.js
+++ b/static/scripts/packed/viz/visualization.js
@@ -1,1 +1,1 @@
-define(["libs/underscore","mvc/data","viz/trackster/util","utils/config"],function(t,k,m,p){var f={toJSON:function(){var v=this,w={};t.each(v.constructor.to_json_keys,function(x){var y=v.get(x);if(x in v.constructor.to_json_mappers){y=v.constructor.to_json_mappers[x](y,v)}w[x]=y});return w}};var a=function(v,y,x,w){$.ajax({url:v,data:x,error:function(){alert("Grid failed")},success:function(z){Galaxy.modal.show({title:"Select datasets for new tracks",body:z,buttons:{Cancel:function(){Galaxy.modal.hide()},Add:function(){var A=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var B={data_type:"track_config",hda_ldda:"hda"},C=$(this).val();if($(this).attr("name")!=="id"){B.hda_ldda="ldda"}A[A.length]=$.ajax({url:y+"/"+C,data:B,dataType:"json"})});$.when.apply($,A).then(function(){var B=(arguments[0] instanceof Array?$.map(arguments,function(C){return C[0]}):[arguments[0]]);w(B)});Galaxy.modal.hide()}}})}})};var g=function(v){this.default_font=v!==undefined?v:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};t.extend(g.prototype,{load_pattern:function(v,z){var w=this.patterns,x=this.dummy_context,y=new Image();y.src=galaxy_config.root+"static/images"+z;y.onload=function(){w[v]=x.createPattern(y,"repeat")}},get_pattern:function(v){return this.patterns[v]},new_canvas:function(){var v=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(v)}v.manager=this;return v}});var r=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(v){this.clear()},get_elt:function(x){var y=this.attributes.obj_cache,z=this.attributes.key_ary,w=x.toString(),v=t.indexOf(z,function(A){return A.toString()===w});if(v!==-1){if(y[w].stale){z.splice(v,1);delete y[w]}else{this.move_key_to_end(x,v)}}return y[w]},set_elt:function(x,z){var A=this.attributes.obj_cache,B=this.attributes.key_ary,w=x.toString(),y=this.attributes.num_elements;if(!A[w]){if(B.length>=y){var v=B.shift();delete A[v.toString()]}B.push(x)}A[w]=z;return z},move_key_to_end:function(w,v){this.attributes.key_ary.splice(v,1);this.attributes.key_ary.push(w)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length},most_recently_added:function(){return this.size()===0?null:this.attributes.key_ary[this.attributes.key_ary.length-1]}});var d=r.extend({defaults:t.extend({},r.prototype.defaults,{dataset:null,genome:null,init_data:null,min_region_size:200,filters_manager:null,data_type:"data",data_mode_compatible:function(v,w){return true},can_subset:function(v){return false}}),initialize:function(v){r.prototype.initialize.call(this);var w=this.get("init_data");if(w){this.add_data(w)}},add_data:function(v){if(this.get("num_elements")<v.length){this.set("num_elements",v.length)}var w=this;t.each(v,function(x){w.set_data(x.region,x)})},data_is_ready:function(){var y=this.get("dataset"),x=$.Deferred(),v=(this.get("data_type")==="raw_data"?"state":this.get("data_type")==="data"?"converted_datasets_state":"error"),w=new m.ServerStateDeferred({ajax_settings:{url:this.get("dataset").url(),data:{hda_ldda:y.get("hda_ldda"),data_type:v},dataType:"json"},interval:5000,success_fn:function(z){return z!=="pending"}});$.when(w.go()).then(function(z){x.resolve(z==="ok"||z==="data")});return x},search_features:function(v){var w=this.get("dataset"),x={query:v,hda_ldda:w.get("hda_ldda"),data_type:"features"};return $.getJSON(w.url(),x)},load_data:function(D,C,w,B){var z=this.get("dataset"),y={data_type:this.get("data_type"),chrom:D.get("chrom"),low:D.get("start"),high:D.get("end"),mode:C,resolution:w,hda_ldda:z.get("hda_ldda")};$.extend(y,B);var F=this.get("filters_manager");if(F){var G=[];var v=F.filters;for(var A=0;A<v.length;A++){G.push(v[A].name)}y.filter_cols=JSON.stringify(G)}var x=this,E=$.getJSON(z.url(),y,function(H){H.region=D;x.set_data(D,H)});this.set_data(D,E);return E},get_data:function(C,B,x,z){var D=this.get_elt(C);if(D&&(m.is_deferred(D)||this.get("data_mode_compatible")(D,B))){return D}var E=this.get("key_ary"),v=this.get("obj_cache"),w,A;for(var y=0;y<E.length;y++){w=E[y];if(w.contains(C)){A=true;D=v[w.toString()];if(m.is_deferred(D)||(this.get("data_mode_compatible")(D,B)&&this.get("can_subset")(D))){this.move_key_to_end(w,y);if(!m.is_deferred(D)){var G=this.subset_entry(D,C);this.set_data(C,G);D=G}return D}}}if(!A&&C.length()<this.attributes.min_region_size){C=C.copy();var F=this.most_recently_added();if(!F||(C.get("start")>F.get("start"))){C.set("end",C.get("start")+this.attributes.min_region_size)}else{C.set("start",C.get("end")-this.attributes.min_region_size)}C.set("genome",this.attributes.genome);C.trim()}return this.load_data(C,B,x,z)},set_data:function(w,v){this.set_elt(w,v)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(D,C,y,B,z){var F=this._mark_stale(D);if(!(F&&this.get("data_mode_compatible")(F,C))){console.log("ERROR: problem with getting more data: current data is not compatible");return}var x=D.get("start");if(z===this.DEEP_DATA_REQ){$.extend(B,{start_val:F.data.length+1})}else{if(z===this.BROAD_DATA_REQ){x=(F.max_high?F.max_high:F.data[F.data.length-1][2])+1}}var E=D.copy().set("start",x);var w=this,A=this.load_data(E,C,y,B),v=$.Deferred();this.set_data(D,v);$.when(A).then(function(G){if(G.data){G.data=F.data.concat(G.data);if(G.max_low){G.max_low=F.max_low}if(G.message){G.message=G.message.replace(/[0-9]+/,G.data.length)}}w.set_data(D,G);v.resolve(G)});return v},can_get_more_detailed_data:function(w){var v=this.get_elt(w);return(v.dataset_type==="bigwig"&&v.data.length<8000)},get_more_detailed_data:function(y,A,w,z,x){var v=this._mark_stale(y);if(!v){console.log("ERROR getting more detailed data: no current data");return}if(!x){x={}}if(v.dataset_type==="bigwig"){x.num_samples=1000*z}return this.load_data(y,A,w,x)},_mark_stale:function(w){var v=this.get_elt(w);if(!v){console.log("ERROR: no data to mark as stale: ",this.get("dataset"),w.toString())}v.stale=true;return v},get_genome_wide_data:function(v){var x=this,z=true,y=t.map(v.get("chroms_info").chrom_info,function(B){var A=x.get_elt(new h({chrom:B.chrom,start:0,end:B.len}));if(!A){z=false}return A});if(z){return y}var w=$.Deferred();$.getJSON(this.get("dataset").url(),{data_type:"genome_data"},function(A){x.add_data(A.data);w.resolve(A.data)});return w},subset_entry:function(x,y){var v={bigwig:function(z,A){return t.filter(z,function(B){return B[0]>=A.get("start")&&B[0]<=A.get("end")})},refseq:function(A,B){var C=B.get("start")-x.region.get("start"),z=x.data.length-(x.region.get("end")-B.get("end"));return x.data.slice(C,z)}};var w=x.data;if(!x.region.same(y)&&x.dataset_type in v){w=v[x.dataset_type](x.data,y)}return{region:y,data:w,dataset_type:x.dataset_type}}});var q=d.extend({initialize:function(v){var w=new Backbone.Model();w.urlRoot=v.data_url;this.set("dataset",w)},load_data:function(x,y,v,w){return(x.length()<=100000?d.prototype.load_data.call(this,x,y,v,w):{data:null,region:x})}});var c=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},initialize:function(v){this.id=v.dbkey},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info},get_chrom_region:function(v){var w=t.find(this.get_chroms_info(),function(x){return x.chrom===v});return new h({chrom:w.chrom,end:w.len})},get_chrom_len:function(v){return t.find(this.get_chroms_info(),function(w){return w.chrom===v}).len}});var h=Backbone.Model.extend({defaults:{chrom:null,start:0,end:0,str_val:null,genome:null},same:function(v){return this.attributes.chrom===v.get("chrom")&&this.attributes.start===v.get("start")&&this.attributes.end===v.get("end")},initialize:function(w){if(w.from_str){var y=w.from_str.split(":"),x=y[0],v=y[1].split("-");this.set({chrom:x,start:parseInt(v[0],10),end:parseInt(v[1],10)})}this.attributes.str_val=this.get("chrom")+":"+this.get("start")+"-"+this.get("end");this.on("change",function(){this.attributes.str_val=this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},this)},copy:function(){return new h({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.attributes.str_val},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(C){var w=this.get("chrom"),B=C.get("chrom"),A=this.get("start"),y=C.get("start"),z=this.get("end"),x=C.get("end"),v;if(w&&B&&w!==B){return h.overlap_results.DIF_CHROMS}if(A<y){if(z<y){v=h.overlap_results.BEFORE}else{if(z<x){v=h.overlap_results.OVERLAP_START}else{v=h.overlap_results.CONTAINS}}}else{if(A>y){if(A>x){v=h.overlap_results.AFTER}else{if(z<=x){v=h.overlap_results.CONTAINED_BY}else{v=h.overlap_results.OVERLAP_END}}}else{v=(z>=x?h.overlap_results.CONTAINS:h.overlap_results.CONTAINED_BY)}}return v},trim:function(v){if(this.attributes.start<0){this.attributes.start=0}if(this.attributes.genome){var w=this.attributes.genome.get_chrom_len(this.attributes.chrom);if(this.attributes.end>w){this.attributes.end=w-1}}return this},contains:function(v){return this.compute_overlap(v)===h.overlap_results.CONTAINS},overlaps:function(v){return t.intersection([this.compute_overlap(v)],[h.overlap_results.DIF_CHROMS,h.overlap_results.BEFORE,h.overlap_results.AFTER]).length===0}},{overlap_results:{DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006}});var n=Backbone.Collection.extend({model:h});var e=Backbone.Model.extend({defaults:{region:null,note:""},initialize:function(v){this.set("region",new h(v.region))}});var s=Backbone.Collection.extend({model:e});var u=Backbone.Model.extend(f).extend({defaults:{mode:"Auto"},initialize:function(v){this.set("dataset",new k.Dataset(v.dataset));this.set("config",p.ConfigSettingCollection.from_config_dict(v.prefs));this.get("config").add([{key:"name",value:this.get("dataset").get("name")},{key:"color"}]);var w=this.get("preloaded_data");if(w){w=w.data}else{w=[]}this.set("data_manager",new d({dataset:this.get("dataset"),init_data:w}))}},{to_json_keys:["track_type","dataset","prefs","mode","filters","tool_state"],to_json_mappers:{prefs:function(w,v){if(t.size(w)===0){w={name:v.get("config").get("name").get("value"),color:v.get("config").get("color").get("value")}}return w},dataset:function(v){return{id:v.id,hda_ldda:v.get("hda_ldda")}}}});var j=Backbone.Collection.extend({model:u});var o=Backbone.Model.extend({defaults:{title:"",type:""},url:galaxy_config.root+"visualization/save",save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var l=o.extend(f).extend({defaults:t.extend({},o.prototype.defaults,{dbkey:"",drawables:null,bookmarks:null,viewport:null}),initialize:function(v){this.set("drawables",new j(v.tracks));this.set("config",p.ConfigSettingCollection.from_config_dict(v.prefs||{}));this.unset("tracks");this.get("drawables").each(function(w){w.unset("preloaded_data")})},add_tracks:function(v){this.get("drawables").add(v)}},{to_json_keys:["view","viewport","bookmarks"],to_json_mappers:{view:function(w,v){return{obj_type:"View",prefs:{name:v.get("title"),content_visible:true},drawables:v.get("drawables")}}}});var b=Backbone.Model.extend({});var i=Backbone.Router.extend({initialize:function(w){this.view=w.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var v=this;v.view.on("navigate",function(x){v.navigate(x)})},change_location:function(v){this.view.go_to(v)}});return{BackboneTrack:u,BrowserBookmark:e,BrowserBookmarkCollection:s,Cache:r,CanvasManager:g,Genome:c,GenomeDataManager:d,GenomeRegion:h,GenomeRegionCollection:n,GenomeVisualization:l,GenomeReferenceDataManager:q,TrackBrowserRouter:i,TrackConfig:b,Visualization:o,select_datasets:a}});
\ No newline at end of file
+define(["libs/underscore","mvc/data","viz/trackster/util","utils/config"],function(t,k,m,p){var f={toJSON:function(){var v=this,w={};t.each(v.constructor.to_json_keys,function(x){var y=v.get(x);if(x in v.constructor.to_json_mappers){y=v.constructor.to_json_mappers[x](y,v)}w[x]=y});return w}};var a=function(v,y,x,w){$.ajax({url:v,data:x,error:function(){alert("Grid failed")},success:function(z){Galaxy.modal.show({title:"Select datasets for new tracks",body:z,buttons:{Cancel:function(){Galaxy.modal.hide()},Add:function(){var A=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var B={data_type:"track_config",hda_ldda:"hda"},C=$(this).val();if($(this).attr("name")!=="id"){B.hda_ldda="ldda"}A[A.length]=$.ajax({url:y+"/"+C,data:B,dataType:"json"})});$.when.apply($,A).then(function(){var B=(arguments[0] instanceof Array?$.map(arguments,function(C){return C[0]}):[arguments[0]]);w(B)});Galaxy.modal.hide()}}})}})};var g=function(v){this.default_font=v!==undefined?v:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};t.extend(g.prototype,{load_pattern:function(v,z){var w=this.patterns,x=this.dummy_context,y=new Image();y.src=galaxy_config.root+"static/images"+z;y.onload=function(){w[v]=x.createPattern(y,"repeat")}},get_pattern:function(v){return this.patterns[v]},new_canvas:function(){var v=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(v)}v.manager=this;return v}});var r=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(v){this.clear()},get_elt:function(x){var y=this.attributes.obj_cache,z=this.attributes.key_ary,w=x.toString(),v=t.indexOf(z,function(A){return A.toString()===w});if(v!==-1){if(y[w].stale){z.splice(v,1);delete y[w]}else{this.move_key_to_end(x,v)}}return y[w]},set_elt:function(x,z){var A=this.attributes.obj_cache,B=this.attributes.key_ary,w=x.toString(),y=this.attributes.num_elements;if(!A[w]){if(B.length>=y){var v=B.shift();delete A[v.toString()]}B.push(x)}A[w]=z;return z},move_key_to_end:function(w,v){this.attributes.key_ary.splice(v,1);this.attributes.key_ary.push(w)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length},most_recently_added:function(){return this.size()===0?null:this.attributes.key_ary[this.attributes.key_ary.length-1]}});var d=r.extend({defaults:t.extend({},r.prototype.defaults,{dataset:null,genome:null,init_data:null,min_region_size:200,filters_manager:null,data_type:"data",data_mode_compatible:function(v,w){return true},can_subset:function(v){return false}}),initialize:function(v){r.prototype.initialize.call(this);var w=this.get("init_data");if(w){this.add_data(w)}},add_data:function(v){if(this.get("num_elements")<v.length){this.set("num_elements",v.length)}var w=this;t.each(v,function(x){w.set_data(x.region,x)})},data_is_ready:function(){var y=this.get("dataset"),x=$.Deferred(),v=(this.get("data_type")==="raw_data"?"state":this.get("data_type")==="data"?"converted_datasets_state":"error"),w=new m.ServerStateDeferred({ajax_settings:{url:this.get("dataset").url(),data:{hda_ldda:y.get("hda_ldda"),data_type:v},dataType:"json"},interval:5000,success_fn:function(z){return z!=="pending"}});$.when(w.go()).then(function(z){x.resolve(z==="ok"||z==="data")});return x},search_features:function(v){var w=this.get("dataset"),x={query:v,hda_ldda:w.get("hda_ldda"),data_type:"features"};return $.getJSON(w.url(),x)},load_data:function(D,C,w,B){var z=this.get("dataset"),y={data_type:this.get("data_type"),chrom:D.get("chrom"),low:D.get("start"),high:D.get("end"),mode:C,resolution:w,hda_ldda:z.get("hda_ldda")};$.extend(y,B);var F=this.get("filters_manager");if(F){var G=[];var v=F.filters;for(var A=0;A<v.length;A++){G.push(v[A].name)}y.filter_cols=JSON.stringify(G)}var x=this,E=$.getJSON(z.url(),y,function(H){H.region=D;x.set_data(D,H)});this.set_data(D,E);return E},get_data:function(C,B,x,z){var D=this.get_elt(C);if(D&&(m.is_deferred(D)||this.get("data_mode_compatible")(D,B))){return D}var E=this.get("key_ary"),v=this.get("obj_cache"),w,A;for(var y=0;y<E.length;y++){w=E[y];if(w.contains(C)){A=true;D=v[w.toString()];if(m.is_deferred(D)||(this.get("data_mode_compatible")(D,B)&&this.get("can_subset")(D))){this.move_key_to_end(w,y);if(!m.is_deferred(D)){var G=this.subset_entry(D,C);this.set_data(C,G);D=G}return D}}}if(!A&&C.length()<this.attributes.min_region_size){C=C.copy();var F=this.most_recently_added();if(!F||(C.get("start")>F.get("start"))){C.set("end",C.get("start")+this.attributes.min_region_size)}else{C.set("start",C.get("end")-this.attributes.min_region_size)}C.set("genome",this.attributes.genome);C.trim()}return this.load_data(C,B,x,z)},set_data:function(w,v){this.set_elt(w,v)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(D,C,y,B,z){var F=this._mark_stale(D);if(!(F&&this.get("data_mode_compatible")(F,C))){console.log("ERROR: problem with getting more data: current data is not compatible");return}var x=D.get("start");if(z===this.DEEP_DATA_REQ){$.extend(B,{start_val:F.data.length+1})}else{if(z===this.BROAD_DATA_REQ){x=(F.max_high?F.max_high:F.data[F.data.length-1][2])+1}}var E=D.copy().set("start",x);var w=this,A=this.load_data(E,C,y,B),v=$.Deferred();this.set_data(D,v);$.when(A).then(function(G){if(G.data){G.data=F.data.concat(G.data);if(G.max_low){G.max_low=F.max_low}if(G.message){G.message=G.message.replace(/[0-9]+/,G.data.length)}}w.set_data(D,G);v.resolve(G)});return v},can_get_more_detailed_data:function(w){var v=this.get_elt(w);return(v.dataset_type==="bigwig"&&v.data.length<8000)},get_more_detailed_data:function(y,A,w,z,x){var v=this._mark_stale(y);if(!v){console.log("ERROR getting more detailed data: no current data");return}if(!x){x={}}if(v.dataset_type==="bigwig"){x.num_samples=1000*z}return this.load_data(y,A,w,x)},_mark_stale:function(w){var v=this.get_elt(w);if(!v){console.log("ERROR: no data to mark as stale: ",this.get("dataset"),w.toString())}v.stale=true;return v},get_genome_wide_data:function(v){var x=this,z=true,y=t.map(v.get("chroms_info").chrom_info,function(B){var A=x.get_elt(new h({chrom:B.chrom,start:0,end:B.len}));if(!A){z=false}return A});if(z){return y}var w=$.Deferred();$.getJSON(this.get("dataset").url(),{data_type:"genome_data"},function(A){x.add_data(A.data);w.resolve(A.data)});return w},subset_entry:function(x,y){var v={bigwig:function(z,A){return t.filter(z,function(B){return B[0]>=A.get("start")&&B[0]<=A.get("end")})},refseq:function(A,B){var C=B.get("start")-x.region.get("start"),z=x.data.length-(x.region.get("end")-B.get("end"));return x.data.slice(C,z)}};var w=x.data;if(!x.region.same(y)&&x.dataset_type in v){w=v[x.dataset_type](x.data,y)}return{region:y,data:w,dataset_type:x.dataset_type}}});var q=d.extend({initialize:function(v){var w=new Backbone.Model();w.urlRoot=v.data_url;this.set("dataset",w)},load_data:function(x,y,v,w){return(x.length()<=100000?d.prototype.load_data.call(this,x,y,v,w):{data:null,region:x})}});var c=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},initialize:function(v){this.id=v.dbkey},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info},get_chrom_region:function(v){var w=t.find(this.get_chroms_info(),function(x){return x.chrom===v});return new h({chrom:w.chrom,end:w.len})},get_chrom_len:function(v){return t.find(this.get_chroms_info(),function(w){return w.chrom===v}).len}});var h=Backbone.Model.extend({defaults:{chrom:null,start:0,end:0,str_val:null,genome:null},same:function(v){return this.attributes.chrom===v.get("chrom")&&this.attributes.start===v.get("start")&&this.attributes.end===v.get("end")},initialize:function(w){if(w.from_str){var y=w.from_str.split(":"),x=y[0],v=y[1].split("-");this.set({chrom:x,start:parseInt(v[0],10),end:parseInt(v[1],10)})}this.attributes.str_val=this.get("chrom")+":"+this.get("start")+"-"+this.get("end");this.on("change",function(){this.attributes.str_val=this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},this)},copy:function(){return new h({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.attributes.str_val},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(C){var w=this.get("chrom"),B=C.get("chrom"),A=this.get("start"),y=C.get("start"),z=this.get("end"),x=C.get("end"),v;if(w&&B&&w!==B){return h.overlap_results.DIF_CHROMS}if(A<y){if(z<y){v=h.overlap_results.BEFORE}else{if(z<x){v=h.overlap_results.OVERLAP_START}else{v=h.overlap_results.CONTAINS}}}else{if(A>y){if(A>x){v=h.overlap_results.AFTER}else{if(z<=x){v=h.overlap_results.CONTAINED_BY}else{v=h.overlap_results.OVERLAP_END}}}else{v=(z>=x?h.overlap_results.CONTAINS:h.overlap_results.CONTAINED_BY)}}return v},trim:function(v){if(this.attributes.start<0){this.attributes.start=0}if(this.attributes.genome){var w=this.attributes.genome.get_chrom_len(this.attributes.chrom);if(this.attributes.end>w){this.attributes.end=w-1}}return this},contains:function(v){return this.compute_overlap(v)===h.overlap_results.CONTAINS},overlaps:function(v){return t.intersection([this.compute_overlap(v)],[h.overlap_results.DIF_CHROMS,h.overlap_results.BEFORE,h.overlap_results.AFTER]).length===0}},{overlap_results:{DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006}});var n=Backbone.Collection.extend({model:h});var e=Backbone.Model.extend({defaults:{region:null,note:""},initialize:function(v){this.set("region",new h(v.region))}});var s=Backbone.Collection.extend({model:e});var u=Backbone.Model.extend(f).extend({defaults:{mode:"Auto"},initialize:function(v){this.set("dataset",new k.Dataset(v.dataset));var x=[{key:"name",value:this.get("dataset").get("name")},{key:"color"}];this.set("config",p.ConfigSettingCollection.from_models_and_saved_values(x,v.prefs));var w=this.get("preloaded_data");if(w){w=w.data}else{w=[]}this.set("data_manager",new d({dataset:this.get("dataset"),init_data:w}))}},{to_json_keys:["track_type","dataset","prefs","mode","filters","tool_state"],to_json_mappers:{prefs:function(w,v){if(t.size(w)===0){w={name:v.get("config").get("name").get("value"),color:v.get("config").get("color").get("value")}}return w},dataset:function(v){return{id:v.id,hda_ldda:v.get("hda_ldda")}}}});var j=Backbone.Collection.extend({model:u});var o=Backbone.Model.extend({defaults:{title:"",type:""},url:galaxy_config.root+"visualization/save",save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var l=o.extend(f).extend({defaults:t.extend({},o.prototype.defaults,{dbkey:"",drawables:null,bookmarks:null,viewport:null}),initialize:function(v){this.set("drawables",new j(v.tracks));var w=[];this.set("config",p.ConfigSettingCollection.from_models_and_saved_values(w,v.prefs));this.unset("tracks");this.get("drawables").each(function(x){x.unset("preloaded_data")})},add_tracks:function(v){this.get("drawables").add(v)}},{to_json_keys:["view","viewport","bookmarks"],to_json_mappers:{view:function(w,v){return{obj_type:"View",prefs:{name:v.get("title"),content_visible:true},drawables:v.get("drawables")}}}});var b=Backbone.Model.extend({});var i=Backbone.Router.extend({initialize:function(w){this.view=w.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var v=this;v.view.on("navigate",function(x){v.navigate(x)})},change_location:function(v){this.view.go_to(v)}});return{BackboneTrack:u,BrowserBookmark:e,BrowserBookmarkCollection:s,Cache:r,CanvasManager:g,Genome:c,GenomeDataManager:d,GenomeRegion:h,GenomeRegionCollection:n,GenomeVisualization:l,GenomeReferenceDataManager:q,TrackBrowserRouter:i,TrackConfig:b,Visualization:o,select_datasets:a}});
\ No newline at end of file
diff -r fd24924488a575516696595a8e61e276d795f2b5 -r 9d91895363591d3c1eb8f18fac8fa6511aa19e52 static/scripts/viz/circster.js
--- a/static/scripts/viz/circster.js
+++ b/static/scripts/viz/circster.js
@@ -96,7 +96,7 @@
// Calculate return value
var rval = null;
- if (num < 1) {
+ if (Math.abs(num) < 1) {
rval = num.toPrecision(sigDigits);
}
else {
@@ -104,6 +104,7 @@
var roundedNum = Math.round(num.toPrecision(sigDigits));
// Use abbreviations.
+ num = Math.abs(num);
if (num < 1000) {
rval = roundedNum;
}
@@ -426,10 +427,6 @@
// -- Create track group element. --
var track_parent_elt = this.parent_elt;
- if (!track_parent_elt) {
- console.log('no parent elt');
- }
-
// -- Render background arcs. --
var genome_arcs = this.chroms_layout,
arc_gen = d3.svg.arc()
@@ -909,7 +906,7 @@
return 0;
}
}) );
-
+
// For max, use 98% quantile in attempt to avoid very large values. However, this max may be 0
// for sparsely populated data, so use max in that case.
return [ _.min(values), this._quantile(values, 0.5) || _.max(values) ];
diff -r fd24924488a575516696595a8e61e276d795f2b5 -r 9d91895363591d3c1eb8f18fac8fa6511aa19e52 static/scripts/viz/visualization.js
--- a/static/scripts/viz/visualization.js
+++ b/static/scripts/viz/visualization.js
@@ -894,14 +894,12 @@
this.set('dataset', new data_mod.Dataset(options.dataset));
// -- Set up config settings. --
-
- this.set('config', config_mod.ConfigSettingCollection.from_config_dict(options.prefs));
-
- // Set up some minimal config.
- this.get('config').add( [
+ var models = [
{ key: 'name', value: this.get('dataset').get('name') },
{ key: 'color' }
- ] );
+ ];
+
+ this.set('config', config_mod.ConfigSettingCollection.from_models_and_saved_values(models, options.prefs));
// -- Set up data manager. --
var preloaded_data = this.get('preloaded_data');
@@ -993,7 +991,9 @@
initialize: function(options) {
// Replace drawables with tracks.
this.set('drawables', new BackboneTrackCollection(options.tracks));
- this.set('config', config_mod.ConfigSettingCollection.from_config_dict(options.prefs || {}));
+
+ var models = [];
+ this.set('config', config_mod.ConfigSettingCollection.from_models_and_saved_values(models, options.prefs));
// Clear track and data definitions to avoid storing large objects.
this.unset('tracks');
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