diff --git a/BACKEND/app/services/line_connection.ts b/BACKEND/app/services/line_connection.ts index 77f9b99..7378809 100644 --- a/BACKEND/app/services/line_connection.ts +++ b/BACKEND/app/services/line_connection.ts @@ -287,6 +287,7 @@ export default class LineConnection { this.config.status = 'disconnected' this.config.output += this.config.output + '[CLEAR_TERMINAL_SCROLL_BACK]' this.config.listFeatureTested = [] + this.config.latestScenario = undefined this.physicalTest = new PhysicalPortTest([]) // this.config.inventory = undefined this.socketIO.emit('line_disconnected', { diff --git a/FRONTEND/src/App.tsx b/FRONTEND/src/App.tsx index 62480b0..b84938e 100644 --- a/FRONTEND/src/App.tsx +++ b/FRONTEND/src/App.tsx @@ -256,6 +256,7 @@ function App() { netOutput: "[CLEAR_TERMINAL_SCROLL_BACK]", output: "[CLEAR_TERMINAL_SCROLL_BACK]", listFeatureTested: [], + latestScenario: undefined, }, data?.stationId ) diff --git a/FRONTEND/src/components/CardLine.tsx b/FRONTEND/src/components/CardLine.tsx index efe1b58..4d75a14 100644 --- a/FRONTEND/src/components/CardLine.tsx +++ b/FRONTEND/src/components/CardLine.tsx @@ -3,7 +3,7 @@ import type { IScenario, TLine, TStation } from "../untils/types"; import classes from "./Component.module.css"; import TerminalCLI from "./TerminalXTerm"; import type { Socket } from "socket.io-client"; -import { memo, useMemo, useState } from "react"; +import { memo, useEffect, useMemo, useState } from "react"; import { convertTimestampToDate } from "../untils/helper"; import { ButtonDPELP, ButtonScenario } from "./ButtonAction"; import { notifications } from "@mantine/notifications"; @@ -40,6 +40,7 @@ const CardLine = ({ const [isDisabled, setIsDisabled] = useState(false); const [valueBaud, setValueBaud] = useState(""); const [focusTerminal, setFocusTerminal] = useState(false); + const [isShowIssue, setIsShowIssue] = useState(false); // useEffect(() => { // if ( @@ -122,6 +123,18 @@ const CardLine = ({ } }; + useEffect(() => { + if (line?.latestScenario?.detectAI) { + const data = + line?.latestScenario?.detectAI?.issue && + Array.isArray(line?.latestScenario?.detectAI?.issue) + ? "- " + line?.latestScenario?.detectAI?.issue?.join("\n- ") + : ""; + if (data) setIsShowIssue(true); + else setIsShowIssue(false); + } else setIsShowIssue(false); + }, [line?.latestScenario]); + return ( )} - - {line?.listFeatureTested?.includes("DPELP") ? ( - - DPELP - - ) : ( - "" - )} - {line?.listFeatureTested?.includes("PHYSICAL") ? ( - - Physical - - ) : ( - "" - )} + + + {line?.listFeatureTested?.includes("DPELP") ? ( + + DPELP + + ) : ( + "" + )} + {line?.listFeatureTested?.includes("PHYSICAL") ? ( + + Physical + + ) : ( + "" + )} + + + {isShowIssue ? ( + + Issue + + ) : ( + "" + )} +