From f937dc3cd275de981116a21e438490ad5b76bfab Mon Sep 17 00:00:00 2001 From: iSecloud <869820505@qq.com> Date: Wed, 6 Nov 2024 17:10:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(backend):=20=E8=A1=A5=E5=85=85=E9=9B=86?= =?UTF-8?q?=E7=BE=A4=E5=AE=9E=E4=BE=8B=E5=AD=97=E6=AE=B5=20#7774?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dbm-ui/backend/db_meta/models/instance.py | 1 + dbm-ui/backend/db_services/dbbase/resources/query.py | 5 +++++ dbm-ui/backend/db_services/mongodb/resources/query.py | 2 ++ .../db_services/mysql/resources/tendbcluster/query.py | 2 ++ 4 files changed, 10 insertions(+) diff --git a/dbm-ui/backend/db_meta/models/instance.py b/dbm-ui/backend/db_meta/models/instance.py index 36da3e8b7c..0531384ce7 100644 --- a/dbm-ui/backend/db_meta/models/instance.py +++ b/dbm-ui/backend/db_meta/models/instance.py @@ -57,6 +57,7 @@ def simple_desc(self): "bk_host_id": self.machine.bk_host_id, "bk_cloud_id": self.machine.bk_cloud_id, "spec_config": self.machine.spec_config, + "bk_sub_zone": self.machine.bk_sub_zone, "bk_biz_id": self.bk_biz_id, } diff --git a/dbm-ui/backend/db_services/dbbase/resources/query.py b/dbm-ui/backend/db_services/dbbase/resources/query.py index 6c39761d00..96e4af33da 100644 --- a/dbm-ui/backend/db_services/dbbase/resources/query.py +++ b/dbm-ui/backend/db_services/dbbase/resources/query.py @@ -602,6 +602,7 @@ def _to_cluster_representation( "cluster_stats": cluster_stats_map.get(cluster.immute_domain, {}), "cluster_type": cluster.cluster_type, "cluster_type_name": ClusterType.get_choice_label(cluster.cluster_type), + "disaster_tolerance_level": cluster.disaster_tolerance_level, "master_domain": cluster_entry_map_value.get("master_domain", ""), "slave_domain": cluster_entry_map_value.get("slave_domain", ""), "cluster_entry": cluster_entry, @@ -734,6 +735,8 @@ def _filter_instance_qs(cls, query_filters: Q, query_params: Dict[str, str]) -> "machine__bk_host_id", "machine__spec_config", "machine__machine_type", + "machine__bk_sub_zone", + "machine__bk_sub_zone_id", ] # 获取storage实例的查询集 storage_queryset = ( @@ -781,6 +784,8 @@ def _to_instance_representation( "db_module_name": db_module_names_map.get(instance["cluster__db_module_id"], ""), "bk_cloud_id": instance["machine__bk_cloud_id"], "bk_cloud_name": bk_cloud_name, + "bk_sub_zone": instance["machine__bk_sub_zone"], + "bk_sub_zone_id": instance["machine__bk_sub_zone_id"], "ip": instance["machine__ip"], "port": instance["port"], "instance_address": f"{instance['machine__ip']}{IP_PORT_DIVIDER}{instance['port']}", diff --git a/dbm-ui/backend/db_services/mongodb/resources/query.py b/dbm-ui/backend/db_services/mongodb/resources/query.py index 8402a8652e..28cd2d1d26 100644 --- a/dbm-ui/backend/db_services/mongodb/resources/query.py +++ b/dbm-ui/backend/db_services/mongodb/resources/query.py @@ -172,6 +172,8 @@ def _filter_instance_qs(cls, query_filters: Q, query_params: Dict[str, str]) -> "machine__bk_host_id", "machine__machine_type", "machine__spec_config", + "machine__bk_sub_zone", + "machine__bk_sub_zone_id", "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 3d17560635..9831143a46 100644 --- a/dbm-ui/backend/db_services/mysql/resources/tendbcluster/query.py +++ b/dbm-ui/backend/db_services/mysql/resources/tendbcluster/query.py @@ -203,6 +203,8 @@ def _filter_instance_qs(cls, query_filters, query_params): "machine__ip", "machine__bk_cloud_id", "machine__machine_type", + "machine__bk_sub_zone", + "machine__bk_sub_zone_id", ] # 获取remote实例的查询集