- Create zod schemas for everything related to a workflow run - Update the types to be inferred from the zod schemas - Improper workflow run outputs will render a blank screen; we could show an error in the future https://github.com/user-attachments/assets/8e666c3e-82b0-4ab5-8804-2f70130ea257
31 lines
767 B
TypeScript
31 lines
767 B
TypeScript
import { useWorkflowRunUnsafe } from '@/workflow/hooks/useWorkflowRunUnsafe';
|
|
import styled from '@emotion/styled';
|
|
import { isDefined } from 'twenty-shared';
|
|
import { CodeEditor } from 'twenty-ui';
|
|
|
|
const StyledSourceCodeContainer = styled.div`
|
|
margin: ${({ theme }) => theme.spacing(4)};
|
|
`;
|
|
|
|
export const WorkflowRunOutputVisualizer = ({
|
|
workflowRunId,
|
|
}: {
|
|
workflowRunId: string;
|
|
}) => {
|
|
const workflowRun = useWorkflowRunUnsafe({ workflowRunId });
|
|
|
|
if (!isDefined(workflowRun)) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<StyledSourceCodeContainer>
|
|
<CodeEditor
|
|
value={JSON.stringify(workflowRun.output, null, 2)}
|
|
language="json"
|
|
options={{ readOnly: true, domReadOnly: true }}
|
|
/>
|
|
</StyledSourceCodeContainer>
|
|
);
|
|
};
|