Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 文本管理计算文件夹大小请求超时 #5836

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/api/modules/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export const DownloadFile = (params: File.FileDownload) => {
};

export const ComputeDirSize = (params: File.DirSizeReq) => {
return http.post<File.DirSizeRes>('files/size', params);
return http.post<File.DirSizeRes>('files/size', params, TimeoutEnum.T_5M);
};

export const FileKeys = () => {
Expand Down
13 changes: 10 additions & 3 deletions frontend/src/views/host/file-management/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,13 @@
<el-table-column :label="$t('file.size')" prop="size" max-width="50" sortable>
<template #default="{ row, $index }">
<span v-if="row.isDir">
<el-button type="primary" link small @click="getDirSize(row, $index)">
<el-button
type="primary"
link
small
@click="getDirSize(row, $index)"
:loading="btnLoading == $index"
>
<span v-if="row.dirSize == undefined">
{{ $t('file.calculate') }}
</span>
Expand Down Expand Up @@ -381,6 +387,7 @@ const initData = () => ({
});
let req = reactive(initData());
let loading = ref(false);
let btnLoading = ref(-1);
const paths = ref<FilePaths[]>([]);
let pathWidth = ref(0);
const history: string[] = [];
Expand Down Expand Up @@ -631,15 +638,15 @@ const getDirSize = async (row: any, index: number) => {
const req = {
path: row.path,
};
loading.value = true;
btnLoading.value = index;
await ComputeDirSize(req)
.then(async (res) => {
let newData = [...data.value];
newData[index].dirSize = res.data.size;
data.value = newData;
})
.finally(() => {
loading.value = false;
btnLoading.value = -1;
});
};

Expand Down
Loading