Update flow test dpelp

This commit is contained in:
nguyentrungthat 2026-03-05 08:52:41 +07:00
parent 3088848b1a
commit 5305e64453
4 changed files with 77 additions and 35 deletions

View File

@ -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)
}
}

View File

@ -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)

View File

@ -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 },

View File

@ -1395,37 +1395,67 @@ const ModalTerminal = ({
</Flex>
</Menu.Dropdown>
</Menu>
<ButtonDPELP
socket={socket}
selectedLines={line ? [line] : []}
isDisable={isDisable}
onClick={() => {
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"
)}
/>
<Menu trigger="hover" withArrow shadow="md" position="top">
<Menu.Target>
<Button
fw={400}
mr={"5px"}
disabled={isDisable || selectedLines.length === 0}
variant="outline"
color="green"
style={{ height: "30px", width: "100px" }}
onClick={() => {}}
>
DPELP <IconCaretRight size={"14px"} />
</Button>
</Menu.Target>
<Menu.Dropdown>
<Flex direction={"column"} gap={"8px"}>
<ButtonDPELP
socket={socket}
selectedLines={line ? [line] : []}
isDisable={isDisable}
dataDPELP={scenarios?.find(
(el) => 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"
/>
<ButtonDPELP
socket={socket}
selectedLines={line ? [line] : []}
isDisable={isDisable}
dataDPELP={scenarios?.find(
(el) => 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"
/>
</Flex>
</Menu.Dropdown>
</Menu>
<Button
fw={400}
disabled={isDisable}