Skip to content

Commit

Permalink
fix(backend): 域名查询集群信息接口优化 #8266
Browse files Browse the repository at this point in the history
# Reviewed, transaction id: 25231
  • Loading branch information
ygcyao authored and iSecloud committed Nov 29, 2024
1 parent a9c668e commit 36075dd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dbm-ui/backend/db_meta/api/priv_manager/biz_clusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def biz_clusters(bk_biz_id: int, immute_domains: Optional[List[str]]):
padding_clusters = SystemSettings.get_setting_value(SystemSettingsEnum.PADDING_PROXY_CLUSTER_LIST.value) or []

for cluster in qs:
storage_instances = list(cluster.storageinstance_set.all())
proxy_instances = list(cluster.proxyinstance_set.all())
res.append(
{
"id": cluster.id,
Expand All @@ -47,7 +49,7 @@ def biz_clusters(bk_biz_id: int, immute_domains: Optional[List[str]]):
"status": ele.status,
"bk_instance_id": ele.bk_instance_id,
}
for ele in cluster.proxyinstance_set.all()
for ele in proxy_instances
],
"master_storage_instances": [
{
Expand All @@ -59,7 +61,8 @@ def biz_clusters(bk_biz_id: int, immute_domains: Optional[List[str]]):
"status": ele.status,
"bk_instance_id": ele.bk_instance_id,
}
for ele in cluster.storageinstance_set.filter(instance_inner_role=InstanceInnerRole.MASTER.value)
for ele in storage_instances
if ele.instance_inner_role == InstanceInnerRole.MASTER.value
],
"slave_storage_instances": [
{
Expand All @@ -71,7 +74,8 @@ def biz_clusters(bk_biz_id: int, immute_domains: Optional[List[str]]):
"status": ele.status,
"bk_instance_id": ele.bk_instance_id,
}
for ele in cluster.storageinstance_set.filter(instance_inner_role=InstanceInnerRole.SLAVE.value)
for ele in storage_instances
if ele.instance_inner_role == InstanceInnerRole.SLAVE.value
],
"storages": [
{
Expand All @@ -83,7 +87,7 @@ def biz_clusters(bk_biz_id: int, immute_domains: Optional[List[str]]):
"status": ele.status,
"bk_instance_id": ele.bk_instance_id,
}
for ele in cluster.storageinstance_set.all()
for ele in storage_instances
],
}
)
Expand Down

0 comments on commit 36075dd

Please sign in to comment.