diff --git a/backend/app/dto/backup.go b/backend/app/dto/backup.go index 9e1685ddb..a180d1586 100644 --- a/backend/app/dto/backup.go +++ b/backend/app/dto/backup.go @@ -59,7 +59,7 @@ type BackupRecords struct { } type DownloadRecord struct { - Source string `json:"source" validate:"required,oneof=OSS S3 SFTP MINIO LOCAL"` + Source string `json:"source" validate:"required,oneof=OSS S3 SFTP MINIO LOCAL COS KODO"` FileDir string `json:"fileDir" validate:"required"` FileName string `json:"fileName" validate:"required"` } diff --git a/backend/app/dto/setting.go b/backend/app/dto/setting.go index e6beda926..ee399ccbe 100644 --- a/backend/app/dto/setting.go +++ b/backend/app/dto/setting.go @@ -49,7 +49,7 @@ type PortUpdate struct { } type SnapshotCreate struct { - From string `json:"from" validate:"required,oneof=OSS S3 SFTP MINIO"` + From string `json:"from" validate:"required,oneof=OSS S3 SFTP MINIO COS KODO"` Description string `json:"description"` } type SnapshotRecover struct { diff --git a/backend/utils/cloud_storage/client/cos.go b/backend/utils/cloud_storage/client/cos.go index 67e33f09a..232099d61 100644 --- a/backend/utils/cloud_storage/client/cos.go +++ b/backend/utils/cloud_storage/client/cos.go @@ -57,7 +57,7 @@ func (cos cosClient) ListBuckets() ([]interface{}, error) { } var datas []interface{} for _, bucket := range buckets.Buckets { - datas = append(datas, bucket) + datas = append(datas, bucket.Name) } return datas, nil } diff --git a/frontend/src/assets/iconfont/iconfont.css b/frontend/src/assets/iconfont/iconfont.css index cec4075e6..b0cf9a486 100644 --- a/frontend/src/assets/iconfont/iconfont.css +++ b/frontend/src/assets/iconfont/iconfont.css @@ -1,9 +1,9 @@ @font-face { font-family: "panel"; /* Project id 3575356 */ - src: url('iconfont.woff2?t=1673865903517') format('woff2'), - url('iconfont.woff?t=1673865903517') format('woff'), - url('iconfont.ttf?t=1673865903517') format('truetype'), - url('iconfont.svg?t=1673865903517#panel') format('svg'); + src: url('iconfont.woff2?t=1680702361679') format('woff2'), + url('iconfont.woff?t=1680702361679') format('woff'), + url('iconfont.ttf?t=1680702361679') format('truetype'), + url('iconfont.svg?t=1680702361679#panel') format('svg'); } .panel { @@ -14,6 +14,18 @@ -moz-osx-font-smoothing: grayscale; } +.p-tengxunyun1:before { + content: "\e651"; +} + +.p-qiniuyun:before { + content: "\e62c"; +} + +.p-file-png:before { + content: "\e7ae"; +} + .p-file-ppt:before { content: "\e6e2"; } diff --git a/frontend/src/assets/iconfont/iconfont.js b/frontend/src/assets/iconfont/iconfont.js index a2bf259a4..74c27e960 100644 --- a/frontend/src/assets/iconfont/iconfont.js +++ b/frontend/src/assets/iconfont/iconfont.js @@ -1 +1 @@ -window._iconfont_svg_string_3575356='',function(c){var l=(l=document.getElementsByTagName("script"))[l.length-1],h=l.getAttribute("data-injectcss"),l=l.getAttribute("data-disable-injectsvg");if(!l){var a,t,v,p,i,z=function(l,h){h.parentNode.insertBefore(l,h)};if(h&&!c.__iconfont__svg__cssinject__){c.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(l){console&&console.log(l)}}a=function(){var l,h=document.createElement("div");h.innerHTML=c._iconfont_svg_string_3575356,(h=h.getElementsByTagName("svg")[0])&&(h.setAttribute("aria-hidden","true"),h.style.position="absolute",h.style.width=0,h.style.height=0,h.style.overflow="hidden",h=h,(l=document.body).firstChild?z(h,l.firstChild):l.appendChild(h))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(a,0):(t=function(){document.removeEventListener("DOMContentLoaded",t,!1),a()},document.addEventListener("DOMContentLoaded",t,!1)):document.attachEvent&&(v=a,p=c.document,i=!1,o(),p.onreadystatechange=function(){"complete"==p.readyState&&(p.onreadystatechange=null,m())})}function m(){i||(i=!0,v())}function o(){try{p.documentElement.doScroll("left")}catch(l){return void setTimeout(o,50)}m()}}(window); \ No newline at end of file +window._iconfont_svg_string_3575356='',function(c){var l=(l=document.getElementsByTagName("script"))[l.length-1],h=l.getAttribute("data-injectcss"),l=l.getAttribute("data-disable-injectsvg");if(!l){var a,t,v,p,i,z=function(l,h){h.parentNode.insertBefore(l,h)};if(h&&!c.__iconfont__svg__cssinject__){c.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(l){console&&console.log(l)}}a=function(){var l,h=document.createElement("div");h.innerHTML=c._iconfont_svg_string_3575356,(h=h.getElementsByTagName("svg")[0])&&(h.setAttribute("aria-hidden","true"),h.style.position="absolute",h.style.width=0,h.style.height=0,h.style.overflow="hidden",h=h,(l=document.body).firstChild?z(h,l.firstChild):l.appendChild(h))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(a,0):(t=function(){document.removeEventListener("DOMContentLoaded",t,!1),a()},document.addEventListener("DOMContentLoaded",t,!1)):document.attachEvent&&(v=a,p=c.document,i=!1,o(),p.onreadystatechange=function(){"complete"==p.readyState&&(p.onreadystatechange=null,m())})}function m(){i||(i=!0,v())}function o(){try{p.documentElement.doScroll("left")}catch(l){return void setTimeout(o,50)}m()}}(window); \ No newline at end of file diff --git a/frontend/src/assets/iconfont/iconfont.json b/frontend/src/assets/iconfont/iconfont.json index 062e2b741..efb95c41c 100644 --- a/frontend/src/assets/iconfont/iconfont.json +++ b/frontend/src/assets/iconfont/iconfont.json @@ -5,6 +5,27 @@ "css_prefix_text": "p-", "description": "", "glyphs": [ + { + "icon_id": "12959160", + "name": "腾讯云", + "font_class": "tengxunyun1", + "unicode": "e651", + "unicode_decimal": 58961 + }, + { + "icon_id": "24877229", + "name": "七牛云", + "font_class": "qiniuyun", + "unicode": "e62c", + "unicode_decimal": 58924 + }, + { + "icon_id": "19671162", + "name": "png-1", + "font_class": "file-png", + "unicode": "e7ae", + "unicode_decimal": 59310 + }, { "icon_id": "26815641", "name": "PPT", diff --git a/frontend/src/assets/iconfont/iconfont.svg b/frontend/src/assets/iconfont/iconfont.svg index 42e3cf61a..b0124106d 100644 --- a/frontend/src/assets/iconfont/iconfont.svg +++ b/frontend/src/assets/iconfont/iconfont.svg @@ -14,6 +14,12 @@ /> + + + + + + diff --git a/frontend/src/assets/iconfont/iconfont.ttf b/frontend/src/assets/iconfont/iconfont.ttf index 6cb47955f..8fb7649cc 100644 Binary files a/frontend/src/assets/iconfont/iconfont.ttf and b/frontend/src/assets/iconfont/iconfont.ttf differ diff --git a/frontend/src/assets/iconfont/iconfont.woff b/frontend/src/assets/iconfont/iconfont.woff index 4bcba45ce..2ae03b047 100644 Binary files a/frontend/src/assets/iconfont/iconfont.woff and b/frontend/src/assets/iconfont/iconfont.woff differ diff --git a/frontend/src/assets/iconfont/iconfont.woff2 b/frontend/src/assets/iconfont/iconfont.woff2 index cfe41d682..baf742125 100644 Binary files a/frontend/src/assets/iconfont/iconfont.woff2 and b/frontend/src/assets/iconfont/iconfont.woff2 differ diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 97610576c..aca99acca 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -807,6 +807,9 @@ const message = { S3: 'Amazon S3', MINIO: 'MINIO', SFTP: 'SFTP', + COS: 'Tencent COS Browser', + KODO: 'Qiniu KODO', + domain: 'Accelerate domain', backupAccount: 'Backup account', loadBucket: 'Get bucket', accountName: 'Account name', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index 9871f0851..1d9c2bf5d 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -809,6 +809,9 @@ const message = { S3: '亚马逊 S3 云存储', MINIO: 'MINIO', SFTP: 'SFTP', + COS: '腾讯云 COS Browser', + KODO: '七牛云 KODO', + domain: '加速域名', backupAccount: '备份账号', loadBucket: '获取桶', accountName: '账户名称', diff --git a/frontend/src/views/setting/backup-account/index.vue b/frontend/src/views/setting/backup-account/index.vue index f6b8bf828..531f0b033 100644 --- a/frontend/src/views/setting/backup-account/index.vue +++ b/frontend/src/views/setting/backup-account/index.vue @@ -106,6 +106,79 @@ + + +
+ +  {{ $t('setting.COS') }} +
+ + {{ $t('commons.button.edit') }} + + + {{ $t('commons.button.delete') }} + +
+ +
+
+ + {{ cosData.varsJson['region'] }} + + + {{ cosData.bucket }} + + + {{ dateFormat(0, 0, cosData.createdAt) }} + +
+ + + {{ $t('setting.createBackupAccount', ['COS']) }} + + +
+ +
+ +  {{ $t('setting.KODO') }} +
+ + {{ $t('commons.button.edit') }} + + + {{ $t('commons.button.delete') }} + +
+
+ + +
+ + {{ kodoData.varsJson['domain'] }} + + + {{ kodoData.bucket }} + + + {{ dateFormat(0, 0, kodoData.createdAt) }} + +
+ + + {{ $t('setting.createBackupAccount', ['KODO']) }} + + +
+
@@ -263,6 +336,30 @@ const s3Data = ref({ }, createdAt: new Date(), }); +const cosData = ref({ + id: 0, + type: 'COS', + accessKey: '', + bucket: '', + credential: '', + vars: '', + varsJson: { + region: '', + }, + createdAt: new Date(), +}); +const kodoData = ref({ + id: 0, + type: 'KODO', + accessKey: '', + bucket: '', + credential: '', + vars: '', + varsJson: { + domain: '', + }, + createdAt: new Date(), +}); const search = async () => { const res = await getBackupList(); @@ -287,6 +384,12 @@ const search = async () => { case 'SFTP': sftpData.value = bac; break; + case 'COS': + cosData.value = bac; + break; + case 'KODO': + kodoData.value = bac; + break; } } }; diff --git a/frontend/src/views/setting/backup-account/operate/index.vue b/frontend/src/views/setting/backup-account/operate/index.vue index 32ce9075e..a0fdbadc2 100644 --- a/frontend/src/views/setting/backup-account/operate/index.vue +++ b/frontend/src/views/setting/backup-account/operate/index.vue @@ -45,7 +45,7 @@ + + + { dialogData.value.rowData!.varsJson['dir'] = path; }; function hasBucket(val: string) { - return val === 'OSS' || val === 'S3' || val === 'MINIO'; + return val === 'OSS' || val === 'S3' || val === 'MINIO' || val === 'COS' || val === 'KODO'; +} + +function hasEndpoint(val: string) { + return val === 'OSS' || val === 'S3'; } const getBuckets = async (formEl: FormInstance | undefined) => {