mirror of
https://github.com/sartography/spiff-arena.git
synced 2025-01-11 18:14:20 +00:00
allow setting a failed process instance to the suspended status w/ burnettk (#416)
Co-authored-by: jasquat <jasquat@users.noreply.github.com>
This commit is contained in:
parent
b661f3b930
commit
1bc8ffc47d
@ -2,4 +2,8 @@ export default class ProcessInstanceClass {
|
|||||||
static terminalStatuses() {
|
static terminalStatuses() {
|
||||||
return ['complete', 'error', 'terminated'];
|
return ['complete', 'error', 'terminated'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static nonErrorTerminalStatuses() {
|
||||||
|
return ['complete', 'terminated'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -436,10 +436,12 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
|||||||
return <div />;
|
return <div />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// you cannot suspend an instance that is done. except if it has status error, since
|
||||||
|
// you might want to perform admin actions to recover from an errored instance.
|
||||||
const suspendButton = () => {
|
const suspendButton = () => {
|
||||||
if (
|
if (
|
||||||
processInstance &&
|
processInstance &&
|
||||||
!ProcessInstanceClass.terminalStatuses()
|
!ProcessInstanceClass.nonErrorTerminalStatuses()
|
||||||
.concat(['suspended'])
|
.concat(['suspended'])
|
||||||
.includes(processInstance.status)
|
.includes(processInstance.status)
|
||||||
) {
|
) {
|
||||||
@ -473,6 +475,27 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
|||||||
return <div />;
|
return <div />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const deleteButton = () => {
|
||||||
|
if (
|
||||||
|
processInstance &&
|
||||||
|
ProcessInstanceClass.terminalStatuses().includes(processInstance.status)
|
||||||
|
) {
|
||||||
|
return (
|
||||||
|
<ButtonWithConfirmation
|
||||||
|
data-qa="process-instance-delete"
|
||||||
|
kind="ghost"
|
||||||
|
renderIcon={TrashCan}
|
||||||
|
iconDescription="Delete"
|
||||||
|
hasIconOnly
|
||||||
|
description={`Delete Process Instance: ${processInstance.id}`}
|
||||||
|
onConfirmation={deleteProcessInstance}
|
||||||
|
confirmButtonLabel="Delete"
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return <div />;
|
||||||
|
};
|
||||||
|
|
||||||
const processTaskResult = (result: Task) => {
|
const processTaskResult = (result: Task) => {
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
setTaskDataToDisplay('');
|
setTaskDataToDisplay('');
|
||||||
@ -1135,22 +1158,8 @@ export default function ProcessInstanceShow({ variant }: OwnProps) {
|
|||||||
if (ability.can('POST', `${targetUris.processInstanceResumePath}`)) {
|
if (ability.can('POST', `${targetUris.processInstanceResumePath}`)) {
|
||||||
elements.push(resumeButton());
|
elements.push(resumeButton());
|
||||||
}
|
}
|
||||||
if (
|
if (ability.can('DELETE', targetUris.processInstanceActionPath)) {
|
||||||
ability.can('DELETE', targetUris.processInstanceActionPath) &&
|
elements.push(deleteButton());
|
||||||
ProcessInstanceClass.terminalStatuses().includes(processInstance.status)
|
|
||||||
) {
|
|
||||||
elements.push(
|
|
||||||
<ButtonWithConfirmation
|
|
||||||
data-qa="process-instance-delete"
|
|
||||||
kind="ghost"
|
|
||||||
renderIcon={TrashCan}
|
|
||||||
iconDescription="Delete"
|
|
||||||
hasIconOnly
|
|
||||||
description={`Delete Process Instance: ${processInstance.id}`}
|
|
||||||
onConfirmation={deleteProcessInstance}
|
|
||||||
confirmButtonLabel="Delete"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return elements;
|
return elements;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user