mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2024-11-25 03:29:13 +08:00
feat: dns 账号增加名称校验,查看密钥改为编辑按钮
This commit is contained in:
parent
58ce2055fd
commit
716b30d169
@ -16,13 +16,13 @@ func (w WebsiteDnsAccountRepo) Page(page, size int, opts ...DBOption) (int64, []
|
||||
return count, accounts, err
|
||||
}
|
||||
|
||||
func (w WebsiteDnsAccountRepo) GetFirst(opts ...DBOption) (model.WebsiteDnsAccount, error) {
|
||||
func (w WebsiteDnsAccountRepo) GetFirst(opts ...DBOption) (*model.WebsiteDnsAccount, error) {
|
||||
var account model.WebsiteDnsAccount
|
||||
db := getDb(opts...).Model(&model.WebsiteDnsAccount{})
|
||||
if err := db.First(&account).Error; err != nil {
|
||||
return account, err
|
||||
return nil, err
|
||||
}
|
||||
return account, nil
|
||||
return &account, nil
|
||||
}
|
||||
|
||||
func (w WebsiteDnsAccountRepo) Create(account model.WebsiteDnsAccount) error {
|
||||
|
@ -28,6 +28,11 @@ func (w WebsiteDnsAccountService) Page(search dto.PageInfo) (int64, []response.W
|
||||
}
|
||||
|
||||
func (w WebsiteDnsAccountService) Create(create request.WebsiteDnsAccountCreate) (request.WebsiteDnsAccountCreate, error) {
|
||||
exist, _ := websiteDnsRepo.GetFirst(commonRepo.WithByName(create.Name))
|
||||
if exist != nil {
|
||||
return request.WebsiteDnsAccountCreate{}, buserr.New(constant.ErrNameIsExist)
|
||||
}
|
||||
|
||||
authorization, err := json.Marshal(create.Authorization)
|
||||
if err != nil {
|
||||
return request.WebsiteDnsAccountCreate{}, err
|
||||
|
@ -11,7 +11,7 @@
|
||||
<el-col :span="22" :offset="1">
|
||||
<el-form ref="accountForm" label-position="top" :model="account" :rules="rules">
|
||||
<el-form-item :label="$t('commons.table.name')" prop="name">
|
||||
<el-input v-model="account.name"></el-input>
|
||||
<el-input v-model.trim="account.name"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('website.type')" prop="type">
|
||||
<el-select v-model="account.type" :disabled="accountData.mode === 'edit'">
|
||||
@ -79,14 +79,14 @@ const accountData = ref<AccountProps>({
|
||||
});
|
||||
|
||||
const types = [
|
||||
{
|
||||
label: 'DnsPod',
|
||||
value: 'DnsPod',
|
||||
},
|
||||
{
|
||||
label: i18n.global.t('website.aliyun'),
|
||||
value: 'AliYun',
|
||||
},
|
||||
{
|
||||
label: 'DnsPod',
|
||||
value: 'DnsPod',
|
||||
},
|
||||
{
|
||||
label: 'CloudFlare',
|
||||
value: 'CloudFlare',
|
||||
@ -111,7 +111,7 @@ let rules = ref({
|
||||
let account = ref({
|
||||
id: 0,
|
||||
name: '',
|
||||
type: 'DnsPod',
|
||||
type: 'AliYun',
|
||||
authorization: {},
|
||||
});
|
||||
const em = defineEmits(['close']);
|
||||
|
@ -16,11 +16,6 @@
|
||||
<span v-else>{{ row.type }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('website.key')">
|
||||
<template #default="{ row }">
|
||||
<el-link type="primary" @click="openEdit(row)">{{ $t('website.check') }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<fu-table-operations
|
||||
:ellipsis="1"
|
||||
:buttons="buttons"
|
||||
@ -54,9 +49,15 @@ let loading = ref(false);
|
||||
let open = ref(false);
|
||||
|
||||
const buttons = [
|
||||
{
|
||||
label: i18n.global.t('commons.button.edit'),
|
||||
click: function (row: Website.DnsAccount) {
|
||||
openEdit(row);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: i18n.global.t('app.delete'),
|
||||
click: function (row: Website.Website) {
|
||||
click: function (row: Website.DnsAccount) {
|
||||
deleteAccount(row.id);
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user