mirror of https://github.com/openspug/spug
A web终端支持搜索 ip
parent
02d9563367
commit
ee58ee1845
|
@ -93,7 +93,7 @@ class Group(models.Model, ModelMixin):
|
||||||
response = dict(key=self.id, value=self.id, title=self.name, children=[])
|
response = dict(key=self.id, value=self.id, title=self.name, children=[])
|
||||||
if with_hosts:
|
if with_hosts:
|
||||||
def make_item(x):
|
def make_item(x):
|
||||||
return dict(title=x.name, key=f'{self.id}_{x.id}', id=x.id, isLeaf=True)
|
return dict(title=x.name, hostname=x.hostname, key=f'{self.id}_{x.id}', id=x.id, isLeaf=True)
|
||||||
|
|
||||||
response['children'] = [make_item(x) for x in self.hosts.all()]
|
response['children'] = [make_item(x) for x in self.hosts.all()]
|
||||||
return response
|
return response
|
||||||
|
|
|
@ -37,7 +37,7 @@ function WebSSH(props) {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (searchValue) {
|
if (searchValue) {
|
||||||
const newTreeData = rawHostList.filter(x => includes(x.title, searchValue))
|
const newTreeData = rawHostList.filter(x => includes([x.title, x.hostname], searchValue))
|
||||||
setTreeData(newTreeData)
|
setTreeData(newTreeData)
|
||||||
} else {
|
} else {
|
||||||
setTreeData(rawTreeData)
|
setTreeData(rawTreeData)
|
||||||
|
|
Loading…
Reference in New Issue