diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml index 72f1ced6..76d821e1 100755 --- a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml @@ -439,6 +439,12 @@ paths: description: For filtering - not_started, user_input_required, waiting, complete, error, or suspended schema: type: string + - name: user_filter + in: query + required: false + description: For filtering - indicates the user has manually entered a query + schema: + type: boolean # process_instance_list get: operationId: spiffworkflow_backend.routes.process_api_blueprint.process_instance_list diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py index d278b27e..d5d11094 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -74,6 +74,7 @@ from spiffworkflow_backend.services.process_instance_processor import ( ) from spiffworkflow_backend.services.process_instance_report_service import ( ProcessInstanceReportService, + ProcessInstanceReportFilter, ) from spiffworkflow_backend.services.process_instance_service import ( ProcessInstanceService, @@ -732,18 +733,32 @@ def process_instance_list( end_from: Optional[int] = None, end_to: Optional[int] = None, process_status: Optional[str] = None, + user_filter: Optional[bool] = False, ) -> flask.wrappers.Response: """Process_instance_list.""" process_instance_report = ProcessInstanceReportModel.default_report(g.user) - report_filter = ProcessInstanceReportService.filter_from_metadata_with_overrides( - process_instance_report, - process_model_identifier, - start_from, - start_to, - end_from, - end_to, - process_status, - ) + + print(f"user_filter: {user_filter}") + + if user_filter: + report_filter = ProcessInstanceReportFilter( + process_model_identifier, + start_from, + start_to, + end_from, + end_to, + process_status, + ) + else: + report_filter = ProcessInstanceReportService.filter_from_metadata_with_overrides( + process_instance_report, + process_model_identifier, + start_from, + start_to, + end_from, + end_to, + process_status, + ) # process_model_identifier = un_modify_modified_process_model_id(modified_process_model_identifier) process_instance_query = ProcessInstanceModel.query diff --git a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx index 543b9a46..8f482a59 100644 --- a/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx +++ b/spiffworkflow-frontend/src/components/ProcessInstanceListTable.tsx @@ -125,6 +125,11 @@ export default function ProcessInstanceListTable({ } let queryParamString = `per_page=${perPage}&page=${page}`; + const userAppliedFilter = searchParams.get('user_filter'); + if (userAppliedFilter) { + queryParamString += `&user_filter=${userAppliedFilter}`; + } + Object.keys(parametersToAlwaysFilterBy).forEach((paramName: string) => { // @ts-expect-error TS(7053) FIXME: const functionToCall = parametersToAlwaysFilterBy[paramName]; @@ -286,7 +291,7 @@ export default function ProcessInstanceListTable({ undefined, paginationQueryParamPrefix ); - let queryParamString = `per_page=${perPage}&page=${page}`; + let queryParamString = `per_page=${perPage}&page=${page}&user_filter=true`; const startFromSeconds = convertDateStringToSeconds(startFrom); const endFromSeconds = convertDateStringToSeconds(endFrom); @@ -338,6 +343,7 @@ export default function ProcessInstanceListTable({ } setErrorMessage(null); + console.log(queryParamString); navigate(`/admin/process-instances?${queryParamString}`); };