Update line_connection.ts

This commit is contained in:
nguyentrungthat 2026-01-19 13:20:45 +07:00
parent 6e2f7e756d
commit ae7050a719
1 changed files with 8 additions and 10 deletions

View File

@ -131,6 +131,7 @@ export default class LineConnection {
private outputLoadIosLicense: string | boolean
private listDeviceIos: string[]
private debounceTimer: NodeJS.Timeout | null = null
private testingPortPoE: boolean
constructor(config: LineConfig, socketIO: any, handleClearLine: () => void) {
this.config = config
@ -161,6 +162,7 @@ export default class LineConnection {
this.outputLoadIosLicense = ''
this.listDeviceIos = []
this.debounceTimer = null
this.testingPortPoE = false
}
/**
* Connect to line with socket
@ -213,16 +215,10 @@ export default class LineConnection {
this.outputPhysicalTest += message
if (this.debounceTimer) clearTimeout(this.debounceTimer)
this.debounceTimer = setTimeout(() => {
this.flushLogBuffer()
}, 1000) // 1s debounce
// const ports = this.physicalTest.handleLog(message)
// if (ports?.length)
// this.socketIO.emit('test_port_physical', {
// stationId,
// lineId: id,
// data: ports,
// })
if (this.testingPortPoE)
this.debounceTimer = setTimeout(() => {
this.flushLogBuffer()
}, 1000) // 1s debounce
}
if (data.toString().includes('More') || data.toString().includes('MORE'))
this.writeCommand(' ')
@ -1057,6 +1053,7 @@ export default class LineConnection {
this.config.runningPhysical = true
this.config.runningScenario = 'Physical Test'
const listPorts = await this.getPorts()
this.testingPortPoE = true
this.socketIO.emit('running_scenario', {
stationId: this.config.stationId,
lineId: this.config.id,
@ -1110,6 +1107,7 @@ export default class LineConnection {
this.physicalTest.resetTestedPorts()
this.config.runningPhysical = false
this.config.runningScenario = ''
this.testingPortPoE = false
this.outputBuffer = ''
this.outputScenario = ''
this.outputPhysicalTest = ''