Update rule run dpelp và physical
This commit is contained in:
parent
7af8aabf6b
commit
3088848b1a
|
|
@ -607,10 +607,13 @@ export default class LineConnection {
|
|||
this.config.listFeatureTested = [
|
||||
...new Set([...this.config.listFeatureTested, 'DPELP']),
|
||||
]
|
||||
if (!this.config.listFeatureTested.includes('PHYSICAL')) this.runPhysicalTest()
|
||||
this.sendFeatureTested()
|
||||
|
||||
// Set timeout send report
|
||||
this.setTimeoutSendSummaryReport(600000)
|
||||
this.setTimeoutSendSummaryReport(
|
||||
!this.config.listFeatureTested.includes('PHYSICAL') ? 600000 : 60000
|
||||
)
|
||||
|
||||
// }
|
||||
if (this.config.latestScenario)
|
||||
|
|
@ -1272,7 +1275,7 @@ export default class LineConnection {
|
|||
this.config.listFeatureTested = [...new Set([...this.config.listFeatureTested, 'PHYSICAL'])]
|
||||
this.sendFeatureTested()
|
||||
// Set timeout send report
|
||||
this.setTimeoutSendSummaryReport(180000)
|
||||
this.setTimeoutSendSummaryReport(60000)
|
||||
const formReport = this.physicalTest.getFormReport()
|
||||
await sendMessageToMail(
|
||||
`[ATC] - [${this.config.stationName} - Line: ${this.config.lineNumber}] - Physical Ports Test`,
|
||||
|
|
|
|||
|
|
@ -609,6 +609,7 @@ export class WebSocketIo {
|
|||
const stationName = data.stationName || ''
|
||||
const stationId = data.stationId || ''
|
||||
const scenarioName = data.scenarioName || ''
|
||||
const skipTestPorts = data.skipTestPorts || false
|
||||
const station = await Station.find(stationId)
|
||||
// Check station is active
|
||||
const activeStation = await checkStationActive(stationId)
|
||||
|
|
@ -619,6 +620,11 @@ export class WebSocketIo {
|
|||
const line = this.lineMap.get(lineId)
|
||||
if (line && line.config.isReady) {
|
||||
lineIds.push(lineId)
|
||||
if (skipTestPorts) {
|
||||
line.config.listFeatureTested = [
|
||||
...new Set([...line.config.listFeatureTested, 'PHYSICAL']),
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
// Check station sendWiki flag
|
||||
|
|
|
|||
|
|
@ -586,10 +586,27 @@ function App() {
|
|||
}),
|
||||
};
|
||||
});
|
||||
|
||||
updateValueSelectedLines(lineId, updates);
|
||||
},
|
||||
[]
|
||||
);
|
||||
|
||||
const updateValueSelectedLines = (
|
||||
lineId: number,
|
||||
updates: Partial<TLine>
|
||||
) => {
|
||||
// Update selectedLine nếu nó đang được chọn
|
||||
setSelectedLines((prevSelected) =>
|
||||
prevSelected?.map((line) => {
|
||||
if (line.id === lineId) {
|
||||
return { ...line, ...updates };
|
||||
}
|
||||
return line;
|
||||
})
|
||||
);
|
||||
};
|
||||
|
||||
const updateValueSelectedLine = (lineId: number, updates: Partial<TLine>) => {
|
||||
// Update selectedLine nếu nó đang được chọn
|
||||
setSelectedLine((prevSelected) => {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {
|
|||
CloseButton,
|
||||
Flex,
|
||||
Grid,
|
||||
Menu,
|
||||
ScrollArea,
|
||||
Tabs,
|
||||
Text,
|
||||
|
|
@ -25,7 +26,11 @@ import { DrawerAPCControl, DrawerSwitchControl } from "./Drawer/DrawerControl";
|
|||
import DrawerScenario from "./Modal/ModalScenario";
|
||||
import { isJsonString } from "../untils/helper";
|
||||
import { motion } from "motion/react";
|
||||
import { IconCaretDown, IconCaretUp } from "@tabler/icons-react";
|
||||
import {
|
||||
IconCaretDown,
|
||||
IconCaretRight,
|
||||
IconCaretUp,
|
||||
} from "@tabler/icons-react";
|
||||
import InputHistory from "./InputHistory";
|
||||
import ModalRunScenario from "./Modal/ModalRunScenario";
|
||||
|
||||
|
|
@ -360,31 +365,94 @@ const BottomToolBar = ({
|
|||
gap={"xs"}
|
||||
wrap={"wrap"}
|
||||
>
|
||||
<ButtonDPELP
|
||||
socket={socket}
|
||||
selectedLines={selectedLines}
|
||||
isDisable={isDisable || selectedLines.length === 0}
|
||||
dataDPELP={scenarios?.find(
|
||||
(el) => el.title.toUpperCase() === "DPELP"
|
||||
)}
|
||||
onClick={() => {
|
||||
if (
|
||||
selectedLines.length > 0
|
||||
// &&
|
||||
// selectedLines.length === station?.lines?.length
|
||||
) {
|
||||
socket?.emit("run_all_dpelp", {
|
||||
lineIds: selectedLines.map((line) => line.id),
|
||||
stationName: station.name,
|
||||
stationId: station.id,
|
||||
});
|
||||
}
|
||||
setIsDisable(true);
|
||||
setTimeout(() => {
|
||||
setIsDisable(false);
|
||||
}, 5000);
|
||||
}}
|
||||
/>
|
||||
<Menu
|
||||
trigger="hover"
|
||||
withArrow
|
||||
shadow="md"
|
||||
position="top"
|
||||
>
|
||||
<Menu.Target>
|
||||
<Button
|
||||
fw={400}
|
||||
mr={"5px"}
|
||||
disabled={
|
||||
isDisable || selectedLines.length === 0
|
||||
}
|
||||
variant="outline"
|
||||
color="green"
|
||||
style={{ height: "30px", width: "100px" }}
|
||||
onClick={() => {}}
|
||||
>
|
||||
DPELP <IconCaretRight size={"14px"} />
|
||||
</Button>
|
||||
</Menu.Target>
|
||||
<Menu.Dropdown>
|
||||
<Flex direction={"column"} gap={"8px"}>
|
||||
<ButtonDPELP
|
||||
socket={socket}
|
||||
selectedLines={selectedLines}
|
||||
isDisable={
|
||||
isDisable || selectedLines.length === 0
|
||||
}
|
||||
dataDPELP={scenarios?.find(
|
||||
(el) => el.title.toUpperCase() === "DPELP"
|
||||
)}
|
||||
onClick={() => {
|
||||
if (
|
||||
selectedLines.length > 0
|
||||
// &&
|
||||
// selectedLines.length === station?.lines?.length
|
||||
) {
|
||||
socket?.emit("run_all_dpelp", {
|
||||
lineIds: selectedLines.map(
|
||||
(line) => line.id
|
||||
),
|
||||
stationName: station.name,
|
||||
stationId: station.id,
|
||||
});
|
||||
}
|
||||
setIsDisable(true);
|
||||
setTimeout(() => {
|
||||
setIsDisable(false);
|
||||
}, 5000);
|
||||
}}
|
||||
text="Run Test Ports after DPELP"
|
||||
/>
|
||||
<ButtonDPELP
|
||||
socket={socket}
|
||||
selectedLines={selectedLines}
|
||||
isDisable={
|
||||
isDisable || selectedLines.length === 0
|
||||
}
|
||||
dataDPELP={scenarios?.find(
|
||||
(el) => el.title.toUpperCase() === "DPELP"
|
||||
)}
|
||||
onClick={() => {
|
||||
if (
|
||||
selectedLines.length > 0
|
||||
// &&
|
||||
// selectedLines.length === station?.lines?.length
|
||||
) {
|
||||
socket?.emit("run_all_dpelp", {
|
||||
lineIds: selectedLines.map(
|
||||
(line) => line.id
|
||||
),
|
||||
stationName: station.name,
|
||||
stationId: station.id,
|
||||
skipTestPorts: true,
|
||||
});
|
||||
}
|
||||
setIsDisable(true);
|
||||
setTimeout(() => {
|
||||
setIsDisable(false);
|
||||
}, 5000);
|
||||
}}
|
||||
text="Skip Test Ports"
|
||||
color="yellow"
|
||||
/>
|
||||
</Flex>
|
||||
</Menu.Dropdown>
|
||||
</Menu>
|
||||
<Button
|
||||
fw={400}
|
||||
disabled={isDisable || selectedLines.length === 0}
|
||||
|
|
@ -402,19 +470,42 @@ const BottomToolBar = ({
|
|||
mr={"5px"}
|
||||
style={{ height: "30px", width: "100px" }}
|
||||
onClick={() => {
|
||||
selectedLines.forEach((line) => {
|
||||
socket?.emit("run_physical_test", {
|
||||
lineId: line?.id,
|
||||
stationId: Number(station.id),
|
||||
if (
|
||||
selectedLines?.filter(
|
||||
(line) => line?.runningPhysical
|
||||
)?.length > 0
|
||||
) {
|
||||
selectedLines
|
||||
?.filter((line) => line?.runningPhysical)
|
||||
.forEach((line) => {
|
||||
socket?.emit("end_run_physical_test", {
|
||||
lineId: line?.id,
|
||||
stationId: Number(station.id),
|
||||
});
|
||||
});
|
||||
setIsDisable(true);
|
||||
setTimeout(() => {
|
||||
setIsDisable(false);
|
||||
}, 5000);
|
||||
} else {
|
||||
selectedLines.forEach((line) => {
|
||||
socket?.emit("run_physical_test", {
|
||||
lineId: line?.id,
|
||||
stationId: Number(station.id),
|
||||
});
|
||||
});
|
||||
});
|
||||
setIsDisable(true);
|
||||
setTimeout(() => {
|
||||
setIsDisable(false);
|
||||
}, 10000);
|
||||
setIsDisable(true);
|
||||
setTimeout(() => {
|
||||
setIsDisable(false);
|
||||
}, 10000);
|
||||
}
|
||||
}}
|
||||
>
|
||||
Physical
|
||||
{selectedLines?.filter(
|
||||
(line) => line?.runningPhysical
|
||||
)?.length > 0
|
||||
? "Done/End"
|
||||
: "Physical"}
|
||||
</Button>
|
||||
<DrawerLogs
|
||||
socket={socket}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ export const ButtonDPELP = ({
|
|||
selectedLines,
|
||||
className = "",
|
||||
dataDPELP,
|
||||
text = "DPELP",
|
||||
color = "#00a164",
|
||||
}: {
|
||||
socket: Socket | null;
|
||||
isDisable: boolean;
|
||||
|
|
@ -23,6 +25,8 @@ export const ButtonDPELP = ({
|
|||
selectedLines: TLine[];
|
||||
className?: string;
|
||||
dataDPELP?: IScenario;
|
||||
text?: string;
|
||||
color?: string;
|
||||
}) => {
|
||||
return (
|
||||
<Button
|
||||
|
|
@ -34,7 +38,7 @@ export const ButtonDPELP = ({
|
|||
mr={"5px"}
|
||||
variant="filled"
|
||||
fw={400}
|
||||
color="#00a164"
|
||||
color={color || "#00a164"}
|
||||
onClick={async () => {
|
||||
onClick();
|
||||
selectedLines?.forEach((el) => {
|
||||
|
|
@ -162,7 +166,7 @@ export const ButtonDPELP = ({
|
|||
});
|
||||
}}
|
||||
>
|
||||
DPELP
|
||||
{text}
|
||||
</Button>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue