Skip to content

Commit 3d0c40e

Browse files
committed
feat: added name filter for domains list #41
1 parent c4f87fb commit 3d0c40e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

frontend/src/views/domain/DomainList.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ const {$gettext, interpolate} = useGettext()
99
import domain from '@/api/domain'
1010
import {Badge, message} from 'ant-design-vue'
1111
import {h, ref} from 'vue'
12+
import {input} from '@/components/StdDataEntry'
1213
1314
const columns = [{
1415
title: () => $gettext('Name'),
1516
dataIndex: 'name',
1617
sorter: true,
17-
pithy: true
18+
pithy: true,
19+
edit: {
20+
type: input
21+
},
22+
search: true
1823
}, {
1924
title: () => $gettext('Status'),
2025
dataIndex: 'enabled',
@@ -40,7 +45,7 @@ const columns = [{
4045
pithy: true
4146
}, {
4247
title: () => $gettext('Action'),
43-
dataIndex: 'action',
48+
dataIndex: 'action'
4449
}]
4550
4651
const table = ref(null)
@@ -85,7 +90,6 @@ function destroy(site_name: any) {
8590
<std-table
8691
:api="domain"
8792
:columns="columns"
88-
:disable_search="true"
8993
row-key="name"
9094
ref="table"
9195
@clickEdit="r => $router.push({

server/api/domain.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
)
1616

1717
func GetDomains(c *gin.Context) {
18+
name := c.Query("name")
1819
orderBy := c.Query("order_by")
1920
sort := c.DefaultQuery("sort", "desc")
2021

@@ -49,6 +50,9 @@ func GetDomains(c *gin.Context) {
4950
file := configFiles[i]
5051
fileInfo, _ := file.Info()
5152
if !file.IsDir() {
53+
if name != "" && !strings.Contains(file.Name(), name) {
54+
continue
55+
}
5256
configs = append(configs, gin.H{
5357
"name": file.Name(),
5458
"size": fileInfo.Size(),

0 commit comments

Comments
 (0)