add coloring for cancelled tasks

This commit is contained in:
Elizabeth Esswein 2023-04-12 13:22:10 -04:00
parent 69e92cc815
commit d384556b4a
4 changed files with 31 additions and 2 deletions

View File

@ -68,6 +68,7 @@ type OwnProps = {
diagramType: string; diagramType: string;
readyOrWaitingProcessInstanceTasks?: Task[] | null; readyOrWaitingProcessInstanceTasks?: Task[] | null;
completedProcessInstanceTasks?: Task[] | null; completedProcessInstanceTasks?: Task[] | null;
cancelledProcessInstanceTasks?: Task[] | null;
saveDiagram?: (..._args: any[]) => any; saveDiagram?: (..._args: any[]) => any;
onDeleteFile?: (..._args: any[]) => any; onDeleteFile?: (..._args: any[]) => any;
isPrimaryFile?: boolean; isPrimaryFile?: boolean;
@ -94,6 +95,7 @@ export default function ReactDiagramEditor({
diagramType, diagramType,
readyOrWaitingProcessInstanceTasks, readyOrWaitingProcessInstanceTasks,
completedProcessInstanceTasks, completedProcessInstanceTasks,
cancelledProcessInstanceTasks,
saveDiagram, saveDiagram,
onDeleteFile, onDeleteFile,
isPrimaryFile, isPrimaryFile,
@ -358,7 +360,8 @@ export default function ReactDiagramEditor({
function checkTaskCanBeHighlighted(taskBpmnId: string) { function checkTaskCanBeHighlighted(taskBpmnId: string) {
return ( return (
!taskSpecsThatCannotBeHighlighted.includes(taskBpmnId) && !taskSpecsThatCannotBeHighlighted.includes(taskBpmnId) &&
!taskBpmnId.match(/EndJoin/) !taskBpmnId.match(/EndJoin/) &&
!taskBpmnId.match(/BoundaryEventParent/)
); );
} }
@ -441,6 +444,19 @@ export default function ReactDiagramEditor({
); );
}); });
} }
if (cancelledProcessInstanceTasks) {
const bpmnProcessIdentifiers = getBpmnProcessIdentifiers(
canvas.getRootElement()
);
cancelledProcessInstanceTasks.forEach((cancelledTask) => {
highlightBpmnIoElement(
canvas,
cancelledTask,
'cancelled-task-highlight',
bpmnProcessIdentifiers
);
});
}
} }
function displayDiagram( function displayDiagram(
@ -518,6 +534,7 @@ export default function ReactDiagramEditor({
diagramXMLString, diagramXMLString,
readyOrWaitingProcessInstanceTasks, readyOrWaitingProcessInstanceTasks,
completedProcessInstanceTasks, completedProcessInstanceTasks,
cancelledProcessInstanceTasks,
fileName, fileName,
performingXmlUpdates, performingXmlUpdates,
processModelId, processModelId,

View File

@ -142,6 +142,10 @@ code {
fill: grey !important; fill: grey !important;
opacity: .4; opacity: .4;
} }
.cancelled-task-highlight:not(.djs-connection) .djs-visual > :nth-child(1) {
fill: blue !important;
opacity: .2;
}
.accordion-item-label { .accordion-item-label {
vertical-align: middle; vertical-align: middle;

View File

@ -58,6 +58,7 @@ export interface Task {
export interface TaskIds { export interface TaskIds {
completed: Task[]; completed: Task[];
readyOrWaiting: Task[]; readyOrWaiting: Task[];
cancelled: Task[];
} }
export interface ProcessInstanceTask { export interface ProcessInstanceTask {

View File

@ -231,13 +231,19 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
}; };
const getTaskIds = () => { const getTaskIds = () => {
const taskIds: TaskIds = { completed: [], readyOrWaiting: [] }; const taskIds: TaskIds = {
completed: [],
readyOrWaiting: [],
cancelled: [],
};
if (tasks) { if (tasks) {
tasks.forEach(function getUserTasksElement(task: Task) { tasks.forEach(function getUserTasksElement(task: Task) {
if (task.state === 'COMPLETED') { if (task.state === 'COMPLETED') {
taskIds.completed.push(task); taskIds.completed.push(task);
} else if (task.state === 'READY' || task.state === 'WAITING') { } else if (task.state === 'READY' || task.state === 'WAITING') {
taskIds.readyOrWaiting.push(task); taskIds.readyOrWaiting.push(task);
} else if (task.state === 'CANCELLED') {
taskIds.cancelled.push(task);
} }
return null; return null;
}); });
@ -1152,6 +1158,7 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
fileName={processInstance.bpmn_xml_file_contents || ''} fileName={processInstance.bpmn_xml_file_contents || ''}
readyOrWaitingProcessInstanceTasks={taskIds.readyOrWaiting} readyOrWaitingProcessInstanceTasks={taskIds.readyOrWaiting}
completedProcessInstanceTasks={taskIds.completed} completedProcessInstanceTasks={taskIds.completed}
cancelledProcessInstanceTasks={taskIds.cancelled}
diagramType="readonly" diagramType="readonly"
onElementClick={handleClickedDiagramTask} onElementClick={handleClickedDiagramTask}
/> />