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

@ -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 },