Skip to content

Commit

Permalink
better raw data
Browse files Browse the repository at this point in the history
  • Loading branch information
scopsy committed Dec 8, 2024
1 parent c5b03f2 commit 0717d3c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions apps/dashboard/src/components/activity/activity-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export function ActivityPanel({ activityId, onActivitySelect }: ActivityPanelPro
initial={{ opacity: 0.7 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.5, ease: 'easeOut' }}
className="h-full overflow-auto"
>
<div>
<div className="flex items-center gap-2 border-b border-t border-neutral-200 border-b-neutral-100 p-2">
Expand Down
29 changes: 28 additions & 1 deletion apps/dashboard/src/components/activity/execution-detail-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,29 @@ export function ExecutionDetailItem({ detail }: ExecutionDetailItemProps) {
const [isExpanded, setIsExpanded] = useState(false);
const { icon: StatusIcon, colorClass } = getStatusConfig(detail.status);

const formatContent = (raw: unknown): string => {
if (typeof raw === 'string') {
try {
const parsed = JSON.parse(raw);
return JSON.stringify(parsed, null, 2)
.split('\n')
.map((line) => line.trimEnd())
.join('\n');
} catch {
return raw;
}
}

if (typeof raw === 'object') {
return JSON.stringify(raw, null, 2)
.split('\n')
.map((line) => line.trimEnd())
.join('\n');
}

return String(raw);
};

return (
<div className="flex items-start gap-3">
<div className="flex h-full items-center pt-2">
Expand All @@ -66,7 +89,11 @@ export function ExecutionDetailItem({ detail }: ExecutionDetailItemProps) {
{isExpanded && detail.raw && (
<div className="border-t border-neutral-200 bg-neutral-50 p-3">
<div className="text-foreground-600 text-xs">
{typeof detail.raw === 'string' ? detail.raw : JSON.stringify(detail.raw, null, 2)}
<div className="overflow-x-auto">
<pre className="max-w-fullfont-mono min-w-0" style={{ width: '1px' }}>
{formatContent(detail.raw)}
</pre>
</div>
</div>
</div>
)}
Expand Down

0 comments on commit 0717d3c

Please sign in to comment.