galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
November 2014
- 2 participants
- 184 discussions
commit/galaxy-central: carlfeberhard: Phyloviz: fix saving
by commits-noreply@bitbucket.org 13 Nov '14
by commits-noreply@bitbucket.org 13 Nov '14
13 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/e802fed907e5/
Changeset: e802fed907e5
User: carlfeberhard
Date: 2014-11-13 16:23:12+00:00
Summary: Phyloviz: fix saving
Affected #: 3 files
diff -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a -r e802fed907e5341d2d50c94d546a65faf3978a1a client/galaxy/scripts/viz/phyloviz.js
--- a/client/galaxy/scripts/viz/phyloviz.js
+++ b/client/galaxy/scripts/viz/phyloviz.js
@@ -199,6 +199,7 @@
this.set("dataset", new data_mod.Dataset({
id: options.dataset_id
}));
+
},
root : {}, // Root has to be its own independent object because it is not part of the viz_config
@@ -267,16 +268,14 @@
show_message("Saving to Galaxy", "progress");
return $.ajax({
- url : this.url,
+ url : this.url(),
type : "POST",
dataType: "json",
data : {
- vis_json: JSON.stringify(config)
+ config : JSON.stringify( config ),
+ type : 'phyloviz'
},
success: function(res){
- var viz_id = res.url.split("id=")[1].split("&")[0],
- viz_url = "/visualization?id=" + viz_id;
- window.history.pushState({}, "", viz_url + window.location.hash);
hide_modal();
}
});
diff -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a -r e802fed907e5341d2d50c94d546a65faf3978a1a static/scripts/packed/viz/phyloviz.js
--- a/static/scripts/packed/viz/phyloviz.js
+++ b/static/scripts/packed/viz/phyloviz.js
@@ -1,1 +1,1 @@
-define(["libs/d3","viz/visualization","mvc/data"],function(m,f,g){var l=Backbone.View.extend({className:"UserMenuBase",isAcceptableValue:function(q,o,n){var r=q.val(),s=q.attr("displayLabel")||q.attr("id").replace("phyloViz","");function p(t){return !isNaN(parseFloat(t))&&isFinite(t)}if(!p(r)){alert(s+" is not a number!");return false}if(r>n){alert(s+" is too large.");return false}else{if(r<o){alert(s+" is too small.");return false}}return true},hasIllegalJsonCharacters:function(n){if(n.val().search(/"|'|\\/)!==-1){alert("Named fields cannot contain these illegal characters: double quote(\"), single guote('), or back slash(\\). ");return true}return false}});function h(){var w=this,r=m.layout.hierarchy().sort(null).value(null),v=360,q="Linear",u=18,s=200,t=0,p=0.5,n=50;w.leafHeight=function(x){if(typeof x==="undefined"){return u}else{u=x;return w}};w.layoutMode=function(x){if(typeof x==="undefined"){return q}else{q=x;return w}};w.layoutAngle=function(x){if(typeof x==="undefined"){return v}if(isNaN(x)||x<0||x>360){return w}else{v=x;return w}};w.separation=function(x){if(typeof x==="undefined"){return s}else{s=x;return w}};w.links=function(x){return m.layout.tree().links(x)};w.nodes=function(A,y){if(toString.call(A)==="[object Array]"){A=A[0]}var z=r.call(w,A,y),x=[],C=0,B=0;window._d=A;window._nodes=z;z.forEach(function(D){C=D.depth>C?D.depth:C;x.push(D)});x.forEach(function(D){if(!D.children){B+=1;D.depth=C}});u=q==="Circular"?v/B:u;t=0;o(x[0],C,u,null);return x};function o(B,D,A,z){var y=B.children,x=0;var C=B.dist||p;C=C>1?1:C;B.dist=C;if(z!==null){B.y0=z.y0+C*s}else{B.y0=n}if(!y){B.x0=t*A;t+=1}else{y.forEach(function(E){E.parent=B;x+=o(E,D,A,B)});B.x0=x/y.length}B.x=B.x0;B.y=B.y0;return B.x0}return w}var b=f.Visualization.extend({defaults:{layout:"Linear",separation:250,leafHeight:18,type:"phyloviz",title:"Title",scaleFactor:1,translate:[0,0],fontSize:12,selectedNode:null,nodeAttrChangedTime:0},initialize:function(n){this.set("dataset",new g.Dataset({id:n.dataset_id}))},root:{},toggle:function(n){if(typeof n==="undefined"){return}if(n.children){n._children=n.children;n.children=null}else{n.children=n._children;n._children=null}},toggleAll:function(n){if(n.children&&n.children.length!==0){n.children.forEach(this.toggleAll);toggle(n)}},getData:function(){return this.root},save:function(){var n=this.root;o(n);function o(q){delete q.parent;if(q._selected){delete q._selected}if(q.children){q.children.forEach(o)}if(q._children){q._children.forEach(o)}}var p=jQuery.extend(true,{},this.attributes);p.selectedNode=null;show_message("Saving to Galaxy","progress");return $.ajax({url:this.url,type:"POST",dataType:"json",data:{vis_json:JSON.stringify(p)},success:function(q){var r=q.url.split("id=")[1].split("&")[0],s="/visualization?id="+r;window.history.pushState({},"",s+window.location.hash);hide_modal()}})}});var d=Backbone.View.extend({defaults:{nodeRadius:4.5},stdInit:function(o){var n=this;n.model.on("change:separation change:leafHeight change:fontSize change:nodeAttrChangedTime",n.updateAndRender,n);n.vis=o.vis;n.i=0;n.maxDepth=-1;n.width=o.width;n.height=o.height},updateAndRender:function(p){var o=m.select(".vis"),n=this;p=p||n.model.root;n.renderNodes(p);n.renderLinks(p);n.addTooltips()},renderLinks:function(n){var w=this;var o=w.diagonal;var p=w.duration;var r=w.layoutMode;var t=w.vis.selectAll("g.completeLink").data(w.tree.links(w.nodes),function(x){return x.target.id});var v=function(x){x.pos0=x.source.y0+" "+x.source.x0;x.pos1=x.source.y0+" "+x.target.x0;x.pos2=x.target.y0+" "+x.target.x0};var u=t.enter().insert("svg:g","g.node").attr("class","completeLink");u.append("svg:path").attr("class","link").attr("d",function(x){v(x);return"M "+x.pos0+" L "+x.pos1});var s=t.transition().duration(500);s.select("path.link").attr("d",function(x){v(x);return"M "+x.pos0+" L "+x.pos1+" L "+x.pos2});var q=t.exit().remove()},selectNode:function(o){var n=this;m.selectAll("g.node").classed("selectedHighlight",function(p){if(o.id===p.id){if(o._selected){delete o._selected;return false}else{o._selected=true;return true}}return false});n.model.set("selectedNode",o);$("#phyloVizSelectedNodeName").val(o.name);$("#phyloVizSelectedNodeDist").val(o.dist);$("#phyloVizSelectedNodeAnnotation").val(o.annotation||"")},addTooltips:function(){$(".tooltip").remove();$(".node").attr("data-original-title",function(){var o=this.__data__,n=o.annotation||"None";return o?(o.name?o.name+"<br/>":"")+"Dist: "+o.dist+" <br/>Annotation: "+n:""}).tooltip({placement:"top",trigger:"hover"})}});var a=d.extend({initialize:function(o){var n=this;n.margins=o.margins;n.layoutMode="Linear";n.stdInit(o);n.layout();n.updateAndRender(n.model.root)},layout:function(){var n=this;n.tree=new h().layoutMode("Linear");n.diagonal=m.svg.diagonal().projection(function(o){return[o.y,o.x]})},renderNodes:function(n){var u=this,v=u.model.get("fontSize")+"px";u.tree.separation(u.model.get("separation")).leafHeight(u.model.get("leafHeight"));var q=500,o=u.tree.separation(u.model.get("separation")).nodes(u.model.root);var p=u.vis.selectAll("g.node").data(o,function(w){return w.name+w.id||(w.id=++u.i)});u.nodes=o;u.duration=q;var r=p.enter().append("svg:g").attr("class","node").on("dblclick",function(){m.event.stopPropagation()}).on("click",function(w){if(m.event.altKey){u.selectNode(w)}else{if(w.children&&w.children.length===0){return}u.model.toggle(w);u.updateAndRender(w)}});if(toString.call(n)==="[object Array]"){n=n[0]}r.attr("transform",function(w){return"translate("+n.y0+","+n.x0+")"});r.append("svg:circle").attr("r",0.000001).style("fill",function(w){return w._children?"lightsteelblue":"#fff"});r.append("svg:text").attr("class","nodeLabel").attr("x",function(w){return w.children||w._children?-10:10}).attr("dy",".35em").attr("text-anchor",function(w){return w.children||w._children?"end":"start"}).style("fill-opacity",0.000001);var s=p.transition().duration(q);s.attr("transform",function(w){return"translate("+w.y+","+w.x+")"});s.select("circle").attr("r",u.defaults.nodeRadius).style("fill",function(w){return w._children?"lightsteelblue":"#fff"});s.select("text").style("fill-opacity",1).style("font-size",v).text(function(w){return w.name});var t=p.exit().transition().duration(q).remove();t.select("circle").attr("r",0.000001);t.select("text").style("fill-opacity",0.000001);o.forEach(function(w){w.x0=w.x;w.y0=w.y})}});var j=Backbone.View.extend({className:"phyloviz",initialize:function(o){var n=this;n.MIN_SCALE=0.05;n.MAX_SCALE=5;n.MAX_DISPLACEMENT=500;n.margins=[10,60,10,80];n.width=$("#PhyloViz").width();n.height=$("#PhyloViz").height();n.radius=n.width;n.data=o.data;$(window).resize(function(){n.width=$("#PhyloViz").width();n.height=$("#PhyloViz").height();n.render()});n.phyloTree=new b(o.config);n.phyloTree.root=n.data;n.zoomFunc=m.behavior.zoom().scaleExtent([n.MIN_SCALE,n.MAX_SCALE]);n.zoomFunc.translate(n.phyloTree.get("translate"));n.zoomFunc.scale(n.phyloTree.get("scaleFactor"));n.navMenu=new c(n);n.settingsMenu=new i({phyloTree:n.phyloTree});n.nodeSelectionView=new e({phyloTree:n.phyloTree});n.search=new k();setTimeout(function(){n.zoomAndPan()},1000)},render:function(){var o=this;$("#PhyloViz").empty();o.mainSVG=m.select("#PhyloViz").append("svg:svg").attr("width",o.width).attr("height",o.height).attr("pointer-events","all").call(o.zoomFunc.on("zoom",function(){o.zoomAndPan()}));o.boundingRect=o.mainSVG.append("svg:rect").attr("class","boundingRect").attr("width",o.width).attr("height",o.height).attr("stroke","black").attr("fill","white");o.vis=o.mainSVG.append("svg:g").attr("class","vis");o.layoutOptions={model:o.phyloTree,width:o.width,height:o.height,vis:o.vis,margins:o.margins};$("#title").text("Phylogenetic Tree from "+o.phyloTree.get("title")+":");var n=new a(o.layoutOptions)},zoomAndPan:function(n){var t,p;if(typeof n!=="undefined"){t=n.zoom;p=n.translate}var w=this,r=w.zoomFunc.scale(),v=w.zoomFunc.translate(),s="",u="";switch(t){case"reset":r=1;v=[0,0];break;case"+":r*=1.1;break;case"-":r*=0.9;break;default:if(typeof t==="number"){r=t}else{if(m.event!==null){r=m.event.scale}}}if(r<w.MIN_SCALE||r>w.MAX_SCALE){return}w.zoomFunc.scale(r);s="translate("+w.margins[3]+","+w.margins[0]+") scale("+r+")";if(m.event!==null){u="translate("+m.event.translate+")"}else{if(typeof p!=="undefined"){var q=p.split(",")[0];var o=p.split(",")[1];if(!isNaN(q)&&!isNaN(o)){v=[v[0]+parseFloat(q),v[1]+parseFloat(o)]}}w.zoomFunc.translate(v);u="translate("+v+")"}w.phyloTree.set("scaleFactor",r);w.phyloTree.set("translate",v);w.vis.attr("transform",u+s)},reloadViz:function(){var n=this,o=$("#phylovizNexSelector :selected").val();$.getJSON(n.phyloTree.get("dataset").url(),{tree_index:o,data_type:"raw_data"},function(p){n.data=p.data;n.config=p;n.render()})}});var c=Backbone.View.extend({initialize:function(o){var n=this;n.phylovizView=o;$("#panelHeaderRightBtns").empty();$("#phyloVizNavBtns").empty();$("#phylovizNexSelector").off();n.initNavBtns();n.initRightHeaderBtns();$("#phylovizNexSelector").off().on("change",function(){n.phylovizView.reloadViz()})},initRightHeaderBtns:function(){var n=this;rightMenu=create_icon_buttons_menu([{icon_class:"gear",title:"PhyloViz Settings",on_click:function(){$("#SettingsMenu").show();n.settingsMenu.updateUI()}},{icon_class:"disk",title:"Save visualization",on_click:function(){var o=$("#phylovizNexSelector option:selected").text();if(o){n.phylovizView.phyloTree.set("title",o)}n.phylovizView.phyloTree.save()}},{icon_class:"chevron-expand",title:"Search / Edit Nodes",on_click:function(){$("#nodeSelectionView").show()}},{icon_class:"information",title:"Phyloviz Help",on_click:function(){window.open("https://wiki.galaxyproject.org/Learn/Visualization/PhylogeneticTree")}}],{tooltip_config:{placement:"bottom"}});$("#panelHeaderRightBtns").append(rightMenu.$el)},initNavBtns:function(){var n=this,o=create_icon_buttons_menu([{icon_class:"zoom-in",title:"Zoom in",on_click:function(){n.phylovizView.zoomAndPan({zoom:"+"})}},{icon_class:"zoom-out",title:"Zoom out",on_click:function(){n.phylovizView.zoomAndPan({zoom:"-"})}},{icon_class:"arrow-circle",title:"Reset Zoom/Pan",on_click:function(){n.phylovizView.zoomAndPan({zoom:"reset"})}}],{tooltip_config:{placement:"bottom"}});$("#phyloVizNavBtns").append(o.$el)}});var i=l.extend({className:"Settings",initialize:function(o){var n=this;n.phyloTree=o.phyloTree;n.el=$("#SettingsMenu");n.inputs={separation:$("#phyloVizTreeSeparation"),leafHeight:$("#phyloVizTreeLeafHeight"),fontSize:$("#phyloVizTreeFontSize")};$("#settingsCloseBtn").off().on("click",function(){n.el.hide()});$("#phylovizResetSettingsBtn").off().on("click",function(){n.resetToDefaults()});$("#phylovizApplySettingsBtn").off().on("click",function(){n.apply()})},apply:function(){var n=this;if(!n.isAcceptableValue(n.inputs.separation,50,2500)||!n.isAcceptableValue(n.inputs.leafHeight,5,30)||!n.isAcceptableValue(n.inputs.fontSize,5,20)){return}$.each(n.inputs,function(o,p){n.phyloTree.set(o,p.val())})},updateUI:function(){var n=this;$.each(n.inputs,function(o,p){p.val(n.phyloTree.get(o))})},resetToDefaults:function(){$(".tooltip").remove();var n=this;$.each(n.phyloTree.defaults,function(o,p){n.phyloTree.set(o,p)});n.updateUI()},render:function(){}});var e=l.extend({className:"Settings",initialize:function(o){var n=this;n.el=$("#nodeSelectionView");n.phyloTree=o.phyloTree;n.UI={enableEdit:$("#phylovizEditNodesCheck"),saveChanges:$("#phylovizNodeSaveChanges"),cancelChanges:$("#phylovizNodeCancelChanges"),name:$("#phyloVizSelectedNodeName"),dist:$("#phyloVizSelectedNodeDist"),annotation:$("#phyloVizSelectedNodeAnnotation")};n.valuesOfConcern={name:null,dist:null,annotation:null};$("#nodeSelCloseBtn").off().on("click",function(){n.el.hide()});n.UI.saveChanges.off().on("click",function(){n.updateNodes()});n.UI.cancelChanges.off().on("click",function(){n.cancelChanges()});(function(p){p.fn.enable=function(q){return p(this).each(function(){if(q){p(this).removeAttr("disabled")}else{p(this).attr("disabled","disabled")}})}})(jQuery);n.UI.enableEdit.off().on("click",function(){n.toggleUI()})},toggleUI:function(){var n=this,o=n.UI.enableEdit.is(":checked");if(!o){n.cancelChanges()}$.each(n.valuesOfConcern,function(p,q){n.UI[p].enable(o)});if(o){n.UI.saveChanges.show();n.UI.cancelChanges.show()}else{n.UI.saveChanges.hide();n.UI.cancelChanges.hide()}},cancelChanges:function(){var n=this,o=n.phyloTree.get("selectedNode");if(o){$.each(n.valuesOfConcern,function(p,q){n.UI[p].val(o[p])})}},updateNodes:function(){var n=this,o=n.phyloTree.get("selectedNode");if(o){if(!n.isAcceptableValue(n.UI.dist,0,1)||n.hasIllegalJsonCharacters(n.UI.name)||n.hasIllegalJsonCharacters(n.UI.annotation)){return}$.each(n.valuesOfConcern,function(p,q){(o[p])=n.UI[p].val()});n.phyloTree.set("nodeAttrChangedTime",new Date())}else{alert("No node selected")}}});var k=l.extend({initialize:function(){var n=this;$("#phyloVizSearchBtn").on("click",function(){var p=$("#phyloVizSearchTerm"),q=$("#phyloVizSearchCondition").val().split("-"),o=q[0],r=q[1];n.hasIllegalJsonCharacters(p);if(o==="dist"){n.isAcceptableValue(p,0,1)}n.searchTree(o,r,p.val())})},searchTree:function(n,p,o){m.selectAll("g.node").classed("searchHighlight",function(r){var q=r[n];if(typeof q!=="undefined"&&q!==null){if(n==="dist"){switch(p){case"greaterEqual":return q>=+o;case"lesserEqual":return q<=+o;default:return}}else{if(n==="name"||n==="annotation"){return q.toLowerCase().indexOf(o.toLowerCase())!==-1}}}})}});return{PhylovizView:j}});
\ No newline at end of file
+define(["libs/d3","viz/visualization","mvc/data"],function(m,f,g){var l=Backbone.View.extend({className:"UserMenuBase",isAcceptableValue:function(q,o,n){var r=q.val(),s=q.attr("displayLabel")||q.attr("id").replace("phyloViz","");function p(t){return !isNaN(parseFloat(t))&&isFinite(t)}if(!p(r)){alert(s+" is not a number!");return false}if(r>n){alert(s+" is too large.");return false}else{if(r<o){alert(s+" is too small.");return false}}return true},hasIllegalJsonCharacters:function(n){if(n.val().search(/"|'|\\/)!==-1){alert("Named fields cannot contain these illegal characters: double quote(\"), single guote('), or back slash(\\). ");return true}return false}});function h(){var w=this,r=m.layout.hierarchy().sort(null).value(null),v=360,q="Linear",u=18,s=200,t=0,p=0.5,n=50;w.leafHeight=function(x){if(typeof x==="undefined"){return u}else{u=x;return w}};w.layoutMode=function(x){if(typeof x==="undefined"){return q}else{q=x;return w}};w.layoutAngle=function(x){if(typeof x==="undefined"){return v}if(isNaN(x)||x<0||x>360){return w}else{v=x;return w}};w.separation=function(x){if(typeof x==="undefined"){return s}else{s=x;return w}};w.links=function(x){return m.layout.tree().links(x)};w.nodes=function(A,y){if(toString.call(A)==="[object Array]"){A=A[0]}var z=r.call(w,A,y),x=[],C=0,B=0;window._d=A;window._nodes=z;z.forEach(function(D){C=D.depth>C?D.depth:C;x.push(D)});x.forEach(function(D){if(!D.children){B+=1;D.depth=C}});u=q==="Circular"?v/B:u;t=0;o(x[0],C,u,null);return x};function o(B,D,A,z){var y=B.children,x=0;var C=B.dist||p;C=C>1?1:C;B.dist=C;if(z!==null){B.y0=z.y0+C*s}else{B.y0=n}if(!y){B.x0=t*A;t+=1}else{y.forEach(function(E){E.parent=B;x+=o(E,D,A,B)});B.x0=x/y.length}B.x=B.x0;B.y=B.y0;return B.x0}return w}var b=f.Visualization.extend({defaults:{layout:"Linear",separation:250,leafHeight:18,type:"phyloviz",title:"Title",scaleFactor:1,translate:[0,0],fontSize:12,selectedNode:null,nodeAttrChangedTime:0},initialize:function(n){this.set("dataset",new g.Dataset({id:n.dataset_id}))},root:{},toggle:function(n){if(typeof n==="undefined"){return}if(n.children){n._children=n.children;n.children=null}else{n.children=n._children;n._children=null}},toggleAll:function(n){if(n.children&&n.children.length!==0){n.children.forEach(this.toggleAll);toggle(n)}},getData:function(){return this.root},save:function(){var n=this.root;o(n);function o(q){delete q.parent;if(q._selected){delete q._selected}if(q.children){q.children.forEach(o)}if(q._children){q._children.forEach(o)}}var p=jQuery.extend(true,{},this.attributes);p.selectedNode=null;show_message("Saving to Galaxy","progress");return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{config:JSON.stringify(p),type:"phyloviz"},success:function(q){hide_modal()}})}});var d=Backbone.View.extend({defaults:{nodeRadius:4.5},stdInit:function(o){var n=this;n.model.on("change:separation change:leafHeight change:fontSize change:nodeAttrChangedTime",n.updateAndRender,n);n.vis=o.vis;n.i=0;n.maxDepth=-1;n.width=o.width;n.height=o.height},updateAndRender:function(p){var o=m.select(".vis"),n=this;p=p||n.model.root;n.renderNodes(p);n.renderLinks(p);n.addTooltips()},renderLinks:function(n){var w=this;var o=w.diagonal;var p=w.duration;var r=w.layoutMode;var t=w.vis.selectAll("g.completeLink").data(w.tree.links(w.nodes),function(x){return x.target.id});var v=function(x){x.pos0=x.source.y0+" "+x.source.x0;x.pos1=x.source.y0+" "+x.target.x0;x.pos2=x.target.y0+" "+x.target.x0};var u=t.enter().insert("svg:g","g.node").attr("class","completeLink");u.append("svg:path").attr("class","link").attr("d",function(x){v(x);return"M "+x.pos0+" L "+x.pos1});var s=t.transition().duration(500);s.select("path.link").attr("d",function(x){v(x);return"M "+x.pos0+" L "+x.pos1+" L "+x.pos2});var q=t.exit().remove()},selectNode:function(o){var n=this;m.selectAll("g.node").classed("selectedHighlight",function(p){if(o.id===p.id){if(o._selected){delete o._selected;return false}else{o._selected=true;return true}}return false});n.model.set("selectedNode",o);$("#phyloVizSelectedNodeName").val(o.name);$("#phyloVizSelectedNodeDist").val(o.dist);$("#phyloVizSelectedNodeAnnotation").val(o.annotation||"")},addTooltips:function(){$(".tooltip").remove();$(".node").attr("data-original-title",function(){var o=this.__data__,n=o.annotation||"None";return o?(o.name?o.name+"<br/>":"")+"Dist: "+o.dist+" <br/>Annotation: "+n:""}).tooltip({placement:"top",trigger:"hover"})}});var a=d.extend({initialize:function(o){var n=this;n.margins=o.margins;n.layoutMode="Linear";n.stdInit(o);n.layout();n.updateAndRender(n.model.root)},layout:function(){var n=this;n.tree=new h().layoutMode("Linear");n.diagonal=m.svg.diagonal().projection(function(o){return[o.y,o.x]})},renderNodes:function(n){var u=this,v=u.model.get("fontSize")+"px";u.tree.separation(u.model.get("separation")).leafHeight(u.model.get("leafHeight"));var q=500,o=u.tree.separation(u.model.get("separation")).nodes(u.model.root);var p=u.vis.selectAll("g.node").data(o,function(w){return w.name+w.id||(w.id=++u.i)});u.nodes=o;u.duration=q;var r=p.enter().append("svg:g").attr("class","node").on("dblclick",function(){m.event.stopPropagation()}).on("click",function(w){if(m.event.altKey){u.selectNode(w)}else{if(w.children&&w.children.length===0){return}u.model.toggle(w);u.updateAndRender(w)}});if(toString.call(n)==="[object Array]"){n=n[0]}r.attr("transform",function(w){return"translate("+n.y0+","+n.x0+")"});r.append("svg:circle").attr("r",0.000001).style("fill",function(w){return w._children?"lightsteelblue":"#fff"});r.append("svg:text").attr("class","nodeLabel").attr("x",function(w){return w.children||w._children?-10:10}).attr("dy",".35em").attr("text-anchor",function(w){return w.children||w._children?"end":"start"}).style("fill-opacity",0.000001);var s=p.transition().duration(q);s.attr("transform",function(w){return"translate("+w.y+","+w.x+")"});s.select("circle").attr("r",u.defaults.nodeRadius).style("fill",function(w){return w._children?"lightsteelblue":"#fff"});s.select("text").style("fill-opacity",1).style("font-size",v).text(function(w){return w.name});var t=p.exit().transition().duration(q).remove();t.select("circle").attr("r",0.000001);t.select("text").style("fill-opacity",0.000001);o.forEach(function(w){w.x0=w.x;w.y0=w.y})}});var j=Backbone.View.extend({className:"phyloviz",initialize:function(o){var n=this;n.MIN_SCALE=0.05;n.MAX_SCALE=5;n.MAX_DISPLACEMENT=500;n.margins=[10,60,10,80];n.width=$("#PhyloViz").width();n.height=$("#PhyloViz").height();n.radius=n.width;n.data=o.data;$(window).resize(function(){n.width=$("#PhyloViz").width();n.height=$("#PhyloViz").height();n.render()});n.phyloTree=new b(o.config);n.phyloTree.root=n.data;n.zoomFunc=m.behavior.zoom().scaleExtent([n.MIN_SCALE,n.MAX_SCALE]);n.zoomFunc.translate(n.phyloTree.get("translate"));n.zoomFunc.scale(n.phyloTree.get("scaleFactor"));n.navMenu=new c(n);n.settingsMenu=new i({phyloTree:n.phyloTree});n.nodeSelectionView=new e({phyloTree:n.phyloTree});n.search=new k();setTimeout(function(){n.zoomAndPan()},1000)},render:function(){var o=this;$("#PhyloViz").empty();o.mainSVG=m.select("#PhyloViz").append("svg:svg").attr("width",o.width).attr("height",o.height).attr("pointer-events","all").call(o.zoomFunc.on("zoom",function(){o.zoomAndPan()}));o.boundingRect=o.mainSVG.append("svg:rect").attr("class","boundingRect").attr("width",o.width).attr("height",o.height).attr("stroke","black").attr("fill","white");o.vis=o.mainSVG.append("svg:g").attr("class","vis");o.layoutOptions={model:o.phyloTree,width:o.width,height:o.height,vis:o.vis,margins:o.margins};$("#title").text("Phylogenetic Tree from "+o.phyloTree.get("title")+":");var n=new a(o.layoutOptions)},zoomAndPan:function(n){var t,p;if(typeof n!=="undefined"){t=n.zoom;p=n.translate}var w=this,r=w.zoomFunc.scale(),v=w.zoomFunc.translate(),s="",u="";switch(t){case"reset":r=1;v=[0,0];break;case"+":r*=1.1;break;case"-":r*=0.9;break;default:if(typeof t==="number"){r=t}else{if(m.event!==null){r=m.event.scale}}}if(r<w.MIN_SCALE||r>w.MAX_SCALE){return}w.zoomFunc.scale(r);s="translate("+w.margins[3]+","+w.margins[0]+") scale("+r+")";if(m.event!==null){u="translate("+m.event.translate+")"}else{if(typeof p!=="undefined"){var q=p.split(",")[0];var o=p.split(",")[1];if(!isNaN(q)&&!isNaN(o)){v=[v[0]+parseFloat(q),v[1]+parseFloat(o)]}}w.zoomFunc.translate(v);u="translate("+v+")"}w.phyloTree.set("scaleFactor",r);w.phyloTree.set("translate",v);w.vis.attr("transform",u+s)},reloadViz:function(){var n=this,o=$("#phylovizNexSelector :selected").val();$.getJSON(n.phyloTree.get("dataset").url(),{tree_index:o,data_type:"raw_data"},function(p){n.data=p.data;n.config=p;n.render()})}});var c=Backbone.View.extend({initialize:function(o){var n=this;n.phylovizView=o;$("#panelHeaderRightBtns").empty();$("#phyloVizNavBtns").empty();$("#phylovizNexSelector").off();n.initNavBtns();n.initRightHeaderBtns();$("#phylovizNexSelector").off().on("change",function(){n.phylovizView.reloadViz()})},initRightHeaderBtns:function(){var n=this;rightMenu=create_icon_buttons_menu([{icon_class:"gear",title:"PhyloViz Settings",on_click:function(){$("#SettingsMenu").show();n.settingsMenu.updateUI()}},{icon_class:"disk",title:"Save visualization",on_click:function(){var o=$("#phylovizNexSelector option:selected").text();if(o){n.phylovizView.phyloTree.set("title",o)}n.phylovizView.phyloTree.save()}},{icon_class:"chevron-expand",title:"Search / Edit Nodes",on_click:function(){$("#nodeSelectionView").show()}},{icon_class:"information",title:"Phyloviz Help",on_click:function(){window.open("https://wiki.galaxyproject.org/Learn/Visualization/PhylogeneticTree")}}],{tooltip_config:{placement:"bottom"}});$("#panelHeaderRightBtns").append(rightMenu.$el)},initNavBtns:function(){var n=this,o=create_icon_buttons_menu([{icon_class:"zoom-in",title:"Zoom in",on_click:function(){n.phylovizView.zoomAndPan({zoom:"+"})}},{icon_class:"zoom-out",title:"Zoom out",on_click:function(){n.phylovizView.zoomAndPan({zoom:"-"})}},{icon_class:"arrow-circle",title:"Reset Zoom/Pan",on_click:function(){n.phylovizView.zoomAndPan({zoom:"reset"})}}],{tooltip_config:{placement:"bottom"}});$("#phyloVizNavBtns").append(o.$el)}});var i=l.extend({className:"Settings",initialize:function(o){var n=this;n.phyloTree=o.phyloTree;n.el=$("#SettingsMenu");n.inputs={separation:$("#phyloVizTreeSeparation"),leafHeight:$("#phyloVizTreeLeafHeight"),fontSize:$("#phyloVizTreeFontSize")};$("#settingsCloseBtn").off().on("click",function(){n.el.hide()});$("#phylovizResetSettingsBtn").off().on("click",function(){n.resetToDefaults()});$("#phylovizApplySettingsBtn").off().on("click",function(){n.apply()})},apply:function(){var n=this;if(!n.isAcceptableValue(n.inputs.separation,50,2500)||!n.isAcceptableValue(n.inputs.leafHeight,5,30)||!n.isAcceptableValue(n.inputs.fontSize,5,20)){return}$.each(n.inputs,function(o,p){n.phyloTree.set(o,p.val())})},updateUI:function(){var n=this;$.each(n.inputs,function(o,p){p.val(n.phyloTree.get(o))})},resetToDefaults:function(){$(".tooltip").remove();var n=this;$.each(n.phyloTree.defaults,function(o,p){n.phyloTree.set(o,p)});n.updateUI()},render:function(){}});var e=l.extend({className:"Settings",initialize:function(o){var n=this;n.el=$("#nodeSelectionView");n.phyloTree=o.phyloTree;n.UI={enableEdit:$("#phylovizEditNodesCheck"),saveChanges:$("#phylovizNodeSaveChanges"),cancelChanges:$("#phylovizNodeCancelChanges"),name:$("#phyloVizSelectedNodeName"),dist:$("#phyloVizSelectedNodeDist"),annotation:$("#phyloVizSelectedNodeAnnotation")};n.valuesOfConcern={name:null,dist:null,annotation:null};$("#nodeSelCloseBtn").off().on("click",function(){n.el.hide()});n.UI.saveChanges.off().on("click",function(){n.updateNodes()});n.UI.cancelChanges.off().on("click",function(){n.cancelChanges()});(function(p){p.fn.enable=function(q){return p(this).each(function(){if(q){p(this).removeAttr("disabled")}else{p(this).attr("disabled","disabled")}})}})(jQuery);n.UI.enableEdit.off().on("click",function(){n.toggleUI()})},toggleUI:function(){var n=this,o=n.UI.enableEdit.is(":checked");if(!o){n.cancelChanges()}$.each(n.valuesOfConcern,function(p,q){n.UI[p].enable(o)});if(o){n.UI.saveChanges.show();n.UI.cancelChanges.show()}else{n.UI.saveChanges.hide();n.UI.cancelChanges.hide()}},cancelChanges:function(){var n=this,o=n.phyloTree.get("selectedNode");if(o){$.each(n.valuesOfConcern,function(p,q){n.UI[p].val(o[p])})}},updateNodes:function(){var n=this,o=n.phyloTree.get("selectedNode");if(o){if(!n.isAcceptableValue(n.UI.dist,0,1)||n.hasIllegalJsonCharacters(n.UI.name)||n.hasIllegalJsonCharacters(n.UI.annotation)){return}$.each(n.valuesOfConcern,function(p,q){(o[p])=n.UI[p].val()});n.phyloTree.set("nodeAttrChangedTime",new Date())}else{alert("No node selected")}}});var k=l.extend({initialize:function(){var n=this;$("#phyloVizSearchBtn").on("click",function(){var p=$("#phyloVizSearchTerm"),q=$("#phyloVizSearchCondition").val().split("-"),o=q[0],r=q[1];n.hasIllegalJsonCharacters(p);if(o==="dist"){n.isAcceptableValue(p,0,1)}n.searchTree(o,r,p.val())})},searchTree:function(n,p,o){m.selectAll("g.node").classed("searchHighlight",function(r){var q=r[n];if(typeof q!=="undefined"&&q!==null){if(n==="dist"){switch(p){case"greaterEqual":return q>=+o;case"lesserEqual":return q<=+o;default:return}}else{if(n==="name"||n==="annotation"){return q.toLowerCase().indexOf(o.toLowerCase())!==-1}}}})}});return{PhylovizView:j}});
\ No newline at end of file
diff -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a -r e802fed907e5341d2d50c94d546a65faf3978a1a static/scripts/viz/phyloviz.js
--- a/static/scripts/viz/phyloviz.js
+++ b/static/scripts/viz/phyloviz.js
@@ -199,6 +199,7 @@
this.set("dataset", new data_mod.Dataset({
id: options.dataset_id
}));
+
},
root : {}, // Root has to be its own independent object because it is not part of the viz_config
@@ -267,16 +268,14 @@
show_message("Saving to Galaxy", "progress");
return $.ajax({
- url : this.url,
+ url : this.url(),
type : "POST",
dataType: "json",
data : {
- vis_json: JSON.stringify(config)
+ config : JSON.stringify( config ),
+ type : 'phyloviz'
},
success: function(res){
- var viz_id = res.url.split("id=")[1].split("&")[0],
- viz_url = "/visualization?id=" + viz_id;
- window.history.pushState({}, "", viz_url + window.location.hash);
hide_modal();
}
});
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
[galaxyproject/usegalaxy-playbook] 9e763a: Static memory increases for certain tools.
by GitHub 13 Nov '14
by GitHub 13 Nov '14
13 Nov '14
Branch: refs/heads/master
Home: https://github.com/galaxyproject/usegalaxy-playbook
Commit: 9e763a5005cb48a34122e78c208607d7aae93783
https://github.com/galaxyproject/usegalaxy-playbook/commit/9e763a5005cb48a3…
Author: Nate Coraor <nate(a)bx.psu.edu>
Date: 2014-11-13 (Thu, 13 Nov 2014)
Changed paths:
M templates/galaxy/usegalaxy.org/config/job_conf.xml.j2
Log Message:
-----------
Static memory increases for certain tools.
Commit: ea2825245643691aa084a51976e19635b97ebe28
https://github.com/galaxyproject/usegalaxy-playbook/commit/ea2825245643691a…
Author: Nate Coraor <nate(a)bx.psu.edu>
Date: 2014-11-13 (Thu, 13 Nov 2014)
Changed paths:
M files/galaxy/test.galaxyproject.org/var/integrated_tool_panel.xml
M production/group_vars/all.yml
M stage/group_vars/all.yml
Log Message:
-----------
Update Test and Main.
Compare: https://github.com/galaxyproject/usegalaxy-playbook/compare/f1c38cf9ddc8...…
1
0
commit/galaxy-central: guerler: ToolForm: Test tool form width limits
by commits-noreply@bitbucket.org 13 Nov '14
by commits-noreply@bitbucket.org 13 Nov '14
13 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/e372aaa3b3bc/
Changeset: e372aaa3b3bc
User: guerler
Date: 2014-11-13 14:59:08+00:00
Summary: ToolForm: Test tool form width limits
Affected #: 5 files
diff -r dfdb4c8c2d12261bdc691ec0db32ad459b0c2525 -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a client/galaxy/scripts/mvc/tools/tools-form.js
--- a/client/galaxy/scripts/mvc/tools/tools-form.js
+++ b/client/galaxy/scripts/mvc/tools/tools-form.js
@@ -334,6 +334,7 @@
this.portlet = new Portlet.View({
icon : 'fa-wrench',
title: '<b>' + this.model.name + '</b> ' + this.model.description,
+ cls : 'ui-portlet-short',
operations: {
menu : menu
},
diff -r dfdb4c8c2d12261bdc691ec0db32ad459b0c2525 -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a static/scripts/mvc/tools/tools-form.js
--- a/static/scripts/mvc/tools/tools-form.js
+++ b/static/scripts/mvc/tools/tools-form.js
@@ -334,6 +334,7 @@
this.portlet = new Portlet.View({
icon : 'fa-wrench',
title: '<b>' + this.model.name + '</b> ' + this.model.description,
+ cls : 'ui-portlet-short',
operations: {
menu : menu
},
diff -r dfdb4c8c2d12261bdc691ec0db32ad459b0c2525 -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a static/scripts/packed/mvc/tools/tools-form.js
--- a/static/scripts/packed/mvc/tools/tools-form.js
+++ b/static/scripts/packed/mvc/tools/tools-form.js
@@ -1,1 +1,1 @@
-define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);this._buildForm(o)},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id,src:"hda"}).id_uncoded}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];switch(p.type){case"data":t=p.options;break;default:for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);v.trigger("change");console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
+define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);this._buildForm(o)},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id,src:"hda"}).id_uncoded}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];switch(p.type){case"data":t=p.options;break;default:for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);v.trigger("change");console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,cls:"ui-portlet-short",operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
diff -r dfdb4c8c2d12261bdc691ec0db32ad459b0c2525 -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a static/style/blue/base.css
--- a/static/style/blue/base.css
+++ b/static/style/blue/base.css
@@ -1279,7 +1279,7 @@
.upload-ftp .upload-ftp-help{margin-bottom:10px}
.upload-ftp .upload-ftp-warning{text-align:center;margin-top:20px}
.upload-settings .upload-settings-cover{position:absolute;width:100%;height:100%;top:0px;left:0px;background:#fff;opacity:0.4;cursor:no-drop}
-.no-highlight,.ui-button-icon,.ui-portlet,.ui-portlet-repeat{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;-ms-user-select:none;}
+.no-highlight,.ui-button-icon,.ui-portlet,.ui-portlet-short,.ui-portlet-repeat{-webkit-user-select:none;-moz-user-select:none;-khtml-user-select:none;-ms-user-select:none;}
.ui-error{-moz-border-radius:3px;border-radius:3px;background:#f9c7c5;padding:5px}
.ui-table-form-error{display:none}.ui-table-form-error .ui-table-form-error-text{padding-left:5px}
.ui-table tbody{cursor:pointer}
@@ -1302,11 +1302,12 @@
.ui-button-icon-plain{border:none !important;background:none !important;height:inherit !important;width:inherit !important;padding-right:3px !important}
.ui-tabs .ui-tabs-add{font-size:0.8em;margin-right:5px}
.ui-tabs .ui-tabs-delete{font-size:0.8em;margin-left:5px;cursor:pointer}
-.ui-portlet,.ui-portlet-repeat,.ui-portlet-repeat{border:solid #d6b161 1px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;position:relative;clear:both;width:auto;height:100%}.ui-portlet .portlet-header{background:#ebd9b2;border-bottom:solid #d6b161 1px;padding:2px 8px;overflow:visible;float:right;width:100%}.ui-portlet .portlet-header .portlet-title .portlet-title-text{vertical-align:middle}
-.ui-portlet .portlet-header .portlet-title .icon{font-size:1.2em;vertical-align:middle}
-.ui-portlet .portlet-buttons{height:50px;padding:10px}
-.ui-portlet .portlet-content{height:inherit;padding:10px;clear:both}.ui-portlet .portlet-content .content{padding:10px;height:100%;width:100%}.ui-portlet .portlet-content .content .buttons{height:50px;padding:10px}
-.ui-portlet .no-scroll{height:calc(100% - 80px)}
+.ui-portlet,.ui-portlet-short,.ui-portlet-repeat,.ui-portlet-short,.ui-portlet-repeat{border:solid #d6b161 1px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;position:relative;clear:both;width:auto;height:100%}.ui-portlet .portlet-header,.ui-portlet-short .portlet-header{background:#ebd9b2;border-bottom:solid #d6b161 1px;padding:2px 8px;overflow:visible;float:right;width:100%}.ui-portlet .portlet-header .portlet-title .portlet-title-text,.ui-portlet-short .portlet-header .portlet-title .portlet-title-text{vertical-align:middle}
+.ui-portlet .portlet-header .portlet-title .icon,.ui-portlet-short .portlet-header .portlet-title .icon{font-size:1.2em;vertical-align:middle}
+.ui-portlet .portlet-buttons,.ui-portlet-short .portlet-buttons{height:50px;padding:10px}
+.ui-portlet .portlet-content,.ui-portlet-short .portlet-content{height:inherit;padding:10px;clear:both}.ui-portlet .portlet-content .content,.ui-portlet-short .portlet-content .content{padding:10px;height:100%;width:100%}.ui-portlet .portlet-content .content .buttons,.ui-portlet-short .portlet-content .content .buttons{height:50px;padding:10px}
+.ui-portlet .no-scroll,.ui-portlet-short .no-scroll{height:calc(100% - 80px)}
+.ui-portlet-short .portlet-content{max-width:600px}
.ui-portlet-repeat{border:none;border-left:solid 3px #ebd9b2;border-radius:5px}.ui-portlet-repeat .portlet-header{background:#ebd9b2;border-radius:3px;border-bottom-left-radius:0px;padding:0px 2px}
.ui-portlet-repeat .portlet-content{padding:0px}.ui-portlet-repeat .portlet-content .content{padding:0px;padding-left:10px}
.ui-popover{max-width:700px;display:none}.ui-popover .popover-close{position:absolute;right:10px;top:7px;font-size:1.2em;cursor:pointer}
diff -r dfdb4c8c2d12261bdc691ec0db32ad459b0c2525 -r e372aaa3b3bc1ab9f9b8053d277c678647e8007a static/style/src/less/ui.less
--- a/static/style/src/less/ui.less
+++ b/static/style/src/less/ui.less
@@ -200,6 +200,13 @@
}
}
+.ui-portlet-short {
+ &:extend(.ui-portlet all);
+ .portlet-content {
+ max-width: 600px;
+ }
+}
+
.ui-portlet-repeat {
&:extend(.ui-portlet);
border: none;
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: ToolForm: Fix collection ids
by commits-noreply@bitbucket.org 12 Nov '14
by commits-noreply@bitbucket.org 12 Nov '14
12 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/dfdb4c8c2d12/
Changeset: dfdb4c8c2d12
User: guerler
Date: 2014-11-12 20:33:53+00:00
Summary: ToolForm: Fix collection ids
Affected #: 1 file
diff -r 76ec1e41fe30300ce12c72167ce38990028f6c27 -r dfdb4c8c2d12261bdc691ec0db32ad459b0c2525 lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -2100,7 +2100,7 @@
if dataset_collection_matcher.hdca_match( hdca, reduction=multiple ):
d['options']['hdca'].append({
'id' : trans.security.encode_id( hdca.id ),
- 'id_uncoded' : hda.id,
+ 'id_uncoded' : hdca.id,
'hid' : hdca.hid,
'name' : hdca.name,
'src' : 'hdca'
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: ToolForm: Temporary modification of return dictionary for datasets
by commits-noreply@bitbucket.org 12 Nov '14
by commits-noreply@bitbucket.org 12 Nov '14
12 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/76ec1e41fe30/
Changeset: 76ec1e41fe30
User: guerler
Date: 2014-11-12 20:30:35+00:00
Summary: ToolForm: Temporary modification of return dictionary for datasets
Affected #: 4 files
diff -r 31f05a12912be544f59a85239e584eeac15a4b98 -r 76ec1e41fe30300ce12c72167ce38990028f6c27 client/galaxy/scripts/mvc/tools/tools-form.js
--- a/client/galaxy/scripts/mvc/tools/tools-form.js
+++ b/client/galaxy/scripts/mvc/tools/tools-form.js
@@ -148,7 +148,7 @@
var current_state = this.tree.finalize({
data : function(dict) {
if (dict.values.length > 0 && dict.values[0] && dict.values[0].src === 'hda') {
- return self.content.get({id: dict.values[0].id, src: 'hda'}).dataset_id;
+ return self.content.get({id: dict.values[0].id, src: 'hda'}).id_uncoded;
}
return null;
}
diff -r 31f05a12912be544f59a85239e584eeac15a4b98 -r 76ec1e41fe30300ce12c72167ce38990028f6c27 lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -2088,10 +2088,10 @@
if dataset_matcher.hda_match( hda ):
d['options']['hda'].append({
'id' : trans.security.encode_id( hda.id ),
+ 'id_uncoded' : hda.id,
'hid' : hda.hid,
'name' : hda.name,
- 'src' : 'hda',
- 'dataset_id' : hda.dataset_id
+ 'src' : 'hda'
})
# add dataset collections
@@ -2100,6 +2100,7 @@
if dataset_collection_matcher.hdca_match( hdca, reduction=multiple ):
d['options']['hdca'].append({
'id' : trans.security.encode_id( hdca.id ),
+ 'id_uncoded' : hda.id,
'hid' : hdca.hid,
'name' : hdca.name,
'src' : 'hdca'
diff -r 31f05a12912be544f59a85239e584eeac15a4b98 -r 76ec1e41fe30300ce12c72167ce38990028f6c27 static/scripts/mvc/tools/tools-form.js
--- a/static/scripts/mvc/tools/tools-form.js
+++ b/static/scripts/mvc/tools/tools-form.js
@@ -148,7 +148,7 @@
var current_state = this.tree.finalize({
data : function(dict) {
if (dict.values.length > 0 && dict.values[0] && dict.values[0].src === 'hda') {
- return self.content.get({id: dict.values[0].id, src: 'hda'}).dataset_id;
+ return self.content.get({id: dict.values[0].id, src: 'hda'}).id_uncoded;
}
return null;
}
diff -r 31f05a12912be544f59a85239e584eeac15a4b98 -r 76ec1e41fe30300ce12c72167ce38990028f6c27 static/scripts/packed/mvc/tools/tools-form.js
--- a/static/scripts/packed/mvc/tools/tools-form.js
+++ b/static/scripts/packed/mvc/tools/tools-form.js
@@ -1,1 +1,1 @@
-define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);this._buildForm(o)},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id,src:"hda"}).dataset_id}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];switch(p.type){case"data":t=p.options;break;default:for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);v.trigger("change");console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
+define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);this._buildForm(o)},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id,src:"hda"}).id_uncoded}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];switch(p.type){case"data":t=p.options;break;default:for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);v.trigger("change");console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: carlfeberhard: Pages: allow registry visualizations to display within an iframe; Refactor embed_item.less and minor style fixes
by commits-noreply@bitbucket.org 12 Nov '14
by commits-noreply@bitbucket.org 12 Nov '14
12 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/31f05a12912b/
Changeset: 31f05a12912b
User: carlfeberhard
Date: 2014-11-12 18:45:38+00:00
Summary: Pages: allow registry visualizations to display within an iframe; Refactor embed_item.less and minor style fixes
Affected #: 7 files
diff -r f26c2543ff053b9ff31617bc03f99d505302ecda -r 31f05a12912be544f59a85239e584eeac15a4b98 lib/galaxy/webapps/galaxy/controllers/page.py
--- a/lib/galaxy/webapps/galaxy/controllers/page.py
+++ b/lib/galaxy/webapps/galaxy/controllers/page.py
@@ -755,6 +755,28 @@
user_is_owner=user_is_owner, history_dict=history_dictionary, hda_dicts=hda_dictionaries )
return filled
+ def _get_embedded_visualization_html( self, trans, id ):
+ """
+ Returns html suitable for embedding visualizations in another page.
+ """
+ visualization = self.get_visualization( trans, id, False, True )
+ visualization.annotation = self.get_item_annotation_str( trans.sa_session, visualization.user, visualization )
+ if not visualization:
+ return None
+
+ # Fork to template based on visualization.type (registry or builtin).
+ if( ( trans.app.visualizations_registry and visualization.type in trans.app.visualizations_registry.plugins )
+ and ( visualization.type not in trans.app.visualizations_registry.BUILT_IN_VISUALIZATIONS ) ):
+ # if a registry visualization, load a version into an iframe :(
+ #TODO: simplest path from A to B but not optimal - will be difficult to do reg visualizations any other way
+ #TODO: this will load the visualization twice (once above, once when the iframe src calls 'saved')
+ encoded_visualization_id = trans.security.encode_id( visualization.id )
+ return trans.fill_template( 'visualization/embed_in_frame.mako',
+ item=visualization, encoded_visualization_id=encoded_visualization_id,
+ content_only=True )
+
+ return trans.fill_template( "visualization/embed.mako", item=visualization, item_data=None )
+
def _get_embed_html( self, trans, item_class, item_id ):
""" Returns HTML for embedding an item in a page. """
item_class = self.get_class( item_class )
@@ -776,10 +798,7 @@
return trans.fill_template( "workflow/embed.mako", item=workflow, item_data=workflow.latest_workflow.steps )
elif item_class == model.Visualization:
- visualization = self.get_visualization( trans, item_id, False, True )
- visualization.annotation = self.get_item_annotation_str( trans.sa_session, visualization.user, visualization )
- if visualization:
- return trans.fill_template( "visualization/embed.mako", item=visualization, item_data=None )
+ return self._get_embedded_visualization_html( trans, item_id )
elif item_class == model.Page:
pass
diff -r f26c2543ff053b9ff31617bc03f99d505302ecda -r 31f05a12912be544f59a85239e584eeac15a4b98 lib/galaxy/webapps/galaxy/controllers/visualization.py
--- a/lib/galaxy/webapps/galaxy/controllers/visualization.py
+++ b/lib/galaxy/webapps/galaxy/controllers/visualization.py
@@ -585,7 +585,7 @@
user_item_rating = 0
ave_item_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, visualization )
- # Display.
+ # Fork to template based on visualization.type (registry or builtin).
if( ( trans.app.visualizations_registry and visualization.type in trans.app.visualizations_registry.plugins )
and ( visualization.type not in trans.app.visualizations_registry.BUILT_IN_VISUALIZATIONS ) ):
# if a registry visualization, load a version of display.mako that will load the vis into an iframe :(
diff -r f26c2543ff053b9ff31617bc03f99d505302ecda -r 31f05a12912be544f59a85239e584eeac15a4b98 static/style/blue/embed_item.css
--- a/static/style/blue/embed_item.css
+++ b/static/style/blue/embed_item.css
@@ -1,19 +1,14 @@
-.embedded-item{margin:0em auto;width:90%;-moz-border-radius:0.5em;-webkit-border-radius:0.5em;border-radius:0.5em}
-.embedded-item.display{padding:5px 10px 10px 10px}
-.embedded-item.history{background-color:#c1c9e5}
-.embedded-item.history p{background:#c1c9e5 no-repeat 2px 2px;margin-top:0;margin-bottom:0}
-.embedded-item.dataset{background-color:#cfc}
-.embedded-item.dataset p{background:#cfc no-repeat 2px 2px;margin-top:0;margin-bottom:0}
-.embedded-item.workflow{background-color:#fbddb3}
-.embedded-item.workflow p{background:#fbddb3 no-repeat 2px 2px;margin-top:0;margin-bottom:0}
-.embedded-item.visualization{background-color:#bbb}
-.embedded-item.visualization p{background:#bbb no-repeat 2px 2px;margin-top:0;margin-bottom:0}
-.embedded-item .expanded-content{display:none;background-color:white;padding:5px}
-.embedded-item .item-content{max-height:25em;overflow:auto}
-.embedded-item.visualization .item-content{overflow:hidden}
+.embedded-item{margin:0em auto;width:90%;-moz-border-radius:0.5em;-webkit-border-radius:0.5em;border-radius:0.5em}.embedded-item .expanded-content{display:none;background-color:white}
+.embedded-item .item-content{max-height:45em;overflow:auto}
.embedded-item>.title{vertical-align:top;text-align:center;font-weight:bold;padding-bottom:5px}
.embedded-item.placeholder .content{padding:0.5em 0.5em;font-style:italic;text-align:center}
-table.annotated-item{width:100%;border-collapse:collapse}
-table.annotated-item td,th{padding:0}
-table.annotated-item .annotation{padding-left:2em;width:40%}
-table.annotated-item td.annotation{vertical-align:text-top;padding-top:1em}
+.embedded-item p{background:inherit;margin-top:0;margin-bottom:0}
+.embedded-item table.annotated-item{width:100%;border-collapse:collapse}
+.embedded-item table.annotated-item td,.embedded-item th{padding:0}
+.embedded-item table.annotated-item .annotation{padding-left:2em;width:40%}
+.embedded-item table.annotated-item td.annotation{vertical-align:text-top;padding-top:1em}
+.embedded-item.display{padding:5px 10px 10px 10px}
+.embedded-item.history{background-color:#C1C9E5}
+.embedded-item.dataset{background-color:#CFC}.embedded-item.dataset .item-content{padding:5px}
+.embedded-item.workflow{background-color:#FBDDB3}.embedded-item.workflow .item-content{padding:5px}
+.embedded-item.visualization{background-color:#BBBBBB}.embedded-item.visualization .item-content{overflow:hidden;height:100%}.embedded-item.visualization .item-content iframe{min-height:320px;margin-bottom:-4px}
diff -r f26c2543ff053b9ff31617bc03f99d505302ecda -r 31f05a12912be544f59a85239e584eeac15a4b98 static/style/src/less/embed_item.less
--- a/static/style/src/less/embed_item.less
+++ b/static/style/src/less/embed_item.less
@@ -4,6 +4,54 @@
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
border-radius: 0.5em;
+
+ .expanded-content {
+ display: none;
+ background-color: white;
+ }
+
+ .item-content {
+ max-height: 45em;
+ overflow: auto;
+ }
+
+ & > .title {
+ vertical-align: top;
+ text-align: center;
+ font-weight: bold;
+ padding-bottom: 5px;
+ }
+
+ &.placeholder .content {
+ padding: 0.5em 0.5em;
+ font-style: italic;
+ text-align: center;
+ }
+
+ p {
+ background: inherit;
+ margin-top:0;
+ margin-bottom:0;
+ }
+
+ table.annotated-item {
+ width: 100%;
+ border-collapse: collapse;
+ }
+
+ table.annotated-item td,th {
+ padding: 0;
+ }
+
+ table.annotated-item .annotation {
+ padding-left: 2em;
+ width: 40%;
+ }
+
+ table.annotated-item td.annotation {
+ vertical-align: text-top;
+ padding-top: 1em;
+ }
}
.embedded-item.display {
@@ -11,89 +59,32 @@
}
.embedded-item.history {
- background-color:#C1C9E5
-}
-
-.embedded-item.history p {
- background:#C1C9E5 no-repeat 2px 2px;
- margin-top:0;
- margin-bottom:0;
+ background-color: #C1C9E5;
}
.embedded-item.dataset {
- background-color:#CFC
-}
-
-.embedded-item.dataset p {
- background:#CFC no-repeat 2px 2px;
- margin-top:0;margin-bottom:0;
+ background-color: #CFC;
+ .item-content {
+ padding: 5px;
+ }
}
.embedded-item.workflow {
- background-color:#FBDDB3
-}
-
-.embedded-item.workflow p {
- background:#FBDDB3 no-repeat 2px 2px;
- margin-top:0;
- margin-bottom:0;
+ background-color: #FBDDB3;
+ .item-content {
+ padding: 5px;
+ }
}
.embedded-item.visualization {
- background-color:#BBBBBB
+ background-color: #BBBBBB;
+ .item-content {
+ overflow: hidden;
+ height: 100%;
+ iframe {
+ min-height: 320px;
+ //TODO: hack to fix small gap after iframe
+ margin-bottom: -4px;
+ }
+ }
}
-
-.embedded-item.visualization p {
- background:#BBBBBB no-repeat 2px 2px;
- margin-top:0;
- margin-bottom:0;
-}
-
-.embedded-item.placeholder{}
-
-.embedded-item .expanded-content {
- display: none;
- background-color: white;
- padding: 5px;
-}
-
-.embedded-item .item-content {
- max-height: 25em;
- overflow: auto;
-}
-
-.embedded-item.visualization .item-content {
- overflow: hidden;
-}
-
-.embedded-item > .title {
- vertical-align: top;
- text-align: center;
- font-weight: bold;
- padding-bottom: 5px;
-}
-
-.embedded-item.placeholder .content {
- padding: 0.5em 0.5em;
- font-style: italic;
- text-align: center;
-}
-
-table.annotated-item {
- width: 100%;
- border-collapse: collapse;
-}
-
-table.annotated-item td,th {
- padding: 0;
-}
-
-table.annotated-item .annotation {
- padding-left: 2em;
- width: 40%;
-}
-
-table.annotated-item td.annotation {
- vertical-align: text-top;
- padding-top: 1em;
-}
diff -r f26c2543ff053b9ff31617bc03f99d505302ecda -r 31f05a12912be544f59a85239e584eeac15a4b98 templates/webapps/galaxy/history/embed.mako
--- a/templates/webapps/galaxy/history/embed.mako
+++ b/templates/webapps/galaxy/history/embed.mako
@@ -1,4 +1,3 @@
-##<%inherit file="/embed_base.mako"/><%namespace file="/display_common.mako" import="*" />
## Some duplication with embed_base here, needed a way to override the main embedded-item html for histories
diff -r f26c2543ff053b9ff31617bc03f99d505302ecda -r 31f05a12912be544f59a85239e584eeac15a4b98 templates/webapps/galaxy/page/display.mako
--- a/templates/webapps/galaxy/page/display.mako
+++ b/templates/webapps/galaxy/page/display.mako
@@ -10,7 +10,8 @@
// (b) ...
$('.embedded-item').each( function() {
var container = $(this);
- if( container.hasClass( 'history' ) ){ return; }
+ if( container.hasClass( 'history' )
+ || container.hasClass( 'visualization' ) ){ return; }
// Show embedded item.
var show_embedded_item = function() {
@@ -119,10 +120,6 @@
.embedded-item.history .toggle {
display: inline;
}
- .embedded-item.history .expanded-content {
- /* generates a fake wide border */
- padding: 4px;
- }
/** wraps around the history */
.embedded-item.history .item-content {
background-color: white;
@@ -138,6 +135,11 @@
.annotated-history-panel .history-controls {
margin: 0px 0px 16px 0px;
}
+
+ /* ---------------------------- visualizations */
+ .embedded-item.visualization .item-content {
+ max-height: none;
+ }
</style></%def>
diff -r f26c2543ff053b9ff31617bc03f99d505302ecda -r 31f05a12912be544f59a85239e584eeac15a4b98 templates/webapps/galaxy/visualization/embed_in_frame.mako
--- /dev/null
+++ b/templates/webapps/galaxy/visualization/embed_in_frame.mako
@@ -0,0 +1,78 @@
+<%namespace file="/display_common.mako" import="*" />
+
+<%
+ import_href = h.url_for( controller='visualization', action='imp', id=encoded_visualization_id )
+ display_href = h.url_for( controller='visualization', action='display_by_username_and_slug',
+ username=item.user.username, slug=item.slug )
+%>
+<div id="visualization-${encoded_visualization_id}" class='embedded-item display visualization'>
+ <div class='title'>
+ <div style="float: left">
+ <a class="expand-content-btn icon-button toggle-expand" href="${display_href}"
+ title="Show or hide visualization"></a>
+ </div>
+ <div style="float: right;">
+ <a title="Import" class="icon-button import" href="${import_href}"></a>
+ <a title="View" class="icon-button go-to-full-screen" href="${display_href}"></a>
+ </div>
+ <h4>
+ <a class="toggle-embed" href="${display_href}" title="Show or hide visualization">
+ Galaxy Visualization | ${get_item_name( item )}
+ </a>
+ </h4>
+ %if hasattr( item, "annotation") and item.annotation:
+ <div class="annotation">${item.annotation}</div>
+ %endif
+ </div>
+ ##<div class='summary-content'>
+ ## currently, no summary content for visualization
+ ## could do the title or caption, whatever...
+ ##</div>
+ <div class='expanded-content'>
+ <div class='item-content'>
+ </div>
+ </div>
+</div>
+
+<script type="text/javascript">
+// Embedding the same visualization more than once will confuse DOM ids.
+// In order to handle this, find this script and cache the previous node (the div above).
+// (Since we need thisScript to be locally scoped or it will get overwritten, enclose in self-calling function)
+(function(){
+ var scripts = document.getElementsByTagName( 'script' ),
+ // this is executed immediately, so the last script will be this script
+ thisScript = scripts[ scripts.length - 1 ],
+ $embeddedObj = $( thisScript ).prev();
+
+ /** check for an existing iframe for this visualization, adding one to the item-content if needed */
+ function addVisualizationIFrame(){
+ var $embeddedObj = $( thisScript ).prev(),
+ $itemContent = $embeddedObj.find( '.expanded-content .item-content' ),
+ $iframe = $itemContent.find( 'iframe' );
+ if( $iframe.size() ){ return $iframe; }
+ return $itemContent.html([
+ '<iframe frameborder="0" width="100%" height="100%" ',
+ 'sandbox="allow-forms allow-same-origin allow-scripts" ',
+ 'src="/visualization/saved?id=${encoded_visualization_id}&embedded=True">',
+ '</iframe>'
+ ].join('')).find( 'iframe' );
+ }
+
+ /** 4 elements change when expanding - toggle them all, add the iframe and prevent the url change */
+ function toggleExpanded( ev ){
+ var $embeddedObj = $( thisScript ).prev();
+ $embeddedObj.find( '.expand-content-btn' ).toggleClass( 'toggle-expand' ).toggleClass( 'toggle' );
+ $embeddedObj.find( ".summary-content" ).slideToggle( "fast" );
+ $embeddedObj.find( ".annotation" ).slideToggle( "fast" );
+ $embeddedObj.find( ".expanded-content" ).slideToggle( "fast" );
+ addVisualizationIFrame();
+ ev.preventDefault();
+ }
+
+ // add expansion to +/- btn and title
+ $(function(){
+ $embeddedObj.find( '.expand-content-btn' ).click( toggleExpanded );
+ $embeddedObj.find( '.toggle-embed' ).click( toggleExpanded );
+ });
+})();
+</script>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: ToolForm: Trigger change event manually
by commits-noreply@bitbucket.org 12 Nov '14
by commits-noreply@bitbucket.org 12 Nov '14
12 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/f26c2543ff05/
Changeset: f26c2543ff05
User: guerler
Date: 2014-11-12 16:30:59+00:00
Summary: ToolForm: Trigger change event manually
Affected #: 3 files
diff -r d7450b2567fb56f93ccc0191a7059ebb46b23cc5 -r f26c2543ff053b9ff31617bc03f99d505302ecda client/galaxy/scripts/mvc/tools/tools-form.js
--- a/client/galaxy/scripts/mvc/tools/tools-form.js
+++ b/client/galaxy/scripts/mvc/tools/tools-form.js
@@ -239,6 +239,7 @@
}
}
field.update(new_options);
+ field.trigger('change');
console.debug('Updating options for ' + input_id);
}
}
diff -r d7450b2567fb56f93ccc0191a7059ebb46b23cc5 -r f26c2543ff053b9ff31617bc03f99d505302ecda static/scripts/mvc/tools/tools-form.js
--- a/static/scripts/mvc/tools/tools-form.js
+++ b/static/scripts/mvc/tools/tools-form.js
@@ -239,6 +239,7 @@
}
}
field.update(new_options);
+ field.trigger('change');
console.debug('Updating options for ' + input_id);
}
}
diff -r d7450b2567fb56f93ccc0191a7059ebb46b23cc5 -r f26c2543ff053b9ff31617bc03f99d505302ecda static/scripts/packed/mvc/tools/tools-form.js
--- a/static/scripts/packed/mvc/tools/tools-form.js
+++ b/static/scripts/packed/mvc/tools/tools-form.js
@@ -1,1 +1,1 @@
-define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);this._buildForm(o)},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id,src:"hda"}).dataset_id}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];switch(p.type){case"data":t=p.options;break;default:for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
+define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);this._buildForm(o)},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id,src:"hda"}).dataset_id}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];switch(p.type){case"data":t=p.options;break;default:for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);v.trigger("change");console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: ToolForm: Show/hide single dataset selection field
by commits-noreply@bitbucket.org 12 Nov '14
by commits-noreply@bitbucket.org 12 Nov '14
12 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d7450b2567fb/
Changeset: d7450b2567fb
User: guerler
Date: 2014-11-12 08:13:37+00:00
Summary: ToolForm: Show/hide single dataset selection field
Affected #: 3 files
diff -r 4231a77fe8946110b2c56efd436000b864b06a84 -r d7450b2567fb56f93ccc0191a7059ebb46b23cc5 client/galaxy/scripts/mvc/tools/tools-select-content.js
--- a/client/galaxy/scripts/mvc/tools/tools-select-content.js
+++ b/client/galaxy/scripts/mvc/tools/tools-select-content.js
@@ -14,15 +14,62 @@
// add element
this.setElement('<div/>');
- // current selection
- this.current = 'single';
+ // list of select fields
+ this.list = {};
+
+ // radio button options
+ var radio_buttons = [];
+
+ // set initial state
+ if (!options.multiple) {
+ this.current = 'single';
+ } else {
+ this.current = 'multiple';
+ }
+
+ // add single dataset selector
+ if (!options.multiple) {
+ radio_buttons.push({icon: 'fa-file-o', label : 'Single dataset', value : 'single'});
+ this.select_single = new Ui.Select.View({
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+ this.list['single'] = {
+ field: this.select_single,
+ type : 'hda'
+ };
+ }
+
+ // add multiple dataset selector
+ radio_buttons.push({icon: 'fa-files-o', label : 'Multiple datasets', value : 'multiple' });
+ this.select_multiple = new Ui.Select.View({
+ multiple : true,
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+ this.list['multiple'] = {
+ field: this.select_multiple,
+ type : 'hda'
+ };
+
+ // add collection selector
+ radio_buttons.push({icon: 'fa-folder-o', label : 'List of datasets', value : 'collection' });
+ this.select_collection = new Ui.Select.View({
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+ this.list['collection'] = {
+ field: this.select_collection,
+ type : 'hdca'
+ };
// create button
this.button_type = new Ui.RadioButton.View({
value : this.current,
- data : [ { icon: 'fa-file-o', label : 'Single dataset', value : 'single' },
- { icon: 'fa-files-o', label : 'Multiple datasets', value : 'multiple' },
- { icon: 'fa-folder-o', label : 'List of datasets', value : 'collection' }],
+ data : radio_buttons,
onchange: function(value) {
self.current = value;
self.refresh();
@@ -30,44 +77,6 @@
}
});
- // single dataset select field
- this.select_single = new Ui.Select.View({
- onchange : function() {
- self.trigger('change');
- }
- });
-
- // multiple datasets select field
- this.select_multiple = new Ui.Select.View({
- multiple : true,
- onchange : function() {
- self.trigger('change');
- }
- });
-
- // collection select field
- this.select_collection = new Ui.Select.View({
- onchange : function() {
- self.trigger('change');
- }
- });
-
- // list of all select fields
- this.list = {
- 'single' : {
- field: this.select_single,
- type : 'hda'
- },
- 'multiple' : {
- field: this.select_multiple,
- type : 'hda'
- },
- 'collection' : {
- field: this.select_collection,
- type : 'hdca'
- }
- };
-
// add batch mode information
this.$batch = $(ToolTemplate.batchMode());
@@ -129,7 +138,7 @@
}
// update selection fields
- this.select_single.update(dataset_options);
+ this.select_single && this.select_single.update(dataset_options);
this.select_multiple.update(dataset_options);
this.select_collection.update(collection_options);
@@ -153,7 +162,7 @@
this.current = 'collection';
this.select_collection.value(list[0]);
} else {
- if (list.length > 1) {
+ if (list.length > 1 || this.options.multiple) {
this.current = 'multiple';
this.select_multiple.value(list);
} else {
diff -r 4231a77fe8946110b2c56efd436000b864b06a84 -r d7450b2567fb56f93ccc0191a7059ebb46b23cc5 static/scripts/mvc/tools/tools-select-content.js
--- a/static/scripts/mvc/tools/tools-select-content.js
+++ b/static/scripts/mvc/tools/tools-select-content.js
@@ -14,15 +14,62 @@
// add element
this.setElement('<div/>');
- // current selection
- this.current = 'single';
+ // list of select fields
+ this.list = {};
+
+ // radio button options
+ var radio_buttons = [];
+
+ // set initial state
+ if (!options.multiple) {
+ this.current = 'single';
+ } else {
+ this.current = 'multiple';
+ }
+
+ // add single dataset selector
+ if (!options.multiple) {
+ radio_buttons.push({icon: 'fa-file-o', label : 'Single dataset', value : 'single'});
+ this.select_single = new Ui.Select.View({
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+ this.list['single'] = {
+ field: this.select_single,
+ type : 'hda'
+ };
+ }
+
+ // add multiple dataset selector
+ radio_buttons.push({icon: 'fa-files-o', label : 'Multiple datasets', value : 'multiple' });
+ this.select_multiple = new Ui.Select.View({
+ multiple : true,
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+ this.list['multiple'] = {
+ field: this.select_multiple,
+ type : 'hda'
+ };
+
+ // add collection selector
+ radio_buttons.push({icon: 'fa-folder-o', label : 'List of datasets', value : 'collection' });
+ this.select_collection = new Ui.Select.View({
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+ this.list['collection'] = {
+ field: this.select_collection,
+ type : 'hdca'
+ };
// create button
this.button_type = new Ui.RadioButton.View({
value : this.current,
- data : [ { icon: 'fa-file-o', label : 'Single dataset', value : 'single' },
- { icon: 'fa-files-o', label : 'Multiple datasets', value : 'multiple' },
- { icon: 'fa-folder-o', label : 'List of datasets', value : 'collection' }],
+ data : radio_buttons,
onchange: function(value) {
self.current = value;
self.refresh();
@@ -30,44 +77,6 @@
}
});
- // single dataset select field
- this.select_single = new Ui.Select.View({
- onchange : function() {
- self.trigger('change');
- }
- });
-
- // multiple datasets select field
- this.select_multiple = new Ui.Select.View({
- multiple : true,
- onchange : function() {
- self.trigger('change');
- }
- });
-
- // collection select field
- this.select_collection = new Ui.Select.View({
- onchange : function() {
- self.trigger('change');
- }
- });
-
- // list of all select fields
- this.list = {
- 'single' : {
- field: this.select_single,
- type : 'hda'
- },
- 'multiple' : {
- field: this.select_multiple,
- type : 'hda'
- },
- 'collection' : {
- field: this.select_collection,
- type : 'hdca'
- }
- };
-
// add batch mode information
this.$batch = $(ToolTemplate.batchMode());
@@ -129,7 +138,7 @@
}
// update selection fields
- this.select_single.update(dataset_options);
+ this.select_single && this.select_single.update(dataset_options);
this.select_multiple.update(dataset_options);
this.select_collection.update(collection_options);
@@ -153,7 +162,7 @@
this.current = 'collection';
this.select_collection.value(list[0]);
} else {
- if (list.length > 1) {
+ if (list.length > 1 || this.options.multiple) {
this.current = 'multiple';
this.select_multiple.value(list);
} else {
diff -r 4231a77fe8946110b2c56efd436000b864b06a84 -r d7450b2567fb56f93ccc0191a7059ebb46b23cc5 static/scripts/packed/mvc/tools/tools-select-content.js
--- a/static/scripts/packed/mvc/tools/tools-select-content.js
+++ b/static/scripts/packed/mvc/tools/tools-select-content.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-tabs","mvc/tools/tools-template"],function(c,e,b,a){var d=Backbone.View.extend({initialize:function(j,g){this.app=j;this.options=g;var f=this;this.setElement("<div/>");this.current="single";this.button_type=new e.RadioButton.View({value:this.current,data:[{icon:"fa-file-o",label:"Single dataset",value:"single"},{icon:"fa-files-o",label:"Multiple datasets",value:"multiple"},{icon:"fa-folder-o",label:"List of datasets",value:"collection"}],onchange:function(i){f.current=i;f.refresh();f.trigger("change")}});this.select_single=new e.Select.View({onchange:function(){f.trigger("change")}});this.select_multiple=new e.Select.View({multiple:true,onchange:function(){f.trigger("change")}});this.select_collection=new e.Select.View({onchange:function(){f.trigger("change")}});this.list={single:{field:this.select_single,type:"hda"},multiple:{field:this.select_multiple,type:"hda"},collection:{field:this.select_collection,type:"hdca"}};this.$batch=$(a.batchMode());this.$el.append(c.wrap(this.button_type.$el));for(var h in this.list){this.$el.append(this.list[h].field.$el)}this.$el.append(this.$batch);this.update(g.data);this.refresh();this.on("change",function(){if(g.onchange){g.onchange(f.value())}})},wait:function(){for(var f in this.list){this.list[f].field.wait()}},unwait:function(){for(var f in this.list){this.list[f].field.unwait()}},update:function(g){var l=[];for(var j in g.hda){var k=g.hda[j];l.push({label:k.hid+": "+k.name,value:k.id})}var f=[];for(var j in g.hdca){var h=g.hdca[j];f.push({label:h.hid+": "+h.name,value:h.id})}this.select_single.update(l);this.select_multiple.update(l);this.select_collection.update(f);this.app.content.add(g)},value:function(m){if(m!==undefined){try{var l=[];for(var h in m.values){l.push(m.values[h].id)}if(m&&m.values.length>0&&m.values[0].src=="hcda"){this.current="collection";this.select_collection.value(l[0])}else{if(l.length>1){this.current="multiple";this.select_multiple.value(l)}else{this.current="single";this.select_single.value(l[0])}}this.refresh();var g=this._select();if(!g.validate()){g.value(g.first())}}catch(k){console.debug("tools-select-content::value() - Skipped.")}}var j=this._select().value();if(!(j instanceof Array)){j=[j]}var f={batch:!this.options.multiple,values:[]};for(var h in j){f.values.push({id:j[h],src:this.list[this.current].type})}return f},validate:function(){return this._select().validate()},refresh:function(){for(var g in this.list){var f=this.list[g].field.$el;if(this.current==g){f.show()}else{f.hide()}}if(this.current!="single"&&!this.options.multiple){this.$batch.show()}else{this.$batch.hide()}},_select:function(){return this.list[this.current].field}});return{View:d}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-tabs","mvc/tools/tools-template"],function(c,e,b,a){var d=Backbone.View.extend({initialize:function(k,g){this.app=k;this.options=g;var f=this;this.setElement("<div/>");this.list={};var j=[];if(!g.multiple){this.current="single"}else{this.current="multiple"}if(!g.multiple){j.push({icon:"fa-file-o",label:"Single dataset",value:"single"});this.select_single=new e.Select.View({onchange:function(){f.trigger("change")}});this.list.single={field:this.select_single,type:"hda"}}j.push({icon:"fa-files-o",label:"Multiple datasets",value:"multiple"});this.select_multiple=new e.Select.View({multiple:true,onchange:function(){f.trigger("change")}});this.list.multiple={field:this.select_multiple,type:"hda"};j.push({icon:"fa-folder-o",label:"List of datasets",value:"collection"});this.select_collection=new e.Select.View({onchange:function(){f.trigger("change")}});this.list.collection={field:this.select_collection,type:"hdca"};this.button_type=new e.RadioButton.View({value:this.current,data:j,onchange:function(i){f.current=i;f.refresh();f.trigger("change")}});this.$batch=$(a.batchMode());this.$el.append(c.wrap(this.button_type.$el));for(var h in this.list){this.$el.append(this.list[h].field.$el)}this.$el.append(this.$batch);this.update(g.data);this.refresh();this.on("change",function(){if(g.onchange){g.onchange(f.value())}})},wait:function(){for(var f in this.list){this.list[f].field.wait()}},unwait:function(){for(var f in this.list){this.list[f].field.unwait()}},update:function(g){var l=[];for(var j in g.hda){var k=g.hda[j];l.push({label:k.hid+": "+k.name,value:k.id})}var f=[];for(var j in g.hdca){var h=g.hdca[j];f.push({label:h.hid+": "+h.name,value:h.id})}this.select_single&&this.select_single.update(l);this.select_multiple.update(l);this.select_collection.update(f);this.app.content.add(g)},value:function(m){if(m!==undefined){try{var l=[];for(var h in m.values){l.push(m.values[h].id)}if(m&&m.values.length>0&&m.values[0].src=="hcda"){this.current="collection";this.select_collection.value(l[0])}else{if(l.length>1||this.options.multiple){this.current="multiple";this.select_multiple.value(l)}else{this.current="single";this.select_single.value(l[0])}}this.refresh();var g=this._select();if(!g.validate()){g.value(g.first())}}catch(k){console.debug("tools-select-content::value() - Skipped.")}}var j=this._select().value();if(!(j instanceof Array)){j=[j]}var f={batch:!this.options.multiple,values:[]};for(var h in j){f.values.push({id:j[h],src:this.list[this.current].type})}return f},validate:function(){return this._select().validate()},refresh:function(){for(var g in this.list){var f=this.list[g].field.$el;if(this.current==g){f.show()}else{f.hide()}}if(this.current!="single"&&!this.options.multiple){this.$batch.show()}else{this.$batch.hide()}},_select:function(){return this.list[this.current].field}});return{View:d}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: guerler: ToolForm: Match and sort datasets and collections through API, add single selection as default option
by commits-noreply@bitbucket.org 12 Nov '14
by commits-noreply@bitbucket.org 12 Nov '14
12 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/4231a77fe894/
Changeset: 4231a77fe894
User: guerler
Date: 2014-11-12 02:46:38+00:00
Summary: ToolForm: Match and sort datasets and collections through API, add single selection as default option
Affected #: 21 files
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 client/galaxy/scripts/mvc/tools/tools-content.js
--- a/client/galaxy/scripts/mvc/tools/tools-content.js
+++ b/client/galaxy/scripts/mvc/tools/tools-content.js
@@ -1,96 +1,23 @@
define(['utils/utils'], function(Utils){
return Backbone.Model.extend({
// initialize
- initialize: function(options) {
- // backup basic url
- this.base_url = galaxy_config.root + 'api/histories/' + options.history_id + '/contents';
-
- // prepare content obects
- this.datatypes = {};
+ initialize: function(app) {
this.summary = {};
-
- // link this
- var self = this;
-
- // request datatypes
- Utils.get({
- url : galaxy_config.root + 'api/datatypes/mapping',
- cache : true,
- success : function(response) {
- // backup datatype dictionary
- self.datatypes = response;
-
- // get history summary
- Utils.get({
- url : self.base_url + '?deleted=false',
- success : function(response) {
- // backup summary
- self.summary = response;
-
- // sort by id
- self.summary.sort(function(a, b) {
- return a.hid > b.hid ? -1 : (a.hid < b.hid ? 1 : 0);
- });
-
- // log
- console.debug('tools-content::initialize() - Completed.');
-
- // callback
- options.success && options.success();
- },
- error : function(response) {
- // log request failure
- console.debug('tools-content::initialize() - Ajax request for summary failed.');
- console.debug(response);
- }
- });
- },
- error : function(response) {
- // log request failure
- console.debug('tools-content::initialize() - Ajax request for datatypes failed.');
- console.debug(response);
- }
- });
},
- /**
- * Filters contents by data type.
+ /** Add new content elements
*/
- filterType: function(options) {
- // initialize parameters
- options = options || {};
- var result = [];
-
- // identify content type
- var history_content_type = 'dataset';
- if (options.src== 'hdca') {
- history_content_type = 'dataset_collection';
+ add: function(content_list) {
+ // add/update content in summary list
+ for (var i in content_list) {
+ for (var j in content_list[i]) {
+ var c = content_list[i][j];
+ this.summary[c.id + '_' + c.src] = c;
+ }
}
- // search in summary
- for (var i in this.summary) {
- var content = this.summary[i];
-
- // check ok state (TODO: should be implemented in the api)
- if (content.history_content_type === 'dataset' && content.state !== 'ok') {
- continue;
- }
-
- // match datatypes
- var found = false;
- for (var i in options.extensions) {
- if (this._matchType(options.extensions[i], content.extension)) {
- found = true;
- break;
- }
- }
-
- // final match result
- if ((content.history_content_type === history_content_type) && (found || !options.extensions)) {
- result.push(content);
- }
- }
- return result;
+ // log
+ console.debug('tools-content::initialize() - Completed.');
},
/** Returns matched content from summary.
@@ -126,33 +53,6 @@
console.debug(response);
}
});
- },
-
- /** Check if datatypes match
- */
- _matchType: function(target, reference) {
- // check if target class is available
- var target_class = this.datatypes.ext_to_class_name[target];
- if (!target_class) {
- console.debug('tools-content::_matchType() - Specific target class unavailable. Accepting all formats.');
- return true;
- }
-
- // check if reference class is available
- var reference_class = this.datatypes.ext_to_class_name[reference];
- if (!reference_class) {
- console.debug('tools-content::_matchType() - Specific reference class unavailable. Accepting all formats.');
- return true;
- }
-
- // check reference group
- var reference_group = this.datatypes.class_to_classes[reference_class];
- if (reference_group[target_class]) {
- return true;
- }
-
- // classes do not match
- return false;
}
});
});
\ No newline at end of file
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 client/galaxy/scripts/mvc/tools/tools-form.js
--- a/client/galaxy/scripts/mvc/tools/tools-form.js
+++ b/client/galaxy/scripts/mvc/tools/tools-form.js
@@ -21,11 +21,19 @@
var self = this;
// link galaxy modal or create one
- if (parent.Galaxy && parent.Galaxy.modal) {
- this.modal = parent.Galaxy.modal;
+ var galaxy = parent.Galaxy;
+ if (galaxy && galaxy.modal) {
+ this.modal = galaxy.modal;
} else {
this.modal = new Ui.Modal.View();
}
+
+ // check if the user is an admin
+ if (galaxy && galaxy.currUser) {
+ this.is_admin = galaxy.currUser.get('is_admin')
+ } else {
+ this.is_admin = false;
+ }
// link options
this.options = options;
@@ -47,12 +55,10 @@
this.job_handler = new ToolJobs(this);
// request history content and build form
- this.content = new ToolContent({
- history_id : self.options.history_id,
- success : function() {
- self._buildForm(self.options);
- }
- });
+ this.content = new ToolContent(this);
+
+ // build this form
+ this._buildForm(options);
},
// message
@@ -72,7 +78,7 @@
// this happens i.e. when repeat blocks are added or removed and on initialization
rebuild: function() {
this.tree.refresh();
- console.debug('tools-form::refresh() - Refreshed form structure.');
+ console.debug('tools-form::rebuild() - Rebuilding data structures.');
},
// refreshes input states i.e. for dynamic parameters
@@ -142,7 +148,7 @@
var current_state = this.tree.finalize({
data : function(dict) {
if (dict.values.length > 0 && dict.values[0] && dict.values[0].src === 'hda') {
- return self.content.get({id: dict.values[0].id}).dataset_id;
+ return self.content.get({id: dict.values[0].id, src: 'hda'}).dataset_id;
}
return null;
}
@@ -215,16 +221,22 @@
// get/update field
var field = self.field_list[input_id];
- if (field.update && input.type != 'data') {
+ if (field.update) {
var new_options = [];
- for (var i in node.options) {
- var opt = node.options[i];
- if (opt.length > 2) {
- new_options.push({
- 'label': opt[0],
- 'value': opt[1]
- });
- }
+ switch (input.type) {
+ case 'data':
+ new_options = input.options;
+ break;
+ default:
+ for (var i in node.options) {
+ var opt = node.options[i];
+ if (opt.length > 2) {
+ new_options.push({
+ 'label': opt[0],
+ 'value': opt[1]
+ });
+ }
+ }
}
field.update(new_options);
console.debug('Updating options for ' + input_id);
@@ -292,7 +304,7 @@
});
// add admin operations
- if (Galaxy.currUser.get('is_admin')) {
+ if (this.is_admin) {
// create download button
menu.addMenu({
icon : 'fa-download',
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 client/galaxy/scripts/mvc/tools/tools-jobs.js
--- a/client/galaxy/scripts/mvc/tools/tools-jobs.js
+++ b/client/galaxy/scripts/mvc/tools/tools-jobs.js
@@ -142,8 +142,8 @@
if (batch_n === -1) {
batch_n = n;
} else {
- if (batch_n !== n && n != 1) {
- this._foundError(input_id, 'Please make sure that you select a single input or the same number of inputs for all batch mode fields. This field contains <b>' + n + '</b> selection(s) while a previous field contains <b>' + batch_n + '</b>.');
+ if (batch_n !== n) {
+ this._foundError(input_id, 'Please make sure that you select the same number of inputs for all batch mode fields. This field contains <b>' + n + '</b> selection(s) while a previous field contains <b>' + batch_n + '</b>.');
return false;
}
}
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 client/galaxy/scripts/mvc/tools/tools-section.js
--- a/client/galaxy/scripts/mvc/tools/tools-section.js
+++ b/client/galaxy/scripts/mvc/tools/tools-section.js
@@ -372,6 +372,7 @@
id : 'field-' + input_def.id,
extensions : input_def.extensions,
multiple : input_def.multiple,
+ data : input_def.options,
onchange : function() {
self.app.refresh();
}
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 client/galaxy/scripts/mvc/tools/tools-select-content.js
--- a/client/galaxy/scripts/mvc/tools/tools-select-content.js
+++ b/client/galaxy/scripts/mvc/tools/tools-select-content.js
@@ -4,7 +4,8 @@
var View = Backbone.View.extend({
// initialize
initialize : function(app, options) {
- // configure options
+ // link app and options
+ this.app = app;
this.options = options;
// link this
@@ -14,13 +15,14 @@
this.setElement('<div/>');
// current selection
- this.current = 'hda';
+ this.current = 'single';
// create button
- this.button_new = new Ui.RadioButton.View({
+ this.button_type = new Ui.RadioButton.View({
value : this.current,
- data : [ { icon: 'fa-file-o', label : 'Select datasets', value : 'hda' },
- { icon: 'fa-files-o', label : 'Select a collection', value : 'hdca' }],
+ data : [ { icon: 'fa-file-o', label : 'Single dataset', value : 'single' },
+ { icon: 'fa-files-o', label : 'Multiple datasets', value : 'multiple' },
+ { icon: 'fa-folder-o', label : 'List of datasets', value : 'collection' }],
onchange: function(value) {
self.current = value;
self.refresh();
@@ -28,68 +30,56 @@
}
});
- //
- // datasets
- //
- var datasets = app.content.filterType({
- src : 'hda',
- extensions : options.extensions
- });
-
- // configure options fields
- var dataset_options = [];
- for (var i in datasets) {
- dataset_options.push({
- label: datasets[i].hid + ': ' + datasets[i].name,
- value: datasets[i].id
- });
- }
-
- // select field
- this.select_datasets = new Ui.Select.View({
- multiple : true,
- data : dataset_options,
- value : dataset_options[0] && dataset_options[0].value,
+ // single dataset select field
+ this.select_single = new Ui.Select.View({
onchange : function() {
self.trigger('change');
}
});
- //
- // collections
- //
- var collections = app.content.filterType({
- src : 'hdca',
- extensions : options.extensions
- });
-
- // configure options fields
- var collection_options = [];
- for (var i in collections) {
- collection_options.push({
- label: collections[i].hid + ': ' + collections[i].name,
- value: collections[i].id
- });
- }
-
- // create select field for collections
- this.select_collection = new Ui.Select.View({
- data : collection_options,
- value : collection_options[0] && collection_options[0].value,
+ // multiple datasets select field
+ this.select_multiple = new Ui.Select.View({
+ multiple : true,
onchange : function() {
self.trigger('change');
}
});
+ // collection select field
+ this.select_collection = new Ui.Select.View({
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+
+ // list of all select fields
+ this.list = {
+ 'single' : {
+ field: this.select_single,
+ type : 'hda'
+ },
+ 'multiple' : {
+ field: this.select_multiple,
+ type : 'hda'
+ },
+ 'collection' : {
+ field: this.select_collection,
+ type : 'hdca'
+ }
+ };
+
+ // add batch mode information
+ this.$batch = $(ToolTemplate.batchMode());
+
// add elements to dom
- this.$el.append(Utils.wrap(this.button_new.$el));
- this.$el.append(this.select_datasets.$el);
- this.$el.append(this.select_collection.$el);
+ this.$el.append(Utils.wrap(this.button_type.$el));
+ for (var i in this.list) {
+ this.$el.append(this.list[i].field.$el);
+ }
+ this.$el.append(this.$batch);
- // check for batch mode
- if (!this.options.multiple) {
- this.$el.append(ToolTemplate.batchMode());
- }
+ // update options
+ this.update(options.data);
// refresh view
this.refresh();
@@ -102,31 +92,77 @@
});
},
+ /** Indicate that select fields are being updated */
+ wait: function() {
+ for (var i in this.list) {
+ this.list[i].field.wait();
+ }
+ },
+
+ /** Indicate that the options update has been completed */
+ unwait: function() {
+ for (var i in this.list) {
+ this.list[i].field.unwait();
+ }
+ },
+
+ /** Update content selector */
+ update: function(options) {
+ // identify dataset options
+ var dataset_options = [];
+ for (var i in options.hda) {
+ var hda = options.hda[i];
+ dataset_options.push({
+ label: hda.hid + ': ' + hda.name,
+ value: hda.id
+ });
+ }
+
+ // identify collection options
+ var collection_options = [];
+ for (var i in options.hdca) {
+ var hdca = options.hdca[i];
+ collection_options.push({
+ label: hdca.hid + ': ' + hdca.name,
+ value: hdca.id
+ });
+ }
+
+ // update selection fields
+ this.select_single.update(dataset_options);
+ this.select_multiple.update(dataset_options);
+ this.select_collection.update(collection_options);
+
+ // add to content list
+ this.app.content.add(options);
+ },
+
/** Return the currently selected dataset values */
value : function (dict) {
// update current value
if (dict !== undefined) {
try {
- // set source
- this.current = dict.values[0].src;
- this.refresh();
-
// create list
var list = [];
for (var i in dict.values) {
list.push(dict.values[i].id);
}
- // identify select element
- switch(this.current) {
- case 'hda':
- this.select_datasets.value(list);
- break;
- case 'hdca':
- this.select_collection.value(list[0]);
- break;
+ // identify suitable select field
+ if (dict && dict.values.length > 0 && dict.values[0].src == 'hcda') {
+ this.current = 'collection';
+ this.select_collection.value(list[0]);
+ } else {
+ if (list.length > 1) {
+ this.current = 'multiple';
+ this.select_multiple.value(list);
+ } else {
+ this.current = 'single';
+ this.select_single.value(list[0]);
+ }
}
-
+ this.refresh();
+
// check if value has been set
var select = this._select();
if (!select.validate()) {
@@ -153,7 +189,7 @@
for (var i in id_list) {
result.values.push({
id : id_list[i],
- src : this.current
+ src : this.list[this.current].type
});
}
@@ -169,26 +205,24 @@
/** Refreshes data selection view */
refresh: function() {
- switch (this.current) {
- case 'hda':
- this.select_datasets.$el.fadeIn();
- this.select_collection.$el.hide();
- break;
- case 'hdca':
- this.select_datasets.$el.hide();
- this.select_collection.$el.fadeIn();
- break;
+ for (var i in this.list) {
+ var $el = this.list[i].field.$el;
+ if (this.current == i) {
+ $el.show();
+ } else {
+ $el.hide();
+ }
+ }
+ if (this.current != 'single' && !this.options.multiple) {
+ this.$batch.show();
+ } else {
+ this.$batch.hide();
}
},
/** Assists in selecting the current field */
_select: function() {
- switch(this.current) {
- case 'hdca':
- return this.select_collection;
- default:
- return this.select_datasets;
- }
+ return this.list[this.current].field;
}
});
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 client/galaxy/scripts/mvc/tools/tools-template.js
--- a/client/galaxy/scripts/mvc/tools/tools-template.js
+++ b/client/galaxy/scripts/mvc/tools/tools-template.js
@@ -56,7 +56,7 @@
batchMode: function() {
return '<div class="ui-table-form-info">' +
'<i class="fa fa-sitemap" style="font-size: 1.2em; padding: 2px 5px;"/>' +
- 'This is a batch mode input field. A separate job will be triggered for each dataset.'
+ 'This is a batch mode input field. A separate job will be triggered for each dataset.' +
'</div>';
}
};
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -2067,22 +2067,49 @@
return ref
def to_dict( self, trans, view='collection', value_mapper=None, other_values=None ):
+ # create dictionary and fill default parameters
d = super( DataToolParameter, self ).to_dict( trans )
d['extensions'] = self.extensions
d['multiple'] = self.multiple
+ d['is_dynamic'] = True
+ d['options'] = {'hda': [], 'hdca': []}
+
+ # return default content if context is not available
if other_values is None:
- # No need to produce lists of datasets for history.
return d
+ # prepare dataset/collection matching
dataset_matcher = DatasetMatcher( trans, self, None, other_values )
history = trans.history
multiple = self.multiple
- for hda_match, hid in self.match_datasets( history, dataset_matcher ):
- # hda_match not an hda - it is a description of the match, may
- # describe match after implicit conversion.
- pass
- for history_dataset_collection in self.match_collections( history, dataset_matcher, reduction=multiple ):
- pass
+
+ # add datasets
+ for hda in history.active_datasets_children_and_roles:
+ if dataset_matcher.hda_match( hda ):
+ d['options']['hda'].append({
+ 'id' : trans.security.encode_id( hda.id ),
+ 'hid' : hda.hid,
+ 'name' : hda.name,
+ 'src' : 'hda',
+ 'dataset_id' : hda.dataset_id
+ })
+
+ # add dataset collections
+ dataset_collection_matcher = DatasetCollectionMatcher( dataset_matcher )
+ for hdca in history.active_dataset_collections:
+ if dataset_collection_matcher.hdca_match( hdca, reduction=multiple ):
+ d['options']['hdca'].append({
+ 'id' : trans.security.encode_id( hdca.id ),
+ 'hid' : hdca.hid,
+ 'name' : hdca.name,
+ 'src' : 'hdca'
+ })
+
+ # sort both lists
+ d['options']['hda'] = sorted(d['options']['hda'], key=lambda k: k['hid'], reverse=True)
+ d['options']['hdca'] = sorted(d['options']['hdca'], key=lambda k: k['hid'], reverse=True)
+
+ # return final dictionary
return d
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 lib/galaxy/webapps/galaxy/api/history_contents.py
--- a/lib/galaxy/webapps/galaxy/api/history_contents.py
+++ b/lib/galaxy/webapps/galaxy/api/history_contents.py
@@ -131,12 +131,13 @@
"""
api_type = "file"
encoded_id = trans.security.encode_id( hda.id )
+ encoded_dataset_id = trans.security.encode_id( hda.dataset_id );
# TODO: handle failed_metadata here as well
return {
'id' : encoded_id,
'history_id' : encoded_history_id,
- 'dataset_id' : hda.dataset_id,
+ 'dataset_id' : encoded_dataset_id,
'name' : hda.name,
'type' : api_type,
'state' : hda.dataset.state,
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 lib/galaxy/webapps/galaxy/api/tools.py
--- a/lib/galaxy/webapps/galaxy/api/tools.py
+++ b/lib/galaxy/webapps/galaxy/api/tools.py
@@ -575,11 +575,13 @@
dict['value'] = value
return dict
- # populate state
+ # initialize state using default parameters
def initialize_state(trans, inputs, state, context=None):
context = ExpressionContext(state, context)
for input in inputs.itervalues():
state[input.name] = input.get_initial_value(trans, context)
+
+ # populates state with incoming url parameters
def populate_state(trans, inputs, state, incoming, prefix="", context=None ):
errors = dict()
context = ExpressionContext(state, context)
@@ -630,12 +632,14 @@
state[input.name] = value
return errors
- # build model
+ # builds tool model including all attributes
def iterate(group_inputs, inputs, tool_state, errors, other_values=None):
other_values = ExpressionContext( tool_state, other_values )
for input_index, input in enumerate( inputs.itervalues() ):
# create model dictionary
group_inputs[input_index] = input.to_dict(trans)
+ if group_inputs[input_index] is None:
+ continue
# identify stat for subsection/group
group_state = tool_state[input.name]
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/mvc/tools/tools-content.js
--- a/static/scripts/mvc/tools/tools-content.js
+++ b/static/scripts/mvc/tools/tools-content.js
@@ -1,96 +1,23 @@
define(['utils/utils'], function(Utils){
return Backbone.Model.extend({
// initialize
- initialize: function(options) {
- // backup basic url
- this.base_url = galaxy_config.root + 'api/histories/' + options.history_id + '/contents';
-
- // prepare content obects
- this.datatypes = {};
+ initialize: function(app) {
this.summary = {};
-
- // link this
- var self = this;
-
- // request datatypes
- Utils.get({
- url : galaxy_config.root + 'api/datatypes/mapping',
- cache : true,
- success : function(response) {
- // backup datatype dictionary
- self.datatypes = response;
-
- // get history summary
- Utils.get({
- url : self.base_url + '?deleted=false',
- success : function(response) {
- // backup summary
- self.summary = response;
-
- // sort by id
- self.summary.sort(function(a, b) {
- return a.hid > b.hid ? -1 : (a.hid < b.hid ? 1 : 0);
- });
-
- // log
- console.debug('tools-content::initialize() - Completed.');
-
- // callback
- options.success && options.success();
- },
- error : function(response) {
- // log request failure
- console.debug('tools-content::initialize() - Ajax request for summary failed.');
- console.debug(response);
- }
- });
- },
- error : function(response) {
- // log request failure
- console.debug('tools-content::initialize() - Ajax request for datatypes failed.');
- console.debug(response);
- }
- });
},
- /**
- * Filters contents by data type.
+ /** Add new content elements
*/
- filterType: function(options) {
- // initialize parameters
- options = options || {};
- var result = [];
-
- // identify content type
- var history_content_type = 'dataset';
- if (options.src== 'hdca') {
- history_content_type = 'dataset_collection';
+ add: function(content_list) {
+ // add/update content in summary list
+ for (var i in content_list) {
+ for (var j in content_list[i]) {
+ var c = content_list[i][j];
+ this.summary[c.id + '_' + c.src] = c;
+ }
}
- // search in summary
- for (var i in this.summary) {
- var content = this.summary[i];
-
- // check ok state (TODO: should be implemented in the api)
- if (content.history_content_type === 'dataset' && content.state !== 'ok') {
- continue;
- }
-
- // match datatypes
- var found = false;
- for (var i in options.extensions) {
- if (this._matchType(options.extensions[i], content.extension)) {
- found = true;
- break;
- }
- }
-
- // final match result
- if ((content.history_content_type === history_content_type) && (found || !options.extensions)) {
- result.push(content);
- }
- }
- return result;
+ // log
+ console.debug('tools-content::initialize() - Completed.');
},
/** Returns matched content from summary.
@@ -126,33 +53,6 @@
console.debug(response);
}
});
- },
-
- /** Check if datatypes match
- */
- _matchType: function(target, reference) {
- // check if target class is available
- var target_class = this.datatypes.ext_to_class_name[target];
- if (!target_class) {
- console.debug('tools-content::_matchType() - Specific target class unavailable. Accepting all formats.');
- return true;
- }
-
- // check if reference class is available
- var reference_class = this.datatypes.ext_to_class_name[reference];
- if (!reference_class) {
- console.debug('tools-content::_matchType() - Specific reference class unavailable. Accepting all formats.');
- return true;
- }
-
- // check reference group
- var reference_group = this.datatypes.class_to_classes[reference_class];
- if (reference_group[target_class]) {
- return true;
- }
-
- // classes do not match
- return false;
}
});
});
\ No newline at end of file
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/mvc/tools/tools-form.js
--- a/static/scripts/mvc/tools/tools-form.js
+++ b/static/scripts/mvc/tools/tools-form.js
@@ -21,11 +21,19 @@
var self = this;
// link galaxy modal or create one
- if (parent.Galaxy && parent.Galaxy.modal) {
- this.modal = parent.Galaxy.modal;
+ var galaxy = parent.Galaxy;
+ if (galaxy && galaxy.modal) {
+ this.modal = galaxy.modal;
} else {
this.modal = new Ui.Modal.View();
}
+
+ // check if the user is an admin
+ if (galaxy && galaxy.currUser) {
+ this.is_admin = galaxy.currUser.get('is_admin')
+ } else {
+ this.is_admin = false;
+ }
// link options
this.options = options;
@@ -47,12 +55,10 @@
this.job_handler = new ToolJobs(this);
// request history content and build form
- this.content = new ToolContent({
- history_id : self.options.history_id,
- success : function() {
- self._buildForm(self.options);
- }
- });
+ this.content = new ToolContent(this);
+
+ // build this form
+ this._buildForm(options);
},
// message
@@ -72,7 +78,7 @@
// this happens i.e. when repeat blocks are added or removed and on initialization
rebuild: function() {
this.tree.refresh();
- console.debug('tools-form::refresh() - Refreshed form structure.');
+ console.debug('tools-form::rebuild() - Rebuilding data structures.');
},
// refreshes input states i.e. for dynamic parameters
@@ -142,7 +148,7 @@
var current_state = this.tree.finalize({
data : function(dict) {
if (dict.values.length > 0 && dict.values[0] && dict.values[0].src === 'hda') {
- return self.content.get({id: dict.values[0].id}).dataset_id;
+ return self.content.get({id: dict.values[0].id, src: 'hda'}).dataset_id;
}
return null;
}
@@ -215,16 +221,22 @@
// get/update field
var field = self.field_list[input_id];
- if (field.update && input.type != 'data') {
+ if (field.update) {
var new_options = [];
- for (var i in node.options) {
- var opt = node.options[i];
- if (opt.length > 2) {
- new_options.push({
- 'label': opt[0],
- 'value': opt[1]
- });
- }
+ switch (input.type) {
+ case 'data':
+ new_options = input.options;
+ break;
+ default:
+ for (var i in node.options) {
+ var opt = node.options[i];
+ if (opt.length > 2) {
+ new_options.push({
+ 'label': opt[0],
+ 'value': opt[1]
+ });
+ }
+ }
}
field.update(new_options);
console.debug('Updating options for ' + input_id);
@@ -292,7 +304,7 @@
});
// add admin operations
- if (Galaxy.currUser.get('is_admin')) {
+ if (this.is_admin) {
// create download button
menu.addMenu({
icon : 'fa-download',
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/mvc/tools/tools-jobs.js
--- a/static/scripts/mvc/tools/tools-jobs.js
+++ b/static/scripts/mvc/tools/tools-jobs.js
@@ -142,8 +142,8 @@
if (batch_n === -1) {
batch_n = n;
} else {
- if (batch_n !== n && n != 1) {
- this._foundError(input_id, 'Please make sure that you select a single input or the same number of inputs for all batch mode fields. This field contains <b>' + n + '</b> selection(s) while a previous field contains <b>' + batch_n + '</b>.');
+ if (batch_n !== n) {
+ this._foundError(input_id, 'Please make sure that you select the same number of inputs for all batch mode fields. This field contains <b>' + n + '</b> selection(s) while a previous field contains <b>' + batch_n + '</b>.');
return false;
}
}
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/mvc/tools/tools-section.js
--- a/static/scripts/mvc/tools/tools-section.js
+++ b/static/scripts/mvc/tools/tools-section.js
@@ -372,6 +372,7 @@
id : 'field-' + input_def.id,
extensions : input_def.extensions,
multiple : input_def.multiple,
+ data : input_def.options,
onchange : function() {
self.app.refresh();
}
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/mvc/tools/tools-select-content.js
--- a/static/scripts/mvc/tools/tools-select-content.js
+++ b/static/scripts/mvc/tools/tools-select-content.js
@@ -4,7 +4,8 @@
var View = Backbone.View.extend({
// initialize
initialize : function(app, options) {
- // configure options
+ // link app and options
+ this.app = app;
this.options = options;
// link this
@@ -14,13 +15,14 @@
this.setElement('<div/>');
// current selection
- this.current = 'hda';
+ this.current = 'single';
// create button
- this.button_new = new Ui.RadioButton.View({
+ this.button_type = new Ui.RadioButton.View({
value : this.current,
- data : [ { icon: 'fa-file-o', label : 'Select datasets', value : 'hda' },
- { icon: 'fa-files-o', label : 'Select a collection', value : 'hdca' }],
+ data : [ { icon: 'fa-file-o', label : 'Single dataset', value : 'single' },
+ { icon: 'fa-files-o', label : 'Multiple datasets', value : 'multiple' },
+ { icon: 'fa-folder-o', label : 'List of datasets', value : 'collection' }],
onchange: function(value) {
self.current = value;
self.refresh();
@@ -28,68 +30,56 @@
}
});
- //
- // datasets
- //
- var datasets = app.content.filterType({
- src : 'hda',
- extensions : options.extensions
- });
-
- // configure options fields
- var dataset_options = [];
- for (var i in datasets) {
- dataset_options.push({
- label: datasets[i].hid + ': ' + datasets[i].name,
- value: datasets[i].id
- });
- }
-
- // select field
- this.select_datasets = new Ui.Select.View({
- multiple : true,
- data : dataset_options,
- value : dataset_options[0] && dataset_options[0].value,
+ // single dataset select field
+ this.select_single = new Ui.Select.View({
onchange : function() {
self.trigger('change');
}
});
- //
- // collections
- //
- var collections = app.content.filterType({
- src : 'hdca',
- extensions : options.extensions
- });
-
- // configure options fields
- var collection_options = [];
- for (var i in collections) {
- collection_options.push({
- label: collections[i].hid + ': ' + collections[i].name,
- value: collections[i].id
- });
- }
-
- // create select field for collections
- this.select_collection = new Ui.Select.View({
- data : collection_options,
- value : collection_options[0] && collection_options[0].value,
+ // multiple datasets select field
+ this.select_multiple = new Ui.Select.View({
+ multiple : true,
onchange : function() {
self.trigger('change');
}
});
+ // collection select field
+ this.select_collection = new Ui.Select.View({
+ onchange : function() {
+ self.trigger('change');
+ }
+ });
+
+ // list of all select fields
+ this.list = {
+ 'single' : {
+ field: this.select_single,
+ type : 'hda'
+ },
+ 'multiple' : {
+ field: this.select_multiple,
+ type : 'hda'
+ },
+ 'collection' : {
+ field: this.select_collection,
+ type : 'hdca'
+ }
+ };
+
+ // add batch mode information
+ this.$batch = $(ToolTemplate.batchMode());
+
// add elements to dom
- this.$el.append(Utils.wrap(this.button_new.$el));
- this.$el.append(this.select_datasets.$el);
- this.$el.append(this.select_collection.$el);
+ this.$el.append(Utils.wrap(this.button_type.$el));
+ for (var i in this.list) {
+ this.$el.append(this.list[i].field.$el);
+ }
+ this.$el.append(this.$batch);
- // check for batch mode
- if (!this.options.multiple) {
- this.$el.append(ToolTemplate.batchMode());
- }
+ // update options
+ this.update(options.data);
// refresh view
this.refresh();
@@ -102,31 +92,77 @@
});
},
+ /** Indicate that select fields are being updated */
+ wait: function() {
+ for (var i in this.list) {
+ this.list[i].field.wait();
+ }
+ },
+
+ /** Indicate that the options update has been completed */
+ unwait: function() {
+ for (var i in this.list) {
+ this.list[i].field.unwait();
+ }
+ },
+
+ /** Update content selector */
+ update: function(options) {
+ // identify dataset options
+ var dataset_options = [];
+ for (var i in options.hda) {
+ var hda = options.hda[i];
+ dataset_options.push({
+ label: hda.hid + ': ' + hda.name,
+ value: hda.id
+ });
+ }
+
+ // identify collection options
+ var collection_options = [];
+ for (var i in options.hdca) {
+ var hdca = options.hdca[i];
+ collection_options.push({
+ label: hdca.hid + ': ' + hdca.name,
+ value: hdca.id
+ });
+ }
+
+ // update selection fields
+ this.select_single.update(dataset_options);
+ this.select_multiple.update(dataset_options);
+ this.select_collection.update(collection_options);
+
+ // add to content list
+ this.app.content.add(options);
+ },
+
/** Return the currently selected dataset values */
value : function (dict) {
// update current value
if (dict !== undefined) {
try {
- // set source
- this.current = dict.values[0].src;
- this.refresh();
-
// create list
var list = [];
for (var i in dict.values) {
list.push(dict.values[i].id);
}
- // identify select element
- switch(this.current) {
- case 'hda':
- this.select_datasets.value(list);
- break;
- case 'hdca':
- this.select_collection.value(list[0]);
- break;
+ // identify suitable select field
+ if (dict && dict.values.length > 0 && dict.values[0].src == 'hcda') {
+ this.current = 'collection';
+ this.select_collection.value(list[0]);
+ } else {
+ if (list.length > 1) {
+ this.current = 'multiple';
+ this.select_multiple.value(list);
+ } else {
+ this.current = 'single';
+ this.select_single.value(list[0]);
+ }
}
-
+ this.refresh();
+
// check if value has been set
var select = this._select();
if (!select.validate()) {
@@ -153,7 +189,7 @@
for (var i in id_list) {
result.values.push({
id : id_list[i],
- src : this.current
+ src : this.list[this.current].type
});
}
@@ -169,26 +205,24 @@
/** Refreshes data selection view */
refresh: function() {
- switch (this.current) {
- case 'hda':
- this.select_datasets.$el.fadeIn();
- this.select_collection.$el.hide();
- break;
- case 'hdca':
- this.select_datasets.$el.hide();
- this.select_collection.$el.fadeIn();
- break;
+ for (var i in this.list) {
+ var $el = this.list[i].field.$el;
+ if (this.current == i) {
+ $el.show();
+ } else {
+ $el.hide();
+ }
+ }
+ if (this.current != 'single' && !this.options.multiple) {
+ this.$batch.show();
+ } else {
+ this.$batch.hide();
}
},
/** Assists in selecting the current field */
_select: function() {
- switch(this.current) {
- case 'hdca':
- return this.select_collection;
- default:
- return this.select_datasets;
- }
+ return this.list[this.current].field;
}
});
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/mvc/tools/tools-template.js
--- a/static/scripts/mvc/tools/tools-template.js
+++ b/static/scripts/mvc/tools/tools-template.js
@@ -56,7 +56,7 @@
batchMode: function() {
return '<div class="ui-table-form-info">' +
'<i class="fa fa-sitemap" style="font-size: 1.2em; padding: 2px 5px;"/>' +
- 'This is a batch mode input field. A separate job will be triggered for each dataset.'
+ 'This is a batch mode input field. A separate job will be triggered for each dataset.' +
'</div>';
}
};
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/packed/mvc/tools/tools-content.js
--- a/static/scripts/packed/mvc/tools/tools-content.js
+++ b/static/scripts/packed/mvc/tools/tools-content.js
@@ -1,1 +1,1 @@
-define(["utils/utils"],function(a){return Backbone.Model.extend({initialize:function(c){this.base_url=galaxy_config.root+"api/histories/"+c.history_id+"/contents";this.datatypes={};this.summary={};var b=this;a.get({url:galaxy_config.root+"api/datatypes/mapping",cache:true,success:function(d){b.datatypes=d;a.get({url:b.base_url+"?deleted=false",success:function(e){b.summary=e;b.summary.sort(function(g,f){return g.hid>f.hid?-1:(g.hid<f.hid?1:0)});console.debug("tools-content::initialize() - Completed.");c.success&&c.success()},error:function(e){console.debug("tools-content::initialize() - Ajax request for summary failed.");console.debug(e)}})},error:function(d){console.debug("tools-content::initialize() - Ajax request for datatypes failed.");console.debug(d)}})},filterType:function(c){c=c||{};var b=[];var g="dataset";if(c.src=="hdca"){g="dataset_collection"}for(var d in this.summary){var e=this.summary[d];if(e.history_content_type==="dataset"&&e.state!=="ok"){continue}var f=false;for(var d in c.extensions){if(this._matchType(c.extensions[d],e.extension)){f=true;break}}if((e.history_content_type===g)&&(f||!c.extensions)){b.push(e)}}return b},get:function(b){return _.findWhere(this.summary,b)||{}},getDetails:function(b){if(!b.id||b.id==="null"){b.success&&b.success();return}var c=this.base_url+"/datasets/"+b.id;if(b.src=="hdca"){c=this.base_url+"/dataset_collections/"+b.id}a.get({url:c,success:function(d){b.success&&b.success(d)},error:function(d){b.success&&b.success();console.debug("tools-content::getDetails() - Ajax request for content failed.");console.debug(d)}})},_matchType:function(f,b){var c=this.datatypes.ext_to_class_name[f];if(!c){console.debug("tools-content::_matchType() - Specific target class unavailable. Accepting all formats.");return true}var d=this.datatypes.ext_to_class_name[b];if(!d){console.debug("tools-content::_matchType() - Specific reference class unavailable. Accepting all formats.");return true}var e=this.datatypes.class_to_classes[d];if(e[c]){return true}return false}})});
\ No newline at end of file
+define(["utils/utils"],function(a){return Backbone.Model.extend({initialize:function(b){this.summary={}},add:function(e){for(var d in e){for(var b in e[d]){var f=e[d][b];this.summary[f.id+"_"+f.src]=f}}console.debug("tools-content::initialize() - Completed.")},get:function(b){return _.findWhere(this.summary,b)||{}},getDetails:function(b){if(!b.id||b.id==="null"){b.success&&b.success();return}var c=this.base_url+"/datasets/"+b.id;if(b.src=="hdca"){c=this.base_url+"/dataset_collections/"+b.id}a.get({url:c,success:function(d){b.success&&b.success(d)},error:function(d){b.success&&b.success();console.debug("tools-content::getDetails() - Ajax request for content failed.");console.debug(d)}})}})});
\ No newline at end of file
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/packed/mvc/tools/tools-form.js
--- a/static/scripts/packed/mvc/tools/tools-form.js
+++ b/static/scripts/packed/mvc/tools/tools-form.js
@@ -1,1 +1,1 @@
-define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;if(parent.Galaxy&&parent.Galaxy.modal){this.modal=parent.Galaxy.modal}else{this.modal=new m.Modal.View()}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f({history_id:n.options.history_id,success:function(){n._buildForm(n.options)}})},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::refresh() - Refreshed form structure.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id}).dataset_id}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update&&p.type!="data"){var t=[];for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}v.update(t);console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(Galaxy.currUser.get("is_admin")){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
+define(["utils/utils","utils/deferred","mvc/ui/ui-portlet","mvc/ui/ui-misc","mvc/citation/citation-model","mvc/citation/citation-view","mvc/tools","mvc/tools/tools-template","mvc/tools/tools-content","mvc/tools/tools-section","mvc/tools/tools-tree","mvc/tools/tools-jobs"],function(i,j,h,m,k,a,e,d,f,l,c,g){var b=Backbone.View.extend({container:"body",initialize:function(o){console.debug(o);var n=this;var p=parent.Galaxy;if(p&&p.modal){this.modal=p.modal}else{this.modal=new m.Modal.View()}if(p&&p.currUser){this.is_admin=p.currUser.get("is_admin")}else{this.is_admin=false}this.options=o;this.deferred=new j();this.setElement("<div/>");$(this.container).append(this.$el);this.tree=new c(this);this.job_handler=new g(this);this.content=new f(this);this._buildForm(o)},message:function(n){$(this.container).empty();$(this.container).append(n)},reset:function(){for(var n in this.element_list){this.element_list[n].reset()}},rebuild:function(){this.tree.refresh();console.debug("tools-form::rebuild() - Rebuilding data structures.")},refresh:function(){if(!this.is_dynamic){return}var n=this;this.deferred.reset();this.deferred.execute(function(){n._updateModel()})},_buildModel:function(){var n=this;var o=galaxy_config.root+"api/tools/"+this.options.id+"/build?";if(this.options.job_id){o+="job_id="+this.options.job_id}else{if(this.options.dataset_id){o+="dataset_id="+this.options.dataset_id}else{var p=top.location.href;var q=p.indexOf("?");if(p.indexOf("tool_id=")!=-1&&q!==-1){o+=p.slice(q+1)}}}i.request({type:"GET",url:o,success:function(r){n.options=$.extend(n.options,r);n.model=r;n.inputs=r.inputs;console.debug("tools-form::initialize() - Initial tool model ready.");console.debug(r);n._buildForm()},error:function(r){console.debug("tools-form::initialize() - Initial tool model request failed.");console.debug(r)}})},_updateModel:function(){var n=this;var o=this.tree.finalize({data:function(r){if(r.values.length>0&&r.values[0]&&r.values[0].src==="hda"){return n.content.get({id:r.values[0].id,src:"hda"}).dataset_id}return null}});console.debug("tools-form::_refreshForm() - Refreshing states.");console.debug(o);function q(u){for(var s in n.input_list){var t=n.field_list[s];var r=n.input_list[s];if(r.is_dynamic&&t.wait&&t.unwait){if(u){t.wait()}else{t.unwait()}}}}q(true);var p=this.deferred.register();i.request({type:"GET",url:galaxy_config.root+"api/tools/"+this.options.id+"/build",data:o,success:function(r){n._updateForm(r);q(false);n.deferred.done(p);console.debug("tools-form::_refreshForm() - States refreshed.");console.debug(r)},error:function(r){n.deferred.done(p);console.debug("tools-form::_refreshForm() - Refresh request failed.");console.debug(r)}})},_updateForm:function(n){var o=this;this.tree.matchModel(n,function(q,u){var p=o.input_list[q];if(p&&p.options){if(JSON.stringify(p.options)!=JSON.stringify(u.options)){p.options=u.options;var v=o.field_list[q];if(v.update){var t=[];switch(p.type){case"data":t=p.options;break;default:for(var s in u.options){var r=u.options[s];if(r.length>2){t.push({label:r[0],value:r[1]})}}}v.update(t);console.debug("Updating options for "+q)}}}})},_buildForm:function(p){var o=this;this.field_list={};this.input_list={};this.element_list={};this.model=p;this.inputs=p.inputs;var r=new m.ButtonMenu({icon:"fa-gear",tooltip:"Click to see a list of options."});if(p.biostar_url){r.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/p/new/post/")}});r.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(o.options.biostar_url+"/t/"+o.options.id+"/")}})}r.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+galaxy_config.root+"root?tool_id="+o.options.id)}});if(this.is_admin){r.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=galaxy_config.root+"api/tools/"+o.options.id+"/download"}})}this.section=new l.View(o,{inputs:this.inputs,cls:"ui-table-plain"});if(this.incompatible){this.$el.hide();$("#tool-form-classic").show();return}this.portlet=new h.View({icon:"fa-wrench",title:"<b>"+this.model.name+"</b> "+this.model.description,operations:{menu:r},buttons:{execute:new m.Button({icon:"fa-check",tooltip:"Execute the tool",title:"Execute",cls:"btn btn-primary",floating:"clear",onclick:function(){o.job_handler.submit()}})}});this.$el.empty();this.$el.append(this.portlet.$el);if(p.help!=""){this.$el.append(d.help(p.help))}if(p.citations){var n=new k.ToolCitationCollection();n.tool_id=p.id;var q=new a.CitationListView({collection:n});q.render();n.fetch();this.$el.append(q.$el)}this.portlet.append(this.section.$el);this.rebuild()}});return{View:b}});
\ No newline at end of file
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/packed/mvc/tools/tools-jobs.js
--- a/static/scripts/packed/mvc/tools/tools-jobs.js
+++ b/static/scripts/packed/mvc/tools/tools-jobs.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/tools/tools-template"],function(b,a){return Backbone.Model.extend({initialize:function(d,c){this.app=d;this.options=b.merge(c,this.optionsDefault)},submit:function(){var c=this;var d={tool_id:this.app.options.id,inputs:this.app.tree.finalize()};this.app.reset();if(!this._validation(d)){console.debug("tools-jobs::submit - Submission canceled. Validation failed.");return}console.debug(d);this.app.modal.show({title:"Please wait...",body:"progress",closing_events:true,buttons:{Close:function(){c.app.modal.hide()}}});b.request({type:"POST",url:galaxy_config.root+"api/tools",data:d,success:function(e){c.app.modal.hide();c.app.message(a.success(e));c._refreshHdas()},error:function(e,g){c.app.modal.hide();if(e&&e.message&&e.message.data){var h=c.app.tree.matchResponse(e.message.data);for(var f in h){c._foundError(f,h[f]);break}}else{console.debug(e);c.app.modal.show({title:"Job submission failed",body:a.error(d),buttons:{Close:function(){c.app.modal.hide()}}})}}})},_foundError:function(c,d){var e=this.app.element_list[c];e.error(d||"Please verify this parameter.");$(this.app.container).animate({scrollTop:e.$el.offset().top-20},500)},_validation:function(h){var d=h.inputs;var m=-1;var i=null;for(var k in d){var f=d[k];var l=this.app.tree.match(k);var e=this.app.field_list[l];var j=this.app.input_list[l];if(j&&e&&e.validate&&!e.validate()){this._foundError(l);return false}if(f.batch){var g=f.values.length;var c=null;if(g>0){c=f.values[0]&&f.values[0].src}if(c){if(i===null){i=c}else{if(i!==c){this._foundError(l,"Please select either dataset or dataset list fields for all batch mode fields.");return false}}}if(m===-1){m=g}else{if(m!==g&&g!=1){this._foundError(l,"Please make sure that you select a single input or the same number of inputs for all batch mode fields. This field contains <b>"+g+"</b> selection(s) while a previous field contains <b>"+m+"</b>.");return false}}}}return true},_refreshHdas:function(){if(parent.Galaxy&&parent.Galaxy.currHistoryPanel){parent.Galaxy.currHistoryPanel.refreshContents()}}})});
\ No newline at end of file
+define(["utils/utils","mvc/tools/tools-template"],function(b,a){return Backbone.Model.extend({initialize:function(d,c){this.app=d;this.options=b.merge(c,this.optionsDefault)},submit:function(){var c=this;var d={tool_id:this.app.options.id,inputs:this.app.tree.finalize()};this.app.reset();if(!this._validation(d)){console.debug("tools-jobs::submit - Submission canceled. Validation failed.");return}console.debug(d);this.app.modal.show({title:"Please wait...",body:"progress",closing_events:true,buttons:{Close:function(){c.app.modal.hide()}}});b.request({type:"POST",url:galaxy_config.root+"api/tools",data:d,success:function(e){c.app.modal.hide();c.app.message(a.success(e));c._refreshHdas()},error:function(e,g){c.app.modal.hide();if(e&&e.message&&e.message.data){var h=c.app.tree.matchResponse(e.message.data);for(var f in h){c._foundError(f,h[f]);break}}else{console.debug(e);c.app.modal.show({title:"Job submission failed",body:a.error(d),buttons:{Close:function(){c.app.modal.hide()}}})}}})},_foundError:function(c,d){var e=this.app.element_list[c];e.error(d||"Please verify this parameter.");$(this.app.container).animate({scrollTop:e.$el.offset().top-20},500)},_validation:function(h){var d=h.inputs;var m=-1;var i=null;for(var k in d){var f=d[k];var l=this.app.tree.match(k);var e=this.app.field_list[l];var j=this.app.input_list[l];if(j&&e&&e.validate&&!e.validate()){this._foundError(l);return false}if(f.batch){var g=f.values.length;var c=null;if(g>0){c=f.values[0]&&f.values[0].src}if(c){if(i===null){i=c}else{if(i!==c){this._foundError(l,"Please select either dataset or dataset list fields for all batch mode fields.");return false}}}if(m===-1){m=g}else{if(m!==g){this._foundError(l,"Please make sure that you select the same number of inputs for all batch mode fields. This field contains <b>"+g+"</b> selection(s) while a previous field contains <b>"+m+"</b>.");return false}}}}return true},_refreshHdas:function(){if(parent.Galaxy&&parent.Galaxy.currHistoryPanel){parent.Galaxy.currHistoryPanel.refreshContents()}}})});
\ No newline at end of file
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/packed/mvc/tools/tools-section.js
--- a/static/scripts/packed/mvc/tools/tools-section.js
+++ b/static/scripts/packed/mvc/tools/tools-section.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/tools/tools-repeat","mvc/tools/tools-select-content","mvc/tools/tools-input"],function(d,b,g,c,a,e){var f=Backbone.View.extend({initialize:function(i,h){this.app=i;this.inputs=h.inputs;h.cls_tr="section-row";this.table=new b.View(h);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var h in this.inputs){this._add(this.inputs[h])}},_add:function(j){var i=this;var h=jQuery.extend(true,{},j);h.id=j.id=d.uuid();this.app.input_list[h.id]=h;var k=h.type;switch(k){case"conditional":this._addConditional(h);break;case"repeat":this._addRepeat(h);break;default:this._addRow(h)}},_addConditional:function(h){var j=this;h.test_param.id=h.id;var m=this._addRow(h.test_param);m.options.onchange=function(t){var p=j.app.tree.matchCase(h,t);for(var r in h.cases){var w=h.cases[r];var u=h.id+"-section-"+r;var o=j.table.get(u);var v=false;for(var q in w.inputs){var s=w.inputs[q].type;if(s&&s!=="hidden"){v=true;break}}if(r==p&&v){o.fadeIn("fast")}else{o.hide()}}j.app.refresh()};for(var l in h.cases){var k=h.id+"-section-"+l;var n=new f(this.app,{inputs:h.cases[l].inputs,cls:"ui-table-plain"});n.$el.addClass("ui-table-form-section");this.table.add(n.$el);this.table.append(k)}m.trigger("change")},_addRepeat:function(o){var r=this;var p=0;function m(i,t){var s=o.id+"-section-"+(p++);var u=null;if(t){u=function(){k.del(s);k.retitle(o.title);r.app.rebuild();r.app.refresh()}}var v=new f(r.app,{inputs:i,cls:"ui-table-plain"});k.add({id:s,title:o.title,$el:v.$el,ondel:u});k.retitle(o.title)}var k=new c.View({title_new:o.title,max:o.max,onnew:function(){m(o.inputs,true);r.app.rebuild();r.app.refresh()}});var h=o.min;var q=_.size(o.cache);for(var l=0;l<Math.max(q,h);l++){var n=null;if(l<q){n=o.cache[l]}else{n=o.inputs}m(n,l>=h)}var j=new e(this.app,{label:o.title,help:o.help,field:k});j.$el.addClass("ui-table-form-section");this.table.add(j.$el);this.table.append(o.id)},_addRow:function(h){var k=h.id;var i=this._createField(h);if(h.is_dynamic){this.app.is_dynamic=true}this.app.field_list[k]=i;var j=new e(this.app,{label:h.label,optional:h.optional,help:h.help,field:i});this.app.element_list[k]=j;this.table.add(j.$el);this.table.append(k);return i},_createField:function(h){var i=null;switch(h.type){case"text":i=this._fieldText(h);break;case"select":i=this._fieldSelect(h);break;case"data":i=this._fieldData(h);break;case"data_column":i=this._fieldSelect(h);break;case"hidden":i=this._fieldHidden(h);break;case"integer":i=this._fieldSlider(h);break;case"float":i=this._fieldSlider(h);break;case"boolean":i=this._fieldBoolean(h);break;case"genomebuild":i=this._fieldSelect(h);break;default:this.app.incompatible=true;if(h.options){i=this._fieldSelect(h)}else{i=this._fieldText(h)}console.debug("tools-form::_addRow() : Auto matched field type ("+h.type+").")}if(h.value!==undefined){i.value(h.value)}return i},_fieldData:function(h){var i=this;return new a.View(this.app,{id:"field-"+h.id,extensions:h.extensions,multiple:h.multiple,onchange:function(){i.app.refresh()}})},_fieldSelect:function(h){var k=[];for(var l in h.options){var m=h.options[l];k.push({label:m[0],value:m[1]})}var n=g.Select;switch(h.display){case"checkboxes":n=g.Checkbox;break;case"radio":n=g.Radio;break}var j=this;return new n.View({id:"field-"+h.id,data:k,multiple:h.multiple,onchange:function(){j.app.refresh()}})},_fieldText:function(h){var i=this;return new g.Input({id:"field-"+h.id,area:h.area,onchange:function(){i.app.refresh()}})},_fieldSlider:function(h){return new g.Slider.View({id:"field-"+h.id,precise:h.type=="float",min:h.min,max:h.max})},_fieldHidden:function(h){return new g.Hidden({id:"field-"+h.id})},_fieldBoolean:function(h){return new g.RadioButton.View({id:"field-"+h.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]})}});return{View:f}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-table","mvc/ui/ui-misc","mvc/tools/tools-repeat","mvc/tools/tools-select-content","mvc/tools/tools-input"],function(d,b,g,c,a,e){var f=Backbone.View.extend({initialize:function(i,h){this.app=i;this.inputs=h.inputs;h.cls_tr="section-row";this.table=new b.View(h);this.setElement(this.table.$el);this.render()},render:function(){this.table.delAll();for(var h in this.inputs){this._add(this.inputs[h])}},_add:function(j){var i=this;var h=jQuery.extend(true,{},j);h.id=j.id=d.uuid();this.app.input_list[h.id]=h;var k=h.type;switch(k){case"conditional":this._addConditional(h);break;case"repeat":this._addRepeat(h);break;default:this._addRow(h)}},_addConditional:function(h){var j=this;h.test_param.id=h.id;var m=this._addRow(h.test_param);m.options.onchange=function(t){var p=j.app.tree.matchCase(h,t);for(var r in h.cases){var w=h.cases[r];var u=h.id+"-section-"+r;var o=j.table.get(u);var v=false;for(var q in w.inputs){var s=w.inputs[q].type;if(s&&s!=="hidden"){v=true;break}}if(r==p&&v){o.fadeIn("fast")}else{o.hide()}}j.app.refresh()};for(var l in h.cases){var k=h.id+"-section-"+l;var n=new f(this.app,{inputs:h.cases[l].inputs,cls:"ui-table-plain"});n.$el.addClass("ui-table-form-section");this.table.add(n.$el);this.table.append(k)}m.trigger("change")},_addRepeat:function(o){var r=this;var p=0;function m(i,t){var s=o.id+"-section-"+(p++);var u=null;if(t){u=function(){k.del(s);k.retitle(o.title);r.app.rebuild();r.app.refresh()}}var v=new f(r.app,{inputs:i,cls:"ui-table-plain"});k.add({id:s,title:o.title,$el:v.$el,ondel:u});k.retitle(o.title)}var k=new c.View({title_new:o.title,max:o.max,onnew:function(){m(o.inputs,true);r.app.rebuild();r.app.refresh()}});var h=o.min;var q=_.size(o.cache);for(var l=0;l<Math.max(q,h);l++){var n=null;if(l<q){n=o.cache[l]}else{n=o.inputs}m(n,l>=h)}var j=new e(this.app,{label:o.title,help:o.help,field:k});j.$el.addClass("ui-table-form-section");this.table.add(j.$el);this.table.append(o.id)},_addRow:function(h){var k=h.id;var i=this._createField(h);if(h.is_dynamic){this.app.is_dynamic=true}this.app.field_list[k]=i;var j=new e(this.app,{label:h.label,optional:h.optional,help:h.help,field:i});this.app.element_list[k]=j;this.table.add(j.$el);this.table.append(k);return i},_createField:function(h){var i=null;switch(h.type){case"text":i=this._fieldText(h);break;case"select":i=this._fieldSelect(h);break;case"data":i=this._fieldData(h);break;case"data_column":i=this._fieldSelect(h);break;case"hidden":i=this._fieldHidden(h);break;case"integer":i=this._fieldSlider(h);break;case"float":i=this._fieldSlider(h);break;case"boolean":i=this._fieldBoolean(h);break;case"genomebuild":i=this._fieldSelect(h);break;default:this.app.incompatible=true;if(h.options){i=this._fieldSelect(h)}else{i=this._fieldText(h)}console.debug("tools-form::_addRow() : Auto matched field type ("+h.type+").")}if(h.value!==undefined){i.value(h.value)}return i},_fieldData:function(h){var i=this;return new a.View(this.app,{id:"field-"+h.id,extensions:h.extensions,multiple:h.multiple,data:h.options,onchange:function(){i.app.refresh()}})},_fieldSelect:function(h){var k=[];for(var l in h.options){var m=h.options[l];k.push({label:m[0],value:m[1]})}var n=g.Select;switch(h.display){case"checkboxes":n=g.Checkbox;break;case"radio":n=g.Radio;break}var j=this;return new n.View({id:"field-"+h.id,data:k,multiple:h.multiple,onchange:function(){j.app.refresh()}})},_fieldText:function(h){var i=this;return new g.Input({id:"field-"+h.id,area:h.area,onchange:function(){i.app.refresh()}})},_fieldSlider:function(h){return new g.Slider.View({id:"field-"+h.id,precise:h.type=="float",min:h.min,max:h.max})},_fieldHidden:function(h){return new g.Hidden({id:"field-"+h.id})},_fieldBoolean:function(h){return new g.RadioButton.View({id:"field-"+h.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}]})}});return{View:f}});
\ No newline at end of file
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/packed/mvc/tools/tools-select-content.js
--- a/static/scripts/packed/mvc/tools/tools-select-content.js
+++ b/static/scripts/packed/mvc/tools/tools-select-content.js
@@ -1,1 +1,1 @@
-define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-tabs","mvc/tools/tools-template"],function(c,e,b,a){var d=Backbone.View.extend({initialize:function(n,h){this.options=h;var g=this;this.setElement("<div/>");this.current="hda";this.button_new=new e.RadioButton.View({value:this.current,data:[{icon:"fa-file-o",label:"Select datasets",value:"hda"},{icon:"fa-files-o",label:"Select a collection",value:"hdca"}],onchange:function(i){g.current=i;g.refresh();g.trigger("change")}});var l=n.content.filterType({src:"hda",extensions:h.extensions});var k=[];for(var j in l){k.push({label:l[j].hid+": "+l[j].name,value:l[j].id})}this.select_datasets=new e.Select.View({multiple:true,data:k,value:k[0]&&k[0].value,onchange:function(){g.trigger("change")}});var m=n.content.filterType({src:"hdca",extensions:h.extensions});var f=[];for(var j in m){f.push({label:m[j].hid+": "+m[j].name,value:m[j].id})}this.select_collection=new e.Select.View({data:f,value:f[0]&&f[0].value,onchange:function(){g.trigger("change")}});this.$el.append(c.wrap(this.button_new.$el));this.$el.append(this.select_datasets.$el);this.$el.append(this.select_collection.$el);if(!this.options.multiple){this.$el.append(a.batchMode())}this.refresh();this.on("change",function(){if(h.onchange){h.onchange(g.value())}})},value:function(m){if(m!==undefined){try{this.current=m.values[0].src;this.refresh();var l=[];for(var h in m.values){l.push(m.values[h].id)}switch(this.current){case"hda":this.select_datasets.value(l);break;case"hdca":this.select_collection.value(l[0]);break}var g=this._select();if(!g.validate()){g.value(g.first())}}catch(k){console.debug("tools-select-content::value() - Skipped.")}}var j=this._select().value();if(!(j instanceof Array)){j=[j]}var f={batch:!this.options.multiple,values:[]};for(var h in j){f.values.push({id:j[h],src:this.current})}return f},validate:function(){return this._select().validate()},refresh:function(){switch(this.current){case"hda":this.select_datasets.$el.fadeIn();this.select_collection.$el.hide();break;case"hdca":this.select_datasets.$el.hide();this.select_collection.$el.fadeIn();break}},_select:function(){switch(this.current){case"hdca":return this.select_collection;default:return this.select_datasets}}});return{View:d}});
\ No newline at end of file
+define(["utils/utils","mvc/ui/ui-misc","mvc/ui/ui-tabs","mvc/tools/tools-template"],function(c,e,b,a){var d=Backbone.View.extend({initialize:function(j,g){this.app=j;this.options=g;var f=this;this.setElement("<div/>");this.current="single";this.button_type=new e.RadioButton.View({value:this.current,data:[{icon:"fa-file-o",label:"Single dataset",value:"single"},{icon:"fa-files-o",label:"Multiple datasets",value:"multiple"},{icon:"fa-folder-o",label:"List of datasets",value:"collection"}],onchange:function(i){f.current=i;f.refresh();f.trigger("change")}});this.select_single=new e.Select.View({onchange:function(){f.trigger("change")}});this.select_multiple=new e.Select.View({multiple:true,onchange:function(){f.trigger("change")}});this.select_collection=new e.Select.View({onchange:function(){f.trigger("change")}});this.list={single:{field:this.select_single,type:"hda"},multiple:{field:this.select_multiple,type:"hda"},collection:{field:this.select_collection,type:"hdca"}};this.$batch=$(a.batchMode());this.$el.append(c.wrap(this.button_type.$el));for(var h in this.list){this.$el.append(this.list[h].field.$el)}this.$el.append(this.$batch);this.update(g.data);this.refresh();this.on("change",function(){if(g.onchange){g.onchange(f.value())}})},wait:function(){for(var f in this.list){this.list[f].field.wait()}},unwait:function(){for(var f in this.list){this.list[f].field.unwait()}},update:function(g){var l=[];for(var j in g.hda){var k=g.hda[j];l.push({label:k.hid+": "+k.name,value:k.id})}var f=[];for(var j in g.hdca){var h=g.hdca[j];f.push({label:h.hid+": "+h.name,value:h.id})}this.select_single.update(l);this.select_multiple.update(l);this.select_collection.update(f);this.app.content.add(g)},value:function(m){if(m!==undefined){try{var l=[];for(var h in m.values){l.push(m.values[h].id)}if(m&&m.values.length>0&&m.values[0].src=="hcda"){this.current="collection";this.select_collection.value(l[0])}else{if(l.length>1){this.current="multiple";this.select_multiple.value(l)}else{this.current="single";this.select_single.value(l[0])}}this.refresh();var g=this._select();if(!g.validate()){g.value(g.first())}}catch(k){console.debug("tools-select-content::value() - Skipped.")}}var j=this._select().value();if(!(j instanceof Array)){j=[j]}var f={batch:!this.options.multiple,values:[]};for(var h in j){f.values.push({id:j[h],src:this.list[this.current].type})}return f},validate:function(){return this._select().validate()},refresh:function(){for(var g in this.list){var f=this.list[g].field.$el;if(this.current==g){f.show()}else{f.hide()}}if(this.current!="single"&&!this.options.multiple){this.$batch.show()}else{this.$batch.hide()}},_select:function(){return this.list[this.current].field}});return{View:d}});
\ No newline at end of file
diff -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 -r 4231a77fe8946110b2c56efd436000b864b06a84 static/scripts/packed/mvc/tools/tools-template.js
--- a/static/scripts/packed/mvc/tools/tools-template.js
+++ b/static/scripts/packed/mvc/tools/tools-template.js
@@ -1,1 +1,1 @@
-define([],function(){return{help:function(a){return'<div class="toolHelp"><div class="toolHelpBody">'+a+"</div></div>"},success:function(c){if(!c.jobs||!c.jobs.length){console.debug("tools-template::success() - Failed jobs.");return}var a=c.jobs.length;var d="";if(a==1){d="1 job has"}else{d=a+" jobs have"}var b='<div class="donemessagelarge"><p>'+d+" been successfully added to the queue - resulting in the following datasets:</p>";for(var e in c.outputs){b+='<p style="padding: 10px 20px;"><b>'+(parseInt(e)+1)+": "+c.outputs[e].name+"</b></p>"}b+="<p>You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from 'running' to 'finished' if completed successfully or 'error' if problems were encountered.</p></div>";return b},error:function(a){return'<div><p>The server could not complete the request. Please contact the Galaxy Team if this error persists.</p><textarea class="ui-textarea" disabled style="color: black;" rows="6">'+JSON.stringify(a,undefined,4)+"</textarea></div>"},batchMode:function(){return'<div class="ui-table-form-info"><i class="fa fa-sitemap" style="font-size: 1.2em; padding: 2px 5px;"/>This is a batch mode input field. A separate job will be triggered for each dataset.';"</div>"}}});
\ No newline at end of file
+define([],function(){return{help:function(a){return'<div class="toolHelp"><div class="toolHelpBody">'+a+"</div></div>"},success:function(c){if(!c.jobs||!c.jobs.length){console.debug("tools-template::success() - Failed jobs.");return}var a=c.jobs.length;var d="";if(a==1){d="1 job has"}else{d=a+" jobs have"}var b='<div class="donemessagelarge"><p>'+d+" been successfully added to the queue - resulting in the following datasets:</p>";for(var e in c.outputs){b+='<p style="padding: 10px 20px;"><b>'+(parseInt(e)+1)+": "+c.outputs[e].name+"</b></p>"}b+="<p>You can check the status of queued jobs and view the resulting data by refreshing the History pane. When the job has been run the status will change from 'running' to 'finished' if completed successfully or 'error' if problems were encountered.</p></div>";return b},error:function(a){return'<div><p>The server could not complete the request. Please contact the Galaxy Team if this error persists.</p><textarea class="ui-textarea" disabled style="color: black;" rows="6">'+JSON.stringify(a,undefined,4)+"</textarea></div>"},batchMode:function(){return'<div class="ui-table-form-info"><i class="fa fa-sitemap" style="font-size: 1.2em; padding: 2px 5px;"/>This is a batch mode input field. A separate job will be triggered for each dataset.</div>'}}});
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: jmchilton: Small fix for e4c9f0b.
by commits-noreply@bitbucket.org 11 Nov '14
by commits-noreply@bitbucket.org 11 Nov '14
11 Nov '14
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/7cdccd6e7573/
Changeset: 7cdccd6e7573
User: jmchilton
Date: 2014-11-11 20:56:18+00:00
Summary: Small fix for e4c9f0b.
Affected #: 1 file
diff -r e4c9f0b5a73851ab2d8644889d305aaab80208d9 -r 7cdccd6e757315f66bada94b85cf046ff5f8edc1 lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -2268,6 +2268,8 @@
subcollection_type = self._history_query( trans ).collection_type_description.collection_type
pass
+ return d
+
class HiddenDataToolParameter( HiddenToolParameter, DataToolParameter ):
"""
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0