mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-19 01:55:55 +08:00
### What problem does this PR solve? _Briefly describe what this PR aims to solve. Include background context that will help reviewers understand the purpose of the PR._ close #5730 ### Type of change - [ ] Bug Fix (non-breaking change which fixes an issue) - [ ] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe): Signed-off-by: yihong0618 <zouzou0208@gmail.com>
This commit is contained in:
parent
06b29d7da4
commit
8d61dcc8ab
@ -41,6 +41,7 @@ const FileUpload = ({
|
|||||||
},
|
},
|
||||||
beforeUpload: (file: UploadFile) => {
|
beforeUpload: (file: UploadFile) => {
|
||||||
setFileList((pre) => {
|
setFileList((pre) => {
|
||||||
|
console.log(file);
|
||||||
return [...pre, file];
|
return [...pre, file];
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -68,11 +69,12 @@ const FileUpload = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface IFileUploadModalProps extends IModalProps<boolean> {
|
interface IFileUploadModalProps extends Omit<IModalProps<boolean>, 'onOk'> {
|
||||||
uploadFileList: UploadFile[];
|
uploadFileList: UploadFile[];
|
||||||
setUploadFileList: Dispatch<SetStateAction<UploadFile[]>>;
|
setUploadFileList: Dispatch<SetStateAction<UploadFile[]>>;
|
||||||
uploadProgress: number;
|
uploadProgress: number;
|
||||||
setUploadProgress: Dispatch<SetStateAction<number>>;
|
setUploadProgress: Dispatch<SetStateAction<number>>;
|
||||||
|
onOk?: (fileList: UploadFile[]) => Promise<boolean | void> | boolean | void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileUploadModal = ({
|
const FileUploadModal = ({
|
||||||
@ -80,19 +82,21 @@ const FileUploadModal = ({
|
|||||||
hideModal,
|
hideModal,
|
||||||
loading,
|
loading,
|
||||||
onOk: onFileUploadOk,
|
onOk: onFileUploadOk,
|
||||||
uploadFileList: fileList,
|
|
||||||
setUploadFileList: setFileList,
|
|
||||||
uploadProgress,
|
uploadProgress,
|
||||||
setUploadProgress,
|
setUploadProgress,
|
||||||
}: IFileUploadModalProps) => {
|
}: IFileUploadModalProps) => {
|
||||||
const { t } = useTranslate('fileManager');
|
const { t } = useTranslate('fileManager');
|
||||||
const [value, setValue] = useState<string | number>('local');
|
const [value, setValue] = useState<string | number>('local');
|
||||||
const [parseOnCreation, setParseOnCreation] = useState(false);
|
const [parseOnCreation, setParseOnCreation] = useState(false);
|
||||||
|
const [fileList, setFileList] = useState<UploadFile[]>([]);
|
||||||
|
|
||||||
const clearFileList = () => {
|
const clearFileList = () => {
|
||||||
setFileList([]);
|
setFileList([]);
|
||||||
setUploadProgress(0);
|
if (typeof setUploadProgress === 'function') {
|
||||||
|
setUploadProgress(0);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
console.log(fileList);
|
||||||
|
|
||||||
const onOk = async () => {
|
const onOk = async () => {
|
||||||
if (uploadProgress === 100) {
|
if (uploadProgress === 100) {
|
||||||
@ -100,7 +104,7 @@ const FileUploadModal = ({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ret = await onFileUploadOk?.(parseOnCreation);
|
const ret = await onFileUploadOk?.(fileList);
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user