diff --git a/client/galaxy/scripts/mvc/history/options-menu.js b/client/galaxy/scripts/mvc/history/options-menu.js index 54aefd59d4f2..0a09403ca564 100644 --- a/client/galaxy/scripts/mvc/history/options-menu.js +++ b/client/galaxy/scripts/mvc/history/options-menu.js @@ -59,15 +59,23 @@ var menu = [ }, { html : _l( 'Delete' ), - confirm : _l( 'Really delete the current history?' ), - href : 'history/delete_current', + anon : true, + func : function() { + if( Galaxy && Galaxy.currHistoryPanel && confirm( _l( 'Really delete the current history?' ) ) ){ + galaxy_main.window.location.href = 'history/delete?id=' + Galaxy.currHistoryPanel.model.id; + } + }, }, { html : _l( 'Delete Permanently' ), - confirm : _l( 'Really delete the current history permanently? This cannot be undone.' ), - href : 'history/delete_current?purge=True', purge : true, anon : true, + func : function() { + if( Galaxy && Galaxy.currHistoryPanel + && confirm( _l( 'Really delete the current history permanently? This cannot be undone.' ) ) ){ + galaxy_main.window.location.href = 'history/delete?purge=True&id=' + Galaxy.currHistoryPanel.model.id; + } + }, }, diff --git a/lib/galaxy/webapps/galaxy/controllers/history.py b/lib/galaxy/webapps/galaxy/controllers/history.py index 541f8f5d74a2..34188bed2a9b 100644 --- a/lib/galaxy/webapps/galaxy/controllers/history.py +++ b/lib/galaxy/webapps/galaxy/controllers/history.py @@ -1122,55 +1122,36 @@ def purge_deleted_datasets( self, trans ): count += 1 return trans.show_ok_message( "%d datasets have been deleted permanently" % count, refresh_frames=['history'] ) - # TODO: use api instead @web.expose - def delete_current( self, trans, purge=False ): - """Delete just the active history -- this does not require a logged in user.""" - history = trans.get_history() - if history.users_shared_with: - return trans.show_error_message( "History (%s) has been shared with others, unshare it before deleting it. " % history.name ) - if not history.deleted: - history.deleted = True - trans.sa_session.add( history ) - trans.sa_session.flush() - trans.log_event( "History id %d marked as deleted" % history.id ) - if purge and trans.app.config.allow_user_dataset_purge: - for hda in history.datasets: - if trans.user: - trans.user.adjust_total_disk_usage(-hda.quota_amount(trans.user)) - hda.purged = True - trans.sa_session.add( hda ) - trans.log_event( "HDA id %s has been purged" % hda.id ) - trans.sa_session.flush() - if hda.dataset.user_can_purge: - try: - hda.dataset.full_delete() - trans.log_event( "Dataset id %s has been purged upon the the purge of HDA id %s" % ( hda.dataset.id, hda.id ) ) - trans.sa_session.add( hda.dataset ) - except: - log.exception( 'Unable to purge dataset (%s) on purge of hda (%s):' % ( hda.dataset.id, hda.id ) ) - history.purged = True - self.sa_session.add( history ) - self.sa_session.flush() - for hda in history.datasets: - # Not all datasets have jobs associated with them (e.g., datasets imported from libraries). - if hda.creating_job_associations: - # HDA has associated job, so try marking it deleted. - job = hda.creating_job_associations[0].job - if job.history_id == history.id and not job.finished: - # No need to check other outputs since the job's parent history is this history - job.mark_deleted( trans.app.config.track_jobs_in_database ) - trans.app.job_manager.job_stop_queue.put( job.id ) - - # Regardless of whether it was previously deleted, get the most recent history or create a new one. - most_recent_history = self.history_manager.most_recent( user=trans.user ) - if most_recent_history: - trans.set_history( most_recent_history ) - return trans.show_ok_message( "History deleted, your most recent history is now active", - refresh_frames=['history'] ) - - trans.get_or_create_default_history() - return trans.show_ok_message( "History deleted, a new history is active", refresh_frames=['history'] ) + def delete( self, trans, id, purge=False ): + """Delete the history -- this does not require a logged in user.""" + # TODO: use api instead + try: + # get the history with the given id, delete and optionally purge + current_history = self.history_manager.get_current( trans ) + history = self.history_manager.get_owned( self.decode_id( id ), trans.user, current_history=current_history ) + if history.users_shared_with: + raise exceptions.ObjectAttributeInvalidException( + "History has been shared with others. Unshare it before deleting it." + ) + self.history_manager.delete( history, flush=( not purge ) ) + if purge: + self.history_manager.purge( history ) + + # if this history is the current history for this session, + # - attempt to find the most recently used, undeleted history and switch to it. + # - If no suitable recent history is found, create a new one and switch + if history == current_history: + most_recent_history = self.history_manager.most_recent( + filters=[ model.History.deleted == false() ], user=trans.user ) + if most_recent_history: + self.history_manager.set_current( trans, most_recent_history ) + else: + trans.get_or_create_default_history() + + except Exception as exc: + return trans.show_error_message( exc ) + return trans.show_ok_message( "History deleted", refresh_frames=['history'] ) @web.expose def resume_paused_jobs( self, trans, current=False, ids=None ): diff --git a/static/maps/mvc/history/options-menu.js.map b/static/maps/mvc/history/options-menu.js.map index f35eae87f0ca..6d567d910f08 100644 --- a/static/maps/mvc/history/options-menu.js.map +++ b/static/maps/mvc/history/options-menu.js.map @@ -1 +1 @@ -{"version":3,"file":"options-menu.js","sources":["../../../src/mvc/history/options-menu.js"],"names":["define","PopupMenu","historyCopyDialog","BASE_MVC","_l","buildMenu","isAnon","purgeAllowed","urlRoot","_","clone","menu","filter","menuOption","anon","purge","href","target","confirm","func","galaxy_main","location","html","header","Galaxy","currHistoryPanel","createNewHistory","model","done","loadCurrentHistory","collapseAll","filtered","contents","hidden","ajaxQueue","Backbone","Model","prototype","save","visible","renderItems","fail","alert","console","error","arguments","deleted","create","$button","options","undefined","anonymous","root"],"mappings":"AAAAA,QACI,oBACA,0BACA,eACA,sBACD,SAAUC,EAAWC,EAAmBC,EAAUC,GAErD,YAmKA,SAASC,GAAWC,EAAQC,EAAcC,GACtC,MAAOC,GAAEC,MAAOC,GAAOC,OAAQ,SAAUC,GACrC,MAAIP,KAAWO,EAAWC,MACf,GAENP,GAAgBM,EAAWE,OACrB,GAIPF,EAAWG,OACXH,EAAWG,KAAOR,EAAUK,EAAWG,KACvCH,EAAWI,OAAS,eAGpBJ,EAAWK,UACXL,EAAWM,KAAO,WACVD,QAASL,EAAWK,WACpBE,YAAYC,SAAWR,EAAWG,SAIvC,KAtLf,GAAIL,KAEIW,KAAUlB,EAAI,iBACdmB,QAAU,IAGVD,KAAUlB,EAAI,mBACdY,KAAU,iBAGVM,KAAUlB,EAAI,4BACdY,KAAU,wBAIVM,KAAUlB,EAAI,mBACdmB,QAAU,EACVT,MAAU,IAGVQ,KAAUlB,EAAI,cACde,KAAU,WACFK,QAAUA,OAAOC,kBACjBD,OAAOC,iBAAiBC,sBAKhCJ,KAAUlB,EAAI,gBACde,KAAU,WACNjB,EAAmBsB,OAAOC,iBAAiBE,OACtCC,KAAM,WACHJ,OAAOC,iBAAiBI,0BAKpCP,KAAUlB,EAAI,oBACdY,KAAU,oBAGVM,KAAUlB,EAAI,kBACdY,KAAU,6BACVF,MAAU,IAGVQ,KAAUlB,EAAI,oBACdY,KAAU,wCAGVM,KAAUlB,EAAI,UACdc,QAAUd,EAAI,sCACdY,KAAU,2BAGVM,KAAUlB,EAAI,sBACdc,QAAUd,EAAI,yEACdY,KAAU,oCACVD,OAAU,EACVD,MAAU,IAKVQ,KAAUlB,EAAI,mBACdmB,QAAU,EACVT,MAAU,IAGVQ,KAAUlB,EAAI,iBACdY,KAAU,0BAGVM,KAAUlB,EAAI,oBACdY,KAAU,yCAGVM,KAAUlB,EAAI,sBACdY,KAAU,0CACVF,MAAU,IAGVQ,KAAUlB,EAAI,8BACde,KAAU,WACFK,QAAUA,OAAOC,kBACjBD,OAAOC,iBAAiBK,iBAKhCR,KAAUlB,EAAI,0BACdU,MAAU,EACVK,KAAU,WACN,GAAIK,QAAUA,OAAOC,kBAAoBP,QAASd,EAAI,uCAA0C,CAC5F,GAAI2B,GAAWP,OAAOC,iBAAiBE,MAAMK,SAASC,QAEtDF,GAASG,UAAWC,SAASC,MAAMC,UAAUC,MAAQC,SAAU,IAC1DX,KAAM,WACHJ,OAAOC,iBAAiBe,gBAE3BC,KAAM,WACHC,MAAO,4CACPC,QAAQC,MAAOC,iBAM/BvB,KAAUlB,EAAI,0BACdU,MAAU,EACVK,KAAU,WACN,GAAIK,QAAUA,OAAOC,kBAAoBP,QAASd,EAAI,uCAA0C,CAC5F,GAAI2B,GAAWP,OAAOC,iBAAiBE,MAAMK,SAASC,QAGtDF,GAASG,UAAWC,SAASC,MAAMC,UAAUC,MAAQQ,SAAU,EAAMP,SAAS,IACzEX,KAAM,WACHJ,OAAOC,iBAAiBe,gBAE3BC,KAAM,WACHC,MAAO,4CACPC,QAAQC,MAAOC,iBAM/BvB,KAAUlB,EAAI,0BACdc,QAAUd,EAAI,0EACdY,KAAU,iCACVD,OAAU,EACVD,MAAU,IAKVQ,KAAUlB,EAAI,aACdmB,QAAU,IAGVD,KAAUlB,EAAI,yBACdY,KAAU,oBACVF,MAAU,IAGVQ,KAAUlB,EAAI,0BACdY,KAAU,sCACVF,MAAU,IAIVQ,KAAUlB,EAAI,iBACdmB,QAAU,IAGVD,KAAUlB,EAAI,oBACdY,KAAU,2BA8Bd+B,EAAS,SAAUC,EAASC,GAC5BA,EAAUA,KACV,IAAI3C,GAA+B4C,SAAtBD,EAAQE,WAAyB,EAAOF,EAAQE,UACzD5C,EAAe0C,EAAQ1C,eAAgB,EACvCI,EAAON,EAAWC,EAAQC,EAAciB,OAAO4B,KAEnD,OAAO,IAAInD,GAAW+C,EAASrC,GAK/B,OAAOoC"} \ No newline at end of file +{"version":3,"file":"options-menu.js","sources":["../../../src/mvc/history/options-menu.js"],"names":["define","PopupMenu","historyCopyDialog","BASE_MVC","_l","buildMenu","isAnon","purgeAllowed","urlRoot","_","clone","menu","filter","menuOption","anon","purge","href","target","confirm","func","galaxy_main","location","html","header","Galaxy","currHistoryPanel","createNewHistory","model","done","loadCurrentHistory","window","id","collapseAll","filtered","contents","hidden","ajaxQueue","Backbone","Model","prototype","save","visible","renderItems","fail","alert","console","error","arguments","deleted","create","$button","options","undefined","anonymous","root"],"mappings":"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"} \ No newline at end of file diff --git a/static/scripts/bundled/analysis.bundled.js b/static/scripts/bundled/analysis.bundled.js index 5879afd19b35..68c621224c95 100644 --- a/static/scripts/bundled/analysis.bundled.js +++ b/static/scripts/bundled/analysis.bundled.js @@ -1,13 +1,12 @@ -webpackJsonp([3,1],[function(t,e,i){(function(t,e){var n=i(1),s=n,a=i(58).GalaxyApp,o=i(56),l=i(11),r=i(87),c=i(86),d=i(60),h=i(19),u=i(45);window.app=function(i,n){window.Galaxy=new a(i,n),Galaxy.debug("analysis app");var p=i.config,g=new r({el:"#left",userIsAnonymous:Galaxy.user.isAnonymous(),search_url:p.search_url,toolbox:p.toolbox,toolbox_in_panel:p.toolbox_in_panel,stored_workflow_menu_entries:p.stored_workflow_menu_entries,nginx_upload_path:p.nginx_upload_path,ftp_upload_site:p.ftp_upload_site,default_genome:p.default_genome,default_extension:p.default_extension}),f=new l.CenterPanel({el:"#center"}),m=new c({el:"#right",galaxyRoot:Galaxy.root,userIsAnonymous:Galaxy.user.isAnonymous(),allow_user_dataset_purge:p.allow_user_dataset_purge}),v=new d.PageLayoutView(t.extend(i,{el:"body",left:g,center:f,right:m}));Galaxy.page=v,Galaxy.params=Galaxy.config.params,Galaxy.toolPanel=g.tool_panel,Galaxy.upload=g.uploadButton,Galaxy.currHistoryPanel=m.historyView,Galaxy.currHistoryPanel.listenToGalaxy(Galaxy),Galaxy.app={display:function(t,e){s(".select2-hidden-accessible").remove(),f.display(t)}};new(e.Router.extend({initialize:function(t){this.options=t},execute:function(t,e,i){Galaxy.debug("router execute:",t,e,i);var n=o.parse(e.pop());e.push(n),t&&t.apply(this,e)},routes:{"(/)":"home","(/)root*":"home","(/)tours(/)(:tour_id)":"show_tours"},show_tours:function(t){t?u.giveTour(t):f.display(new u.ToursView)},home:function(t){t.tool_id||t.job_id?"upload1"===t.tool_id?(Galaxy.upload.show(),this._loadCenterIframe("welcome")):this._loadToolForm(t):t.workflow_id?this._loadCenterIframe("workflow/run?id="+t.workflow_id):t.m_c?this._loadCenterIframe(t.m_c+"/"+t.m_a):this._loadCenterIframe("welcome")},_loadToolForm:function(t){t.id=t.tool_id,f.display(new h.View(t))},_loadCenterIframe:function(t,e){e=e||Galaxy.root,t=e+t,f.$("#galaxy_main").prop("src",t)}}))(i);s(function(){v.render().right.historyView.loadCurrentHistory(),Galaxy.listenTo(v.right.historyView,"history-size-change",function(){Galaxy.user.fetch({url:Galaxy.user.urlRoot()+"/"+(Galaxy.user.id||"current")})}),v.right.historyView.connectToQuotaMeter(v.masthead.quotaMeter),e.history.start({root:Galaxy.root,pushState:!0})})}}).call(e,i(2),i(3))},,,,,,,function(t,e,i){var n,s;(function(a,o){n=[i(4),i(22),i(52),i(21),i(48),i(13),i(8)],s=function(t,e,i,n,s,l,r){var c=a.View.extend({tagName:"label",initialize:function(t){this.model=t&&t.model||new a.Model(t),this.tagName=t.tagName||this.tagName,this.setElement(o("<"+this.tagName+"/>")),this.listenTo(this.model,"change",this.render,this),this.render()},title:function(t){this.model.set("title",t)},value:function(){return this.model.get("title")},render:function(){return this.$el.removeClass().addClass("ui-label").addClass(this.model.get("cls")).html(this.model.get("title")),this}}),d=a.View.extend({initialize:function(t){this.model=t&&t.model||new a.Model({message:null,status:"info",cls:"",persistent:!1}).set(t),this.listenTo(this.model,"change",this.render,this),this.render()},update:function(t){this.model.set(t)},render:function(){this.$el.removeClass().addClass("ui-message").addClass(this.model.get("cls"));var t=this.model.get("status");if(this.model.get("large")?this.$el.addClass(("success"==t&&"done"||"danger"==t&&"error"||t)+"messagelarge"):this.$el.addClass("alert").addClass("alert-"+t),this.model.get("message")){if(this.$el.html(this.model.get("message")),this.$el.fadeIn(),this.timeout&&window.clearTimeout(this.timeout),!this.model.get("persistent")){var e=this;this.timeout=window.setTimeout(function(){e.model.set("message","")},3e3)}}else this.$el.fadeOut();return this}}),h=a.View.extend({initialize:function(t){this.model=t&&t.model||new a.Model({type:"text",placeholder:"",disabled:!1,visible:!0,cls:"",area:!1,color:null,style:null}).set(t),this.tagName=this.model.get("area")?"textarea":"input",this.setElement(o("<"+this.tagName+"/>")),this.listenTo(this.model,"change",this.render,this),this.render()},events:{input:"_onchange"},value:function(t){return void 0!==t&&this.model.set("value","string"==typeof t?t:""),this.model.get("value")},render:function(){return this.$el.removeClass().addClass("ui-"+this.tagName).addClass(this.model.get("cls")).addClass(this.model.get("style")).attr("id",this.model.id).attr("type",this.model.get("type")).attr("placeholder",this.model.get("placeholder")).css("color",this.model.get("color")||"").css("border-color",this.model.get("color")||""),this.model.get("value")!==this.$el.val()&&this.$el.val(this.model.get("value")),this.model.get("disabled")?this.$el.attr("disabled",!0):this.$el.removeAttr("disabled"),this.$el[this.model.get("visible")?"show":"hide"](),this},_onchange:function(){this.value(this.$el.val()),this.model.get("onchange")&&this.model.get("onchange")(this.model.get("value"))}}),u=a.View.extend({initialize:function(t){this.model=t&&t.model||new a.Model(t),this.setElement(o("
").append(this.$info=o("
")).append(this.$hidden=o("
"))),this.listenTo(this.model,"change",this.render,this),this.render()},value:function(t){return void 0!==t&&this.model.set("value",t),this.model.get("value")},render:function(){return this.$el.attr("id",this.model.id),this.$hidden.val(this.model.get("value")),this.model.get("info")?this.$info.show().html(this.model.get("info")):this.$info.hide(),this}});return{Button:l.ButtonDefault,ButtonIcon:l.ButtonIcon,ButtonCheck:l.ButtonCheck,ButtonMenu:l.ButtonMenu,ButtonLink:l.ButtonLink,Input:h,Label:c,Message:d,Modal:r,RadioButton:n.RadioButton,Checkbox:n.Checkbox,Radio:n.Radio,Select:e,Hidden:u,Slider:i,Drilldown:s}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(3),i(1))},,function(t,e,i){var n,s;(function(a,o,l){n=[i(4),i(7)],s=function(t,e){var i=a.View.extend({visible:!1,initialize:function(i){var n=this;this.model=i&&i.model||new a.Model({id:t.uid(),cls:"ui-portlet",title:"",icon:"",buttons:null,body:null,scrollable:!0,nopadding:!1,operations:null,collapsible:!1,collapsible_button:!1,collapsed:!1}).set(i),this.setElement(this._template()),this.$body=this.$(".portlet-body"),this.$title_text=this.$(".portlet-title-text"),this.$title_icon=this.$(".portlet-title-icon"),this.$header=this.$(".portlet-header"),this.$content=this.$(".portlet-content"),this.$footer=this.$(".portlet-footer"),this.$backdrop=this.$(".portlet-backdrop"),this.$buttons=this.$(".portlet-buttons"),this.$operations=this.$(".portlet-operations"),this.model.get("body")&&this.append(this.model.get("body")),this.collapsible_button=new e.ButtonIcon({icon:"fa-eye",tooltip:"Collapse/Expand",cls:"ui-button-icon-plain",onclick:function(){n[n.collapsed?"expand":"collapse"]()}}),this.render()},render:function(){var t=this,e=this.model.attributes;return this.$el.removeClass().addClass(e.cls).attr("id",e.id),this.$header[e.title?"show":"hide"](),this.$title_text.html(e.title),o.each([this.$content,this.$body],function(t){t[e.nopadding?"addClass":"removeClass"]("no-padding")}),e.icon?this.$title_icon.removeClass().addClass("portlet-title-icon fa").addClass(e.icon).show():this.$title_icon.hide(),this.$title_text[e.collapsible?"addClass":"removeClass"]("no-highlight collapsible").off(),e.collapsible&&(this.$title_text.on("click",function(){t[t.collapsed?"expand":"collapse"]()}),e.collapsed?this.collapse():this.expand()),e.buttons?(this.$buttons.empty().show(),l.each(this.model.get("buttons"),function(e,i){i.$el.prop("id",e),t.$buttons.append(i.$el)})):this.$buttons.hide(),this.$operations.empty,e.collapsible_button&&this.$operations.append(this.collapsible_button.$el),e.operations&&l.each(e.operations,function(e,i){i.$el.prop("id",e),t.$operations.append(i.$el)}),this},append:function(t){this.$body.append(t)},empty:function(){this.$body.empty()},header:function(){return this.$header},body:function(){return this.$body},footer:function(){return this.$footer},show:function(){this.visible=!0,this.$el.fadeIn("fast")},hide:function(){this.visible=!1,this.$el.fadeOut("fast")},enableButton:function(t){this.$buttons.find("#"+t).prop("disabled",!1)},disableButton:function(t){this.$buttons.find("#"+t).prop("disabled",!0)},hideOperation:function(t){this.$operations.find("#"+t).hide()},showOperation:function(t){this.$operations.find("#"+t).show()},setOperation:function(t,e){this.$operations.find("#"+t).off("click").on("click",e)},title:function(t){return t&&this.$title_text.html(t),this.$title_text.html()},collapse:function(){this.collapsed=!0,this.$content.height("0%"),this.$body.hide(),this.$footer.hide(),this.collapsible_button.setIcon("fa-eye-slash")},expand:function(){this.collapsed=!1,this.$content.height("100%"),this.$body.fadeIn("fast"),this.$footer.fadeIn("fast"),this.collapsible_button.setIcon("fa-eye")},disable:function(){this.$backdrop.show()},enable:function(){this.$backdrop.hide()},_template:function(){return l("
").append(l("
").addClass("portlet-header").append(l("
").addClass("portlet-operations")).append(l("
").addClass("portlet-title").append(l("").addClass("portlet-title-icon")).append(l("").addClass("portlet-title-text")))).append(l("
").addClass("portlet-content").append(l("
").addClass("portlet-body")).append(l("
").addClass("portlet-buttons"))).append(l("
").addClass("portlet-footer")).append(l("
").addClass("portlet-backdrop"))}});return{View:i}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(3),i(2),i(1))},function(t,e,i){var n,s;n=[],s=function(){"use strict";var t={UPLOAD:"upload",QUEUED:"queued",RUNNING:"running",SETTING_METADATA:"setting_metadata",NEW:"new",EMPTY:"empty",OK:"ok",PAUSED:"paused",FAILED_METADATA:"failed_metadata",NOT_VIEWABLE:"noPermission",DISCARDED:"discarded",ERROR:"error"};return t.READY_STATES=[t.OK,t.EMPTY,t.PAUSED,t.FAILED_METADATA,t.NOT_VIEWABLE,t.DISCARDED,t.ERROR],t.NOT_READY_STATES=[t.UPLOAD,t.QUEUED,t.RUNNING,t.SETTING_METADATA,t.NEW],t}.apply(e,n),!(void 0!==s&&(t.exports=s))},,function(t,e,i){var n,s;(function(a,o,l){n=[i(8),i(24),i(15)],s=function(t,e,i){var n=a.Model.extend({}),s=a.Model.extend({defaults:{id:"",type:"",name:"",hda_ldda:"hda",metadata:null},initialize:function(){this.get("metadata")||this._set_metadata(),this.on("change",this._set_metadata,this)},_set_metadata:function(){var t=new n;o.each(o.keys(this.attributes),function(e){if(0===e.indexOf("metadata_")){var i=e.split("metadata_")[1];t.set(i,this.attributes[e]),delete this.attributes[e]}},this),this.set("metadata",t,{silent:!0})},get_metadata:function(t){return this.attributes.metadata.get(t)},urlRoot:Galaxy.root+"api/datasets"}),r=s.extend({defaults:o.extend({},s.prototype.defaults,{chunk_url:null,first_data_chunk:null,offset:0,at_eof:!1}),initialize:function(t){s.prototype.initialize.call(this),this.attributes.first_data_chunk&&(this.attributes.offset=this.attributes.first_data_chunk.offset),this.attributes.chunk_url=Galaxy.root+"dataset/display?dataset_id="+this.id,this.attributes.url_viz=Galaxy.root+"visualization"},get_next_chunk:function(){if(this.attributes.at_eof)return null;var t=this,e=l.Deferred();return l.getJSON(this.attributes.chunk_url,{offset:t.attributes.offset}).success(function(i){var n;""!==i.ck_data?(n=i,t.attributes.offset=i.offset):(t.attributes.at_eof=!0,n=null),e.resolve(n)}),e}}),c=a.Collection.extend({model:s}),d=a.View.extend({initialize:function(t){this.row_count=0,this.loading_chunk=!1,new p({model:t.model,$el:this.$el})},expand_to_container:function(){this.$el.height()").attr("id","loading_indicator"),this.$el.append(this.loading_indicator);var t=l("").attr({id:"content_table",cellpadding:0});this.$el.append(t);var e=this.model.get_metadata("column_names"),i=l("").appendTo(t),n=l("").appendTo(i);if(e)n.append("");else for(var s=1;s<=this.model.get_metadata("columns");s++)n.append("");var a=this,o=this.model.get("first_data_chunk");o?this._renderChunk(o):l.when(a.model.get_next_chunk()).then(function(t){a._renderChunk(t)}),this.scroll_elt.scroll(function(){a.attempt_to_fetch()})},scrolled_to_bottom:function(){return!1},_renderCell:function(t,e,i){var n=l("");e.append(t),this.row.append(e)},appendHeader:function(){this.$thead.append(this.row),this.row=o("")},add:function(t,e,i){var n=o("");e&&n.css("width",e),i&&n.css("text-align",i),n.append(t),this.row.append(n)},append:function(t,e){this._commit(t,e,!1)},prepend:function(t,e){this._commit(t,e,!0)},get:function(t){return this.$el.find("#"+t)},del:function(t){var e=this.$tbody.find("#"+t);e.length>0&&(e.remove(),this.row_count--,this._refresh())},delAll:function(){this.$tbody.empty(),this.row_count=0,this._refresh()},value:function(t){this.before=this.$tbody.find(".current").attr("id"),void 0!==t&&(this.$tbody.find("tr").removeClass("current"),t&&this.$tbody.find("#"+t).addClass("current"));var e=this.$tbody.find(".current").attr("id");return void 0===e?null:(e!=this.before&&this.options.onchange&&this.options.onchange(t),e)},size:function(){return this.$tbody.find("tr").length},_commit:function(t,e,i){this.del(t),this.row.attr("id",t),i?this.$tbody.prepend(this.row):this.$tbody.append(this.row),e&&(this.row.hide(),this.row.fadeIn()),this.row=this._row(),this.row_count++,this._refresh()},_row:function(){return o('')},_onclick:function(t){var e=this.value(),i=o(t.target).closest("tr").attr("id");""!=i&&i&&e!=i&&(this.options.onconfirm?this.options.onconfirm(i):this.value(i))},_ondblclick:function(t){var e=this.value();e&&this.options.ondblclick&&this.options.ondblclick(e)},_refresh:function(){0==this.row_count?this.$tmessage.show():this.$tmessage.hide()},_template:function(t){return'
"+e.join("")+""+s+"").text(t),s=this.model.get_metadata("column_types");return void 0!==i?n.attr("colspan",i).addClass("stringalign"):s&&e"),n=this.model.get_metadata("columns");return this.row_count%2!==0&&i.addClass("dark_row"),e.length===n?o.each(e,function(t,e){i.append(this._renderCell(t,e))},this):e.length>n?(o.each(e.slice(0,n-1),function(t,e){i.append(this._renderCell(t,e))},this),i.append(this._renderCell(e.slice(n-1).join("\t"),n-1))):n>5&&e.length===n-1?(o.each(e,function(t,e){i.append(this._renderCell(t,e))},this),i.append(l(""))):i.append(this._renderCell(t,0,n)),this.row_count++,i},_renderChunk:function(t){var e=this.$el.find("table");o.each(t.ck_data.split("\n"),function(t,i){""!==t&&e.append(this._renderRow(t))},this)}}),h=d.extend({initialize:function(t){d.prototype.initialize.call(this,t),scroll_elt=o.find(this.$el.parents(),function(t){return"auto"===l(t).css("overflow")}),scroll_elt||(scroll_elt=window),this.scroll_elt=l(scroll_elt)},scrolled_to_bottom:function(){return this.$el.height()-this.scroll_elt.scrollTop()-this.scroll_elt.height()<=0}}),u=d.extend({initialize:function(t){d.prototype.initialize.call(this,t),this.scroll_elt=this.$el.css({position:"relative",overflow:"scroll",height:t.height||"500px"})},scrolled_to_bottom:function(){return this.$el.scrollTop()+this.$el.innerHeight()>=this.el.scrollHeight}}),p=a.View.extend({col:{chrom:null,start:null,end:null},url_viz:null,dataset_id:null,genome_build:null,file_ext:null,initialize:function(t){function e(t,e){for(var i=0;i").attr("type","button").append(this.$icon=o("")).append(this.$title=o(""))),this.listenTo(this.model,"change",this.render,this),this.render()},render:function(){var t=this,e=this.model.attributes;this.$el.removeClass().addClass(e.cls).addClass(e.disabled&&"disabled").attr("id",e.id).attr("disabled",e.disabled).css("float",e.floating).off("click").on("click",function(){o(".tooltip").hide(),e.onclick&&!t.disabled&&e.onclick()}).tooltip({title:e.tooltip,placement:"bottom"}),this.$icon.removeClass().addClass("icon fa").addClass(e.icon),this.$title.removeClass().addClass("title").html(e.title),e.icon&&e.title&&this.$icon.addClass("ui-margin-right"),e.wait&&(this.$el.removeClass(e.cls).addClass(e.wait_cls).prop("disabled",!0),this.$icon.removeClass(e.icon).addClass("fa-spinner fa-spin"),this.$title.html(e.wait_text))},show:function(){this.$el.show()},hide:function(){this.$el.hide()},disable:function(){this.model.set("disabled",!0)},enable:function(){this.model.set("disabled",!1)},wait:function(){this.model.set("wait",!0)},unwait:function(){this.model.set("wait",!1)},setIcon:function(t){this.model.set("icon",t)}}),i=e.extend({initialize:function(e){this.model=e&&e.model||new a.Model({id:t.uid(),title:"",icon:"",cls:""}).set(e),this.setElement(o("").append(this.$icon=o(""))),this.listenTo(this.model,"change",this.render,this),this.render()},render:function(){var t=this.model.attributes;this.$el.removeClass().addClass(t.cls).attr({id:t.id,href:t.href||"javascript:void(0)",title:t.title,target:t.target||"_top",disabled:t.disabled}),this.$icon.removeClass().addClass(t.icon)}}),n=a.View.extend({initialize:function(e){this.model=e&&e.model||new a.Model({id:t.uid(),title:"Select/Unselect all",icons:["fa-square-o","fa-minus-square-o","fa-check-square-o"],value:0,onchange:function(){}}).set(e),this.setElement(o("
").append(this.$icon=o("")).append(this.$title=o(""))),this.listenTo(this.model,"change",this.render,this),this.render()},render:function(t){var e=this,t=this.model.attributes;this.$el.addClass("ui-button-check").off("click").on("click",function(){e.model.set("value",0===e.model.get("value")&&2||0),t.onclick&&t.onclick()}),this.$title.html(t.title),this.$icon.removeClass().addClass("icon fa ui-margin-right").addClass(t.icons[t.value])},value:function(t,e){return void 0!==t&&(e&&0!==t&&(t=t!==e&&1||2),this.model.set("value",t),this.model.get("onchange")(this.model.get("value"))),this.model.get("value")}}),s=e.extend({initialize:function(e){this.model=e&&e.model||new a.Model({id:t.uid(),title:"",floating:"right",icon:"",cls:"ui-button-icon",disabled:!1}).set(e),this.setElement(o("
").append(this.$button=o("
").append(this.$icon=o("")).append(this.$title=o("")))),this.listenTo(this.model,"change",this.render,this),this.render()},render:function(t){var t=this.model.attributes;this.$el.removeClass().addClass(t.cls).addClass(t.disabled&&"disabled").attr("disabled",t.disabled).attr("id",t.id).css("float",t.floating).off("click").on("click",function(){o(".tooltip").hide(),!t.disabled&&t.onclick&&t.onclick()}),this.$button.addClass("button").tooltip({title:t.tooltip,placement:"bottom"}),this.$icon.removeClass().addClass("icon fa").addClass(t.icon),this.$title.addClass("title").html(t.title),t.icon&&t.title&&this.$icon.addClass("ui-margin-right")}}),l=e.extend({$menu:null,initialize:function(t){this.model=t&&t.model||new a.Model({id:"",title:"",floating:"right",pull:"right",icon:null,onclick:null,cls:"ui-button-icon ui-button-menu",tooltip:"",target:"",href:"",onunload:null,visible:!0,tag:""}).set(t),this.setElement(o("
").append(this.$root=o("
").append(this.$icon=o("")).append(this.$title=o("")))),this.listenTo(this.model,"change",this.render,this),this.render()},render:function(){var t=this.model.attributes;this.$el.removeClass().addClass("dropdown").addClass(t.cls).attr("id",t.id).css({"float":t.floating,display:t.visible?"block":"none"}),this.$root.addClass("root button dropdown-toggle").attr("data-toggle","dropdown").tooltip({title:t.tooltip,placement:"bottom"}).off("click").on("click",function(e){o(".tooltip").hide(),e.preventDefault(),t.onclick&&t.onclick()}),this.$icon.removeClass().addClass("icon fa").addClass(t.icon),this.$title.removeClass().addClass("title").html(t.title),t.icon&&t.title&&this.$icon.addClass("ui-margin-right")},addMenu:function(e){var e=t.merge(e,{title:"",target:"",href:"",onclick:null,divider:!1,icon:null,cls:"button-menu btn-group"});this.$menu||(this.$menu=o("
'+t.content+"
"}});return{View:e}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(3),i(1))},function(t,e,i){var n,s;(function(i,a,o){n=[],s=function(){var t=i.Model.extend({defaults:{title:"",icon_class:"",on_click:null,menu_options:null,is_menu_button:!0,id:null,href:null,target:null,enabled:!0,visible:!0,tooltip_config:{}}}),e=i.View.extend({initialize:function(){this.model.attributes.tooltip_config={placement:"bottom"},this.model.bind("change",this.render,this)},render:function(){this.$el.tooltip("hide");var t=this.template(this.model.toJSON());return t.tooltip(this.model.get("tooltip_config")),this.$el.replaceWith(t),this.setElement(t),this},events:{click:"click"},click:function(t){return!a.isFunction(this.model.get("on_click"))||(this.model.get("on_click")(t),!1)},template:function(t){var e='title="'+t.title+'" class="icon-button';return t.is_menu_button&&(e+=" menu-button"),e+=" "+t.icon_class,t.enabled||(e+="_disabled"),e+='"',t.id&&(e+=' id="'+t.id+'"'),e+=' href="'+t.href+'"',t.target&&(e+=' target="'+t.target+'"'),t.visible||(e+=' style="display: none;"'),e=t.enabled?"":"",o(e)}}),n=i.Collection.extend({model:t}),s=i.View.extend({tagName:"div",initialize:function(){this.render()},render:function(){var t=this;return this.collection.each(function(e){var i=o("").attr("href","javascript:void(0)").attr("title",e.attributes.title).addClass("icon-button menu-button").addClass(e.attributes.icon_class).appendTo(t.$el).click(e.attributes.on_click);e.attributes.tooltip_config&&i.tooltip(e.attributes.tooltip_config);var n=e.get("options");n&&make_popupmenu(i,n)}),this}}),l=function(e,i){i||(i={});var o=new n(a.map(e,function(e){return new t(a.extend(e,i))}));return new s({collection:o})};return{IconButton:t,IconButtonView:e,IconButtonCollection:n,IconButtonMenuView:s,create_icon_buttons_menu:l}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(3),i(2),i(1))},function(t,e,i){var n,s,a;!function(o){s=[i(1)],n=o,a="function"==typeof n?n.apply(e,s):n,!(void 0!==a&&(t.exports=a))}(function(t){"use_strict";var e=t;e.fn.make_text_editable=function(t){var i="num_cols"in t?t.num_cols:30,n="num_rows"in t?t.num_rows:4,s="use_textarea"in t&&t.use_textarea,a="on_finish"in t?t.on_finish:null,o="help_text"in t?t.help_text:null,l=e(this);return l.addClass("editable-text").click(function(o){if(!(e(this).children(":input").length>0)){l.removeClass("editable-text");var r,c,d=function(t){l.find(":input").remove(),""!==t?l.text(t):l.html("
"),l.addClass("editable-text"),a&&a(t)},h="cur_text"in t?t.cur_text:l.text();s?(r=e("',"
","
"].join("")}});return{CitationView:n,CitationListView:s}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(3))},function(t,e,i){var n,s;(function(a,o,l){n=[i(42),i(32),i(6),i(5)],s=function(t,e,i,n){"use strict";var s=t.FoldoutListItemView,r=t.ListItemView,c=s.extend({className:s.prototype.className+" dataset-collection",id:function(){return["dataset_collection",this.model.get("id")].join("-")},initialize:function(t){this.linkTarget=t.linkTarget||"_blank",this.hasUser=t.hasUser,s.prototype.initialize.call(this,t)},_setUpListeners:function(){s.prototype._setUpListeners.call(this),this.listenTo(this.model,"change",function(t,e){a.has(t.changed,"deleted")?this.render():a.has(t.changed,"element_count")&&this.$("> .title-bar .subtitle").replaceWith(this._renderSubtitle())})},_renderSubtitle:function(){return o(this.templates.subtitle(this.model.toJSON(),this))},_getFoldoutPanelOptions:function(){var t=s.prototype._getFoldoutPanelOptions.call(this);return a.extend(t,{linkTarget:this.linkTarget,hasUser:this.hasUser})},$selector:function(){return this.$("> .selector")},toString:function(){var t=this.model?this.model+"":"(no model)";return"DCListItemView("+t+")"}});c.prototype.templates=function(){var t=a.extend({},s.prototype.templates.warnings,{error:i.wrapTemplate(["<% if( model.error ){ %>",'
',n("There was an error getting the data for this collection"),": <%- model.error %>","
","<% } %>"]),purged:i.wrapTemplate(["<% if( model.purged ){ %>",'
',n("This collection has been deleted and removed from disk"),"
","<% } %>"]),deleted:i.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
',n("This collection has been deleted"),"
","<% } %>"])}),e=i.wrapTemplate(['
','
','<%- collection.element_identifier || collection.name %>',"
",'
',"
"],"collection"),o=i.wrapTemplate(['
','<% var countText = collection.element_count? ( collection.element_count + " " ) : ""; %>','<% if( collection.collection_type === "list" ){ %>',n("a list of <%- countText %>datasets"),'<% } else if( collection.collection_type === "paired" ){ %>',n("a pair of datasets"),'<% } else if( collection.collection_type === "list:paired" ){ %>',n("a list of <%- countText %>dataset pairs"),'<% } else if( collection.collection_type === "list:list" ){ %>',n("a list of <%- countText %>dataset lists"),"<% } %>","
"],"collection");return a.extend({},s.prototype.templates,{warnings:t,titleBar:e,subtitle:o})}();var d=r.extend({className:r.prototype.className+" dataset-collection-element",initialize:function(t){t.logger&&(this.logger=this.model.logger=t.logger),this.log("DCEListItemView.initialize:",t),r.prototype.initialize.call(this,t)},toString:function(){var t=this.model?this.model+"":"(no model)";return"DCEListItemView("+t+")"}});d.prototype.templates=function(){var t=i.wrapTemplate(['
','
','<%- element.element_identifier %>',"
",'
',"
"],"element");return a.extend({},r.prototype.templates,{titleBar:t})}();var h=e.DatasetListItemView.extend({className:e.DatasetListItemView.prototype.className+" dataset-collection-element",initialize:function(t){t.logger&&(this.logger=this.model.logger=t.logger),this.log("DatasetDCEListItemView.initialize:",t),e.DatasetListItemView.prototype.initialize.call(this,t)},_fetchModelDetails:function(){var t=this;return t.model.inReadyState()&&!t.model.hasDetails()?t.model.fetch({silent:!0}):l.when()},toString:function(){var t=this.model?this.model+"":"(no model)";return"DatasetDCEListItemView("+t+")"}});h.prototype.templates=function(){var t=i.wrapTemplate(['
','','
','<%- element.element_identifier %>',"
","
"],"element");return a.extend({},e.DatasetListItemView.prototype.templates,{titleBar:t})}();var u=c.extend({className:c.prototype.className+" dataset-collection-element",_swapNewRender:function(t){c.prototype._swapNewRender.call(this,t);var e=this.model.get("state")||"ok";return this.$el.addClass("state-"+e),this.$el},toString:function(){var t=this.model?this.model+"":"(no model)";return"NestedDCDCEListItemView("+t+")"}});return{DCListItemView:c,DCEListItemView:d,DatasetDCEListItemView:h,NestedDCDCEListItemView:u}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(2),i(1),i(1))},function(t,e,i){var n,s;(function(a,o,l){n=[i(70),i(6),i(5)],s=function(t,e,i){"use strict";var n="collections",s={defaults:{model_class:"DatasetCollectionElement",element_identifier:null,element_index:null,element_type:null},_mergeObject:function(t){return a.extend(t,t.object,{element_id:t.id}),delete t.object,t},constructor:function(t,e){t=this._mergeObject(t),this.idAttribute="element_id",o.Model.apply(this,arguments)},parse:function(t,e){var i=t;return i=this._mergeObject(i)}},r=o.Model.extend(e.LoggableMixin).extend(s).extend({_logNamespace:n}),c=o.Collection.extend(e.LoggableMixin).extend({_logNamespace:n,model:r,initialize:function(t,e){this.debug(this+"(DCECollection).initialize:",t,e),e=e||{}},toString:function(){return["DatasetCollectionElementCollection(",this.length,")"].join("")}}),d=t.DatasetAssociation.extend(e.mixin(s,{url:function(){return this.has("history_id")?Galaxy.root+"api/histories/"+this.get("history_id")+"/contents/"+this.get("id"):(console.warn("no endpoint for non-hdas within a collection yet"),Galaxy.root+"api/datasets")},defaults:a.extend({},t.DatasetAssociation.prototype.defaults,s.defaults),constructor:function(t,e){this.debug("\t DatasetDCE.constructor:",t,e),s.constructor.call(this,t,e)},initialize:function(e,i){this.debug(this+"(DatasetDCE).initialize:",e,i),t.DatasetAssociation.prototype.initialize.call(this,e,i)},hasDetails:function(){return a.has(this.attributes,"annotation")},toString:function(){var t=this.get("element_identifier");return["DatasetDCE(",t,")"].join("")}})),h=c.extend({model:d,initialize:function(t,e){this.debug(this+"(DatasetDCECollection).initialize:",t,e),c.prototype.initialize.call(this,t,e)},toString:function(){return["DatasetDCECollection(",this.length,")"].join("")}}),u=o.Model.extend(e.LoggableMixin).extend(e.SearchableModelMixin).extend({_logNamespace:n,defaults:{collection_type:null,deleted:!1},collectionClass:c,initialize:function(t,e){this.debug(this+"(DatasetCollection).initialize:",t,e,this),this.elements=this._createElementsModel(),this.on("change:elements",function(){this.log("change:elements"),this.elements=this._createElementsModel()})},_createElementsModel:function(){this.debug(this+"._createElementsModel",this.collectionClass,this.get("elements"),this.elements);var t=this.get("elements")||[];return this.unset("elements",{silent:!0}),this.elements=new this.collectionClass(t),this.elements},toJSON:function(){var t=o.Model.prototype.toJSON.call(this);return this.elements&&(t.elements=this.elements.toJSON()),t},inReadyState:function(){var t=this.get("populated");return this.isDeletedOrPurged()||t},hasDetails:function(){return this.debug("hasDetails:",this.elements.length),0!==this.elements.length},getVisibleContents:function(t){return this.elements},"delete":function(t){return this.get("deleted")?l.when():this.save({deleted:!0},t)},undelete:function(t){return!this.get("deleted")||this.get("purged")?l.when():this.save({deleted:!1},t)},isDeletedOrPurged:function(){return this.get("deleted")||this.get("purged")},searchAttributes:["name"],toString:function(){var t=[this.get("id"),this.get("name")||this.get("element_identifier")];return"DatasetCollection("+t.join(",")+")"}}),p=u.extend({collectionClass:h,initialize:function(t,e){this.debug(this+"(ListDatasetCollection).initialize:",t,e),u.prototype.initialize.call(this,t,e)},toString:function(){return["ListDatasetCollection(",this.get("name"),")"].join("")}}),g=p.extend({initialize:function(t,e){this.debug(this+"(PairDatasetCollection).initialize:",t,e),p.prototype.initialize.call(this,t,e)},toString:function(){return["PairDatasetCollection(",this.get("name"),")"].join("")}}),f=u.extend(e.mixin(s,{constructor:function(t,e){this.debug("\t NestedDCDCE.constructor:",t,e),s.constructor.call(this,t,e)},toString:function(){var t=this.object?""+this.object:this.get("element_identifier");return["NestedDCDCE(",t,")"].join("")}})),m=c.extend({model:f,initialize:function(t,e){this.debug(this+"(NestedDCDCECollection).initialize:",t,e),c.prototype.initialize.call(this,t,e)},toString:function(){return["NestedDCDCECollection(",this.length,")"].join("")}}),v=g.extend(e.mixin(s,{constructor:function(t,e){this.debug("\t NestedPairDCDCE.constructor:",t,e),s.constructor.call(this,t,e)},toString:function(){var t=this.object?""+this.object:this.get("element_identifier");return["NestedPairDCDCE(",t,")"].join("")}})),_=m.extend({model:v,initialize:function(t,e){this.debug(this+"(NestedPairDCDCECollection).initialize:",t,e),m.prototype.initialize.call(this,t,e)},toString:function(){return["NestedPairDCDCECollection(",this.length,")"].join("")}}),y=u.extend({collectionClass:_,initialize:function(t,e){this.debug(this+"(ListPairedDatasetCollection).initialize:",t,e),u.prototype.initialize.call(this,t,e)},toString:function(){return["ListPairedDatasetCollection(",this.get("name"),")"].join("")}}),b=p.extend(e.mixin(s,{constructor:function(t,e){this.debug("\t NestedListDCDCE.constructor:",t,e),s.constructor.call(this,t,e)},toString:function(){var t=this.object?""+this.object:this.get("element_identifier");return["NestedListDCDCE(",t,")"].join("")}})),w=m.extend({model:b,toString:function(){return["NestedListDCDCECollection(",this.length,")"].join("")}}),x=u.extend({collectionClass:w,toString:function(){return["ListOfListsDatasetCollection(",this.get("name"),")"].join("")}});return{ListDatasetCollection:p,PairDatasetCollection:g,ListPairedDatasetCollection:y,ListOfListsDatasetCollection:x}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(2),i(3),i(1))},function(t,e,i){var n,s;(function(a,o,l,r){n=[i(39),i(10),i(6),i(8),i(84),i(5),i(81)],s=function(t,e,i,n,s,c){"use strict";function d(t){var e=t.toJSON(),i=f(e,{creationFn:function(e,i){return e=e.map(function(t){return{id:t.id,name:t.name,src:"dataset"===t.history_content_type?"hda":"hdca"}}),t.createHDCA(e,"list",i)}});return i}var h="collections",u=a.View.extend(i.LoggableMixin).extend({_logNamespace:h,tagName:"li",className:"collection-element",initialize:function(t){this.element=t.element||{},this.selected=t.selected||!1},render:function(){return this.$el.attr("data-element-id",this.element.id).attr("draggable",!0).html(this.template({element:this.element})),this.selected&&this.$el.addClass("selected"),this},template:o.template(['
',"<%- element.name %>","",'"].join("")),select:function(t){this.$el.toggleClass("selected",t),this.trigger("select",{source:this,selected:this.$el.hasClass("selected")})},discard:function(){var t=this,e=this.$el.parent().width();this.$el.animate({"margin-right":e},"fast",function(){t.trigger("discard",{source:t}),t.destroy()})},destroy:function(){this.off(),this.$el.remove()},events:{click:"_click","click .name":"_clickName","click .discard":"_clickDiscard",dragstart:"_dragstart",dragend:"_dragend",dragover:"_sendToParent",drop:"_sendToParent"},_click:function(t){t.stopPropagation(),this.select(t)},_clickName:function(t){t.stopPropagation(),t.preventDefault();var e=([c("Enter a new name for the element"),":\n(",c("Note that changing the name here will not rename the dataset"),")"].join(""),prompt(c("Enter a new name for the element")+":",this.element.name));e&&(this.element.name=e,this.render())},_clickDiscard:function(t){t.stopPropagation(),this.discard()},_dragstart:function(t){t.originalEvent&&(t=t.originalEvent),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",JSON.stringify(this.element)),this.$el.addClass("dragging"),this.$el.parent().trigger("collection-element.dragstart",[this])},_dragend:function(t){this.$el.removeClass("dragging"),this.$el.parent().trigger("collection-element.dragend",[this])},_sendToParent:function(t){this.$el.parent().trigger(t)},toString:function(){return"DatasetCollectionElementView()"}}),p=a.View.extend(i.LoggableMixin).extend({_logNamespace:h,elementViewClass:u,collectionClass:t.HistoryListDatasetCollection,className:"list-collection-creator collection-creator flex-row-container",minElements:1,defaultAttributes:{creationFn:function(){throw new TypeError("no creation fn for creator")},oncreate:function(){},oncancel:function(){},autoscrollDist:24,highlightClr:"rgba( 64, 255, 255, 1.0 )"},initialize:function(t){this.metric("ListCollectionCreator.initialize",t);var e=this;o.each(this.defaultAttributes,function(i,n){i=t[n]||i,e[n]=i}),e.initialElements=t.elements||[],this._instanceSetUp(),this._elementsSetUp(),this._setUpBehaviors()},_instanceSetUp:function(){this.selectedIds={},this.$dragging=null,this.blocking=!1},_elementsSetUp:function(){this.invalidElements=[],this.workingElements=[],this.elementViews=[],this.workingElements=this.initialElements.slice(0),this._ensureElementIds(),this._validateElements(),this._mangleDuplicateNames(),this._sortElements()},_ensureElementIds:function(){return this.workingElements.forEach(function(t){t.hasOwnProperty("id")||(t.id=o.uniqueId())}),this.workingElements},_validateElements:function(){var t=this;return t.invalidElements=[],this.workingElements=this.workingElements.filter(function(e){var i=t._isElementInvalid(e);return i&&t.invalidElements.push({element:e,text:i}),!i}),this.workingElements},_isElementInvalid:function(t){return"dataset"!==t.history_content_type?c("is not a dataset"):t.state!==e.OK?c(o.contains(e.NOT_READY_STATES,t.state)?"hasn't finished running yet":"has errored, is paused, or is not accessible"):t.deleted||t.purged?c("has been deleted or purged"):null},_mangleDuplicateNames:function(){var t=900,e=1,i={};this.workingElements.forEach(function(n){for(var s=n.name;i.hasOwnProperty(s);)if(s=n.name+" ("+e+")",e+=1,e>=t)throw new Error("Safety hit in while loop - thats impressive");n.name=s,i[n.name]=!0})},_sortElements:function(t){},render:function(t,e){return this.workingElements.length .clear-selected").show():this.$(".collection-elements-controls > .clear-selected").hide()},_renderList:function(t,e){var i=this,n=r("
"),s=i.$list();o.each(this.elementViews,function(t){t.destroy(),i.removeElementView(t)}),i.workingElements.forEach(function(t){var e=i._createElementView(t);n.append(e.$el)}),i._renderClearSelected(),s.empty().append(n.children()),o.invoke(i.elementViews,"render"),s.height()>s.css("max-height")?s.css("border-width","1px 0px 1px 0px"):s.css("border-width","0px")},_createElementView:function(t){var e=new this.elementViewClass({element:t,selected:o.has(this.selectedIds,t.id)});return this.elementViews.push(e),this._listenToElementView(e),e},_listenToElementView:function(t){var e=this;e.listenTo(t,{select:function(t){var i=t.source.element;t.selected?e.selectedIds[i.id]=!0:delete e.selectedIds[i.id],e.trigger("elements:select",t)},discard:function(t){e.trigger("elements:discard",t)}})},addElementView:function(t){},removeElementView:function(t){delete this.selectedIds[t.element.id],this._renderClearSelected(),this.elementViews=o.without(this.elementViews,t),this.stopListening(t)},_renderNoElementsLeft:function(){this._disableNameAndCreate(!0),this.$(".collection-elements").append(this.templates.noElementsLeft())},_elementToJSON:function(t){return t},createList:function(t){if(!this.workingElements.length){var e=c("No valid elements for final list")+". ";return e+=''+c("Cancel")+" ",e+=c("or"),e+=' '+c("start over")+".",void this._showAlert(e)}var i=this,n=this.workingElements.map(function(t){return i._elementToJSON(t)});return i.blocking=!0,i.creationFn(n,t).always(function(){i.blocking=!1}).fail(function(t,e,n){i.trigger("error",{xhr:t,status:e,message:c("An error occurred while creating this collection")})}).done(function(t,e,n){i.trigger("collection:created",t,e,n),i.metric("collection:created",t),"function"==typeof i.oncreate&&i.oncreate.call(this,t,e,n)})},_setUpBehaviors:function(){return this.on("error",this._errorHandler),this.once("rendered",function(){this.trigger("rendered:initial",this)}),this.on("elements:select",function(t){this._renderClearSelected()}),this.on("elements:discard",function(t){var e=t.source.element;this.removeElementView(t.source),this.workingElements=o.without(this.workingElements,e),this.workingElements.length||this._renderNoElementsLeft()}),this},_errorHandler:function(t){this.error(t);var e=this;if(content=t.message||c("An error occurred"),t.xhr){var i=t.xhr,n=t.message;0===i.readyState&&0===i.status?content+=": "+c("Galaxy could not be reached and may be updating.")+c(" Try again in a few minutes."):i.responseJSON?content+=":
"+JSON.stringify(i.responseJSON)+"
":content+=": "+n}e._showAlert(content,"alert-danger")},events:{"click .more-help":"_clickMoreHelp","click .less-help":"_clickLessHelp","click .main-help":"_toggleHelp","click .header .alert button":"_hideAlert","click .reset":"reset","click .clear-selected":"clearSelectedElements","click .collection-elements":"clearSelectedElements","dragover .collection-elements":"_dragoverElements","drop .collection-elements":"_dropElements","collection-element.dragstart .collection-elements":"_elementDragstart","collection-element.dragend .collection-elements":"_elementDragend","change .collection-name":"_changeName","keydown .collection-name":"_nameCheckForEnter","click .cancel-create":function(t){"function"==typeof this.oncancel&&this.oncancel.call(this)},"click .create-collection":"_clickCreate"},_clickMoreHelp:function(t){t.stopPropagation(),this.$(".main-help").addClass("expanded"),this.$(".more-help").hide()},_clickLessHelp:function(t){t.stopPropagation(),this.$(".main-help").removeClass("expanded"),this.$(".more-help").show()},_toggleHelp:function(t){t.stopPropagation(),this.$(".main-help").toggleClass("expanded"),this.$(".more-help").toggle()},_showAlert:function(t,e){e=e||"alert-danger",this.$(".main-help").hide(),this.$(".header .alert").attr("class","alert alert-dismissable").addClass(e).show().find(".alert-message").html(t)},_hideAlert:function(t){this.$(".main-help").show(),this.$(".header .alert").hide()},reset:function(){this._instanceSetUp(),this._elementsSetUp(),this.render()},clearSelectedElements:function(t){this.$(".collection-elements .collection-element").removeClass("selected"),this.$(".collection-elements-controls > .clear-selected").hide()},_dragoverElements:function(t){t.preventDefault();var e=this.$list();this._checkForAutoscroll(e,t.originalEvent.clientY);var i=this._getNearestElement(t.originalEvent.clientY);this.$(".element-drop-placeholder").remove();var n=l('
');i.length?i.before(n):e.append(n)},_checkForAutoscroll:function(t,e){var i=2,n=t.offset(),s=t.scrollTop(),a=e-n.top,o=n.top+t.outerHeight()-e;a>=0&&a=0&&ot&&a-o
','
',''].join("")),header:o.template(['",'
','','',"
"].join("")),middle:o.template(['",'
',"
"].join("")),footer:o.template(['
','
','','
',c("Name"),":
","
","
",'
','
','",'
','",'","
","
",'
','","
","
"].join("")),helpContent:o.template(["

",c(["Collections of datasets are permanent, ordered lists of datasets that can be passed to tools and ","workflows in order to have analyses done on each member of the entire group. This interface allows ","you to create a collection and re-order the final collection."].join("")),"

","
    ","
  • ",c(["Rename elements in the list by clicking on ",'the existing name.'].join("")),"
  • ","
  • ",c(["Discard elements from the final created list by clicking on the ",'"Discard" button.'].join("")),"
  • ","
  • ",c(["Reorder the list by clicking and dragging elements. Select multiple elements by clicking on ",'them and you can then move those selected by dragging the ',"entire group. Deselect them by clicking them again or by clicking the ",'the "Clear selected" link.'].join("")),"
  • ","
  • ",c(['Click the "Start over" link to begin again as if you had just opened ',"the interface."].join("")),"
  • ","
  • ",c(['Click the "Cancel" button to exit the interface.'].join("")),"
  • ","

","

",c(['Once your collection is complete, enter a name and ','click "Create list".'].join("")),"

"].join("")),invalidElements:o.template([c("The following selections could not be included due to problems:"),"
    <% _.each( problems, function( problem ){ %>","
  • <%- problem.element.name %>: <%- problem.text %>
  • ","<% }); %>
"].join("")),noElementsLeft:o.template(['
  • ',c("No elements left! "),c("Would you like to "),'',c("start over"),"?","
  • "].join("")),invalidInitial:o.template(['
    ','
    ','',"<% if( _.size( problems ) ){ %>",c("The following selections could not be included due to problems"),":","
      <% _.each( problems, function( problem ){ %>","
    • <%- problem.element.name %>: <%- problem.text %>
    • ","<% }); %>
    ","<% } else if( _.size( elements ) < 1 ){ %>",c("No datasets were selected"),".","<% } %>","
    ",c("At least one element is needed for the collection"),". ",c("You may need to "),'',c("cancel")," ",c("and reselect new elements"),".","
    ","
    ","
    ",'"].join(""))},toString:function(){return"ListCollectionCreator"}}),g=function(t,e,i){var s,a=r.Deferred(),l=Galaxy.modal||new n.View;return e=o.defaults(e||{},{elements:t,oncancel:function(){l.hide(),a.reject("cancelled"); -},oncreate:function(t,e){l.hide(),a.resolve(e)}}),s=new i(e),l.show({title:e.title||c("Create a collection"),body:s.$el,width:"80%",height:"100%",closing_events:!0}),s.render(),window._collectionCreator=s,a},f=function(t,e){return e=e||{},e.title=c("Create a collection from a list of datasets"),g(t,e,p)};return{DatasetCollectionElementView:u,ListCollectionCreator:p,collectionCreatorModal:g,listCollectionCreatorModal:f,createListCollection:d}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(3),i(2),i(1),i(1))},function(t,e,i){var n,s;(function(a,o,l,r){n=[i(42),i(10),i(23),i(6),i(5)],s=function(t,e,i,n,s){"use strict";var c="dataset",d=t.ListItemView,h=d.extend({_logNamespace:c,className:d.prototype.className+" dataset",id:function(){return["dataset",this.model.get("id")].join("-")},initialize:function(t){t.logger&&(this.logger=this.model.logger=t.logger),this.log(this+".initialize:",t),d.prototype.initialize.call(this,t),this.linkTarget=t.linkTarget||"_blank"},_setUpListeners:function(){d.prototype._setUpListeners.call(this),this.listenTo(this.model,"change",function(t,e){this.model.changedAttributes().state&&this.model.inReadyState()&&this.expanded&&!this.model.hasDetails()?this.model.fetch():this.render()})},_fetchModelDetails:function(){var t=this;return t.model.inReadyState()&&!t.model.hasDetails()?t.model.fetch({silent:!0}):a.when()},remove:function(t,e){var i=this;t=t||this.fxSpeed,this.$el.fadeOut(t,function(){o.View.prototype.remove.call(i),e&&e.call(i)})},render:function(t){return d.prototype.render.call(this,t)},_swapNewRender:function(t){return d.prototype._swapNewRender.call(this,t),this.model.has("state")&&this.$el.addClass("state-"+this.model.get("state")),this.$el},_renderPrimaryActions:function(){return[this._renderDisplayButton()]},_renderDisplayButton:function(){var t=this.model.get("state");if(t===e.NOT_VIEWABLE||t===e.DISCARDED||!this.model.get("accessible"))return null;var n={target:this.linkTarget,classes:"display-btn"};if(this.model.get("purged"))n.disabled=!0,n.title=s("Cannot display datasets removed from disk");else if(t===e.UPLOAD)n.disabled=!0,n.title=s("This dataset must finish uploading before it can be viewed");else if(t===e.NEW)n.disabled=!0,n.title=s("This dataset is not yet viewable");else{n.title=s("View data"),n.href=this.model.urls.display;var a=this;n.onclick=function(t){Galaxy.frame&&Galaxy.frame.active&&(Galaxy.frame.addDataset(a.model.get("id")),t.preventDefault())}}return n.faIcon="fa-eye",i(n)},_renderDetails:function(){if(this.model.get("state")===e.NOT_VIEWABLE)return l(this.templates.noAccess(this.model.toJSON(),this));var t=d.prototype._renderDetails.call(this);return t.find(".actions .left").empty().append(this._renderSecondaryActions()),t.find(".summary").html(this._renderSummary()).prepend(this._renderDetailMessages()),t.find(".display-applications").html(this._renderDisplayApplications()),this._setUpBehaviors(t),t},_renderSummary:function(){var t=this.model.toJSON(),e=this.templates.summaries[t.state];return(e=e||this.templates.summaries.unknown)(t,this)},_renderDetailMessages:function(){var t=this,e=l('
    '),i=t.model.toJSON();return r.each(t.templates.detailMessages,function(n){e.append(l(n(i,t)))}),e},_renderDisplayApplications:function(){return this.model.isDeletedOrPurged()?"":[this.templates.displayApplications(this.model.get("display_apps"),this),this.templates.displayApplications(this.model.get("display_types"),this)].join("")},_renderSecondaryActions:function(){switch(this.debug("_renderSecondaryActions"),this.model.get("state")){case e.NOT_VIEWABLE:return[];case e.OK:case e.FAILED_METADATA:case e.ERROR:return[this._renderDownloadButton(),this._renderShowParamsButton()]}return[this._renderShowParamsButton()]},_renderShowParamsButton:function(){return i({title:s("View details"),classes:"params-btn",href:this.model.urls.show_params,target:this.linkTarget,faIcon:"fa-info-circle"})},_renderDownloadButton:function(){return this.model.get("purged")||!this.model.hasData()?null:r.isEmpty(this.model.get("meta_files"))?l(['','',""].join("")):this._renderMetaFileDownloadButton()},_renderMetaFileDownloadButton:function(){var t=this.model.urls;return l(['"].join("\n"))},events:r.extend(r.clone(d.prototype.events),{"click .display-btn":function(t){this.trigger("display",this,t)},"click .params-btn":function(t){this.trigger("params",this,t)},"click .download-btn":function(t){this.trigger("download",this,t)}}),toString:function(){var t=this.model?this.model+"":"(no model)";return"DatasetListItemView("+t+")"}});return h.prototype.templates=function(){var t=r.extend({},d.prototype.templates.warnings,{failed_metadata:n.wrapTemplate(['<% if( model.state === "failed_metadata" ){ %>','
    ',s("An error occurred setting the metadata for this dataset"),"
    ","<% } %>"]),error:n.wrapTemplate(["<% if( model.error ){ %>",'
    ',s("There was an error getting the data for this dataset"),": <%- model.error %>","
    ","<% } %>"]),purged:n.wrapTemplate(["<% if( model.purged ){ %>",'
    ',s("This dataset has been deleted and removed from disk"),"
    ","<% } %>"]),deleted:n.wrapTemplate(["<% if( model.deleted && !model.purged ){ %>",'
    ',s("This dataset has been deleted"),"
    ","<% } %>"])}),i=n.wrapTemplate(['
    ','
    ','
    ','
    ','
    ',"
    ","<% if( !dataset.deleted && !dataset.purged ){ %>",'
    ','
    ','
    ',"<% if( dataset.peek ){ %>",'
    <%= dataset.peek %>
    ',"<% } %>","<% } %>","
    "],"dataset"),a=n.wrapTemplate(['
    ','
    ',s("You do not have permission to view this dataset"),"
    ","
    "],"dataset"),o={};o[e.OK]=o[e.FAILED_METADATA]=n.wrapTemplate(["<% if( dataset.misc_blurb ){ %>",'
    ','<%- dataset.misc_blurb %>',"
    ","<% } %>","<% if( dataset.file_ext ){ %>",'
    ','",'<%- dataset.file_ext %>',"
    ","<% } %>","<% if( dataset.metadata_dbkey ){ %>",'
    ','",'',"<%- dataset.metadata_dbkey %>","","
    ","<% } %>","<% if( dataset.misc_info ){ %>",'
    ','<%- dataset.misc_info %>',"
    ","<% } %>"],"dataset"),o[e.NEW]=n.wrapTemplate(["
    ",s("This is a new dataset and not all of its data are available yet"),"
    "],"dataset"),o[e.NOT_VIEWABLE]=n.wrapTemplate(["
    ",s("You do not have permission to view this dataset"),"
    "],"dataset"),o[e.DISCARDED]=n.wrapTemplate(["
    ",s("The job creating this dataset was cancelled before completion"),"
    "],"dataset"),o[e.QUEUED]=n.wrapTemplate(["
    ",s("This job is waiting to run"),"
    "],"dataset"),o[e.RUNNING]=n.wrapTemplate(["
    ",s("This job is currently running"),"
    "],"dataset"),o[e.UPLOAD]=n.wrapTemplate(["
    ",s("This dataset is currently uploading"),"
    "],"dataset"),o[e.SETTING_METADATA]=n.wrapTemplate(["
    ",s("Metadata is being auto-detected"),"
    "],"dataset"),o[e.PAUSED]=n.wrapTemplate(["
    ",s('This job is paused. Use the "Resume Paused Jobs" in the history menu to resume'),"
    "],"dataset"),o[e.ERROR]=n.wrapTemplate(["<% if( !dataset.purged ){ %>","
    <%- dataset.misc_blurb %>
    ","<% } %>",'',s("An error occurred with this dataset"),":",'
    <%- dataset.misc_info %>
    '],"dataset"),o[e.EMPTY]=n.wrapTemplate(["
    ",s("No data"),": <%- dataset.misc_blurb %>
    "],"dataset"),o.unknown=n.wrapTemplate(['
    Error: unknown dataset state: "<%- dataset.state %>"
    '],"dataset");var l={resubmitted:n.wrapTemplate(["<% if( model.resubmitted ){ %>",'
    ',s("The job creating this dataset has been resubmitted"),"
    ","<% } %>"])},c=n.wrapTemplate(["<% _.each( apps, function( app ){ %>",'
    ','<%- app.label %> ','',"<% _.each( app.links, function( link ){ %>",'',"<% print( _l( link.text ) ); %>"," ","<% }); %>","","
    ","<% }); %>"],"apps");return r.extend({},d.prototype.templates,{warnings:t,details:i,noAccess:a,summaries:o,detailMessages:l,displayApplications:c})}(),{DatasetListItemView:h}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(1),i(3),i(1),i(2))},function(t,e,i){var n,s;(function(a,o,l){n=[i(4)],s=function(t){var e=a.Model.extend({initialize:function(t){this.app=t},checksum:function(){var t="",e=this;return this.app.section.$el.find(".section-row").each(function(){var i=o(this).attr("id"),n=e.app.field_list[i];n&&(t+=i+":"+JSON.stringify(n.value&&n.value())+":"+n.collapsed+";")}),t},set:function(t){for(var e in t.attributes){var i=this.match(e);i&&this.app.field_list[i].value(t.get(e))}},create:function(){function t(t,e,i){n.flat_dict[t]=e,a[t]=i,n.app.element_list[e]&&n.app.element_list[e].$el.attr("tour_id",t)}function e(s,a){for(var o in a){var l=a[o];if(l.input){var r=l.input,c=s;switch(""!=s&&(c+="|"),c+=r.name,r.type){case"repeat":var d="section-",h=[],u=null;for(var p in l){var g=p.indexOf(d);g!=-1&&(g+=d.length,h.push(parseInt(p.substr(g))),u||(u=p.substr(0,g)))}h.sort(function(t,e){return t-e});var o=0;for(var f in h)e(c+"_"+o++,l[u+h[f]]);break;case"conditional":var m=n.app.field_list[r.id].value();t(c+"|"+r.test_param.name,r.id,m);var v=i(r,m);v!=-1&&e(c,a[r.id+"-section-"+v]);break;case"section":e(!r.flat&&c||"",l);break;default:var _=n.app.field_list[r.id];if(_&&_.value){var m=_.value();if((void 0===r.ignore||r.ignore!=m)&&(_.collapsed&&r.collapsible_value&&(m=r.collapsible_value),t(c,r.id,m),r.payload))for(var y in r.payload)t(y,r.id,r.payload[y])}}}}}var n=this,s={};this._iterate(this.app.section.$el,s);var a={};return this.flat_dict={},e("",s),a},match:function(t){return this.flat_dict&&this.flat_dict[t]},matchCase:function(t,e){return i(t,e)},matchModel:function(t,e){var i=this;n(t.inputs,function(t,n){i.flat_dict[n]&&e(t,i.flat_dict[n])})},matchResponse:function(t){function e(t,s){if("string"==typeof s){var a=n.flat_dict[t];a&&(i[a]=s)}else for(var o in s){var l=o;if(""!==t){var r="|";s instanceof Array&&(r="_"),l=t+r+l}e(l,s[o])}}var i={},n=this;return e("",t),i},_iterate:function(t,e){var i=this,n=o(t).children();n.each(function(){var t=this,n=o(t).attr("id");if(o(t).hasClass("section-row")){var s=i.app.input_list[n];e[n]=s&&{input:s}||{},i._iterate(t,e[n])}else i._iterate(t,e)})}}),i=function(t,e){"boolean"==t.test_param.type&&(e="true"==e?t.test_param.truevalue||"true":t.test_param.falsevalue||"false");for(var i in t.cases)if(t.cases[i].value==e)return i;return-1},n=function(t,e,s,a){a=o.extend(!0,{},a),l.each(t,function(t){t&&t.type&&t.name&&(a[t.name]=t)});for(var r in t){var c=t[r],d=s?s+"|"+c.name:c.name;switch(c.type){case"repeat":l.each(c.cache,function(t,i){n(t,e,d+"_"+i,a)});break;case"conditional":if(c.test_param){e(c.test_param,d+"|"+c.test_param.name,a);var h=i(c,c.test_param.value);h!=-1?n(c.cases[h].inputs,e,d,a):Galaxy.emit.debug("form-data::visitInputs() - Invalid case for "+d+".")}else Galaxy.emit.debug("form-data::visitInputs() - Conditional test parameter missing for "+d+".");break;case"section":n(c.inputs,e,d,a);break;default:e(c,d,a)}}};return{Manager:e,visitInputs:n}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(3),i(1),i(2))},function(t,e,i){var n,s;(function(i,a,o){n=[],s=function(){return i.View.extend({initialize:function(t,e){this.app=t,this.app_options=t.options||{},this.field=e&&e.field||new i.View,this.model=e&&e.model||new i.Model({text_enable:this.app_options.text_enable||"Enable",text_disable:this.app_options.text_disable||"Disable",cls_enable:this.app_options.cls_enable||"fa fa-caret-square-o-down",cls_disable:this.app_options.cls_disable||"fa fa-caret-square-o-up"}).set(e),this.setElement(this._template()),this.$field=this.$(".ui-form-field"),this.$info=this.$(".ui-form-info"),this.$preview=this.$(".ui-form-preview"),this.$collapsible=this.$(".ui-form-collapsible"),this.$collapsible_text=this.$(".ui-form-collapsible-text"),this.$collapsible_icon=this.$(".ui-form-collapsible-icon"),this.$title=this.$(".ui-form-title"),this.$title_text=this.$(".ui-form-title-text"),this.$error_text=this.$(".ui-form-error-text"),this.$error=this.$(".ui-form-error"),this.$backdrop=this.$(".ui-form-backdrop"),this.$field.prepend(this.field.$el);var n=this.model.get("collapsible_value");this.field.collapsed=void 0!==n&&JSON.stringify(this.model.get("value"))==JSON.stringify(n),this.listenTo(this.model,"change",this.render,this),this.render();var s=this;this.$collapsible.on("click",function(){s.field.collapsed=!s.field.collapsed,t.trigger&&t.trigger("change"),s.render()})},backdrop:function(){this.model.set("backdrop",!0)},error:function(t){this.model.set("error_text",t)},reset:function(){this.model.set("error_text",null)},render:function(){a(".tooltip").hide();var t=this.model.get("help",""),e=this.model.get("argument");e&&t.indexOf("("+e+")")==-1&&(t+=" ("+e+")"),this.$info.html(t),this.$preview[this.field.collapsed&&this.model.get("collapsible_preview")||this.model.get("disabled")?"show":"hide"]().html(o.escape(this.model.get("text_value")));var i=this.model.get("error_text");if(this.$error[i?"show":"hide"](),this.$el[i?"addClass":"removeClass"]("ui-error"),this.$error_text.html(i),this.$backdrop[this.model.get("backdrop")?"show":"hide"](),this.field.collapsed||this.model.get("disabled")?this.$field.hide():this.$field.fadeIn("fast"),this.field.model&&this.field.model.set({color:this.model.get("color"),style:this.model.get("style")}),this.model.get("disabled")||void 0===this.model.get("collapsible_value"))this.$title_text.show().text(this.model.get("label")),this.$collapsible.hide();else{var n=this.field.collapsed?"enable":"disable";this.$title_text.hide(),this.$collapsible.show(),this.$collapsible_text.text(this.model.get("label")),this.$collapsible_icon.removeClass().addClass("icon").addClass(this.model.get("cls_"+n)).attr("data-original-title",this.model.get("text_"+n)).tooltip({placement:"bottom"})}},_template:function(){return a("
    ").addClass("ui-form-element").append(a("
    ").addClass("ui-form-error ui-error").append(a("").addClass("fa fa-arrow-down")).append(a("").addClass("ui-form-error-text"))).append(a("
    ").addClass("ui-form-title").append(a("
    ").addClass("ui-form-collapsible").append(a("").addClass("ui-form-collapsible-icon")).append(a("").addClass("ui-form-collapsible-text"))).append(a("").addClass("ui-form-title-text"))).append(a("
    ").addClass("ui-form-field").append(a("").addClass("ui-form-info")).append(a("
    ").addClass("ui-form-backdrop"))).append(a("
    ").addClass("ui-form-preview"))}})}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(3),i(1),i(2))},function(t,e,i){var n,s;(function(a,o,l){n=[i(4),i(7),i(49),i(51),i(50),i(47)],s=function(t,e,i,n,s,r){return a.Model.extend({types:{text:"_fieldText",select:"_fieldSelect",data_column:"_fieldSelect",genomebuild:"_fieldSelect",data:"_fieldData",data_collection:"_fieldData",integer:"_fieldSlider","float":"_fieldSlider","boolean":"_fieldBoolean",drill_down:"_fieldDrilldown",color:"_fieldColor",hidden:"_fieldHidden",hidden_data:"_fieldHidden",baseurl:"_fieldHidden",library_data:"_fieldLibrary",ftpfile:"_fieldFtp"},create:function(t){var e=this.types[t.type],i="function"==typeof this[e]?this[e].call(this,t):null;return i||(i=t.options?this._fieldSelect(t):this._fieldText(t),Galaxy.emit.debug("form-parameters::_addRow()","Auto matched field type ("+t.type+").")),void 0===t.value&&(t.value=null),i.value(t.value),i},_fieldData:function(t){return new i.View({id:"field-"+t.id,extensions:t.extensions,optional:t.optional,multiple:t.multiple,type:t.type,flavor:t.flavor,data:t.options,onchange:t.onchange})},_fieldSelect:function(t){if(t.is_workflow)return this._fieldText(t);"data_column"==t.type&&(t.error_text="Missing columns in referenced dataset.");var i=t.data;i||(i=[],o.each(t.options,function(t){i.push({label:t[0],value:t[1]})}));var n=e.Select;switch(t.display){case"checkboxes":n=e.Checkbox;break;case"radio":n=e.Radio;break;case"radiobutton":n=e.RadioButton}return new n.View({id:"field-"+t.id,data:i,error_text:t.error_text||"No options available",multiple:t.multiple,optional:t.optional,onchange:t.onchange})},_fieldDrilldown:function(t){return t.is_workflow?this._fieldText(t):new e.Drilldown.View({id:"field-"+t.id,data:t.options,display:t.display,optional:t.optional,onchange:t.onchange})},_fieldText:function(i){if(i.options&&i.data)if(i.area=i.multiple,t.isEmpty(i.value))i.value=null;else if(l.isArray(i.value)){var n="";for(var s in i.value){if(n+=String(i.value[s]),!i.multiple)break;n+="\n"}i.value=n}return new e.Input({id:"field-"+i.id,area:i.area,placeholder:i.placeholder,onchange:i.onchange})},_fieldSlider:function(t){return new e.Slider.View({id:"field-"+t.id,precise:"float"==t.type,is_workflow:t.is_workflow,min:t.min,max:t.max,onchange:t.onchange})},_fieldHidden:function(t){return new e.Hidden({id:"field-"+t.id,info:t.info})},_fieldBoolean:function(t){return new e.RadioButton.View({id:"field-"+t.id,data:[{label:"Yes",value:"true"},{label:"No",value:"false"}],onchange:t.onchange})},_fieldColor:function(t){return new r({id:"field-"+t.id,onchange:t.onchange})},_fieldLibrary:function(t){return new n.View({id:"field-"+t.id,optional:t.optional,multiple:t.multiple,onchange:t.onchange})},_fieldFtp:function(t){return new s.View({id:"field-"+t.id,optional:t.optional,multiple:t.multiple,onchange:t.onchange})}})}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(3),i(2),i(1))},function(t,e,i){var n,s;(function(a,o,l){n=[i(4),i(14),i(9),i(7)],s=function(t,e,i,n){var s=a.View.extend({initialize:function(i){this.options=t.merge(i,{title:"Section",empty_text:"Not available.",max:null,min:null}),this.setElement("
    "),this.button_new=new n.ButtonIcon({icon:"fa-plus",title:"Insert "+this.options.title_new,tooltip:"Add new "+this.options.title_new+" block",floating:"clear",onclick:function(){i.onnew&&i.onnew()}}),this.table=new e.View({cls:"ui-table-plain",content:""}),this.$el.append(this.table.$el),this.$el.append(o("
    ").append(this.button_new.$el)),this.list={},this.n=0},size:function(){return this.n},add:function(t){if(!t.id||this.list[t.id])return void Galaxy.emit.debug("form-repeat::add()","Duplicate repeat block id.");this.n++;var e=new n.ButtonIcon({icon:"fa-trash-o",tooltip:"Delete this repeat block",cls:"ui-button-icon-plain",onclick:function(){t.ondel&&t.ondel()}}),s=new i.View({id:t.id,title:"placeholder",cls:t.cls||"ui-portlet-repeat",operations:{button_delete:e}});s.append(t.$el),s.$el.addClass("section-row"),this.list[t.id]=s,this.table.add(s.$el),this.table.append("row_"+t.id,!0),this.options.max>0&&this.n>=this.options.max&&this.button_new.disable(),this._refresh()},del:function(t){if(!this.list[t])return void Galaxy.emit.debug("form-repeat::del()","Invalid repeat block id.");this.n--;var e=this.table.get("row_"+t);e.remove(),delete this.list[t],this.button_new.enable(),this._refresh()},delAll:function(){for(var t in this.list)this.del(t)},hideOptions:function(){this.button_new.$el.hide(),l.each(this.list,function(t){t.hideOperation("button_delete")}),l.isEmpty(this.list)&&this.$el.append(o("
    ").addClass("ui-form-info").html(this.options.empty_text))},_refresh:function(){var t=0;for(var e in this.list){var i=this.list[e];i.title(++t+": "+this.options.title),this.n>this.options.min?i.showOperation("button_delete"):i.hideOperation("button_delete")}}});return{View:s}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(3),i(1),i(2))},function(t,e,i){var n,s;(function(a,o,l,r){n=[i(4),i(14),i(7),i(9),i(36),i(34),i(35)],s=function(t,e,i,n,s,c,d){var h=a.View.extend({initialize:function(t,i){this.app=t,this.inputs=i.inputs,i.cls="ui-table-plain",i.cls_tr="section-row",this.table=new e.View(i),this.parameters=new d,this.setElement(this.table.$el),this.render()},render:function(){this.table.delAll();for(var t in this.inputs)this.add(this.inputs[t])},add:function(e){var i=o.extend(!0,{},e);i.id=e.id=t.uid(),this.app.input_list[i.id]=i;var n=i.type;switch(n){case"conditional":this._addConditional(i);break;case"repeat":this._addRepeat(i);break;case"section":this._addSection(i);break;default:this._addRow(i)}},_addConditional:function(t){var e=this;t.test_param.id=t.id,this.app.options.sustain_conditionals&&(t.test_param.disabled=!0);var i=this._addRow(t.test_param);i.model&&i.model.set("onchange",function(i){var n=e.app.data.matchCase(t,i);for(var s in t.cases){var a=t.cases[s],o=t.id+"-section-"+s,l=e.table.get(o),r=!1;for(var c in a.inputs)if(!a.inputs[c].hidden){r=!0;break}s==n&&r?l.fadeIn("fast"):l.hide()}e.app.trigger("change")});for(var n in t.cases){var s=t.id+"-section-"+n,a=new h(this.app,{inputs:t.cases[n].inputs});a.$el.addClass("ui-table-section"),this.table.add(a.$el),this.table.append(s)}i.trigger("change")},_addRepeat:function(t){function e(e){var s=t.id+"-section-"+n++,o=new h(i.app,{inputs:e});a.add({id:s,$el:o.$el,ondel:function(){a.del(s),i.app.trigger("change")}})}for(var i=this,n=0,a=new s.View({title:t.title||"Repeat",title_new:t.title||"",min:t.min,max:t.max,onnew:function(){e(t.inputs),i.app.trigger("change")}}),o=l.size(t.cache),r=0;r").addClass("ui-form-info").html(t.help)),this.app.on("expand",function(t){e.$("#"+t).length>0&&e.expand()}),this.table.add(e.$el),this.table.append(t.id)},_addRow:function(t){var e=this,i=t.id;t.onchange=function(){e.app.trigger("change")};var n=this.parameters.create(t);this.app.field_list[i]=n;var s=new c(this.app,{name:t.name,label:t.label||t.name,value:t.value,text_value:t.text_value,collapsible_value:t.collapsible_value,collapsible_preview:t.collapsible_preview,help:t.help,argument:t.argument,disabled:t.disabled,color:t.color,style:t.style,backdrop:t.backdrop,field:n});return this.app.element_list[i]=s,this.table.add(s.$el),this.table.append(i),t.hidden&&this.table.get(i).hide(),n}});return{View:h}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(3),i(1),i(2),i(1))},function(t,e,i){var n,s;(function(a,o,l){n=[i(4),i(9),i(7),i(37),i(33)],s=function(t,e,i,n,s){return a.View.extend({initialize:function(e){this.options=t.merge(e,{initial_errors:!1,cls:"ui-portlet-limited",icon:null}),this.setElement("
    "),this.render()},update:function(t){var e=this;this.data.matchModel(t,function(t,i){var n=e.input_list[i];if(n&&n.options&&!o.isEqual(n.options,t.options)){n.options=t.options;var s=e.field_list[i];if(s.update){var a=[];if(["data","data_collection","drill_down"].indexOf(n.type)!=-1)a=n.options;else for(var l in t.options){var r=t.options[l];r.length>2&&a.push({label:r[0],value:r[1]})}s.update(a),s.trigger("change"),Galaxy.emit.debug("form-view::update()","Updating options for "+i)}}})},wait:function(t){for(var e in this.input_list){var i=this.field_list[e],n=this.input_list[e];n.is_dynamic&&i.wait&&i.unwait&&(t?i.wait():i.unwait())}},highlight:function(t,e,i){var n=this.element_list[t];if(n&&(n.error(e||"Please verify this parameter."),this.portlet.expand(),this.trigger("expand",t),!i))if(self==top){var s=this.$el.parents().filter(function(){return"auto"==l(this).css("overflow")}).first();s.animate({scrollTop:s.scrollTop()+n.$el.offset().top-50},500)}else l("html, body").animate({scrollTop:n.$el.offset().top-20},500)},errors:function(t){if(this.trigger("reset"),t&&t.errors){var e=this.data.matchResponse(t.errors);for(var i in this.element_list){this.element_list[i];e[i]&&this.highlight(i,e[i],!0)}}},setOnChange:function(t){this.options.onchange=t},render:function(){var t=this;this.off("change"),this.off("reset"),this.field_list={},this.input_list={},this.element_list={},this.data=new s.Manager(this),this._renderForm(),this.data.create(),this.options.initial_errors&&this.errors(this.options);var e=this.data.checksum();return this.on("change",function(i){var n=t.data.checksum();(n!=e||i)&&(e=n,t.options.onchange&&t.options.onchange())}),this.on("reset",function(){for(var t in this.element_list)this.element_list[t].reset()}),this},_renderForm:function(){this.message=new i.Message,this.section=new n.View(this,{inputs:this.options.inputs}),l(".tooltip").remove(),this.portlet=new e.View({icon:this.options.icon,title:this.options.title,cls:this.options.cls,operations:this.options.operations,buttons:this.options.buttons,collapsible:this.options.collapsible,collapsed:this.options.collapsed}),this.portlet.append(this.message.$el),this.portlet.append(this.section.$el),this.$el.empty(),this.$el.append(this.portlet.$el),this.options.message&&this.message.update({persistent:!0,status:"warning",message:this.options.message}),Galaxy.emit.debug("form-view::initialize()","Completed")}})}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(3),i(2),i(1))},function(t,e,i){var n,s;(function(a){n=[i(30),i(40),i(5)],s=function(t,e,i){"use strict";function n(t){return function(e,i){return this.isNew()&&(i=i||{},i.url=this.urlRoot+this.get("history_id")+"/contents",e=e||{},e.type="dataset_collection"),t.call(this,e,i)}}var s=e.HistoryContentMixin,o=t.ListDatasetCollection,l=t.PairDatasetCollection,r=t.ListPairedDatasetCollection,c=t.ListOfListsDatasetCollection,d=o.extend(s).extend({defaults:a.extend(a.clone(o.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list",model_class:"HistoryDatasetCollectionAssociation"}),initialize:function(t,e){o.prototype.initialize.call(this,t,e),s.initialize.call(this,t,e)},save:n(o.prototype.save),toString:function(){return["HistoryListDatasetCollection(",this.get("name"),")"].join("")}}),h=l.extend(s).extend({defaults:a.extend(a.clone(l.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"paired",model_class:"HistoryDatasetCollectionAssociation"}),initialize:function(t,e){l.prototype.initialize.call(this,t,e),s.initialize.call(this,t,e)},save:n(l.prototype.save),toString:function(){return["HistoryPairDatasetCollection(",this.get("name"),")"].join("")}}),u=r.extend(s).extend({defaults:a.extend(a.clone(r.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list:paired",model_class:"HistoryDatasetCollectionAssociation"}),initialize:function(t,e){r.prototype.initialize.call(this,t,e),s.initialize.call(this,t,e)},save:n(r.prototype.save),toString:function(){return["HistoryListPairedDatasetCollection(",this.get("name"),")"].join("")}}),p=c.extend(s).extend({defaults:a.extend(a.clone(c.prototype.defaults),{history_content_type:"dataset_collection",collection_type:"list:list",model_class:"HistoryDatasetCollectionAssociation"}),initialize:function(t,e){c.prototype.initialize.call(this,t,e),s.initialize.call(this,t,e)},save:n(c.prototype.save),toString:function(){return["HistoryListOfListsDatasetCollection(",this.get("name"),")"].join("")}});return{HistoryListDatasetCollection:d,HistoryPairDatasetCollection:h,HistoryListPairedDatasetCollection:u,HistoryListOfListsDatasetCollection:p}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(2))},function(t,e,i){var n,s;(function(a,o){n=[i(10),i(6),i(5)],s=function(t,e,i){"use strict";var n="history",s=function(t,e){return[t,e].join("-")},l={defaults:{history_id:null,history_content_type:null,hid:null,visible:!0},idAttribute:"type_id",constructor:function(t,e){t.type_id=s(t.history_content_type,t.id),this.debug("HistoryContentMixin.constructor:",t.type_id),a.Model.apply(this,arguments)},_typeIdStr:function(){return s(this.get("history_content_type"),this.get("id"))},initialize:function(t,e){this.on("change:id",this._createTypeId)},_createTypeId:function(){this.set("type_id",this._typeIdStr())},isNew:function(){return!this.get("id")},hidden:function(){return!this.get("visible")},isVisible:function(t,e){var i=!0;return t||!this.get("deleted")&&!this.get("purged")||(i=!1),e||this.get("visible")||(i=!1),i},urlRoot:Galaxy.root+"api/histories/",url:function(){var t=this.urlRoot+this.get("history_id")+"/contents/"+this.get("history_content_type")+"s/"+this.get("id");return t},hide:function(t){return this.get("visible")?this.save({visible:!1},t):o.when()},unhide:function(t){return this.get("visible")?o.when():this.save({visible:!0},t)},toString:function(){var t=this.get("id")||"";return this.get("name")&&(t=this.get("hid")+' :"'+this.get("name")+'",'+t),"HistoryContent("+t+")"}},r=a.Model.extend(e.LoggableMixin).extend(l).extend({_logNamespace:n});return{typeIdStr:s,HistoryContentMixin:l,HistoryContent:r}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(3),i(1))},function(t,e,i){var n,s;(function(a,o,l){n=[i(40),i(72),i(39),i(10),i(6),i(5)],s=function(t,e,i,n,s,r){"use strict";var c="history",d=a.Collection.extend(s.LoggableMixin).extend({_logNamespace:c,model:function(t,n){if("dataset"===t.history_content_type)return new e.HistoryDatasetAssociation(t,n);if("dataset_collection"===t.history_content_type){switch(t.collection_type){case"list":return new i.HistoryListDatasetCollection(t,n);case"paired":return new i.HistoryPairDatasetCollection(t,n);case"list:paired":return new i.HistoryListPairedDatasetCollection(t,n);case"list:list":return new i.HistoryListOfListsDatasetCollection(t,n)}var s="Unknown collection_type: "+t.collection_type;return console.warn(s,t),{validationError:s}}return{validationError:"Unknown history_content_type: "+t.history_content_type}},initialize:function(t,e){e=e||{},this.historyId=e.historyId,this.model.prototype.idAttribute="type_id",this.on("all",function(){this.debug(this+".event:",arguments)})},urlRoot:Galaxy.root+"api/histories",url:function(){return this.urlRoot+"/"+this.historyId+"/contents"},ids:function(){return this.map(function(t){return t.get("id")})},notReady:function(){return this.filter(function(t){return!t.inReadyState()})},running:function(){function t(t){return!t.inReadyState()}return new d(this.filter(t))},getByHid:function(t){return o.first(this.filter(function(e){return e.get("hid")===t}))},getVisible:function(t,e,i){i=i||[],this.debug("checking isVisible");var n=new d(this.filter(function(i){return i.isVisible(t,e)}));return o.each(i,function(t){o.isFunction(t)&&(n=new d(n.filter(t)))}),n},hidden:function(){function t(t){return t.hidden()}return new d(this.filter(t))},deleted:function(){function t(t){return t.get("deleted")}return new d(this.filter(t))},visibleAndUndeleted:function(){function t(t){return t.get("visible")&&!t.get("deleted"); -}return new d(this.filter(t))},haveDetails:function(){return this.all(function(t){return t.hasDetails()})},fetch:function(t){return t=t||{},t.data=o.defaults(t.data||{},{v:"dev"}),a.Collection.prototype.fetch.call(this,t)},fetchUpdated:function(t,e){return e=e||{},e.traditional=!0,e.data=[{name:"v",value:"dev"}],t&&(e.data=e.data.concat(this._filtersFromMap({"update_time-ge":t.toISOString()}))),e.merge=!0,e.remove=!1,this.fetch(e)},_filtersFromMap:function(t){var e=[];return o.each(t,function(t,i){e.push({name:"q",value:i}),e.push({name:"qv",value:t})}),e},fetchAllDetails:function(t){t=t||{};var e={details:"all"};return t.data=t.data?o.extend(t.data,e):e,this.fetch(t)},fetchCollectionCounts:function(t){return t=t||{},t.data=o.defaults({keys:["type_id","element_count"].join(","),q:"history_content_type",qv:"dataset_collection"},t.data||{}),t.merge=!0,t.remove=!1,this.fetch(t)},ajaxQueue:function(t,e){var i=l.Deferred(),n=this.length,s=[];if(!n)return i.resolve([]),i;var a=this.chain().reverse().map(function(o,l){return function(){var r=t.call(o,e);r.done(function(t){i.notify({curr:l,total:n,response:t,model:o})}),r.always(function(t){s.push(t),a.length?a.shift()():i.resolve(s)})}}).value();return a.shift()(),i},isCopyable:function(t){var e=["HistoryDatasetAssociation","HistoryDatasetCollectionAssociation"];return o.isObject(t)&&t.id&&o.contains(e,t.model_class)},copy:function(t){var e,i,n;o.isString(t)?(e=t,n="hda",i="dataset"):(e=t.id,n={HistoryDatasetAssociation:"hda",LibraryDatasetDatasetAssociation:"ldda",HistoryDatasetCollectionAssociation:"hdca"}[t.model_class]||"hda",i="hdca"===n?"dataset_collection":"dataset");var s=this,a=l.ajax(this.url(),{method:"POST",contentType:"application/json",data:JSON.stringify({content:e,source:n,type:i})}).done(function(t){s.add([t])}).fail(function(t,o,l){s.trigger("error",s,a,{},"Error copying contents",{type:i,id:e,source:n})});return a},matches:function(t){return this.filter(function(e){return e.matches(t)})},createHDCA:function(t,e,n,s){var a=this,o={list:i.HistoryListDatasetCollection,paired:i.HistoryPairDatasetCollection},l=new o[e]({history_id:this.historyId,name:n,element_identifiers:t});return l.save().done(function(t){a.add(l)}).fail(function(t,e,i){a.trigger("error",t,e,i)})},clone:function(){var t=a.Collection.prototype.clone.call(this);return t.historyId=this.historyId,t},print:function(){var t=this;t.each(function(e){t.debug(e),e.elements&&t.debug("\t elements:",e.elements)})},toString:function(){return["HistoryContents(",[this.historyId,this.length].join(),")"].join("")}});return{HistoryContents:d}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(3),i(2),i(1))},function(t,e,i){var n,s;(function(a,o,l,r){n=[i(6),i(5)],s=function(t,e){"use strict";var i="list",n=a.View.extend(t.LoggableMixin).extend({_logNamespace:i,initialize:function(t){this.expanded=t.expanded||!1,this.log("\t expanded:",this.expanded),this.fxSpeed=void 0!==t.fxSpeed?t.fxSpeed:this.fxSpeed},fxSpeed:"fast",render:function(t){var e=this._buildNewRender();return this._setUpBehaviors(e),this._queueNewRender(e,t),this},_buildNewRender:function(){var t=o(this.templates.el(this.model.toJSON(),this));return this.expanded&&this.$details(t).replaceWith(this._renderDetails().show()),t},_queueNewRender:function(t,e){e=void 0===e?this.fxSpeed:e;var i=this;o(i).queue("fx",[function(t){this.$el.fadeOut(e,t)},function(e){i._swapNewRender(t),e()},function(t){this.$el.fadeIn(e,t)},function(t){this.trigger("rendered",i),t()}])},_swapNewRender:function(t){return this.$el.empty().attr("class",l.isFunction(this.className)?this.className():this.className).append(t.children())},_setUpBehaviors:function(t){t=t||this.$el,t.find("[title]").tooltip({placement:"bottom"})},$details:function(t){return t=t||this.$el,t.find("> .details")},_renderDetails:function(){var t=o(this.templates.details(this.model.toJSON(),this));return this._setUpBehaviors(t),t},toggleExpanded:function(t){return t=void 0===t?!this.expanded:t,t?this.expand():this.collapse(),this},expand:function(){var t=this;return t._fetchModelDetails().always(function(){t._expand()})},_fetchModelDetails:function(){return this.model.hasDetails()?r.when():this.model.fetch()},_expand:function(){var t=this,e=t._renderDetails();t.$details().replaceWith(e),t.expanded=!0,t.$details().slideDown({duration:t.fxSpeed,step:function(){t.trigger("expanding",t)},complete:function(){t.trigger("expanded",t)}})},collapse:function(){this.debug(this+"(ExpandableView).collapse");var t=this;t.expanded=!1,this.$details().slideUp({duration:t.fxSpeed,step:function(){t.trigger("collapsing",t)},complete:function(){t.trigger("collapsed",t)}})}}),s=n.extend(t.mixin(t.SelectableViewMixin,t.DraggableViewMixin,{tagName:"div",className:"list-item",initialize:function(e){n.prototype.initialize.call(this,e),t.SelectableViewMixin.initialize.call(this,e),t.DraggableViewMixin.initialize.call(this,e),this._setUpListeners()},_setUpListeners:function(){return this.on("selectable",function(t){t?this.$(".primary-actions").hide():this.$(".primary-actions").show()},this),this},_buildNewRender:function(){var t=n.prototype._buildNewRender.call(this);return t.children(".warnings").replaceWith(this._renderWarnings()),t.children(".title-bar").replaceWith(this._renderTitleBar()),t.children(".primary-actions").append(this._renderPrimaryActions()),t.find("> .title-bar .subtitle").replaceWith(this._renderSubtitle()),t},_swapNewRender:function(t){return n.prototype._swapNewRender.call(this,t),this.selectable&&this.showSelector(0),this.draggable&&this.draggableOn(),this.$el},_renderWarnings:function(){var t=this,e=o('
    '),i=t.model.toJSON();return l.each(t.templates.warnings,function(n){e.append(o(n(i,t)))}),e},_renderTitleBar:function(){return o(this.templates.titleBar(this.model.toJSON(),this))},_renderPrimaryActions:function(){return[]},_renderSubtitle:function(){return o(this.templates.subtitle(this.model.toJSON(),this))},events:{"click .title-bar":"_clickTitleBar","keydown .title-bar":"_keyDownTitleBar","click .selector":"toggleSelect"},_clickTitleBar:function(t){t.stopPropagation(),t.altKey?(this.toggleSelect(t),this.selectable||this.showSelector()):this.toggleExpanded()},_keyDownTitleBar:function(t){var e=32,i=13;return!t||"keydown"!==t.type||t.keyCode!==e&&t.keyCode!==i||(this.toggleExpanded(),t.stopPropagation(),!1)},toString:function(){var t=this.model?this.model+"":"(no model)";return"ListItemView("+t+")"}}));s.prototype.templates=function(){var e=t.wrapTemplate(['
    ','
    ','
    ','',"
    ",'
    ','
    ','
    ',"
    "]),i={},n=t.wrapTemplate(['
    ','','
    ','<%- element.name %>',"
    ",'
    ',"
    "],"element"),s=t.wrapTemplate(['
    ']),a=t.wrapTemplate(['
    ']);return{el:e,warnings:i,titleBar:n,subtitle:s,details:a}}();var c=s.extend({foldoutStyle:"foldout",foldoutPanelClass:null,initialize:function(t){"drilldown"===this.foldoutStyle&&(this.expanded=!1),this.foldoutStyle=t.foldoutStyle||this.foldoutStyle,this.foldoutPanelClass=t.foldoutPanelClass||this.foldoutPanelClass,s.prototype.initialize.call(this,t),this.foldout=this._createFoldoutPanel()},_renderDetails:function(){if("drilldown"===this.foldoutStyle)return o();var t=s.prototype._renderDetails.call(this);return this._attachFoldout(this.foldout,t)},_createFoldoutPanel:function(){var t=this.model,e=this._getFoldoutPanelClass(t),i=this._getFoldoutPanelOptions(t),n=new e(l.extend(i,{model:t}));return n},_getFoldoutPanelClass:function(){return this.foldoutPanelClass},_getFoldoutPanelOptions:function(){return{foldoutStyle:this.foldoutStyle,fxSpeed:this.fxSpeed}},_attachFoldout:function(t,e){return e=e||this.$("> .details"),this.foldout=t.render(0),t.$("> .controls").hide(),e.append(t.$el)},expand:function(){var t=this;return t._fetchModelDetails().always(function(){"foldout"===t.foldoutStyle?t._expand():"drilldown"===t.foldoutStyle&&t._expandByDrilldown()})},_expandByDrilldown:function(){var t=this;t.listenTo(t.foldout,"close",function(){t.trigger("collapsed:drilldown",t,t.foldout)}),t.trigger("expanded:drilldown",t,t.foldout)}});return c.prototype.templates=function(){var e=t.wrapTemplate(['
    ',"
    "],"collection");return l.extend({},s.prototype.templates,{details:e})}(),{ExpandableView:n,ListItemView:s,FoldoutListItemView:c}}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(3),i(1),i(2),i(1))},function(t,e,i){var n,s;(function(a,o){n=[i(4),i(55),i(7),i(38),i(18),i(28)],s=function(t,e,i,n,s,l){return n.extend({initialize:function(t){var i=this;n.prototype.initialize.call(this,t),this.deferred=new e,t.inputs?this._buildForm(t):this.deferred.execute(function(e){i._buildModel(e,t,!0)})},remove:function(){var t=this;this.$el.hide(),this.deferred.execute(function(){n.prototype.remove.call(t),Galaxy.emit.debug("tool-form-base::remove()","Destroy view.")})},_buildForm:function(e){var i=this;this.options=t.merge(e,this.options),this.options=t.merge({icon:e.icon,title:""+e.name+" "+e.description+" (Galaxy Version "+e.version+")",operations:this._operations(),onchange:function(){i.deferred.reset(),i.deferred.execute(function(t){i._updateModel(t)})}},this.options),this.options.customize&&this.options.customize(this.options),this.render(),this.options.collapsible||this.$el.append(a("
    ").addClass("ui-margin-top-large").append(this._footer()))},_buildModel:function(e,n,s){var o=this;this.options.id=n.id,this.options.version=n.version;var l="",r={};n.job_id?l=Galaxy.root+"api/jobs/"+n.job_id+"/build_for_rerun":(l=Galaxy.root+"api/tools/"+n.id+"/build",Galaxy.params&&Galaxy.params.tool_id==n.id&&(r=a.extend({},Galaxy.params),n.version&&(r.tool_version=n.version))),t.get({url:l,data:r,success:function(t){return t=t.tool_model||t,t.display?(o._buildForm(t),!s&&o.message.update({status:"success",message:"Now you are using '"+o.options.name+"' version "+o.options.version+", id '"+o.options.id+"'.",persistent:!1}),Galaxy.emit.debug("tool-form-base::initialize()","Initial tool model ready.",t),void e.resolve()):void(window.location=Galaxy.root)},error:function(t,n){var s=t&&t.err_msg||"Uncaught error.";401==n.status?window.location=Galaxy.root+"user/login?"+a.param({redirect:Galaxy.root+"?tool_id="+o.options.id}):o.$el.is(":empty")?o.$el.prepend(new i.Message({message:s,status:"danger",persistent:!0,large:!0}).$el):Galaxy.modal&&Galaxy.modal.show({title:"Tool request failed",body:s,buttons:{Close:function(){Galaxy.modal.hide()}}}),Galaxy.emit.debug("tool-form::initialize()","Initial tool model request failed.",t),e.reject()}})},_updateModel:function(e){var i=this,n=this.options.update_url||Galaxy.root+"api/tools/"+this.options.id+"/build",s={tool_id:this.options.id,tool_version:this.options.version,inputs:a.extend(!0,{},i.data.create())};this.wait(!0),Galaxy.emit.debug("tool-form-base::_updateModel()","Sending current state.",s),t.request({type:"POST",url:n,data:s,success:function(t){i.update(t.tool_model||t),i.options.update&&i.options.update(t),i.wait(!1),Galaxy.emit.debug("tool-form-base::_updateModel()","Received new model.",t),e.resolve()},error:function(t){Galaxy.emit.debug("tool-form-base::_updateModel()","Refresh request failed.",t),e.reject()}})},_operations:function(){var t=this,e=this.options,n=new i.ButtonMenu({icon:"fa-cubes",title:!e.narrow&&"Versions"||null,tooltip:"Select another tool version"});if(!e.sustain_version&&e.versions&&e.versions.length>1)for(var s in e.versions){var a=e.versions[s];a!=e.version&&n.addMenu({title:"Switch to "+a,version:a,icon:"fa-cube",onclick:function(){var i=e.id.replace(e.version,this.version),n=this.version;t.deferred.reset(),t.deferred.execute(function(e){t._buildModel(e,{id:i,version:n})})}})}else n.$el.hide();var o=new i.ButtonMenu({icon:"fa-caret-down",title:!e.narrow&&"Options"||null,tooltip:"View available options"});return e.biostar_url&&(o.addMenu({icon:"fa-question-circle",title:"Question?",tooltip:"Ask a question about this tool (Biostar)",onclick:function(){window.open(e.biostar_url+"/p/new/post/")}}),o.addMenu({icon:"fa-search",title:"Search",tooltip:"Search help for this tool (Biostar)",onclick:function(){window.open(e.biostar_url+"/local/search/page/?q="+e.name)}})),o.addMenu({icon:"fa-share",title:"Share",tooltip:"Share this tool",onclick:function(){prompt("Copy to clipboard: Ctrl+C, Enter",window.location.origin+Galaxy.root+"root?tool_id="+e.id)}}),Galaxy.user&&Galaxy.user.get("is_admin")&&o.addMenu({icon:"fa-download",title:"Download",tooltip:"Download this tool",onclick:function(){window.location.href=Galaxy.root+"api/tools/"+e.id+"/download"}}),e.requirements&&e.requirements.length>0&&o.addMenu({icon:"fa-info-circle",title:"Requirements",tooltip:"Display tool requirements",onclick:function(){!this.visible||t.portlet.collapsed?(this.visible=!0,t.portlet.expand(),t.message.update({persistent:!0,message:t._templateRequirements(e),status:"info"})):(this.visible=!1,t.message.update({message:""}))}}),e.sharable_url&&o.addMenu({icon:"fa-external-link",title:"See in Tool Shed",tooltip:"Access the repository",onclick:function(){window.open(e.sharable_url)}}),{menu:o,versions:n}},_footer:function(){var t=this.options,e=a("
    ").append(this._templateHelp(t));if(t.citations){var i=a("
    "),n=new s.ToolCitationCollection;n.tool_id=t.id;var o=new l.CitationListView({el:i,collection:n});o.render(),n.fetch(),e.append(i)}return e},_templateHelp:function(t){var e=a("
    ").addClass("ui-form-help").append(t.help);return e.find("a").attr("target","_blank"),e},_templateRequirements:function(t){var e=t.requirements.length;if(e>0){var i="This tool requires ";o.each(t.requirements,function(t,n){i+=t.name+(t.version?" (Version "+t.version+")":"")+(n").attr("target","_blank").attr("href","https://wiki.galaxyproject.org/Tools/Requirements").text("here");return a("").append(i+". Click ").append(n).append(" for more information.")}return"No requirements found."}})}.apply(e,n),!(void 0!==s&&(t.exports=s))}).call(e,i(1),i(2))},function(t,e,i){var n,s;(function(a,o){n=[i(2),i(17),i(12),i(19)],s=function(t,e,i,n){"use strict";var s={hidden:!1,show:function(){this.set("hidden",!1)},hide:function(){this.set("hidden",!0)},toggle:function(){this.set("hidden",!this.get("hidden"))},is_visible:function(){return!this.attributes.hidden}},l=a.Model.extend({defaults:{name:null,label:null,type:null,value:null,html:null,num_samples:5},initialize:function(t){this.attributes.html=unescape(this.attributes.html)},copy:function(){return new l(this.toJSON())},set_value:function(t){this.set("value",t||"")}}),r=a.Collection.extend({model:l}),c=l.extend({}),d=l.extend({set_value:function(t){this.set("value",parseInt(t,10))},get_samples:function(){return d3.scale.linear().domain([this.get("min"),this.get("max")]).ticks(this.get("num_samples"))}}),h=d.extend({set_value:function(t){this.set("value",parseFloat(t))}}),u=l.extend({get_samples:function(){return t.map(this.get("options"),function(t){return t[0]})}});l.subModelTypes={integer:d,"float":h,data:c,select:u};var p=a.Model.extend({defaults:{id:null,name:null,description:null,target:null,inputs:[],outputs:[]},urlRoot:Galaxy.root+"api/tools",initialize:function(e){this.set("inputs",new r(t.map(e.inputs,function(t){var e=l.subModelTypes[t.type]||l;return new e(t)})))},toJSON:function(){var t=a.Model.prototype.toJSON.call(this);return t.inputs=this.get("inputs").map(function(t){return t.toJSON()}),t},remove_inputs:function(t){var e=this,i=e.get("inputs").filter(function(e){return t.indexOf(e.get("type"))!==-1});e.get("inputs").remove(i)},copy:function(t){var e=new p(this.toJSON());if(t){var i=new a.Collection;e.get("inputs").each(function(t){t.get_samples()&&i.push(t)}),e.set("inputs",i)}return e},apply_search_results:function(e){return t.indexOf(e,this.attributes.id)!==-1?this.show():this.hide(),this.is_visible()},set_input_value:function(t,e){this.get("inputs").find(function(e){return e.get("name")===t}).set("value",e)},set_input_values:function(e){var i=this;t.each(t.keys(e),function(t){i.set_input_value(t,e[t])})},run:function(){return this._run()},rerun:function(t,e){return this._run({action:"rerun",target_dataset_id:t.id,regions:e})},get_inputs_dict:function(){var t={};return this.get("inputs").each(function(e){t[e.get("name")]=e.get("value")}),t},_run:function(n){var s=t.extend({tool_id:this.id,inputs:this.get_inputs_dict()},n),a=o.Deferred(),l=new e.ServerStateDeferred({ajax_settings:{url:this.urlRoot,data:JSON.stringify(s),dataType:"json",contentType:"application/json",type:"POST"},interval:2e3,success_fn:function(t){return"pending"!==t}});return o.when(l.go()).then(function(t){a.resolve(new i.DatasetCollection(t))}),a}});t.extend(p.prototype,s);var g=(a.View.extend({}),a.Collection.extend({model:p})),f=a.Model.extend(s),m=a.Model.extend({defaults:{elems:[],open:!1},clear_search_results:function(){t.each(this.attributes.elems,function(t){t.show()}),this.show(),this.set("open",!1)},apply_search_results:function(e){var i,n=!0;t.each(this.attributes.elems,function(t){t instanceof f?(i=t,i.hide()):t instanceof p&&t.apply_search_results(e)&&(n=!1,i&&i.show())}),n?this.hide():(this.show(),this.set("open",!0))}});t.extend(m.prototype,s);var v=a.Model.extend({defaults:{search_hint_string:"search tools",min_chars_for_search:3,clear_btn_url:"",search_url:"",visible:!0,query:"",results:null,clear_key:27},urlRoot:Galaxy.root+"api/tools",initialize:function(){this.on("change:query",this.do_search)},do_search:function(){var t=this.attributes.query;if(t.length");t.append(S.tool_link(this.model.toJSON()));var e=this.model.get("form_style",null);if("upload1"===this.model.id)t.find("a").on("click",function(t){t.preventDefault(),Galaxy.upload.show()});else if("regular"===e){var i=this;t.find("a").on("click",function(t){t.preventDefault();var e=new n.View({id:i.model.id,version:i.model.get("version")});e.deferred.execute(function(){Galaxy.app.display(e)})})}return this.$el.append(t),this}}),w=y.extend({tagName:"div",className:"toolPanelLabel",render:function(){return this.$el.append(o("").text(this.model.attributes.text)),this}}),x=y.extend({tagName:"div",className:"toolSectionWrapper",initialize:function(){y.prototype.initialize.call(this),this.model.on("change:open",this.update_open,this)},render:function(){this.$el.append(S.panel_section(this.model.toJSON()));var e=this.$el.find(".toolSectionBody");return t.each(this.model.attributes.elems,function(t){if(t instanceof p){var i=new b({model:t,className:"toolTitle"});i.render(),e.append(i.$el)}else if(t instanceof f){var n=new w({model:t});n.render(),e.append(n.$el)}}),this},events:{"click .toolSectionTitle > a":"toggle"},toggle:function(){this.model.set("open",!this.model.attributes.open)},update_open:function(){this.model.attributes.open?this.$el.children(".toolSectionBody").slideDown("fast"):this.$el.children(".toolSectionBody").slideUp("fast")}}),C=a.View.extend({tagName:"div",id:"tool-search",className:"bar",events:{click:"focus_and_select","keyup :input":"query_changed","click #search-clear-btn":"clear"},render:function(){return this.$el.append(S.tool_search(this.model.toJSON())),this.model.is_visible()||this.$el.hide(),this.$el.find("[title]").tooltip(),this},focus_and_select:function(){this.$el.find(":input").focus().select()},clear:function(){return this.model.clear_search(),this.$el.find(":input").val(""),this.focus_and_select(),!1},query_changed:function(t){return this.model.attributes.clear_key&&this.model.attributes.clear_key===t.which?(this.clear(),!1):void this.model.set("query",this.$el.find(":input").val())}}),$=a.View.extend({tagName:"div",className:"toolMenu",initialize:function(){this.model.get("tool_search").on("change:results",this.handle_search_results,this)},render:function(){var t=this,e=new C({model:this.model.get("tool_search")});return e.render(),t.$el.append(e.$el),this.model.get("layout").each(function(e){if(e instanceof m){var i=new x({model:e});i.render(),t.$el.append(i.$el)}else if(e instanceof p){var n=new b({model:e,className:"toolTitleNoSection"});n.render(),t.$el.append(n.$el)}else if(e instanceof f){var s=new w({model:e});s.render(),t.$el.append(s.$el)}}),t.$el.find("a.tool-link").click(function(e){var i=o(this).attr("class").split(/\s+/)[0],n=t.model.get("tools").get(i);t.trigger("tool_link_click",e,n)}),this},handle_search_results:function(){var t=this.model.get("tool_search").get("results");t&&0===t.length?o("#search-no-results").show():o("#search-no-results").hide()}}),E=a.View.extend({className:"toolForm",render:function(){this.$el.children().remove(),this.$el.append(S.tool_form(this.model.toJSON()))}}),S=(a.View.extend({className:"toolMenuAndView",initialize:function(){this.tool_panel_view=new $({collection:this.collection}),this.tool_form_view=new E},render:function(){this.tool_panel_view.render(),this.tool_panel_view.$el.css("float","left"),this.$el.append(this.tool_panel_view.$el),this.tool_form_view.$el.hide(),this.$el.append(this.tool_form_view.$el);var t=this;this.tool_panel_view.on("tool_link_click",function(e,i){e.preventDefault(),t.show_tool(i)})},show_tool:function(t){var e=this;t.fetch().done(function(){e.tool_form_view.model=t,e.tool_form_view.render(),e.tool_form_view.$el.show(),o("#left").width("650px")})}}),{tool_search:t.template(['',' ',''].join("")),panel_section:t.template(['",'