This commit is contained in:
nguyentrungthat 2025-12-15 14:11:50 +07:00
parent 1d0a90f2cf
commit 4a671658ff
3 changed files with 56 additions and 14 deletions

View File

@ -168,7 +168,7 @@ export default class LineConnection {
if (!this.config.inventory)
this.outputInventory = this.outputInventory.slice(-3000) + message
}
if (data.toString().includes('--More--')) this.writeCommand(' ')
if (data.toString().includes('More')) this.writeCommand(' ')
// let output = cleanData(message)
// console.log(`📨 [${this.config.port}] ${message}`)

View File

@ -182,7 +182,7 @@ export const ButtonScenario = ({
selectedLines: TLine[];
scenario: IScenario;
fontSize?: string;
station: TStation;
station: TStation | undefined;
}) => {
return (
<Button
@ -231,8 +231,8 @@ export const ButtonScenario = ({
if (scenario?.send_result)
socket?.emit("run_all_dpelp", {
lineIds: selectedLines?.map((el) => el.id),
stationName: station.name,
stationId: Number(station.id),
stationName: station?.name,
stationId: Number(station?.id),
});
selectedLines?.forEach((el) => {
socket?.emit(

View File

@ -1,4 +1,5 @@
import {
ActionIcon,
Box,
Button,
CloseButton,
@ -29,6 +30,7 @@ import {
IconCircleCheckFilled,
IconCircleDot,
IconInfoCircle,
IconSettings,
} from "@tabler/icons-react";
import { ButtonDPELP, ButtonScenario } from "../ButtonAction";
import CopyIcon from "../CopyIcon";
@ -547,20 +549,21 @@ const ModalTerminal = ({
position="right"
>
<Menu.Target>
<Button
<ActionIcon
fw={400}
me={"md"}
disabled={isDisable}
variant="filled"
size="xs"
style={{
height: "26px",
width: "80px",
marginRight: "20px",
}}
size="md"
// style={{
// height: "26px",
// width: "80px",
// marginRight: "20px",
// }}
onClick={() => {}}
>
BAUD
</Button>
<IconSettings />
</ActionIcon>
</Menu.Target>
<Menu.Dropdown style={{ width: "110px" }}>
<Flex
@ -578,7 +581,7 @@ const ModalTerminal = ({
size="xs"
onClick={() => {
if (!line) return;
socket?.emit("change_baud", {
socket?.emit("set_baud", {
stationId: line?.stationId || line?.station_id,
lineId: line?.id,
baud: el,
@ -592,6 +595,25 @@ const ModalTerminal = ({
{el}
</Button>
))}
<Input
placeholder="Custom"
value={valueBaud}
onChange={(e) => setValueBaud(e.target.value)}
onKeyDown={(e) => {
if (e.key === "Enter") {
socket?.emit("set_baud", {
lineId: line?.id,
baud: Number(valueBaud),
stationId: Number(stationItem?.id),
});
setValueBaud("");
setIsDisable(true);
setTimeout(() => {
setIsDisable(false);
}, 5000);
}
}}
/>
</Flex>
</Menu.Dropdown>
</Menu>
@ -889,11 +911,30 @@ const ModalTerminal = ({
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>
@ -932,6 +973,7 @@ const ModalTerminal = ({
}, 5000);
}}
scenario={el}
station={stationItem}
/>
))}
</Box>