From fd53ed075d5b94abc89bf5e80f2bfdeeff780a3f Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Tue, 2 Sep 2014 09:29:50 -0400 Subject: [PATCH] Pack scripts. --- static/scripts/packed/mvc/data.js | 2 +- static/scripts/packed/mvc/dataset/dataset-choice.js | 2 +- static/scripts/packed/mvc/dataset/dataset-li.js | 2 +- static/scripts/packed/mvc/library/library-dataset-view.js | 2 +- static/scripts/packed/mvc/library/library-folder-view.js | 2 +- static/scripts/packed/mvc/library/library-folderrow-view.js | 2 +- static/scripts/packed/mvc/library/library-library-view.js | 2 +- static/scripts/packed/mvc/tools/tools-datasets.js | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/static/scripts/packed/mvc/data.js b/static/scripts/packed/mvc/data.js index 2b7f27f328f..97ea7beb969 100644 --- a/static/scripts/packed/mvc/data.js +++ b/static/scripts/packed/mvc/data.js @@ -1 +1 @@ -define(["mvc/ui/ui-modal","mvc/ui/ui-frames"],function(j,i){var g=Backbone.Model.extend({});var b=Backbone.Model.extend({defaults:{id:"",type:"",name:"",hda_ldda:"hda",metadata:null},initialize:function(){this._set_metadata();this.on("change",this._set_metadata,this)},_set_metadata:function(){var m=new g();_.each(_.keys(this.attributes),function(n){if(n.indexOf("metadata_")===0){var o=n.split("metadata_")[1];m.set(o,this.attributes[n]);delete this.attributes[n]}},this);this.set("metadata",m,{silent:true})},get_metadata:function(m){return this.attributes.metadata.get(m)},urlRoot:galaxy_config.root+"api/datasets"});var h=b.extend({defaults:_.extend({},b.prototype.defaults,{chunk_url:null,first_data_chunk:null,chunk_index:-1,at_eof:false}),initialize:function(m){b.prototype.initialize.call(this);this.attributes.chunk_index=(this.attributes.first_data_chunk?1:0);this.attributes.chunk_url=galaxy_config.root+"dataset/display?dataset_id="+this.id;this.attributes.url_viz=galaxy_config.root+"visualization"},get_next_chunk:function(){if(this.attributes.at_eof){return null}var m=this,n=$.Deferred();$.getJSON(this.attributes.chunk_url,{chunk:m.attributes.chunk_index++}).success(function(o){var p;if(o.ck_data!==""){p=o}else{m.attributes.at_eof=true;p=null}n.resolve(p)});return n}});var e=Backbone.Collection.extend({model:b});var a=Backbone.View.extend({initialize:function(m){this.row_count=0;this.loading_chunk=false;this.header_color="#AAA";this.dark_row_color="#DDD";new d({model:m.model,$el:this.$el})},expand_to_container:function(){if(this.$el.height()").attr("id","loading_indicator");this.$el.append(this.loading_indicator);var p=$("").attr({id:"content_table",cellpadding:0});this.$el.append(p);var m=this.model.get_metadata("column_names"),q=$("").css("background-color",this.header_color).appendTo(p);if(m){q.append("")}var o=this,n=this.model.get("first_data_chunk");if(n){this._renderChunk(n)}else{$.when(o.model.get_next_chunk()).then(function(r){o._renderChunk(r)})}this.scroll_elt.scroll(function(){o.attempt_to_fetch()})},scrolled_to_bottom:function(){return false},_renderCell:function(p,m,q){var n=$("
"+m.join("")+"").text(p);var o=this.model.get_metadata("column_types");if(q!==undefined){n.attr("colspan",q).addClass("stringalign")}else{if(o){if(m"),o=this.model.get_metadata("columns");if(this.row_count%2!==0){p.css("background-color",this.dark_row_color)}if(n.length===o){_.each(n,function(r,q){p.append(this._renderCell(r,q))},this)}else{if(n.length>o){_.each(n.slice(0,o-1),function(r,q){p.append(this._renderCell(r,q))},this);p.append(this._renderCell(n.slice(o-1).join("\t"),o-1))}else{if(o>5&&n.length===o-1){_.each(n,function(r,q){p.append(this._renderCell(r,q))},this);p.append($(""))}else{p.append(this._renderCell(m,0,o))}}}this.row_count++;return p},_renderChunk:function(m){var n=this.$el.find("table");_.each(m.ck_data.split("\n"),function(o,p){if(o!==""){n.append(this._renderRow(o))}},this)}});var f=a.extend({initialize:function(m){a.prototype.initialize.call(this,m);scroll_elt=_.find(this.$el.parents(),function(n){return $(n).css("overflow")==="auto"});if(!scroll_elt){scroll_elt=window}this.scroll_elt=$(scroll_elt)},scrolled_to_bottom:function(){return(this.$el.height()-this.scroll_elt.scrollTop()-this.scroll_elt.height()<=0)}});var l=a.extend({initialize:function(m){a.prototype.initialize.call(this,m);this.scroll_elt=this.$el.css({position:"relative",overflow:"scroll",height:this.options.height||"500px"})},scrolled_to_bottom:function(){return this.$el.scrollTop()+this.$el.innerHeight()>=this.el.scrollHeight}});var d=Backbone.View.extend({col:{chrom:null,start:null,end:null},url_viz:null,dataset_id:null,genome_build:null,data_type:null,initialize:function(o){var r=parent.Galaxy;if(r&&r.modal){this.modal=r.modal}if(r&&r.frame){this.frame=r.frame}if(!this.modal||!this.frame){return}var n=o.model;var q=n.get("metadata");if(!n.get("data_type")){return}this.data_type=n.get("data_type");if(this.data_type=="bed"){if(q.get("chromCol")&&q.get("startCol")&&q.get("endCol")){this.col.chrom=q.get("chromCol")-1;this.col.start=q.get("startCol")-1;this.col.end=q.get("endCol")-1}else{console.log("TabularButtonTrackster : Bed-file metadata incomplete.");return}}if(this.data_type=="vcf"){function p(t,u){for(var s=0;s").attr("id","loading_indicator");this.$el.append(this.loading_indicator);var p=$("").attr({id:"content_table",cellpadding:0});this.$el.append(p);var m=this.model.get_metadata("column_names"),q=$("").css("background-color",this.header_color).appendTo(p);if(m){q.append("")}var o=this,n=this.model.get("first_data_chunk");if(n){this._renderChunk(n)}else{$.when(o.model.get_next_chunk()).then(function(r){o._renderChunk(r)})}this.scroll_elt.scroll(function(){o.attempt_to_fetch()})},scrolled_to_bottom:function(){return false},_renderCell:function(p,m,q){var n=$("');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(""))},templateRowFile:function(){tmpl_array=[];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(""))},templateRowDeletedFile:function(){tmpl_array=[];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(""))}});return{FolderRowView:a}}); \ No newline at end of file +define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-dataset-view"],function(c,e,f,d,b){var a=Backbone.View.extend({lastSelectedHistory:"",events:{"click .undelete_dataset_btn":"undelete_dataset"},options:{type:null},initialize:function(g){this.render(g)},render:function(g){var h=null;if(g.get("type")==="folder"){this.options.type="folder";h=this.templateRowFolder()}else{this.options.type="file";if(g.get("deleted")){h=this.templateRowDeletedFile()}else{h=this.templateRowFile()}}this.setElement(h({content_item:g}));this.$el.show();return this},showDatasetDetails:function(){Galaxy.libraries.datasetView=new b.LibraryDatasetView({id:this.id})},undelete_dataset:function(i){$(".tooltip").hide();var h=this;var g=$(i.target).closest("tr")[0].id;var j=Galaxy.libraries.folderListView.collection.get(g);j.url=j.urlRoot+j.id+"?undelete=true";j.destroy({success:function(l,k){Galaxy.libraries.folderListView.collection.remove(g);var m=new d.Item(k);Galaxy.libraries.folderListView.collection.add(m);f.success("Dataset undeleted. Click this to see it.","",{onclick:function(){h.showDatasetDetails()}})},error:function(l,k){if(typeof k.responseJSON!=="undefined"){f.error("Dataset was not undeleted. "+k.responseJSON.err_msg)}else{f.error("An error occured! Dataset was not undeleted. Please try again.")}}})},templateRowFolder:function(){tmpl_array=[];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(""))},templateRowFile:function(){tmpl_array=[];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(""))},templateRowDeletedFile:function(){tmpl_array=[];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(""))}});return{FolderRowView:a}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/library/library-library-view.js b/static/scripts/packed/mvc/library/library-library-view.js index 1df7059cb5a..a5d0370e4b9 100644 --- a/static/scripts/packed/mvc/library/library-library-view.js +++ b/static/scripts/packed/mvc/library/library-library-view.js @@ -1 +1 @@ -define(["libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(d,c,a){var b=Backbone.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_save_permissions":"savePermissions"},initialize:function(e){this.options=_.extend(this.options,e);if(this.options.id){this.fetchLibrary()}},fetchLibrary:function(e){this.options=_.extend(this.options,e);this.model=new c.Library({id:this.options.id});var f=this;this.model.fetch({success:function(){if(f.options.show_permissions){f.showPermissions()}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){$(".tooltip").remove();this.options=_.extend(this.options,e);var f=this.templateLibrary();this.$el.html(f({item:this.model}));$("#center [data-toggle]").tooltip()},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_library_role_list.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.templateLibraryPermissions();this.$el.html(g({library:this.model,is_admin:h}));var e=this;if(this.options.fetched_permissions===undefined){$.get("/api/libraries/"+e.id+"/permissions?scope=current").done(function(i){e.prepareSelectBoxes({fetched_permissions:i})}).fail(function(){d.error("An error occurred while fetching library permissions. :(")})}else{this.prepareSelectBoxes({})}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},_serializeRoles:function(g){var e=[];for(var f=0;f=0;f--){ids_list.push(e[f].id)}return ids_list},savePermissions:function(h){var g=this;var i=this._extractIds(this.accessSelectObject.$el.select2("data"));var e=this._extractIds(this.addSelectObject.$el.select2("data"));var j=this._extractIds(this.manageSelectObject.$el.select2("data"));var f=this._extractIds(this.modifySelectObject.$el.select2("data"));$.post("/api/libraries/"+g.id+"/permissions?action=set_permissions",{"access_ids[]":i,"add_ids[]":e,"manage_ids[]":j,"modify_ids[]":f,}).done(function(k){g.showPermissions({fetched_permissions:k});d.success("Permissions saved")}).fail(function(){d.error("An error occurred while setting library permissions :(")})},templateLibrary:function(){var e=[];e.push('
');e.push('
');e.push(' ');e.push(' /datasets/<%- item.id %>/permissions">');e.push(' ');e.push("
");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('
"+m.join("")+"").text(p);var o=this.model.get_metadata("column_types");if(q!==undefined){n.attr("colspan",q).addClass("stringalign")}else{if(o){if(m"),o=this.model.get_metadata("columns");if(this.row_count%2!==0){p.css("background-color",this.dark_row_color)}if(n.length===o){_.each(n,function(r,q){p.append(this._renderCell(r,q))},this)}else{if(n.length>o){_.each(n.slice(0,o-1),function(r,q){p.append(this._renderCell(r,q))},this);p.append(this._renderCell(n.slice(o-1).join("\t"),o-1))}else{if(o>5&&n.length===o-1){_.each(n,function(r,q){p.append(this._renderCell(r,q))},this);p.append($(""))}else{p.append(this._renderCell(m,0,o))}}}this.row_count++;return p},_renderChunk:function(m){var n=this.$el.find("table");_.each(m.ck_data.split("\n"),function(o,p){if(o!==""){n.append(this._renderRow(o))}},this)}});var f=a.extend({initialize:function(m){a.prototype.initialize.call(this,m);scroll_elt=_.find(this.$el.parents(),function(n){return $(n).css("overflow")==="auto"});if(!scroll_elt){scroll_elt=window}this.scroll_elt=$(scroll_elt)},scrolled_to_bottom:function(){return(this.$el.height()-this.scroll_elt.scrollTop()-this.scroll_elt.height()<=0)}});var l=a.extend({initialize:function(m){a.prototype.initialize.call(this,m);this.scroll_elt=this.$el.css({position:"relative",overflow:"scroll",height:this.options.height||"500px"})},scrolled_to_bottom:function(){return this.$el.scrollTop()+this.$el.innerHeight()>=this.el.scrollHeight}});var d=Backbone.View.extend({col:{chrom:null,start:null,end:null},url_viz:null,dataset_id:null,genome_build:null,file_ext:null,initialize:function(o){var r=parent.Galaxy;if(r&&r.modal){this.modal=r.modal}if(r&&r.frame){this.frame=r.frame}if(!this.modal||!this.frame){return}var n=o.model;var q=n.get("metadata");if(!n.get("file_ext")){return}this.file_ext=n.get("file_ext");if(this.file_ext=="bed"){if(q.get("chromCol")&&q.get("startCol")&&q.get("endCol")){this.col.chrom=q.get("chromCol")-1;this.col.start=q.get("startCol")-1;this.col.end=q.get("endCol")-1}else{console.log("TabularButtonTrackster : Bed-file metadata incomplete.");return}}if(this.file_ext=="vcf"){function p(t,u){for(var s=0;s'].join("")});m.$(".modal-header").remove();m.$(".modal-footer").css("margin-top","0px");o=new d.DatasetList({title:j.title,subtitle:j.subtitle||c(["Click the checkboxes on the right to select datasets. ","Click the datasets names to see their details. "].join("")),el:m.$body.find(".list-panel"),selecting:true,selected:j.selected,collection:new a.DatasetAssociationCollection(n)});o.once("rendered:initial",function(){m.show();m.$el.addClass("dataset-choice-modal")});if(!j.multiselect){o.on("rendered",function(){o.$(".list-actions").hide()});o.on("view:selected",function(r){q.resolve([r.model.toJSON()])})}o.render(0);return q.always(function(){m.hide()})};var e=Backbone.View.extend(i.LoggableMixin).extend({className:"dataset-choice",initialize:function(j){this.debug(this+"(DatasetChoice).initialize:",j);this.label=j.label!==undefined?c(j.label):"";this.where=j.where;this.datasetsOnly=j.datasetsOnly!==undefined?j.datasetsOnly:true;this.datasetJSON=j.datasetJSON||[];this.selected=j.selected||[];this._setUpListeners()},_setUpListeners:function(){},render:function(){var j=this.toJSON();this.$el.html(this._template(j));this.$(".selected").replaceWith(this._renderSelected(j));return this},_template:function(j){return _.template([""].join(""),{json:j})},_renderSelected:function(j){if(j.selected.length){return $(_.template(['
','<%= selected.hid %>: <%= selected.name %>','',"<%= selected.misc_blurb %>","",c("format")+": ","<%= selected.data_type %>","<%= selected.misc_info %>","","
"].join(""),{selected:j.selected[0]}))}return $(['(',c("click to select a dataset"),")"].join(""))},toJSON:function(){var j=this;return{label:j.label,datasets:j.datasetJSON,selected:_.compact(_.map(j.selected,function(k){return _.findWhere(j.datasetJSON,{id:k})}))}},events:{click:"chooseWithModal"},chooseWithModal:function(){var j=this;return this._createModal().done(function(k){if(k){j.selected=_.pluck(k,"id");j.trigger("selected",j,k);j.render()}else{j.trigger("cancelled",j)}}).fail(function(){j.trigger("error",j,arguments)})},_createModal:function(){return new b(this.datasetJSON,this._getModalOptions())},_getModalOptions:function(){return{title:this.label,multiselect:false,selected:this.selected,where:this.where,datasetsOnly:this.datasetsOnly}},toString:function(){return"DatasetChoice("+this.selected+")"}});var h=e.extend({className:e.prototype.className+" multi",cells:{hid:c("History #"),name:c("Name"),misc_blurb:c("Summary"),data_type:c("Format"),genome_build:c("Genome"),tags:c("Tags"),annotation:c("Annotation")},initialize:function(j){this.showHeaders=j.showHeaders!==undefined?j.showHeaders:true;this.cells=j.cells||this.cells;e.prototype.initialize.call(this,j)},_renderSelected:function(j){if(j.selected.length){return $(_.template(['',"<% if( json.showHeaders ){ %>","","<% _.map( json.cells, function( val, key ){ %>","","<% }); %>","","<% } %>","","<% _.map( json.selected, function( selected ){ %>","","<% _.map( json.cells, function( val, key ){ %>",'',"<% }) %>","","<% }); %>","","
<%= val %>
<%= selected[ key ] %>
"].join(""),{json:j}))}return $(['(',c("click to select a dataset"),")"].join(""))},toJSON:function(){return _.extend(e.prototype.toJSON.call(this),{showHeaders:this.showHeaders,cells:this.cells})},_getModalOptions:function(){return _.extend(e.prototype._getModalOptions.call(this),{multiselect:true})},toString:function(){return"DatasetChoice("+this.selected+")"}});return{DatasetChoiceModal:b,DatasetChoice:e,MultiDatasetChoice:h}}); \ No newline at end of file +define(["mvc/dataset/dataset-model","mvc/dataset/dataset-list","mvc/ui/ui-modal","mvc/base-mvc","utils/localization"],function(a,d,f,i,c){function g(k,j,m){function l(p,o){for(var n in o){if(o.hasOwnProperty(n)){if(p[n]!==o[n]){return false}}}return true}return k.filter(function(n){return(!n.deleted&&n.visible)&&(!m||n.collection_type===undefined)&&(l(n,j))})}var b=function(n,j){j=_.defaults(j||{},{datasetsOnly:true,where:{state:"ok"},multiselect:false,selected:[]});j.title=j.title||(j.multiselect?c("Choose datasets:"):c("Choose a dataset:"));var m,o,l,q=jQuery.Deferred(),p=j.filter||g;n=p(n,j.where,j.datasetsOnly);if(!n.length){return q.reject("No matches found")}function k(){q.resolve(o.getSelectedModels().map(function(r){return r.toJSON()}))}if(j.multiselect){l={};l[c("Ok")]=k}m=new f.View({height:"auto",buttons:l,closing_events:true,closing_callback:function(){q.resolve(null)},body:['
'].join("")});m.$(".modal-header").remove();m.$(".modal-footer").css("margin-top","0px");o=new d.DatasetList({title:j.title,subtitle:j.subtitle||c(["Click the checkboxes on the right to select datasets. ","Click the datasets names to see their details. "].join("")),el:m.$body.find(".list-panel"),selecting:true,selected:j.selected,collection:new a.DatasetAssociationCollection(n)});o.once("rendered:initial",function(){m.show();m.$el.addClass("dataset-choice-modal")});if(!j.multiselect){o.on("rendered",function(){o.$(".list-actions").hide()});o.on("view:selected",function(r){q.resolve([r.model.toJSON()])})}o.render(0);return q.always(function(){m.hide()})};var e=Backbone.View.extend(i.LoggableMixin).extend({className:"dataset-choice",initialize:function(j){this.debug(this+"(DatasetChoice).initialize:",j);this.label=j.label!==undefined?c(j.label):"";this.where=j.where;this.datasetsOnly=j.datasetsOnly!==undefined?j.datasetsOnly:true;this.datasetJSON=j.datasetJSON||[];this.selected=j.selected||[];this._setUpListeners()},_setUpListeners:function(){},render:function(){var j=this.toJSON();this.$el.html(this._template(j));this.$(".selected").replaceWith(this._renderSelected(j));return this},_template:function(j){return _.template([""].join(""),{json:j})},_renderSelected:function(j){if(j.selected.length){return $(_.template(['
','<%= selected.hid %>: <%= selected.name %>','',"<%= selected.misc_blurb %>","",c("format")+": ","<%= selected.file_ext %>","<%= selected.misc_info %>","","
"].join(""),{selected:j.selected[0]}))}return $(['(',c("click to select a dataset"),")"].join(""))},toJSON:function(){var j=this;return{label:j.label,datasets:j.datasetJSON,selected:_.compact(_.map(j.selected,function(k){return _.findWhere(j.datasetJSON,{id:k})}))}},events:{click:"chooseWithModal"},chooseWithModal:function(){var j=this;return this._createModal().done(function(k){if(k){j.selected=_.pluck(k,"id");j.trigger("selected",j,k);j.render()}else{j.trigger("cancelled",j)}}).fail(function(){j.trigger("error",j,arguments)})},_createModal:function(){return new b(this.datasetJSON,this._getModalOptions())},_getModalOptions:function(){return{title:this.label,multiselect:false,selected:this.selected,where:this.where,datasetsOnly:this.datasetsOnly}},toString:function(){return"DatasetChoice("+this.selected+")"}});var h=e.extend({className:e.prototype.className+" multi",cells:{hid:c("History #"),name:c("Name"),misc_blurb:c("Summary"),file_ext:c("Format"),genome_build:c("Genome"),tags:c("Tags"),annotation:c("Annotation")},initialize:function(j){this.showHeaders=j.showHeaders!==undefined?j.showHeaders:true;this.cells=j.cells||this.cells;e.prototype.initialize.call(this,j)},_renderSelected:function(j){if(j.selected.length){return $(_.template(['',"<% if( json.showHeaders ){ %>","","<% _.map( json.cells, function( val, key ){ %>","","<% }); %>","","<% } %>","","<% _.map( json.selected, function( selected ){ %>","","<% _.map( json.cells, function( val, key ){ %>",'',"<% }) %>","","<% }); %>","","
<%= val %>
<%= selected[ key ] %>
"].join(""),{json:j}))}return $(['(',c("click to select a dataset"),")"].join(""))},toJSON:function(){return _.extend(e.prototype.toJSON.call(this),{showHeaders:this.showHeaders,cells:this.cells})},_getModalOptions:function(){return _.extend(e.prototype._getModalOptions.call(this),{multiselect:true})},toString:function(){return"DatasetChoice("+this.selected+")"}});return{DatasetChoiceModal:b,DatasetChoice:e,MultiDatasetChoice:h}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/dataset/dataset-li.js b/static/scripts/packed/mvc/dataset/dataset-li.js index 4a9bf686bc7..6043b636048 100644 --- a/static/scripts/packed/mvc/dataset/dataset-li.js +++ b/static/scripts/packed/mvc/dataset/dataset-li.js @@ -1 +1 @@ -define(["mvc/dataset/states","mvc/base-mvc","utils/localization"],function(a,b,c){var e=b.ListItemView;var d=e.extend({className:e.prototype.className+" dataset",id:function(){return["dataset",this.model.get("id")].join("-")},initialize:function(f){if(f.logger){this.logger=this.model.logger=f.logger}this.log(this+".initialize:",f);e.prototype.initialize.call(this,f);this.linkTarget=f.linkTarget||"_blank";this._setUpListeners()},_setUpListeners:function(){this.on("selectable",function(f){if(f){this.$(".primary-actions").hide()}else{this.$(".primary-actions").show()}},this);this.model.on("change",function(g,f){if(this.model.changedAttributes().state&&this.model.inReadyState()&&this.expanded&&!this.model.hasDetails()){this.model.fetch()}else{this.render()}},this);this.on("all",function(f){this.log(f)},this)},_fetchModelDetails:function(){var f=this;if(f.model.inReadyState()&&!f.model.hasDetails()){return f.model.fetch({silent:true})}return jQuery.when()},remove:function(g,h){var f=this;g=g||this.fxSpeed;this.$el.fadeOut(g,function(){Backbone.View.prototype.remove.call(f);if(h){h.call(f)}})},render:function(f){return e.prototype.render.call(this,f)},_swapNewRender:function(f){e.prototype._swapNewRender.call(this,f);if(this.model.has("state")){this.$el.addClass("state-"+this.model.get("state"))}return this.$el},_renderPrimaryActions:function(){return[this._renderDisplayButton()]},_renderDisplayButton:function(){var h=this.model.get("state");if((h===a.NOT_VIEWABLE)||(h===a.DISCARDED)||(!this.model.get("accessible"))){return null}var g={target:this.linkTarget,classes:"display-btn"};if(this.model.get("purged")){g.disabled=true;g.title=c("Cannot display datasets removed from disk")}else{if(h===a.UPLOAD){g.disabled=true;g.title=c("This dataset must finish uploading before it can be viewed")}else{if(h===a.NEW){g.disabled=true;g.title=c("This dataset is not yet viewable")}else{g.title=c("View data");g.href=this.model.urls.display;var f=this;g.onclick=function(i){if(Galaxy.frame&&Galaxy.frame.active){Galaxy.frame.add({title:"Data Viewer: "+f.model.get("name"),type:"other",content:function(j){require(["mvc/data"],function(k){var l=new k.TabularDataset({id:f.model.get("id")});$.when(l.fetch()).then(function(){k.createTabularDatasetChunkedView({model:l,parent_elt:j,embedded:true,height:"100%"})})})}});i.preventDefault()}}}}}g.faIcon="fa-eye";return faIconButton(g)},_renderDetails:function(){if(this.model.get("state")===a.NOT_VIEWABLE){return $(this.templates.noAccess(this.model.toJSON(),this))}var f=e.prototype._renderDetails.call(this);f.find(".actions .left").empty().append(this._renderSecondaryActions());f.find(".summary").html(this._renderSummary()).prepend(this._renderDetailMessages());f.find(".display-applications").html(this._renderDisplayApplications());this._setUpBehaviors(f);return f},_renderSummary:function(){var f=this.model.toJSON(),g=this.templates.summaries[f.state];g=g||this.templates.summaries.unknown;return g(f,this)},_renderDetailMessages:function(){var f=this,h=$('
'),g=f.model.toJSON();_.each(f.templates.detailMessages,function(i){h.append($(i(g,f)))});return h},_renderDisplayApplications:function(){if(this.model.isDeletedOrPurged()){return""}return[this.templates.displayApplications(this.model.get("display_apps"),this),this.templates.displayApplications(this.model.get("display_types"),this)].join("")},_renderSecondaryActions:function(){this.debug("_renderSecondaryActions");switch(this.model.get("state")){case a.NOT_VIEWABLE:return[];case a.OK:case a.FAILED_METADATA:case a.ERROR:return[this._renderDownloadButton(),this._renderShowParamsButton()]}return[this._renderShowParamsButton()]},_renderShowParamsButton:function(){return faIconButton({title:c("View details"),classes:"params-btn",href:this.model.urls.show_params,target:this.linkTarget,faIcon:"fa-info-circle"})},_renderDownloadButton:function(){if(this.model.get("purged")||!this.model.hasData()){return null}if(!_.isEmpty(this.model.get("meta_files"))){return this._renderMetaFileDownloadButton()}return $(['','',""].join(""))},_renderMetaFileDownloadButton:function(){var f=this.model.urls;return $(['"].join("\n"))},toString:function(){var f=(this.model)?(this.model+""):("(no model)");return"DatasetListItemView("+f+")"}});d.prototype.templates=(function(){var h=_.extend({},e.prototype.templates.warnings,{failed_metadata:b.wrapTemplate(['<% if( model.state === "failed_metadata" ){ %>','
',c("An error occurred setting the metadata for this dataset"),"
","<% } %>"]),error:b.wrapTemplate(["<% if( model.error ){ %>",'
',c("There was an error getting the data for this dataset"),": <%- model.error %>","
","<% } %>"]),purged:b.wrapTemplate(["<% if( model.purged ){ %>",'
',c("This dataset has been deleted and removed from disk"),"
","<% } %>"]),deleted:b.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
',c("This dataset has been deleted"),"
","<% } %>"])});var i=b.wrapTemplate(['
','
','
','
','
',"
","<% if( !dataset.deleted && !dataset.purged ){ %>",'
','
','
',"<% if( dataset.peek ){ %>",'
<%= dataset.peek %>
',"<% } %>","<% } %>","
"],"dataset");var g=b.wrapTemplate(['
','
',c("You do not have permission to view this dataset"),"
","
"],"dataset");var j={};j[a.OK]=j[a.FAILED_METADATA]=b.wrapTemplate(["<% if( dataset.misc_blurb ){ %>",'
','<%- dataset.misc_blurb %>',"
","<% } %>","<% if( dataset.data_type ){ %>",'
','",'<%- dataset.data_type %>',"
","<% } %>","<% if( dataset.metadata_dbkey ){ %>",'
','",'',"<%- dataset.metadata_dbkey %>","","
","<% } %>","<% if( dataset.misc_info ){ %>",'
','<%- dataset.misc_info %>',"
","<% } %>"],"dataset");j[a.NEW]=b.wrapTemplate(["
",c("This is a new dataset and not all of its data are available yet"),"
"],"dataset");j[a.NOT_VIEWABLE]=b.wrapTemplate(["
",c("You do not have permission to view this dataset"),"
"],"dataset");j[a.DISCARDED]=b.wrapTemplate(["
",c("The job creating this dataset was cancelled before completion"),"
"],"dataset");j[a.QUEUED]=b.wrapTemplate(["
",c("This job is waiting to run"),"
"],"dataset");j[a.RUNNING]=b.wrapTemplate(["
",c("This job is currently running"),"
"],"dataset");j[a.UPLOAD]=b.wrapTemplate(["
",c("This dataset is currently uploading"),"
"],"dataset");j[a.SETTING_METADATA]=b.wrapTemplate(["
",c("Metadata is being auto-detected"),"
"],"dataset");j[a.PAUSED]=b.wrapTemplate(["
",c('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume'),"
"],"dataset");j[a.ERROR]=b.wrapTemplate(["<% if( !dataset.purged ){ %>","
<%- dataset.misc_blurb %>
","<% } %>",'',c("An error occurred with this dataset"),":",'
<%- dataset.misc_info %>
'],"dataset");j[a.EMPTY]=b.wrapTemplate(["
",c("No data"),": <%- dataset.misc_blurb %>
"],"dataset");j.unknown=b.wrapTemplate(['
Error: unknown dataset state: "<%- dataset.state %>"
'],"dataset");var k={resubmitted:b.wrapTemplate(["<% if( model.resubmitted ){ %>",'
',c("The job creating this dataset has been resubmitted"),"
","<% } %>"])};var f=b.wrapTemplate(["<% _.each( apps, function( app ){ %>",'
','<%- app.label %> ','',"<% _.each( app.links, function( link ){ %>",'',"<% print( _l( link.text ) ); %>"," ","<% }); %>","","
","<% }); %>"],"apps");return _.extend({},e.prototype.templates,{warnings:h,details:i,noAccess:g,summaries:j,detailMessages:k,displayApplications:f})}());return{DatasetListItemView:d}}); \ No newline at end of file +define(["mvc/dataset/states","mvc/base-mvc","utils/localization"],function(a,b,c){var e=b.ListItemView;var d=e.extend({className:e.prototype.className+" dataset",id:function(){return["dataset",this.model.get("id")].join("-")},initialize:function(f){if(f.logger){this.logger=this.model.logger=f.logger}this.log(this+".initialize:",f);e.prototype.initialize.call(this,f);this.linkTarget=f.linkTarget||"_blank";this._setUpListeners()},_setUpListeners:function(){this.on("selectable",function(f){if(f){this.$(".primary-actions").hide()}else{this.$(".primary-actions").show()}},this);this.model.on("change",function(g,f){if(this.model.changedAttributes().state&&this.model.inReadyState()&&this.expanded&&!this.model.hasDetails()){this.model.fetch()}else{this.render()}},this);this.on("all",function(f){this.log(f)},this)},_fetchModelDetails:function(){var f=this;if(f.model.inReadyState()&&!f.model.hasDetails()){return f.model.fetch({silent:true})}return jQuery.when()},remove:function(g,h){var f=this;g=g||this.fxSpeed;this.$el.fadeOut(g,function(){Backbone.View.prototype.remove.call(f);if(h){h.call(f)}})},render:function(f){return e.prototype.render.call(this,f)},_swapNewRender:function(f){e.prototype._swapNewRender.call(this,f);if(this.model.has("state")){this.$el.addClass("state-"+this.model.get("state"))}return this.$el},_renderPrimaryActions:function(){return[this._renderDisplayButton()]},_renderDisplayButton:function(){var h=this.model.get("state");if((h===a.NOT_VIEWABLE)||(h===a.DISCARDED)||(!this.model.get("accessible"))){return null}var g={target:this.linkTarget,classes:"display-btn"};if(this.model.get("purged")){g.disabled=true;g.title=c("Cannot display datasets removed from disk")}else{if(h===a.UPLOAD){g.disabled=true;g.title=c("This dataset must finish uploading before it can be viewed")}else{if(h===a.NEW){g.disabled=true;g.title=c("This dataset is not yet viewable")}else{g.title=c("View data");g.href=this.model.urls.display;var f=this;g.onclick=function(i){if(Galaxy.frame&&Galaxy.frame.active){Galaxy.frame.add({title:"Data Viewer: "+f.model.get("name"),type:"other",content:function(j){require(["mvc/data"],function(k){var l=new k.TabularDataset({id:f.model.get("id")});$.when(l.fetch()).then(function(){k.createTabularDatasetChunkedView({model:l,parent_elt:j,embedded:true,height:"100%"})})})}});i.preventDefault()}}}}}g.faIcon="fa-eye";return faIconButton(g)},_renderDetails:function(){if(this.model.get("state")===a.NOT_VIEWABLE){return $(this.templates.noAccess(this.model.toJSON(),this))}var f=e.prototype._renderDetails.call(this);f.find(".actions .left").empty().append(this._renderSecondaryActions());f.find(".summary").html(this._renderSummary()).prepend(this._renderDetailMessages());f.find(".display-applications").html(this._renderDisplayApplications());this._setUpBehaviors(f);return f},_renderSummary:function(){var f=this.model.toJSON(),g=this.templates.summaries[f.state];g=g||this.templates.summaries.unknown;return g(f,this)},_renderDetailMessages:function(){var f=this,h=$('
'),g=f.model.toJSON();_.each(f.templates.detailMessages,function(i){h.append($(i(g,f)))});return h},_renderDisplayApplications:function(){if(this.model.isDeletedOrPurged()){return""}return[this.templates.displayApplications(this.model.get("display_apps"),this),this.templates.displayApplications(this.model.get("display_types"),this)].join("")},_renderSecondaryActions:function(){this.debug("_renderSecondaryActions");switch(this.model.get("state")){case a.NOT_VIEWABLE:return[];case a.OK:case a.FAILED_METADATA:case a.ERROR:return[this._renderDownloadButton(),this._renderShowParamsButton()]}return[this._renderShowParamsButton()]},_renderShowParamsButton:function(){return faIconButton({title:c("View details"),classes:"params-btn",href:this.model.urls.show_params,target:this.linkTarget,faIcon:"fa-info-circle"})},_renderDownloadButton:function(){if(this.model.get("purged")||!this.model.hasData()){return null}if(!_.isEmpty(this.model.get("meta_files"))){return this._renderMetaFileDownloadButton()}return $(['','',""].join(""))},_renderMetaFileDownloadButton:function(){var f=this.model.urls;return $(['"].join("\n"))},toString:function(){var f=(this.model)?(this.model+""):("(no model)");return"DatasetListItemView("+f+")"}});d.prototype.templates=(function(){var h=_.extend({},e.prototype.templates.warnings,{failed_metadata:b.wrapTemplate(['<% if( model.state === "failed_metadata" ){ %>','
',c("An error occurred setting the metadata for this dataset"),"
","<% } %>"]),error:b.wrapTemplate(["<% if( model.error ){ %>",'
',c("There was an error getting the data for this dataset"),": <%- model.error %>","
","<% } %>"]),purged:b.wrapTemplate(["<% if( model.purged ){ %>",'
',c("This dataset has been deleted and removed from disk"),"
","<% } %>"]),deleted:b.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
',c("This dataset has been deleted"),"
","<% } %>"])});var i=b.wrapTemplate(['
','
','
','
','
',"
","<% if( !dataset.deleted && !dataset.purged ){ %>",'
','
','
',"<% if( dataset.peek ){ %>",'
<%= dataset.peek %>
',"<% } %>","<% } %>","
"],"dataset");var g=b.wrapTemplate(['
','
',c("You do not have permission to view this dataset"),"
","
"],"dataset");var j={};j[a.OK]=j[a.FAILED_METADATA]=b.wrapTemplate(["<% if( dataset.misc_blurb ){ %>",'
','<%- dataset.misc_blurb %>',"
","<% } %>","<% if( dataset.file_ext ){ %>",'
','",'<%- dataset.file_ext %>',"
","<% } %>","<% if( dataset.metadata_dbkey ){ %>",'
','",'',"<%- dataset.metadata_dbkey %>","","
","<% } %>","<% if( dataset.misc_info ){ %>",'
','<%- dataset.misc_info %>',"
","<% } %>"],"dataset");j[a.NEW]=b.wrapTemplate(["
",c("This is a new dataset and not all of its data are available yet"),"
"],"dataset");j[a.NOT_VIEWABLE]=b.wrapTemplate(["
",c("You do not have permission to view this dataset"),"
"],"dataset");j[a.DISCARDED]=b.wrapTemplate(["
",c("The job creating this dataset was cancelled before completion"),"
"],"dataset");j[a.QUEUED]=b.wrapTemplate(["
",c("This job is waiting to run"),"
"],"dataset");j[a.RUNNING]=b.wrapTemplate(["
",c("This job is currently running"),"
"],"dataset");j[a.UPLOAD]=b.wrapTemplate(["
",c("This dataset is currently uploading"),"
"],"dataset");j[a.SETTING_METADATA]=b.wrapTemplate(["
",c("Metadata is being auto-detected"),"
"],"dataset");j[a.PAUSED]=b.wrapTemplate(["
",c('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume'),"
"],"dataset");j[a.ERROR]=b.wrapTemplate(["<% if( !dataset.purged ){ %>","
<%- dataset.misc_blurb %>
","<% } %>",'',c("An error occurred with this dataset"),":",'
<%- dataset.misc_info %>
'],"dataset");j[a.EMPTY]=b.wrapTemplate(["
",c("No data"),": <%- dataset.misc_blurb %>
"],"dataset");j.unknown=b.wrapTemplate(['
Error: unknown dataset state: "<%- dataset.state %>"
'],"dataset");var k={resubmitted:b.wrapTemplate(["<% if( model.resubmitted ){ %>",'
',c("The job creating this dataset has been resubmitted"),"
","<% } %>"])};var f=b.wrapTemplate(["<% _.each( apps, function( app ){ %>",'
','<%- app.label %> ','',"<% _.each( app.links, function( link ){ %>",'',"<% print( _l( link.text ) ); %>"," ","<% }); %>","","
","<% }); %>"],"apps");return _.extend({},e.prototype.templates,{warnings:h,details:i,noAccess:g,summaries:j,detailMessages:k,displayApplications:f})}());return{DatasetListItemView:d}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/library/library-dataset-view.js b/static/scripts/packed/mvc/library/library-dataset-view.js index 37821cf5eaf..841e8ba232e 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()},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 +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("file_ext")) { %>');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("file_ext")) %>
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("file_ext")) { %>');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("file_ext")) %>
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("file_ext")) %>
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-folder-view.js b/static/scripts/packed/mvc/library/library-folder-view.js index 3c2fd0e17fb..c4969fb5ee0 100644 --- a/static/scripts/packed/mvc/library/library-folder-view.js +++ b/static/scripts/packed/mvc/library/library-folder-view.js @@ -1 +1 @@ -define(["libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(d,c,a){var b=Backbone.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_save_permissions":"savePermissions"},initialize:function(e){this.options=_.extend(this.options,e);if(this.options.id){this.fetchFolder()}},fetchFolder:function(e){this.options=_.extend(this.options,e);this.model=new c.FolderAsModel({id:this.options.id});var f=this;this.model.fetch({success:function(){if(f.options.show_permissions){f.showPermissions()}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){$(".tooltip").remove();this.options=_.extend(this.options,e);var f=this.templateFolder();this.$el.html(f({item:this.model}));$(".peek").html(this.model.get("peek"));$("#center [data-toggle]").tooltip()},shareFolder:function(){d.info("Feature coming soon.")},goBack:function(){Galaxy.libraries.library_router.back()},showPermissions:function(f){this.options=_.extend(this.options,f);$(".tooltip").remove();var h=false;if(Galaxy.currUser){h=Galaxy.currUser.isAdmin()}var g=this.templateFolderPermissions();this.$el.html(g({folder:this.model,is_admin:h}));var e=this;if(this.options.fetched_permissions===undefined){$.get("/api/folders/"+e.id+"/permissions?scope=current").done(function(i){e.prepareSelectBoxes({fetched_permissions:i})}).fail(function(){d.error("An error occurred while fetching folder permissions. :(")})}else{this.prepareSelectBoxes({})}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},_serializeRoles:function(g){var e=[];for(var f=0;f=0;f--){ids_list.push(e[f].id)}return ids_list},savePermissions:function(h){var g=this;var e=this._extractIds(this.addSelectObject.$el.select2("data"));var i=this._extractIds(this.manageSelectObject.$el.select2("data"));var f=this._extractIds(this.modifySelectObject.$el.select2("data"));$.post("/api/folders/"+g.id+"/permissions?action=set_permissions",{"add_ids[]":e,"manage_ids[]":i,"modify_ids[]":f,}).done(function(j){g.showPermissions({fetched_permissions:j});d.success("Permissions saved")}).fail(function(){d.error("An error occurred while setting folder permissions :(")})},templateFolder:function(){var e=[];e.push('
');e.push('
');e.push(' ');e.push(' /datasets/<%- item.id %>/permissions">');e.push(' ');e.push("
");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(' <% if (item.get("data_type")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push("
">Name<%= _.escape(item.get("name")) %>
Data type<%= _.escape(item.get("data_type")) %>
");e.push("
");e.push("
");return _.template(e.join(""))},templateFolderPermissions:function(){var e=[];e.push('
');e.push('
');e.push(' ">');e.push("
");e.push('

Folder: <%= _.escape(folder.get("name")) %>

');e.push('
');e.push("<% if (is_admin) { %>");e.push("You are logged in as an administrator therefore you can manage any folder 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("

Folder permissions

");e.push("

Roles that can manage permissions on this folder

");e.push('
');e.push('
User with any of these roles can manage permissions on this folder.
');e.push("

Roles that can add items to this folder

");e.push('
');e.push('
User with any of these roles can add items to this folder (folders and datasets).
');e.push("

Roles that can modify this folder

");e.push('
');e.push('
User with any of these roles can modify this folder (name, etc.).
');e.push('');e.push("
");e.push("
");return _.template(e.join(""))}});return{FolderView:b}}); \ No newline at end of file +define(["libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(d,c,a){var b=Backbone.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_save_permissions":"savePermissions"},initialize:function(e){this.options=_.extend(this.options,e);if(this.options.id){this.fetchFolder()}},fetchFolder:function(e){this.options=_.extend(this.options,e);this.model=new c.FolderAsModel({id:this.options.id});var f=this;this.model.fetch({success:function(){if(f.options.show_permissions){f.showPermissions()}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){$(".tooltip").remove();this.options=_.extend(this.options,e);var f=this.templateFolder();this.$el.html(f({item:this.model}));$(".peek").html(this.model.get("peek"));$("#center [data-toggle]").tooltip()},shareFolder:function(){d.info("Feature coming soon.")},goBack:function(){Galaxy.libraries.library_router.back()},showPermissions:function(f){this.options=_.extend(this.options,f);$(".tooltip").remove();var h=false;if(Galaxy.currUser){h=Galaxy.currUser.isAdmin()}var g=this.templateFolderPermissions();this.$el.html(g({folder:this.model,is_admin:h}));var e=this;if(this.options.fetched_permissions===undefined){$.get("/api/folders/"+e.id+"/permissions?scope=current").done(function(i){e.prepareSelectBoxes({fetched_permissions:i})}).fail(function(){d.error("An error occurred while fetching folder permissions. :(")})}else{this.prepareSelectBoxes({})}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},_serializeRoles:function(g){var e=[];for(var f=0;f=0;f--){ids_list.push(e[f].id)}return ids_list},savePermissions:function(h){var g=this;var e=this._extractIds(this.addSelectObject.$el.select2("data"));var i=this._extractIds(this.manageSelectObject.$el.select2("data"));var f=this._extractIds(this.modifySelectObject.$el.select2("data"));$.post("/api/folders/"+g.id+"/permissions?action=set_permissions",{"add_ids[]":e,"manage_ids[]":i,"modify_ids[]":f,}).done(function(j){g.showPermissions({fetched_permissions:j});d.success("Permissions saved")}).fail(function(){d.error("An error occurred while setting folder permissions :(")})},templateFolder:function(){var e=[];e.push('
');e.push('
');e.push(' ');e.push(' /datasets/<%- item.id %>/permissions">');e.push(' ');e.push("
");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(' <% if (item.get("file_ext")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push("
">Name<%= _.escape(item.get("name")) %>
Data type<%= _.escape(item.get("file_ext")) %>
");e.push("
");e.push("
");return _.template(e.join(""))},templateFolderPermissions:function(){var e=[];e.push('
');e.push('
');e.push(' ">');e.push("
");e.push('

Folder: <%= _.escape(folder.get("name")) %>

');e.push('
');e.push("<% if (is_admin) { %>");e.push("You are logged in as an administrator therefore you can manage any folder 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("

Folder permissions

");e.push("

Roles that can manage permissions on this folder

");e.push('
');e.push('
User with any of these roles can manage permissions on this folder.
');e.push("

Roles that can add items to this folder

");e.push('
');e.push('
User with any of these roles can add items to this folder (folders and datasets).
');e.push("

Roles that can modify this folder

");e.push('
');e.push('
User with any of these roles can modify this folder (name, etc.).
');e.push('');e.push("
");e.push("
");return _.template(e.join(""))}});return{FolderView:b}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/library/library-folderrow-view.js b/static/scripts/packed/mvc/library/library-folderrow-view.js index 82b778a06c8..04f6a9a03c6 100644 --- a/static/scripts/packed/mvc/library/library-folderrow-view.js +++ b/static/scripts/packed/mvc/library/library-folderrow-view.js @@ -1 +1 @@ -define(["galaxy.masthead","utils/utils","libs/toastr","mvc/library/library-model","mvc/library/library-dataset-view"],function(c,e,f,d,b){var a=Backbone.View.extend({lastSelectedHistory:"",events:{"click .undelete_dataset_btn":"undelete_dataset"},options:{type:null},initialize:function(g){this.render(g)},render:function(g){var h=null;if(g.get("type")==="folder"){this.options.type="folder";h=this.templateRowFolder()}else{this.options.type="file";if(g.get("deleted")){h=this.templateRowDeletedFile()}else{h=this.templateRowFile()}}this.setElement(h({content_item:g}));this.$el.show();return this},showDatasetDetails:function(){Galaxy.libraries.datasetView=new b.LibraryDatasetView({id:this.id})},undelete_dataset:function(i){$(".tooltip").hide();var h=this;var g=$(i.target).closest("tr")[0].id;var j=Galaxy.libraries.folderListView.collection.get(g);j.url=j.urlRoot+j.id+"?undelete=true";j.destroy({success:function(l,k){Galaxy.libraries.folderListView.collection.remove(g);var m=new d.Item(k);Galaxy.libraries.folderListView.collection.add(m);f.success("Dataset undeleted. Click this to see it.","",{onclick:function(){h.showDatasetDetails()}})},error:function(l,k){if(typeof k.responseJSON!=="undefined"){f.error("Dataset was not undeleted. "+k.responseJSON.err_msg)}else{f.error("An error occured! Dataset was not undeleted. Please try again.")}}})},templateRowFolder:function(){tmpl_array=[];tmpl_array.push('
");tmpl_array.push(' ');tmpl_array.push(" ");tmpl_array.push(' <%- content_item.get("name") %>');tmpl_array.push(" folder<%= _.escape(content_item.get("update_time")) %>");tmpl_array.push(' <% if (content_item.get("can_manage")) { %><% } %>');tmpl_array.push("
");tmpl_array.push(' ');tmpl_array.push(" /datasets/<%- content_item.id %>" class="library-dataset"><%- content_item.get("name") %><%= _.escape(content_item.get("data_type")) %><%= _.escape(content_item.get("file_size")) %><%= _.escape(content_item.get("update_time")) %>");tmpl_array.push(' <% if (content_item.get("is_unrestricted")) { %><% } %>');tmpl_array.push(' <% if (content_item.get("is_private")) { %><% } %>');tmpl_array.push(' <% if ((content_item.get("is_unrestricted") === false) && (content_item.get("is_private") === false)) { %><% } %>');tmpl_array.push(' <% if (content_item.get("can_manage")) { %>/datasets/<%- content_item.id %>/permissions"><% } %>');tmpl_array.push("
");tmpl_array.push(' ');tmpl_array.push(" <%- content_item.get("name") %><%= _.escape(content_item.get("data_type")) %><%= _.escape(content_item.get("file_size")) %><%= _.escape(content_item.get("update_time")) %>
");tmpl_array.push(' ');tmpl_array.push(" ");tmpl_array.push(' <%- content_item.get("name") %>');tmpl_array.push(" folder<%= _.escape(content_item.get("update_time")) %>");tmpl_array.push(' <% if (content_item.get("can_manage")) { %><% } %>');tmpl_array.push("
");tmpl_array.push(' ');tmpl_array.push(" /datasets/<%- content_item.id %>" class="library-dataset"><%- content_item.get("name") %><%= _.escape(content_item.get("file_ext")) %><%= _.escape(content_item.get("file_size")) %><%= _.escape(content_item.get("update_time")) %>");tmpl_array.push(' <% if (content_item.get("is_unrestricted")) { %><% } %>');tmpl_array.push(' <% if (content_item.get("is_private")) { %><% } %>');tmpl_array.push(' <% if ((content_item.get("is_unrestricted") === false) && (content_item.get("is_private") === false)) { %><% } %>');tmpl_array.push(' <% if (content_item.get("can_manage")) { %>/datasets/<%- content_item.id %>/permissions"><% } %>');tmpl_array.push("
");tmpl_array.push(' ');tmpl_array.push(" <%- content_item.get("name") %><%= _.escape(content_item.get("file_ext")) %><%= _.escape(content_item.get("file_size")) %><%= _.escape(content_item.get("update_time")) %>
');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("
">Name<%= _.escape(item.get("name")) %>
Data type<%= _.escape(item.get("data_type")) %>
");e.push("");e.push("");return _.template(e.join(""))},templateLibraryPermissions:function(){var e=[];e.push('
');e.push('
');e.push(' ');e.push("
");e.push('

Library: <%= _.escape(library.get("name")) %>

');e.push('
');e.push("<% if (is_admin) { %>");e.push("You are logged in as an administrator therefore you can manage any library 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 permissions

");e.push("

Roles that can access the library

");e.push('
');e.push('
User with any of these roles can access this library. If there are no access roles set on the library it is considered unrestricted.
');e.push("

Roles that can manage permissions on this library

");e.push('
');e.push('
User with any of these roles can manage permissions on this library (includes giving access).
');e.push("

Roles that can add items to this library

");e.push('
');e.push('
User with any of these roles can add items to this library (folders and datasets).
');e.push("

Roles that can modify this library

");e.push('
');e.push('
User with any of these roles can modify this library (name, synopsis, etc.).
');e.push('');e.push("
");e.push("
");return _.template(e.join(""))}});return{LibraryView:b}}); \ No newline at end of file +define(["libs/toastr","mvc/library/library-model","mvc/ui/ui-select"],function(d,c,a){var b=Backbone.View.extend({el:"#center",model:null,options:{},events:{"click .toolbtn_save_permissions":"savePermissions"},initialize:function(e){this.options=_.extend(this.options,e);if(this.options.id){this.fetchLibrary()}},fetchLibrary:function(e){this.options=_.extend(this.options,e);this.model=new c.Library({id:this.options.id});var f=this;this.model.fetch({success:function(){if(f.options.show_permissions){f.showPermissions()}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){$(".tooltip").remove();this.options=_.extend(this.options,e);var f=this.templateLibrary();this.$el.html(f({item:this.model}));$("#center [data-toggle]").tooltip()},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_library_role_list.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.templateLibraryPermissions();this.$el.html(g({library:this.model,is_admin:h}));var e=this;if(this.options.fetched_permissions===undefined){$.get("/api/libraries/"+e.id+"/permissions?scope=current").done(function(i){e.prepareSelectBoxes({fetched_permissions:i})}).fail(function(){d.error("An error occurred while fetching library permissions. :(")})}else{this.prepareSelectBoxes({})}$("#center [data-toggle]").tooltip();$("#center").css("overflow","auto")},_serializeRoles:function(g){var e=[];for(var f=0;f=0;f--){ids_list.push(e[f].id)}return ids_list},savePermissions:function(h){var g=this;var i=this._extractIds(this.accessSelectObject.$el.select2("data"));var e=this._extractIds(this.addSelectObject.$el.select2("data"));var j=this._extractIds(this.manageSelectObject.$el.select2("data"));var f=this._extractIds(this.modifySelectObject.$el.select2("data"));$.post("/api/libraries/"+g.id+"/permissions?action=set_permissions",{"access_ids[]":i,"add_ids[]":e,"manage_ids[]":j,"modify_ids[]":f,}).done(function(k){g.showPermissions({fetched_permissions:k});d.success("Permissions saved")}).fail(function(){d.error("An error occurred while setting library permissions :(")})},templateLibrary:function(){var e=[];e.push('
');e.push('
');e.push(' ');e.push(' /datasets/<%- item.id %>/permissions">');e.push(' ');e.push("
");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(' <% if (item.get("file_ext")) { %>');e.push(" ");e.push(' ');e.push(' ');e.push(" ");e.push(" <% } %>");e.push("
">Name<%= _.escape(item.get("name")) %>
Data type<%= _.escape(item.get("file_ext")) %>
");e.push("
");e.push("
");return _.template(e.join(""))},templateLibraryPermissions:function(){var e=[];e.push('
');e.push('
');e.push(' ');e.push("
");e.push('

Library: <%= _.escape(library.get("name")) %>

');e.push('
');e.push("<% if (is_admin) { %>");e.push("You are logged in as an administrator therefore you can manage any library 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 permissions

");e.push("

Roles that can access the library

");e.push('
');e.push('
User with any of these roles can access this library. If there are no access roles set on the library it is considered unrestricted.
');e.push("

Roles that can manage permissions on this library

");e.push('
');e.push('
User with any of these roles can manage permissions on this library (includes giving access).
');e.push("

Roles that can add items to this library

");e.push('
');e.push('
User with any of these roles can add items to this library (folders and datasets).
');e.push("

Roles that can modify this library

");e.push('
');e.push('
User with any of these roles can modify this library (name, synopsis, etc.).
');e.push('');e.push("
");e.push("
");return _.template(e.join(""))}});return{LibraryView:b}}); \ No newline at end of file diff --git a/static/scripts/packed/mvc/tools/tools-datasets.js b/static/scripts/packed/mvc/tools/tools-datasets.js index 57037d2e5a6..d3c3f2a4f29 100644 --- a/static/scripts/packed/mvc/tools/tools-datasets.js +++ b/static/scripts/packed/mvc/tools/tools-datasets.js @@ -1 +1 @@ -define(["mvc/history/history-contents"],function(a){return Backbone.Model.extend({initialize:function(c){this.currHistoryContents=new a.HistoryContents({});this.currHistoryContents.historyId="f597429621d6eb2b";var b=this;var d=this.currHistoryContents.fetchAllDetails().done(function(){console.debug("tools-datasets::initialize() - Completed.");c.success&&c.success()}).fail(function(){console.debug("tools-datasets::initialize() - Ajax request failed.")})},filterType:function(b){return this.currHistoryContents.filter(function(c){var d=c.get("history_content_type");var e=c.get("data_type");return d==="dataset"})},filter:function(b){return _.first(this.currHistoryContents.filter(function(c){return c.get("id")===b}))}})}); \ No newline at end of file +define(["mvc/history/history-contents"],function(a){return Backbone.Model.extend({initialize:function(c){this.currHistoryContents=new a.HistoryContents({});this.currHistoryContents.historyId="f597429621d6eb2b";var b=this;var d=this.currHistoryContents.fetchAllDetails().done(function(){console.debug("tools-datasets::initialize() - Completed.");c.success&&c.success()}).fail(function(){console.debug("tools-datasets::initialize() - Ajax request failed.")})},filterType:function(b){return this.currHistoryContents.filter(function(c){var d=c.get("history_content_type");var e=c.get("file_ext");return d==="dataset"})},filter:function(b){return _.first(this.currHistoryContents.filter(function(c){return c.get("id")===b}))}})}); \ No newline at end of file