mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
3 lines
6.1 KiB
JavaScript
3 lines
6.1 KiB
JavaScript
"use strict";define(["utils/utils","mvc/ui/ui-misc"],function(o,e){function t(){var t=$(".response-message"),a={};a={status:o.getQueryString("status"),message:_.escape(o.getQueryString("message")),persistent:!0,cls:o.getQueryString("status")+"message"},t.empty().html(new e.Message(a).$el)}return{View:Backbone.View.extend({initialize:function(){this.setElement("<div/>"),this.render()},render:function(){var o=this;$.getJSON(Galaxy.root+"api/workflows/",function(e){var a=null;o.$el.empty().append(o._templateHeader()),t(),(a=o.$(".user-workflows")).append(o._templateActionButtons()),e.length>0?(a.append(o._templateWorkflowTable(o,e)),o.adjust_actiondropdown(a),_.each(e,function(e){o.confirm_delete(e)}),o.register_show_tool_menu(),o.search_workflow(o.$(".search-wf"),o.$(".workflow-search tr"),3)):a.append(o._templateNoWorkflow())})},register_show_tool_menu:function(){var o=this.$(".show-in-tool-panel");o.on("click",function(e){for(var t=[],a=0;a<o.length;a++){var l=o[a];l.checked&&t.push(l.value)}$.ajax({type:"PUT",url:Galaxy.root+"api/workflows/menu/",data:JSON.stringify({workflow_ids:t}),contentType:"application/json"}).done(function(o){window.location=Galaxy.root+"workflow"})})},confirm_delete:function(o){var e=this.$(".link-confirm-"+o.id),t=this.$(".link-confirm-shared-"+o.id);e.click(function(){return confirm("Are you sure you want to delete workflow '"+o.name+"'?")}),t.click(function(){return confirm("Are you sure you want to remove the shared workflow '"+o.name+"'?")})},search_workflow:function(o,e,t){o.on("keyup",function(){var o=$(this).val();if(o.length>=t){var a=new RegExp(o,"i");e.hide(),e.filter(function(){return a.test($(this).text())}).show()}else e.show()})},adjust_actiondropdown:function(o){o.on("show.bs.dropdown",function(){o.css("overflow","inherit")}),o.on("hide.bs.dropdown",function(){o.css("overflow","auto")})},_templateNoWorkflow:function(){return'<div class="wf-nodata"> You have no workflows. </div>'},_templateActionButtons:function(){return'<ul class="manage-table-actions"><li><input class="search-wf form-control" type="text" autocomplete="off" placeholder="search for workflow..."></li><li><a class="action-button fa fa-plus wf-action" id="new-workflow" title="Create new workflow" href="'+Galaxy.root+'workflow/create"></a></li><li><a class="action-button fa fa-upload wf-action" id="import-workflow" title="Upload or import workflow" href="'+Galaxy.root+'workflow/import_workflow"></a></li></ul>'},_templateWorkflowTable:function(o,e){var t="",a="";return t+='<table class="table colored"><thead><tr class="header"><th>Name</th><th>Owner</th><th># of Steps</th><th>Published</th><th>Show in tools panel</th></tr></thead>',_.each(e,function(e){var t='<input type="checkbox" class="show-in-tool-panel" '+(e.show_in_tool_panel?'checked="'+e.show_in_tool_panel+'"':"")+' value="'+e.id+'">';a=a+'<tr><td><div class="dropdown"><button class="menubutton" type="button" data-toggle="dropdown">'+_.escape(e.name)+'<span class="caret"></span></button>'+o._templateActions(e)+"</div></td><td>"+(e.owner===Galaxy.user.attributes.username?"You":e.owner)+"</td><td>"+e.number_of_steps+"</td><td>"+(e.published?"Yes":"No")+"</td><td>"+t+"</td></tr>"}),t+'<tbody class="workflow-search">'+a+"</tbody></table>"},_templateActions:function(o){return o.owner===Galaxy.user.attributes.username?'<ul class="dropdown-menu action-dpd"><li><a href="'+Galaxy.root+"workflow/editor?id="+o.id+'">Edit</a></li><li><a href="'+Galaxy.root+"workflow/run?id="+o.id+'">Run</a></li><li><a href="'+Galaxy.root+"workflow/sharing?id="+o.id+'">Share or Download</a></li><li><a href="'+Galaxy.root+"workflow/copy?id="+o.id+'">Copy</a></li><li><a href="'+Galaxy.root+"workflow/rename?id="+o.id+'">Rename</a></li><li><a href="'+Galaxy.root+"workflow/display_by_id?id="+o.id+'">View</a></li><li><a class="link-confirm-'+o.id+'" href="'+Galaxy.root+"workflow/delete?id="+o.id+'">Delete</a></li></ul>':'<ul class="dropdown-menu action-dpd"><li><a href="'+Galaxy.root+"workflow/display_by_username_and_slug?username="+o.owner+"&slug="+o.slug+'">View</a></li><li><a href="'+Galaxy.root+"workflow/run?id="+o.id+'">Run</a></li><li><a href="'+Galaxy.root+"workflow/copy?id="+o.id+'">Copy</a></li><li><a class="link-confirm-shared-'+o.id+'" href="'+Galaxy.root+"workflow/sharing?unshare_me=True&id="+o.id+'">Remove</a></li></ul>'},_templateHeader:function(){return'<div class="page-container"><div class="user-workflows wf"><div class="response-message"></div><h2>Your workflows</h2></div></div>'}}),ImportWorkflowView:Backbone.View.extend({initialize:function(){this.setElement("<div/>"),this.render()},render:function(){var o=this;$.getJSON(Galaxy.root+"workflow/upload_import_workflow",function(e){o.$el.empty().append(o._mainTemplate(e))})},_mainTemplate:function(o){return"<div class='toolForm'><div class='toolFormTitle'>Import Galaxy workflow</div><div class='toolFormBody'><form name='import_workflow' id='import_workflow' action='"+Galaxy.root+"workflow/upload_import_workflow' enctype='multipart/form-data' method='POST'><div class='form-row'><label>Galaxy workflow URL:</label><input type='text' name='url' class='input-url' value='"+o.url+"' size='40'><div class='toolParamHelp' style='clear: both;'>If the workflow is accessible via a URL, enter the URL above and click <b>Import</b>.</div><div style='clear: both'></div></div><div class='form-row'><label>Galaxy workflow file:</label><div class='form-row-input'><input type='file' name='file_data' class='input-file'/></div><div class='toolParamHelp' style='clear: both;'>If the workflow is in a file on your computer, choose it and then click <b>Import</b>.</div><div style='clear: both'></div></div><div class='form-row'><input type='submit' class='primary-button wf-import' name='import_button' value='Import'></div></form><hr/><div class='form-row'><label>Import a Galaxy workflow from myExperiment:</label><div class='form-row-input'><a href='"+o.myexperiment_target_url+"'> Visit myExperiment</a></div><div class='toolParamHelp' style='clear: both;'>Click the link above to visit myExperiment and browse for Galaxy workflows.</div><div style='clear: both'></div></div></div></div>"}})}});
|
|
//# sourceMappingURL=../../../maps/mvc/workflow/workflow.js.map
|