minor fixes to the frontend so that he Start button works in all cases and the interstial page's console is not so noisy, and images show up correctly.

This commit is contained in:
Dan 2023-04-21 11:21:52 -04:00
parent c7aae99774
commit 3e16590690
2 changed files with 7 additions and 9 deletions

View File

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

View File

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