feat: Add the cleaning of the execution script (#8540)

This commit is contained in:
ssongliu 2025-05-04 21:20:01 +08:00 committed by GitHub
parent 4b5526a028
commit 3533eed5f4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View file

@ -279,6 +279,8 @@ func (u *DeviceService) Clean(req []dto.Clean) {
_ = taskRepo.Delete(repo.WithByType(item.Name))
}
}
case "script":
dropFileOrDir(path.Join(global.Dir.TmpDir, "script", item.Name))
case "images":
dropImages()
case "containers":
@ -516,6 +518,11 @@ func loadLogTree(fileOp fileUtils.FileOp) []dto.CleanTree {
list2 := loadTreeWithDir(false, "task_log", path2, fileOp)
size2, _ := fileOp.GetDirSize(path2)
treeData = append(treeData, dto.CleanTree{ID: uuid.NewString(), Label: "task_log", Size: uint64(size2), Children: list2, Type: "task_log"})
path3 := path.Join(global.Dir.TmpDir, "script")
list3 := loadTreeWithAllFile(true, path3, "script", path3, fileOp)
size3, _ := fileOp.GetDirSize(path3)
treeData = append(treeData, dto.CleanTree{ID: uuid.NewString(), Label: "script", Size: uint64(size3), Children: list3, Type: "script", IsRecommend: true})
return treeData
}

View file

@ -632,6 +632,8 @@ function load18n(label: string) {
return i18n.global.t('clean.directory');
case 'system_log':
return i18n.global.t('clean.systemLog');
case 'script':
return i18n.global.t('cronjob.library.script');
case 'docker_log':
return i18n.global.t('clean.dockerLog');
case 'task_log':