mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
2 lines
5.5 KiB
JavaScript
2 lines
5.5 KiB
JavaScript
define(["utils/utils"],function(a){function b(b){var c=b.$el.find(".response-message"),d=a.getQueryString("status"),e=a.getQueryString("message");e&&null!==e&&""!==e?(c.addClass(d+"message"),c.html("<p>"+_.escape(e)+"</p>")):c.html("")}var c=Backbone.View.extend({initialize:function(){this.setElement("<div/>"),this.render()},render:function(){var a=this,c=3;$.getJSON(Galaxy.root+"api/workflows/",function(d){var e=null;a.$el.empty().append(a._templateHeader()),b(a),e=a.$el.find(".user-workflows"),e.append(a._templateActionButtons()),d.length>0?(e.append(a._templateWorkflowTable(a,d)),a.adjust_actiondropdown(e),_.each(d,function(b){a.confirm_delete(a,b)}),a.search_workflow(a,a.$el.find(".search-wf"),a.$el.find(".workflow-search tr"),c)):e.append(a._templateNoWorkflow())})},confirm_delete:function(a,b){var c=a.$el.find(".link-confirm-"+b.id),d=a.$el.find(".link-confirm-shared-"+b.id);c.click(function(){return confirm("Are you sure you want to delete workflow '"+b.name+"'?")}),d.click(function(){return confirm("Are you sure you want to remove the shared workflow '"+b.name+"'?")})},search_workflow:function(a,b,c,d){b.on("keyup",function(){var a=$(this).val();if(a.length>=d){var b=new RegExp(a,"i");c.hide(),c.filter(function(){return b.test($(this).text())}).show()}else c.show()})},adjust_actiondropdown:function(a){a.on("show.bs.dropdown",function(){a.css("overflow","inherit")}),a.on("hide.bs.dropdown",function(){a.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(a,b){var c="",d="";return c+='<table class="table colored"><thead><tr class="header"><th>Name</th><th>Owner</th><th># of Steps</th><th>Published</th></tr></thead>',_.each(b,function(b){d=d+'<tr><td><div class="dropdown"><button class="menubutton" type="button" data-toggle="dropdown">'+_.escape(b.name)+'<span class="caret"></span></button>'+a._templateActions(b)+"</div></td><td>"+(b.owner===Galaxy.user.attributes.username?"You":b.owner)+"</td><td>"+b.number_of_steps+"</td><td>"+(b.published?"Yes":"No")+"</td></tr>"}),c+'<tbody class="workflow-search">'+d+"</tbody></table>"},_templateActions:function(a){return a.owner===Galaxy.user.attributes.username?'<ul class="dropdown-menu action-dpd"><li><a href="'+Galaxy.root+"workflow/editor?id="+a.id+'">Edit</a></li><li><a href="'+Galaxy.root+"workflow/run?id="+a.id+'">Run</a></li><li><a href="'+Galaxy.root+"workflow/sharing?id="+a.id+'">Share or Download</a></li><li><a href="'+Galaxy.root+"workflow/copy?id="+a.id+'">Copy</a></li><li><a href="'+Galaxy.root+"workflow/rename?id="+a.id+'">Rename</a></li><li><a href="'+Galaxy.root+"workflow/display_by_id?id="+a.id+'">View</a></li><li><a class="link-confirm-'+a.id+'" href="'+Galaxy.root+"workflow/delete?id="+a.id+'">Delete</a></li></ul>':'<ul class="dropdown-menu action-dpd"><li><a href="'+Galaxy.root+"workflow/display_by_username_and_slug?username="+a.owner+"&slug="+a.slug+'">View</a></li><li><a href="'+Galaxy.root+"workflow/run?id="+a.id+'">Run</a></li><li><a href="'+Galaxy.root+"workflow/copy?id="+a.id+'">Copy</a></li><li><a class="link-confirm-shared-'+a.id+'" href="'+Galaxy.root+"workflow/sharing?unshare_me=True&id="+a.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>'}}),d=Backbone.View.extend({initialize:function(){this.setElement("<div/>"),this.render()},render:function(){var a=this;$.getJSON(Galaxy.root+"workflow/upload_import_workflow",function(b){a.$el.empty().append(a._mainTemplate(a,b))})},_mainTemplate:function(a,b){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='"+b.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='"+b.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>"}});return{View:c,ImportWorkflowView:d}});
|
|
//# sourceMappingURL=../../../maps/mvc/workflow/workflow.js.map
|