do not filter files on process model show and added sorting to files w/ burnettk
This commit is contained in:
parent
7a96a6f756
commit
512ac5f3c1
|
@ -88,10 +88,12 @@ CONTENT_TYPES = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass(order=True)
|
||||||
class File:
|
class File:
|
||||||
"""File."""
|
"""File."""
|
||||||
|
|
||||||
|
sort_index: str = field(init=False)
|
||||||
|
|
||||||
content_type: str
|
content_type: str
|
||||||
name: str
|
name: str
|
||||||
type: str
|
type: str
|
||||||
|
@ -107,6 +109,10 @@ class File:
|
||||||
process_group_id: Optional[str] = None
|
process_group_id: Optional[str] = None
|
||||||
archived: bool = False
|
archived: bool = False
|
||||||
|
|
||||||
|
def __post_init__(self):
|
||||||
|
"""__post_init__."""
|
||||||
|
self.sort_index = f"{self.type}:{self.name}"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_file_system(
|
def from_file_system(
|
||||||
cls, file_name, file_type, content_type, last_modified, file_size
|
cls, file_name, file_type, content_type, last_modified, file_size
|
||||||
|
|
|
@ -115,7 +115,7 @@ def process_model_show(process_group_id, process_model_id):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
files = SpecFileService.get_files(process_model, extension_filter="bpmn")
|
files = sorted(SpecFileService.get_files(process_model))
|
||||||
process_model.files = files
|
process_model.files = files
|
||||||
process_model_json = ProcessModelInfoSchema().dump(process_model)
|
process_model_json = ProcessModelInfoSchema().dump(process_model)
|
||||||
return process_model_json
|
return process_model_json
|
||||||
|
|
|
@ -49,7 +49,6 @@ class Script:
|
||||||
We may be able to remove the task for each of these calls if we are not using it other than potentially
|
We may be able to remove the task for each of these calls if we are not using it other than potentially
|
||||||
updating the task data.
|
updating the task data.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def make_closure(subclass, task, workflow_id):
|
def make_closure(subclass, task, workflow_id):
|
||||||
"""Yes - this is black magic.
|
"""Yes - this is black magic.
|
||||||
|
|
||||||
|
@ -85,7 +84,6 @@ class Script:
|
||||||
We may be able to remove the task for each of these calls if we are not using it other than potentially
|
We may be able to remove the task for each of these calls if we are not using it other than potentially
|
||||||
updating the task data.
|
updating the task data.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def make_closure_validate(subclass, task, workflow_id):
|
def make_closure_validate(subclass, task, workflow_id):
|
||||||
"""Make_closure_validate."""
|
"""Make_closure_validate."""
|
||||||
instance = subclass()
|
instance = subclass()
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
"""test_file."""
|
||||||
|
|
||||||
|
from spiffworkflow_backend.models.file import File
|
||||||
|
|
||||||
|
|
||||||
|
def test_files_can_be_sorted() -> None:
|
||||||
|
"""Test_files_can_be_sorted."""
|
||||||
|
europe = create_test_file(type="bpmn", name="europe")
|
||||||
|
asia = create_test_file(type="bpmn", name="asia")
|
||||||
|
africa = create_test_file(type="dmn", name="africa")
|
||||||
|
oceania = create_test_file(type="dmn", name="oceania")
|
||||||
|
|
||||||
|
mylist = [europe, oceania, asia, africa]
|
||||||
|
assert sorted(mylist) == [asia, europe, africa, oceania]
|
||||||
|
|
||||||
|
|
||||||
|
def create_test_file(type: str, name: str):
|
||||||
|
"""Create_test_file."""
|
||||||
|
return File(type=type, name=name, content_type=type, document={}, last_modified="Tuesday", size="1")
|
Loading…
Reference in New Issue