lint and show version control identifier on process model show

This commit is contained in:
burnettk 2023-03-06 23:23:10 -05:00
parent f075a84dd6
commit d5800c5a40
5 changed files with 21 additions and 5 deletions

View File

@ -5,8 +5,8 @@ from typing import Any
from typing import Optional from typing import Optional
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine # type: ignore
from flask import current_app from flask import current_app
from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine # type: ignore
from sqlalchemy import ForeignKey from sqlalchemy import ForeignKey
from sqlalchemy.event import listens_for from sqlalchemy.event import listens_for
from sqlalchemy.orm import relationship from sqlalchemy.orm import relationship
@ -141,9 +141,11 @@ class MessageInstanceModel(SpiffworkflowBaseDBModel):
# message instances can't happen with other messages. So don't error up. # message instances can't happen with other messages. So don't error up.
# fixme: Perhaps log some sort of error. # fixme: Perhaps log some sort of error.
current_app.logger.warning( current_app.logger.warning(
"Error evaluating correlation key when comparing send and receive messages." + "Error evaluating correlation key when comparing send and receive"
f"Expression {correlation_key.retrieval_expression} failed with the error " + " messages."
str(e) + f"Expression {correlation_key.retrieval_expression} failed with"
" the error "
+ str(e)
) )
return False return False
if result != expected_value: if result != expected_value:

View File

@ -38,9 +38,12 @@ class ProcessModelInfo:
files: list[File] | None = field(default_factory=list[File]) files: list[File] | None = field(default_factory=list[File])
fault_or_suspend_on_exception: str = NotificationType.fault.value fault_or_suspend_on_exception: str = NotificationType.fault.value
exception_notification_addresses: list[str] = field(default_factory=list) exception_notification_addresses: list[str] = field(default_factory=list)
parent_groups: list[ProcessGroupLite] | None = None
metadata_extraction_paths: list[dict[str, str]] | None = None metadata_extraction_paths: list[dict[str, str]] | None = None
# just for the API
parent_groups: list[ProcessGroupLite] | None = None
bpmn_version_control_identifier: str | None = None
def __post_init__(self) -> None: def __post_init__(self) -> None:
"""__post_init__.""" """__post_init__."""
self.sort_index = self.id self.sort_index = self.id

View File

@ -30,6 +30,7 @@ from spiffworkflow_backend.routes.process_api_blueprint import _get_process_mode
from spiffworkflow_backend.routes.process_api_blueprint import ( from spiffworkflow_backend.routes.process_api_blueprint import (
_un_modify_modified_process_model_id, _un_modify_modified_process_model_id,
) )
from spiffworkflow_backend.services.git_service import GitCommandError
from spiffworkflow_backend.services.git_service import GitService from spiffworkflow_backend.services.git_service import GitService
from spiffworkflow_backend.services.git_service import MissingGitConfigsError from spiffworkflow_backend.services.git_service import MissingGitConfigsError
from spiffworkflow_backend.services.process_instance_report_service import ( from spiffworkflow_backend.services.process_instance_report_service import (
@ -200,6 +201,12 @@ def process_model_show(
process_model.parent_groups = ProcessModelService.get_parent_group_array( process_model.parent_groups = ProcessModelService.get_parent_group_array(
process_model.id process_model.id
) )
try:
current_git_revision = GitService.get_current_revision()
except GitCommandError:
current_git_revision = ""
process_model.bpmn_version_control_identifier = current_git_revision
return make_response(jsonify(process_model), 200) return make_response(jsonify(process_model), 200)

View File

@ -171,6 +171,7 @@ export interface ProcessModel {
metadata_extraction_paths?: MetadataExtractionPath[]; metadata_extraction_paths?: MetadataExtractionPath[];
fault_or_suspend_on_exception?: string; fault_or_suspend_on_exception?: string;
exception_notification_addresses?: string[]; exception_notification_addresses?: string[];
bpmn_version_control_identifier?: string;
} }
export interface ProcessGroup { export interface ProcessGroup {

View File

@ -498,6 +498,9 @@ export default function ProcessModelShow() {
<span> <span>
<Button size="sm" kind="ghost"> <Button size="sm" kind="ghost">
Files Files
{processModel &&
processModel.bpmn_version_control_identifier &&
` (revision ${processModel.bpmn_version_control_identifier})`}
</Button> </Button>
</span> </span>
</Stack> </Stack>