Update confirm before run Physical
This commit is contained in:
parent
b715c0773a
commit
2ecb153118
|
|
@ -1908,6 +1908,12 @@ ${log}
|
||||||
`[ATC] - [${config.stationName} - Line: ${config.lineNumber}] - Summary of Testing Results`,
|
`[ATC] - [${config.stationName} - Line: ${config.lineNumber}] - Summary of Testing Results`,
|
||||||
body
|
body
|
||||||
)
|
)
|
||||||
|
this.socketIO.emit('summary_tested', {
|
||||||
|
stationId: this.config.stationId,
|
||||||
|
lineId: this.config.id,
|
||||||
|
body: body,
|
||||||
|
title: `[${config.stationName} - Line: ${config.lineNumber}] - Summary of Testing Results`,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ export class PhysicalPortTest {
|
||||||
const missingPoE = missing.filter((p) => !p.name.includes('SFP'))
|
const missingPoE = missing.filter((p) => !p.name.includes('SFP'))
|
||||||
const missingSFP = missing.filter((p) => p.name.includes('SFP'))
|
const missingSFP = missing.filter((p) => p.name.includes('SFP'))
|
||||||
|
|
||||||
const status = missing.length === 0 ? 'PASS' : 'WARNING'
|
const status = missing.length === 0 && tested.length > 0 ? 'PASS' : 'WARNING'
|
||||||
|
|
||||||
return `
|
return `
|
||||||
<b>Physical Ports Test Report</b><br/>
|
<b>Physical Ports Test Report</b><br/>
|
||||||
|
|
@ -181,29 +181,32 @@ export class PhysicalPortTest {
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<br/>
|
<br/>
|
||||||
${missing.length
|
${
|
||||||
? `
|
missing.length
|
||||||
|
? `
|
||||||
────────────────────────────────<br/>
|
────────────────────────────────<br/>
|
||||||
<b style="color: #ff0000;">Missing Ports</b><br/>
|
<b style="color: #ff0000;">Missing Ports</b><br/>
|
||||||
<table cellpadding="6" cellspacing="0" border="1" style="margin-top: 10px; border-collapse: collapse; width: 100%">
|
<table cellpadding="6" cellspacing="0" border="1" style="margin-top: 10px; border-collapse: collapse; width: 100%">
|
||||||
<tr>
|
<tr>
|
||||||
${missingPoE?.length
|
${
|
||||||
? `<td>
|
missingPoE?.length
|
||||||
|
? `<td>
|
||||||
<div style="column-count: 12;">${missingPoE.map((p) => this.normalizePortName(p.name)).join('<br/>')}</div>
|
<div style="column-count: 12;">${missingPoE.map((p) => this.normalizePortName(p.name)).join('<br/>')}</div>
|
||||||
</td>`
|
</td>`
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
${missingSFP?.length
|
${
|
||||||
? `<td>
|
missingSFP?.length
|
||||||
|
? `<td>
|
||||||
<div style="column-count: 4;">${missingSFP.map((p) => this.normalizePortName(p.name)).join('<br/>')}</div>
|
<div style="column-count: 4;">${missingSFP.map((p) => this.normalizePortName(p.name)).join('<br/>')}</div>
|
||||||
</td>`
|
</td>`
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
`
|
`
|
||||||
: ''
|
: ''
|
||||||
}
|
}
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
`.trim()
|
`.trim()
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ import {
|
||||||
Box,
|
Box,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import type {
|
import type {
|
||||||
|
DataSummaryTested,
|
||||||
FileInfo,
|
FileInfo,
|
||||||
IScenario,
|
IScenario,
|
||||||
ReceivedFile,
|
ReceivedFile,
|
||||||
|
|
@ -57,6 +58,7 @@ import { isJsonString } from "./untils/helper";
|
||||||
import BottomToolBar from "./components/BottomToolBar";
|
import BottomToolBar from "./components/BottomToolBar";
|
||||||
import ModalConfirmSkipTestPort from "./components/Modal/ModalConfirmSkipTestPort";
|
import ModalConfirmSkipTestPort from "./components/Modal/ModalConfirmSkipTestPort";
|
||||||
import ModalConfirmRunPhysical from "./components/Modal/ModalConfirmRunPhysicalTest";
|
import ModalConfirmRunPhysical from "./components/Modal/ModalConfirmRunPhysicalTest";
|
||||||
|
import ModalSummaryTested from "./components/Modal/ModalSummaryTested";
|
||||||
// import ModalConfirmRunScenario from "./components/Modal/ModalConfirmRunScenario";
|
// import ModalConfirmRunScenario from "./components/Modal/ModalConfirmRunScenario";
|
||||||
|
|
||||||
const apiUrl = import.meta.env.VITE_BACKEND_URL;
|
const apiUrl = import.meta.env.VITE_BACKEND_URL;
|
||||||
|
|
@ -115,6 +117,8 @@ function App() {
|
||||||
const [linesConfirmRunPhysical, setLinesConfirmRunPhysical] = useState<
|
const [linesConfirmRunPhysical, setLinesConfirmRunPhysical] = useState<
|
||||||
TLine[]
|
TLine[]
|
||||||
>([]);
|
>([]);
|
||||||
|
const [dataSummaryTested, setDataSummaryTested] =
|
||||||
|
useState<DataSummaryTested | null>(null);
|
||||||
|
|
||||||
const connectApcSwitch = (station: TStation) => {
|
const connectApcSwitch = (station: TStation) => {
|
||||||
if (!station?.is_active) return;
|
if (!station?.is_active) return;
|
||||||
|
|
@ -499,6 +503,15 @@ function App() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
socket?.on("summary_tested", (data) => {
|
||||||
|
if (data?.body) {
|
||||||
|
setDataSummaryTested({
|
||||||
|
body: data?.body || "",
|
||||||
|
title: data?.title || "",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// ✅ cleanup on unmount or when socket changes
|
// ✅ cleanup on unmount or when socket changes
|
||||||
return () => {
|
return () => {
|
||||||
socket.off("init");
|
socket.off("init");
|
||||||
|
|
@ -518,6 +531,7 @@ function App() {
|
||||||
socket.off("user_clear_terminal");
|
socket.off("user_clear_terminal");
|
||||||
socket.off("test_port_physical");
|
socket.off("test_port_physical");
|
||||||
socket.off("feature_tested");
|
socket.off("feature_tested");
|
||||||
|
socket.off("summary_tested");
|
||||||
};
|
};
|
||||||
}, [socket, stations, selectedLine]);
|
}, [socket, stations, selectedLine]);
|
||||||
|
|
||||||
|
|
@ -990,6 +1004,7 @@ function App() {
|
||||||
listCategories={listCategories}
|
listCategories={listCategories}
|
||||||
setLinesConfirmSkipPort={setLinesConfirmSkipPort}
|
setLinesConfirmSkipPort={setLinesConfirmSkipPort}
|
||||||
linesConfirmSkipPort={linesConfirmSkipPort}
|
linesConfirmSkipPort={linesConfirmSkipPort}
|
||||||
|
dataSummaryTested={dataSummaryTested}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* <ModalConfirmRunScenario
|
{/* <ModalConfirmRunScenario
|
||||||
|
|
@ -1011,6 +1026,11 @@ function App() {
|
||||||
socket={socket}
|
socket={socket}
|
||||||
station={stations.find((el) => el.id === Number(activeTab))}
|
station={stations.find((el) => el.id === Number(activeTab))}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<ModalSummaryTested
|
||||||
|
data={dataSummaryTested}
|
||||||
|
setData={setDataSummaryTested}
|
||||||
|
/>
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ export default function ModalConfirmRunPhysical({
|
||||||
title="Confirm Run Test Ports"
|
title="Confirm Run Test Ports"
|
||||||
>
|
>
|
||||||
<Box>
|
<Box>
|
||||||
<ScrollArea h={"66vh"}>
|
<ScrollArea h={"50vh"}>
|
||||||
{dataLines.map((line, i) => (
|
{dataLines.map((line, i) => (
|
||||||
<Box
|
<Box
|
||||||
key={i}
|
key={i}
|
||||||
|
|
@ -81,6 +81,7 @@ export default function ModalConfirmRunPhysical({
|
||||||
>
|
>
|
||||||
<Flex
|
<Flex
|
||||||
p={"xs"}
|
p={"xs"}
|
||||||
|
align={"center"}
|
||||||
style={{
|
style={{
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
}}
|
}}
|
||||||
|
|
@ -101,16 +102,16 @@ export default function ModalConfirmRunPhysical({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Text size="sm" fw={600}>
|
<Text size="lg" fw={600}>
|
||||||
Line: {line.lineNumber}
|
Line: {line.lineNumber}
|
||||||
</Text>
|
</Text>
|
||||||
<Text size="sm" fw={600}>
|
<Text size="lg" fw={600}>
|
||||||
PID: {line.pid || ""}
|
PID: {line.pid || ""}
|
||||||
</Text>
|
</Text>
|
||||||
<Text size="sm" fw={600}>
|
<Text size="lg" fw={600}>
|
||||||
SN: {line.sn || ""}
|
SN: {line.sn || ""}
|
||||||
</Text>
|
</Text>
|
||||||
<Text size="sm" fw={600}>
|
<Text size="lg" fw={600}>
|
||||||
VID: {line.vid || ""}
|
VID: {line.vid || ""}
|
||||||
</Text>
|
</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
import { Modal, Box, Text } from "@mantine/core";
|
||||||
|
import type { DataSummaryTested } from "../../untils/types";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
data: DataSummaryTested | null;
|
||||||
|
setData: (value: React.SetStateAction<DataSummaryTested | null>) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function ModalSummaryTested({ data, setData }: Props) {
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
size={"70%"}
|
||||||
|
style={{ position: "absolute", left: 0 }}
|
||||||
|
opened={data && data?.body ? true : false}
|
||||||
|
onClose={() => {
|
||||||
|
setData(null);
|
||||||
|
}}
|
||||||
|
title="Summary"
|
||||||
|
>
|
||||||
|
<Box>
|
||||||
|
<Box p={"md"} pt={0}>
|
||||||
|
<Text fw={"bold"} fz={18}>
|
||||||
|
{data?.title}
|
||||||
|
</Text>
|
||||||
|
</Box>
|
||||||
|
<Box pt={0} p={"md"}>
|
||||||
|
<span dangerouslySetInnerHTML={{ __html: data?.body || "" }} />
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -17,6 +17,7 @@ import {
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from "@mantine/core";
|
} from "@mantine/core";
|
||||||
import type {
|
import type {
|
||||||
|
DataSummaryTested,
|
||||||
FileInfo,
|
FileInfo,
|
||||||
IScenario,
|
IScenario,
|
||||||
SwitchPortsProps,
|
SwitchPortsProps,
|
||||||
|
|
@ -83,6 +84,7 @@ const ModalTerminal = ({
|
||||||
setScenarios,
|
setScenarios,
|
||||||
setLinesConfirmSkipPort,
|
setLinesConfirmSkipPort,
|
||||||
linesConfirmSkipPort,
|
linesConfirmSkipPort,
|
||||||
|
dataSummaryTested,
|
||||||
}: {
|
}: {
|
||||||
opened: boolean;
|
opened: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
|
|
@ -100,6 +102,7 @@ const ModalTerminal = ({
|
||||||
setScenarios: (value: React.SetStateAction<IScenario[]>) => void;
|
setScenarios: (value: React.SetStateAction<IScenario[]>) => void;
|
||||||
setLinesConfirmSkipPort: (value: React.SetStateAction<TLine[]>) => void;
|
setLinesConfirmSkipPort: (value: React.SetStateAction<TLine[]>) => void;
|
||||||
linesConfirmSkipPort: TLine[];
|
linesConfirmSkipPort: TLine[];
|
||||||
|
dataSummaryTested: DataSummaryTested | null;
|
||||||
}) => {
|
}) => {
|
||||||
const user = useMemo(() => {
|
const user = useMemo(() => {
|
||||||
return localStorage.getItem("user") &&
|
return localStorage.getItem("user") &&
|
||||||
|
|
@ -547,8 +550,13 @@ const ModalTerminal = ({
|
||||||
setOpenScenarioModal(false);
|
setOpenScenarioModal(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (openSelectIos) return;
|
if (
|
||||||
if (linesConfirmSkipPort.length) return;
|
openSelectIos ||
|
||||||
|
linesConfirmSkipPort.length > 0 ||
|
||||||
|
(dataSummaryTested && dataSummaryTested?.body)
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
|
||||||
onClose();
|
onClose();
|
||||||
if (
|
if (
|
||||||
line?.userOpenCLI === user?.userName &&
|
line?.userOpenCLI === user?.userName &&
|
||||||
|
|
|
||||||
|
|
@ -300,3 +300,8 @@ export type Keywords = {
|
||||||
match_type: string;
|
match_type: string;
|
||||||
is_active: boolean;
|
is_active: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type DataSummaryTested = {
|
||||||
|
body: string;
|
||||||
|
title: string;
|
||||||
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue