From 579873f2962244ab011ad90095e75ec83141d0bb Mon Sep 17 00:00:00 2001 From: Apex Liu Date: Mon, 13 Jul 2020 11:50:03 +0800 Subject: [PATCH] fix: cannot search description and cid of host in remote ops page. --- server/www/teleport/webroot/app/model/ops.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/www/teleport/webroot/app/model/ops.py b/server/www/teleport/webroot/app/model/ops.py index a996f20..de936f8 100644 --- a/server/www/teleport/webroot/app/model/ops.py +++ b/server/www/teleport/webroot/app/model/ops.py @@ -482,7 +482,7 @@ def get_auth(auth_id): def get_all_remotes(handler, sql_filter, sql_order, sql_limit): s = SQL(get_db()) - s.select_from('host', ['id', 'name', 'ip', 'router_ip', 'router_port', 'state'], alt_name='h') + s.select_from('host', ['id', 'name', 'ip', 'router_ip', 'router_port', 'desc', 'cid', 'state'], alt_name='h') str_where = '' _where = list() @@ -492,7 +492,7 @@ def get_all_remotes(handler, sql_filter, sql_order, sql_limit): if k == 'state': _where.append('h.state={}'.format(sql_filter[k])) elif k == 'search': - _where.append('(h.name LIKE "%{k}%" OR h.ip LIKE "%{k}%" OR h.router_ip LIKE "%{k}%")'.format(k=sql_filter[k])) + _where.append('(h.name LIKE "%{k}%" OR h.ip LIKE "%{k}%" OR h.router_ip LIKE "%{k}%" OR h.desc LIKE "%{k}%" OR h.cid LIKE "%{k}%")'.format(k=sql_filter[k])) elif k == 'host_group': shg = SQL(get_db()) shg.select_from('group_map', ['mid'], alt_name='g') @@ -617,7 +617,7 @@ def get_remotes(handler, sql_filter, sql_order, sql_limit): if k == 'search': ss = SQL(get_db()) ss.select_from('host', ['id'], alt_name='h') - ss.where('(h.name LIKE "%{k}%" OR h.ip LIKE "%{k}%" OR h.router_ip LIKE "%{k}%")'.format(k=sql_filter[k])) + ss.where('(h.name LIKE "%{k}%" OR h.ip LIKE "%{k}%" OR h.router_ip LIKE "%{k}%" OR h.desc LIKE "%{k}%" OR h.cid LIKE "%{k}%")'.format(k=sql_filter[k])) err = ss.query() if err != TPE_OK: return err, 0, 1, []