From 6092e768efe31e10a9f6fd2e91c89cf84b34d5cf Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Tue, 4 Mar 2025 18:00:57 +0800 Subject: [PATCH] feat(file): Prevent progress display after file download completion (#8062) --- agent/app/api/v2/file.go | 12 +++++++++++- frontend/src/views/host/file-management/index.vue | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/agent/app/api/v2/file.go b/agent/app/api/v2/file.go index e3d64b120..5b0b99ef7 100644 --- a/agent/app/api/v2/file.go +++ b/agent/app/api/v2/file.go @@ -1,6 +1,7 @@ package v2 import ( + "encoding/json" "errors" "fmt" "io" @@ -761,7 +762,16 @@ func (b *BaseApi) WgetProcess(c *gin.Context) { func (b *BaseApi) ProcessKeys(c *gin.Context) { res := &response.FileProcessKeys{} keys := global.CACHE.PrefixScanKey("file-wget-") - res.Keys = keys + for _, key := range keys { + value := global.CACHE.Get(key) + if value == "" { + continue + } + var process files.Process + if err := json.Unmarshal([]byte(value), &process); err == nil && process.Percent != 100 { + res.Keys = append(res.Keys, key) + } + } helper.SuccessWithData(c, res) } diff --git a/frontend/src/views/host/file-management/index.vue b/frontend/src/views/host/file-management/index.vue index 2018b4a90..43841417d 100644 --- a/frontend/src/views/host/file-management/index.vue +++ b/frontend/src/views/host/file-management/index.vue @@ -434,6 +434,7 @@ const mobile = computed(() => { }); const search = async () => { + getWgetProcess(); loading.value = true; if (req.search != '') { req.sortBy = 'name'; @@ -983,7 +984,6 @@ onMounted(() => { nextTick(function () { handlePath(); }); - getWgetProcess(); });