This commit is contained in:
nguyentrungthat 2025-11-07 14:02:15 +07:00
parent c09f27da86
commit caf3a5a696
2 changed files with 11 additions and 3 deletions

View File

@ -287,6 +287,7 @@ function App() {
socket.off("user_close_cli"); socket.off("user_close_cli");
socket.off("confirm_take_over"); socket.off("confirm_take_over");
socket.off("response_content_log"); socket.off("response_content_log");
socket.off("data_textfsm");
}; };
}, [socket, stations, selectedLine]); }, [socket, stations, selectedLine]);
@ -366,7 +367,6 @@ function App() {
useEffect(() => { useEffect(() => {
return () => { return () => {
console.log("CLEANUP SOCKET CLI", selectedLine);
if (selectedLine) if (selectedLine)
socket?.emit("close_cli", { socket?.emit("close_cli", {
lineId: selectedLine?.id, lineId: selectedLine?.id,
@ -511,10 +511,17 @@ function App() {
socket={socket} socket={socket}
selectedLines={selectedLines.filter( selectedLines={selectedLines.filter(
(el) => (el) =>
typeof el?.userEmailOpenCLI === "undefined" || !el?.userEmailOpenCLI ||
el?.userEmailOpenCLI === user?.email el?.userEmailOpenCLI === user?.email
)} )}
isDisable={isDisable || selectedLines.length === 0} isDisable={
isDisable ||
selectedLines.filter(
(el) =>
!el?.userEmailOpenCLI ||
el?.userEmailOpenCLI === user?.email
).length === 0
}
onClick={() => { onClick={() => {
setSelectedLines([]); setSelectedLines([]);
setIsDisable(true); setIsDisable(true);

View File

@ -113,6 +113,7 @@ const CardLine = ({
isDisabled={ isDisabled={
typeof line?.userOpenCLI !== "undefined" && typeof line?.userOpenCLI !== "undefined" &&
typeof line?.userOpenCLI === "string" && typeof line?.userOpenCLI === "string" &&
line?.userOpenCLI.length > 0 &&
line?.userOpenCLI !== user?.userName line?.userOpenCLI !== user?.userName
} }
line_status={line?.status || ""} line_status={line?.status || ""}