Merge remote-tracking branch 'origin/main' into feature/better_unit_tests

This commit is contained in:
jasquat 2022-12-16 13:16:08 -05:00
commit 2e334d3bb1
5 changed files with 44 additions and 28 deletions

View File

@ -148,33 +148,18 @@ permissions:
allowed_permissions: [create, read, update, delete] allowed_permissions: [create, read, update, delete]
uri: /v1.0/process-groups/manage-procurement:procurement:* 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: manage-revenue-streams-instances:
groups: ["core-contributor", "demo"] groups: ["core-contributor", "demo"]
users: [] users: []
allowed_permissions: [create, read] allowed_permissions: [create, read]
uri: /v1.0/process-instances/manage-revenue-streams:product-revenue-streams:customer-contracts-trade-terms/* 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: manage-procurement-invoice-instances:
groups: ["core-contributor", "demo"] groups: ["core-contributor", "demo"]
users: [] users: []
allowed_permissions: [create, read] allowed_permissions: [create, read]
uri: /v1.0/process-instances/manage-procurement:procurement:core-contributor-invoice-management:* 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: manage-procurement-instances:
groups: ["core-contributor", "demo"] groups: ["core-contributor", "demo"]
users: [] users: []

View File

@ -2550,7 +2550,7 @@ class TestProcessApi(BaseTest):
f"/v1.0/process-models/{modified_original_process_model_id}/move?new_location={new_location}", f"/v1.0/process-models/{modified_original_process_model_id}/move?new_location={new_location}",
headers=self.logged_in_headers(with_super_admin_user), 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 assert response.json["id"] == new_process_model_path
# make sure the original model does not exist # 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}", f"/v1.0/process-groups/{modified_original_process_group_id}/move?new_location={new_location}",
headers=self.logged_in_headers(with_super_admin_user), 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 assert response.json["id"] == new_sub_path
# make sure the original subgroup does not exist # make sure the original subgroup does not exist

View File

@ -58,7 +58,7 @@ import { Can } from '@casl/react';
import HttpService from '../services/HttpService'; import HttpService from '../services/HttpService';
import ButtonWithConfirmation from './ButtonWithConfirmation'; import ButtonWithConfirmation from './ButtonWithConfirmation';
import { makeid } from '../helpers'; import { getBpmnProcessIdentifiers, makeid } from '../helpers';
import { useUriListForPermissions } from '../hooks/UriListForPermissions'; import { useUriListForPermissions } from '../hooks/UriListForPermissions';
import { PermissionsToCheck, ProcessInstanceTask } from '../interfaces'; import { PermissionsToCheck, ProcessInstanceTask } from '../interfaces';
import { usePermissionFetcher } from '../hooks/PermissionService'; import { usePermissionFetcher } from '../hooks/PermissionService';
@ -231,8 +231,10 @@ export default function ReactDiagramEditor({
function handleElementClick(event: any) { function handleElementClick(event: any) {
if (onElementClick) { if (onElementClick) {
const canvas = diagramModeler.get('canvas'); const canvas = diagramModeler.get('canvas');
const rootElement = canvas.getRootElement(); const bpmnProcessIdentifiers = getBpmnProcessIdentifiers(
onElementClick(event.element, rootElement); canvas.getRootElement()
);
onElementClick(event.element, bpmnProcessIdentifiers);
} }
} }
@ -357,11 +359,15 @@ export default function ReactDiagramEditor({
canvas: any, canvas: any,
processInstanceTask: ProcessInstanceTask, processInstanceTask: ProcessInstanceTask,
bpmnIoClassName: string, bpmnIoClassName: string,
bpmnRootElementId: string bpmnProcessIdentifiers: string[]
) { ) {
if (checkTaskCanBeHighlighted(processInstanceTask.name)) { if (checkTaskCanBeHighlighted(processInstanceTask.name)) {
try { try {
if (bpmnRootElementId === processInstanceTask.process_identifier) { if (
bpmnProcessIdentifiers.includes(
processInstanceTask.process_identifier
)
) {
canvas.addMarker(processInstanceTask.name, bpmnIoClassName); canvas.addMarker(processInstanceTask.name, bpmnIoClassName);
} }
} catch (bpmnIoError: any) { } catch (bpmnIoError: any) {
@ -403,24 +409,28 @@ export default function ReactDiagramEditor({
// Option 3 at: // Option 3 at:
// https://github.com/bpmn-io/bpmn-js-examples/tree/master/colors // https://github.com/bpmn-io/bpmn-js-examples/tree/master/colors
if (readyOrWaitingProcessInstanceTasks) { if (readyOrWaitingProcessInstanceTasks) {
const rootElement = canvas.getRootElement(); const bpmnProcessIdentifiers = getBpmnProcessIdentifiers(
canvas.getRootElement()
);
readyOrWaitingProcessInstanceTasks.forEach((readyOrWaitingBpmnTask) => { readyOrWaitingProcessInstanceTasks.forEach((readyOrWaitingBpmnTask) => {
highlightBpmnIoElement( highlightBpmnIoElement(
canvas, canvas,
readyOrWaitingBpmnTask, readyOrWaitingBpmnTask,
'active-task-highlight', 'active-task-highlight',
rootElement.id bpmnProcessIdentifiers
); );
}); });
} }
if (completedProcessInstanceTasks) { if (completedProcessInstanceTasks) {
const rootElement = canvas.getRootElement(); const bpmnProcessIdentifiers = getBpmnProcessIdentifiers(
canvas.getRootElement()
);
completedProcessInstanceTasks.forEach((completedTask) => { completedProcessInstanceTasks.forEach((completedTask) => {
highlightBpmnIoElement( highlightBpmnIoElement(
canvas, canvas,
completedTask, completedTask,
'completed-task-highlight', 'completed-task-highlight',
rootElement.id bpmnProcessIdentifiers
); );
}); });
} }

View File

@ -213,3 +213,24 @@ export const refreshAtInterval = (
clearTimeout(timeoutRef); 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;
};

View File

@ -392,13 +392,13 @@ export default function ProcessInstanceShow() {
const handleClickedDiagramTask = ( const handleClickedDiagramTask = (
shapeElement: any, shapeElement: any,
bpmnRootElement: any bpmnProcessIdentifiers: any
) => { ) => {
if (tasks) { if (tasks) {
const matchingTask: any = tasks.find( const matchingTask: any = tasks.find(
(task: any) => (task: any) =>
task.name === shapeElement.id && task.name === shapeElement.id &&
task.process_identifier === bpmnRootElement.id bpmnProcessIdentifiers.includes(task.process_identifier)
); );
if (matchingTask) { if (matchingTask) {
setTaskToDisplay(matchingTask); setTaskToDisplay(matchingTask);