Merge branch 'main' of github.com:sartography/spiff-arena

This commit is contained in:
jasquat 2023-04-21 11:21:57 -04:00
commit b973ce6186
2 changed files with 7 additions and 9 deletions

View File

@ -94,12 +94,12 @@ export default function ProcessInstanceRun({
const { ability } = usePermissionFetcher(permissionRequestData); const { ability } = usePermissionFetcher(permissionRequestData);
const onProcessInstanceRun = (processInstance: any) => { const onProcessInstanceRun = (processInstance: any) => {
// FIXME: ensure that the task is actually for the current user as well
const processInstanceId = (processInstance as any).id; const processInstanceId = (processInstance as any).id;
const nextTask = (processInstance as any).next_task; navigate(
if (nextTask && nextTask.state === 'READY') { `/process/${modifyProcessIdentifierForPathParam(
navigate(`/tasks/${processInstanceId}/${nextTask.id}`); processModel.id
} )}/${processInstanceId}/interstitial`
);
onSuccessCallback(processInstance); onSuccessCallback(processInstance);
}; };

View File

@ -27,7 +27,6 @@ export default function ProcessInterstitial() {
{ {
headers: getBasicHeaders(), headers: getBasicHeaders(),
onmessage(ev) { onmessage(ev) {
console.log(data, ev.data);
const task = JSON.parse(ev.data); const task = JSON.parse(ev.data);
setData((prevData) => [...prevData, task]); setData((prevData) => [...prevData, task]);
setLastTask(task); setLastTask(task);
@ -68,7 +67,6 @@ export default function ProcessInterstitial() {
if (state === 'CLOSED') { if (state === 'CLOSED') {
return lastTask.state; return lastTask.state;
} }
console.log('The State is: ', state);
return state; return state;
}; };
@ -80,6 +78,7 @@ export default function ProcessInterstitial() {
); );
case 'LOCKED': case 'LOCKED':
return <img src="/interstitial/locked.png" alt="Locked" />; return <img src="/interstitial/locked.png" alt="Locked" />;
case 'READY':
case 'REDIRECTING': case 'REDIRECTING':
return <img src="/interstitial/redirect.png" alt="Redirecting ...." />; return <img src="/interstitial/redirect.png" alt="Redirecting ...." />;
case 'WAITING': case 'WAITING':
@ -87,12 +86,11 @@ export default function ProcessInterstitial() {
case 'COMPLETED': case 'COMPLETED':
return <img src="/interstitial/completed.png" alt="Completed" />; return <img src="/interstitial/completed.png" alt="Completed" />;
default: default:
return <br />; return getStatus();
} }
}; };
function capitalize(str: string): string { function capitalize(str: string): string {
console.log('Capitalizing: ', str);
if (str && str.length > 0) { if (str && str.length > 0) {
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase(); return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
} }