mirror of
https://github.com/status-im/spiff-arena.git
synced 2025-03-03 02:40:37 +00:00
Accept report_identifier
This commit is contained in:
parent
1dcaddf715
commit
513da570e2
@ -79,6 +79,7 @@ class ProcessInstanceReportModel(SpiffworkflowBaseDBModel):
|
|||||||
identifier=identifier, created_by_id=user.id
|
identifier=identifier, created_by_id=user.id
|
||||||
).first()
|
).first()
|
||||||
|
|
||||||
|
# TODO replace with system report that is loaded on launch (or similar)
|
||||||
if process_instance_report is None:
|
if process_instance_report is None:
|
||||||
report_metadata = {
|
report_metadata = {
|
||||||
"columns": [
|
"columns": [
|
||||||
|
@ -739,7 +739,7 @@ def process_instance_list(
|
|||||||
report_identifier: Optional[str] = None
|
report_identifier: Optional[str] = None
|
||||||
) -> flask.wrappers.Response:
|
) -> flask.wrappers.Response:
|
||||||
"""Process_instance_list."""
|
"""Process_instance_list."""
|
||||||
process_instance_report = ProcessInstanceReportModel.default_report(g.user)
|
process_instance_report = ProcessInstanceReportService.report_with_identifier(g.user, report_identifier)
|
||||||
|
|
||||||
if user_filter:
|
if user_filter:
|
||||||
report_filter = ProcessInstanceReportFilter(
|
report_filter = ProcessInstanceReportFilter(
|
||||||
|
@ -5,6 +5,7 @@ from typing import Optional
|
|||||||
from spiffworkflow_backend.models.process_instance_report import (
|
from spiffworkflow_backend.models.process_instance_report import (
|
||||||
ProcessInstanceReportModel,
|
ProcessInstanceReportModel,
|
||||||
)
|
)
|
||||||
|
from spiffworkflow_backend.models.user import UserModel
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@ -41,6 +42,63 @@ class ProcessInstanceReportFilter:
|
|||||||
class ProcessInstanceReportService:
|
class ProcessInstanceReportService:
|
||||||
"""ProcessInstanceReportService."""
|
"""ProcessInstanceReportService."""
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def report_with_identifier(
|
||||||
|
cls,
|
||||||
|
user: UserModel,
|
||||||
|
report_identifier: Optional[str] = None
|
||||||
|
) -> ProcessInstanceReportModel:
|
||||||
|
if report_identifier is None:
|
||||||
|
return ProcessInstanceReportModel.default_report(user)
|
||||||
|
|
||||||
|
# TODO replace with system reports that are loaded on launch (or similar)
|
||||||
|
temp_system_metdata_map = {
|
||||||
|
"system_report_instances_initiated_by_me": {
|
||||||
|
"columns": [
|
||||||
|
{"Header": "id", "accessor": "id"},
|
||||||
|
{
|
||||||
|
"Header": "process_model_identifier",
|
||||||
|
"accessor": "process_model_identifier",
|
||||||
|
},
|
||||||
|
{"Header": "start_in_seconds", "accessor": "start_in_seconds"},
|
||||||
|
{"Header": "end_in_seconds", "accessor": "end_in_seconds"},
|
||||||
|
{"Header": "status", "accessor": "status"},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"system_report_instances_with_tasks_completed_by_me": {
|
||||||
|
"columns": [
|
||||||
|
{"Header": "start_in_seconds", "accessor": "start_in_seconds"},
|
||||||
|
{"Header": "end_in_seconds", "accessor": "end_in_seconds"},
|
||||||
|
{"Header": "status", "accessor": "status"},
|
||||||
|
{"Header": "id", "accessor": "id"},
|
||||||
|
{
|
||||||
|
"Header": "process_model_identifier",
|
||||||
|
"accessor": "process_model_identifier",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
"system_report_instances_with_tasks_completed_by_my_groups": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"Header": "process_model_identifier",
|
||||||
|
"accessor": "process_model_identifier",
|
||||||
|
},
|
||||||
|
{"Header": "start_in_seconds", "accessor": "start_in_seconds"},
|
||||||
|
{"Header": "end_in_seconds", "accessor": "end_in_seconds"},
|
||||||
|
{"Header": "status", "accessor": "status"},
|
||||||
|
{"Header": "id", "accessor": "id"},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
process_instance_report = cls(
|
||||||
|
identifier=identifier,
|
||||||
|
created_by_id=user.id,
|
||||||
|
report_metadata=temp_system_metadata_map[report_identifier],
|
||||||
|
)
|
||||||
|
|
||||||
|
return process_instance_report
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def filter_by_to_dict(
|
def filter_by_to_dict(
|
||||||
cls, process_instance_report: ProcessInstanceReportModel
|
cls, process_instance_report: ProcessInstanceReportModel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user