diff --git a/BACKEND/app/services/line_connection.ts b/BACKEND/app/services/line_connection.ts index 18cc89d..6747f0d 100644 --- a/BACKEND/app/services/line_connection.ts +++ b/BACKEND/app/services/line_connection.ts @@ -494,9 +494,9 @@ export default class LineConnection { } if (typeof step.send !== 'undefined') { - this.outputScenario += `\n---send-command---"${(step?.send ?? '').toString().replace(/\r/g, '\\r').replace(/\n/g, '\\n')}"---${now}---\n` + this.outputScenario += `\n---send-command---"${(step?.send ?? '[ENTER]').toString().replace(/\r/g, '\\r').replace(/\n/g, '\\n')}"---${now}---\n` appendLog( - `\n---send-command---"${(step?.send ?? '').toString().replace(/\r/g, '\\r').replace(/\n/g, '\\n')}"---${now}---\n`, + `\n---send-command---"${(step?.send ?? '[ENTER]').toString().replace(/\r/g, '\\r').replace(/\n/g, '\\n')}"---${now}---\n`, this.config.stationId, this.config.stationName, this.config.stationIp, @@ -578,7 +578,7 @@ export default class LineConnection { waitForExpect = async (expect: string, timeout = 60000) => { const start = Date.now() - console.log('[EXPECT]', expect, timeout) + // console.log('[EXPECT]', expect, timeout) while (Date.now() - start < timeout) { if (this.outputBuffer.includes(expect)) { this.outputBuffer = '' diff --git a/BACKEND/app/ultils/templates/index.ts b/BACKEND/app/ultils/templates/index.ts index ffc0920..efaa175 100644 --- a/BACKEND/app/ultils/templates/index.ts +++ b/BACKEND/app/ultils/templates/index.ts @@ -18,10 +18,14 @@ function getStructuredDataTextfsm(output: string, command: string) { case 'sh ver': return showVersion(output) case 'show license': + case 'show lic': case 'sh license': + case 'sh lic': return showLicense(output) case 'show logging': + case 'show log': case 'sh logging': + case 'sh log': return showLogging(output) default: return '' diff --git a/BACKEND/providers/socket_io_provider.ts b/BACKEND/providers/socket_io_provider.ts index 1a7b670..767f4e0 100644 --- a/BACKEND/providers/socket_io_provider.ts +++ b/BACKEND/providers/socket_io_provider.ts @@ -558,9 +558,10 @@ export class WebSocketIo { const lineIds = data.lineIds const stationName = data.stationName || '' const stationId = data.stationId || '' + const scenarioName = data.scenarioName || '' const station = await Station.find(stationId) // Check station sendWiki flag - console.log('[DPELP] Received run all dpelp', station?.send_wiki) + console.log('[DPELP] Received run all dpelp', lineIds) if (!station || !station?.send_wiki) return const results = await this.waitUntilAllReady(lineIds) @@ -574,11 +575,11 @@ export class WebSocketIo { process.env.LINK_WIKI || 'https://logs.danielvu.com/api/wiki/page/insert?title=Dev_test' await axios.post(linkWiki, { data: tableHTML, - titleAuto: `[DPELP] - ${stationName} - ` + dataFormat, + titleAuto: `[${scenarioName || 'DPELP'}] - ${stationName} - ` + dataFormat, }) await sendMessageToMail( 'andrew.ng@apactech.io', - `[DPELP] - ${stationName} - ${dataFormat}`, + `[${scenarioName || 'DPELP'}] - ${stationName} - ${dataFormat}`, tableHTML, ['ips@ipsupply.com.au', 'kay@ipsupply.com.au', 'joseph@apactech.io'] ) @@ -586,7 +587,8 @@ export class WebSocketIo { 'stream', 'ATC_Report', station.name, - `\n\n---\n**[DPELP] - ${stationName} - ${dataFormat}**\n\n` + zulipMess + `\n\n---\n**[${scenarioName || 'DPELP'}] - ${stationName} - ${dataFormat}**\n\n` + + zulipMess ) } catch (error) { console.log(error) diff --git a/FRONTEND/src/components/ButtonAction.tsx b/FRONTEND/src/components/ButtonAction.tsx index 7e56fac..63d5158 100644 --- a/FRONTEND/src/components/ButtonAction.tsx +++ b/FRONTEND/src/components/ButtonAction.tsx @@ -233,6 +233,7 @@ export const ButtonScenario = ({ lineIds: selectedLines?.map((el) => el.id), stationName: station?.name, stationId: Number(station?.id), + scenarioName: scenario.title, }); selectedLines?.forEach((el) => { socket?.emit( diff --git a/FRONTEND/src/components/Modal/ModalRunScenario.tsx b/FRONTEND/src/components/Modal/ModalRunScenario.tsx index e5aed44..2d65add 100644 --- a/FRONTEND/src/components/Modal/ModalRunScenario.tsx +++ b/FRONTEND/src/components/Modal/ModalRunScenario.tsx @@ -496,6 +496,7 @@ const ModalRunScenario = ({ lineIds: selectedLines?.map((el) => el.id), stationName: station.name, stationId: Number(station.id), + scenarioName: scenario.title, }); selectedLines