Fixing some caching issues and places where the updates were not being processed completed. And updates to the docker file.
This commit is contained in:
parent
0685b282e8
commit
9a195bedad
|
@ -18,6 +18,10 @@ RUN pipenv install --dev
|
||||||
|
|
||||||
ENV FLASK_APP=./crc/__init__.py
|
ENV FLASK_APP=./crc/__init__.py
|
||||||
|
|
||||||
|
# run migrations
|
||||||
|
CMD ["pipenv", "run", "flask", "db", "upgrade"]
|
||||||
|
CMD ["pipenv", "run", "flask", "load-example-data"]
|
||||||
|
|
||||||
# include rejoiner code (gets overriden by local changes)
|
# include rejoiner code (gets overriden by local changes)
|
||||||
COPY . /crc-workflow/
|
COPY . /crc-workflow/
|
||||||
|
|
||||||
|
@ -26,3 +30,5 @@ CMD ["pipenv", "run", "python", "/crc-workflow/run.py"]
|
||||||
|
|
||||||
# expose ports
|
# expose ports
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ def update_file_from_request(file_model):
|
||||||
|
|
||||||
db.session.add(file_data_model)
|
db.session.add(file_data_model)
|
||||||
db.session.add(file_model)
|
db.session.add(file_model)
|
||||||
|
db.session.commit()
|
||||||
db.session.flush() # Assure the id is set on the model before returning it.
|
db.session.flush() # Assure the id is set on the model before returning it.
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,7 +75,8 @@ def get_file(file_id):
|
||||||
return send_file(
|
return send_file(
|
||||||
io.BytesIO(file_data.data),
|
io.BytesIO(file_data.data),
|
||||||
attachment_filename=file_data.file_model.name,
|
attachment_filename=file_data.file_model.name,
|
||||||
mimetype=file_data.file_model.content_type
|
mimetype=file_data.file_model.content_type,
|
||||||
|
cache_timeout=-1 # Don't cache these files on the browser.
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,11 @@ def get_workflow(workflow_id):
|
||||||
workflow = db.session.query(WorkflowModel).filter_by(id=workflow_id).first()
|
workflow = db.session.query(WorkflowModel).filter_by(id=workflow_id).first()
|
||||||
return schema.dump(workflow)
|
return schema.dump(workflow)
|
||||||
|
|
||||||
|
|
||||||
def delete(workflow_id):
|
def delete(workflow_id):
|
||||||
db.session.query(WorkflowModel).filter_by(id=workflow_id).delete()
|
db.session.query(WorkflowModel).filter_by(id=workflow_id).delete()
|
||||||
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
def get_tasks(workflow_id):
|
def get_tasks(workflow_id):
|
||||||
workflow = db.session.query(WorkflowModel).filter_by(id=workflow_id).first()
|
workflow = db.session.query(WorkflowModel).filter_by(id=workflow_id).first()
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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_1gjhqt9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.6.0-dev">
|
<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_1gjhqt9" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
|
||||||
<bpmn:process id="Process_1ds61df" isExecutable="true">
|
<bpmn:process id="Process_1ds61df" isExecutable="true">
|
||||||
<bpmn:startEvent id="StartEvent_1">
|
<bpmn:startEvent id="StartEvent_1">
|
||||||
<bpmn:outgoing>SequenceFlow_0ik56h0</bpmn:outgoing>
|
<bpmn:outgoing>SequenceFlow_0ik56h0</bpmn:outgoing>
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
<camunda:value id="cat" name="Cat Fact" />
|
<camunda:value id="cat" name="Cat Fact" />
|
||||||
<camunda:value id="buzzword" name="Business Buzzword" />
|
<camunda:value id="buzzword" name="Business Buzzword" />
|
||||||
</camunda:formField>
|
</camunda:formField>
|
||||||
<camunda:formField id="is_anonymous" label="Do you want to remain anonymous?" type="boolean">
|
<camunda:formField id="is_anonymous" label="Do you enjoy fried chicken with pickles?" type="boolean">
|
||||||
<camunda:properties>
|
<camunda:properties>
|
||||||
<camunda:property id="description" value="Choose "yes" if you don't want us to use your name" />
|
<camunda:property id="description" value="Choose "yes" if you don't want us to use your name" />
|
||||||
<camunda:property id="help" value="# Heading 1\n\nOh hey, it's Markdown text." />
|
<camunda:property id="help" value="# Heading 1\n\nOh hey, it's Markdown text." />
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
<camunda:constraint name="required" config="true" />
|
<camunda:constraint name="required" config="true" />
|
||||||
</camunda:validation>
|
</camunda:validation>
|
||||||
</camunda:formField>
|
</camunda:formField>
|
||||||
<camunda:formField id="should_send_greeting" label="Say hi to user?" type="enum" defaultValue="yes">
|
<camunda:formField id="should_send_greeting" label="Is Alex a lovely person?" type="enum" defaultValue="yes">
|
||||||
<camunda:properties>
|
<camunda:properties>
|
||||||
<camunda:property id="label_expression" value="model.name ? 'Say hi to ' + model.name + '?' : 'Say hi?'" />
|
<camunda:property id="label_expression" value="model.name ? 'Say hi to ' + model.name + '?' : 'Say hi?'" />
|
||||||
<camunda:property id="hide_expression" value="model.is_anonymous" />
|
<camunda:property id="hide_expression" value="model.is_anonymous" />
|
||||||
|
|
|
@ -4,7 +4,7 @@ import unittest
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from crc import db
|
from crc import db
|
||||||
from crc.models import WorkflowSpecModel, FileModel, FileType, FileSchema
|
from crc.models import WorkflowSpecModel, FileModel, FileType, FileSchema, FileDataModel
|
||||||
from tests.base_test import BaseTest
|
from tests.base_test import BaseTest
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ class TestApiFiles(BaseTest, unittest.TestCase):
|
||||||
file = db.session.query(FileModel).filter_by(workflow_spec_id = spec.id).first()
|
file = db.session.query(FileModel).filter_by(workflow_spec_id = spec.id).first()
|
||||||
|
|
||||||
data = {}
|
data = {}
|
||||||
data['file'] = io.BytesIO(b"abcdef"), 'random_fact.bpmn'
|
data['file'] = io.BytesIO(b"hijklim"), 'random_fact.bpmn'
|
||||||
|
|
||||||
rv = self.app.put('/v1.0/file/%i' % file.id, data=data, follow_redirects=True,
|
rv = self.app.put('/v1.0/file/%i' % file.id, data=data, follow_redirects=True,
|
||||||
content_type='multipart/form-data')
|
content_type='multipart/form-data')
|
||||||
|
@ -83,6 +83,9 @@ class TestApiFiles(BaseTest, unittest.TestCase):
|
||||||
self.assertEqual("application/octet-stream", file.content_type)
|
self.assertEqual("application/octet-stream", file.content_type)
|
||||||
self.assertEqual(spec.id, file.workflow_spec_id)
|
self.assertEqual(spec.id, file.workflow_spec_id)
|
||||||
|
|
||||||
|
data_model = db.session.query(FileDataModel).filter_by(file_model_id = file.id).first()
|
||||||
|
self.assertEqual(b"hijklim", data_model.data)
|
||||||
|
|
||||||
def test_get_file(self):
|
def test_get_file(self):
|
||||||
self.load_example_data()
|
self.load_example_data()
|
||||||
spec = db.session.query(WorkflowSpecModel).first()
|
spec = db.session.query(WorkflowSpecModel).first()
|
||||||
|
|
Loading…
Reference in New Issue