Skip to content

Commit 6092e76

Browse files
feat(file): Prevent progress display after file download completion (#8062)
1 parent 9ee3832 commit 6092e76

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

agent/app/api/v2/file.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package v2
22

33
import (
4+
"encoding/json"
45
"errors"
56
"fmt"
67
"io"
@@ -761,7 +762,16 @@ func (b *BaseApi) WgetProcess(c *gin.Context) {
761762
func (b *BaseApi) ProcessKeys(c *gin.Context) {
762763
res := &response.FileProcessKeys{}
763764
keys := global.CACHE.PrefixScanKey("file-wget-")
764-
res.Keys = keys
765+
for _, key := range keys {
766+
value := global.CACHE.Get(key)
767+
if value == "" {
768+
continue
769+
}
770+
var process files.Process
771+
if err := json.Unmarshal([]byte(value), &process); err == nil && process.Percent != 100 {
772+
res.Keys = append(res.Keys, key)
773+
}
774+
}
765775
helper.SuccessWithData(c, res)
766776
}
767777

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ const mobile = computed(() => {
434434
});
435435
436436
const search = async () => {
437+
getWgetProcess();
437438
loading.value = true;
438439
if (req.search != '') {
439440
req.sortBy = 'name';
@@ -983,7 +984,6 @@ onMounted(() => {
983984
nextTick(function () {
984985
handlePath();
985986
});
986-
getWgetProcess();
987987
});
988988
</script>
989989

0 commit comments

Comments
 (0)