diff --git a/apps/common/signal_handlers.py b/apps/common/signal_handlers.py
index 588a63632..b517e4575 100644
--- a/apps/common/signal_handlers.py
+++ b/apps/common/signal_handlers.py
@@ -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:
diff --git a/apps/labels/api.py b/apps/labels/api.py
index 2dc51e4b8..ccf0751b3 100644
--- a/apps/labels/api.py
+++ b/apps/labels/api.py
@@ -123,13 +123,28 @@ class LabelViewSet(OrgBulkModelViewSet):
class LabeledResourceViewSet(OrgBulkModelViewSet):
model = LabeledResource
filterset_fields = ("label__name", "label__value", "res_type", "res_id", "label")
- search_fields = filterset_fields
+ search_fields = []
serializer_classes = {
'default': serializers.LabeledResourceSerializer,
}
ordering_fields = ('res_type', 'date_created')
+ def filter_search(self, queryset):
+ keyword = self.request.query_params.get('search')
+ if not keyword:
+ return queryset
+ matched = []
+ for instance in queryset:
+ if keyword.lower() in str(instance.resource).lower():
+ matched.append(instance.id)
+ return queryset.filter(id__in=matched)
+
def get_queryset(self):
queryset = super().get_queryset()
queryset = queryset.order_by('res_type')
return queryset
+
+ def filter_queryset(self, queryset):
+ queryset = super().filter_queryset(queryset)
+ queryset = self.filter_search(queryset)
+ return queryset
diff --git a/apps/labels/models.py b/apps/labels/models.py
index 3bf9213f5..0d5874dcb 100644
--- a/apps/labels/models.py
+++ b/apps/labels/models.py
@@ -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)
diff --git a/apps/locale/zh/LC_MESSAGES/django.po b/apps/locale/zh/LC_MESSAGES/django.po
index c00048951..e91b1891f 100644
--- a/apps/locale/zh/LC_MESSAGES/django.po
+++ b/apps/locale/zh/LC_MESSAGES/django.po
@@ -6904,7 +6904,7 @@ msgstr ""
"这些账号用于连接发布的应用,账号现在分为两种类型:
一种是专用的,每个用"
"户都有一个专用账号。 另一种是公共的,当应用不支持多开且专用的已经被使用时,会"
"使用公共账号连接;
注意: 如果不开启自动创建账号, 当前发布机仅能被指定标"
-"签的资产调度到,默认不会放到调度池中"
+"签的资产调度到,默认不会放到调度池中,且需要手动维护账号"
#: terminal/serializers/applet_host.py:92
msgid "The number of public accounts created automatically"