diff --git a/app/w/logs/components/sidebar/sidebar.tsx b/app/w/logs/components/sidebar/sidebar.tsx new file mode 100644 index 000000000..302a38ceb --- /dev/null +++ b/app/w/logs/components/sidebar/sidebar.tsx @@ -0,0 +1,250 @@ +'use client' + +import { useEffect, useMemo, useState } from 'react' +import { X } from 'lucide-react' +import { Button } from '@/components/ui/button' +import { ScrollArea } from '@/components/ui/scroll-area' +import { WorkflowLog } from '@/app/w/logs/stores/types' +import { formatDate } from '@/app/w/logs/utils/format-date' + +interface LogSidebarProps { + log: WorkflowLog | null + isOpen: boolean + onClose: () => void +} + +/** + * Formats JSON content for display, handling multiple JSON objects separated by '--' + */ +const formatJsonContent = (content: string): JSX.Element => { + // Check if the content has multiple parts separated by '--' + const parts = content.split(/\s*--\s*/g).filter((part) => part.trim().length > 0) + + if (parts.length > 1) { + // Handle multiple parts + return ( +
+ {JSON.stringify(jsonData, null, 2)}
+
+
+ {JSON.stringify(parsedJson, null, 2)}
+
+ {formatDate(log.createdAt).full}
+{log.executionId}
+{log.level}
+{log.trigger}
+{log.duration}
+