-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Expand file tree
/
Copy pathfiles.ts
More file actions
180 lines (137 loc) · 5.95 KB
/
files.ts
File metadata and controls
180 lines (137 loc) · 5.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
import { File } from '@/api/interface/file';
import http from '@/api';
import { AxiosRequestConfig } from 'axios';
import { ResPage } from '../interface';
import { TimeoutEnum } from '@/enums/http-enum';
import { ReqPage } from '@/api/interface';
import { Dashboard } from '@/api/interface/dashboard';
export const getFilesList = (params: File.ReqFile) => {
return http.post<File.File>('files/search', params, TimeoutEnum.T_5M);
};
export const getFilesListByNode = (params: File.ReqNodeFile) => {
return http.post<File.File>('files/search?operateNode=' + params.node, params, TimeoutEnum.T_5M);
};
export const getUploadList = (params: File.SearchUploadInfo) => {
return http.post<ResPage<File.UploadInfo>>('files/upload/search', params);
};
export const getFilesTree = (params: File.ReqFile) => {
return http.post<File.FileTree[]>('files/tree', params);
};
export const createFile = (form: File.FileCreate) => {
return http.post<File.File>('files', form);
};
export const deleteFile = (form: File.FileDelete) => {
return http.post<File.File>('files/del', form);
};
export const deleteFileByNode = (form: File.FileDelete, node: string) => {
return http.post<File.File>('files/del?operateNode=' + node, form);
};
export const batchDeleteFile = (form: File.FileBatchDelete) => {
return http.post('files/batch/del', form);
};
export const changeFileMode = (form: File.FileCreate) => {
return http.post<File.File>('files/mode', form, TimeoutEnum.T_5M);
};
export const compressFile = (form: File.FileCompress) => {
return http.post<File.File>('files/compress', form, TimeoutEnum.T_10M);
};
export const deCompressFile = (form: File.FileDeCompress) => {
return http.post<File.File>('files/decompress', form, TimeoutEnum.T_10M);
};
export const getFileContent = (params: File.ReqFile) => {
return http.post<File.File>('files/content', params);
};
export const getPreviewContent = (params: File.PreviewContentReq) => {
return http.post<File.File>('files/preview', params, TimeoutEnum.T_5M);
};
export const saveFileContent = (params: File.FileEdit) => {
return http.post<File.File>('files/save', params);
};
export const checkFile = (path: string, withInit: boolean) => {
return http.post<boolean>('files/check', { path: path, withInit: withInit });
};
export const uploadFileData = (params: FormData, config: AxiosRequestConfig) => {
return http.upload<File.File>('files/upload', params, config);
};
export const batchCheckFiles = (paths: string[]) => {
return http.post<File.ExistFileInfo[]>('files/batch/check', { paths: paths }, TimeoutEnum.T_5M);
};
export const batchGetFileRemarks = (paths: string[]) => {
return http.post<File.FileRemarksRes>('files/remarks', { paths: paths }, TimeoutEnum.T_5M);
};
export const setFileRemark = (params: File.FileRemarkUpdate) => {
return http.post('files/remark', params);
};
export const chunkUploadFileData = (params: FormData, config: AxiosRequestConfig) => {
return http.upload<File.File>('files/chunkupload', params, config);
};
export const renameRile = (params: File.FileRename) => {
return http.post<File.File>('files/rename', params);
};
export const changeOwner = (params: File.FileOwner) => {
return http.post<File.File>('files/owner', params);
};
export const wgetFile = (params: File.FileWget) => {
return http.post<File.FileWgetRes>('files/wget', params);
};
export const moveFile = (params: File.FileMove) => {
return http.post<File.File>('files/move', params, TimeoutEnum.T_5M);
};
export const downloadFile = (params: File.FileDownload) => {
return http.download<BlobPart>('files/download', params, { responseType: 'blob', timeout: TimeoutEnum.T_40S });
};
export const computeDirSize = (params: File.DirSizeReq) => {
return http.post<File.DirSizeRes>('files/size', params, TimeoutEnum.T_5M);
};
export const computeDepthDirSize = (params: File.DirSizeReq) => {
return http.post<File.DepthDirSizeRes[]>('files/depth/size', params, TimeoutEnum.T_5M);
};
export const fileWgetKeys = () => {
return http.get<File.FileKeys>('files/wget/process/keys');
};
export const getRecycleList = (params: ReqPage) => {
return http.post<ResPage<File.RecycleBin>>('files/recycle/search', params);
};
export const reduceFile = (params: File.RecycleBinReduce) => {
return http.post<any>('files/recycle/reduce', params);
};
export const clearRecycle = () => {
return http.post<any>('files/recycle/clear');
};
export const searchFavorite = (params: ReqPage) => {
return http.post<ResPage<File.Favorite>>('files/favorite/search', params);
};
export const addFavorite = (path: string) => {
return http.post<any>('files/favorite', { path: path });
};
export const readByLine = (req: File.FileReadByLine, operateNode?: string) => {
const params = operateNode ? `?operateNode=${operateNode}` : '';
return http.post<any>(`files/read${params}`, req, TimeoutEnum.T_40S);
};
export const removeFavorite = (id: number) => {
return http.post<any>('files/favorite/del', { id: id });
};
export const batchChangeRole = (params: File.FileRole) => {
return http.post<any>('files/batch/role', params, TimeoutEnum.T_5M);
};
export const getRecycleStatus = () => {
return http.get<string>('files/recycle/status');
};
export const getRecycleStatusByNode = (node: string) => {
return http.get<string>('files/recycle/status?operateNode=' + node);
};
export const getPathByType = (pathType: string) => {
return http.get<string>(`files/path/${pathType}`);
};
export const searchHostMount = () => {
return http.post<Dashboard.DiskInfo[]>(`/files/mount`);
};
export const searchUserGroup = () => {
return http.post<File.UserGroupResponse>(`/files/user/group`);
};
export const convertFiles = (params: File.ConvertFileRequest) => {
return http.post<File.ConvertFile>('files/convert', params, TimeoutEnum.T_5M);
};
export const convertLogs = (params: ReqPage) => {
return http.post<ResPage<File.ConvertLogResponse>>('files/convert/log', params, TimeoutEnum.T_5M);
};