From dc5b6fba553ab5d49ad60513bd5be00baf0727a1 Mon Sep 17 00:00:00 2001 From: ssongliu Date: Sat, 28 Jan 2023 16:51:58 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A4=87=E4=BB=BD=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/backup.go | 23 ++ frontend/src/api/interface/backup.ts | 1 + frontend/src/lang/modules/en.ts | 2 + frontend/src/lang/modules/zh.ts | 6 +- .../views/container/compose/create/index.vue | 6 +- .../container/container/create/index.vue | 4 +- .../container/container/terminal/index.vue | 7 +- .../src/views/container/image/build/index.vue | 8 +- .../src/views/container/image/pull/index.vue | 6 +- .../src/views/container/image/push/index.vue | 8 +- .../src/views/container/image/save/index.vue | 4 +- .../src/views/container/image/tag/index.vue | 4 +- .../views/container/network/create/index.vue | 4 +- .../views/container/repo/operator/index.vue | 4 +- .../container/template/operator/index.vue | 6 +- .../views/container/volume/create/index.vue | 4 +- frontend/src/views/cronjob/operate/index.vue | 4 +- .../src/views/database/mysql/backup/index.vue | 4 +- .../src/views/database/mysql/create/index.vue | 8 +- frontend/src/views/database/mysql/index.vue | 151 ++++---- .../src/views/database/mysql/upload/index.vue | 4 +- .../views/setting/backup-account/index.vue | 344 +++++++++++++----- .../setting/backup-account/operate/index.vue | 43 +-- frontend/src/views/setting/panel/index.vue | 316 +++++----------- frontend/src/views/setting/safe/index.vue | 304 +++++++++++----- 25 files changed, 738 insertions(+), 537 deletions(-) diff --git a/backend/app/service/backup.go b/backend/app/service/backup.go index 22aff6a61..cbb0ae719 100644 --- a/backend/app/service/backup.go +++ b/backend/app/service/backup.go @@ -36,13 +36,36 @@ func NewIBackupService() IBackupService { func (u *BackupService) List() ([]dto.BackupInfo, error) { ops, err := backupRepo.List(commonRepo.WithOrderBy("created_at desc")) var dtobas []dto.BackupInfo + ossExist, s3Exist, sftpExist, minioExist := false, false, false, false for _, group := range ops { + switch group.Type { + case "OSS": + ossExist = true + case "S3": + s3Exist = true + case "SFTP": + sftpExist = true + case "MINIO": + minioExist = true + } var item dto.BackupInfo if err := copier.Copy(&item, &group); err != nil { return nil, errors.WithMessage(constant.ErrStructTransform, err.Error()) } dtobas = append(dtobas, item) } + if !ossExist { + dtobas = append(dtobas, dto.BackupInfo{Type: "OSS"}) + } + if !s3Exist { + dtobas = append(dtobas, dto.BackupInfo{Type: "S3"}) + } + if !sftpExist { + dtobas = append(dtobas, dto.BackupInfo{Type: "SFTP"}) + } + if !minioExist { + dtobas = append(dtobas, dto.BackupInfo{Type: "MINIO"}) + } return dtobas, err } diff --git a/frontend/src/api/interface/backup.ts b/frontend/src/api/interface/backup.ts index d08cab9e2..52db5d5fa 100644 --- a/frontend/src/api/interface/backup.ts +++ b/frontend/src/api/interface/backup.ts @@ -9,6 +9,7 @@ export namespace Backup { credential: string; vars: string; varsJson: object; + createdAt: Date; } export interface BackupOperate { id: number; diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 33969cc3c..0056577bb 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -699,6 +699,7 @@ export default { duplicatePassword: 'The new password cannot be the same as the original password, please re-enter!', backup: 'Backup', + createBackupAccount: 'Create {0} backup account', noTypeForCreate: 'No backup type is currently created', serverDisk: 'Server disks', currentPath: 'Current path', @@ -734,6 +735,7 @@ export default { complexityHelper: 'The password must contain at least eight characters and contain at least three uppercase letters, lowercase letters, digits, and special characters', mfa: 'MFA', + mfaHelper: 'After this function is enabled, the mobile application verification code will be verified', mfaHelper1: 'Download a MFA verification mobile app such as:', mfaHelper2: 'Scan the following QR code using the mobile app to obtain the 6-digit verification code', mfaHelper3: 'Enter six digits from the app', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index bcb523a30..6e1bcba6b 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -239,7 +239,7 @@ export default { database: { delete: '删除操作无法回滚,请输入 "', deleteHelper: '" 删除此数据库', - create: '创建数据库', + create: '新建数据库', noMysql: '当前未检测到 {0} 数据库,请进入应用商店点击安装!', mysqlBadStatus: '当前 mysql 应用状态异常,请在', adjust: '中查看原因或修改配置', @@ -713,6 +713,7 @@ export default { duplicatePassword: '新密码不能与原始密码一致,请重新输入!', backup: '备份', + createBackupAccount: '添加 {0} 备份账号', noTypeForCreate: '当前无可创建备份类型', serverDisk: '服务器磁盘', currentPath: '当前路径', @@ -767,8 +768,9 @@ export default { expiredHelper: '当前密码已过期,请重新修改密码:', timeoutHelper: '【 {0} 天后 】面板密码即将过期,过期后需要重新设置密码', complexity: '密码复杂度验证', - complexityHelper: '密码必须满足密码长度大于 8 位且包含字母、数字及特殊字符', + complexityHelper: '开启后密码必须满足密码长度大于 8 位且包含字母、数字及特殊字符', mfa: '两步验证', + mfaHelper: '开启后会验证手机应用验证码', mfaHelper1: '下载两步验证手机应用 如:', mfaHelper2: '使用手机应用扫描以下二维码,获取 6 位验证码', mfaHelper3: '输入手机应用上的 6 位数字', diff --git a/frontend/src/views/container/compose/create/index.vue b/frontend/src/views/container/compose/create/index.vue index ad14bdac8..4620fd60b 100644 --- a/frontend/src/views/container/compose/create/index.vue +++ b/frontend/src/views/container/compose/create/index.vue @@ -1,5 +1,5 @@