Add console logs to code step (#10786)

Works for local and lambda drivers

## After

![image](https://github.com/user-attachments/assets/ec082cf6-4159-4a15-99b6-243c73a13773)

![image](https://github.com/user-attachments/assets/f42e3f43-5ea4-4167-b4b5-9a17826fd224)
This commit is contained in:
martmull
2025-03-12 10:40:59 +01:00
committed by GitHub
parent 4d0450069c
commit 4036933c84
11 changed files with 189 additions and 9 deletions

View File

@ -5,6 +5,7 @@ export type ServerlessFunctionTestData = {
input: { [field: string]: any };
output: {
data?: string;
logs: string;
duration?: number;
status?: ServerlessFunctionExecutionStatus;
error?: string;
@ -15,6 +16,7 @@ export type ServerlessFunctionTestData = {
export const DEFAULT_OUTPUT_VALUE = {
data: 'Enter an input above then press "Test"',
logs: '',
status: ServerlessFunctionExecutionStatus.IDLE,
};

View File

@ -37,6 +37,7 @@ import { useRecoilState, useRecoilValue } from 'recoil';
import { isDefined } from 'twenty-shared';
import { CodeEditor, IconCode, IconPlayerPlay, useIcons } from 'twenty-ui';
import { useDebouncedCallback } from 'use-debounce';
import { TextArea } from '@/ui/input/components/TextArea';
const StyledContainer = styled.div`
display: flex;
@ -340,6 +341,16 @@ export const WorkflowEditActionFormServerlessFunction = ({
isTesting={isTesting}
/>
</StyledCodeEditorContainer>
<StyledCodeEditorContainer>
<InputLabel>Logs</InputLabel>
<TextArea
value={
isTesting ? '' : serverlessFunctionTestData.output.logs
}
maxRows={20}
disabled
/>
</StyledCodeEditorContainer>
</>
)}
</WorkflowStepBody>