mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-21 05:16:54 +08:00
### What problem does this PR solve? fix: fetch file list by react-query #1306 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -19,17 +19,19 @@ import {
|
||||
} from 'antd';
|
||||
import { useMemo } from 'react';
|
||||
import {
|
||||
useFetchDocumentListOnMount,
|
||||
useHandleBreadcrumbClick,
|
||||
useHandleDeleteFile,
|
||||
useHandleSearchChange,
|
||||
useSelectBreadcrumbItems,
|
||||
} from './hooks';
|
||||
|
||||
import { useSelectParentFolderList } from '@/hooks/file-manager-hooks';
|
||||
import {
|
||||
IListResult,
|
||||
useSelectParentFolderList,
|
||||
} from '@/hooks/file-manager-hooks';
|
||||
import styles from './index.less';
|
||||
|
||||
interface IProps {
|
||||
interface IProps
|
||||
extends Pick<IListResult, 'searchString' | 'handleInputChange'> {
|
||||
selectedRowKeys: string[];
|
||||
showFolderCreateModal: () => void;
|
||||
showFileUploadModal: () => void;
|
||||
@ -41,10 +43,10 @@ const FileToolbar = ({
|
||||
showFolderCreateModal,
|
||||
showFileUploadModal,
|
||||
setSelectedRowKeys,
|
||||
searchString,
|
||||
handleInputChange,
|
||||
}: IProps) => {
|
||||
const { t } = useTranslate('knowledgeDetails');
|
||||
useFetchDocumentListOnMount();
|
||||
const { handleInputChange, searchString } = useHandleSearchChange();
|
||||
const breadcrumbItems = useSelectBreadcrumbItems();
|
||||
const { handleBreadcrumbClick } = useHandleBreadcrumbClick();
|
||||
const parentFolderList = useSelectParentFolderList();
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { useSelectFileList } from '@/hooks/file-manager-hooks';
|
||||
import { useFetchNextFileList } from '@/hooks/file-manager-hooks';
|
||||
import { IFile } from '@/interfaces/database/file-manager';
|
||||
import { formatDate } from '@/utils/date';
|
||||
import { Button, Flex, Space, Table, Tag, Typography } from 'antd';
|
||||
@ -6,7 +6,6 @@ import { ColumnsType } from 'antd/es/table';
|
||||
import ActionCell from './action-cell';
|
||||
import FileToolbar from './file-toolbar';
|
||||
import {
|
||||
useGetFilesPagination,
|
||||
useGetRowSelection,
|
||||
useHandleConnectToKnowledge,
|
||||
useHandleCreateFolder,
|
||||
@ -30,7 +29,7 @@ const { Text } = Typography;
|
||||
|
||||
const FileManager = () => {
|
||||
const { t } = useTranslate('fileManager');
|
||||
const fileList = useSelectFileList();
|
||||
// const fileList = useSelectFileList();
|
||||
const { rowSelection, setSelectedRowKeys } = useGetRowSelection();
|
||||
const loading = useSelectFileListLoading();
|
||||
const navigateToOtherFolder = useNavigateToOtherFolder();
|
||||
@ -64,8 +63,9 @@ const FileManager = () => {
|
||||
initialValue,
|
||||
connectToKnowledgeLoading,
|
||||
} = useHandleConnectToKnowledge();
|
||||
const { pagination } = useGetFilesPagination();
|
||||
|
||||
// const { pagination } = useGetFilesPagination();
|
||||
const { pagination, data, searchString, handleInputChange } =
|
||||
useFetchNextFileList();
|
||||
const columns: ColumnsType<IFile> = [
|
||||
{
|
||||
title: t('name'),
|
||||
@ -151,13 +151,15 @@ const FileManager = () => {
|
||||
return (
|
||||
<section className={styles.fileManagerWrapper}>
|
||||
<FileToolbar
|
||||
searchString={searchString}
|
||||
handleInputChange={handleInputChange}
|
||||
selectedRowKeys={rowSelection.selectedRowKeys as string[]}
|
||||
showFolderCreateModal={showFolderCreateModal}
|
||||
showFileUploadModal={showFileUploadModal}
|
||||
setSelectedRowKeys={setSelectedRowKeys}
|
||||
></FileToolbar>
|
||||
<Table
|
||||
dataSource={fileList}
|
||||
dataSource={data?.files}
|
||||
columns={columns}
|
||||
rowKey={'id'}
|
||||
rowSelection={rowSelection}
|
||||
|
||||
Reference in New Issue
Block a user