diff --git a/chat2db-community-client/src/blocks/ImportAndExport/components/Log/index.tsx b/chat2db-community-client/src/blocks/ImportAndExport/components/Log/index.tsx index e1c6d1e84c..2199a5b6b9 100644 --- a/chat2db-community-client/src/blocks/ImportAndExport/components/Log/index.tsx +++ b/chat2db-community-client/src/blocks/ImportAndExport/components/Log/index.tsx @@ -11,7 +11,7 @@ import { import { useSize } from 'ahooks'; import VirtualList, { type ListRef } from 'rc-virtual-list'; import { useStyles } from './style'; -import { Spin } from 'antd'; +import { Progress, Spin } from 'antd'; import importExportServices from '@/service/importExport'; import { ImportExportTaskDetails, ImportExportTaskEvent } from '@/typings/importExport'; import { ACTIVE_TASK_STATUSES, ImportExportTaskStatus } from '@/constants/importExport'; @@ -274,7 +274,18 @@ const Log = (props: IProps) => { ] : []; const visibleEvents = events.length ? events : fallbackErrorEvent; - + const progress = + taskDetails.status === ImportExportTaskStatus.SUCCESS + ? 100 + : Math.min(100, Math.max(0, Number(taskDetails.progress) || 0)); + const progressStatus = + taskDetails.status === ImportExportTaskStatus.SUCCESS + ? 'success' + : taskDetails.status === ImportExportTaskStatus.FAILED + ? 'exception' + : taskDetails.status === ImportExportTaskStatus.RUNNING + ? 'active' + : 'normal'; return (
{loadingOlder && ( @@ -317,6 +328,20 @@ const Log = (props: IProps) => {
{i18n('workspace.task.events.loadFailed')}
)}
+
+
+ + + {progress}% + +
+
); }; diff --git a/chat2db-community-client/src/blocks/ImportAndExport/components/Log/style.ts b/chat2db-community-client/src/blocks/ImportAndExport/components/Log/style.ts index 44afb08073..fbde474b92 100644 --- a/chat2db-community-client/src/blocks/ImportAndExport/components/Log/style.ts +++ b/chat2db-community-client/src/blocks/ImportAndExport/components/Log/style.ts @@ -38,6 +38,48 @@ export const useStyles = createStyles(({ css, token }) => { font-size: 12px; transform: translateX(-50%); `, + progressPanel: css` + flex: none; + padding: 8px 16px; + border-top: 1px solid ${token.colorBorderSecondary}; + background: ${token.colorBgElevated}; + `, + progressHeader: css` + display: flex; + width: 100%; + gap: 12px; + align-items: center; + min-width: 0; + `, + progressValue: css` + flex: none; + color: ${token.colorPrimary}; + font-size: 14px; + font-variant-numeric: tabular-nums; + font-weight: 600; + + &[data-status='SUCCESS'] { + color: ${token.colorSuccess}; + } + + &[data-status='FAILED'] { + color: ${token.colorError}; + } + + &[data-status='CANCELLED'] { + color: ${token.colorTextSecondary}; + } + `, + progressBar: css` + min-width: 80px; + flex: 1; + line-height: 1; + + :global(.ant-progress-inner), + :global(.ant-progress-bg) { + border-radius: 999px; + } + `, eventConsole: css` display: flex; min-height: 0;