Skip to content

Commit

Permalink
refactor(dashboard): show log output
Browse files Browse the repository at this point in the history
  • Loading branch information
bryson-g committed Dec 20, 2024
1 parent f98fc9c commit 167f75d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { FC } from 'react'
import { NodeRunsList } from '../../NodeRunsList'
import { NodeDetails } from '../NodeDetails'
import { getTaskRun } from './getTaskRun'
import { OverflowText } from '@/app/[tenantId]/components/OverflowText'

export const TaskDetails: FC<{
taskNode?: TaskNode
Expand Down Expand Up @@ -93,14 +94,15 @@ export const TaskDetails: FC<{
{nodeRun && nodeRun.errorMessage && (
<div className="mt-2 flex flex-col rounded bg-red-200 p-1">
<h3 className="font-bold">Error</h3>
<div className="overflow-x-auto min-w-0">
{data?.attempts[0]?.logOutput?.str ?? nodeRun.errorMessage}
</div>
<OverflowText
variant="error"
className="text-nowrap"
text={data?.attempts[data?.attempts.length - 1]?.logOutput?.str ?? nodeRun.errorMessage}
/>
</div>
)
}
<NodeRunsList nodeRuns={nodeRunsList} />
</NodeDetails >
)}
<NodeRunsList nodeRuns={nodeRunsList} />
</NodeDetails>
)
}

Expand Down
5 changes: 3 additions & 2 deletions dashboard/src/app/[tenantId]/components/OverflowText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ import { tryFormatAsJson } from '@/app/utils/tryFormatAsJson'
type OverflowTextProps = {
text: string
className?: string
variant?: 'error'
}

export const OverflowText: FC<OverflowTextProps> = ({ text, className }) => {
export const OverflowText: FC<OverflowTextProps> = ({ text, className, variant }) => {
const textRef = useRef<HTMLDivElement>(null)
const [isOverflowing, setIsOverflowing] = useState(false)

Expand Down Expand Up @@ -45,7 +46,7 @@ export const OverflowText: FC<OverflowTextProps> = ({ text, className }) => {
</DialogTrigger>
<DialogContent className="max-w-2xl gap-2 overflow-visible">
<CopyButton value={formattedText} className="h-8 w-8 rounded-full" />
<div className="h-96 overflow-auto rounded-lg bg-gray-100">
<div className={cn('h-96 overflow-auto rounded-lg bg-gray-100', { 'bg-red-200': variant === 'error' })}>
<div className="max-w-full whitespace-pre-wrap break-words p-4">{formattedText}</div>
</div>
</DialogContent>
Expand Down

0 comments on commit 167f75d

Please sign in to comment.