фикс пинга 2
This commit is contained in:
parent
2643c84aa6
commit
00101ff6b3
2 changed files with 4 additions and 1 deletions
|
|
@ -25,6 +25,7 @@ import {
|
||||||
Typography,
|
Typography,
|
||||||
message,
|
message,
|
||||||
} from 'antd'
|
} from 'antd'
|
||||||
|
import { useQueryClient } from '@tanstack/react-query'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useNavigate, useParams } from 'react-router-dom'
|
import { useNavigate, useParams } from 'react-router-dom'
|
||||||
|
|
@ -386,6 +387,7 @@ export function DeviceDetailPage() {
|
||||||
const { data: device, isLoading } = useDevice(objId, deviceId)
|
const { data: device, isLoading } = useDevice(objId, deviceId)
|
||||||
const deleteDevice = useDeleteDevice(objId)
|
const deleteDevice = useDeleteDevice(objId)
|
||||||
|
|
||||||
|
const qc = useQueryClient()
|
||||||
const [editOpen, setEditOpen] = useState(false)
|
const [editOpen, setEditOpen] = useState(false)
|
||||||
const [activeTab, setActiveTab] = useState('info')
|
const [activeTab, setActiveTab] = useState('info')
|
||||||
const [liveStatus, setLiveStatus] = useState<{ status: string; ping_ms: number | null } | null>(null)
|
const [liveStatus, setLiveStatus] = useState<{ status: string; ping_ms: number | null } | null>(null)
|
||||||
|
|
@ -394,6 +396,7 @@ export function DeviceDetailPage() {
|
||||||
onDeviceStatus: (ev) => {
|
onDeviceStatus: (ev) => {
|
||||||
if (ev.device_id === deviceId) {
|
if (ev.device_id === deviceId) {
|
||||||
setLiveStatus({ status: ev.status, ping_ms: ev.ping_ms })
|
setLiveStatus({ status: ev.status, ping_ms: ev.ping_ms })
|
||||||
|
qc.invalidateQueries({ queryKey: ['device', objId, deviceId] })
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -457,7 +457,7 @@ 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 showLastSeen = d.status !== 'online' && d.last_seen && d.last_ping_at !== d.last_seen
|
const showLastSeen = d.last_seen && d.last_ping_at !== d.last_seen
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Space size={6} align="start">
|
<Space size={6} align="start">
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue