fix: large logs page stuck

This commit is contained in:
jialin
2024-11-05 19:46:47 +08:00
parent 5f2115fff6
commit f684a3b0ae
8 changed files with 114 additions and 40 deletions
@@ -17,6 +17,7 @@ const ViewCodeModal: React.FC<ViewModalProps> = (props) => {
height: 420
});
const isFullScreenRef = React.useRef(false);
const logsViewerRef = React.useRef<any>(null);
const intl = useIntl();
const viewportHeight = window.innerHeight;
const viewHeight = viewportHeight - 86;
@@ -31,6 +32,11 @@ const ViewCodeModal: React.FC<ViewModalProps> = (props) => {
});
}, []);
const handleCancel = useCallback(() => {
logsViewerRef.current?.abort();
onCancel();
}, [onCancel]);
useEffect(() => {
if (open) {
isFullScreenRef.current = false;
@@ -53,7 +59,7 @@ const ViewCodeModal: React.FC<ViewModalProps> = (props) => {
}
open={open}
centered={true}
onCancel={onCancel}
onCancel={handleCancel}
destroyOnClose={true}
closeIcon={true}
maskClosable={false}
@@ -67,6 +73,7 @@ const ViewCodeModal: React.FC<ViewModalProps> = (props) => {
footer={null}
>
<LogsViewer
ref={logsViewerRef}
height={modalSize.height}
diffHeight={93}
url={url}