Workflows: Refactor workflow preview generation
Refactor the workflow preview generation to work as a background task API service. Solves GitLab issue #532. The image generation runs as an out of process task ensuring that the HTTP request is never compromised. A new task queue named "document_states_fast" was created. The settings WORKFLOWS_IMAGE_CACHE_TIME, WORKFLOWS_IMAGE_CACHE_STORAGE_BACKEND, WORKFLOWS_IMAGE_CACHE_STORAGE_BACKEND_ARGUMENTS we added. Images generated are stored by default under /mayan/media/workflows. The Dockerfile and deployment instructions are updated to include the new queue. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -12,10 +12,10 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from common.forms import DynamicModelForm
|
||||
|
||||
from .classes import WorkflowAction
|
||||
from .fields import WorfklowImageField
|
||||
from .models import (
|
||||
Workflow, WorkflowState, WorkflowStateAction, WorkflowTransition
|
||||
)
|
||||
from .widgets import WorkflowImageWidget
|
||||
|
||||
|
||||
class WorkflowActionSelectionForm(forms.Form):
|
||||
@@ -178,9 +178,9 @@ class WorkflowInstanceTransitionForm(forms.Form):
|
||||
|
||||
|
||||
class WorkflowPreviewForm(forms.Form):
|
||||
preview = forms.IntegerField(widget=WorkflowImageWidget())
|
||||
workflow = WorfklowImageField()
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
instance = kwargs.pop('instance', None)
|
||||
super(WorkflowPreviewForm, self).__init__(*args, **kwargs)
|
||||
self.fields['preview'].initial = instance
|
||||
self.fields['workflow'].initial = instance
|
||||
|
||||
Reference in New Issue
Block a user