From f812c8d009ab4a27e3dd6ad908393b421539d40c Mon Sep 17 00:00:00 2001 From: ycggyao Date: Fri, 17 Jan 2025 11:36:59 +0800 Subject: [PATCH] =?UTF-8?q?feat(backend):=20=E5=AE=9E=E4=BE=8B=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E3=80=81=E5=AE=9E=E4=BE=8B=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AD=97=E6=AE=B5=20#9119=20#=20Reviewed,=20?= =?UTF-8?q?transaction=20id:=2029504?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbm-ui/backend/db_services/dbbase/resources/query.py | 6 ++++++ dbm-ui/backend/db_services/mongodb/resources/query.py | 3 +++ .../db_services/mysql/resources/tendbcluster/query.py | 3 +++ dbm-ui/backend/db_services/quick_search/handlers.py | 3 +++ 4 files changed, 15 insertions(+) diff --git a/dbm-ui/backend/db_services/dbbase/resources/query.py b/dbm-ui/backend/db_services/dbbase/resources/query.py index 393d65c4fd..078fc4bef8 100644 --- a/dbm-ui/backend/db_services/dbbase/resources/query.py +++ b/dbm-ui/backend/db_services/dbbase/resources/query.py @@ -735,6 +735,9 @@ def _filter_instance_qs(cls, query_filters: Q, query_params: Dict[str, str]) -> "machine__machine_type", "machine__bk_sub_zone", "machine__bk_sub_zone_id", + "machine__bk_os_name", + "machine__bk_rack_id", + "machine__bk_svr_device_cls_name", ] # 获取storage实例的查询集 storage_queryset = ( @@ -790,6 +793,9 @@ def _to_instance_representation( "instance_address": f"{instance['machine__ip']}{IP_PORT_DIVIDER}{instance['port']}", "bk_host_id": instance["machine__bk_host_id"], "machine_type": instance["machine__machine_type"], + "bk_os_name": instance["machine__bk_os_name"], + "bk_rack_id": instance["machine__bk_rack_id"], + "bk_svr_device_cls_name": instance["machine__bk_svr_device_cls_name"], "role": instance["role"], "master_domain": cluster_entry_map.get(instance["cluster__id"], {}).get("master_domain", ""), "slave_domain": cluster_entry_map.get(instance["cluster__id"], {}).get("slave_domain", ""), diff --git a/dbm-ui/backend/db_services/mongodb/resources/query.py b/dbm-ui/backend/db_services/mongodb/resources/query.py index 429cd9af5c..ae8cc1658a 100644 --- a/dbm-ui/backend/db_services/mongodb/resources/query.py +++ b/dbm-ui/backend/db_services/mongodb/resources/query.py @@ -255,6 +255,9 @@ def _filter_instance_qs(cls, query_filters: Q, query_params: Dict[str, str]) -> "machine__spec_config", "machine__bk_sub_zone", "machine__bk_sub_zone_id", + "machine__bk_os_name", + "machine__bk_rack_id", + "machine__bk_svr_device_cls_name", "shard", ] storage_instance = ( diff --git a/dbm-ui/backend/db_services/mysql/resources/tendbcluster/query.py b/dbm-ui/backend/db_services/mysql/resources/tendbcluster/query.py index add7d63cab..3acfc2661c 100644 --- a/dbm-ui/backend/db_services/mysql/resources/tendbcluster/query.py +++ b/dbm-ui/backend/db_services/mysql/resources/tendbcluster/query.py @@ -201,6 +201,9 @@ def _filter_instance_qs(cls, query_filters, query_params): "machine__machine_type", "machine__bk_sub_zone", "machine__bk_sub_zone_id", + "machine__bk_os_name", + "machine__bk_rack_id", + "machine__bk_svr_device_cls_name", ] # 获取remote实例的查询集 diff --git a/dbm-ui/backend/db_services/quick_search/handlers.py b/dbm-ui/backend/db_services/quick_search/handlers.py index 2ec7e0e10c..af878d5c51 100644 --- a/dbm-ui/backend/db_services/quick_search/handlers.py +++ b/dbm-ui/backend/db_services/quick_search/handlers.py @@ -210,6 +210,9 @@ def filter_instance(self, keyword_list: list): "bk_idc_area": F("machine__bk_idc_area"), "bk_idc_name": F("machine__bk_idc_name"), "bk_sub_zone": F("machine__bk_sub_zone"), + "bk_os_name": F("machine__bk_os_name"), + "bk_rack_id": F("machine__bk_rack_id"), + "bk_svr_device_cls_name": F("machine__bk_svr_device_cls_name"), "ip_port": Concat("machine__ip", Value(":"), "port", output_field=CharField()), } fields = [