1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 16:29:17 +08:00

feat: 页面增加腾讯云、阿里云备份账号

This commit is contained in:
ssongliu 2023-04-05 21:58:28 +08:00 committed by ssongliu
parent 2585801f8a
commit a434bbbc12
14 changed files with 171 additions and 11 deletions

View File

@ -59,7 +59,7 @@ type BackupRecords struct {
} }
type DownloadRecord 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"` FileDir string `json:"fileDir" validate:"required"`
FileName string `json:"fileName" validate:"required"` FileName string `json:"fileName" validate:"required"`
} }

View File

@ -49,7 +49,7 @@ type PortUpdate struct {
} }
type SnapshotCreate 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"` Description string `json:"description"`
} }
type SnapshotRecover struct { type SnapshotRecover struct {

View File

@ -57,7 +57,7 @@ func (cos cosClient) ListBuckets() ([]interface{}, error) {
} }
var datas []interface{} var datas []interface{}
for _, bucket := range buckets.Buckets { for _, bucket := range buckets.Buckets {
datas = append(datas, bucket) datas = append(datas, bucket.Name)
} }
return datas, nil return datas, nil
} }

View File

@ -1,9 +1,9 @@
@font-face { @font-face {
font-family: "panel"; /* Project id 3575356 */ font-family: "panel"; /* Project id 3575356 */
src: url('iconfont.woff2?t=1673865903517') format('woff2'), src: url('iconfont.woff2?t=1680702361679') format('woff2'),
url('iconfont.woff?t=1673865903517') format('woff'), url('iconfont.woff?t=1680702361679') format('woff'),
url('iconfont.ttf?t=1673865903517') format('truetype'), url('iconfont.ttf?t=1680702361679') format('truetype'),
url('iconfont.svg?t=1673865903517#panel') format('svg'); url('iconfont.svg?t=1680702361679#panel') format('svg');
} }
.panel { .panel {
@ -14,6 +14,18 @@
-moz-osx-font-smoothing: grayscale; -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 { .p-file-ppt:before {
content: "\e6e2"; content: "\e6e2";
} }

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,27 @@
"css_prefix_text": "p-", "css_prefix_text": "p-",
"description": "", "description": "",
"glyphs": [ "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", "icon_id": "26815641",
"name": "PPT", "name": "PPT",

View File

@ -14,6 +14,12 @@
/> />
<missing-glyph /> <missing-glyph />
<glyph glyph-name="tengxunyun1" unicode="&#58961;" d="M512 725.333333c130.474667 0 240.938667-83.797333 277.930667-199.296a198.826667 198.826667 0 0 1-41.557334 0.597334 222.293333 222.293333 0 0 1-49.706666-10.624C668.202667 586.666667 596.096 636.245333 512 636.245333c-100.266667 0-183.466667-70.528-199.381333-163.029333a279.04 279.04 0 0 1-89.429334 3.84C241.28 617.045333 363.690667 725.333333 512 725.333333zM258.474667 478.677333c54.442667 0 104.192-20.181333 142.165333-53.418666 16.085333-14.08 45.226667-39.68 87.381333-76.8l-7.381333 6.528-61.568-60.885334-54.4 54.4c-34.218667 34.261333-66.090667 47.957333-106.197333 47.957334a133.589333 133.589333 0 0 1 0-267.221334c10.666667 0 29.312-0.768 56.064-2.346666l-90.453334-77.141334A215.893333 215.893333 0 0 0 258.432 478.72zM674.346667 461.525333a215.808 215.808 0 0 0 168.618666-397.354666c-15.36-6.485333-38.186667-15.957333-63.146666-16.213334-72.106667-0.597333-244.181333-0.896-516.352-0.938666h-42.666667a206248.106667 206248.106667 0 0 1 397.013333 380.714666c18.261333 17.578667 41.130667 27.264 56.533334 33.792z m41.856-80.554666c-9.258667-3.925333-23.04-9.770667-34.048-20.352-30.165333-29.098667-109.952-105.642667-239.445334-229.632h53.418667c148.181333 0 242.773333 0.213333 283.733333 0.554666 15.061333 0.128 28.842667 5.845333 38.101334 9.813334a130.133333 130.133333 0 0 1-101.76 239.616z" horiz-adv-x="1024" />
<glyph glyph-name="qiniuyun" unicode="&#58924;" d="M512-42.667c235.648 0 426.667 191.019 426.667 426.667S747.648 810.667 512 810.667 85.333 619.648 85.333 384 276.352-42.667 512-42.667z m290.73 597.078c3.969 0.896 6.145-0.854 7.169-2.688 1.664-2.987 0.085-7.168 0.085-7.168-42.155-120.192-158.293-202.07-297.941-201.515h-0.086a339.883 339.883 0 0 0-81.365 9.43l35.541-119.723s1.963-16.342 20.95-16.342h57.002s24.875-1.92 30.464 19.328c5.334 20.182 25.6 67.414 25.6 67.414s6.315 19.2 25.088 32.512c18.774 13.312 28.032 13.013 29.227 12.288 0.981-0.64 0.64-2.176 0.64-2.176l-19.499-113.536c-2.176-37.078-28.8-61.568-64.341-61.568H464.939c-35.499 0-62.848 22.4-64.299 61.568l-21.376 137.301c-77.568 33.28-137.472 95.83-165.248 175.019 0 0-1.579 4.224 0.085 7.168 1.024 1.877 3.2 3.584 7.168 2.688 1.152-0.256 4.182-3.755 9.174-9.472 18.773-21.632 65.066-75.094 142.848-106.966l-7.979 56.747s-0.17 1.28 0.81 2.432c1.067 1.28 6.273 2.688 15.19-1.792a32.213 32.213 0 0 0 15.957-19.328l15.702-51.499a351.147 351.147 0 0 1 98.986-11.733h0.086c164.01-3.37 253.525 99.84 281.514 132.139 4.992 5.717 8.022 9.216 9.174 9.472z" horiz-adv-x="1024" />
<glyph glyph-name="file-png" unicode="&#59310;" d="M137.90231 896C110.10583 895.29856 87.74167 872.89856 87.04023 845.06624V-72.34559999999999a48.70656 48.70656 0 0 1 15.27296-35.6352 49.9712 49.9712 0 0 1 35.58912-15.29856h746.33728a48.64 48.64 0 0 1 35.58912 15.29344 50.37056 50.37056 0 0 1 15.27296 35.64032V607.2832000000001L646.72791 896H137.90231zM935.10167 607.2832000000001h-237.44512c-27.82208 0.6656-50.2272 23.07584-50.92864 50.93376V896l288.37376-288.7168zM299.05943 505.34912h84.7872v-84.91008H299.05943V505.344z m169.57952 0h84.79744v-84.91008H468.63383V505.344z m169.65632 0h84.7872v-84.91008h-84.7872V505.344zM383.84663 420.43904h84.79232v-84.9152h-84.7872V420.43904z m169.58976 0h84.85888v-84.9152H553.43639V420.43904zM383.84663 250.61375999999996h84.79232v-84.97664h-84.7872v84.97664z m169.58976 0h84.85888v-84.97664H553.43639v84.97664z m-254.38208 84.91008H383.84663v-84.91008H299.05943v84.91008z m169.58464 0h84.79744v-84.91008H468.63383v84.91008z m169.65632 0h84.7872v-84.91008h-84.7872v84.91008z m-339.24096-169.88672H383.84663v-85.0432H299.05943v85.0432z m169.58464 0h84.79744v-85.0432H468.63383v85.0432z m169.65632 0h84.7872v-85.0432h-84.7872v85.0432z" horiz-adv-x="1024" />
<glyph glyph-name="file-ppt" unicode="&#59106;" d="M661.944889 822.855111H146.289778a36.679111 36.679111 0 0 1-36.579556-36.565333v-804.579556a36.679111 36.679111 0 0 1 36.579556-36.565333h731.420444a36.679111 36.679111 0 0 1 36.579556 36.565333v588.8L661.944889 822.855111zM661.944889 607.089778a36.679111 36.679111 0 0 1 36.565333-36.579556h215.779556L661.944889 822.855111v-215.765333zM512 475.434667h-140.8v-354.744889h91.434667v124.344889h53.020444c104.234667 0 166.4 43.875556 166.4 118.855111-1.820444 73.144889-58.510222 111.544889-170.055111 111.544889z m-49.365333-62.179556h43.875555c60.344889 0 84.124444-14.620444 84.124445-51.2 0-38.4-27.434667-56.689778-82.289778-56.689778H460.8v107.889778h1.834667z" horiz-adv-x="1024" /> <glyph glyph-name="file-ppt" unicode="&#59106;" d="M661.944889 822.855111H146.289778a36.679111 36.679111 0 0 1-36.579556-36.565333v-804.579556a36.679111 36.679111 0 0 1 36.579556-36.565333h731.420444a36.679111 36.679111 0 0 1 36.579556 36.565333v588.8L661.944889 822.855111zM661.944889 607.089778a36.679111 36.679111 0 0 1 36.565333-36.579556h215.779556L661.944889 822.855111v-215.765333zM512 475.434667h-140.8v-354.744889h91.434667v124.344889h53.020444c104.234667 0 166.4 43.875556 166.4 118.855111-1.820444 73.144889-58.510222 111.544889-170.055111 111.544889z m-49.365333-62.179556h43.875555c60.344889 0 84.124444-14.620444 84.124445-51.2 0-38.4-27.434667-56.689778-82.289778-56.689778H460.8v107.889778h1.834667z" horiz-adv-x="1024" />
<glyph glyph-name="file-html" unicode="&#53539;" d="M661.944889 822.855111H146.289778a36.679111 36.679111 0 0 1-36.579556-36.565333v-804.579556a36.679111 36.679111 0 0 1 36.579556-36.565333h731.420444a36.679111 36.679111 0 0 1 36.579556 36.565333v588.8L661.944889 822.855111zM661.944889 607.089778a36.679111 36.679111 0 0 1 36.565333-36.579556h215.779556L661.944889 822.855111v-215.765333zM332.8 290.74488899999994l-31.089778 10.965333 104.234667 32.924445v71.310222L204.8 327.31022199999995v-53.020444l201.144889-78.634667v71.310222L332.8 290.74488899999994z m106.055111-193.834667h58.510222l80.469334 362.055111h-58.524445l-80.455111-362.055111zM819.2 329.14488900000003l-201.144889 76.8v-71.310222l73.144889-21.944889 31.089778-10.979556-104.234667-34.744889v-71.310222L819.2 274.28977799999996v54.855111z" horiz-adv-x="1024" /> <glyph glyph-name="file-html" unicode="&#53539;" d="M661.944889 822.855111H146.289778a36.679111 36.679111 0 0 1-36.579556-36.565333v-804.579556a36.679111 36.679111 0 0 1 36.579556-36.565333h731.420444a36.679111 36.679111 0 0 1 36.579556 36.565333v588.8L661.944889 822.855111zM661.944889 607.089778a36.679111 36.679111 0 0 1 36.565333-36.579556h215.779556L661.944889 822.855111v-215.765333zM332.8 290.74488899999994l-31.089778 10.965333 104.234667 32.924445v71.310222L204.8 327.31022199999995v-53.020444l201.144889-78.634667v71.310222L332.8 290.74488899999994z m106.055111-193.834667h58.510222l80.469334 362.055111h-58.524445l-80.455111-362.055111zM819.2 329.14488900000003l-201.144889 76.8v-71.310222l73.144889-21.944889 31.089778-10.979556-104.234667-34.744889v-71.310222L819.2 274.28977799999996v54.855111z" horiz-adv-x="1024" />

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

@ -807,6 +807,9 @@ const message = {
S3: 'Amazon S3', S3: 'Amazon S3',
MINIO: 'MINIO', MINIO: 'MINIO',
SFTP: 'SFTP', SFTP: 'SFTP',
COS: 'Tencent COS Browser',
KODO: 'Qiniu KODO',
domain: 'Accelerate domain',
backupAccount: 'Backup account', backupAccount: 'Backup account',
loadBucket: 'Get bucket', loadBucket: 'Get bucket',
accountName: 'Account name', accountName: 'Account name',

View File

@ -809,6 +809,9 @@ const message = {
S3: '亚马逊 S3 云存储', S3: '亚马逊 S3 云存储',
MINIO: 'MINIO', MINIO: 'MINIO',
SFTP: 'SFTP', SFTP: 'SFTP',
COS: '腾讯云 COS Browser',
KODO: '七牛云 KODO',
domain: '加速域名',
backupAccount: '备份账号', backupAccount: '备份账号',
loadBucket: '获取桶', loadBucket: '获取桶',
accountName: '账户名称', accountName: '账户名称',

View File

@ -106,6 +106,79 @@
</el-alert> </el-alert>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20" style="margin-top: 20px">
<el-col :span="12">
<div>
<svg-icon style="font-size: 7px" iconName="p-tengxunyun1"></svg-icon>
<span style="font-size: 14px; font-weight: 500">&nbsp;{{ $t('setting.COS') }}</span>
<div style="float: right">
<el-button
round
:disabled="cosData.id === 0"
@click="onOpenDialog('edit', 'COS', cosData)"
>
{{ $t('commons.button.edit') }}
</el-button>
<el-button round :disabled="s3Data.id === 0" @click="onBatchDelete(cosData)">
{{ $t('commons.button.delete') }}
</el-button>
</div>
<el-divider class="devider" />
</div>
<div v-if="cosData.id !== 0" style="margin-left: 20px">
<el-form-item label="Region">
{{ cosData.varsJson['region'] }}
</el-form-item>
<el-form-item label="Bucket">
{{ cosData.bucket }}
</el-form-item>
<el-form-item :label="$t('commons.table.createdAt')">
{{ dateFormat(0, 0, cosData.createdAt) }}
</el-form-item>
</div>
<el-alert v-else center class="alert" style="height: 167px" :closable="false">
<el-button size="large" round plain type="primary" @click="onOpenDialog('create', 'COS')">
{{ $t('setting.createBackupAccount', ['COS']) }}
</el-button>
</el-alert>
</el-col>
<el-col :span="12">
<div>
<svg-icon style="font-size: 7px" iconName="p-qiniuyun"></svg-icon>
<span style="font-size: 14px; font-weight: 500">&nbsp;{{ $t('setting.KODO') }}</span>
<div style="float: right">
<el-button
round
:disabled="kodoData.id === 0"
@click="onOpenDialog('edit', 'KODO', kodoData)"
>
{{ $t('commons.button.edit') }}
</el-button>
<el-button round :disabled="kodoData.id === 0" @click="onBatchDelete(kodoData)">
{{ $t('commons.button.delete') }}
</el-button>
</div>
</div>
<el-divider class="devider" />
<div v-if="kodoData.id !== 0" style="margin-left: 20px">
<el-form-item :label="$t('setting.domain')">
{{ kodoData.varsJson['domain'] }}
</el-form-item>
<el-form-item label="Bucket">
{{ kodoData.bucket }}
</el-form-item>
<el-form-item :label="$t('commons.table.createdAt')">
{{ dateFormat(0, 0, kodoData.createdAt) }}
</el-form-item>
</div>
<el-alert v-else center class="alert" style="height: 167px" :closable="false">
<el-button size="large" round plain type="primary" @click="onOpenDialog('create', 'KODO')">
{{ $t('setting.createBackupAccount', ['KODO']) }}
</el-button>
</el-alert>
</el-col>
</el-row>
<el-row :gutter="20" style="margin-top: 20px"> <el-row :gutter="20" style="margin-top: 20px">
<el-col :span="12"> <el-col :span="12">
<div> <div>
@ -263,6 +336,30 @@ const s3Data = ref<Backup.BackupInfo>({
}, },
createdAt: new Date(), createdAt: new Date(),
}); });
const cosData = ref<Backup.BackupInfo>({
id: 0,
type: 'COS',
accessKey: '',
bucket: '',
credential: '',
vars: '',
varsJson: {
region: '',
},
createdAt: new Date(),
});
const kodoData = ref<Backup.BackupInfo>({
id: 0,
type: 'KODO',
accessKey: '',
bucket: '',
credential: '',
vars: '',
varsJson: {
domain: '',
},
createdAt: new Date(),
});
const search = async () => { const search = async () => {
const res = await getBackupList(); const res = await getBackupList();
@ -287,6 +384,12 @@ const search = async () => {
case 'SFTP': case 'SFTP':
sftpData.value = bac; sftpData.value = bac;
break; break;
case 'COS':
cosData.value = bac;
break;
case 'KODO':
kodoData.value = bac;
break;
} }
} }
}; };

View File

@ -45,7 +45,7 @@
<el-input show-password clearable v-model.trim="dialogData.rowData!.credential" /> <el-input show-password clearable v-model.trim="dialogData.rowData!.credential" />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="dialogData.rowData!.type === 'S3'" v-if="dialogData.rowData!.type === 'S3' || dialogData.rowData!.type === 'COS'"
label="Region" label="Region"
prop="varsJson.region" prop="varsJson.region"
:rules="Rules.requiredInput" :rules="Rules.requiredInput"
@ -53,13 +53,21 @@
<el-input v-model.trim="dialogData.rowData!.varsJson['region']" /> <el-input v-model.trim="dialogData.rowData!.varsJson['region']" />
</el-form-item> </el-form-item>
<el-form-item <el-form-item
v-if="hasBucket(dialogData.rowData!.type) && dialogData.rowData!.type !== 'MINIO'" v-if="hasEndpoint(dialogData.rowData!.type)"
label="Endpoint" label="Endpoint"
prop="varsJson.endpoint" prop="varsJson.endpoint"
:rules="Rules.requiredInput" :rules="Rules.requiredInput"
> >
<el-input v-model.trim="dialogData.rowData!.varsJson['endpoint']" /> <el-input v-model.trim="dialogData.rowData!.varsJson['endpoint']" />
</el-form-item> </el-form-item>
<el-form-item
v-if="dialogData.rowData!.type === 'KODO'"
:label="$t('setting.domain')"
prop="varsJson.domain"
:rules="Rules.requiredInput"
>
<el-input v-model.trim="dialogData.rowData!.varsJson['domain']" />
</el-form-item>
<el-form-item <el-form-item
v-if="dialogData.rowData!.type === 'MINIO'" v-if="dialogData.rowData!.type === 'MINIO'"
label="Endpoint" label="Endpoint"
@ -199,7 +207,11 @@ const loadDir = async (path: string) => {
dialogData.value.rowData!.varsJson['dir'] = path; dialogData.value.rowData!.varsJson['dir'] = path;
}; };
function hasBucket(val: string) { 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) => { const getBuckets = async (formEl: FormInstance | undefined) => {