Update
This commit is contained in:
parent
5135f7ba9a
commit
46f72decd3
|
|
@ -242,6 +242,7 @@ const ModalLineHistory = ({
|
|||
}}
|
||||
testLogContent={selectedHistory?.output || ""}
|
||||
isShowShortLog={true}
|
||||
portPhysical={selectedHistory?.portPhysical}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -12,18 +12,37 @@ const ModalLog = ({
|
|||
onClose,
|
||||
testLogContent,
|
||||
isShowShortLog = false,
|
||||
portPhysical,
|
||||
}: {
|
||||
opened: boolean;
|
||||
onClose: () => void;
|
||||
testLogContent: string;
|
||||
isShowShortLog?: boolean;
|
||||
portPhysical?: {
|
||||
name: string;
|
||||
tested: boolean;
|
||||
}[];
|
||||
}) => {
|
||||
const [valueLog, setValueLog] = useState(testLogContent);
|
||||
const [isShort, setIsShort] = useState(false);
|
||||
const [valueTestedPorts, setValueTestedPorts] = useState<string>("");
|
||||
|
||||
useEffect(() => {
|
||||
setValueLog(testLogContent);
|
||||
}, [testLogContent]);
|
||||
|
||||
useEffect(() => {
|
||||
if(portPhysical && Array.isArray(portPhysical)) {
|
||||
const portPoE = portPhysical.filter(port => !port.name.includes("SFP"))
|
||||
const poeTested = portPhysical.filter(port => port.tested && !port.name.includes("SFP"))
|
||||
const portSFP = portPhysical.filter(port => port.name.includes("SFP"))
|
||||
const sfpTested = portPhysical.filter(port => port.tested && port.name.includes("SFP"))
|
||||
const value = `POE Tested: ${poeTested.length}/${portPoE.length}\nSFP Tested: ${sfpTested.length}/${portSFP.length}`;
|
||||
setValueTestedPorts(value);
|
||||
setValueLog(testLogContent + "\n\n" + value);
|
||||
}
|
||||
}, [portPhysical]);
|
||||
|
||||
const addTooltipsToHighlights = () => {
|
||||
const highlights = document.querySelectorAll(".highlight");
|
||||
highlights.forEach((highlight) => {
|
||||
|
|
@ -99,7 +118,7 @@ const ModalLog = ({
|
|||
<Button
|
||||
variant="outline"
|
||||
onClick={() => {
|
||||
setValueLog(createShortLog(testLogContent));
|
||||
setValueLog(createShortLog(testLogContent) + "\n\n" + valueTestedPorts);
|
||||
setIsShort(true);
|
||||
}}
|
||||
color="green"
|
||||
|
|
@ -110,7 +129,7 @@ const ModalLog = ({
|
|||
<Button
|
||||
variant="outline"
|
||||
onClick={() => {
|
||||
setValueLog(testLogContent);
|
||||
setValueLog(testLogContent + "\n\n" + valueTestedPorts);
|
||||
setIsShort(false);
|
||||
}}
|
||||
color="green"
|
||||
|
|
|
|||
Loading…
Reference in New Issue