Skip to content

Commit

Permalink
feat(backend): 补充集群实例字段 TencentBlueKing#7774
Browse files Browse the repository at this point in the history
  • Loading branch information
iSecloud committed Nov 6, 2024
1 parent 018eb41 commit f937dc3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions dbm-ui/backend/db_meta/models/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
5 changes: 5 additions & 0 deletions dbm-ui/backend/db_services/dbbase/resources/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = (
Expand Down Expand Up @@ -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']}",
Expand Down
2 changes: 2 additions & 0 deletions dbm-ui/backend/db_services/mongodb/resources/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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实例的查询集
Expand Down

0 comments on commit f937dc3

Please sign in to comment.