feat: translate FileManager #345 (#558)

### What problem does this PR solve?
#345
feat: translate FileManager
feat: batch delete files from the file table in the knowledge base

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-04-26 17:22:23 +08:00
committed by GitHub
parent f69ff39fa0
commit eb62c669ae
20 changed files with 212 additions and 69 deletions

View File

@ -20,12 +20,12 @@ import {
import { useMemo } from 'react';
import {
useFetchDocumentListOnMount,
useHandleBreadcrumbClick,
useHandleDeleteFile,
useHandleSearchChange,
useSelectBreadcrumbItems,
} from './hooks';
import { Link } from 'umi';
import styles from './index.less';
interface IProps {
@ -35,20 +35,6 @@ interface IProps {
setSelectedRowKeys: (keys: string[]) => void;
}
const itemRender: BreadcrumbProps['itemRender'] = (
currentRoute,
params,
items,
) => {
const isLast = currentRoute?.path === items[items.length - 1]?.path;
return isLast ? (
<span>{currentRoute.title}</span>
) : (
<Link to={`${currentRoute.path}`}>{currentRoute.title}</Link>
);
};
const FileToolbar = ({
selectedRowKeys,
showFolderCreateModal,
@ -59,6 +45,26 @@ const FileToolbar = ({
useFetchDocumentListOnMount();
const { handleInputChange, searchString } = useHandleSearchChange();
const breadcrumbItems = useSelectBreadcrumbItems();
const { handleBreadcrumbClick } = useHandleBreadcrumbClick();
const itemRender: BreadcrumbProps['itemRender'] = (
currentRoute,
params,
items,
) => {
const isLast = currentRoute?.path === items[items.length - 1]?.path;
return isLast ? (
<span>{currentRoute.title}</span>
) : (
<span
className={styles.breadcrumbItemButton}
onClick={() => handleBreadcrumbClick(currentRoute.path)}
>
{currentRoute.title}
</span>
);
};
const actionItems: MenuProps['items'] = useMemo(() => {
return [
@ -70,7 +76,7 @@ const FileToolbar = ({
<Button type="link">
<Space>
<FileTextOutlined />
{t('localFiles')}
{t('uploadFile', { keyPrefix: 'fileManager' })}
</Space>
</Button>
</div>
@ -83,12 +89,13 @@ const FileToolbar = ({
label: (
<div>
<Button type="link">
<FolderOpenOutlined />
New Folder
<Space>
<FolderOpenOutlined />
{t('newFolder', { keyPrefix: 'fileManager' })}
</Space>
</Button>
</div>
),
// disabled: true,
},
];
}, [t, showFolderCreateModal, showFileUploadModal]);