diff --git a/BACKEND/app/services/line_connection.ts b/BACKEND/app/services/line_connection.ts index be5feb6..1d8e61e 100644 --- a/BACKEND/app/services/line_connection.ts +++ b/BACKEND/app/services/line_connection.ts @@ -612,7 +612,7 @@ export default class LineConnection { // Set timeout send report this.setTimeoutSendSummaryReport( - !this.config.listFeatureTested.includes('PHYSICAL') ? 600000 : 60000 + !this.config.listFeatureTested.includes('PHYSICAL') ? 600000 : 30000 ) // } @@ -1275,7 +1275,7 @@ export default class LineConnection { this.config.listFeatureTested = [...new Set([...this.config.listFeatureTested, 'PHYSICAL'])] this.sendFeatureTested() // Set timeout send report - this.setTimeoutSendSummaryReport(60000) + this.setTimeoutSendSummaryReport(30000) const formReport = this.physicalTest.getFormReport() await sendMessageToMail( `[ATC] - [${this.config.stationName} - Line: ${this.config.lineNumber}] - Physical Ports Test`, @@ -1866,4 +1866,11 @@ ${log} this.sendReportSummary(snapshot) }, timeout) } + + resetDPELP() { + this.config.listFeatureTested = [] + this.dataDPELP = '' + this.sendFeatureTested() + console.log('Reset DPELP data and features', this.config.id, this.config.listFeatureTested) + } } diff --git a/BACKEND/providers/socket_io_provider.ts b/BACKEND/providers/socket_io_provider.ts index f71ed64..95af97f 100644 --- a/BACKEND/providers/socket_io_provider.ts +++ b/BACKEND/providers/socket_io_provider.ts @@ -605,6 +605,7 @@ export class WebSocketIo { socket.on('run_all_dpelp', async (data) => { try { + console.log('[DPELP] Received run all dpelp', data) const dataLines = data.lineIds || [] const stationName = data.stationName || '' const stationId = data.stationId || '' @@ -620,15 +621,19 @@ export class WebSocketIo { const line = this.lineMap.get(lineId) if (line && line.config.isReady) { lineIds.push(lineId) + console.log(lineId, skipTestPorts) if (skipTestPorts) { line.config.listFeatureTested = [ ...new Set([...line.config.listFeatureTested, 'PHYSICAL']), ] + } else { + console.log('Reset list feature tested for line', lineId) + line.resetDPELP() } } } // Check station sendWiki flag - console.log('[DPELP] Received run all dpelp', lineIds) + // console.log('[DPELP] Received run all dpelp', lineIds) if (!station || !station?.send_wiki || lineIds?.length < 1) return const results = await this.waitUntilAllReady(lineIds) diff --git a/FRONTEND/src/App.tsx b/FRONTEND/src/App.tsx index db363d4..1a74947 100644 --- a/FRONTEND/src/App.tsx +++ b/FRONTEND/src/App.tsx @@ -468,7 +468,7 @@ function App() { }); socket?.on("feature_tested", (data) => { - if (data?.listFeatureTested && data?.listFeatureTested.length > 0) + if (data?.listFeatureTested) updateValueLineStation( data?.lineId, { listFeatureTested: data?.listFeatureTested }, diff --git a/FRONTEND/src/components/Modal/ModalTerminal.tsx b/FRONTEND/src/components/Modal/ModalTerminal.tsx index c0481c9..126d1fe 100644 --- a/FRONTEND/src/components/Modal/ModalTerminal.tsx +++ b/FRONTEND/src/components/Modal/ModalTerminal.tsx @@ -1395,37 +1395,67 @@ const ModalTerminal = ({ - - { - const dpelp = scenarios?.find( - (el) => el.title.toUpperCase() === "DPELP" - ); - if (dpelp?.isReboot || dpelp?.is_reboot) { - socket?.emit("control_apc", { - outletNumbers: [line?.outlet], - station: { ...stationItem, lines: [] }, - action: "restart", - apcName: line?.apc_name || line?.apcName, - }); - } - socket?.emit("run_all_dpelp", { - lineIds: [line?.id], - stationName: stationItem?.name, - stationId: Number(stationItem?.id), - }); - setIsDisable(true); - setTimeout(() => { - setIsDisable(false); - }, 10000); - }} - dataDPELP={scenarios?.find( - (el) => el.title.toUpperCase() === "DPELP" - )} - /> + + + + + + + el.title.toUpperCase() === "DPELP" + )} + onClick={() => { + socket?.emit("run_all_dpelp", { + lineIds: [line?.id], + stationName: stationItem?.name, + stationId: Number(stationItem?.id), + }); + setIsDisable(true); + setTimeout(() => { + setIsDisable(false); + }, 10000); + }} + text="Run Test Ports after DPELP" + /> + el.title.toUpperCase() === "DPELP" + )} + onClick={() => { + socket?.emit("run_all_dpelp", { + lineIds: [line?.id], + stationName: stationItem?.name, + stationId: Number(stationItem?.id), + skipTestPorts: true, + }); + setIsDisable(true); + setTimeout(() => { + setIsDisable(false); + }, 10000); + }} + text="Skip Test Ports" + color="yellow" + /> + + +