This commit is contained in:
Michael Kret 2024-09-14 08:58:45 +03:00
parent 8496adb94f
commit 726cd86378
2 changed files with 36 additions and 2 deletions

View file

@ -320,7 +320,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 waitDate = new Date(workflowExecution.waitTill);

View file

@ -15,7 +15,7 @@ import type {
IRun,
INode,
} from 'n8n-workflow';
import { NodeConnectionType } from 'n8n-workflow';
import { NodeConnectionType, sleep } from 'n8n-workflow';
import { useToast } from '@/composables/useToast';
import { useNodeHelpers } from '@/composables/useNodeHelpers';
@ -295,6 +295,40 @@ export function useRunWorkflow(useRunWorkflowOpts: { router: ReturnType<typeof u
shouldShowForm,
});
while (true) {
if (runWorkflowApiResponse.executionId) {
const execution = await workflowsStore.getExecution(runWorkflowApiResponse.executionId);
if (!execution) break;
console.log(execution.startedAt, execution.stoppedAt);
if (execution.finished) {
workflowsStore.setWorkflowExecutionData(execution);
nodeHelpers.updateNodesExecutionIssues();
return runWorkflowApiResponse;
} else {
await sleep(2000);
if (execution.data) {
workflowsStore.setWorkflowExecutionRunData(execution.data);
}
displayForm({
nodes: workflowData.nodes,
runData: workflowsStore.getWorkflowExecution?.data?.resultData?.runData,
destinationNode: options.destinationNode,
pinData,
directParentNodes,
formWaitingUrl: rootStore.formWaitingUrl,
executionId: runWorkflowApiResponse.executionId,
source: options.source,
getTestUrl,
shouldShowForm,
});
}
} else break;
}
await useExternalHooks().run('workflowRun.runWorkflow', {
nodeName: options.destinationNode,
source: options.source,