added the process model identifier for the diagram if it is not the top level w/ burnettk

This commit is contained in:
jasquat 2023-01-25 10:39:17 -05:00
parent 63ff763807
commit cc1fe58c47
4 changed files with 28 additions and 1 deletions

View File

@ -87,7 +87,6 @@ class ProcessInstanceModel(SpiffworkflowBaseDBModel):
created_at_in_seconds: int = db.Column(db.Integer)
status: str = db.Column(db.String(50))
bpmn_xml_file_contents: str | None = None
bpmn_version_control_type: str = db.Column(db.String(50))
bpmn_version_control_identifier: str = db.Column(db.String(255))
spiff_step: int = db.Column(db.Integer)
@ -95,6 +94,9 @@ class ProcessInstanceModel(SpiffworkflowBaseDBModel):
locked_by: str | None = db.Column(db.String(80))
locked_at_in_seconds: int | None = db.Column(db.Integer)
bpmn_xml_file_contents: str | None = None
process_model_with_diagram_identifier: str | None = None
@property
def serialized(self) -> dict[str, Any]:
"""Return object data in serializeable format."""
@ -118,6 +120,9 @@ class ProcessInstanceModel(SpiffworkflowBaseDBModel):
def serialized_with_metadata(self) -> dict[str, Any]:
process_instance_attributes = self.serialized
process_instance_attributes["process_metadata"] = self.process_metadata
process_instance_attributes["process_model_with_diagram_identifier"] = (
self.process_model_with_diagram_identifier
)
return process_instance_attributes
@property

View File

@ -673,6 +673,9 @@ def _get_process_instance(
spec_reference.process_model_id
)
name_of_file_with_diagram = spec_reference.file_name
process_instance.process_model_with_diagram_identifier = (
process_model_with_diagram.id
)
else:
process_model_with_diagram = _get_process_model(process_model_identifier)
if process_model_with_diagram.primary_file_name:

View File

@ -87,6 +87,7 @@ export interface ProcessInstance {
bpmn_version_control_identifier: string;
bpmn_version_control_type: string;
process_metadata?: ProcessInstanceMetadata[];
process_model_with_diagram_identifier?: string;
}
export interface MessageCorrelationProperties {

View File

@ -35,6 +35,7 @@ import HttpService from '../services/HttpService';
import ReactDiagramEditor from '../components/ReactDiagramEditor';
import {
convertSecondsToFormattedDateTime,
modifyProcessIdentifierForPathParam,
unModifyProcessIdentifierForPathParam,
} from '../helpers';
import ButtonWithConfirmation from '../components/ButtonWithConfirmation';
@ -395,6 +396,23 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
{processInstance.process_initiator_username}
</Column>
</Grid>
{processInstance.process_model_with_diagram_identifier ? (
<Grid condensed fullWidth>
<Column sm={1} md={1} lg={2} className="grid-list-title">
Current Diagram:{' '}
</Column>
<Column sm={4} md={6} lg={8} className="grid-date">
<Link
data-qa="go-to-current-diagram-process-model"
to={`/admin/process-models/${modifyProcessIdentifierForPathParam(
processInstance.process_model_with_diagram_identifier || ''
)}`}
>
{processInstance.process_model_with_diagram_identifier}
</Link>
</Column>
</Grid>
) : null}
<Grid condensed fullWidth>
<Column sm={1} md={1} lg={2} className="grid-list-title">
Started:{' '}