Update
This commit is contained in:
parent
cba3178d09
commit
b715c0773a
|
|
@ -618,13 +618,13 @@ export default class LineConnection {
|
||||||
this.config.listFeatureTested = [
|
this.config.listFeatureTested = [
|
||||||
...new Set([...this.config.listFeatureTested, 'DPELP']),
|
...new Set([...this.config.listFeatureTested, 'DPELP']),
|
||||||
]
|
]
|
||||||
if (!this.config.listFeatureTested.includes('PHYSICAL')) this.runPhysicalTest()
|
// if (!this.config.listFeatureTested.includes('PHYSICAL')) this.runPhysicalTest()
|
||||||
this.sendFeatureTested()
|
this.sendFeatureTested()
|
||||||
|
|
||||||
// Set timeout send report
|
// Set timeout send report
|
||||||
this.setTimeoutSendSummaryReport(
|
// this.setTimeoutSendSummaryReport(
|
||||||
!this.config.listFeatureTested.includes('PHYSICAL') ? 600000 : 30000
|
// !this.config.listFeatureTested.includes('PHYSICAL') ? 600000 : 30000
|
||||||
)
|
// )
|
||||||
|
|
||||||
// }
|
// }
|
||||||
if (this.config.latestScenario)
|
if (this.config.latestScenario)
|
||||||
|
|
@ -1173,6 +1173,7 @@ Ports Missing/Down: ${missing.length}\n\n`
|
||||||
console.log('Running physical test')
|
console.log('Running physical test')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
this.setTimeoutSendSummaryReport(600000)
|
||||||
this.config.runningPhysical = true
|
this.config.runningPhysical = true
|
||||||
this.config.runningScenario = 'Physical Test'
|
this.config.runningScenario = 'Physical Test'
|
||||||
this.config.isSkipPhysical = false
|
this.config.isSkipPhysical = false
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ import DraggableTabs from "./components/DragTabs";
|
||||||
import { isJsonString } from "./untils/helper";
|
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 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;
|
||||||
|
|
@ -111,6 +112,9 @@ function App() {
|
||||||
const [listLicense, setListLicense] = useState<FileInfo[]>([]);
|
const [listLicense, setListLicense] = useState<FileInfo[]>([]);
|
||||||
const [isLoading, setIsLoading] = useState(true);
|
const [isLoading, setIsLoading] = useState(true);
|
||||||
const [linesConfirmSkipPort, setLinesConfirmSkipPort] = useState<TLine[]>([]);
|
const [linesConfirmSkipPort, setLinesConfirmSkipPort] = useState<TLine[]>([]);
|
||||||
|
const [linesConfirmRunPhysical, setLinesConfirmRunPhysical] = useState<
|
||||||
|
TLine[]
|
||||||
|
>([]);
|
||||||
|
|
||||||
const connectApcSwitch = (station: TStation) => {
|
const connectApcSwitch = (station: TStation) => {
|
||||||
if (!station?.is_active) return;
|
if (!station?.is_active) return;
|
||||||
|
|
@ -484,6 +488,14 @@ function App() {
|
||||||
const valueLine = findLineByLineId(data?.lineId, data?.stationId);
|
const valueLine = findLineByLineId(data?.lineId, data?.stationId);
|
||||||
if (valueLine) setLinesConfirmSkipPort((pre) => [...pre, valueLine]);
|
if (valueLine) setLinesConfirmSkipPort((pre) => [...pre, valueLine]);
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
!data?.listFeatureTested?.includes("PHYSICAL") &&
|
||||||
|
data?.listFeatureTested?.includes("DPELP")
|
||||||
|
) {
|
||||||
|
const valueLine = findLineByLineId(data?.lineId, data?.stationId);
|
||||||
|
if (valueLine)
|
||||||
|
setLinesConfirmRunPhysical((pre) => [...pre, valueLine]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -992,6 +1004,13 @@ function App() {
|
||||||
socket={socket}
|
socket={socket}
|
||||||
station={stations.find((el) => el.id === Number(activeTab))}
|
station={stations.find((el) => el.id === Number(activeTab))}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<ModalConfirmRunPhysical
|
||||||
|
listLines={linesConfirmRunPhysical}
|
||||||
|
setListLines={setLinesConfirmRunPhysical}
|
||||||
|
socket={socket}
|
||||||
|
station={stations.find((el) => el.id === Number(activeTab))}
|
||||||
|
/>
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,153 @@
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import {
|
||||||
|
Modal,
|
||||||
|
Box,
|
||||||
|
Text,
|
||||||
|
Flex,
|
||||||
|
Button,
|
||||||
|
ScrollArea,
|
||||||
|
Checkbox,
|
||||||
|
} from "@mantine/core";
|
||||||
|
import type { TLine, TStation } from "../../untils/types";
|
||||||
|
import type { Socket } from "socket.io-client";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
listLines: TLine[];
|
||||||
|
setListLines: (lines: React.SetStateAction<TLine[]>) => void;
|
||||||
|
socket: Socket | null;
|
||||||
|
station: TStation | undefined;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PropsLines {
|
||||||
|
id: number | undefined;
|
||||||
|
checked: boolean;
|
||||||
|
pid?: string;
|
||||||
|
sn?: string;
|
||||||
|
vid?: string;
|
||||||
|
lineNumber?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function ModalConfirmRunPhysical({
|
||||||
|
listLines,
|
||||||
|
setListLines,
|
||||||
|
socket,
|
||||||
|
station,
|
||||||
|
}: Props) {
|
||||||
|
const [dataLines, setDataLines] = useState<PropsLines[]>([]);
|
||||||
|
const [isDisabled, setIsDisabled] = useState<boolean>(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (listLines) {
|
||||||
|
setDataLines(() =>
|
||||||
|
listLines
|
||||||
|
.filter((line) => line.id)
|
||||||
|
.map((line) => ({
|
||||||
|
id: line.id,
|
||||||
|
lineNumber: line?.lineNumber,
|
||||||
|
pid: line?.inventory?.pid,
|
||||||
|
sn: line?.inventory?.sn,
|
||||||
|
vid: line?.inventory?.vid,
|
||||||
|
checked: true,
|
||||||
|
}))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, [listLines]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
size={"xl"}
|
||||||
|
style={{ position: "absolute", left: 0 }}
|
||||||
|
opened={dataLines.length > 0}
|
||||||
|
onClose={() => {}}
|
||||||
|
closeOnClickOutside={false}
|
||||||
|
closeOnEscape={false}
|
||||||
|
withCloseButton={false}
|
||||||
|
title="Confirm Run Test Ports"
|
||||||
|
>
|
||||||
|
<Box>
|
||||||
|
<ScrollArea h={"66vh"}>
|
||||||
|
{dataLines.map((line, i) => (
|
||||||
|
<Box
|
||||||
|
key={i}
|
||||||
|
style={{
|
||||||
|
border: "1px #ccc solid",
|
||||||
|
borderTop:
|
||||||
|
i < dataLines.length - 1 || dataLines.length === 1
|
||||||
|
? "1px solid #ccc"
|
||||||
|
: 0,
|
||||||
|
borderBottom:
|
||||||
|
i !== 0 || dataLines.length === 1 ? "1px solid #ccc" : 0,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Flex
|
||||||
|
p={"xs"}
|
||||||
|
style={{
|
||||||
|
fontWeight: 600,
|
||||||
|
}}
|
||||||
|
gap={"lg"}
|
||||||
|
>
|
||||||
|
<Checkbox
|
||||||
|
checked={line.checked}
|
||||||
|
onChange={(e) =>
|
||||||
|
setDataLines(
|
||||||
|
dataLines.map((el) =>
|
||||||
|
el.id === line.id
|
||||||
|
? {
|
||||||
|
...el,
|
||||||
|
checked: e.target.checked,
|
||||||
|
}
|
||||||
|
: el
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Text size="sm" fw={600}>
|
||||||
|
Line: {line.lineNumber}
|
||||||
|
</Text>
|
||||||
|
<Text size="sm" fw={600}>
|
||||||
|
PID: {line.pid || ""}
|
||||||
|
</Text>
|
||||||
|
<Text size="sm" fw={600}>
|
||||||
|
SN: {line.sn || ""}
|
||||||
|
</Text>
|
||||||
|
<Text size="sm" fw={600}>
|
||||||
|
VID: {line.vid || ""}
|
||||||
|
</Text>
|
||||||
|
</Flex>
|
||||||
|
</Box>
|
||||||
|
))}
|
||||||
|
<Flex justify={"end"} mt={"xs"}>
|
||||||
|
<Button
|
||||||
|
disabled={
|
||||||
|
isDisabled || dataLines.filter((el) => el.checked).length === 0
|
||||||
|
}
|
||||||
|
color={"green"}
|
||||||
|
onClick={() => {
|
||||||
|
const listChecked = dataLines.filter((el) => el.checked);
|
||||||
|
const listNotChecked = dataLines.filter((el) => !el.checked);
|
||||||
|
listChecked.forEach((line) => {
|
||||||
|
socket?.emit("run_physical_test", {
|
||||||
|
lineId: line?.id,
|
||||||
|
stationId: Number(station?.id),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
setDataLines(listNotChecked);
|
||||||
|
setListLines(
|
||||||
|
listLines.filter((el) =>
|
||||||
|
listNotChecked.find((li) => li.id === el.id)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
setIsDisabled(true);
|
||||||
|
setTimeout(() => {
|
||||||
|
setIsDisabled(false);
|
||||||
|
}, 1000);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
Run
|
||||||
|
</Button>
|
||||||
|
</Flex>
|
||||||
|
</ScrollArea>
|
||||||
|
</Box>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -132,7 +132,14 @@ export default function ModalConfirmSkipTestPort({
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!line.note)
|
if (!line.note)
|
||||||
setDataLines(
|
setDataLines(
|
||||||
dataLines.map((el) => ({ ...el, isError: true }))
|
dataLines.map((el) =>
|
||||||
|
el.id === line.id
|
||||||
|
? {
|
||||||
|
...el,
|
||||||
|
isError: true,
|
||||||
|
}
|
||||||
|
: el
|
||||||
|
)
|
||||||
);
|
);
|
||||||
else {
|
else {
|
||||||
socket?.emit("end_run_physical_test", {
|
socket?.emit("end_run_physical_test", {
|
||||||
|
|
@ -149,7 +156,7 @@ export default function ModalConfirmSkipTestPort({
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Save
|
Skip
|
||||||
</Button>
|
</Button>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue