a couple updates for extensions w/ burnettk
This commit is contained in:
parent
8f50749fa0
commit
f3e7bbaa02
|
@ -23,7 +23,6 @@ from spiffworkflow_backend.models.process_instance import ProcessInstanceApiSche
|
||||||
from spiffworkflow_backend.models.process_instance import ProcessInstanceCannotBeDeletedError
|
from spiffworkflow_backend.models.process_instance import ProcessInstanceCannotBeDeletedError
|
||||||
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
|
from spiffworkflow_backend.models.process_instance import ProcessInstanceModel
|
||||||
from spiffworkflow_backend.models.process_instance import ProcessInstanceModelSchema
|
from spiffworkflow_backend.models.process_instance import ProcessInstanceModelSchema
|
||||||
from spiffworkflow_backend.models.process_instance_metadata import ProcessInstanceMetadataModel
|
|
||||||
from spiffworkflow_backend.models.process_instance_queue import ProcessInstanceQueueModel
|
from spiffworkflow_backend.models.process_instance_queue import ProcessInstanceQueueModel
|
||||||
from spiffworkflow_backend.models.process_instance_report import ProcessInstanceReportModel
|
from spiffworkflow_backend.models.process_instance_report import ProcessInstanceReportModel
|
||||||
from spiffworkflow_backend.models.process_instance_report import Report
|
from spiffworkflow_backend.models.process_instance_report import Report
|
||||||
|
@ -291,21 +290,9 @@ def process_instance_report_column_list(
|
||||||
) -> flask.wrappers.Response:
|
) -> flask.wrappers.Response:
|
||||||
table_columns = ProcessInstanceReportService.builtin_column_options()
|
table_columns = ProcessInstanceReportService.builtin_column_options()
|
||||||
system_report_column_options = ProcessInstanceReportService.system_report_column_options()
|
system_report_column_options = ProcessInstanceReportService.system_report_column_options()
|
||||||
columns_for_metadata_query = (
|
columns_for_metadata_strings = ProcessInstanceReportService.process_instance_metadata_as_columns(
|
||||||
db.session.query(ProcessInstanceMetadataModel.key)
|
process_model_identifier
|
||||||
.order_by(ProcessInstanceMetadataModel.key)
|
|
||||||
.distinct() # type: ignore
|
|
||||||
)
|
)
|
||||||
if process_model_identifier:
|
|
||||||
columns_for_metadata_query = columns_for_metadata_query.join(ProcessInstanceModel)
|
|
||||||
columns_for_metadata_query = columns_for_metadata_query.filter(
|
|
||||||
ProcessInstanceModel.process_model_identifier == process_model_identifier
|
|
||||||
)
|
|
||||||
|
|
||||||
columns_for_metadata = columns_for_metadata_query.all()
|
|
||||||
columns_for_metadata_strings = [
|
|
||||||
{"Header": i[0], "accessor": i[0], "filterable": True} for i in columns_for_metadata
|
|
||||||
]
|
|
||||||
return make_response(jsonify(table_columns + system_report_column_options + columns_for_metadata_strings), 200)
|
return make_response(jsonify(table_columns + system_report_column_options + columns_for_metadata_strings), 200)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ from flask import current_app
|
||||||
from flask_sqlalchemy.query import Query
|
from flask_sqlalchemy.query import Query
|
||||||
from spiffworkflow_backend.exceptions.api_error import ApiError
|
from spiffworkflow_backend.exceptions.api_error import ApiError
|
||||||
from spiffworkflow_backend.models.db import SpiffworkflowBaseDBModel
|
from spiffworkflow_backend.models.db import SpiffworkflowBaseDBModel
|
||||||
|
from spiffworkflow_backend.models.db import db
|
||||||
from spiffworkflow_backend.models.group import GroupModel
|
from spiffworkflow_backend.models.group import GroupModel
|
||||||
from spiffworkflow_backend.models.human_task import HumanTaskModel
|
from spiffworkflow_backend.models.human_task import HumanTaskModel
|
||||||
from spiffworkflow_backend.models.human_task_user import HumanTaskUserModel
|
from spiffworkflow_backend.models.human_task_user import HumanTaskUserModel
|
||||||
|
@ -181,6 +182,27 @@ class ProcessInstanceReportService:
|
||||||
return_value: ReportMetadata = temp_system_metadata_map[metadata_key]
|
return_value: ReportMetadata = temp_system_metadata_map[metadata_key]
|
||||||
return return_value
|
return return_value
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def process_instance_metadata_as_columns(
|
||||||
|
cls, process_model_identifier: str | None = None
|
||||||
|
) -> list[ReportMetadataColumn]:
|
||||||
|
columns_for_metadata_query = (
|
||||||
|
db.session.query(ProcessInstanceMetadataModel.key)
|
||||||
|
.order_by(ProcessInstanceMetadataModel.key)
|
||||||
|
.distinct() # type: ignore
|
||||||
|
)
|
||||||
|
if process_model_identifier:
|
||||||
|
columns_for_metadata_query = columns_for_metadata_query.join(ProcessInstanceModel)
|
||||||
|
columns_for_metadata_query = columns_for_metadata_query.filter(
|
||||||
|
ProcessInstanceModel.process_model_identifier == process_model_identifier
|
||||||
|
)
|
||||||
|
|
||||||
|
columns_for_metadata = columns_for_metadata_query.all()
|
||||||
|
columns_for_metadata_strings: list[ReportMetadataColumn] = [
|
||||||
|
{"Header": i[0], "accessor": i[0], "filterable": True} for i in columns_for_metadata
|
||||||
|
]
|
||||||
|
return columns_for_metadata_strings
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def compile_report(cls, report_metadata: ReportMetadata, user: UserModel) -> None:
|
def compile_report(cls, report_metadata: ReportMetadata, user: UserModel) -> None:
|
||||||
compiled_filters: list[FilterValue] = []
|
compiled_filters: list[FilterValue] = []
|
||||||
|
|
|
@ -29,7 +29,6 @@ export interface UiSchemaForm {
|
||||||
export interface UiSchemaAction {
|
export interface UiSchemaAction {
|
||||||
api_path: string;
|
api_path: string;
|
||||||
|
|
||||||
navigate_to_on_form_submit?: string;
|
|
||||||
persistence_level?: UiSchemaPersistenceLevel;
|
persistence_level?: UiSchemaPersistenceLevel;
|
||||||
process_id_to_run?: string;
|
process_id_to_run?: string;
|
||||||
results_markdown_filename?: string;
|
results_markdown_filename?: string;
|
||||||
|
|
Loading…
Reference in New Issue