Update
This commit is contained in:
parent
5135f7ba9a
commit
46f72decd3
|
|
@ -242,6 +242,7 @@ const ModalLineHistory = ({
|
||||||
}}
|
}}
|
||||||
testLogContent={selectedHistory?.output || ""}
|
testLogContent={selectedHistory?.output || ""}
|
||||||
isShowShortLog={true}
|
isShowShortLog={true}
|
||||||
|
portPhysical={selectedHistory?.portPhysical}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -12,18 +12,37 @@ const ModalLog = ({
|
||||||
onClose,
|
onClose,
|
||||||
testLogContent,
|
testLogContent,
|
||||||
isShowShortLog = false,
|
isShowShortLog = false,
|
||||||
|
portPhysical,
|
||||||
}: {
|
}: {
|
||||||
opened: boolean;
|
opened: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
testLogContent: string;
|
testLogContent: string;
|
||||||
isShowShortLog?: boolean;
|
isShowShortLog?: boolean;
|
||||||
|
portPhysical?: {
|
||||||
|
name: string;
|
||||||
|
tested: boolean;
|
||||||
|
}[];
|
||||||
}) => {
|
}) => {
|
||||||
const [valueLog, setValueLog] = useState(testLogContent);
|
const [valueLog, setValueLog] = useState(testLogContent);
|
||||||
const [isShort, setIsShort] = useState(false);
|
const [isShort, setIsShort] = useState(false);
|
||||||
|
const [valueTestedPorts, setValueTestedPorts] = useState<string>("");
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setValueLog(testLogContent);
|
setValueLog(testLogContent);
|
||||||
}, [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 addTooltipsToHighlights = () => {
|
||||||
const highlights = document.querySelectorAll(".highlight");
|
const highlights = document.querySelectorAll(".highlight");
|
||||||
highlights.forEach((highlight) => {
|
highlights.forEach((highlight) => {
|
||||||
|
|
@ -99,7 +118,7 @@ const ModalLog = ({
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setValueLog(createShortLog(testLogContent));
|
setValueLog(createShortLog(testLogContent) + "\n\n" + valueTestedPorts);
|
||||||
setIsShort(true);
|
setIsShort(true);
|
||||||
}}
|
}}
|
||||||
color="green"
|
color="green"
|
||||||
|
|
@ -110,7 +129,7 @@ const ModalLog = ({
|
||||||
<Button
|
<Button
|
||||||
variant="outline"
|
variant="outline"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setValueLog(testLogContent);
|
setValueLog(testLogContent + "\n\n" + valueTestedPorts);
|
||||||
setIsShort(false);
|
setIsShort(false);
|
||||||
}}
|
}}
|
||||||
color="green"
|
color="green"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue