feat: create folder #345 (#518)

### What problem does this PR solve?

feat: create folder
feat: ensure that all files in the current folder can be correctly
requested after renaming the folder
#345 

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-04-24 11:07:22 +08:00
committed by GitHub
parent 369400c483
commit 2d228dbf7f
10 changed files with 285 additions and 47 deletions

View File

@@ -1,4 +1,5 @@
import { useShowDeleteConfirm, useTranslate } from '@/hooks/commonHooks';
import { useTranslate } from '@/hooks/commonHooks';
import { IFile } from '@/interfaces/database/file-manager';
import { api_host } from '@/utils/api';
import { downloadFile } from '@/utils/fileUtil';
import {
@@ -8,9 +9,8 @@ import {
ToolOutlined,
} from '@ant-design/icons';
import { Button, Space, Tooltip } from 'antd';
import { useHandleDeleteFile } from '../hooks';
import { useRemoveFile } from '@/hooks/fileManagerHooks';
import { IFile } from '@/interfaces/database/file-manager';
import styles from './index.less';
interface IProps {
@@ -23,18 +23,7 @@ const ActionCell = ({ record, setCurrentRecord, showRenameModal }: IProps) => {
const documentId = record.id;
const beingUsed = false;
const { t } = useTranslate('knowledgeDetails');
const removeDocument = useRemoveFile();
const showDeleteConfirm = useShowDeleteConfirm();
const onRmDocument = () => {
if (!beingUsed) {
showDeleteConfirm({
onOk: () => {
return removeDocument([documentId]);
},
});
}
};
const { handleRemoveFile } = useHandleDeleteFile([documentId]);
const onDownloadDocument = () => {
downloadFile({
@@ -71,7 +60,7 @@ const ActionCell = ({ record, setCurrentRecord, showRenameModal }: IProps) => {
<Button
type="text"
disabled={beingUsed}
onClick={onRmDocument}
onClick={handleRemoveFile}
className={styles.iconButton}
>
<DeleteOutlined size={20} />