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]
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: []

View File

@ -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

View File

@ -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
);
});
}

View File

@ -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;
};

View File

@ -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);