diff --git a/dbm-ui/backend/db_meta/api/cluster/es/detail.py b/dbm-ui/backend/db_meta/api/cluster/es/detail.py index ef554c8ba4..3d6872df47 100644 --- a/dbm-ui/backend/db_meta/api/cluster/es/detail.py +++ b/dbm-ui/backend/db_meta/api/cluster/es/detail.py @@ -28,21 +28,21 @@ def scan_cluster(cluster: Cluster) -> Graphic: ) # 获得Master节点组,冷节点组,热节点组 - _dummy, master_group = graph.add_instance_nodes( + hot_insts, master_group = graph.add_instance_nodes( cluster=cluster, roles=InstanceRole.ES_MASTER, group_name=_("Master 节点") ) - _dummy, hot_node_group = graph.add_instance_nodes( + master_insts, hot_node_group = graph.add_instance_nodes( cluster=cluster, roles=InstanceRole.ES_DATANODE_HOT, group_name=_("热节点") ) - _dummy, cold_node_group = graph.add_instance_nodes( + cold_insts, cold_node_group = graph.add_instance_nodes( cluster=cluster, roles=InstanceRole.ES_DATANODE_COLD, group_name=_("冷节点") ) + entry = cluster.clusterentry_set.first() if client_group: + hub_group = client_group # 获得访问入口节点组 - entry = client_insts.first().bind_entry.first() _dummy, entry_group = graph.add_node(entry) - # 访问入口 ---> Client节点,关系为:访问 graph.add_line(source=entry_group, target=client_group, label=LineLabel.Access) # Client节点 ---> Master/冷/热节点,关系为:访问 @@ -51,5 +51,14 @@ def scan_cluster(cluster: Cluster) -> Graphic: graph.add_line(source=client_group, target=hot_node_group, label=LineLabel.Access) if cold_node_group: graph.add_line(source=client_group, target=cold_node_group, label=LineLabel.Access) + elif hot_node_group: + _dummy, entry_group = graph.add_node(entry) + hub_group = hot_node_group + graph.add_line(source=entry_group, target=hot_node_group, label=LineLabel.Access) + graph.add_line(source=hot_node_group, target=master_group, label=LineLabel.Access) + else: + hub_group = master_group + if cold_node_group: + graph.add_line(source=hub_group, target=cold_node_group, label=LineLabel.Access) return graph