Skip to content

Commit 16aed0c

Browse files
committed
enhance(dns_credential): add provider and name filtering options
1 parent a95b2d7 commit 16aed0c

File tree

2 files changed

+32
-2
lines changed

2 files changed

+32
-2
lines changed

api/certificate/dns_credential.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ func GetDnsCredential(c *gin.Context) {
3636
}
3737

3838
func GetDnsCredentialList(c *gin.Context) {
39-
cosy.Core[model.DnsCredential](c).SetFussy("provider").PagingList()
39+
cosy.Core[model.DnsCredential](c).
40+
SetEqual("provider").
41+
SetFussy("name").
42+
PagingList()
4043
}
4144

4245
type DnsCredentialManageJson struct {

app/src/views/certificate/DNSCredential.vue

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
<script setup lang="tsx">
22
import type { CustomRenderArgs, StdTableColumn } from '@uozi-admin/curd'
3+
import type { DNSProvider } from '@/api/auto_cert'
34
import type { DnsCredential } from '@/api/dns_credential'
45
import { datetimeRender, StdCurd } from '@uozi-admin/curd'
6+
import auto_cert from '@/api/auto_cert'
57
import dns_credential from '@/api/dns_credential'
68
import DNSChallenge from './components/DNSChallenge.vue'
79
10+
const dnsProviders = ref<DNSProvider[]>([])
11+
12+
onMounted(async () => {
13+
dnsProviders.value = await auto_cert.get_dns_providers()
14+
})
15+
816
const columns: StdTableColumn[] = [{
917
title: () => $gettext('Name'),
1018
dataIndex: 'name',
@@ -13,14 +21,33 @@ const columns: StdTableColumn[] = [{
1321
edit: {
1422
type: 'input',
1523
},
24+
search: true,
1625
}, {
1726
title: () => $gettext('Provider'),
18-
dataIndex: ['config', 'name'],
27+
dataIndex: 'provider',
1928
customRender: ({ record }: CustomRenderArgs) => {
2029
return record.provider
2130
},
2231
sorter: true,
2332
pure: true,
33+
search: {
34+
type: 'select',
35+
select: {
36+
remote: {
37+
valueKey: 'name',
38+
labelKey: 'name',
39+
api: async () => {
40+
return {
41+
data: await auto_cert.get_dns_providers(),
42+
}
43+
},
44+
},
45+
showSearch: true,
46+
filterOption: (input, option) => {
47+
return option?.label?.toLowerCase().includes(input.toLowerCase()) ?? false
48+
},
49+
},
50+
},
2451
}, {
2552
title: () => $gettext('Configuration'),
2653
dataIndex: 'code',

0 commit comments

Comments
 (0)