diff --git a/BACKEND/app/services/line_connection.ts b/BACKEND/app/services/line_connection.ts
index ef413e7..7347ab6 100644
--- a/BACKEND/app/services/line_connection.ts
+++ b/BACKEND/app/services/line_connection.ts
@@ -696,8 +696,6 @@ export default class LineConnection {
timestamp: now,
})
- console.log(newItem)
-
// Lấy phần tử cuối
const lastItems = await redis.zrevrange(key, 0, 0)
if (lastItems.length > 0) {
diff --git a/FRONTEND/src/components/BottomToolBar.tsx b/FRONTEND/src/components/BottomToolBar.tsx
index 3f19c9f..d39430a 100644
--- a/FRONTEND/src/components/BottomToolBar.tsx
+++ b/FRONTEND/src/components/BottomToolBar.tsx
@@ -22,7 +22,12 @@ import { DrawerAPCControl, DrawerSwitchControl } from "./DrawerControl";
import DrawerScenario from "./DrawerScenario";
import { isJsonString } from "../untils/helper";
import { motion } from "motion/react";
-import { IconCaretDown, IconCaretUp, IconPlayerPlay, IconPlus } from "@tabler/icons-react";
+import {
+ IconCaretDown,
+ IconCaretUp,
+ IconPlayerPlay,
+ IconPlus,
+} from "@tabler/icons-react";
interface TabsProps {
selectedLines: TLine[];
@@ -296,217 +301,143 @@ const BottomToolBar = ({
zIndex: 1,
}}
>
-
- {
- setExpanded((prev) => !prev);
- }}
- >
- {isExpand ? (
-
- ) : (
-
- )}
-
-
-
-
- {
- setActiveTabBottom(val || "command");
- }}
- className={classes.containerBottom}
- style={{ height: "20vh" }}
- >
-
-
- Command Line
-
-
- APC
-
-
- Switch
-
-
+
+ {
+ setExpanded((prev) => !prev);
+ }}
+ >
+ {isExpand ? (
+
+ ) : (
+
+ )}
+
+
+
+
+ {
+ setActiveTabBottom(val || "command");
+ }}
+ className={classes.containerBottom}
+ style={{ height: "20vh" }}
+ >
+
+
+ Command Line
+
+
+ APC
+
+
+ Switch
+
+
-
-
-
-
- {selectedLines.map((el) => (
-
-
- Line {el.lineNumber}
- {
- setSelectedLines(
- selectedLines.filter(
- (line) => line.id !== el.id
- )
- );
- socket?.emit("close_cli", {
- lineId: el?.id,
- stationId: el.stationId || el.station_id,
- });
- }}
- />
-
-
- ))}
-
-
-
-
-
-
-
+
+
- {
- const newValue = event.currentTarget.value;
- setValueInput(newValue);
- }}
- onKeyDown={(event) => {
- if (event.key === "Enter") {
- const listLine = selectedLines.length
- ? selectedLines
- : station?.lines;
- if (listLine?.length) {
- socket?.emit("write_command_line_from_web", {
- lineIds: listLine.map((line) => line.id),
- stationId: station.id,
- command: valueInput + "\r\n",
- });
- // setTimeout(() => {
- // socket?.emit("write_command_line_from_web", {
- // lineIds: listLine.map((line) => line.id),
- // stationId: station.id,
- // command: " \n",
- // });
- // }, 1000);
- }
- setValueInput("");
- }
- }}
- rightSectionPointerEvents="all"
- rightSection={
- setValueInput("")}
- style={{
- display: valueInput ? undefined : "none",
- }}
- />
- }
- />
-
-
-
-
- {
- const lines = station.lines.filter(
- (line) =>
- !line?.userOpenCLI ||
- line?.userOpenCLI === user?.userName
- );
- if (selectedLines.length !== lines.length) {
- setSelectedLines(lines);
- lines.forEach((line) => {
- socket?.emit("open_cli", {
- lineId: line.id,
- stationId: line.stationId || line.station_id,
- userEmail: user?.email,
- userName: user?.userName,
- });
- });
- } else {
+
+
+ {selectedLines.map((el) => (
+
+ {/* Close button góc trên phải */}
+ {
+ setSelectedLines(
+ selectedLines.filter(
+ (line) => line.id !== el.id
+ )
+ );
+ socket?.emit("close_cli", {
+ lineId: el?.id,
+ stationId: el.stationId || el.station_id,
+ });
+ }}
+ />
+
+
+ Line {el.lineNumber}
+
+
+ ))}
+
+
+ {selectedLines?.length > 0 ? (
+
+ ) : (
+ ""
+ )}
+
+
+
+
+
+
+
+
+ {
+ const newValue = event.currentTarget.value;
+ setValueInput(newValue);
+ }}
+ onKeyDown={(event) => {
+ if (event.key === "Enter") {
+ const listLine = selectedLines.length
+ ? selectedLines
+ : station?.lines;
+ if (listLine?.length) {
+ socket?.emit("write_command_line_from_web", {
+ lineIds: listLine.map((line) => line.id),
+ stationId: station.id,
+ command: valueInput + "\r\n",
+ });
+ // setTimeout(() => {
+ // socket?.emit("write_command_line_from_web", {
+ // lineIds: listLine.map((line) => line.id),
+ // stationId: station.id,
+ // command: " \n",
+ // });
+ // }, 1000);
+ }
+ setValueInput("");
+ }
+ }}
+ rightSectionPointerEvents="all"
+ rightSection={
+ setValueInput("")}
+ style={{
+ display: valueInput ? undefined : "none",
+ }}
+ />
}
- }}
- />
- {
- // setSelectedLines([]);
- setIsDisable(true);
- setTimeout(() => {
- setIsDisable(false);
- }, 5000);
- }}
- />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ />
+
+
+
+
+ {
+ const lines = station.lines.filter(
+ (line) =>
+ !line?.userOpenCLI ||
+ line?.userOpenCLI === user?.userName
+ );
+ if (selectedLines.length !== lines.length) {
+ setSelectedLines(lines);
+ lines.forEach((line) => {
+ socket?.emit("open_cli", {
+ lineId: line.id,
+ stationId: line.stationId || line.station_id,
+ userEmail: user?.email,
+ userName: user?.userName,
+ });
+ });
+ } else {
+ lines.forEach((line) => {
+ socket?.emit("close_cli", {
+ lineId: line?.id,
+ stationId: line.stationId || line.station_id,
+ });
+ });
+ setSelectedLines([]);
+ }
+ }}
+ />
+ {
+ // setSelectedLines([]);
+ setIsDisable(true);
+ setTimeout(() => {
+ setIsDisable(false);
+ }, 5000);
+ }}
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{/* Drawer Scenario để Add/Edit */}