From ef20557635e11b098a5f97ac8c0f2f1ccf72fa6f Mon Sep 17 00:00:00 2001 From: nguyentrungthat <80239428+nguentrungthat@users.noreply.github.com> Date: Mon, 4 May 2026 07:46:58 +0700 Subject: [PATCH] Update modal confirm --- BACKEND/app/services/line_connection.ts | 3 + FRONTEND/src/App.tsx | 80 ++++++++++++++++--------- 2 files changed, 54 insertions(+), 29 deletions(-) diff --git a/BACKEND/app/services/line_connection.ts b/BACKEND/app/services/line_connection.ts index ac0d9f5..d81bc6d 100644 --- a/BACKEND/app/services/line_connection.ts +++ b/BACKEND/app/services/line_connection.ts @@ -1809,6 +1809,9 @@ ${log} listFeatureTested: this.config.listFeatureTested, isSkipPhysical: this.config.isSkipPhysical, reasonSkipPhysical: this.config.reasonSkipPhysical, + pid: this.config.inventory?.pid, + sn: this.config.inventory?.sn, + vid: this.config.inventory?.vid, }) } diff --git a/FRONTEND/src/App.tsx b/FRONTEND/src/App.tsx index a5995a8..c2642b7 100644 --- a/FRONTEND/src/App.tsx +++ b/FRONTEND/src/App.tsx @@ -154,10 +154,10 @@ function App() { response.data.map((station) => { connectApcSwitch(station); const lines = (station?.lines || []).sort( - (a: TLine, b: TLine) => a?.lineNumber - b?.lineNumber + (a: TLine, b: TLine) => a?.lineNumber - b?.lineNumber, ); return { ...station, lines }; - }) + }), ); } } @@ -253,8 +253,8 @@ function App() { updateValueLineStation( data?.lineId, { status: data.status, connecting: false }, - data?.stationId - ) + data?.stationId, + ), ); socket.on("line_disconnected", (data) => @@ -269,8 +269,8 @@ function App() { latestScenario: undefined, isReady: false, }, - data?.stationId - ) + data?.stationId, + ), ); socket?.on("line_output", (data) => { @@ -295,7 +295,7 @@ function App() { updateValueLineStation( data?.lineId, { isReady: isReady }, - data?.stationId + data?.stationId, ); }); @@ -303,7 +303,7 @@ function App() { updateValueLineStation( data?.lineId, { netOutput: data.error, connecting: false }, - data?.stationId + data?.stationId, ); }); @@ -315,7 +315,7 @@ function App() { updateValueLineStation( value?.id, { ...value, netOutput: value.output }, - value?.stationId + value?.stationId, ); }); } @@ -336,7 +336,7 @@ function App() { userEmailOpenCLI: data.userEmailOpenCLI, userOpenCLI: data.userOpenCLI, }, - data?.stationId + data?.stationId, ); }, 100); }); @@ -350,7 +350,7 @@ function App() { userEmailOpenCLI: undefined, userOpenCLI: undefined, }, - data?.stationId + data?.stationId, ); }, 100); }); @@ -406,7 +406,7 @@ function App() { inventory: data.inventory, latestScenario: data.latestScenario, }, - data?.stationId + data?.stationId, ); }, 100); }); @@ -418,7 +418,7 @@ function App() { { tickets: data.data, }, - data?.stationId + data?.stationId, ); }, 100); }); @@ -430,7 +430,7 @@ function App() { { baud: data.data, }, - data?.stationId + data?.stationId, ); }, 100); }); @@ -440,7 +440,7 @@ function App() { updateValueLineStation( data?.lineId, { connecting: true }, - data?.stationId + data?.stationId, ); }, 100); }); @@ -455,7 +455,7 @@ function App() { ports: data?.ports || [], listPortsPhysical: [], }, - data?.stationId + data?.stationId, ); }, 100); }); @@ -464,7 +464,7 @@ function App() { updateValueLineStation( data?.lineId, { netOutput: "", output: "", loadingClearTerminal: true }, - data?.stationId + data?.stationId, ); }); @@ -473,7 +473,7 @@ function App() { updateValueLineStation( data?.lineId, { listPortsPhysical: data?.data }, - data?.stationId + data?.stationId, ); }); @@ -486,7 +486,7 @@ function App() { isSkipPhysical: data?.isSkipPhysical, reasonSkipPhysical: data?.reasonSkipPhysical, }, - data?.stationId + data?.stationId, ); if (data?.isSkipPhysical && !data?.reasonSkipPhysical) { const valueLine = findLineByLineId(data?.lineId, data?.stationId); @@ -495,7 +495,18 @@ function App() { openModalTerminal && selectedLine?.id === valueLine?.id ) - setLinesConfirmSkipPort((pre) => [...pre, valueLine]); + setLinesConfirmSkipPort((pre) => [ + ...pre, + { + ...valueLine, + inventory: { + ...valueLine.inventory, + pid: data?.pid, + sn: data?.sn, + vid: data?.vid, + }, + }, + ]); } if ( !data?.listFeatureTested?.includes("PHYSICAL") && @@ -507,7 +518,18 @@ function App() { openModalTerminal && selectedLine?.id === valueLine?.id ) - setLinesConfirmRunPhysical((pre) => [...pre, valueLine]); + setLinesConfirmRunPhysical((pre) => [ + ...pre, + { + ...valueLine, + inventory: { + ...valueLine.inventory, + pid: data?.pid, + sn: data?.sn, + vid: data?.vid, + }, + }, + ]); } } }); @@ -565,7 +587,7 @@ function App() { updateValueSelectedLine(line?.id || 0, data); return data; }), - })) + })), ); // clear lineBuffersRef.current.clear(); @@ -607,8 +629,8 @@ function App() { }; }), } - : station - ) + : station, + ), ); // Update selectedLine nếu nó đang được chọn @@ -639,12 +661,12 @@ function App() { updateValueSelectedLines(lineId, updates); }, - [] + [], ); const updateValueSelectedLines = ( lineId: number, - updates: Partial + updates: Partial, ) => { // Update selectedLine nếu nó đang được chọn setSelectedLines((prevSelected) => @@ -653,7 +675,7 @@ function App() { return { ...line, ...updates }; } return line; - }) + }), ); }; @@ -801,7 +823,7 @@ function App() { const rightChunks = chunkArray(rightLines, 2); const numRows = Math.max( leftChunks.length, - rightChunks.length + rightChunks.length, ); return ( @@ -895,7 +917,7 @@ function App() { ); - } + }, )} );