From ee58ee1845182cdf640139c602c02d555671dc10 Mon Sep 17 00:00:00 2001 From: vapao Date: Fri, 18 Feb 2022 21:29:07 +0800 Subject: [PATCH] =?UTF-8?q?A=20web=E7=BB=88=E7=AB=AF=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=20ip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/host/models.py | 2 +- spug_web/src/pages/ssh/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spug_api/apps/host/models.py b/spug_api/apps/host/models.py index 872bd96..6845976 100644 --- a/spug_api/apps/host/models.py +++ b/spug_api/apps/host/models.py @@ -93,7 +93,7 @@ class Group(models.Model, ModelMixin): response = dict(key=self.id, value=self.id, title=self.name, children=[]) if with_hosts: 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()] return response diff --git a/spug_web/src/pages/ssh/index.js b/spug_web/src/pages/ssh/index.js index 9967bb0..440276c 100644 --- a/spug_web/src/pages/ssh/index.js +++ b/spug_web/src/pages/ssh/index.js @@ -37,7 +37,7 @@ function WebSSH(props) { useEffect(() => { if (searchValue) { - const newTreeData = rawHostList.filter(x => includes(x.title, searchValue)) + const newTreeData = rawHostList.filter(x => includes([x.title, x.hostname], searchValue)) setTreeData(newTreeData) } else { setTreeData(rawTreeData)