setWorkflowExecutionRunData fix

This commit is contained in:
Michael Kret 2024-09-18 09:27:34 +03:00
parent 41512376a0
commit d7a60611e2
3 changed files with 9 additions and 6 deletions

View file

@ -321,7 +321,7 @@ const nodeTitle = computed(() => {
const waiting = computed(() => {
const workflowExecution = workflowsStore.getWorkflowExecution as ExecutionSummary;
if (workflowExecution?.waitTill) {
if (workflowExecution?.waitTill && !workflowExecution?.finished) {
const lastNodeExecuted = get(workflowExecution, 'data.resultData.lastNodeExecuted');
if (props.name === lastNodeExecuted) {
const node = props.workflow.getNode(lastNodeExecuted);

View file

@ -325,7 +325,8 @@ export function useCanvasMapping({
if (workflowExecution && lastNodeExecuted && isExecutionSummary(workflowExecution)) {
if (
node.name === workflowExecution.data?.resultData?.lastNodeExecuted &&
workflowExecution.waitTill
workflowExecution?.waitTill &&
!workflowExecution?.finished
) {
const waitDate = new Date(workflowExecution.waitTill);

View file

@ -345,24 +345,27 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType<typeof u
const resolveWaitingNodesData = async (): Promise<void> => {
return await new Promise<void>((resolve) => {
const interval = setInterval(async () => {
const execution = await workflowsStore.getExecution(executionId as string);
const execution = await workflowsStore.getExecution((executionId as string) || '');
localStorage.removeItem(FORM_RELOAD);
if (!execution || workflowsStore.workflowExecutionData === null) {
clearInterval(interval);
resolve();
return;
}
if (execution.finished || ['error', 'canceled', 'crashed'].includes(execution.status)) {
workflowsStore.setWorkflowExecutionData(execution);
nodeHelpers.updateNodesExecutionIssues();
uiStore.removeActiveAction('workflowRunning');
clearInterval(interval);
resolve();
return;
}
if (execution.data) {
if (execution.data?.waitTill) {
workflowsStore.setWorkflowExecutionRunData(execution.data);
} else {
console.log(execution);
}
if (execution.status === 'waiting') {
@ -373,7 +376,6 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType<typeof u
waitingNode.type === WAIT_NODE_TYPE &&
waitingNode.parameters.resume === 'form'
) {
localStorage.removeItem(FORM_RELOAD);
const testUrl = getFormResumeUrl(waitingNode, executionId as string);
if (isFormShown) {