From 6e282c42bd22cea31182a26aeb2334476daaa73d Mon Sep 17 00:00:00 2001 From: nguyentrungthat <80239428+nguentrungthat@users.noreply.github.com> Date: Thu, 18 Dec 2025 08:12:23 +0700 Subject: [PATCH] Enable scenario run and reporting, adjust UI elements Uncommented code to run scenarios and send reports via email and Zulip in the backend, and commented out the scenario confirmation modal in the frontend. Also adjusted the height of the ScrollArea in the BottomToolBar component for improved UI layout. --- BACKEND/app/services/line_connection.ts | 24 ++++++++++---------- BACKEND/providers/socket_io_provider.ts | 27 +++++++++++------------ FRONTEND/src/App.tsx | 6 ++--- FRONTEND/src/components/BottomToolBar.tsx | 2 +- 4 files changed, 29 insertions(+), 30 deletions(-) diff --git a/BACKEND/app/services/line_connection.ts b/BACKEND/app/services/line_connection.ts index 6a2efe1..8fd70f6 100644 --- a/BACKEND/app/services/line_connection.ts +++ b/BACKEND/app/services/line_connection.ts @@ -473,11 +473,11 @@ export default class LineConnection { // console.log(pid, scenario) if (scenario && scenario.id !== script.id) { this.outputScenario = '' - // this.runScript(scenario, userName) - this.socketIO.emit('confirm_scenario', { - scenario: scenario, - id: this.config.id, - }) + this.runScript(scenario, userName) + // this.socketIO.emit('confirm_scenario', { + // scenario: scenario, + // id: this.config.id, + // }) resolve(true) return } @@ -490,13 +490,13 @@ export default class LineConnection { }, data, }) - if (script?.send_result || script?.sendResult) { - this.dataDPELP = result - console.log( - `DPELP DATA line ${this.config.lineNumber} of ${this.config.stationName}:`, - this.dataDPELP - ) - } + // if (script?.send_result || script?.sendResult) { + this.dataDPELP = result + console.log( + `DPELP DATA line ${this.config.lineNumber} of ${this.config.stationName}:`, + this.dataDPELP + ) + // } if (this.config.latestScenario) this.config.latestScenario = { ...this.config.latestScenario, detectAI: detectLog } this.config.data = data diff --git a/BACKEND/providers/socket_io_provider.ts b/BACKEND/providers/socket_io_provider.ts index be8eb5f..6bf9f44 100644 --- a/BACKEND/providers/socket_io_provider.ts +++ b/BACKEND/providers/socket_io_provider.ts @@ -574,24 +574,23 @@ export class WebSocketIo { const linkWiki = process.env.LINK_WIKI || 'https://logs.danielvu.com/api/wiki/page/insert?title=Dev_test' - // await axios.post(linkWiki, { - // data: tableHTML, - // titleAuto: `[${scenarioName || 'DPELP'}] - ${stationName} - ` + dataFormat, - // }) + await axios.post(linkWiki, { + data: tableHTML, + titleAuto: `[${scenarioName || 'DPELP'}] - ${stationName} - ` + dataFormat, + }) await sendMessageToMail( 'andrew.ng@apactech.io', `[${scenarioName || 'DPELP'}] - ${stationName} - ${dataFormat}`, - tableHTML - // , - // ['ips@ipsupply.com.au', 'kay@ipsupply.com.au', 'joseph@apactech.io'] + tableHTML, + ['ips@ipsupply.com.au', 'kay@ipsupply.com.au', 'joseph@apactech.io'] + ) + await sendMessageToZulip( + 'stream', + 'ATC_Report', + station.name, + `\n\n---\n**[${scenarioName || 'DPELP'}] - ${stationName} - ${dataFormat}**\n\n` + + zulipMess ) - // await sendMessageToZulip( - // 'stream', - // 'ATC_Report', - // station.name, - // `\n\n---\n**[${scenarioName || 'DPELP'}] - ${stationName} - ${dataFormat}**\n\n` + - // zulipMess - // ) } catch (error) { console.log(error) } diff --git a/FRONTEND/src/App.tsx b/FRONTEND/src/App.tsx index 5193669..9af6125 100644 --- a/FRONTEND/src/App.tsx +++ b/FRONTEND/src/App.tsx @@ -52,7 +52,7 @@ import PageLogin from "./components/Authentication/LoginPage"; import DraggableTabs from "./components/DragTabs"; import { isJsonString } from "./untils/helper"; import BottomToolBar from "./components/BottomToolBar"; -import ModalConfirmRunScenario from "./components/Modal/ModalConfirmRunScenario"; +// import ModalConfirmRunScenario from "./components/Modal/ModalConfirmRunScenario"; const apiUrl = import.meta.env.VITE_BACKEND_URL; @@ -827,11 +827,11 @@ function App() { scenarios={scenarios} /> - el.id === Number(activeTab))} scenarios={scenarios} - /> + /> */} ); } diff --git a/FRONTEND/src/components/BottomToolBar.tsx b/FRONTEND/src/components/BottomToolBar.tsx index eec3aa5..3db9690 100644 --- a/FRONTEND/src/components/BottomToolBar.tsx +++ b/FRONTEND/src/components/BottomToolBar.tsx @@ -193,7 +193,7 @@ const BottomToolBar = ({ > - + {selectedLines.map((el) => (