From b045261f1641b8503cd8f9225abbb948e1b879a9 Mon Sep 17 00:00:00 2001
From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com>
Date: Tue, 24 Oct 2023 22:27:32 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=B8=8A=E4=BC=A0?=
=?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E5=8A=9F=E8=83=BD=20(#2661)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Refs https://github.com/1Panel-dev/1Panel/issues/1364
Refs https://github.com/1Panel-dev/1Panel/issues/2053
---
backend/app/api/v1/file.go | 7 +-
frontend/src/lang/modules/en.ts | 1 +
frontend/src/lang/modules/tw.ts | 1 +
frontend/src/lang/modules/zh.ts | 1 +
.../host/file-management/delete/index.vue | 1 +
.../host/file-management/upload/index.vue | 127 +++++++++++++++++-
6 files changed, 131 insertions(+), 7 deletions(-)
diff --git a/backend/app/api/v1/file.go b/backend/app/api/v1/file.go
index aaa5a320a..8bc879051 100644
--- a/backend/app/api/v1/file.go
+++ b/backend/app/api/v1/file.go
@@ -568,12 +568,13 @@ func (b *BaseApi) Size(c *gin.Context) {
}
func mergeChunks(fileName string, fileDir string, dstDir string, chunkCount int) error {
- if _, err := os.Stat(path.Dir(dstDir)); err != nil && os.IsNotExist(err) {
- if err = os.MkdirAll(path.Dir(dstDir), os.ModePerm); err != nil {
+ op := files.NewFileOp()
+ dstDir = strings.TrimSpace(dstDir)
+ if _, err := os.Stat(dstDir); err != nil && os.IsNotExist(err) {
+ if err = op.CreateDir(dstDir, os.ModePerm); err != nil {
return err
}
}
-
targetFile, err := os.Create(filepath.Join(dstDir, fileName))
if err != nil {
return err
diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts
index 1faf98f01..e2f94d340 100644
--- a/frontend/src/lang/modules/en.ts
+++ b/frontend/src/lang/modules/en.ts
@@ -975,6 +975,7 @@ const message = {
favorite: 'favorites',
removeFavorite: 'Remove from favorites?',
addFavorite: 'Add to favorites',
+ clearList: 'Clear list',
},
ssh: {
autoStart: 'Auto Start',
diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts
index 703a3793b..89eb6f1cb 100644
--- a/frontend/src/lang/modules/tw.ts
+++ b/frontend/src/lang/modules/tw.ts
@@ -936,6 +936,7 @@ const message = {
favorite: '收藏夾',
removeFavorite: '是否從收藏夾移出?',
addFavorite: '加入收藏夾',
+ clearList: '清空列表',
},
ssh: {
autoStart: '開機自啟',
diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts
index d5b26b91f..9cb12b729 100644
--- a/frontend/src/lang/modules/zh.ts
+++ b/frontend/src/lang/modules/zh.ts
@@ -937,6 +937,7 @@ const message = {
favorite: '收藏夹',
removeFavorite: '是否从收藏夹移出?',
addFavorite: '加入收藏夹子',
+ clearList: '清空列表',
},
ssh: {
autoStart: '开机自启',
diff --git a/frontend/src/views/host/file-management/delete/index.vue b/frontend/src/views/host/file-management/delete/index.vue
index 663329898..bf5dc61c7 100644
--- a/frontend/src/views/host/file-management/delete/index.vue
+++ b/frontend/src/views/host/file-management/delete/index.vue
@@ -53,6 +53,7 @@ const forceDelete = ref(false);
const acceptParams = (props: File.File[]) => {
files.value = props;
open.value = true;
+ forceDelete.value = false;
};
const onConfirm = () => {
diff --git a/frontend/src/views/host/file-management/upload/index.vue b/frontend/src/views/host/file-management/upload/index.vue
index f2101192e..67f8513a4 100644
--- a/frontend/src/views/host/file-management/upload/index.vue
+++ b/frontend/src/views/host/file-management/upload/index.vue
@@ -9,6 +9,26 @@
+