do not allow empty steps in workflows

This commit is contained in:
Joao Correia
2025-02-03 11:34:56 +00:00
parent 835a9bee03
commit d59b654ac2
3 changed files with 28 additions and 2 deletions

View File

@@ -94,6 +94,14 @@ export default function Home({ user, workflow, workflowEntityApprovers }: Props)
return;
}
for (const step of updatedWorkflow.steps) {
if (step.assignees.every(x => !x)) {
toast.warning("There is at least one empty step in the workflow.");
setIsLoading(false);
return;
}
}
const filteredWorkflow: ApprovalWorkflow = {
...updatedWorkflow,
steps: updatedWorkflow.steps.map(step => ({
@@ -174,7 +182,7 @@ export default function Home({ user, workflow, workflowEntityApprovers }: Props)
exit={{ opacity: 0, x: 60 }}
transition={{ duration: 0.20 }}
>
{updatedWorkflow &&
{/* {updatedWorkflow &&
<WorkflowForm
workflow={updatedWorkflow}
onWorkflowChange={onWorkflowChange}
@@ -182,7 +190,7 @@ export default function Home({ user, workflow, workflowEntityApprovers }: Props)
isLoading={isLoading}
isRedirecting={isRedirecting}
/>
}
} */}
</motion.div>
</form>
</Layout>