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 TYPE_CHECKING
from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine # type: ignore
from flask import current_app
from SpiffWorkflow.bpmn.PythonScriptEngine import PythonScriptEngine # type: ignore
from sqlalchemy import ForeignKey
from sqlalchemy.event import listens_for
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.
# fixme: Perhaps log some sort of error.
current_app.logger.warning(
"Error evaluating correlation key when comparing send and receive messages." +
f"Expression {correlation_key.retrieval_expression} failed with the error " +
str(e)
"Error evaluating correlation key when comparing send and receive"
" messages."
+ f"Expression {correlation_key.retrieval_expression} failed with"
" the error "
+ str(e)
)
return False
if result != expected_value:

View File

@ -38,9 +38,12 @@ class ProcessModelInfo:
files: list[File] | None = field(default_factory=list[File])
fault_or_suspend_on_exception: str = NotificationType.fault.value
exception_notification_addresses: list[str] = field(default_factory=list)
parent_groups: list[ProcessGroupLite] | 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:
"""__post_init__."""
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 (
_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 MissingGitConfigsError
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.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)

View File

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

View File

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