allow adding waiting_for and task_title columns in instance list page

This commit is contained in:
jasquat 2023-05-04 08:00:37 -04:00
parent 8655ca0cd0
commit fa85a06efe
2 changed files with 12 additions and 3 deletions

View File

@ -298,8 +298,8 @@ def process_instance_report_show(
def process_instance_report_column_list(
process_model_identifier: Optional[str] = None,
) -> flask.wrappers.Response:
"""Process_instance_report_column_list."""
table_columns = ProcessInstanceReportService.builtin_column_options()
system_report_column_options = ProcessInstanceReportService.system_report_column_options()
columns_for_metadata_query = (
db.session.query(ProcessInstanceMetadataModel.key)
.order_by(ProcessInstanceMetadataModel.key)
@ -315,7 +315,7 @@ def process_instance_report_column_list(
columns_for_metadata_strings = [
{"Header": i[0], "accessor": i[0], "filterable": True} for i in columns_for_metadata
]
return make_response(jsonify(table_columns + columns_for_metadata_strings), 200)
return make_response(jsonify(table_columns + system_report_column_options + columns_for_metadata_strings), 200)
def process_instance_show_for_me(

View File

@ -320,7 +320,7 @@ class ProcessInstanceReportService:
@classmethod
def builtin_column_options(cls) -> list[ReportMetadataColumn]:
"""Builtin_column_options."""
"""Columns that are actually in the process instance table."""
return_value: list[ReportMetadataColumn] = [
{"Header": "Id", "accessor": "id", "filterable": False},
{
@ -339,6 +339,15 @@ class ProcessInstanceReportService:
]
return return_value
@classmethod
def system_report_column_options(cls) -> list[ReportMetadataColumn]:
"""Columns that are used with certain system reports."""
return_value: list[ReportMetadataColumn] = [
{"Header": "Task", "accessor": "task_title", "filterable": False},
{"Header": "Waiting For", "accessor": "waiting_for", "filterable": False},
]
return return_value
@classmethod
def get_filter_value(cls, filters: list[FilterValue], filter_key: str) -> Any:
for filter in filters: