From 3088848b1aab29ef98e3bde4d2b8a46ff8d08f49 Mon Sep 17 00:00:00 2001 From: nguyentrungthat <80239428+nguentrungthat@users.noreply.github.com> Date: Wed, 4 Mar 2026 14:20:54 +0700 Subject: [PATCH] =?UTF-8?q?Update=20rule=20run=20dpelp=20v=C3=A0=20physica?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BACKEND/app/services/line_connection.ts | 7 +- BACKEND/providers/socket_io_provider.ts | 6 + FRONTEND/src/App.tsx | 17 +++ FRONTEND/src/components/BottomToolBar.tsx | 163 +++++++++++++++++----- FRONTEND/src/components/ButtonAction.tsx | 8 +- 5 files changed, 161 insertions(+), 40 deletions(-) diff --git a/BACKEND/app/services/line_connection.ts b/BACKEND/app/services/line_connection.ts index 02f3ac7..be5feb6 100644 --- a/BACKEND/app/services/line_connection.ts +++ b/BACKEND/app/services/line_connection.ts @@ -607,10 +607,13 @@ export default class LineConnection { this.config.listFeatureTested = [ ...new Set([...this.config.listFeatureTested, 'DPELP']), ] + if (!this.config.listFeatureTested.includes('PHYSICAL')) this.runPhysicalTest() this.sendFeatureTested() // Set timeout send report - this.setTimeoutSendSummaryReport(600000) + this.setTimeoutSendSummaryReport( + !this.config.listFeatureTested.includes('PHYSICAL') ? 600000 : 60000 + ) // } if (this.config.latestScenario) @@ -1272,7 +1275,7 @@ export default class LineConnection { this.config.listFeatureTested = [...new Set([...this.config.listFeatureTested, 'PHYSICAL'])] this.sendFeatureTested() // Set timeout send report - this.setTimeoutSendSummaryReport(180000) + this.setTimeoutSendSummaryReport(60000) const formReport = this.physicalTest.getFormReport() await sendMessageToMail( `[ATC] - [${this.config.stationName} - Line: ${this.config.lineNumber}] - Physical Ports Test`, diff --git a/BACKEND/providers/socket_io_provider.ts b/BACKEND/providers/socket_io_provider.ts index 80fe281..f71ed64 100644 --- a/BACKEND/providers/socket_io_provider.ts +++ b/BACKEND/providers/socket_io_provider.ts @@ -609,6 +609,7 @@ export class WebSocketIo { const stationName = data.stationName || '' const stationId = data.stationId || '' const scenarioName = data.scenarioName || '' + const skipTestPorts = data.skipTestPorts || false const station = await Station.find(stationId) // Check station is active const activeStation = await checkStationActive(stationId) @@ -619,6 +620,11 @@ export class WebSocketIo { const line = this.lineMap.get(lineId) if (line && line.config.isReady) { lineIds.push(lineId) + if (skipTestPorts) { + line.config.listFeatureTested = [ + ...new Set([...line.config.listFeatureTested, 'PHYSICAL']), + ] + } } } // Check station sendWiki flag diff --git a/FRONTEND/src/App.tsx b/FRONTEND/src/App.tsx index 57ce4f3..db363d4 100644 --- a/FRONTEND/src/App.tsx +++ b/FRONTEND/src/App.tsx @@ -586,10 +586,27 @@ function App() { }), }; }); + + updateValueSelectedLines(lineId, updates); }, [] ); + const updateValueSelectedLines = ( + lineId: number, + updates: Partial + ) => { + // Update selectedLine nếu nó đang được chọn + setSelectedLines((prevSelected) => + prevSelected?.map((line) => { + if (line.id === lineId) { + return { ...line, ...updates }; + } + return line; + }) + ); + }; + const updateValueSelectedLine = (lineId: number, updates: Partial) => { // Update selectedLine nếu nó đang được chọn setSelectedLine((prevSelected) => { diff --git a/FRONTEND/src/components/BottomToolBar.tsx b/FRONTEND/src/components/BottomToolBar.tsx index c3b2747..7527802 100644 --- a/FRONTEND/src/components/BottomToolBar.tsx +++ b/FRONTEND/src/components/BottomToolBar.tsx @@ -5,6 +5,7 @@ import { CloseButton, Flex, Grid, + Menu, ScrollArea, Tabs, Text, @@ -25,7 +26,11 @@ import { DrawerAPCControl, DrawerSwitchControl } from "./Drawer/DrawerControl"; import DrawerScenario from "./Modal/ModalScenario"; import { isJsonString } from "../untils/helper"; import { motion } from "motion/react"; -import { IconCaretDown, IconCaretUp } from "@tabler/icons-react"; +import { + IconCaretDown, + IconCaretRight, + IconCaretUp, +} from "@tabler/icons-react"; import InputHistory from "./InputHistory"; import ModalRunScenario from "./Modal/ModalRunScenario"; @@ -360,31 +365,94 @@ const BottomToolBar = ({ gap={"xs"} wrap={"wrap"} > - el.title.toUpperCase() === "DPELP" - )} - onClick={() => { - if ( - selectedLines.length > 0 - // && - // selectedLines.length === station?.lines?.length - ) { - socket?.emit("run_all_dpelp", { - lineIds: selectedLines.map((line) => line.id), - stationName: station.name, - stationId: station.id, - }); - } - setIsDisable(true); - setTimeout(() => { - setIsDisable(false); - }, 5000); - }} - /> + + + + + + + el.title.toUpperCase() === "DPELP" + )} + onClick={() => { + if ( + selectedLines.length > 0 + // && + // selectedLines.length === station?.lines?.length + ) { + socket?.emit("run_all_dpelp", { + lineIds: selectedLines.map( + (line) => line.id + ), + stationName: station.name, + stationId: station.id, + }); + } + setIsDisable(true); + setTimeout(() => { + setIsDisable(false); + }, 5000); + }} + text="Run Test Ports after DPELP" + /> + el.title.toUpperCase() === "DPELP" + )} + onClick={() => { + if ( + selectedLines.length > 0 + // && + // selectedLines.length === station?.lines?.length + ) { + socket?.emit("run_all_dpelp", { + lineIds: selectedLines.map( + (line) => line.id + ), + stationName: station.name, + stationId: station.id, + skipTestPorts: true, + }); + } + setIsDisable(true); + setTimeout(() => { + setIsDisable(false); + }, 5000); + }} + text="Skip Test Ports" + color="yellow" + /> + + + { return ( ); };