mirror of https://github.com/jumpserver/jumpserver
perf: 修改搜索
parent
4d15e46ceb
commit
88b9a4d693
|
@ -69,7 +69,7 @@ def digest_sql_query():
|
|||
|
||||
for query in queries:
|
||||
sql = query['sql']
|
||||
# print(" # {}: {}".format(query['time'], sql))
|
||||
print(" # {}: {}".format(query['time'], sql))
|
||||
if len(queries) < 3:
|
||||
continue
|
||||
print("- Table: {}".format(table_name))
|
||||
|
@ -77,7 +77,7 @@ def digest_sql_query():
|
|||
sql = query['sql']
|
||||
if not sql or not sql.startswith('SELECT'):
|
||||
continue
|
||||
# print('\t{}. {}'.format(i, sql))
|
||||
print('\t{}. {}'.format(i, sql))
|
||||
|
||||
logger.debug(">>> [{}] {}".format(method, path))
|
||||
for name, counter in counters:
|
||||
|
|
|
@ -129,6 +129,7 @@ class LabeledResourceViewSet(OrgBulkModelViewSet):
|
|||
}
|
||||
ordering_fields = ('res_type', 'date_created')
|
||||
|
||||
# Todo: 这里需要优化,查询 sql 太多
|
||||
def filter_search(self, queryset):
|
||||
keyword = self.request.query_params.get('search')
|
||||
if not keyword:
|
||||
|
|
|
@ -40,5 +40,5 @@ class LabeledResource(JMSOrgBaseModel):
|
|||
unique_together = [('label', 'res_type', 'res_id', 'org_id')]
|
||||
verbose_name = _('Labeled resource')
|
||||
|
||||
# def __str__(self):
|
||||
# return '{} => {}'.format(self.label, self.resource)
|
||||
def __str__(self):
|
||||
return '{} => {}'.format(self.label, self.resource)
|
||||
|
|
Loading…
Reference in New Issue