Update run dpelp

This commit is contained in:
nguyentrungthat 2025-12-05 09:27:43 +07:00
parent 637bdfa16b
commit f0b1a09fd4
5 changed files with 22 additions and 25 deletions

View File

@ -1,14 +1,7 @@
import fs from 'node:fs'
import { textfsmResults } from './../ultils/templates/index.js'
import net from 'node:net'
import {
appendLog,
cleanData,
getLogWithTimeScenario,
isValidJson,
mapToLineFormat,
sleep,
} from '../ultils/helper.js'
import { appendLog, cleanData, isValidJson, mapToLineFormat, sleep } from '../ultils/helper.js'
import Scenario from '#models/scenario'
import Station from '#models/station'
import APCController from './apc_connection.js'
@ -418,7 +411,7 @@ export default class LineConnection {
this.config.lineNumber
)
const logScenarios = getLogWithTimeScenario(this.outputScenario, now) || ''
const logScenarios = this.outputScenario
const data = textfsmResults(logScenarios, '')
try {
data.forEach((item) => {
@ -485,9 +478,9 @@ export default class LineConnection {
}
if (step.send) {
this.outputScenario += `\n---send-command---"${step?.send ?? ''}"---${now}---\n`
this.outputScenario += `\n---send-command---"${(step?.send ?? '').toString().replace(/\r/g, '\\r').replace(/\n/g, '\\n')}"---${now}---\n`
appendLog(
`\n---send-command---"${step?.send ?? ''}"---${now}---\n`,
`\n---send-command---"${(step?.send ?? '').toString().replace(/\r/g, '\\r').replace(/\n/g, '\\n')}"---${now}---\n`,
this.config.stationId,
this.config.stationName,
this.config.stationIp,

View File

@ -567,8 +567,9 @@ export class WebSocketIo {
await sendMessageToMail(
'andrew.ng@apactech.io',
`[DPELP] Report AUTO - ${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']
)
} catch (error) {
console.log(error)

View File

@ -135,13 +135,13 @@ export const ButtonDPELP = ({
repeat: "1",
note: "",
},
{
expect: "",
send: "show platform",
delay: "3000",
repeat: "1",
note: "",
},
// {
// expect: "",
// send: "show platform",
// delay: "3000",
// repeat: "1",
// note: "",
// },
];
socket?.emit(
"run_scenario",

View File

@ -406,6 +406,11 @@ const CardLine = ({
selectedLines={[line]}
isDisable={isDisabled}
onClick={() => {
socket?.emit("run_all_dpelp", {
lineIds: [line?.id],
stationName: stationItem.name,
stationId: Number(stationItem.id),
});
setIsDisabled(true);
setTimeout(() => {
setIsDisabled(false);

View File

@ -720,11 +720,9 @@ export const DrawerSwitchControl: React.FC<DrawerProps> = ({
const [checkedActive, setCheckedActive] = useState("all");
useEffect(() => {
if (!open) {
setListPortsSelected([]);
setLoading(true);
}
}, [open]);
setListPortsSelected([]);
setLoading(true);
}, [stationId]);
useEffect(() => {
const value = localStorage.getItem("show-switch-port");