fix output

This commit is contained in:
dv 2026-04-07 22:25:08 +03:00
parent 9dde2252f0
commit b2f0d3df29

View file

@ -1,5 +1,5 @@
import { ArrowLeftOutlined, CheckCircleOutlined, CloseCircleOutlined } from '@ant-design/icons' import { ArrowLeftOutlined, CheckCircleOutlined, CloseCircleOutlined, ExpandAltOutlined } from '@ant-design/icons'
import { Breadcrumb, Card, Col, Descriptions, Row, Spin, Table, Tag, Typography } from 'antd' import { Breadcrumb, Card, Col, Descriptions, Modal, Row, Spin, Table, Tag, Typography } from 'antd'
import dayjs from 'dayjs' import dayjs from 'dayjs'
import { useEffect, useRef, useState } from 'react' import { useEffect, useRef, useState } from 'react'
import { useNavigate, useParams } from 'react-router-dom' import { useNavigate, useParams } from 'react-router-dom'
@ -26,6 +26,7 @@ export function TaskDetailPage() {
const [log, setLog] = useState<LogLine[]>([]) const [log, setLog] = useState<LogLine[]>([])
const [deviceResults, setDeviceResults] = useState<Record<number, { status: string; duration_ms: number }>>({}) const [deviceResults, setDeviceResults] = useState<Record<number, { status: string; duration_ms: number }>>({})
const logEndRef = useRef<HTMLDivElement>(null) const logEndRef = useRef<HTMLDivElement>(null)
const [stdoutModal, setStdoutModal] = useState<string | null>(null)
// Populate log from persisted events on load // Populate log from persisted events on load
useEffect(() => { useEffect(() => {
@ -87,8 +88,19 @@ export function TaskDetailPage() {
title: 'Вывод', title: 'Вывод',
dataIndex: 'stdout', dataIndex: 'stdout',
key: 'stdout', key: 'stdout',
ellipsis: true, render: (s: string | null) => s ? (
render: (s: string | null) => s ? <code style={{ fontSize: 12 }}>{s.slice(0, 120)}</code> : '—', <div style={{ display: 'flex', alignItems: 'flex-start', gap: 4 }}>
<code style={{ fontSize: 12, whiteSpace: 'pre-wrap', wordBreak: 'break-all', flex: 1 }}>
{s.slice(0, 120)}{s.length > 120 ? '…' : ''}
</code>
{s.length > 120 && (
<ExpandAltOutlined
style={{ color: '#1677ff', cursor: 'pointer', flexShrink: 0, marginTop: 2 }}
onClick={() => setStdoutModal(s)}
/>
)}
</div>
) : '—',
}, },
] ]
@ -179,6 +191,29 @@ export function TaskDetailPage() {
</Col> </Col>
)} )}
</Row> </Row>
<Modal
open={stdoutModal !== null}
onCancel={() => setStdoutModal(null)}
footer={null}
title="Вывод"
width={800}
>
<pre style={{
background: '#1e1e1e',
color: '#ccc',
padding: 16,
borderRadius: 6,
fontSize: 13,
overflowX: 'auto',
maxHeight: '60vh',
overflowY: 'auto',
whiteSpace: 'pre-wrap',
wordBreak: 'break-all',
}}>
{stdoutModal}
</pre>
</Modal>
</div> </div>
) )
} }