Update modal confirm

This commit is contained in:
nguyentrungthat 2026-05-04 07:46:58 +07:00
parent 5d36b39c64
commit ef20557635
2 changed files with 54 additions and 29 deletions

View File

@ -1809,6 +1809,9 @@ ${log}
listFeatureTested: this.config.listFeatureTested, listFeatureTested: this.config.listFeatureTested,
isSkipPhysical: this.config.isSkipPhysical, isSkipPhysical: this.config.isSkipPhysical,
reasonSkipPhysical: this.config.reasonSkipPhysical, reasonSkipPhysical: this.config.reasonSkipPhysical,
pid: this.config.inventory?.pid,
sn: this.config.inventory?.sn,
vid: this.config.inventory?.vid,
}) })
} }

View File

@ -154,10 +154,10 @@ function App() {
response.data.map((station) => { response.data.map((station) => {
connectApcSwitch(station); connectApcSwitch(station);
const lines = (station?.lines || []).sort( const lines = (station?.lines || []).sort(
(a: TLine, b: TLine) => a?.lineNumber - b?.lineNumber (a: TLine, b: TLine) => a?.lineNumber - b?.lineNumber,
); );
return { ...station, lines }; return { ...station, lines };
}) }),
); );
} }
} }
@ -253,8 +253,8 @@ function App() {
updateValueLineStation( updateValueLineStation(
data?.lineId, data?.lineId,
{ status: data.status, connecting: false }, { status: data.status, connecting: false },
data?.stationId data?.stationId,
) ),
); );
socket.on("line_disconnected", (data) => socket.on("line_disconnected", (data) =>
@ -269,8 +269,8 @@ function App() {
latestScenario: undefined, latestScenario: undefined,
isReady: false, isReady: false,
}, },
data?.stationId data?.stationId,
) ),
); );
socket?.on("line_output", (data) => { socket?.on("line_output", (data) => {
@ -295,7 +295,7 @@ function App() {
updateValueLineStation( updateValueLineStation(
data?.lineId, data?.lineId,
{ isReady: isReady }, { isReady: isReady },
data?.stationId data?.stationId,
); );
}); });
@ -303,7 +303,7 @@ function App() {
updateValueLineStation( updateValueLineStation(
data?.lineId, data?.lineId,
{ netOutput: data.error, connecting: false }, { netOutput: data.error, connecting: false },
data?.stationId data?.stationId,
); );
}); });
@ -315,7 +315,7 @@ function App() {
updateValueLineStation( updateValueLineStation(
value?.id, value?.id,
{ ...value, netOutput: value.output }, { ...value, netOutput: value.output },
value?.stationId value?.stationId,
); );
}); });
} }
@ -336,7 +336,7 @@ function App() {
userEmailOpenCLI: data.userEmailOpenCLI, userEmailOpenCLI: data.userEmailOpenCLI,
userOpenCLI: data.userOpenCLI, userOpenCLI: data.userOpenCLI,
}, },
data?.stationId data?.stationId,
); );
}, 100); }, 100);
}); });
@ -350,7 +350,7 @@ function App() {
userEmailOpenCLI: undefined, userEmailOpenCLI: undefined,
userOpenCLI: undefined, userOpenCLI: undefined,
}, },
data?.stationId data?.stationId,
); );
}, 100); }, 100);
}); });
@ -406,7 +406,7 @@ function App() {
inventory: data.inventory, inventory: data.inventory,
latestScenario: data.latestScenario, latestScenario: data.latestScenario,
}, },
data?.stationId data?.stationId,
); );
}, 100); }, 100);
}); });
@ -418,7 +418,7 @@ function App() {
{ {
tickets: data.data, tickets: data.data,
}, },
data?.stationId data?.stationId,
); );
}, 100); }, 100);
}); });
@ -430,7 +430,7 @@ function App() {
{ {
baud: data.data, baud: data.data,
}, },
data?.stationId data?.stationId,
); );
}, 100); }, 100);
}); });
@ -440,7 +440,7 @@ function App() {
updateValueLineStation( updateValueLineStation(
data?.lineId, data?.lineId,
{ connecting: true }, { connecting: true },
data?.stationId data?.stationId,
); );
}, 100); }, 100);
}); });
@ -455,7 +455,7 @@ function App() {
ports: data?.ports || [], ports: data?.ports || [],
listPortsPhysical: [], listPortsPhysical: [],
}, },
data?.stationId data?.stationId,
); );
}, 100); }, 100);
}); });
@ -464,7 +464,7 @@ function App() {
updateValueLineStation( updateValueLineStation(
data?.lineId, data?.lineId,
{ netOutput: "", output: "", loadingClearTerminal: true }, { netOutput: "", output: "", loadingClearTerminal: true },
data?.stationId data?.stationId,
); );
}); });
@ -473,7 +473,7 @@ function App() {
updateValueLineStation( updateValueLineStation(
data?.lineId, data?.lineId,
{ listPortsPhysical: data?.data }, { listPortsPhysical: data?.data },
data?.stationId data?.stationId,
); );
}); });
@ -486,7 +486,7 @@ function App() {
isSkipPhysical: data?.isSkipPhysical, isSkipPhysical: data?.isSkipPhysical,
reasonSkipPhysical: data?.reasonSkipPhysical, reasonSkipPhysical: data?.reasonSkipPhysical,
}, },
data?.stationId data?.stationId,
); );
if (data?.isSkipPhysical && !data?.reasonSkipPhysical) { if (data?.isSkipPhysical && !data?.reasonSkipPhysical) {
const valueLine = findLineByLineId(data?.lineId, data?.stationId); const valueLine = findLineByLineId(data?.lineId, data?.stationId);
@ -495,7 +495,18 @@ function App() {
openModalTerminal && openModalTerminal &&
selectedLine?.id === valueLine?.id selectedLine?.id === valueLine?.id
) )
setLinesConfirmSkipPort((pre) => [...pre, valueLine]); setLinesConfirmSkipPort((pre) => [
...pre,
{
...valueLine,
inventory: {
...valueLine.inventory,
pid: data?.pid,
sn: data?.sn,
vid: data?.vid,
},
},
]);
} }
if ( if (
!data?.listFeatureTested?.includes("PHYSICAL") && !data?.listFeatureTested?.includes("PHYSICAL") &&
@ -507,7 +518,18 @@ function App() {
openModalTerminal && openModalTerminal &&
selectedLine?.id === valueLine?.id selectedLine?.id === valueLine?.id
) )
setLinesConfirmRunPhysical((pre) => [...pre, valueLine]); setLinesConfirmRunPhysical((pre) => [
...pre,
{
...valueLine,
inventory: {
...valueLine.inventory,
pid: data?.pid,
sn: data?.sn,
vid: data?.vid,
},
},
]);
} }
} }
}); });
@ -565,7 +587,7 @@ function App() {
updateValueSelectedLine(line?.id || 0, data); updateValueSelectedLine(line?.id || 0, data);
return data; return data;
}), }),
})) })),
); );
// clear // clear
lineBuffersRef.current.clear(); lineBuffersRef.current.clear();
@ -607,8 +629,8 @@ function App() {
}; };
}), }),
} }
: station : station,
) ),
); );
// Update selectedLine nếu nó đang được chọn // Update selectedLine nếu nó đang được chọn
@ -639,12 +661,12 @@ function App() {
updateValueSelectedLines(lineId, updates); updateValueSelectedLines(lineId, updates);
}, },
[] [],
); );
const updateValueSelectedLines = ( const updateValueSelectedLines = (
lineId: number, lineId: number,
updates: Partial<TLine> updates: Partial<TLine>,
) => { ) => {
// Update selectedLine nếu nó đang được chọn // Update selectedLine nếu nó đang được chọn
setSelectedLines((prevSelected) => setSelectedLines((prevSelected) =>
@ -653,7 +675,7 @@ function App() {
return { ...line, ...updates }; return { ...line, ...updates };
} }
return line; return line;
}) }),
); );
}; };
@ -801,7 +823,7 @@ function App() {
const rightChunks = chunkArray(rightLines, 2); const rightChunks = chunkArray(rightLines, 2);
const numRows = Math.max( const numRows = Math.max(
leftChunks.length, leftChunks.length,
rightChunks.length rightChunks.length,
); );
return ( return (
@ -895,7 +917,7 @@ function App() {
</Grid.Col> </Grid.Col>
</Grid> </Grid>
); );
} },
)} )}
</> </>
); );