From 0cdeffe1ec5341c4c4d391ae7cc6ece7d2f0ac89 Mon Sep 17 00:00:00 2001 From: jbirddog <100367399+jbirddog@users.noreply.github.com> Date: Thu, 15 Dec 2022 09:31:19 -0500 Subject: [PATCH 1/8] Fix endpoints for script task unit tests (#77) --- .../src/spiffworkflow_backend/api.yml | 20 ++++--------------- .../routes/process_api_blueprint.py | 6 +++--- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml index 84ada2341..c559ba98a 100755 --- a/spiffworkflow-backend/src/spiffworkflow_backend/api.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/api.yml @@ -610,15 +610,9 @@ paths: items: $ref: "#/components/schemas/Workflow" - /process-models/{process_group_id}/{process_model_id}/script-unit-tests: + /process-models/{modified_process_model_identifier}/script-unit-tests: parameters: - - name: process_group_id - in: path - required: true - description: The unique id of an existing process group - schema: - type: string - - name: process_model_id + - name: modified_process_model_identifier in: path required: true description: The unique id of an existing process model. @@ -637,15 +631,9 @@ paths: schema: $ref: "#/components/schemas/Workflow" - /process-models/{process_group_id}/{process_model_id}/script-unit-tests/run: + /process-models/{modified_process_model_identifier}/script-unit-tests/run: parameters: - - name: process_group_id - in: path - required: true - description: The unique id of an existing process group - schema: - type: string - - name: process_model_id + - name: modified_process_model_identifier in: path required: true description: The unique id of an existing process model. 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 74e5a7e74..9a6168361 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -1613,7 +1613,7 @@ def task_submit( def script_unit_test_create( - process_group_id: str, process_model_id: str, body: Dict[str, Union[str, bool, int]] + modified_process_model_identifier: str, body: Dict[str, Union[str, bool, int]] ) -> flask.wrappers.Response: """Script_unit_test_create.""" bpmn_task_identifier = _get_required_parameter_or_raise( @@ -1624,7 +1624,7 @@ def script_unit_test_create( "expected_output_json", body ) - process_model_identifier = f"{process_group_id}/{process_model_id}" + process_model_identifier = modified_process_model_identifier.replace(":", "/") process_model = get_process_model(process_model_identifier) file = SpecFileService.get_files(process_model, process_model.primary_file_name)[0] if file is None: @@ -1702,7 +1702,7 @@ def script_unit_test_create( def script_unit_test_run( - process_group_id: str, process_model_id: str, body: Dict[str, Union[str, bool, int]] + modified_process_model_identifier: str, body: Dict[str, Union[str, bool, int]] ) -> flask.wrappers.Response: """Script_unit_test_run.""" # FIXME: We should probably clear this somewhere else but this works From ff77f8f1fe90656aff829ab86e2916a844105440 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 15 Dec 2022 10:02:51 -0500 Subject: [PATCH 2/8] add support to find the form for a call activity defined in another process model --- .../routes/process_api_blueprint.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) 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 74e5a7e74..16217a119 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -1,5 +1,6 @@ """APIs for dealing with process groups, process models, and process instances.""" import json +import os import random import re import string @@ -75,6 +76,7 @@ from spiffworkflow_backend.models.user_group_assignment import UserGroupAssignme from spiffworkflow_backend.routes.user import verify_token from spiffworkflow_backend.services.authorization_service import AuthorizationService from spiffworkflow_backend.services.error_handling_service import ErrorHandlingService +from spiffworkflow_backend.services.file_system_service import FileSystemService from spiffworkflow_backend.services.git_service import GitService from spiffworkflow_backend.services.message_service import MessageService from spiffworkflow_backend.services.process_instance_processor import ( @@ -1484,7 +1486,25 @@ def task_show(process_instance_id: int, task_id: str) -> flask.wrappers.Response task.data = spiff_task.data task.process_model_display_name = process_model.display_name task.process_model_identifier = process_model.id + process_model_with_form = process_model + refs = SpecFileService.get_references_for_process(process_model_with_form) + all_processes = [i.identifier for i in refs] + if task.process_identifier not in all_processes: + bpmn_file_full_path = ( + ProcessInstanceProcessor.bpmn_file_full_path_from_bpmn_process_identifier( + task.process_identifier + ) + ) + relative_path = os.path.relpath( + bpmn_file_full_path, start=FileSystemService.root_path() + ) + process_model_relative_path = os.path.dirname(relative_path) + process_model_with_form = ( + ProcessModelService.get_process_model_from_relative_path( + process_model_relative_path + ) + ) if task.type == "User Task": if not form_schema_file_name: From eb55bfc763ee6177e8a348bcef12769fab4f0320 Mon Sep 17 00:00:00 2001 From: jbirddog <100367399+jbirddog@users.noreply.github.com> Date: Thu, 15 Dec 2022 11:56:54 -0500 Subject: [PATCH 3/8] Allow viewing/editing xml of bpmn and dmn files (#76) --- .../src/components/ReactDiagramEditor.tsx | 22 +++++++++++++++ .../src/routes/ReactFormEditor.tsx | 28 ++++++++++++++++++- 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx index a1be5efac..3584a6d27 100644 --- a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx +++ b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx @@ -52,6 +52,8 @@ import TouchModule from 'diagram-js/lib/navigation/touch'; // @ts-expect-error TS(7016) FIXME import ZoomScrollModule from 'diagram-js/lib/navigation/zoomscroll'; +import { useNavigate } from 'react-router-dom'; + import { Can } from '@casl/react'; import HttpService from '../services/HttpService'; @@ -119,6 +121,7 @@ export default function ReactDiagramEditor({ [targetUris.processModelFileShowPath]: ['POST', 'GET', 'PUT', 'DELETE'], }; const { ability } = usePermissionFetcher(permissionRequestData); + const navigate = useNavigate(); useEffect(() => { if (diagramModelerState) { @@ -542,6 +545,8 @@ export default function ReactDiagramEditor({ }); }; + const canViewXml = fileName !== undefined; + const userActionOptions = () => { if (diagramType !== 'readonly') { return ( @@ -580,6 +585,23 @@ export default function ReactDiagramEditor({ > + + {canViewXml && ( + + )} + ); } diff --git a/spiffworkflow-frontend/src/routes/ReactFormEditor.tsx b/spiffworkflow-frontend/src/routes/ReactFormEditor.tsx index 5a4da3878..5d1f55279 100644 --- a/spiffworkflow-frontend/src/routes/ReactFormEditor.tsx +++ b/spiffworkflow-frontend/src/routes/ReactFormEditor.tsx @@ -36,7 +36,20 @@ export default function ReactFormEditor() { return searchParams.get('file_ext') ?? 'json'; })(); - const editorDefaultLanguage = fileExtension === 'md' ? 'markdown' : 'json'; + const hasDiagram = fileExtension === 'bpmn' || fileExtension === 'dmn'; + + const editorDefaultLanguage = (() => { + if (fileExtension === 'json') { + return 'json'; + } + if (hasDiagram) { + return 'xml'; + } + if (fileExtension === 'md') { + return 'markdown'; + } + return 'text'; + })(); const modifiedProcessModelId = modifyProcessIdentifierForPathParam( `${params.process_model_id}` @@ -193,6 +206,19 @@ export default function ReactFormEditor() { buttonLabel="Delete" /> ) : null} + {hasDiagram ? ( + + ) : null} Date: Thu, 15 Dec 2022 12:52:53 -0500 Subject: [PATCH 4/8] commit and push to github on all changes to bpmn dir w/ burnettk cullerton --- .../bin/git_commit_bpmn_models_repo | 18 +++---- .../spiffworkflow_backend/config/testing.py | 1 + .../routes/process_api_blueprint.py | 54 +++++++++++++++---- .../services/git_service.py | 33 +++++++++--- 4 files changed, 78 insertions(+), 28 deletions(-) diff --git a/spiffworkflow-backend/bin/git_commit_bpmn_models_repo b/spiffworkflow-backend/bin/git_commit_bpmn_models_repo index 13e18da9c..62fc0cab0 100755 --- a/spiffworkflow-backend/bin/git_commit_bpmn_models_repo +++ b/spiffworkflow-backend/bin/git_commit_bpmn_models_repo @@ -11,11 +11,12 @@ set -o errtrace -o errexit -o nounset -o pipefail bpmn_models_absolute_dir="$1" git_commit_message="$2" -git_commit_username="$3" -git_commit_email="$4" +git_branch="$3" +git_commit_username="$4" +git_commit_email="$5" -if [[ -z "${2:-}" ]]; then - >&2 echo "usage: $(basename "$0") [bpmn_models_absolute_dir] [git_commit_message]" +if [[ -z "${5:-}" ]]; then + >&2 echo "usage: $(basename "$0") [bpmn_models_absolute_dir] [git_commit_message] [git_branch] [git_commit_username] [git_commit_email]" exit 1 fi @@ -26,11 +27,8 @@ git add . if [ -z "$(git status --porcelain)" ]; then echo "No changes to commit" else - if [[ -n "$git_commit_username" ]]; then - git config --local user.name "$git_commit_username" - fi - if [[ -n "$git_commit_email" ]]; then - git config --local user.email "$git_commit_email" - fi + git config --local user.name "$git_commit_username" + git config --local user.email "$git_commit_email" git commit -m "$git_commit_message" + git push --set-upstream origin "$git_branch" fi diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/testing.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/testing.py index bbda9db9a..605c1bccc 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/testing.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/testing.py @@ -15,6 +15,7 @@ SPIFFWORKFLOW_BACKEND_PERMISSIONS_FILE_NAME = environ.get( SPIFFWORKFLOW_BACKEND_LOG_LEVEL = environ.get( "SPIFFWORKFLOW_BACKEND_LOG_LEVEL", default="debug" ) +GIT_COMMIT_ON_SAVE = False # NOTE: set this here since nox shoves tests and src code to # different places and this allows us to know exactly where we are at the start 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 a89ae9530..ba2f65c29 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/routes/process_api_blueprint.py @@ -170,6 +170,9 @@ def process_group_add(body: dict) -> flask.wrappers.Response: """Add_process_group.""" process_group = ProcessGroup(**body) ProcessModelService.add_process_group(process_group) + commit_and_push_to_git( + f"User: {g.user.username} added process group {process_group.id}" + ) return make_response(jsonify(process_group), 201) @@ -177,6 +180,9 @@ def process_group_delete(modified_process_group_id: str) -> flask.wrappers.Respo """Process_group_delete.""" process_group_id = un_modify_modified_process_model_id(modified_process_group_id) ProcessModelService().process_group_delete(process_group_id) + commit_and_push_to_git( + f"User: {g.user.username} deleted process group {process_group_id}" + ) return Response(json.dumps({"ok": True}), status=200, mimetype="application/json") @@ -194,6 +200,9 @@ def process_group_update( process_group_id = un_modify_modified_process_model_id(modified_process_group_id) process_group = ProcessGroup(id=process_group_id, **body_filtered) ProcessModelService.update_process_group(process_group) + commit_and_push_to_git( + f"User: {g.user.username} updated process group {process_group_id}" + ) return make_response(jsonify(process_group), 200) @@ -258,7 +267,10 @@ def process_group_move( new_process_group = ProcessModelService().process_group_move( original_process_group_id, new_location ) - return make_response(jsonify(new_process_group), 201) + commit_and_push_to_git( + f"User: {g.user.username} moved process group {original_process_group_id} to {new_process_group.id}" + ) + return make_response(jsonify(new_process_group), 200) def process_model_create( @@ -306,6 +318,9 @@ def process_model_create( ) ProcessModelService.add_process_model(process_model_info) + commit_and_push_to_git( + f"User: {g.user.username} created process model {process_model_info.id}" + ) return Response( json.dumps(ProcessModelInfoSchema().dump(process_model_info)), status=201, @@ -319,6 +334,9 @@ def process_model_delete( """Process_model_delete.""" process_model_identifier = modified_process_model_identifier.replace(":", "/") ProcessModelService().process_model_delete(process_model_identifier) + commit_and_push_to_git( + f"User: {g.user.username} deleted process model {process_model_identifier}" + ) return Response(json.dumps({"ok": True}), status=200, mimetype="application/json") @@ -342,6 +360,9 @@ def process_model_update( process_model = get_process_model(process_model_identifier) ProcessModelService.update_process_model(process_model, body_filtered) + commit_and_push_to_git( + f"User: {g.user.username} updated process model {process_model_identifier}" + ) return ProcessModelInfoSchema().dump(process_model) @@ -373,7 +394,10 @@ def process_model_move( new_process_model = ProcessModelService().process_model_move( original_process_model_id, new_location ) - return make_response(jsonify(new_process_model), 201) + commit_and_push_to_git( + f"User: {g.user.username} moved process model {original_process_model_id} to {new_process_model.id}" + ) + return make_response(jsonify(new_process_model), 200) def process_model_publish( @@ -469,14 +493,9 @@ def process_model_file_update( ) SpecFileService.update_file(process_model, file_name, request_file_contents) - - if current_app.config["GIT_COMMIT_ON_SAVE"]: - git_output = GitService.commit( - message=f"User: {g.user.username} clicked save for {process_model_identifier}/{file_name}" - ) - current_app.logger.info(f"git output: {git_output}") - else: - current_app.logger.info("Git commit on save is disabled") + commit_and_push_to_git( + f"User: {g.user.username} clicked save for {process_model_identifier}/{file_name}" + ) return Response(json.dumps({"ok": True}), status=200, mimetype="application/json") @@ -498,6 +517,9 @@ def process_model_file_delete( ) ) from exception + commit_and_push_to_git( + f"User: {g.user.username} deleted process model file {process_model_identifier}/{file_name}" + ) return Response(json.dumps({"ok": True}), status=200, mimetype="application/json") @@ -519,6 +541,9 @@ def add_file(modified_process_model_identifier: str) -> flask.wrappers.Response: file_contents = SpecFileService.get_data(process_model, file.name) file.file_contents = file_contents file.process_model_id = process_model.id + commit_and_push_to_git( + f"User: {g.user.username} added process model file {process_model_identifier}/{file.name}" + ) return Response( json.dumps(FileSchema().dump(file)), status=201, mimetype="application/json" ) @@ -2058,3 +2083,12 @@ def update_task_data( status=200, mimetype="application/json", ) + + +def commit_and_push_to_git(message: str) -> None: + """Commit_and_push_to_git.""" + if current_app.config["GIT_COMMIT_ON_SAVE"]: + git_output = GitService.commit(message=message) + current_app.logger.info(f"git output: {git_output}") + else: + current_app.logger.info("Git commit on save is disabled") diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py b/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py index 152aab1c0..8ef952c3c 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/services/git_service.py @@ -68,8 +68,17 @@ class GitService: return cls.run_shell_command_to_get_stdout(shell_command) @classmethod - def commit(cls, message: str, repo_path: Optional[str] = None) -> str: + def commit( + cls, + message: str, + repo_path: Optional[str] = None, + branch_name: Optional[str] = None, + ) -> str: """Commit.""" + cls.check_for_basic_configs() + branch_name_to_use = branch_name + if branch_name_to_use is None: + branch_name_to_use = current_app.config["GIT_BRANCH"] repo_path_to_use = repo_path if repo_path is None: repo_path_to_use = current_app.config["BPMN_SPEC_ABSOLUTE_DIR"] @@ -88,14 +97,25 @@ class GitService: shell_command_path, repo_path_to_use, message, + branch_name_to_use, git_username, git_email, ] return cls.run_shell_command_to_get_stdout(shell_command) @classmethod - def check_for_configs(cls) -> None: + def check_for_basic_configs(cls) -> None: + """Check_for_basic_configs.""" + if current_app.config["GIT_BRANCH"] is None: + raise MissingGitConfigsError( + "Missing config for GIT_BRANCH. " + "This is required for publishing process models" + ) + + @classmethod + def check_for_publish_configs(cls) -> None: """Check_for_configs.""" + cls.check_for_basic_configs() if current_app.config["GIT_BRANCH_TO_PUBLISH_TO"] is None: raise MissingGitConfigsError( "Missing config for GIT_BRANCH_TO_PUBLISH_TO. " @@ -148,7 +168,7 @@ class GitService: @classmethod def handle_web_hook(cls, webhook: dict) -> bool: """Handle_web_hook.""" - cls.check_for_configs() + cls.check_for_publish_configs() if "repository" not in webhook or "clone_url" not in webhook["repository"]: raise InvalidGitWebhookBodyError( @@ -184,7 +204,7 @@ class GitService: @classmethod def publish(cls, process_model_id: str, branch_to_update: str) -> str: """Publish.""" - cls.check_for_configs() + cls.check_for_publish_configs() source_process_model_root = FileSystemService.root_path() source_process_model_path = os.path.join( source_process_model_root, process_model_id @@ -233,10 +253,7 @@ class GitService: f"Request to publish changes to {process_model_id}, " f"from {g.user.username} on {current_app.config['ENV_IDENTIFIER']}" ) - cls.commit(commit_message, destination_process_root) - cls.run_shell_command( - ["git", "push", "--set-upstream", "origin", branch_to_pull_request] - ) + cls.commit(commit_message, destination_process_root, branch_to_pull_request) # build url for github page to open PR git_remote = cls.run_shell_command_to_get_stdout( From 618c71416ac62065890b56a4087708b8a9ddfb79 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 15 Dec 2022 13:04:24 -0500 Subject: [PATCH 5/8] do not set git branch info on development w/ burnettk cullerton --- .../src/spiffworkflow_backend/config/development.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/development.py b/spiffworkflow-backend/src/spiffworkflow_backend/config/development.py index 15cbead83..39e10cb58 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/development.py +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/development.py @@ -17,5 +17,3 @@ GIT_CLONE_URL_FOR_PUBLISHING = environ.get( ) GIT_USERNAME = "sartography-automated-committer" GIT_USER_EMAIL = f"{GIT_USERNAME}@users.noreply.github.com" -GIT_BRANCH_TO_PUBLISH_TO = "main" -GIT_BRANCH = "main" From ea1daec7a893d46706b13ba380ff9aedf0375a93 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 15 Dec 2022 14:55:06 -0500 Subject: [PATCH 6/8] get all of the process identifiers that the diagram knows about so we can display the correct task info --- .../src/components/ReactDiagramEditor.tsx | 28 +++++++++++++------ spiffworkflow-frontend/src/helpers.tsx | 21 ++++++++++++++ .../src/routes/ProcessInstanceShow.tsx | 4 +-- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx index 3584a6d27..ade2cda5c 100644 --- a/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx +++ b/spiffworkflow-frontend/src/components/ReactDiagramEditor.tsx @@ -58,7 +58,7 @@ import { Can } from '@casl/react'; import HttpService from '../services/HttpService'; import ButtonWithConfirmation from './ButtonWithConfirmation'; -import { makeid } from '../helpers'; +import { getBpmnProcessIdentifiers, makeid } from '../helpers'; import { useUriListForPermissions } from '../hooks/UriListForPermissions'; import { PermissionsToCheck, ProcessInstanceTask } from '../interfaces'; import { usePermissionFetcher } from '../hooks/PermissionService'; @@ -231,8 +231,10 @@ export default function ReactDiagramEditor({ function handleElementClick(event: any) { if (onElementClick) { const canvas = diagramModeler.get('canvas'); - const rootElement = canvas.getRootElement(); - onElementClick(event.element, rootElement); + const bpmnProcessIdentifiers = getBpmnProcessIdentifiers( + canvas.getRootElement() + ); + onElementClick(event.element, bpmnProcessIdentifiers); } } @@ -357,11 +359,15 @@ export default function ReactDiagramEditor({ canvas: any, processInstanceTask: ProcessInstanceTask, bpmnIoClassName: string, - bpmnRootElementId: string + bpmnProcessIdentifiers: string[] ) { if (checkTaskCanBeHighlighted(processInstanceTask.name)) { try { - if (bpmnRootElementId === processInstanceTask.process_identifier) { + if ( + bpmnProcessIdentifiers.includes( + processInstanceTask.process_identifier + ) + ) { canvas.addMarker(processInstanceTask.name, bpmnIoClassName); } } catch (bpmnIoError: any) { @@ -403,24 +409,28 @@ export default function ReactDiagramEditor({ // Option 3 at: // https://github.com/bpmn-io/bpmn-js-examples/tree/master/colors if (readyOrWaitingProcessInstanceTasks) { - const rootElement = canvas.getRootElement(); + const bpmnProcessIdentifiers = getBpmnProcessIdentifiers( + canvas.getRootElement() + ); readyOrWaitingProcessInstanceTasks.forEach((readyOrWaitingBpmnTask) => { highlightBpmnIoElement( canvas, readyOrWaitingBpmnTask, 'active-task-highlight', - rootElement.id + bpmnProcessIdentifiers ); }); } if (completedProcessInstanceTasks) { - const rootElement = canvas.getRootElement(); + const bpmnProcessIdentifiers = getBpmnProcessIdentifiers( + canvas.getRootElement() + ); completedProcessInstanceTasks.forEach((completedTask) => { highlightBpmnIoElement( canvas, completedTask, 'completed-task-highlight', - rootElement.id + bpmnProcessIdentifiers ); }); } diff --git a/spiffworkflow-frontend/src/helpers.tsx b/spiffworkflow-frontend/src/helpers.tsx index 0b73e517d..8f6255335 100644 --- a/spiffworkflow-frontend/src/helpers.tsx +++ b/spiffworkflow-frontend/src/helpers.tsx @@ -213,3 +213,24 @@ export const refreshAtInterval = ( clearTimeout(timeoutRef); }; }; + +const getChildProcesses = (bpmnElement: any) => { + let elements: string[] = []; + bpmnElement.children.forEach((c: any) => { + if (c.type === 'bpmn:Participant') { + if (c.businessObject.processRef) { + elements.push(c.businessObject.processRef.id); + } + elements = [...elements, ...getChildProcesses(c)]; + } else if (c.type === 'bpmn:SubProcess') { + elements.push(c.id); + } + }); + return elements; +}; + +export const getBpmnProcessIdentifiers = (rootBpmnElement: any) => { + const childProcesses = getChildProcesses(rootBpmnElement); + childProcesses.push(rootBpmnElement.businessObject.id); + return childProcesses; +}; diff --git a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx index 3e0c2094d..7a9b97943 100644 --- a/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessInstanceShow.tsx @@ -392,13 +392,13 @@ export default function ProcessInstanceShow() { const handleClickedDiagramTask = ( shapeElement: any, - bpmnRootElement: any + bpmnProcessIdentifiers: any ) => { if (tasks) { const matchingTask: any = tasks.find( (task: any) => task.name === shapeElement.id && - task.process_identifier === bpmnRootElement.id + bpmnProcessIdentifiers.includes(task.process_identifier) ); if (matchingTask) { setTaskToDisplay(matchingTask); From debde51b00b5873d24b94f17526ce487a491ea28 Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 15 Dec 2022 14:57:07 -0500 Subject: [PATCH 7/8] fix broken unit tests in backend --- .../spiffworkflow_backend/integration/test_process_api.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py index 4a0100d33..3bc21456e 100644 --- a/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py +++ b/spiffworkflow-backend/tests/spiffworkflow_backend/integration/test_process_api.py @@ -2550,7 +2550,7 @@ class TestProcessApi(BaseTest): f"/v1.0/process-models/{modified_original_process_model_id}/move?new_location={new_location}", headers=self.logged_in_headers(with_super_admin_user), ) - assert response.status_code == 201 + assert response.status_code == 200 assert response.json["id"] == new_process_model_path # make sure the original model does not exist @@ -2595,7 +2595,7 @@ class TestProcessApi(BaseTest): f"/v1.0/process-groups/{modified_original_process_group_id}/move?new_location={new_location}", headers=self.logged_in_headers(with_super_admin_user), ) - assert response.status_code == 201 + assert response.status_code == 200 assert response.json["id"] == new_sub_path # make sure the original subgroup does not exist From e3fe09490ba5b10e9124f2ff3ebddc3bcc79a73a Mon Sep 17 00:00:00 2001 From: jasquat Date: Thu, 15 Dec 2022 15:55:22 -0500 Subject: [PATCH 8/8] fix permissions for core on dev w/ burnettk --- .../terraform_deployed_environment.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/terraform_deployed_environment.yml b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/terraform_deployed_environment.yml index 2e41e3b00..731de9ab0 100644 --- a/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/terraform_deployed_environment.yml +++ b/spiffworkflow-backend/src/spiffworkflow_backend/config/permissions/terraform_deployed_environment.yml @@ -148,33 +148,18 @@ permissions: allowed_permissions: [create, read, update, delete] uri: /v1.0/process-groups/manage-procurement:procurement:* - manage-revenue-streams-instantiate: - groups: ["core-contributor", "demo"] - users: [] - allowed_permissions: [create] - uri: /v1.0/process-models/manage-revenue-streams:product-revenue-streams:customer-contracts-trade-terms/* manage-revenue-streams-instances: groups: ["core-contributor", "demo"] users: [] allowed_permissions: [create, read] uri: /v1.0/process-instances/manage-revenue-streams:product-revenue-streams:customer-contracts-trade-terms/* - manage-procurement-invoice-instantiate: - groups: ["core-contributor", "demo"] - users: [] - allowed_permissions: [create] - uri: /v1.0/process-models/manage-procurement:procurement:core-contributor-invoice-management:* manage-procurement-invoice-instances: groups: ["core-contributor", "demo"] users: [] allowed_permissions: [create, read] uri: /v1.0/process-instances/manage-procurement:procurement:core-contributor-invoice-management:* - manage-procurement-instantiate: - groups: ["core-contributor", "demo"] - users: [] - allowed_permissions: [create] - uri: /v1.0/process-models/manage-procurement:vendor-lifecycle-management:* manage-procurement-instances: groups: ["core-contributor", "demo"] users: []