コード例 #1
0
def form_for_activity(form):
    try:
        inputs = task_service.get_inputs(form['act_id'])
        outputs = task_service.get_outputs(form['act_id'])
    except Exception:
        subprocess_stack = form['subprocess_stack']
        act_id = form['act_id']
        instance_data = PipelineInstance.objects.get(instance_id=form['instance_id']).execution_data
        inputs = pipeline_parser.WebPipelineAdapter(instance_data).get_act_inputs(act_id=act_id,
                                                                                  subprocess_stack=subprocess_stack)
        outputs = {}

    component = library.ComponentLibrary.get_component_class(form['component_code'])
    # append inputs
    inputs_table = inputs

    # append outputs
    outputs_table = []
    outputs_format = component.outputs_format()
    for outputs_item in outputs_format:
        value = outputs.get('outputs', {}).get(outputs_item['key'], '')
        outputs_table.append({
            'name': outputs_item['name'],
            'value': value
        })

    data = {
        'inputs': inputs_table,
        'outputs': outputs_table,
        'ex_data': outputs.get('ex_data', '')
    }
    return data
コード例 #2
0
def get_form_for_retry(request):
    act_id = request.GET.get('act_id')
    act_data = task_service.get_inputs(act_id)
    return JsonResponse(act_data, safe=True)