Example #1
0
def edit_workflow(request, workflow):
    history = History.objects.filter(submitter=request.user,
                                     job=workflow).order_by('-submission_date')
    workflow_form = WorkflowForm(instance=workflow)
    user_can_access_job = workflow.is_accessible(request.user)
    user_can_edit_job = workflow.is_editable(request.user)

    return render(
        'editor/edit_workflow.mako', request, {
            'workflow_form':
            workflow_form,
            'workflow':
            workflow,
            'history':
            history,
            'user_can_access_job':
            user_can_access_job,
            'user_can_edit_job':
            user_can_edit_job,
            'job_properties':
            extract_field_data(workflow_form['job_properties']),
            'link_form':
            LinkForm(),
            'default_link_form':
            DefaultLinkForm(action=workflow.start),
            'node_form':
            NodeForm(),
            'action_forms':
            [(node_type, design_form_by_type(node_type, request.user,
                                             workflow)())
             for node_type in ACTION_TYPES.iterkeys()]
        })
Example #2
0
def edit_workflow(request, workflow):
    history = History.objects.filter(submitter=request.user,
                                     job=workflow).order_by('-submission_date')
    workflow_form = WorkflowForm(instance=workflow)
    user_can_access_job = workflow.can_read(request.user)
    user_can_edit_job = workflow.is_editable(request.user)
    oozie_api = get_oozie(request.user)
    credentials = Credentials()
    credentials.fetch(oozie_api)

    return render(
        'editor/edit_workflow.mako', request, {
            'oozie_api':
            oozie_api,
            'workflow_form':
            workflow_form,
            'workflow':
            workflow,
            'history':
            history,
            'user_can_access_job':
            user_can_access_job,
            'user_can_edit_job':
            user_can_edit_job,
            'job_properties':
            extract_field_data(workflow_form['job_properties']),
            'link_form':
            LinkForm(),
            'default_link_form':
            DefaultLinkForm(action=workflow.start),
            'node_form':
            NodeForm(),
            'action_forms':
            [(node_type, design_form_by_type(node_type, request.user,
                                             workflow)())
             for node_type in ACTION_TYPES.keys()],
            'credentials':
            json.dumps(list(credentials.credentials.keys()))
        })