Skip to content

Commit

Permalink
Adding basic elements for import workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
anuprulez committed May 30, 2017
1 parent a407a99 commit 094dbe9
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 14 deletions.
7 changes: 6 additions & 1 deletion client/galaxy/scripts/apps/analysis.js
Expand Up @@ -81,6 +81,7 @@ window.app = function app( options, bootstrapped ){
'(/)workflow(/)' : 'show_workflows',
'(/)custom_builds' : 'show_custom_builds',
'(/)workflow/run(/)' : 'show_run',
'(/)workflow/import_workflow' : 'show_import_workflow',
},

require_login: [
Expand Down Expand Up @@ -117,7 +118,11 @@ window.app = function app( options, bootstrapped ){
},

show_run : function() {
this.page.display( new Workflows.Run_Workflow_View() )
this.page.display( new Workflows.Run_Workflow_View() );
},

show_import_workflow : function() {
this.page.display( new Workflows.Import_Workflow_View() );
},

show_custom_builds : function() {
Expand Down
39 changes: 37 additions & 2 deletions client/galaxy/scripts/mvc/workflow/workflow.js
@@ -1,5 +1,5 @@
/** Workflow view */
define( [ 'mvc/tool/tool-form-composite' ], function( ToolForm ) {
define( [ 'mvc/tool/tool-form-composite', 'mvc/form/form-view', 'mvc/ui/ui-misc' ], function( ToolForm, Form, Ui ) {

/** View of the main workflow list page */
var View = Backbone.View.extend({
Expand Down Expand Up @@ -217,8 +217,43 @@ define( [ 'mvc/tool/tool-form-composite' ], function( ToolForm ) {
},
});

var Import_Workflow_View = Backbone.View.extend({

initialize: function() {
this.setElement( '<div/>' );
this.render();
},

/** Open page to import workflow */
render: function() {
var self = this;
$.getJSON( Galaxy.root + 'workflow/get_import_workflow', function( options ) {
var form = new Form({
title : options.title,
icon : options.icon,
inputs : options.inputs,
operations: {
'submit': new Ui.ButtonIcon({
tooltip : 'Import workflow',
title : 'Import',
icon : 'fa-upload',
onclick : function() { self.import_workflow( form, options ) }
})
}
});
self.$el.empty().append( form.$el );
});
},

/** Import a workflow */
import_workflow: function( form, options ) {
// TODO: Import workflow
}
});

return {
View : View,
Run_Workflow_View : Run_Workflow_View
Run_Workflow_View : Run_Workflow_View,
Import_Workflow_View : Import_Workflow_View
};
});
1 change: 1 addition & 0 deletions lib/galaxy/webapps/galaxy/buildapp.py
Expand Up @@ -109,6 +109,7 @@ def paste_app_factory( global_conf, **kwargs ):
webapp.add_client_route( '/user/{form_id}' )
webapp.add_client_route( '/workflow' )
webapp.add_client_route( '/workflow/run' )
webapp.add_client_route( '/workflow/import_workflow' )
webapp.add_client_route( '/custom_builds' )

# ==== Done
Expand Down
26 changes: 25 additions & 1 deletion lib/galaxy/webapps/galaxy/controllers/workflow.py
Expand Up @@ -740,7 +740,31 @@ def export_to_file( self, trans, id ):
return stored_dict

@web.expose
def import_workflow( self, trans, cntrller='workflow', **kwd ):
def get_import_workflow( self, trans, **kwd ):
"""
Import/upload workflow page elements
"""
inputs = list()
input_url = { 'id': 'url_input',
'name': 'url',
'type': 'text',
'label': 'Galaxy workflow URL:',
'value': '',
'help': 'If the workflow is accessible via a URL, enter the URL above and click <b>Import</b>.' }
inputs.append(input_url)

input_file = { 'id': 'file_input',
'name': 'file_data',
'type': 'file',
'label': 'Galaxy workflow file:',
'help': 'If the workflow is in a file on your computer, choose it and then click <b>Import</b>.' }

inputs.append(input_file)
form = { 'title': 'Import Galaxy workflow', 'icon': 'fa fa-upload', 'inputs': inputs }
return json.dumps(form);

@web.expose
def save_import_workflow( self, trans, cntrller='workflow', **kwd ):
"""
Import a workflow by reading an url, uploading a file, opening and reading the contents
of a local file, or receiving the textual representation of a workflow via http.
Expand Down
2 changes: 1 addition & 1 deletion static/maps/mvc/workflow/workflow.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions static/scripts/bundled/analysis.bundled.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/scripts/bundled/analysis.bundled.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion static/scripts/bundled/libs.bundled.js.map

Large diffs are not rendered by default.

0 comments on commit 094dbe9

Please sign in to comment.