фикс пинга
This commit is contained in:
parent
3c3624d848
commit
da8092dfe8
2 changed files with 28 additions and 16 deletions
|
|
@ -462,17 +462,26 @@ export function DeviceDetailPage() {
|
||||||
|
|
||||||
<Descriptions bordered size="small" column={1} labelStyle={{ width: 180 }} style={{ marginTop: 16 }}>
|
<Descriptions bordered size="small" column={1} labelStyle={{ width: 180 }} style={{ marginTop: 16 }}>
|
||||||
<Descriptions.Item label="Статус"><DeviceStatusBadge status={effectiveStatus} /></Descriptions.Item>
|
<Descriptions.Item label="Статус"><DeviceStatusBadge status={effectiveStatus} /></Descriptions.Item>
|
||||||
<Descriptions.Item label="Последний ping">
|
<Descriptions.Item label="Последний пинг">
|
||||||
{device.last_seen ? (
|
{(device.last_ping_at ?? device.last_seen) ? (
|
||||||
<Tooltip title={elapsedAgo(device.last_seen)}>
|
<Tooltip title={elapsedAgo((device.last_ping_at ?? device.last_seen)!)}>
|
||||||
<Space size={4} style={{ cursor: 'default' }}>
|
<Space size={4} style={{ cursor: 'default' }}>
|
||||||
<ClockCircleOutlined style={{ color: '#999' }} />
|
<ClockCircleOutlined style={{ color: '#999' }} />
|
||||||
<span>{dayjs(device.last_seen).format('DD.MM.YYYY HH:mm:ss')}</span>
|
<span>{dayjs(device.last_ping_at ?? device.last_seen).format('DD.MM.YYYY HH:mm:ss')}</span>
|
||||||
{effectivePing !== null && <span style={{ color: '#999' }}>{effectivePing}мс</span>}
|
|
||||||
</Space>
|
</Space>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
) : '—'}
|
) : '—'}
|
||||||
</Descriptions.Item>
|
</Descriptions.Item>
|
||||||
|
{device.last_seen && device.last_ping_at !== device.last_seen && (
|
||||||
|
<Descriptions.Item label="Онлайн был">
|
||||||
|
<Tooltip title={elapsedAgo(device.last_seen)}>
|
||||||
|
<Space size={4} style={{ cursor: 'default' }}>
|
||||||
|
<ClockCircleOutlined style={{ color: '#52c41a' }} />
|
||||||
|
<span>{dayjs(device.last_seen).format('DD.MM.YYYY HH:mm:ss')}</span>
|
||||||
|
</Space>
|
||||||
|
</Tooltip>
|
||||||
|
</Descriptions.Item>
|
||||||
|
)}
|
||||||
<Descriptions.Item label="Мониторинг">
|
<Descriptions.Item label="Мониторинг">
|
||||||
{device.monitor_enabled
|
{device.monitor_enabled
|
||||||
? <Tag color="green">Включён</Tag>
|
? <Tag color="green">Включён</Tag>
|
||||||
|
|
|
||||||
|
|
@ -457,20 +457,23 @@ export function ObjectDetailPage({ defaultMode = 'inventory' }: { defaultMode?:
|
||||||
? <Tooltip title="Мониторинг включен"><span style={{ color: '#faad14' }}>⟳</span></Tooltip>
|
? <Tooltip title="Мониторинг включен"><span style={{ color: '#faad14' }}>⟳</span></Tooltip>
|
||||||
: null
|
: null
|
||||||
|
|
||||||
const lastSeenHint = d.last_seen && d.last_ping_at && d.last_ping_at !== d.last_seen
|
const showLastSeen = d.status !== 'online' && d.last_seen && d.last_ping_at !== d.last_seen
|
||||||
? `онлайн был: ${dayjs(d.last_seen).format('DD.MM.YYYY HH:mm')}`
|
|
||||||
: null
|
|
||||||
|
|
||||||
const tooltipText = [elapsedAgo(pingTime), lastSeenHint].filter(Boolean).join(' · ')
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Space size={6}>
|
<Space size={6} align="start">
|
||||||
{dot}
|
{dot}
|
||||||
<Tooltip title={tooltipText}>
|
<div>
|
||||||
<span style={{ color: dotColor, cursor: 'default' }}>
|
<Tooltip title={elapsedAgo(pingTime)}>
|
||||||
{dayjs(pingTime).format('DD.MM.YYYY HH:mm')}
|
<span style={{ color: dotColor, cursor: 'default' }}>
|
||||||
</span>
|
{dayjs(pingTime).format('DD.MM.YYYY HH:mm')}
|
||||||
</Tooltip>
|
</span>
|
||||||
|
</Tooltip>
|
||||||
|
{showLastSeen && (
|
||||||
|
<div style={{ fontSize: 11, color: '#999', lineHeight: 1.4 }}>
|
||||||
|
онлайн: {dayjs(d.last_seen).format('DD.MM.YYYY HH:mm')}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
{pauseIcon}
|
{pauseIcon}
|
||||||
</Space>
|
</Space>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue