diff --git a/web/app/components/app/workflow-log/__tests__/evaluation-cell.spec.tsx b/web/app/components/app/workflow-log/__tests__/evaluation-cell.spec.tsx index e51ffdaaac..a8af664416 100644 --- a/web/app/components/app/workflow-log/__tests__/evaluation-cell.spec.tsx +++ b/web/app/components/app/workflow-log/__tests__/evaluation-cell.spec.tsx @@ -15,6 +15,20 @@ describe('EvaluationCell', () => { expect(screen.queryByRole('button', { name: 'appLog.table.header.evaluation' })).not.toBeInTheDocument() }) + it('should render a placeholder when evaluation data is missing', () => { + render() + + expect(screen.getByText('-')).toBeInTheDocument() + expect(screen.queryByRole('button', { name: 'appLog.table.header.evaluation' })).not.toBeInTheDocument() + }) + + it('should render a placeholder when evaluation data is null', () => { + render() + + expect(screen.getByText('-')).toBeInTheDocument() + expect(screen.queryByRole('button', { name: 'appLog.table.header.evaluation' })).not.toBeInTheDocument() + }) + it('should render a trigger button when evaluation data is available', () => { render( { @@ -28,8 +28,9 @@ const EvaluationCell = ({ }: EvaluationCellProps) => { const { t } = useTranslation() const [open, setOpen] = useState(false) + const evaluationItems = evaluation ?? [] - if (!evaluation.length) { + if (!evaluationItems.length) { return (
- @@ -61,12 +62,12 @@ const EvaluationCell = ({ popupClassName="w-[320px] overflow-hidden rounded-xl border-[0.5px] border-components-panel-border p-0 shadow-[0px_12px_16px_-4px_rgba(9,9,11,0.08),0px_4px_6px_-2px_rgba(9,9,11,0.03)]" >
- {evaluation.map((item, index) => ( + {evaluationItems.map((item, index) => (
diff --git a/web/models/log.ts b/web/models/log.ts index 93a9f322b4..2a63c7b3dd 100644 --- a/web/models/log.ts +++ b/web/models/log.ts @@ -275,7 +275,7 @@ export type WorkflowAppLogDetail = { created_by_end_user?: EndUserInfo created_at: number read_at?: number - evaluation: EvaluationLogItem[] + evaluation?: EvaluationLogItem[] | null } export type WorkflowLogsResponse = { data: Array