From c6b3962542a69cdbb3f8faa54f53f8a0608c796e Mon Sep 17 00:00:00 2001 From: nguyentrungthat <80239428+nguentrungthat@users.noreply.github.com> Date: Fri, 14 Nov 2025 15:18:34 +0700 Subject: [PATCH] Update --- BACKEND/app/services/line_connection.ts | 3 +- BACKEND/providers/socket_io_provider.ts | 1 + FRONTEND/src/components/ButtonAction.tsx | 3 + FRONTEND/src/components/CardLine.tsx | 62 ++++++++++++++------ FRONTEND/src/components/Component.module.css | 9 +++ 5 files changed, 59 insertions(+), 19 deletions(-) diff --git a/BACKEND/app/services/line_connection.ts b/BACKEND/app/services/line_connection.ts index b306ac6..09b3ac6 100644 --- a/BACKEND/app/services/line_connection.ts +++ b/BACKEND/app/services/line_connection.ts @@ -521,7 +521,7 @@ export default class LineConnection { console.log('SPAM Break to line:', this.config.lineNumber) let count = 0 const escInterval = setInterval(() => { - if (count >= 100) { + if (count >= 10) { clearInterval(escInterval) return } @@ -540,5 +540,6 @@ export default class LineConnection { this.writeCommand('end\r\n') await sleep(500) this.writeCommand('write memory\r\n') + this.writeCommand('\r\n') } } diff --git a/BACKEND/providers/socket_io_provider.ts b/BACKEND/providers/socket_io_provider.ts index a36d635..ce6a82b 100644 --- a/BACKEND/providers/socket_io_provider.ts +++ b/BACKEND/providers/socket_io_provider.ts @@ -168,6 +168,7 @@ export class WebSocketIo { }) socket.on('set_baud', async (data) => { + console.log('Set baud', data) const lineId = data.lineId const baud = data.baud const line = await Line.find(lineId) diff --git a/FRONTEND/src/components/ButtonAction.tsx b/FRONTEND/src/components/ButtonAction.tsx index 282268d..4e8a8f5 100644 --- a/FRONTEND/src/components/ButtonAction.tsx +++ b/FRONTEND/src/components/ButtonAction.tsx @@ -14,14 +14,17 @@ export const ButtonDPELP = ({ isDisable, onClick, selectedLines, + className = "", }: { socket: Socket | null; isDisable: boolean; onClick: () => void; selectedLines: TLine[]; + className?: string; }) => { return ( - + - + { - setShowMenu(true); setIsDisabled(true); setTimeout(() => { setIsDisabled(false); @@ -354,18 +368,25 @@ const CardLine = ({ - + - + { - setShowMenu(true); + onClick={(e) => { + e.preventDefault(); + e.stopPropagation(); socket?.emit("set_baud", { lineId: line.id, baud: el, @@ -423,6 +446,7 @@ const CardLine = ({