Merge pull request #55 from sartography/feature/navigation
Fixing a bug with navigation where elements went missing past exclusi…
This commit is contained in:
commit
8a6c0a62f7
|
@ -783,7 +783,7 @@
|
|||
"spiffworkflow": {
|
||||
"editable": true,
|
||||
"git": "https://github.com/sartography/SpiffWorkflow.git",
|
||||
"ref": "661902387021f7130ae27fa35434eb3b2c138610"
|
||||
"ref": "29afbcd69d7bb266c7b08962b5f0b36fdbc4636b"
|
||||
},
|
||||
"sqlalchemy": {
|
||||
"hashes": [
|
||||
|
|
|
@ -93,6 +93,9 @@ def __get_workflow_api_model(processor: WorkflowProcessor, next_task = None):
|
|||
spiff_task = processor.bpmn_workflow.get_task(nav_item['task_id'])
|
||||
if 'description' in nav_item:
|
||||
nav_item['title'] = nav_item.pop('description')
|
||||
# fixme: duplicate code from the workflow_service. Should only do this in one place.
|
||||
if ' ' in nav_item['title']:
|
||||
nav_item['title'] = nav_item['title'].partition(' ')[2]
|
||||
else:
|
||||
nav_item['title'] = ""
|
||||
if spiff_task:
|
||||
|
|
|
@ -0,0 +1,143 @@
|
|||
<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_83c9f25" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.3">
|
||||
<bpmn:process id="Process_84bead4" isExecutable="true">
|
||||
<bpmn:startEvent id="StartEvent_1">
|
||||
<bpmn:outgoing>Flow_1ux3ndu</bpmn:outgoing>
|
||||
</bpmn:startEvent>
|
||||
<bpmn:sequenceFlow id="Flow_1ux3ndu" sourceRef="StartEvent_1" targetRef="Activity_07iglj7" />
|
||||
<bpmn:exclusiveGateway id="Gateway_1lh8c45" name="Decide Which Branch?">
|
||||
<bpmn:incoming>Flow_1ut95vk</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_1fok0lz</bpmn:outgoing>
|
||||
<bpmn:outgoing>Flow_01he29w</bpmn:outgoing>
|
||||
</bpmn:exclusiveGateway>
|
||||
<bpmn:sequenceFlow id="Flow_1ut95vk" sourceRef="Activity_07iglj7" targetRef="Gateway_1lh8c45" />
|
||||
<bpmn:sequenceFlow id="Flow_1fok0lz" name="a" sourceRef="Gateway_1lh8c45" targetRef="Activity_19ig0xo">
|
||||
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">which_branch == 'a'</bpmn:conditionExpression>
|
||||
</bpmn:sequenceFlow>
|
||||
<bpmn:sequenceFlow id="Flow_01he29w" name="b" sourceRef="Gateway_1lh8c45" targetRef="Activity_1hx53cu">
|
||||
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">which_branch == 'b'</bpmn:conditionExpression>
|
||||
</bpmn:sequenceFlow>
|
||||
<bpmn:exclusiveGateway id="Gateway_0ikuwt5">
|
||||
<bpmn:incoming>Flow_03ddkww</bpmn:incoming>
|
||||
<bpmn:incoming>Flow_0ozlczo</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_1ph05b1</bpmn:outgoing>
|
||||
</bpmn:exclusiveGateway>
|
||||
<bpmn:sequenceFlow id="Flow_03ddkww" sourceRef="Activity_19ig0xo" targetRef="Gateway_0ikuwt5" />
|
||||
<bpmn:sequenceFlow id="Flow_0ozlczo" sourceRef="Activity_1hx53cu" targetRef="Gateway_0ikuwt5" />
|
||||
<bpmn:sequenceFlow id="Flow_1ph05b1" sourceRef="Gateway_0ikuwt5" targetRef="Activity_1b15riu" />
|
||||
<bpmn:userTask id="Activity_07iglj7" name="Enter Task 1" camunda:formKey="form_task_1">
|
||||
<bpmn:extensionElements>
|
||||
<camunda:formData>
|
||||
<camunda:formField id="which_branch" label="Which branch?" type="enum">
|
||||
<camunda:value id="a" name="Task 2a" />
|
||||
<camunda:value id="b" name="Task 2b" />
|
||||
</camunda:formField>
|
||||
</camunda:formData>
|
||||
</bpmn:extensionElements>
|
||||
<bpmn:incoming>Flow_1ux3ndu</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_1ut95vk</bpmn:outgoing>
|
||||
</bpmn:userTask>
|
||||
<bpmn:userTask id="Activity_19ig0xo" name="Enter Task 2a" camunda:formKey="form_task2a">
|
||||
<bpmn:extensionElements>
|
||||
<camunda:formData>
|
||||
<camunda:formField id="FormField_0taj99h" label="What is your favorite color?" type="string" />
|
||||
</camunda:formData>
|
||||
</bpmn:extensionElements>
|
||||
<bpmn:incoming>Flow_1fok0lz</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_03ddkww</bpmn:outgoing>
|
||||
</bpmn:userTask>
|
||||
<bpmn:userTask id="Activity_1hx53cu" name="Enter Task 2b" camunda:formKey="form_task2b">
|
||||
<bpmn:extensionElements>
|
||||
<camunda:formData>
|
||||
<camunda:formField id="FormField_1l30p68" label="Do you like pie?" type="boolean" />
|
||||
</camunda:formData>
|
||||
</bpmn:extensionElements>
|
||||
<bpmn:incoming>Flow_01he29w</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_0ozlczo</bpmn:outgoing>
|
||||
</bpmn:userTask>
|
||||
<bpmn:userTask id="Activity_1b15riu" name="Enter Task 3" camunda:formKey="form_task3">
|
||||
<bpmn:extensionElements>
|
||||
<camunda:formData>
|
||||
<camunda:formField id="FormField_3nh4vhj" label="Tell me a bedtime story." type="textarea" />
|
||||
</camunda:formData>
|
||||
</bpmn:extensionElements>
|
||||
<bpmn:incoming>Flow_1ph05b1</bpmn:incoming>
|
||||
<bpmn:outgoing>Flow_0kr8pvy</bpmn:outgoing>
|
||||
</bpmn:userTask>
|
||||
<bpmn:endEvent id="Event_0im2hti">
|
||||
<bpmn:incoming>Flow_0kr8pvy</bpmn:incoming>
|
||||
</bpmn:endEvent>
|
||||
<bpmn:sequenceFlow id="Flow_0kr8pvy" sourceRef="Activity_1b15riu" targetRef="Event_0im2hti" />
|
||||
</bpmn:process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_84bead4">
|
||||
<bpmndi:BPMNEdge id="Flow_0kr8pvy_di" bpmnElement="Flow_0kr8pvy">
|
||||
<di:waypoint x="890" y="177" />
|
||||
<di:waypoint x="952" y="177" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_1ph05b1_di" bpmnElement="Flow_1ph05b1">
|
||||
<di:waypoint x="735" y="177" />
|
||||
<di:waypoint x="790" y="177" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_0ozlczo_di" bpmnElement="Flow_0ozlczo">
|
||||
<di:waypoint x="630" y="290" />
|
||||
<di:waypoint x="710" y="290" />
|
||||
<di:waypoint x="710" y="202" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_03ddkww_di" bpmnElement="Flow_03ddkww">
|
||||
<di:waypoint x="630" y="177" />
|
||||
<di:waypoint x="685" y="177" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_01he29w_di" bpmnElement="Flow_01he29w">
|
||||
<di:waypoint x="450" y="202" />
|
||||
<di:waypoint x="450" y="290" />
|
||||
<di:waypoint x="530" y="290" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="462" y="243" width="6" height="14" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_1fok0lz_di" bpmnElement="Flow_1fok0lz">
|
||||
<di:waypoint x="475" y="177" />
|
||||
<di:waypoint x="530" y="177" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="500" y="159" width="6" height="14" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_1ut95vk_di" bpmnElement="Flow_1ut95vk">
|
||||
<di:waypoint x="370" y="177" />
|
||||
<di:waypoint x="425" y="177" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge id="Flow_1ux3ndu_di" bpmnElement="Flow_1ux3ndu">
|
||||
<di:waypoint x="215" y="177" />
|
||||
<di:waypoint x="270" y="177" />
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
|
||||
<dc:Bounds x="179" y="159" width="36" height="36" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Gateway_1lh8c45_di" bpmnElement="Gateway_1lh8c45" isMarkerVisible="true">
|
||||
<dc:Bounds x="425" y="152" width="50" height="50" />
|
||||
<bpmndi:BPMNLabel>
|
||||
<dc:Bounds x="417" y="122" width="68" height="27" />
|
||||
</bpmndi:BPMNLabel>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Gateway_0ikuwt5_di" bpmnElement="Gateway_0ikuwt5" isMarkerVisible="true">
|
||||
<dc:Bounds x="685" y="152" width="50" height="50" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Activity_0f7bxmu_di" bpmnElement="Activity_07iglj7">
|
||||
<dc:Bounds x="270" y="137" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Activity_0pyt443_di" bpmnElement="Activity_19ig0xo">
|
||||
<dc:Bounds x="530" y="137" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Activity_1mv6e1a_di" bpmnElement="Activity_1hx53cu">
|
||||
<dc:Bounds x="530" y="250" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Activity_1hbzn0k_di" bpmnElement="Activity_1b15riu">
|
||||
<dc:Bounds x="790" y="137" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Event_0im2hti_di" bpmnElement="Event_0im2hti">
|
||||
<dc:Bounds x="952" y="159" width="36" height="36" />
|
||||
</bpmndi:BPMNShape>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</bpmn:definitions>
|
|
@ -154,7 +154,7 @@ class TestTasksApi(BaseTest):
|
|||
|
||||
self.assertIsNotNone(workflow_api.navigation)
|
||||
nav = workflow_api.navigation
|
||||
self.assertEquals(5, len(nav))
|
||||
self.assertEquals(6, len(nav))
|
||||
self.assertEquals("Do You Have Bananas", nav[0]['title'])
|
||||
self.assertEquals("READY", nav[0]['state'])
|
||||
self.assertEquals("Bananas?", nav[1]['title'])
|
||||
|
@ -162,6 +162,23 @@ class TestTasksApi(BaseTest):
|
|||
self.assertEquals("yes", nav[2]['title'])
|
||||
self.assertEquals("NOOP", nav[2]['state'])
|
||||
|
||||
def test_navigation_with_exclusive_gateway(self):
|
||||
self.load_example_data()
|
||||
workflow = self.create_workflow('exclusive_gateway_2')
|
||||
|
||||
# get the first form in the two form workflow.
|
||||
workflow_api = self.get_workflow_api(workflow)
|
||||
self.assertIsNotNone(workflow_api.navigation)
|
||||
nav = workflow_api.navigation
|
||||
self.assertEquals(7, len(nav))
|
||||
self.assertEquals("Task 1", nav[0]['title'])
|
||||
self.assertEquals("Which Branch?", nav[1]['title'])
|
||||
self.assertEquals("a", nav[2]['title'])
|
||||
self.assertEquals("Task 2a", nav[3]['title'])
|
||||
self.assertEquals("b", nav[4]['title'])
|
||||
self.assertEquals("Task 2b", nav[5]['title'])
|
||||
self.assertEquals("Task 3", nav[6]['title'])
|
||||
|
||||
|
||||
def test_document_added_to_workflow_shows_up_in_file_list(self):
|
||||
self.load_example_data()
|
||||
|
|
Loading…
Reference in New Issue