fix: #567 use modal to upload files in the knowledge base (#601)

### What problem does this PR solve?

fix:  #567 use modal to upload files in the knowledge base

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2024-04-29 15:45:19 +08:00
committed by GitHub
parent 6874c6f3a7
commit 38f0cc016f
13 changed files with 262 additions and 20 deletions

View File

@@ -19,6 +19,7 @@ import {
useFetchDocumentListOnMount,
useGetPagination,
useGetRowSelection,
useHandleUploadDocument,
useNavigateToOtherPage,
useRenameDocument,
} from './hooks';
@@ -26,6 +27,7 @@ import ParsingActionCell from './parsing-action-cell';
import ParsingStatusCell from './parsing-status-cell';
import RenameModal from './rename-modal';
import FileUploadModal from '@/components/file-upload-modal';
import { formatDate } from '@/utils/date';
import styles from './index.less';
@@ -58,6 +60,13 @@ const KnowledgeFile = () => {
hideChangeParserModal,
showChangeParserModal,
} = useChangeDocumentParser(currentRecord.id);
const {
documentUploadVisible,
hideDocumentUploadModal,
showDocumentUploadModal,
onDocumentUploadOk,
documentUploadLoading,
} = useHandleUploadDocument();
const { t } = useTranslation('translation', {
keyPrefix: 'knowledgeDetails',
});
@@ -157,6 +166,7 @@ const KnowledgeFile = () => {
<DocumentToolbar
selectedRowKeys={rowSelection.selectedRowKeys as string[]}
showCreateModal={showCreateModal}
showDocumentUploadModal={showDocumentUploadModal}
></DocumentToolbar>
<Table
rowKey="id"
@@ -190,6 +200,12 @@ const KnowledgeFile = () => {
hideModal={hideRenameModal}
initialName={currentRecord.name}
></RenameModal>
<FileUploadModal
visible={documentUploadVisible}
hideModal={hideDocumentUploadModal}
loading={documentUploadLoading}
onOk={onDocumentUploadOk}
></FileUploadModal>
</div>
);
};