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.
This commit is contained in:
nguyentrungthat 2025-12-18 08:12:23 +07:00
parent 4b130df801
commit 6e282c42bd
4 changed files with 29 additions and 30 deletions

View File

@ -473,11 +473,11 @@ export default class LineConnection {
// console.log(pid, scenario) // console.log(pid, scenario)
if (scenario && scenario.id !== script.id) { if (scenario && scenario.id !== script.id) {
this.outputScenario = '' this.outputScenario = ''
// this.runScript(scenario, userName) this.runScript(scenario, userName)
this.socketIO.emit('confirm_scenario', { // this.socketIO.emit('confirm_scenario', {
scenario: scenario, // scenario: scenario,
id: this.config.id, // id: this.config.id,
}) // })
resolve(true) resolve(true)
return return
} }
@ -490,13 +490,13 @@ export default class LineConnection {
}, },
data, data,
}) })
if (script?.send_result || script?.sendResult) { // if (script?.send_result || script?.sendResult) {
this.dataDPELP = result this.dataDPELP = result
console.log( console.log(
`DPELP DATA line ${this.config.lineNumber} of ${this.config.stationName}:`, `DPELP DATA line ${this.config.lineNumber} of ${this.config.stationName}:`,
this.dataDPELP this.dataDPELP
) )
} // }
if (this.config.latestScenario) if (this.config.latestScenario)
this.config.latestScenario = { ...this.config.latestScenario, detectAI: detectLog } this.config.latestScenario = { ...this.config.latestScenario, detectAI: detectLog }
this.config.data = data this.config.data = data

View File

@ -574,24 +574,23 @@ export class WebSocketIo {
const linkWiki = const linkWiki =
process.env.LINK_WIKI || 'https://logs.danielvu.com/api/wiki/page/insert?title=Dev_test' process.env.LINK_WIKI || 'https://logs.danielvu.com/api/wiki/page/insert?title=Dev_test'
// await axios.post(linkWiki, { await axios.post(linkWiki, {
// data: tableHTML, data: tableHTML,
// titleAuto: `[${scenarioName || 'DPELP'}] - ${stationName} - ` + dataFormat, titleAuto: `[${scenarioName || 'DPELP'}] - ${stationName} - ` + dataFormat,
// }) })
await sendMessageToMail( await sendMessageToMail(
'andrew.ng@apactech.io', 'andrew.ng@apactech.io',
`[${scenarioName || 'DPELP'}] - ${stationName} - ${dataFormat}`, `[${scenarioName || 'DPELP'}] - ${stationName} - ${dataFormat}`,
tableHTML tableHTML,
// , ['ips@ipsupply.com.au', 'kay@ipsupply.com.au', 'joseph@apactech.io']
// ['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) { } catch (error) {
console.log(error) console.log(error)
} }

View File

@ -52,7 +52,7 @@ import PageLogin from "./components/Authentication/LoginPage";
import DraggableTabs from "./components/DragTabs"; import DraggableTabs from "./components/DragTabs";
import { isJsonString } from "./untils/helper"; import { isJsonString } from "./untils/helper";
import BottomToolBar from "./components/BottomToolBar"; 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; const apiUrl = import.meta.env.VITE_BACKEND_URL;
@ -827,11 +827,11 @@ function App() {
scenarios={scenarios} scenarios={scenarios}
/> />
<ModalConfirmRunScenario {/* <ModalConfirmRunScenario
socket={socket} socket={socket}
station={stations.find((el) => el.id === Number(activeTab))} station={stations.find((el) => el.id === Number(activeTab))}
scenarios={scenarios} scenarios={scenarios}
/> /> */}
</Container> </Container>
); );
} }

View File

@ -193,7 +193,7 @@ const BottomToolBar = ({
> >
<Flex justify={"space-between"} align="flex-start"> <Flex justify={"space-between"} align="flex-start">
<Box> <Box>
<ScrollArea h={"11vh"}> <ScrollArea h={"9vh"}>
<Flex wrap={"wrap"} gap={"8px"} w={"420px"}> <Flex wrap={"wrap"} gap={"8px"} w={"420px"}>
{selectedLines.map((el) => ( {selectedLines.map((el) => (
<Box <Box