Revise workflow create endpoint

This commit is contained in:
guerler
2017-11-13 12:52:53 -05:00
parent b7482aa1ff
commit 32e00137be
6 changed files with 34 additions and 14 deletions
+10
View File
@@ -52,6 +52,7 @@ window.app = function app(options, bootstrapped) {
"(/)visualizations(/)edit(/)": "show_visualizations_edit",
"(/)visualizations/(:action_id)": "show_visualizations",
"(/)workflows/list_published(/)": "show_workflows_published",
"(/)workflows/create(/)": "show_workflows_create",
"(/)histories(/)rename(/)": "show_histories_rename",
"(/)histories(/)permissions(/)": "show_histories_permissions",
"(/)histories(/)(:action_id)": "show_histories",
@@ -178,6 +179,15 @@ window.app = function app(options, bootstrapped) {
this.page.display(new Workflows.View());
},
show_workflows_create: function() {
this.page.display(
new FormWrapper.View({
url: `workflow/create`,
redirect: "workflows/list"
})
);
},
show_run: function() {
this._loadWorkflow();
},
+1
View File
@@ -112,6 +112,7 @@ def paste_app_factory(global_conf, **kwargs):
webapp.add_client_route('/user/{form_id}')
webapp.add_client_route('/workflow')
webapp.add_client_route('/workflows/list_published')
webapp.add_client_route('/workflows/create')
webapp.add_client_route('/visualizations/list_published')
webapp.add_client_route('/visualizations/list')
webapp.add_client_route('/visualizations/edit')
@@ -496,14 +496,23 @@ class WorkflowController(BaseUIController, SharableMixin, UsesStoredWorkflowMixi
return_url = url_for('/') + 'workflow?status=done&message=%s' % escape(message)
trans.response.send_redirect(return_url)
@web.expose
@web.require_login("create workflows")
def create(self, trans, workflow_name=None, workflow_annotation=""):
"""
Create a new stored workflow with name `workflow_name`.
"""
user = trans.get_user()
if workflow_name is not None:
@web.expose_api
def create(self, trans, payload=None, **kwd):
if trans.request.method == 'GET':
return {
'title' : 'Create Workflow',
'inputs' : [{
'name' : 'workflow_name',
'label' : 'Name',
'value' : 'Unnamed workflow'
}, {
'name' : 'workflow_annotation',
'label' : 'Annotation',
'help' : 'A description of the workflow; annotation is shown alongside shared or published workflows.'
}]}
'''else:
user = trans.get_user()
if workflow_name is not None:
# Create the new stored workflow
stored_workflow = model.StoredWorkflow()
stored_workflow.name = workflow_name
@@ -522,13 +531,13 @@ class WorkflowController(BaseUIController, SharableMixin, UsesStoredWorkflowMixi
session.add(stored_workflow)
session.flush()
return self.editor(trans, id=trans.security.encode_id(stored_workflow.id))
else:
else:
return form(url_for(controller="workflow", action="create"), "Create New Workflow", submit_text="Create", use_panels=True) \
.add_text("workflow_name", "Workflow Name", value="Unnamed workflow") \
.add_text("workflow_annotation",
"Workflow Annotation",
value="",
help="A description of the workflow; annotation is shown alongside shared or published workflows.")
help="A description of the workflow; annotation is shown alongside shared or published workflows.")'''
@web.json
def save_workflow_as(self, trans, workflow_name, workflow_data, workflow_annotation=""):
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long