Skip to content

Commit 2b14dfc

Browse files
fix(file): Fix issue with abnormal display when calculating sizes of multiple folders simultaneously
1 parent 7a6e537 commit 2b14dfc

File tree

1 file changed

+3
-8
lines changed
  • frontend/src/views/host/file-management

1 file changed

+3
-8
lines changed

frontend/src/views/host/file-management/index.vue

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@
256256
link
257257
small
258258
@click="getDirSize(row, $index)"
259-
:loading="btnLoading == $index"
259+
:loading="row.btnLoading"
260260
>
261261
<span v-if="row.dirSize == undefined">
262262
{{ $t('file.calculate') }}
@@ -377,7 +377,6 @@ const initData = () => ({
377377
});
378378
let req = reactive(initData());
379379
let loading = ref(false);
380-
let btnLoading = ref(-1);
381380
const paths = ref<FilePaths[]>([]);
382381
let pathWidth = ref(0);
383382
const history: string[] = [];
@@ -419,7 +418,6 @@ const dialogVscodeOpenRef = ref();
419418
const previewRef = ref();
420419
const processRef = ref();
421420
422-
// editablePath
423421
const { searchableStatus, searchablePath, searchableInputRef, searchableInputBlur } = useSearchable(paths);
424422
425423
const paginationConfig = reactive({
@@ -453,7 +451,6 @@ const search = async () => {
453451
});
454452
};
455453
456-
/** just search, no handleSearchResult */
457454
const searchFile = async () => {
458455
loading.value = true;
459456
try {
@@ -548,7 +545,6 @@ const jump = async (url: string) => {
548545
const { path: oldUrl, pageSize: oldPageSize } = req;
549546
Object.assign(req, initData(), { path: url, containSub: false, search: '', pageSize: oldPageSize });
550547
let searchResult = await searchFile();
551-
// check search result,the file is exists?
552548
if (!searchResult.data.path) {
553549
req.path = oldUrl;
554550
globalStore.setLastFilePath(req.path);
@@ -566,7 +562,6 @@ const jump = async (url: string) => {
566562
567563
const backForwardJump = async (url: string) => {
568564
const oldPageSize = req.pageSize;
569-
// reset search params before exec jump
570565
Object.assign(req, initData());
571566
req.path = url;
572567
req.containSub = false;
@@ -624,15 +619,15 @@ const getDirSize = async (row: any, index: number) => {
624619
const req = {
625620
path: row.path,
626621
};
627-
btnLoading.value = index;
622+
data.value[index].btnLoading = true;
628623
await computeDirSize(req)
629624
.then(async (res) => {
630625
let newData = [...data.value];
631626
newData[index].dirSize = res.data.size;
632627
data.value = newData;
633628
})
634629
.finally(() => {
635-
btnLoading.value = -1;
630+
data.value[index].btnLoading = false;
636631
});
637632
};
638633

0 commit comments

Comments
 (0)