mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-19 12:06:42 +08:00
### 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:
@ -1,7 +1,9 @@
|
||||
import { paginationModel } from '@/base';
|
||||
import { BaseState } from '@/interfaces/common';
|
||||
import { IFile, IFolder } from '@/interfaces/database/file-manager';
|
||||
import i18n from '@/locales/config';
|
||||
import fileManagerService from '@/services/fileManagerService';
|
||||
import { message } from 'antd';
|
||||
import omit from 'lodash/omit';
|
||||
import { DvaModel } from 'umi';
|
||||
|
||||
@ -33,6 +35,7 @@ const model: DvaModel<FileManagerModelState> = {
|
||||
});
|
||||
const { retcode } = data;
|
||||
if (retcode === 0) {
|
||||
message.success(i18n.t('message.deleted'));
|
||||
yield put({
|
||||
type: 'listFile',
|
||||
payload: { parentId: payload.parentId },
|
||||
@ -69,6 +72,7 @@ const model: DvaModel<FileManagerModelState> = {
|
||||
omit(payload, ['parentId']),
|
||||
);
|
||||
if (data.retcode === 0) {
|
||||
message.success(i18n.t('message.renamed'));
|
||||
yield put({
|
||||
type: 'listFile',
|
||||
payload: { parentId: payload.parentId },
|
||||
@ -89,6 +93,8 @@ const model: DvaModel<FileManagerModelState> = {
|
||||
});
|
||||
const { data } = yield call(fileManagerService.uploadFile, formData);
|
||||
if (data.retcode === 0) {
|
||||
message.success(i18n.t('message.uploaded'));
|
||||
|
||||
yield put({
|
||||
type: 'listFile',
|
||||
payload: { parentId: payload.parentId },
|
||||
@ -99,6 +105,8 @@ const model: DvaModel<FileManagerModelState> = {
|
||||
*createFolder({ payload = {} }, { call, put }) {
|
||||
const { data } = yield call(fileManagerService.createFolder, payload);
|
||||
if (data.retcode === 0) {
|
||||
message.success(i18n.t('message.created'));
|
||||
|
||||
yield put({
|
||||
type: 'listFile',
|
||||
payload: { parentId: payload.parentId },
|
||||
@ -125,6 +133,7 @@ const model: DvaModel<FileManagerModelState> = {
|
||||
omit(payload, 'parentId'),
|
||||
);
|
||||
if (data.retcode === 0) {
|
||||
message.success(i18n.t('message.operated'));
|
||||
yield put({
|
||||
type: 'listFile',
|
||||
payload: { parentId: payload.parentId },
|
||||
|
||||
Reference in New Issue
Block a user