Skip to content

Commit

Permalink
修复日志滚动逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
whyour committed Sep 12, 2023
1 parent 742d0b2 commit 748a099
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,5 +451,6 @@
"登录已过期,请重新登录": "Login session has expired, please log in again",
"系统日志": "System Logs",
"主题": "Theme",
"语言": "Language"
"语言": "Language",
"中...": "ing..."
}
3 changes: 2 additions & 1 deletion src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -451,5 +451,6 @@
"登录已过期,请重新登录": "登录已过期,请重新登录",
"系统日志": "系统日志",
"主题": "主题",
"语言": "语言"
"语言": "语言",
"中...": "中..."
}
7 changes: 4 additions & 3 deletions src/pages/crontab/logModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,12 @@ const CronLogModal = ({
handleCancel();
};

const handleScroll = (e) => {
const sTop = e.target.scrollTop;
const handleScroll: React.UIEventHandler<HTMLDivElement> = (e) => {
const sTop = (e.target as HTMLDivElement).scrollTop;
if (scrollInfoRef.current.down) {
scrollInfoRef.current = {
value: sTop,
down: sTop > scrollInfoRef.current.value,
down: sTop > scrollInfoRef.current.value || !sTop,
};
}
};
Expand All @@ -105,6 +105,7 @@ const CronLogModal = ({
useEffect(() => {
if (cron && cron.id && visible) {
getCronLog(true);
scrollInfoRef.current.down = true;
}
}, [cron, visible]);

Expand Down
5 changes: 3 additions & 2 deletions src/pages/setting/progress.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import { Modal, Progress } from 'antd';
import { useRef } from 'react';

Expand All @@ -15,14 +16,14 @@ export default function useProgress(title: string) {
const showProgress = (percent: number) => {
if (modalRef.current) {
modalRef.current.update({
title: `${title}${percent >= 100 ? '成功' : '中...'}`,
title: `${title}${percent >= 100 ? intl.get('成功') : intl.get('中...')}`,
content: <ProgressElement percent={percent} />,
});
} else {
modalRef.current = Modal.info({
width: 600,
maskClosable: false,
title: `${title}${percent >= 100 ? '成功' : '中...'}`,
title: `${title}${percent >= 100 ? intl.get('成功') : intl.get('中...')}`,
centered: true,
content: <ProgressElement percent={percent} />,
});
Expand Down

0 comments on commit 748a099

Please sign in to comment.