Update physical test, load IOS
This commit is contained in:
parent
c5e3e796bf
commit
57e91bc422
|
|
@ -1319,6 +1319,7 @@ export default class LineConnection {
|
|||
await this.writeCommand(`${fileName}\r\n`)
|
||||
await this.writeCommand(`${server}\r\n`)
|
||||
await this.writeCommand(`i/${fileName}\r\n`)
|
||||
this.outputBuffer = ''
|
||||
await sleep(5000)
|
||||
while (true) {
|
||||
if (this.outputBuffer.includes('#')) {
|
||||
|
|
|
|||
|
|
@ -46,49 +46,50 @@ export class PhysicalPortTest {
|
|||
// });
|
||||
}
|
||||
|
||||
handleLog(line: string) {
|
||||
let iface: string | null = null
|
||||
let markTested = false
|
||||
let state: 'up' | 'down' | undefined
|
||||
handleLog(lines: string) {
|
||||
for (const line of lines.split('\n')) {
|
||||
let iface: string | null = null
|
||||
let markTested = false
|
||||
let state: 'up' | 'down' | undefined
|
||||
|
||||
// 1️⃣ LINK / LINEPROTO
|
||||
let match = line.match(LINK_REGEX)
|
||||
if (match) {
|
||||
iface = normalizeInterface(match[1])
|
||||
state = match[2] as 'up' | 'down'
|
||||
if (state === 'up') markTested = true
|
||||
// 1️⃣ LINK / LINEPROTO
|
||||
let match = line.match(LINK_REGEX)
|
||||
if (match) {
|
||||
iface = normalizeInterface(match[1])
|
||||
state = match[2] as 'up' | 'down'
|
||||
if (state === 'up') markTested = true
|
||||
}
|
||||
|
||||
// 2️⃣ POE POWER GRANTED
|
||||
match = line.match(POE_GRANTED_REGEX)
|
||||
if (match) {
|
||||
iface = normalizeInterface(match[1])
|
||||
markTested = true
|
||||
}
|
||||
|
||||
// 3️⃣ POE DISCONNECT
|
||||
match = line.match(POE_DISCONNECT_REGEX)
|
||||
if (match) {
|
||||
iface = normalizeInterface(match[1])
|
||||
markTested = true
|
||||
}
|
||||
|
||||
if (!iface) return
|
||||
|
||||
const port = this.ports.get(iface)
|
||||
if (!port) return
|
||||
|
||||
port.lastSeen = new Date()
|
||||
|
||||
if (state && port.lastState === state) return
|
||||
if (state) port.lastState = state
|
||||
|
||||
// ⭐ PASS nếu có ít nhất 1 event hợp lệ
|
||||
if (markTested && !port.tested) {
|
||||
port.tested = true
|
||||
this.checkDone()
|
||||
}
|
||||
}
|
||||
|
||||
// 2️⃣ POE POWER GRANTED
|
||||
match = line.match(POE_GRANTED_REGEX)
|
||||
if (match) {
|
||||
iface = normalizeInterface(match[1])
|
||||
markTested = true
|
||||
}
|
||||
|
||||
// 3️⃣ POE DISCONNECT
|
||||
match = line.match(POE_DISCONNECT_REGEX)
|
||||
if (match) {
|
||||
iface = normalizeInterface(match[1])
|
||||
markTested = true
|
||||
}
|
||||
|
||||
if (!iface) return
|
||||
|
||||
const port = this.ports.get(iface)
|
||||
if (!port) return
|
||||
|
||||
port.lastSeen = new Date()
|
||||
|
||||
if (state && port.lastState === state) return
|
||||
if (state) port.lastState = state
|
||||
|
||||
// ⭐ PASS nếu có ít nhất 1 event hợp lệ
|
||||
if (markTested && !port.tested) {
|
||||
port.tested = true
|
||||
this.checkDone()
|
||||
}
|
||||
|
||||
return this.getTestedPorts()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -142,7 +142,10 @@ function DrawerLogs({
|
|||
offset={8}
|
||||
radius="md"
|
||||
opened={opened}
|
||||
onClose={close}
|
||||
onClose={() => {
|
||||
if (isLogModalOpen) return;
|
||||
close();
|
||||
}}
|
||||
title={
|
||||
<div>
|
||||
<Tooltip
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ const ModalSelectIOS = ({
|
|||
const payload = {
|
||||
stationId: Number(station?.id),
|
||||
lineId: Number(line?.id),
|
||||
iosName: ios,
|
||||
iosName: ios?.name,
|
||||
station: station,
|
||||
outletNumber: line?.outlet || -1,
|
||||
apcName: line?.apcName || line?.apc_name,
|
||||
|
|
|
|||
|
|
@ -987,6 +987,7 @@ const ModalTerminal = ({
|
|||
{line?.runningPhysical && line?.ports
|
||||
? line?.ports?.map((port, i) => (
|
||||
<Text
|
||||
fz={"14px"}
|
||||
key={i}
|
||||
c={
|
||||
line?.listPortsPhysical?.includes(port)
|
||||
|
|
|
|||
Loading…
Reference in New Issue