fix: backend updateable when local path

This commit is contained in:
jialin
2024-11-08 15:09:25 +08:00
parent 93a6a77c2b
commit 343ada135d
7 changed files with 38 additions and 17 deletions
+6 -4
View File
@@ -41,8 +41,14 @@ const LogsList: React.FC<LogsListProps> = forwardRef((props, ref) => {
updateScrollerPosition(0);
}, [updateScrollerPosition]);
const debounceResetStopScroll = _.debounce(() => {
stopScroll.current = false;
}, 30000);
const scrollToTop = useCallback(() => {
stopScroll.current = true;
updateScrollerPositionToTop();
debounceResetStopScroll();
}, [updateScrollerPositionToTop]);
useImperativeHandle(ref, () => ({
@@ -50,10 +56,6 @@ const LogsList: React.FC<LogsListProps> = forwardRef((props, ref) => {
scrollToTop
}));
const debounceResetStopScroll = _.debounce(() => {
stopScroll.current = false;
}, 30000);
const handleOnWheel = useCallback(
(e: any) => {
const scrollTop = scrollEventElement?.scrollTop;
@@ -13,7 +13,7 @@ interface LogsPaginationProps {
}
const LogsPagination: React.FC<LogsPaginationProps> = (props) => {
const { page, total, pageSize, onNext, onPrev } = props;
const { page, total, pageSize, onWheel, onNext, onPrev } = props;
const intl = useIntl();
const handleOnPrev = () => {
@@ -181,6 +181,18 @@ const LogsViewer: React.FC<LogsViewerProps> = forwardRef((props, ref) => {
[loading, isLoadend, logs.length, pageSize]
);
const debouncedScroll = useCallback(
_.debounce(() => {
if (scrollPos[0] === 'top') {
logListRef.current?.scrollToTop();
}
if (scrollPos[0] === 'bottom') {
logListRef.current?.scrollToBottom();
}
}, 150),
[scrollPos]
);
useEffect(() => {
createChunkConnection();
return () => {
@@ -189,12 +201,7 @@ const LogsViewer: React.FC<LogsViewerProps> = forwardRef((props, ref) => {
}, [url, props.params]);
useEffect(() => {
if (scrollPos[0] === 'top') {
logListRef.current?.scrollToTop();
}
if (scrollPos[0] === 'bottom') {
logListRef.current?.scrollToBottom();
}
debouncedScroll();
}, [scrollPos]);
return (