WIP: Adds enum field lookup option data

This commit is contained in:
Aaron Louie 2020-07-03 12:20:10 -04:00
parent 340ae68eed
commit f344fe60c0
6 changed files with 97 additions and 10 deletions

View File

@ -61,7 +61,7 @@ class Task(object):
class OptionSchema(ma.Schema):
class Meta:
fields = ["id", "name"]
fields = ["id", "name", "data"]
class ValidationSchema(ma.Schema):
@ -71,15 +71,11 @@ class ValidationSchema(ma.Schema):
class FormFieldPropertySchema(ma.Schema):
class Meta:
fields = [
"id", "value"
]
fields = ["id", "value"]
class FormFieldSchema(ma.Schema):
class Meta:
fields = [
"id", "type", "label", "default_value", "options", "validation", "properties", "value"
]
fields = ["id", "type", "label", "default_value", "options", "validation", "properties", "value"]
default_value = marshmallow.fields.String(required=False, allow_none=True)
options = marshmallow.fields.List(marshmallow.fields.Nested(OptionSchema))

View File

@ -1,4 +1,5 @@
import copy
import json
import string
from datetime import datetime
import random
@ -319,8 +320,8 @@ class WorkflowService(object):
task.data = spiff_task.data
if hasattr(spiff_task.task_spec, "form"):
task.form = spiff_task.task_spec.form
for field in task.form.fields:
WorkflowService.process_options(spiff_task, field)
for i, field in enumerate(task.form.fields):
task.form.fields[i] = WorkflowService.process_options(spiff_task, field)
task.documentation = WorkflowService._process_documentation(spiff_task)
# All ready tasks should have a valid name, and this can be computed for
@ -391,7 +392,9 @@ class WorkflowService(object):
if not hasattr(field, 'options'):
field.options = []
for d in data:
field.options.append({"id": d.value, "name": d.label})
field.options.append({"id": d.value, "name": d.label, "data": d.data})
return field
@staticmethod
def log_task_action(user_uid, workflow_model, spiff_task, action, version):

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0xebv4o" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
<bpmn:process id="Process_1e61sci" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_1gnws9u</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_1gnws9u" sourceRef="StartEvent_1" targetRef="Activity_13fk8t8" />
<bpmn:endEvent id="Event_13knd01">
<bpmn:incoming>Flow_1xria19</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_1xria19" sourceRef="Activity_0vmt66y" targetRef="Event_13knd01" />
<bpmn:userTask id="Activity_13fk8t8" name="Display Some Lookup Fields" camunda:formKey="lookup_form">
<bpmn:extensionElements>
<camunda:formData>
<camunda:formField id="lookup_dropdown" label="This is a dropdown" type="enum">
<camunda:properties>
<camunda:property id="spreadsheet.name" value="lookup.xlsx" />
<camunda:property id="spreadsheet.value.column" value="UID" />
<camunda:property id="spreadsheet.label.column" value="FULL_NAME" />
</camunda:properties>
</camunda:formField>
<camunda:formField id="lookup_checkbox" label="These are checkboxes" type="enum">
<camunda:properties>
<camunda:property id="spreadsheet.name" value="lookup.xlsx" />
<camunda:property id="spreadsheet.value.column" value="UID" />
<camunda:property id="spreadsheet.label.column" value="FULL_NAME" />
<camunda:property id="enum_type" value="checkbox" />
</camunda:properties>
</camunda:formField>
<camunda:formField id="lookup_radio" label="Here are some radio buttons" type="enum">
<camunda:properties>
<camunda:property id="spreadsheet.name" value="lookup.xlsx" />
<camunda:property id="spreadsheet.value.column" value="UID" />
<camunda:property id="spreadsheet.label.column" value="FULL_NAME" />
<camunda:property id="enum_type" value="radio" />
</camunda:properties>
</camunda:formField>
</camunda:formData>
</bpmn:extensionElements>
<bpmn:incoming>Flow_1gnws9u</bpmn:incoming>
<bpmn:outgoing>Flow_0zud2rb</bpmn:outgoing>
</bpmn:userTask>
<bpmn:sequenceFlow id="Flow_0zud2rb" sourceRef="Activity_13fk8t8" targetRef="Activity_0vmt66y" />
<bpmn:manualTask id="Activity_0vmt66y" name="Display Stuff">
<bpmn:documentation>lookup_dropdown: {{ lookup_dropdown }}
lookup_checkbox: {{ lookup_checkbox }}
lookup_radio: {{ lookup_radio }}
</bpmn:documentation>
<bpmn:incoming>Flow_0zud2rb</bpmn:incoming>
<bpmn:outgoing>Flow_1xria19</bpmn:outgoing>
</bpmn:manualTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1e61sci">
<bpmndi:BPMNEdge id="Flow_1gnws9u_di" bpmnElement="Flow_1gnws9u">
<di:waypoint x="215" y="117" />
<di:waypoint x="270" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1xria19_di" bpmnElement="Flow_1xria19">
<di:waypoint x="510" y="117" />
<di:waypoint x="552" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0zud2rb_di" bpmnElement="Flow_0zud2rb">
<di:waypoint x="370" y="117" />
<di:waypoint x="410" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_142ek9m_di" bpmnElement="Activity_13fk8t8">
<dc:Bounds x="270" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_13knd01_di" bpmnElement="Event_13knd01">
<dc:Bounds x="552" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_17ng7d7_di" bpmnElement="Activity_0vmt66y">
<dc:Bounds x="410" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

Binary file not shown.

View File

@ -69,6 +69,12 @@ class ExampleDataLoader:
db.session.commit()
# Pass IRB Review
self.create_spec(id="group_test",
name="group_test",
display_name="Group Test",
description="TBD",
category_id=0,
display_order=0)
self.create_spec(id="irb_api_personnel",
name="irb_api_personnel",
display_name="Personnel",