diff --git a/lib/galaxy/webapps/galaxy/api/folder_contents.py b/lib/galaxy/webapps/galaxy/api/folder_contents.py index 322bc043c5d..be515e9e381 100644 --- a/lib/galaxy/webapps/galaxy/api/folder_contents.py +++ b/lib/galaxy/webapps/galaxy/api/folder_contents.py @@ -161,10 +161,13 @@ class FolderContentsController( BaseAPIController, UsesLibraryMixin, UsesLibrary # Check whether user can modify the current folder can_modify_folder = is_admin or trans.app.security_agent.can_modify_library_item( current_user_roles, folder ) - + parent_library_id = None + if folder.parent_library is not None: + parent_library_id = trans.security.encode_id( folder.parent_library.id ) metadata = dict( full_path=full_path, can_add_library_item=can_add_library_item, - can_modify_folder=can_modify_folder ) + can_modify_folder=can_modify_folder, + parent_library_id=parent_library_id ) folder_container = dict( metadata=metadata, folder_contents=folder_contents ) return folder_container diff --git a/lib/galaxy/webapps/galaxy/api/lda_datasets.py b/lib/galaxy/webapps/galaxy/api/lda_datasets.py index 3b302285efb..71d6c923de0 100644 --- a/lib/galaxy/webapps/galaxy/api/lda_datasets.py +++ b/lib/galaxy/webapps/galaxy/api/lda_datasets.py @@ -80,7 +80,7 @@ class LibraryDatasetsController( BaseAPIController, UsesVisualizationMixin ): rval[ 'can_user_manage' ] = trans.app.security_agent.can_manage_dataset( current_user_roles, library_dataset.library_dataset_dataset_association.dataset) or trans.user_is_admin() return rval - @expose_api + @expose_api_anonymous def show_version( self, trans, encoded_dataset_id, encoded_ldda_id, **kwd ): """ show_version( self, trans, encoded_dataset_id, encoded_ldda_id, **kwd ): diff --git a/static/scripts/mvc/library/library-dataset-view.js b/static/scripts/mvc/library/library-dataset-view.js index 72982038d89..e2e8d5badc4 100644 --- a/static/scripts/mvc/library/library-dataset-view.js +++ b/static/scripts/mvc/library/library-dataset-view.js @@ -88,6 +88,13 @@ var LibraryDatasetView = Backbone.View.extend({ this.ldda.fetch({ success: function(){ that.renderVersion(); + }, + error: function(model, response){ + if (typeof response.responseJSON !== "undefined"){ + mod_toastr.error(response.responseJSON.err_msg); + } else { + mod_toastr.error('An error ocurred :('); + } } }); } @@ -153,8 +160,12 @@ var LibraryDatasetView = Backbone.View.extend({ var self = this; this.histories = new mod_library_model.GalaxyHistories(); this.histories.fetch({ - success: function (){ - callback(self); + success: function (histories){ + if (histories.length === 0){ + mod_toastr.warning('You have to create history first. Click this to do so.', '', {onclick: function() {window.location='/';}}); + } else { + callback(self); + } }, error: function(model, response){ if (typeof response.responseJSON !== "undefined"){ @@ -645,7 +656,7 @@ var LibraryDatasetView = Backbone.View.extend({ tmpl_array.push('
'); tmpl_array.push('
'); - tmpl_array.push(' /datasets/<%- item.id %>">'); + tmpl_array.push(' /datasets/<%- item.id %>">'); tmpl_array.push('
'); // BREADCRUMBS diff --git a/static/scripts/mvc/library/library-folderlist-view.js b/static/scripts/mvc/library/library-folderlist-view.js index 83d3cb57c93..7e26e4f0835 100644 --- a/static/scripts/mvc/library/library-folderlist-view.js +++ b/static/scripts/mvc/library/library-folderlist-view.js @@ -100,7 +100,7 @@ var FolderListView = Backbone.View.extend({ upper_folder_id = path[path.length-2][0]; } - this.$el.html(template({ path: this.folderContainer.attributes.metadata.full_path, id: this.options.id, upper_folder_id: upper_folder_id, order: this.sort})); + this.$el.html(template({ path: this.folderContainer.attributes.metadata.full_path, parent_library_id: this.folderContainer.attributes.metadata.parent_library_id, id: this.options.id, upper_folder_id: upper_folder_id, order: this.sort})); // initialize the library tooltips $("#center [data-toggle]").tooltip(); @@ -304,7 +304,7 @@ var FolderListView = Backbone.View.extend({ tmpl_array.push(''); // FOLDER CONTENT - tmpl_array.push(''); + tmpl_array.push('
'); tmpl_array.push(' '); tmpl_array.push(' '); tmpl_array.push(' '); diff --git a/static/scripts/mvc/library/library-foldertoolbar-view.js b/static/scripts/mvc/library/library-foldertoolbar-view.js index 4540592d85f..7364f804c27 100644 --- a/static/scripts/mvc/library/library-foldertoolbar-view.js +++ b/static/scripts/mvc/library/library-foldertoolbar-view.js @@ -346,8 +346,12 @@ var FolderToolbarView = Backbone.View.extend({ self.histories.get(history_id).set({'contents' : history_contents}); self.modal.$el.find('#selected_history_content').html(history_contents_template({history_contents: history_contents.models.reverse()})); }, - error: function(){ - mod_toastr.error('An error ocurred :('); + error: function(model, response){ + if (typeof response.responseJSON !== "undefined"){ + mod_toastr.error(response.responseJSON.err_msg); + } else { + mod_toastr.error('An error ocurred :('); + } } }); }, @@ -516,17 +520,36 @@ var FolderToolbarView = Backbone.View.extend({ }, showLibInfo: function(){ - var self = this; - var template = this.templateLibInfoInModal(); - this.modal = Galaxy.modal; - this.modal.show({ - closing_events : true, - title : 'Library Information', - body : template({library:library}), - buttons : { - 'Close' : function() {Galaxy.modal.hide();} + var library_id = Galaxy.libraries.folderListView.folderContainer.attributes.metadata.parent_library_id; + var library = null; + var that = this; + if (Galaxy.libraries.libraryListView !== null){ + library = Galaxy.libraries.libraryListView.collection.get(library_id); + } else { + library = new mod_library_model.Library({id: library_id}); + library.fetch({ + success: function(){ + var template = that.templateLibInfoInModal(); + that.modal = Galaxy.modal; + that.modal.show({ + closing_events : true, + title : 'Library Information', + body : template({library:library}), + buttons : { + 'Close' : function() {Galaxy.modal.hide();} + } + }); + }, + error: function(model, response){ + if (typeof response.responseJSON !== "undefined"){ + mod_toastr.error(response.responseJSON.err_msg); + } else { + mod_toastr.error('An error ocurred :('); + } } - }); + }) + } + }, templateToolBar: function(){ @@ -536,7 +559,8 @@ var FolderToolbarView = Backbone.View.extend({ tmpl_array.push('
'); // TOOLBAR START tmpl_array.push('
'); - tmpl_array.push(' '); + tmpl_array.push(' DATA LIBRARIES'); + tmpl_array.push(' '); tmpl_array.push(' '); tmpl_array.push(' '); - tmpl_array.push(' '); + tmpl_array.push(' '); + tmpl_array.push(' '); + tmpl_array.push('
'); // TOOLBAR END tmpl_array.push('
'); @@ -568,6 +594,13 @@ var FolderToolbarView = Backbone.View.extend({ tmpl_array = []; tmpl_array.push('
'); + tmpl_array.push('

Library name:

'); + tmpl_array.push('

<%- library.get("name") %>

'); + tmpl_array.push('

Library description:

'); + tmpl_array.push('

<%- library.get("description") %>

'); + tmpl_array.push('

Library synopsis:

'); + tmpl_array.push('

<%- library.get("synopsis") %>

'); + tmpl_array.push('
'); return _.template(tmpl_array.join('')); diff --git a/static/scripts/mvc/library/library-librarylist-view.js b/static/scripts/mvc/library/library-librarylist-view.js index 30fa544764a..5fd61cf8ef4 100644 --- a/static/scripts/mvc/library/library-librarylist-view.js +++ b/static/scripts/mvc/library/library-librarylist-view.js @@ -29,15 +29,12 @@ var LibraryListView = Backbone.View.extend({ initialize : function(options){ this.options = _.defaults(this.options || {}, options); - var viewContext = this; - + var that = this; this.rowViews = {}; - this.collection = new mod_library_model.Libraries(); - this.collection.fetch({ success: function(){ - viewContext.render(); + that.render(); }, error: function(model, response){ if (typeof response.responseJSON !== "undefined"){ @@ -53,10 +50,6 @@ var LibraryListView = Backbone.View.extend({ * or from a given array of library models, * or renders an empty list in case no data is given. */ render: function (options) { - /** - * need to hide manually because of the element removal - * bug in tooltip - */ $(".tooltip").hide(); var template = this.templateLibraryList(); var libraries_to_render = null; diff --git a/static/scripts/mvc/library/library-librarytoolbar-view.js b/static/scripts/mvc/library/library-librarytoolbar-view.js index b4cc07c3c89..855ba284cfd 100644 --- a/static/scripts/mvc/library/library-librarytoolbar-view.js +++ b/static/scripts/mvc/library/library-librarytoolbar-view.js @@ -116,12 +116,19 @@ var LibraryToolbarView = Backbone.View.extend({ tmpl_array.push('
'); // TOOLBAR tmpl_array.push('
'); - tmpl_array.push(' <% if(admin_user === true) { %>'); - tmpl_array.push('
'); - tmpl_array.push(' include deleted'); - tmpl_array.push(' '); + tmpl_array.push('
'); + tmpl_array.push(' DATA LIBRARIES'); + tmpl_array.push(' <% if(admin_user === true) { %>'); + tmpl_array.push(' | include deleted |'); + tmpl_array.push(' '); + tmpl_array.push(' <% } %>'); + tmpl_array.push(' '); tmpl_array.push('
'); - tmpl_array.push(' <% } %>'); + + tmpl_array.push('
'); + tmpl_array.push(' '); + tmpl_array.push('
'); + tmpl_array.push('
'); tmpl_array.push('
'); // table with libraries will append here diff --git a/static/scripts/packed/mvc/library/library-dataset-view.js b/static/scripts/packed/mvc/library/library-dataset-view.js index e6e87f97185..37821cf5eaf 100644 --- a/static/scripts/packed/mvc/library/library-dataset-view.js +++ b/static/scripts/packed/mvc/library/library-dataset-view.js @@ -1 +1 @@ -define(["libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(d,c,b){var a=Backbone.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_modify_dataset":"enableModification","click .toolbtn_cancel_modifications":"render","click .toolbtn-download-dataset":"downloadDataset","click .toolbtn-import-dataset":"importIntoHistory","click .toolbtn-share-dataset":"shareDataset","click .btn-copy-link-to-clipboard":"copyToClipboard","click .btn-make-private":"makeDatasetPrivate","click .btn-remove-restrictions":"removeDatasetRestrictions","click .toolbtn_save_permissions":"savePermissions","click .toolbtn_save_modifications":"comingSoon",},initialize:function(e){this.options=_.extend(this.options,e);if(this.options.id){this.fetchDataset()}},fetchDataset:function(e){this.options=_.extend(this.options,e);this.model=new c.Item({id:this.options.id});var f=this;this.model.fetch({success:function(){if(f.options.show_permissions){f.showPermissions()}else{if(f.options.show_version){f.fetchVersion()}else{f.render()}}},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}else{d.error("An error ocurred :(. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}}})},render:function(e){this.options=_.extend(this.options,e);$(".tooltip").remove();var f=this.templateDataset();this.$el.html(f({item:this.model}));$(".peek").html(this.model.get("peek"));$("#center [data-toggle]").tooltip()},fetchVersion:function(e){this.options=_.extend(this.options,e);that=this;if(!this.options.ldda_id){this.render();d.error("Library dataset version requested but no id provided.")}else{this.ldda=new c.Ldda({id:this.options.ldda_id});this.ldda.url=this.ldda.urlRoot+this.model.id+"/versions/"+this.ldda.id;this.ldda.fetch({success:function(){that.renderVersion()}})}},renderVersion:function(){$(".tooltip").remove();var e=this.templateVersion();this.$el.html(e({item:this.model,ldda:this.ldda}));$(".peek").html(this.ldda.get("peek"))},enableModification:function(){$(".tooltip").remove();var e=this.templateModifyDataset();this.$el.html(e({item:this.model}));$(".peek").html(this.model.get("peek"));$("#center [data-toggle]").tooltip()},downloadDataset:function(){var e="/api/libraries/datasets/download/uncompressed";var f={ldda_ids:this.id};this.processDownload(e,f)},processDownload:function(f,g,h){if(f&&g){g=typeof g=="string"?g:$.param(g);var e="";$.each(g.split("&"),function(){var i=this.split("=");e+=''});$('
'+e+"").appendTo("body").submit().remove();d.info("Your download will begin soon")}},importIntoHistory:function(){this.refreshUserHistoriesList(function(e){var f=e.templateBulkImportInModal();e.modal=Galaxy.modal;e.modal.show({closing_events:true,title:"Import into History",body:f({histories:e.histories.models}),buttons:{Import:function(){e.importCurrentIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})},refreshUserHistoriesList:function(f){var e=this;this.histories=new c.GalaxyHistories();this.histories.fetch({success:function(){f(e)},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg)}else{d.error("An error ocurred :(")}}})},importCurrentIntoHistory:function(){var f=$(this.modal.elMain).find("select[name=dataset_import_single] option:selected").val();var g=new c.HistoryItem();g.url=g.urlRoot+f+"/contents";var e="/api/histories/"+f+"/set_as_current";$.ajax({url:e,type:"PUT"});g.save({content:this.id,source:"library"},{success:function(){Galaxy.modal.hide();d.success("Dataset imported. Click this to start analysing it.","",{onclick:function(){window.location="/"}})},error:function(i,h){if(typeof h.responseJSON!=="undefined"){d.error("Dataset not imported. "+h.responseJSON.err_msg)}else{d.error("An error occured! Dataset not imported. Please try again.")}}})},shareDataset:function(){d.info("Feature coming soon.")},goBack:function(){Galaxy.libraries.library_router.back()},showPermissions:function(f){this.options=_.extend(this.options,f);$(".tooltip").remove();if(this.options.fetched_permissions!==undefined){if(this.options.fetched_permissions.access_dataset_roles.length===0){this.model.set({is_unrestricted:true})}else{this.model.set({is_unrestricted:false})}}var h=false;if(Galaxy.currUser){h=Galaxy.currUser.isAdmin()}var g=this.templateDatasetPermissions();this.$el.html(g({item:this.model,is_admin:h}));var e=this;if(this.options.fetched_permissions===undefined){$.get("/api/libraries/datasets/"+e.id+"/permissions?scope=current").done(function(i){e.prepareSelectBoxes({fetched_permissions:i,is_admin:h})}).fail(function(){d.error("An error occurred while fetching dataset permissions. :(")})}else{this.prepareSelectBoxes({is_admin:h})}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},prepareSelectBoxes:function(r){this.options=_.extend(this.options,r);var s=this.options.fetched_permissions;var k=this.options.is_admin;var q=this;var m=[];for(var h=0;h=0;h--){g.push(k[h].id)}for(var h=f.length-1;h>=0;h--){j.push(f[h].id)}for(var h=m.length-1;h>=0;h--){l.push(m[h].id)}$.post("/api/libraries/datasets/"+n.id+"/permissions?action=set_permissions",{"access_ids[]":g,"manage_ids[]":j,"modify_ids[]":l,}).done(function(i){n.showPermissions({fetched_permissions:i});d.success("Permissions saved")}).fail(function(){d.error("An error occurred while setting dataset permissions :(")})},templateDataset:function(){var e=[];e.push('
');e.push('
');e.push(' ');e.push(' ');e.push(' <% if (item.get("can_user_modify")) { %>');e.push(' ');e.push(" <% } %>");e.push(' <% if (item.get("can_user_manage")) { %>');e.push(' /datasets/<%- item.id %>/permissions">');e.push(' ');e.push(" <% } %>");e.push("
");e.push('");e.push('<% if (item.get("is_unrestricted")) { %>');e.push('
');e.push(" This dataset is unrestricted so everybody can access it. Just share the URL of this page. ");e.push(' ');e.push("
");e.push("<% } %>");e.push('
');e.push('
');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(' <% if (item.get("data_type")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("genome_build")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("file_size")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("date_uploaded")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("uploaded_by")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("metadata_data_lines")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("metadata_comment_lines")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("metadata_columns")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("metadata_column_types")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("message")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("misc_blurb")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("misc_info")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push("
">Name<%= _.escape(item.get("name")) %>
Data type<%= _.escape(item.get("data_type")) %>
Genome build<%= _.escape(item.get("genome_build")) %>
Size<%= _.escape(item.get("file_size")) %>
Date uploaded (UTC)<%= _.escape(item.get("date_uploaded")) %>
Uploaded by<%= _.escape(item.get("uploaded_by")) %>
Data Lines<%= _.escape(item.get("metadata_data_lines")) %>
Comment Lines<%= _.escape(item.get("metadata_comment_lines")) %>
Number of Columns<%= _.escape(item.get("metadata_columns")) %>
Column Types<%= _.escape(item.get("metadata_column_types")) %>
Message<%= _.escape(item.get("message")) %>
Miscellaneous blurb<%= _.escape(item.get("misc_blurb")) %>
Miscellaneous information<%= _.escape(item.get("misc_info")) %>
");e.push("
");e.push('
');e.push("        
");e.push("
");e.push(' <% if (item.get("has_versions")) { %>');e.push("
");e.push("

Expired versions:

");e.push("
");e.push(" <% } %>");e.push("
");e.push("");return _.template(e.join(""))},templateVersion:function(){var e=[];e.push('
');e.push('
');e.push(' /datasets/<%- item.id %>">');e.push("
");e.push('");e.push('
This is an expired version of the library dataset: <%= _.escape(item.get("name")) %>
');e.push('
');e.push(' ');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(' <% if (ldda.get("data_type")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("genome_build")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("file_size")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("date_uploaded")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("uploaded_by")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_data_lines")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_comment_lines")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_columns")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_column_types")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("message")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("misc_blurb")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("misc_info")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push("
Name<%= _.escape(ldda.get("name")) %>
Data type<%= _.escape(ldda.get("data_type")) %>
Genome build<%= _.escape(ldda.get("genome_build")) %>
Size<%= _.escape(ldda.get("file_size")) %>
Date uploaded (UTC)<%= _.escape(ldda.get("date_uploaded")) %>
Uploaded by<%= _.escape(ldda.get("uploaded_by")) %>
Data Lines<%= _.escape(ldda.get("metadata_data_lines")) %>
Comment Lines<%= _.escape(ldda.get("metadata_comment_lines")) %>
Number of Columns<%= _.escape(ldda.get("metadata_columns")) %>
Column Types<%= _.escape(ldda.get("metadata_column_types")) %>
Message<%= _.escape(ldda.get("message")) %>
Miscellaneous blurb<%= _.escape(ldda.get("misc_blurb")) %>
Miscellaneous information<%= _.escape(ldda.get("misc_info")) %>
");e.push("
");e.push('
');e.push("        
");e.push("
");e.push("
");e.push("
");return _.template(e.join(""))},templateModifyDataset:function(){var e=[];e.push('
');e.push('
');e.push(' ');e.push(' ');e.push("
");e.push('");e.push('
');e.push('

For more editing options please import the dataset to history and use "Edit attributes" on it.

');e.push(' ');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(' ');e.push(' ');e.push(' ');e.push(" ");e.push(' ');e.push(' <% if (item.get("metadata_comment_lines") === "") { %>');e.push(' ');e.push(" <% } else { %>");e.push(' ');e.push(" <% } %>");e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push("
">Name">
Data type<%= _.escape(item.get("data_type")) %>
Genome build<%= _.escape(item.get("genome_build")) %>
Size<%= _.escape(item.get("file_size")) %>
Date uploaded (UTC)<%= _.escape(item.get("date_uploaded")) %>
Uploaded by<%= _.escape(item.get("uploaded_by")) %>
Data Lines<%= _.escape(item.get("metadata_data_lines")) %>
Comment Lines<%= _.escape(item.get("metadata_comment_lines")) %>unknown
Number of Columns<%= _.escape(item.get("metadata_columns")) %>
Column Types<%= _.escape(item.get("metadata_column_types")) %>
Message<%= _.escape(item.get("message")) %>
Miscellaneous information<%= _.escape(item.get("misc_info")) %>
Miscellaneous blurb<%= _.escape(item.get("misc_blurb")) %>
");e.push("
");e.push('
');e.push("   
");e.push("
");e.push("
");e.push("
");return _.template(e.join(""))},templateDatasetPermissions:function(){var e=[];e.push('
');e.push('
');e.push(' ">');e.push(' /datasets/<%- item.id %>">');e.push("
");e.push('");e.push('

Dataset: <%= _.escape(item.get("name")) %>

');e.push('
');e.push("<% if (is_admin) { %>");e.push("You are logged in as an administrator therefore you can manage any dataset on this Galaxy instance. Please make sure you understand the consequences.");e.push("<% } else { %>");e.push("You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.");e.push("<% } %>");e.push("
");e.push('
');e.push("

Library-related permissions

");e.push("

Roles that can modify the library item

");e.push('
');e.push('
User with any of these roles can modify name, metadata, and other information about this library item.
');e.push("
");e.push("

Dataset-related permissions

");e.push('
Changes made below will affect every library item that was created from this dataset and also every history this dataset is part of.
');e.push('<% if (!item.get("is_unrestricted")) { %>');e.push("

You can remove all access restrictions on this dataset. ");e.push(' ");e.push("

");e.push("<% } else { %>");e.push(" This dataset is unrestricted so everybody can access it. Just share the URL of this page.");e.push(' ');e.push("

You can make this dataset private to you. ");e.push(' ');e.push("

");e.push("<% } %>");e.push("

Roles that can access the dataset

");e.push('
');e.push('
User has to have all these roles in order to access this dataset. Users without access permission cannot have other permissions on this dataset. If there are no access roles set on the dataset it is considered unrestricted.
');e.push("

Roles that can manage permissions on the dataset

");e.push('
');e.push('
User with any of these roles can manage permissions of this dataset. If you remove yourself you will loose the ability manage this dataset unless you are an admin.
');e.push('');e.push("
");e.push("
");return _.template(e.join(""))},templateBulkImportInModal:function(){var e=[];e.push('');e.push("Select history: ");e.push('");e.push("");return _.template(e.join(""))},templateAccessSelect:function(){var e=[];e.push('");return _.template(e.join(""))}});return{LibraryDatasetView:a}}); \ No newline at end of file +define(["libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(d,c,b){var a=Backbone.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_modify_dataset":"enableModification","click .toolbtn_cancel_modifications":"render","click .toolbtn-download-dataset":"downloadDataset","click .toolbtn-import-dataset":"importIntoHistory","click .toolbtn-share-dataset":"shareDataset","click .btn-copy-link-to-clipboard":"copyToClipboard","click .btn-make-private":"makeDatasetPrivate","click .btn-remove-restrictions":"removeDatasetRestrictions","click .toolbtn_save_permissions":"savePermissions","click .toolbtn_save_modifications":"comingSoon",},initialize:function(e){this.options=_.extend(this.options,e);if(this.options.id){this.fetchDataset()}},fetchDataset:function(e){this.options=_.extend(this.options,e);this.model=new c.Item({id:this.options.id});var f=this;this.model.fetch({success:function(){if(f.options.show_permissions){f.showPermissions()}else{if(f.options.show_version){f.fetchVersion()}else{f.render()}}},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}else{d.error("An error ocurred :(. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}}})},render:function(e){this.options=_.extend(this.options,e);$(".tooltip").remove();var f=this.templateDataset();this.$el.html(f({item:this.model}));$(".peek").html(this.model.get("peek"));$("#center [data-toggle]").tooltip()},fetchVersion:function(e){this.options=_.extend(this.options,e);that=this;if(!this.options.ldda_id){this.render();d.error("Library dataset version requested but no id provided.")}else{this.ldda=new c.Ldda({id:this.options.ldda_id});this.ldda.url=this.ldda.urlRoot+this.model.id+"/versions/"+this.ldda.id;this.ldda.fetch({success:function(){that.renderVersion()},error:function(g,f){if(typeof f.responseJSON!=="undefined"){d.error(f.responseJSON.err_msg)}else{d.error("An error ocurred :(")}}})}},renderVersion:function(){$(".tooltip").remove();var e=this.templateVersion();this.$el.html(e({item:this.model,ldda:this.ldda}));$(".peek").html(this.ldda.get("peek"))},enableModification:function(){$(".tooltip").remove();var e=this.templateModifyDataset();this.$el.html(e({item:this.model}));$(".peek").html(this.model.get("peek"));$("#center [data-toggle]").tooltip()},downloadDataset:function(){var e="/api/libraries/datasets/download/uncompressed";var f={ldda_ids:this.id};this.processDownload(e,f)},processDownload:function(f,g,h){if(f&&g){g=typeof g=="string"?g:$.param(g);var e="";$.each(g.split("&"),function(){var i=this.split("=");e+=''});$('
'+e+"
").appendTo("body").submit().remove();d.info("Your download will begin soon")}},importIntoHistory:function(){this.refreshUserHistoriesList(function(e){var f=e.templateBulkImportInModal();e.modal=Galaxy.modal;e.modal.show({closing_events:true,title:"Import into History",body:f({histories:e.histories.models}),buttons:{Import:function(){e.importCurrentIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})},refreshUserHistoriesList:function(f){var e=this;this.histories=new c.GalaxyHistories();this.histories.fetch({success:function(g){if(g.length===0){d.warning("You have to create history first. Click this to do so.","",{onclick:function(){window.location="/"}})}else{f(e)}},error:function(h,g){if(typeof g.responseJSON!=="undefined"){d.error(g.responseJSON.err_msg)}else{d.error("An error ocurred :(")}}})},importCurrentIntoHistory:function(){var f=$(this.modal.elMain).find("select[name=dataset_import_single] option:selected").val();var g=new c.HistoryItem();g.url=g.urlRoot+f+"/contents";var e="/api/histories/"+f+"/set_as_current";$.ajax({url:e,type:"PUT"});g.save({content:this.id,source:"library"},{success:function(){Galaxy.modal.hide();d.success("Dataset imported. Click this to start analysing it.","",{onclick:function(){window.location="/"}})},error:function(i,h){if(typeof h.responseJSON!=="undefined"){d.error("Dataset not imported. "+h.responseJSON.err_msg)}else{d.error("An error occured! Dataset not imported. Please try again.")}}})},shareDataset:function(){d.info("Feature coming soon.")},goBack:function(){Galaxy.libraries.library_router.back()},showPermissions:function(f){this.options=_.extend(this.options,f);$(".tooltip").remove();if(this.options.fetched_permissions!==undefined){if(this.options.fetched_permissions.access_dataset_roles.length===0){this.model.set({is_unrestricted:true})}else{this.model.set({is_unrestricted:false})}}var h=false;if(Galaxy.currUser){h=Galaxy.currUser.isAdmin()}var g=this.templateDatasetPermissions();this.$el.html(g({item:this.model,is_admin:h}));var e=this;if(this.options.fetched_permissions===undefined){$.get("/api/libraries/datasets/"+e.id+"/permissions?scope=current").done(function(i){e.prepareSelectBoxes({fetched_permissions:i,is_admin:h})}).fail(function(){d.error("An error occurred while fetching dataset permissions. :(")})}else{this.prepareSelectBoxes({is_admin:h})}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},prepareSelectBoxes:function(r){this.options=_.extend(this.options,r);var s=this.options.fetched_permissions;var k=this.options.is_admin;var q=this;var m=[];for(var h=0;h=0;h--){g.push(k[h].id)}for(var h=f.length-1;h>=0;h--){j.push(f[h].id)}for(var h=m.length-1;h>=0;h--){l.push(m[h].id)}$.post("/api/libraries/datasets/"+n.id+"/permissions?action=set_permissions",{"access_ids[]":g,"manage_ids[]":j,"modify_ids[]":l,}).done(function(i){n.showPermissions({fetched_permissions:i});d.success("Permissions saved")}).fail(function(){d.error("An error occurred while setting dataset permissions :(")})},templateDataset:function(){var e=[];e.push('
');e.push('
');e.push(' ');e.push(' ');e.push(' <% if (item.get("can_user_modify")) { %>');e.push(' ');e.push(" <% } %>");e.push(' <% if (item.get("can_user_manage")) { %>');e.push(' /datasets/<%- item.id %>/permissions">');e.push(' ');e.push(" <% } %>");e.push("
");e.push('");e.push('<% if (item.get("is_unrestricted")) { %>');e.push('
');e.push(" This dataset is unrestricted so everybody can access it. Just share the URL of this page. ");e.push(' ');e.push("
");e.push("<% } %>");e.push('
');e.push(' ');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(' <% if (item.get("data_type")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("genome_build")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("file_size")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("date_uploaded")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("uploaded_by")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("metadata_data_lines")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("metadata_comment_lines")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("metadata_columns")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("metadata_column_types")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("message")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("misc_blurb")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (item.get("misc_info")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push("
">Name<%= _.escape(item.get("name")) %>
Data type<%= _.escape(item.get("data_type")) %>
Genome build<%= _.escape(item.get("genome_build")) %>
Size<%= _.escape(item.get("file_size")) %>
Date uploaded (UTC)<%= _.escape(item.get("date_uploaded")) %>
Uploaded by<%= _.escape(item.get("uploaded_by")) %>
Data Lines<%= _.escape(item.get("metadata_data_lines")) %>
Comment Lines<%= _.escape(item.get("metadata_comment_lines")) %>
Number of Columns<%= _.escape(item.get("metadata_columns")) %>
Column Types<%= _.escape(item.get("metadata_column_types")) %>
Message<%= _.escape(item.get("message")) %>
Miscellaneous blurb<%= _.escape(item.get("misc_blurb")) %>
Miscellaneous information<%= _.escape(item.get("misc_info")) %>
");e.push("
");e.push('
');e.push("        
");e.push("
");e.push(' <% if (item.get("has_versions")) { %>');e.push("
");e.push("

Expired versions:

");e.push("
");e.push(" <% } %>");e.push("
");e.push("
");return _.template(e.join(""))},templateVersion:function(){var e=[];e.push('
');e.push(' ");e.push('");e.push('
This is an expired version of the library dataset: <%= _.escape(item.get("name")) %>
');e.push('
');e.push(' ');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(' <% if (ldda.get("data_type")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("genome_build")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("file_size")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("date_uploaded")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("uploaded_by")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_data_lines")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_comment_lines")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_columns")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("metadata_column_types")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("message")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("misc_blurb")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push(' <% if (ldda.get("misc_info")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push("
Name<%= _.escape(ldda.get("name")) %>
Data type<%= _.escape(ldda.get("data_type")) %>
Genome build<%= _.escape(ldda.get("genome_build")) %>
Size<%= _.escape(ldda.get("file_size")) %>
Date uploaded (UTC)<%= _.escape(ldda.get("date_uploaded")) %>
Uploaded by<%= _.escape(ldda.get("uploaded_by")) %>
Data Lines<%= _.escape(ldda.get("metadata_data_lines")) %>
Comment Lines<%= _.escape(ldda.get("metadata_comment_lines")) %>
Number of Columns<%= _.escape(ldda.get("metadata_columns")) %>
Column Types<%= _.escape(ldda.get("metadata_column_types")) %>
Message<%= _.escape(ldda.get("message")) %>
Miscellaneous blurb<%= _.escape(ldda.get("misc_blurb")) %>
Miscellaneous information<%= _.escape(ldda.get("misc_info")) %>
");e.push("
");e.push('
');e.push("        
");e.push("
");e.push("
");e.push("
");return _.template(e.join(""))},templateModifyDataset:function(){var e=[];e.push('
');e.push('
');e.push(' ');e.push(' ');e.push("
");e.push('");e.push('
');e.push('

For more editing options please import the dataset to history and use "Edit attributes" on it.

');e.push(' ');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(' ');e.push(' ');e.push(' ');e.push(" ");e.push(' ');e.push(' <% if (item.get("metadata_comment_lines") === "") { %>');e.push(' ');e.push(" <% } else { %>");e.push(' ');e.push(" <% } %>");e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push("
">Name">
Data type<%= _.escape(item.get("data_type")) %>
Genome build<%= _.escape(item.get("genome_build")) %>
Size<%= _.escape(item.get("file_size")) %>
Date uploaded (UTC)<%= _.escape(item.get("date_uploaded")) %>
Uploaded by<%= _.escape(item.get("uploaded_by")) %>
Data Lines<%= _.escape(item.get("metadata_data_lines")) %>
Comment Lines<%= _.escape(item.get("metadata_comment_lines")) %>unknown
Number of Columns<%= _.escape(item.get("metadata_columns")) %>
Column Types<%= _.escape(item.get("metadata_column_types")) %>
Message<%= _.escape(item.get("message")) %>
Miscellaneous information<%= _.escape(item.get("misc_info")) %>
Miscellaneous blurb<%= _.escape(item.get("misc_blurb")) %>
");e.push("
");e.push('
');e.push("   
");e.push("
");e.push("
");e.push("
");return _.template(e.join(""))},templateDatasetPermissions:function(){var e=[];e.push('
');e.push(' ");e.push('");e.push('

Dataset: <%= _.escape(item.get("name")) %>

');e.push('
');e.push("<% if (is_admin) { %>");e.push("You are logged in as an administrator therefore you can manage any dataset on this Galaxy instance. Please make sure you understand the consequences.");e.push("<% } else { %>");e.push("You can assign any number of roles to any of the following permission types. However please read carefully the implications of such actions.");e.push("<% } %>");e.push("
");e.push('
');e.push("

Library-related permissions

");e.push("

Roles that can modify the library item

");e.push('
');e.push('
User with any of these roles can modify name, metadata, and other information about this library item.
');e.push("
");e.push("

Dataset-related permissions

");e.push('
Changes made below will affect every library item that was created from this dataset and also every history this dataset is part of.
');e.push('<% if (!item.get("is_unrestricted")) { %>');e.push("

You can remove all access restrictions on this dataset. ");e.push(' ");e.push("

");e.push("<% } else { %>");e.push(" This dataset is unrestricted so everybody can access it. Just share the URL of this page.");e.push(' ');e.push("

You can make this dataset private to you. ");e.push(' ');e.push("

");e.push("<% } %>");e.push("

Roles that can access the dataset

");e.push('
');e.push('
User has to have all these roles in order to access this dataset. Users without access permission cannot have other permissions on this dataset. If there are no access roles set on the dataset it is considered unrestricted.
');e.push("

Roles that can manage permissions on the dataset

");e.push('
');e.push('
User with any of these roles can manage permissions of this dataset. If you remove yourself you will loose the ability manage this dataset unless you are an admin.
');e.push('');e.push("
");e.push("
");return _.template(e.join(""))},templateBulkImportInModal:function(){var e=[];e.push('');e.push("Select history: ");e.push('");e.push("");return _.template(e.join(""))},templateAccessSelect:function(){var e=[];e.push('");return _.template(e.join(""))}});return{LibraryDatasetView:a}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/library/library-folderlist-view.js b/static/scripts/packed/mvc/library/library-folderlist-view.js index fbec6d5e452..3ce7889ca2a 100644 --- a/static/scripts/packed/mvc/library/library-folderlist-view.js +++ b/static/scripts/packed/mvc/library/library-folderlist-view.js @@ -1 +1 @@ -define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-folderrow-view","mvc/library/library-dataset-view"],function(d,f,g,e,a,c){var b=Backbone.View.extend({el:"#folder_items_element",defaults:{include_deleted:false},progress:0,progressStep:1,modal:null,folderContainer:null,sort:"asc",events:{"click #select-all-checkboxes":"selectAll","click .dataset_row":"selectClickedRow","click .sort-folder-link":"sortColumnClicked"},rowViews:{},initialize:function(h){this.options=_.defaults(this.options||{},h);this.fetchFolder()},fetchFolder:function(h){var h=h||{};this.options.include_deleted=h.include_deleted;var i=this;this.collection=new e.Folder();this.listenTo(this.collection,"add",this.renderOne);this.listenTo(this.collection,"remove",this.removeOne);this.folderContainer=new e.FolderContainer({id:this.options.id});this.folderContainer.url=this.folderContainer.attributes.urlRoot+this.options.id+"/contents";if(this.options.include_deleted){this.folderContainer.url=this.folderContainer.url+"?include_deleted=true"}this.folderContainer.fetch({success:function(j){i.folder_container=j;i.render();i.addAll(j.get("folder").models);if(i.options.dataset_id){row=_.findWhere(i.rowViews,{id:i.options.dataset_id});if(row){row.showDatasetDetails()}else{g.error("Dataset not found. Showing folder instead.")}}},error:function(k,j){if(typeof j.responseJSON!=="undefined"){g.error(j.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}else{g.error("An error ocurred :(. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}}})},render:function(h){this.options=_.defaults(this.options,h);var i=this.templateFolder();$(".tooltip").hide();var j=this.folderContainer.attributes.metadata.full_path;var k;if(j.length===1){k=0}else{k=j[j.length-2][0]}this.$el.html(i({path:this.folderContainer.attributes.metadata.full_path,id:this.options.id,upper_folder_id:k,order:this.sort}));$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},postRender:function(){var h=this.folderContainer.attributes.metadata;h.contains_file=typeof this.collection.findWhere({type:"file"})!=="undefined";Galaxy.libraries.folderToolbarView.configureElements(h);$(".library-row").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},addAll:function(h){_.each(h.reverse(),function(i){Galaxy.libraries.folderListView.collection.add(i)});$("#center [data-toggle]").tooltip();this.checkEmptiness();this.postRender()},renderAll:function(){var h=this;_.each(this.collection.models.reverse(),function(i){h.renderOne(i)});this.postRender()},renderOne:function(i){if(i.get("type")!=="folder"){this.options.contains_file=true}i.set("folder_id",this.id);var h=new a.FolderRowView(i);this.rowViews[i.get("id")]=h;this.$el.find("#first_folder_item").after(h.el);$(".library-row").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},removeOne:function(h){this.$el.find("#"+h.id).remove()},checkEmptiness:function(){if((this.$el.find(".dataset_row").length===0)&&(this.$el.find(".folder_row").length===0)){this.$el.find(".empty-folder-message").show()}else{this.$el.find(".empty-folder-message").hide()}},sortColumnClicked:function(h){h.preventDefault();if(this.sort==="asc"){this.sortFolder("name","desc");this.sort="desc"}else{this.sortFolder("name","asc");this.sort="asc"}this.render();this.renderAll();this.checkEmptiness()},sortFolder:function(i,h){if(i==="name"){if(h==="asc"){return this.collection.sortByNameAsc()}else{if(h==="desc"){return this.collection.sortByNameDesc()}}}},selectAll:function(i){var h=i.target.checked;that=this;$(":checkbox","#folder_list_body").each(function(){this.checked=h;$row=$(this.parentElement.parentElement);if(h){that.makeDarkRow($row)}else{that.makeWhiteRow($row)}})},selectClickedRow:function(i){var k="";var h;var j;if(i.target.localName==="input"){k=i.target;h=$(i.target.parentElement.parentElement);j="input"}else{if(i.target.localName==="td"){k=$("#"+i.target.parentElement.id).find(":checkbox")[0];h=$(i.target.parentElement);j="td"}}if(k.checked){if(j==="td"){k.checked="";this.makeWhiteRow(h)}else{if(j==="input"){this.makeDarkRow(h)}}}else{if(j==="td"){k.checked="selected";this.makeDarkRow(h)}else{if(j==="input"){this.makeWhiteRow(h)}}}},makeDarkRow:function(h){h.removeClass("light").addClass("dark");h.find("a").removeClass("light").addClass("dark");h.find(".fa-file-o").removeClass("fa-file-o").addClass("fa-file")},makeWhiteRow:function(h){h.removeClass("dark").addClass("light");h.find("a").removeClass("dark").addClass("light");h.find(".fa-file").removeClass("fa-file").addClass("fa-file-o")},templateFolder:function(){var h=[];h.push('");h.push('');h.push(" ");h.push(' ');h.push(' ');h.push(' ');h.push(' ');h.push(' ');h.push(' ');h.push(' ');h.push(" ");h.push(' ');h.push(' ');h.push(' ');h.push(" ");h.push(" ");h.push(" ");h.push(" ");h.push(" ");h.push(" ");h.push(" ");h.push(" ");h.push("
name data typesizetime updated (UTC)
" title="Go to parent folder" class="btn_open_folder btn btn-default btn-xs">..
");h.push('');return _.template(h.join(""))}});return{FolderListView:b}}); \ No newline at end of file +define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-folderrow-view","mvc/library/library-dataset-view"],function(d,f,g,e,a,c){var b=Backbone.View.extend({el:"#folder_items_element",defaults:{include_deleted:false},progress:0,progressStep:1,modal:null,folderContainer:null,sort:"asc",events:{"click #select-all-checkboxes":"selectAll","click .dataset_row":"selectClickedRow","click .sort-folder-link":"sortColumnClicked"},rowViews:{},initialize:function(h){this.options=_.defaults(this.options||{},h);this.fetchFolder()},fetchFolder:function(h){var h=h||{};this.options.include_deleted=h.include_deleted;var i=this;this.collection=new e.Folder();this.listenTo(this.collection,"add",this.renderOne);this.listenTo(this.collection,"remove",this.removeOne);this.folderContainer=new e.FolderContainer({id:this.options.id});this.folderContainer.url=this.folderContainer.attributes.urlRoot+this.options.id+"/contents";if(this.options.include_deleted){this.folderContainer.url=this.folderContainer.url+"?include_deleted=true"}this.folderContainer.fetch({success:function(j){i.folder_container=j;i.render();i.addAll(j.get("folder").models);if(i.options.dataset_id){row=_.findWhere(i.rowViews,{id:i.options.dataset_id});if(row){row.showDatasetDetails()}else{g.error("Dataset not found. Showing folder instead.")}}},error:function(k,j){if(typeof j.responseJSON!=="undefined"){g.error(j.responseJSON.err_msg+" Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}else{g.error("An error ocurred :(. Click this to go back.","",{onclick:function(){Galaxy.libraries.library_router.back()}})}}})},render:function(h){this.options=_.defaults(this.options,h);var i=this.templateFolder();$(".tooltip").hide();var j=this.folderContainer.attributes.metadata.full_path;var k;if(j.length===1){k=0}else{k=j[j.length-2][0]}this.$el.html(i({path:this.folderContainer.attributes.metadata.full_path,parent_library_id:this.folderContainer.attributes.metadata.parent_library_id,id:this.options.id,upper_folder_id:k,order:this.sort}));$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},postRender:function(){var h=this.folderContainer.attributes.metadata;h.contains_file=typeof this.collection.findWhere({type:"file"})!=="undefined";Galaxy.libraries.folderToolbarView.configureElements(h);$(".library-row").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},addAll:function(h){_.each(h.reverse(),function(i){Galaxy.libraries.folderListView.collection.add(i)});$("#center [data-toggle]").tooltip();this.checkEmptiness();this.postRender()},renderAll:function(){var h=this;_.each(this.collection.models.reverse(),function(i){h.renderOne(i)});this.postRender()},renderOne:function(i){if(i.get("type")!=="folder"){this.options.contains_file=true}i.set("folder_id",this.id);var h=new a.FolderRowView(i);this.rowViews[i.get("id")]=h;this.$el.find("#first_folder_item").after(h.el);$(".library-row").hover(function(){$(this).find(".show_on_hover").show()},function(){$(this).find(".show_on_hover").hide()})},removeOne:function(h){this.$el.find("#"+h.id).remove()},checkEmptiness:function(){if((this.$el.find(".dataset_row").length===0)&&(this.$el.find(".folder_row").length===0)){this.$el.find(".empty-folder-message").show()}else{this.$el.find(".empty-folder-message").hide()}},sortColumnClicked:function(h){h.preventDefault();if(this.sort==="asc"){this.sortFolder("name","desc");this.sort="desc"}else{this.sortFolder("name","asc");this.sort="asc"}this.render();this.renderAll();this.checkEmptiness()},sortFolder:function(i,h){if(i==="name"){if(h==="asc"){return this.collection.sortByNameAsc()}else{if(h==="desc"){return this.collection.sortByNameDesc()}}}},selectAll:function(i){var h=i.target.checked;that=this;$(":checkbox","#folder_list_body").each(function(){this.checked=h;$row=$(this.parentElement.parentElement);if(h){that.makeDarkRow($row)}else{that.makeWhiteRow($row)}})},selectClickedRow:function(i){var k="";var h;var j;if(i.target.localName==="input"){k=i.target;h=$(i.target.parentElement.parentElement);j="input"}else{if(i.target.localName==="td"){k=$("#"+i.target.parentElement.id).find(":checkbox")[0];h=$(i.target.parentElement);j="td"}}if(k.checked){if(j==="td"){k.checked="";this.makeWhiteRow(h)}else{if(j==="input"){this.makeDarkRow(h)}}}else{if(j==="td"){k.checked="selected";this.makeDarkRow(h)}else{if(j==="input"){this.makeWhiteRow(h)}}}},makeDarkRow:function(h){h.removeClass("light").addClass("dark");h.find("a").removeClass("light").addClass("dark");h.find(".fa-file-o").removeClass("fa-file-o").addClass("fa-file")},makeWhiteRow:function(h){h.removeClass("dark").addClass("light");h.find("a").removeClass("dark").addClass("light");h.find(".fa-file").removeClass("fa-file").addClass("fa-file-o")},templateFolder:function(){var h=[];h.push('");h.push('');h.push(" ");h.push(' ');h.push(' ');h.push(' ');h.push(' ');h.push(' ');h.push(' ');h.push(' ');h.push(" ");h.push(' ');h.push(' ');h.push(' ');h.push(" ");h.push(" ");h.push(" ");h.push(" ");h.push(" ");h.push(" ");h.push(" ");h.push(" ");h.push("
name data typesizetime updated (UTC)
" title="Go to parent folder" class="btn_open_folder btn btn-default btn-xs">..
");h.push('');return _.template(h.join(""))}});return{FolderListView:b}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/library/library-foldertoolbar-view.js b/static/scripts/packed/mvc/library/library-foldertoolbar-view.js index 5645232413f..b9f7d082573 100644 --- a/static/scripts/packed/mvc/library/library-foldertoolbar-view.js +++ b/static/scripts/packed/mvc/library/library-foldertoolbar-view.js @@ -1 +1 @@ -define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model"],function(b,d,e,c){var a=Backbone.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click .toolbtn_add_files":"addFilesToFolderModal","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_show_libinfo":"showLibInfo","click #toolbtn_bulk_delete":"deleteSelectedDatasets"},defaults:{can_add_library_item:false,contains_file:false,chain_call_control:{total_number:0,failed_number:0}},modal:null,histories:null,initialize:function(f){this.options=_.defaults(f||{},this.defaults);this.render()},render:function(g){this.options=_.extend(this.options,g);var i=false;var f=true;if(Galaxy.currUser){i=Galaxy.currUser.isAdmin();f=Galaxy.currUser.isAnonymous()}var h=this.templateToolBar();this.$el.html(h({id:this.options.id,admin_user:i,anonym:f}))},configureElements:function(f){this.options=_.extend(this.options,f);if(this.options.can_add_library_item===true){$(".add-library-items").show()}else{$(".add-library-items").hide()}if(this.options.contains_file===true){if(Galaxy.currUser){if(!Galaxy.currUser.isAnonymous()){$(".logged-dataset-manipulation").show();$(".dataset-manipulation").show()}else{$(".dataset-manipulation").show();$(".logged-dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(){event.preventDefault();event.stopPropagation();var f=this;var g=this.templateNewFolderInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Folder",body:g(),buttons:{Create:function(){f.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var f=this.serialize_new_folder();if(this.validate_new_folder(f)){var g=new c.FolderAsModel();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];g.url=g.urlRoot+"/"+current_folder_id;g.save(f,{success:function(h){Galaxy.modal.hide();e.success("Folder created");h.set({type:"folder"});Galaxy.libraries.folderListView.collection.add(h)},error:function(i,h){Galaxy.modal.hide();if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})}else{e.error("Folder's name is missing")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(f){return f.name!==""},modalBulkImport:function(){var f=$("#folder_table").find(":checked");if(f.length===0){e.info("You have to select some datasets first")}else{this.refreshUserHistoriesList(function(g){var h=g.templateBulkImportInModal();g.modal=Galaxy.modal;g.modal.show({closing_events:true,title:"Import into History",body:h({histories:g.histories.models}),buttons:{Import:function(){g.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})}},refreshUserHistoriesList:function(g){var f=this;this.histories=new c.GalaxyHistories();this.histories.fetch({success:function(){g(f)},error:function(i,h){if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},importAllIntoHistory:function(){this.modal.disableButton("Import");this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var k=$("select[name=dataset_import_bulk] option:selected").val();this.options.last_used_history_id=k;var n=$("select[name=dataset_import_bulk] option:selected").text();var p=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){p.push(this.parentElement.parentElement.id)}});var o=this.templateImportIntoHistoryProgressBar();this.modal.$el.find(".modal-body").html(o({history_name:n}));var l=100/p.length;this.initProgress(l);var f=[];for(var h=p.length-1;h>=0;h--){var j=p[h];var m=new c.HistoryItem();m.url=m.urlRoot+k+"/contents";m.content=j;m.source="library";f.push(m)}this.options.chain_call_control.total_number=f.length;var g="/api/histories/"+k+"/set_as_current";$.ajax({url:g,type:"PUT"});this.chainCall(f,n)},chainCall:function(g,j){var f=this;var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets imported into history. Click this to start analysing it.","",{onclick:function(){window.location="/"}})}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were imported into history.")}else{if(this.options.chain_call_control.failed_number'});$('
'+f+"
").appendTo("body").submit().remove();e.info("Your download will begin soon")}},addFilesToFolderModal:function(){this.refreshUserHistoriesList(function(f){f.modal=Galaxy.modal;var g=f.templateAddFilesInModal();var h=f.options.full_path[f.options.full_path.length-1][1];f.modal.show({closing_events:true,title:"Add datasets from history to "+h,body:g({histories:f.histories.models}),buttons:{Add:function(){f.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}}});if(f.histories.models.length>0){f.fetchAndDisplayHistoryContents(f.histories.models[0].id);$("#dataset_add_bulk").change(function(i){f.fetchAndDisplayHistoryContents(i.target.value)})}else{e.error("An error ocurred :(")}})},fetchAndDisplayHistoryContents:function(h){var g=new c.HistoryContents({id:h});var f=this;g.fetch({success:function(j){var i=f.templateHistoryContents();f.histories.get(h).set({contents:j});f.modal.$el.find("#selected_history_content").html(i({history_contents:j.models.reverse()}))},error:function(){e.error("An error ocurred :(")}})},addAllDatasetsFromHistory:function(){this.modal.disableButton("Add");this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var f=[];this.modal.$el.find("#selected_history_content").find(":checked").each(function(){var i=$(this.parentElement).data("id");if(i){f.push(i)}});var l=this.options.folder_name;var k=this.templateAddingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(k({folder_name:l}));this.progressStep=100/f.length;this.progress=0;var j=[];for(var h=f.length-1;h>=0;h--){history_dataset_id=f[h];var g=new c.Item();g.url="/api/folders/"+this.options.id+"/contents";g.set({from_hda_id:history_dataset_id});j.push(g)}this.options.chain_call_control.total_number=j.length;this.chainCallAddingHdas(j)},chainCallAddingHdas:function(g){var f=this;this.added_hdas=new c.Folder();var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets from history added to the folder")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were added to the folder.")}else{if(this.options.chain_call_control.failed_number=0;h--){var k=new c.Item({id:g[h]});l.push(k)}this.options.chain_call_control.total_number=g.length;this.chainCallDeletingHdas(l)}},chainCallDeletingHdas:function(g){var f=this;this.deleted_lddas=new c.Folder();var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets deleted")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were deleted.")}else{if(this.options.chain_call_control.failed_number');tmpl_array.push('
');tmpl_array.push(' ');tmpl_array.push(' ");tmpl_array.push(' ');tmpl_array.push(' ");tmpl_array.push(' ');tmpl_array.push(' ');tmpl_array.push("
");tmpl_array.push('
');tmpl_array.push("
");tmpl_array.push("");return _.template(tmpl_array.join(""))},templateLibInfoInModal:function(){tmpl_array=[];tmpl_array.push('
');tmpl_array.push("
");return _.template(tmpl_array.join(""))},templateNewFolderInModal:function(){tmpl_array=[];tmpl_array.push('
');tmpl_array.push("
");tmpl_array.push('');tmpl_array.push('');tmpl_array.push("
");tmpl_array.push("
");return _.template(tmpl_array.join(""))},templateBulkImportInModal:function(){var f=[];f.push('');f.push("Select history: ");f.push('");f.push("");return _.template(f.join(""))},templateImportIntoHistoryProgressBar:function(){var f=[];f.push('
');f.push("Importing selected datasets to history <%= _.escape(history_name) %>");f.push("
");f.push('
');f.push('
');f.push(' 0% Complete');f.push("
");f.push("
");f.push("");return _.template(f.join(""))},templateAddingDatasetsProgressBar:function(){var f=[];f.push('
');f.push("Adding selected datasets from history to library folder <%= _.escape(folder_name) %>");f.push("
");f.push('
');f.push('
');f.push(' 0% Complete');f.push("
");f.push("
");f.push("");return _.template(f.join(""))},templateDeletingDatasetsProgressBar:function(){var f=[];f.push('
');f.push("
");f.push('
');f.push('
');f.push(' 0% Complete');f.push("
");f.push("
");f.push("");return _.template(f.join(""))},templateAddFilesInModal:function(){var f=[];f.push('
');f.push('
');f.push("Select history: ");f.push('");f.push("
");f.push('
');f.push("
");f.push("
");return _.template(f.join(""))},templateHistoryContents:function(){var f=[];f.push("Choose the datasets to import:");f.push("
    ");f.push(" <% _.each(history_contents, function(history_item) { %>");f.push('
  • ">');f.push(' <%= _.escape(history_item.get("hid")) %>: <%= _.escape(history_item.get("name")) %>');f.push("
  • ");f.push(" <% }); %>");f.push("
");return _.template(f.join(""))}});return{FolderToolbarView:a}}); \ No newline at end of file +define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model"],function(b,d,e,c){var a=Backbone.View.extend({el:"#center",events:{"click #toolbtn_create_folder":"createFolderFromModal","click #toolbtn_bulk_import":"modalBulkImport","click .toolbtn_add_files":"addFilesToFolderModal","click #include_deleted_datasets_chk":"checkIncludeDeleted","click #toolbtn_show_libinfo":"showLibInfo","click #toolbtn_bulk_delete":"deleteSelectedDatasets"},defaults:{can_add_library_item:false,contains_file:false,chain_call_control:{total_number:0,failed_number:0}},modal:null,histories:null,initialize:function(f){this.options=_.defaults(f||{},this.defaults);this.render()},render:function(g){this.options=_.extend(this.options,g);var i=false;var f=true;if(Galaxy.currUser){i=Galaxy.currUser.isAdmin();f=Galaxy.currUser.isAnonymous()}var h=this.templateToolBar();this.$el.html(h({id:this.options.id,admin_user:i,anonym:f}))},configureElements:function(f){this.options=_.extend(this.options,f);if(this.options.can_add_library_item===true){$(".add-library-items").show()}else{$(".add-library-items").hide()}if(this.options.contains_file===true){if(Galaxy.currUser){if(!Galaxy.currUser.isAnonymous()){$(".logged-dataset-manipulation").show();$(".dataset-manipulation").show()}else{$(".dataset-manipulation").show();$(".logged-dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}}else{$(".logged-dataset-manipulation").hide();$(".dataset-manipulation").hide()}this.$el.find("[data-toggle]").tooltip()},createFolderFromModal:function(){event.preventDefault();event.stopPropagation();var f=this;var g=this.templateNewFolderInModal();this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Folder",body:g(),buttons:{Create:function(){f.create_new_folder_event()},Close:function(){Galaxy.modal.hide()}}})},create_new_folder_event:function(){var f=this.serialize_new_folder();if(this.validate_new_folder(f)){var g=new c.FolderAsModel();url_items=Backbone.history.fragment.split("/");current_folder_id=url_items[url_items.length-1];g.url=g.urlRoot+"/"+current_folder_id;g.save(f,{success:function(h){Galaxy.modal.hide();e.success("Folder created");h.set({type:"folder"});Galaxy.libraries.folderListView.collection.add(h)},error:function(i,h){Galaxy.modal.hide();if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})}else{e.error("Folder's name is missing")}return false},serialize_new_folder:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val()}},validate_new_folder:function(f){return f.name!==""},modalBulkImport:function(){var f=$("#folder_table").find(":checked");if(f.length===0){e.info("You have to select some datasets first")}else{this.refreshUserHistoriesList(function(g){var h=g.templateBulkImportInModal();g.modal=Galaxy.modal;g.modal.show({closing_events:true,title:"Import into History",body:h({histories:g.histories.models}),buttons:{Import:function(){g.importAllIntoHistory()},Close:function(){Galaxy.modal.hide()}}})})}},refreshUserHistoriesList:function(g){var f=this;this.histories=new c.GalaxyHistories();this.histories.fetch({success:function(){g(f)},error:function(i,h){if(typeof h.responseJSON!=="undefined"){e.error(h.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},importAllIntoHistory:function(){this.modal.disableButton("Import");this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var k=$("select[name=dataset_import_bulk] option:selected").val();this.options.last_used_history_id=k;var n=$("select[name=dataset_import_bulk] option:selected").text();var p=[];$("#folder_table").find(":checked").each(function(){if(this.parentElement.parentElement.id!==""){p.push(this.parentElement.parentElement.id)}});var o=this.templateImportIntoHistoryProgressBar();this.modal.$el.find(".modal-body").html(o({history_name:n}));var l=100/p.length;this.initProgress(l);var f=[];for(var h=p.length-1;h>=0;h--){var j=p[h];var m=new c.HistoryItem();m.url=m.urlRoot+k+"/contents";m.content=j;m.source="library";f.push(m)}this.options.chain_call_control.total_number=f.length;var g="/api/histories/"+k+"/set_as_current";$.ajax({url:g,type:"PUT"});this.chainCall(f,n)},chainCall:function(g,j){var f=this;var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets imported into history. Click this to start analysing it.","",{onclick:function(){window.location="/"}})}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were imported into history.")}else{if(this.options.chain_call_control.failed_number'});$('
'+f+"
").appendTo("body").submit().remove();e.info("Your download will begin soon")}},addFilesToFolderModal:function(){this.refreshUserHistoriesList(function(f){f.modal=Galaxy.modal;var g=f.templateAddFilesInModal();var h=f.options.full_path[f.options.full_path.length-1][1];f.modal.show({closing_events:true,title:"Add datasets from history to "+h,body:g({histories:f.histories.models}),buttons:{Add:function(){f.addAllDatasetsFromHistory()},Close:function(){Galaxy.modal.hide()}}});if(f.histories.models.length>0){f.fetchAndDisplayHistoryContents(f.histories.models[0].id);$("#dataset_add_bulk").change(function(i){f.fetchAndDisplayHistoryContents(i.target.value)})}else{e.error("An error ocurred :(")}})},fetchAndDisplayHistoryContents:function(h){var g=new c.HistoryContents({id:h});var f=this;g.fetch({success:function(j){var i=f.templateHistoryContents();f.histories.get(h).set({contents:j});f.modal.$el.find("#selected_history_content").html(i({history_contents:j.models.reverse()}))},error:function(j,i){if(typeof i.responseJSON!=="undefined"){e.error(i.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},addAllDatasetsFromHistory:function(){this.modal.disableButton("Add");this.options.chain_call_control.total_number=0;this.options.chain_call_control.failed_number=0;var f=[];this.modal.$el.find("#selected_history_content").find(":checked").each(function(){var i=$(this.parentElement).data("id");if(i){f.push(i)}});var l=this.options.folder_name;var k=this.templateAddingDatasetsProgressBar();this.modal.$el.find(".modal-body").html(k({folder_name:l}));this.progressStep=100/f.length;this.progress=0;var j=[];for(var h=f.length-1;h>=0;h--){history_dataset_id=f[h];var g=new c.Item();g.url="/api/folders/"+this.options.id+"/contents";g.set({from_hda_id:history_dataset_id});j.push(g)}this.options.chain_call_control.total_number=j.length;this.chainCallAddingHdas(j)},chainCallAddingHdas:function(g){var f=this;this.added_hdas=new c.Folder();var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets from history added to the folder")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were added to the folder.")}else{if(this.options.chain_call_control.failed_number=0;h--){var k=new c.Item({id:g[h]});l.push(k)}this.options.chain_call_control.total_number=g.length;this.chainCallDeletingHdas(l)}},chainCallDeletingHdas:function(g){var f=this;this.deleted_lddas=new c.Folder();var h=g.pop();if(typeof h==="undefined"){if(this.options.chain_call_control.failed_number===0){e.success("Selected datasets deleted")}else{if(this.options.chain_call_control.failed_number===this.options.chain_call_control.total_number){e.error("There was an error and no datasets were deleted.")}else{if(this.options.chain_call_control.failed_number');tmpl_array.push('
');tmpl_array.push(" DATA LIBRARIES");tmpl_array.push(' ');tmpl_array.push(' ");tmpl_array.push(' ');tmpl_array.push(' ");tmpl_array.push(' ');tmpl_array.push(' ');tmpl_array.push(' ');tmpl_array.push("
");tmpl_array.push('
');tmpl_array.push("
");tmpl_array.push("");return _.template(tmpl_array.join(""))},templateLibInfoInModal:function(){tmpl_array=[];tmpl_array.push('
');tmpl_array.push("

Library name:

");tmpl_array.push('

<%- library.get("name") %>

');tmpl_array.push("

Library description:

");tmpl_array.push('

<%- library.get("description") %>

');tmpl_array.push("

Library synopsis:

");tmpl_array.push('

<%- library.get("synopsis") %>

');tmpl_array.push("
");return _.template(tmpl_array.join(""))},templateNewFolderInModal:function(){tmpl_array=[];tmpl_array.push('
');tmpl_array.push("
");tmpl_array.push('');tmpl_array.push('');tmpl_array.push("
");tmpl_array.push("
");return _.template(tmpl_array.join(""))},templateBulkImportInModal:function(){var f=[];f.push('');f.push("Select history: ");f.push('");f.push("");return _.template(f.join(""))},templateImportIntoHistoryProgressBar:function(){var f=[];f.push('
');f.push("Importing selected datasets to history <%= _.escape(history_name) %>");f.push("
");f.push('
');f.push('
');f.push(' 0% Complete');f.push("
");f.push("
");f.push("");return _.template(f.join(""))},templateAddingDatasetsProgressBar:function(){var f=[];f.push('
');f.push("Adding selected datasets from history to library folder <%= _.escape(folder_name) %>");f.push("
");f.push('
');f.push('
');f.push(' 0% Complete');f.push("
");f.push("
");f.push("");return _.template(f.join(""))},templateDeletingDatasetsProgressBar:function(){var f=[];f.push('
');f.push("
");f.push('
');f.push('
');f.push(' 0% Complete');f.push("
");f.push("
");f.push("");return _.template(f.join(""))},templateAddFilesInModal:function(){var f=[];f.push('
');f.push('
');f.push("Select history: ");f.push('");f.push("
");f.push('
');f.push("
");f.push("
");return _.template(f.join(""))},templateHistoryContents:function(){var f=[];f.push("Choose the datasets to import:");f.push("
    ");f.push(" <% _.each(history_contents, function(history_item) { %>");f.push('
  • ">');f.push(' <%= _.escape(history_item.get("hid")) %>: <%= _.escape(history_item.get("name")) %>');f.push("
  • ");f.push(" <% }); %>");f.push("
");return _.template(f.join(""))}});return{FolderToolbarView:a}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/library/library-librarylist-view.js b/static/scripts/packed/mvc/library/library-librarylist-view.js index bb2a0f4370a..9b4833e60dd 100644 --- a/static/scripts/packed/mvc/library/library-librarylist-view.js +++ b/static/scripts/packed/mvc/library/library-librarylist-view.js @@ -1 +1 @@ -define(["galaxy.masthead","mvc/base-mvc","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-libraryrow-view"],function(b,g,d,e,c,a){var f=Backbone.View.extend({el:"#libraries_element",events:{"click .sort-libraries-link":"sort_clicked"},modal:null,collection:null,rowViews:{},initialize:function(i){this.options=_.defaults(this.options||{},i);var h=this;this.rowViews={};this.collection=new c.Libraries();this.collection.fetch({success:function(){h.render()},error:function(k,j){if(typeof j.responseJSON!=="undefined"){e.error(j.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},render:function(i){$(".tooltip").hide();var j=this.templateLibraryList();var k=null;var h=Galaxy.libraries.preferences.get("with_deleted");var l=null;if(typeof i!=="undefined"){h=typeof i.with_deleted!=="undefined"?i.with_deleted:false;l=typeof i.models!=="undefined"?i.models:null}if(this.collection!==null&&l===null){this.sortLibraries();if(h){k=this.collection.models}else{k=this.collection.where({deleted:false})}}else{if(l!==null){k=l}else{k=[]}}this.$el.html(j({length:k.length,order:Galaxy.libraries.preferences.get("sort_order")}));if(k.length>0){this.renderRows(k)}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},renderRows:function(l){for(var k=0;k');tmpl_array.push("<% if(length === 0) { %>");tmpl_array.push('
There are no libraries visible to you. If you expected some to show up please consult the library security wikipage or visit the Galaxy support site.
');tmpl_array.push("<% } else{ %>");tmpl_array.push('');tmpl_array.push(" ");tmpl_array.push(' ');tmpl_array.push(' ');tmpl_array.push(' ');tmpl_array.push(' ');tmpl_array.push(" ");tmpl_array.push(' ');tmpl_array.push(" ");tmpl_array.push("
name descriptionsynopsis
");tmpl_array.push("<% }%>");tmpl_array.push("");return _.template(tmpl_array.join(""))},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},});return{LibraryListView:f}}); \ No newline at end of file +define(["galaxy.masthead","mvc/base-mvc","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-libraryrow-view"],function(b,g,d,e,c,a){var f=Backbone.View.extend({el:"#libraries_element",events:{"click .sort-libraries-link":"sort_clicked"},modal:null,collection:null,rowViews:{},initialize:function(h){this.options=_.defaults(this.options||{},h);var i=this;this.rowViews={};this.collection=new c.Libraries();this.collection.fetch({success:function(){i.render()},error:function(k,j){if(typeof j.responseJSON!=="undefined"){e.error(j.responseJSON.err_msg)}else{e.error("An error ocurred :(")}}})},render:function(i){$(".tooltip").hide();var j=this.templateLibraryList();var k=null;var h=Galaxy.libraries.preferences.get("with_deleted");var l=null;if(typeof i!=="undefined"){h=typeof i.with_deleted!=="undefined"?i.with_deleted:false;l=typeof i.models!=="undefined"?i.models:null}if(this.collection!==null&&l===null){this.sortLibraries();if(h){k=this.collection.models}else{k=this.collection.where({deleted:false})}}else{if(l!==null){k=l}else{k=[]}}this.$el.html(j({length:k.length,order:Galaxy.libraries.preferences.get("sort_order")}));if(k.length>0){this.renderRows(k)}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},renderRows:function(l){for(var k=0;k');tmpl_array.push("<% if(length === 0) { %>");tmpl_array.push('
There are no libraries visible to you. If you expected some to show up please consult the library security wikipage or visit the Galaxy support site.
');tmpl_array.push("<% } else{ %>");tmpl_array.push('');tmpl_array.push(" ");tmpl_array.push(' ');tmpl_array.push(' ');tmpl_array.push(' ');tmpl_array.push(' ');tmpl_array.push(" ");tmpl_array.push(' ');tmpl_array.push(" ");tmpl_array.push("
name descriptionsynopsis
");tmpl_array.push("<% }%>");tmpl_array.push("");return _.template(tmpl_array.join(""))},redirectToHome:function(){window.location="../"},redirectToLogin:function(){window.location="/user/login"},});return{LibraryListView:f}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/library/library-librarytoolbar-view.js b/static/scripts/packed/mvc/library/library-librarytoolbar-view.js index 802fff592ef..fcf8152f7cd 100644 --- a/static/scripts/packed/mvc/library/library-librarytoolbar-view.js +++ b/static/scripts/packed/mvc/library/library-librarytoolbar-view.js @@ -1 +1 @@ -define(["libs/toastr","mvc/library/library-model"],function(b,a){var c=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal","click #include_deleted_chk":"check_include_deleted"},initialize:function(){this.render()},render:function(){var f=this.templateToolBar();var e=false;var d=true;if(Galaxy.currUser){e=Galaxy.currUser.isAdmin();d=Galaxy.currUser.isAnonymous()}this.$el.html(f({admin_user:e,anon_user:d}));if(e){this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted")}},show_library_modal:function(e){e.preventDefault();e.stopPropagation();var d=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){d.create_new_library_event()},Close:function(){d.modal.hide()}}})},create_new_library_event:function(){var f=this.serialize_new_library();if(this.validate_new_library(f)){var e=new a.Library();var d=this;e.save(f,{success:function(g){Galaxy.libraries.libraryListView.collection.add(g);d.modal.hide();d.clear_library_modal();Galaxy.libraries.libraryListView.render();b.success("Library created")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){b.error(g.responseJSON.err_msg)}else{b.error("An error occured :(")}}})}else{b.error("Library's name is missing")}return false},clear_library_modal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serialize_new_library:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},validate_new_library:function(d){return d.name!==""},check_include_deleted:function(d){if(d.target.checked){Galaxy.libraries.preferences.set({with_deleted:true});Galaxy.libraries.libraryListView.render()}else{Galaxy.libraries.preferences.set({with_deleted:false});Galaxy.libraries.libraryListView.render()}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('
');tmpl_array.push('
');tmpl_array.push(" <% if(admin_user === true) { %>");tmpl_array.push('
');tmpl_array.push(' include deleted');tmpl_array.push(' ');tmpl_array.push("
");tmpl_array.push(" <% } %>");tmpl_array.push("
");tmpl_array.push('
');tmpl_array.push("
");tmpl_array.push("
");return _.template(tmpl_array.join(""))},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('
');tmpl_array.push("
");tmpl_array.push(' ');tmpl_array.push(' ');tmpl_array.push(' ');tmpl_array.push("
");tmpl_array.push("
");return tmpl_array.join("")}});return{LibraryToolbarView:c}}); \ No newline at end of file +define(["libs/toastr","mvc/library/library-model"],function(b,a){var c=Backbone.View.extend({el:"#center",events:{"click #create_new_library_btn":"show_library_modal","click #include_deleted_chk":"check_include_deleted"},initialize:function(){this.render()},render:function(){var f=this.templateToolBar();var e=false;var d=true;if(Galaxy.currUser){e=Galaxy.currUser.isAdmin();d=Galaxy.currUser.isAnonymous()}this.$el.html(f({admin_user:e,anon_user:d}));if(e){this.$el.find("#include_deleted_chk")[0].checked=Galaxy.libraries.preferences.get("with_deleted")}},show_library_modal:function(e){e.preventDefault();e.stopPropagation();var d=this;this.modal=Galaxy.modal;this.modal.show({closing_events:true,title:"Create New Library",body:this.templateNewLibraryInModal(),buttons:{Create:function(){d.create_new_library_event()},Close:function(){d.modal.hide()}}})},create_new_library_event:function(){var f=this.serialize_new_library();if(this.validate_new_library(f)){var e=new a.Library();var d=this;e.save(f,{success:function(g){Galaxy.libraries.libraryListView.collection.add(g);d.modal.hide();d.clear_library_modal();Galaxy.libraries.libraryListView.render();b.success("Library created")},error:function(h,g){if(typeof g.responseJSON!=="undefined"){b.error(g.responseJSON.err_msg)}else{b.error("An error occured :(")}}})}else{b.error("Library's name is missing")}return false},clear_library_modal:function(){$("input[name='Name']").val("");$("input[name='Description']").val("");$("input[name='Synopsis']").val("")},serialize_new_library:function(){return{name:$("input[name='Name']").val(),description:$("input[name='Description']").val(),synopsis:$("input[name='Synopsis']").val()}},validate_new_library:function(d){return d.name!==""},check_include_deleted:function(d){if(d.target.checked){Galaxy.libraries.preferences.set({with_deleted:true});Galaxy.libraries.libraryListView.render()}else{Galaxy.libraries.preferences.set({with_deleted:false});Galaxy.libraries.libraryListView.render()}},templateToolBar:function(){tmpl_array=[];tmpl_array.push('
');tmpl_array.push('
');tmpl_array.push('
');tmpl_array.push(" DATA LIBRARIES");tmpl_array.push(" <% if(admin_user === true) { %>");tmpl_array.push(' | include deleted |');tmpl_array.push(' ');tmpl_array.push(" <% } %>");tmpl_array.push(' ');tmpl_array.push("
");tmpl_array.push("
");tmpl_array.push(" ");tmpl_array.push("
");tmpl_array.push("
");tmpl_array.push('
');tmpl_array.push("
");tmpl_array.push("
");return _.template(tmpl_array.join(""))},templateNewLibraryInModal:function(){tmpl_array=[];tmpl_array.push('
');tmpl_array.push("
");tmpl_array.push(' ');tmpl_array.push(' ');tmpl_array.push(' ');tmpl_array.push("
");tmpl_array.push("
");return tmpl_array.join("")}});return{LibraryToolbarView:c}}); \ No newline at end of file diff --git a/static/style/blue/base.css b/static/style/blue/base.css index cefd7ac0ec5..8b857cb3918 100644 --- a/static/style/blue/base.css +++ b/static/style/blue/base.css @@ -1329,6 +1329,7 @@ ul{list-style:none} .libraryTitle th{text-align:left} pre.peek{background:white;color:black;overflow:auto} pre.peek th{color:white;background:#ebd9b2} +.help-button{float:right} span.expandLink{padding-left:12px;display:inline-block;vertical-align:middle;background:url(../images/silk/resultset_next.png) no-repeat} .folderRow.expanded span.expandLink{background:url(../images/silk/resultset_bottom.png) no-repeat} .folderRow span.rowIcon{float:left;margin-right:5px;width:16px;height:16px;display:inline-block;vertical-align:middle;background:url(../images/silk/folder.png)} diff --git a/static/style/blue/library.css b/static/style/blue/library.css index aafaab07855..22b2845b2fa 100644 --- a/static/style/blue/library.css +++ b/static/style/blue/library.css @@ -32,6 +32,7 @@ ul{list-style:none} .libraryTitle th{text-align:left} pre.peek{background:white;color:black;overflow:auto} pre.peek th{color:white;background:#ebd9b2} +.help-button{float:right} span.expandLink{padding-left:12px;display:inline-block;vertical-align:middle;background:url(../images/silk/resultset_next.png) no-repeat} .folderRow.expanded span.expandLink{background:url(../images/silk/resultset_bottom.png) no-repeat} .folderRow span.rowIcon{float:left;margin-right:5px;width:16px;height:16px;display:inline-block;vertical-align:middle;background:url(../images/silk/folder.png)} diff --git a/static/style/src/less/library.less b/static/style/src/less/library.less index bc8d1a4adad..d0c325aff79 100644 --- a/static/style/src/less/library.less +++ b/static/style/src/less/library.less @@ -151,6 +151,10 @@ pre.peek th { background: @table-heading-bg; } +.help-button { + float: right; +} + span.expandLink { padding-left: 12px; display: inline-block;