Select node by default when pending form action (#11378)

We want the run side panel to be open when the form step is pending



https://github.com/user-attachments/assets/a7a7015e-b0b7-422a-b625-eca8f2614ac1
This commit is contained in:
Thomas Trompette
2025-04-04 15:56:57 +02:00
committed by GitHub
parent 59e8e0633b
commit 6b184cc641
4 changed files with 24 additions and 5 deletions

View File

@ -257,6 +257,7 @@ export const workflowRunSchema = z
__typename: z.literal('WorkflowRun'), __typename: z.literal('WorkflowRun'),
id: z.string(), id: z.string(),
workflowVersionId: z.string(), workflowVersionId: z.string(),
workflowId: z.string(),
output: workflowRunOutputSchema.nullable(), output: workflowRunOutputSchema.nullable(),
context: workflowRunContextSchema.nullable(), context: workflowRunContextSchema.nullable(),
status: workflowRunStatusSchema, status: workflowRunStatusSchema,

View File

@ -29,11 +29,11 @@ export const WorkflowRunVisualizerEffect = ({
}, [setWorkflowRunId, workflowRunId]); }, [setWorkflowRunId, workflowRunId]);
useEffect(() => { useEffect(() => {
if (!isDefined(workflowVersion)) { if (!isDefined(workflowRun)) {
return; return;
} }
setWorkflowId(workflowVersion.workflowId); setWorkflowId(workflowRun.workflowId);
}, [setWorkflowId, workflowVersion]); }, [setWorkflowId, workflowRun]);
useEffect(() => { useEffect(() => {
if (!isDefined(workflowRun?.output)) { if (!isDefined(workflowRun?.output)) {

View File

@ -144,6 +144,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0, "x": 0,
"y": 0, "y": 0,
}, },
"selected": false,
}, },
{ {
"data": { "data": {
@ -157,6 +158,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0, "x": 0,
"y": 150, "y": 150,
}, },
"selected": false,
}, },
{ {
"data": { "data": {
@ -170,6 +172,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0, "x": 0,
"y": 300, "y": 300,
}, },
"selected": false,
}, },
], ],
} }
@ -319,6 +322,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0, "x": 0,
"y": 0, "y": 0,
}, },
"selected": false,
}, },
{ {
"data": { "data": {
@ -332,6 +336,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0, "x": 0,
"y": 150, "y": 150,
}, },
"selected": false,
}, },
{ {
"data": { "data": {
@ -345,6 +350,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0, "x": 0,
"y": 300, "y": 300,
}, },
"selected": false,
}, },
], ],
} }
@ -479,6 +485,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0, "x": 0,
"y": 0, "y": 0,
}, },
"selected": false,
}, },
{ {
"data": { "data": {
@ -492,6 +499,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0, "x": 0,
"y": 150, "y": 150,
}, },
"selected": false,
}, },
{ {
"data": { "data": {
@ -505,6 +513,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0, "x": 0,
"y": 300, "y": 300,
}, },
"selected": false,
}, },
], ],
} }
@ -672,6 +681,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0, "x": 0,
"y": 0, "y": 0,
}, },
"selected": false,
}, },
{ {
"data": { "data": {
@ -685,6 +695,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0, "x": 0,
"y": 150, "y": 150,
}, },
"selected": false,
}, },
{ {
"data": { "data": {
@ -698,6 +709,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0, "x": 0,
"y": 300, "y": 300,
}, },
"selected": false,
}, },
{ {
"data": { "data": {
@ -711,6 +723,7 @@ describe('generateWorkflowRunDiagram', () => {
"x": 0, "x": 0,
"y": 450, "y": 450,
}, },
"selected": false,
}, },
], ],
} }

View File

@ -15,8 +15,8 @@ import {
} from '@/workflow/workflow-diagram/types/WorkflowDiagram'; } from '@/workflow/workflow-diagram/types/WorkflowDiagram';
import { getWorkflowDiagramTriggerNode } from '@/workflow/workflow-diagram/utils/getWorkflowDiagramTriggerNode'; import { getWorkflowDiagramTriggerNode } from '@/workflow/workflow-diagram/utils/getWorkflowDiagramTriggerNode';
import { TRIGGER_STEP_ID } from '@/workflow/workflow-trigger/constants/TriggerStepId'; import { TRIGGER_STEP_ID } from '@/workflow/workflow-trigger/constants/TriggerStepId';
import { v4 } from 'uuid';
import { isDefined } from 'twenty-shared/utils'; import { isDefined } from 'twenty-shared/utils';
import { v4 } from 'uuid';
export const generateWorkflowRunDiagram = ({ export const generateWorkflowRunDiagram = ({
trigger, trigger,
@ -79,11 +79,15 @@ export const generateWorkflowRunDiagram = ({
} }
const runResult = stepsOutput?.[nodeId]; const runResult = stepsOutput?.[nodeId];
const isPendingFormAction =
step.type === 'FORM' &&
isDefined(runResult?.pendingEvent) &&
runResult.pendingEvent;
let runStatus: WorkflowDiagramRunStatus; let runStatus: WorkflowDiagramRunStatus;
if (skippedExecution) { if (skippedExecution) {
runStatus = 'not-executed'; runStatus = 'not-executed';
} else if (!isDefined(runResult) || isDefined(runResult.pendingEvent)) { } else if (!isDefined(runResult) || isPendingFormAction) {
runStatus = 'running'; runStatus = 'running';
} else { } else {
if (isDefined(runResult.error)) { if (isDefined(runResult.error)) {
@ -105,6 +109,7 @@ export const generateWorkflowRunDiagram = ({
x: xPos, x: xPos,
y: yPos, y: yPos,
}, },
selected: isPendingFormAction,
}); });
processNode({ processNode({