diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation.py index baec8270..c8c28aab 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_correlation.py @@ -44,6 +44,9 @@ class MessageCorrelationModel(SpiffworkflowBaseDBModel): updated_at_in_seconds: int = db.Column(db.Integer) created_at_in_seconds: int = db.Column(db.Integer) + message_correlation_property = relationship( + "MessageCorrelationPropertyModel" + ) message_correlations_message_instances = relationship( "MessageCorrelationMessageInstanceModel", cascade="delete" ) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_instance.py b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_instance.py index 61dd12b2..fd454fd6 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/models/message_instance.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/models/message_instance.py @@ -59,6 +59,8 @@ class MessageInstanceModel(SpiffworkflowBaseDBModel): updated_at_in_seconds: int = db.Column(db.Integer) created_at_in_seconds: int = db.Column(db.Integer) + message_correlations: dict | None = None + @validates("message_type") def validate_message_type(self, key: str, value: Any) -> Any: """Validate_message_type.""" 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 0042adcf..dfbb2a4d 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -1,4 +1,5 @@ """APIs for dealing with process groups, process models, and process instances.""" +import dataclasses import json import os import random @@ -13,6 +14,10 @@ from typing import Union import connexion # type: ignore import flask.wrappers import jinja2 +from spiffworkflow_backend.models import message_correlation_message_instance +from spiffworkflow_backend.models.message_correlation import MessageCorrelationModel +from spiffworkflow_backend.models.message_correlation_message_instance import MessageCorrelationMessageInstanceModel +from spiffworkflow_backend.models.message_correlation_property import MessageCorrelationPropertyModel import werkzeug from flask import Blueprint from flask import current_app @@ -581,16 +586,25 @@ def message_instance_list( MessageInstanceModel.created_at_in_seconds.desc(), # type: ignore MessageInstanceModel.id.desc(), # type: ignore ) - .join(MessageModel) + .join(MessageModel, MessageModel.id == MessageInstanceModel.message_model_id) .join(ProcessInstanceModel) .add_columns( MessageModel.identifier.label("message_identifier"), ProcessInstanceModel.process_model_identifier, - ProcessInstanceModel.process_group_identifier, ) .paginate(page=page, per_page=per_page, error_out=False) ) + for message_instance in message_instances: + message_correlations: dict = {} + for mcmi in message_instance.MessageInstanceModel.message_correlations_message_instances: + mc = MessageCorrelationModel.query.filter_by(id=mcmi.message_correlation_id).all() + for m in mc: + if m.name not in message_correlations: + message_correlations[m.name] = {} + message_correlations[m.name][m.message_correlation_property.identifier] = m.value + message_instance.MessageInstanceModel.message_correlations = message_correlations + response_json = { "results": message_instances.items, "pagination": { diff --git a/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx b/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx index 89bd6ac9..83ea1e43 100644 --- a/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx +++ b/spiffworkflow-frontend/src/routes/MessageInstanceList.tsx @@ -65,7 +65,7 @@ export default function MessageInstanceList() { {rowToUse.message_identifier} {rowToUse.message_type} - {rowToUse.failure_cause} + {rowToUse.failure_cause || '-'} {rowToUse.status} {convertSecondsToFormattedDate(rowToUse.created_at_in_seconds)} diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx index b7c05734..338b04e3 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceList.tsx @@ -276,26 +276,6 @@ export default function ProcessInstanceList() { ); }; - - const getSearchParamsAsQueryString = () => { - let queryParamString = ''; - Object.keys(parametersToAlwaysFilterBy).forEach((paramName) => { - const searchParamValue = searchParams.get(paramName); - if (searchParamValue) { - queryParamString += `&${paramName}=${searchParamValue}`; - } - }); - - Object.keys(parametersToGetFromSearchParams).forEach( - (paramName: string) => { - if (searchParams.get(paramName)) { - queryParamString += `&${paramName}=${searchParams.get(paramName)}`; - } - } - ); - return queryParamString; - }; - const processStatusSearch = () => { return ( ); }; - const clearFilters = () => { setProcessModelSelection(null); setProcessStatusSelection([]); @@ -324,7 +303,6 @@ export default function ProcessInstanceList() { setEndFrom(''); setEndTo(''); }; - const filterOptions = () => { if (!showFilterOptions) { return null; @@ -385,6 +363,33 @@ export default function ProcessInstanceList() { ); }; + const toggleShowFilterOptions = () => { + setShowFilterOptions(!showFilterOptions); + }; + const filterComponent = () => { + return ( + <> + + +