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