diff --git a/dbm-ui/backend/db_meta/models/cluster_entry.py b/dbm-ui/backend/db_meta/models/cluster_entry.py index d4d6756486..9fad850d67 100644 --- a/dbm-ui/backend/db_meta/models/cluster_entry.py +++ b/dbm-ui/backend/db_meta/models/cluster_entry.py @@ -85,22 +85,29 @@ def get_cluster_entry_map(cls, cluster_ids: List[int]) -> Dict[int, Dict[str, st @property def detail(self): """入口详情""" - + # 以下几类访问入口,都是指向 proxy + proxy = self.proxyinstance_set.first() + detail = {} if self.cluster_entry_type == ClusterEntryType.CLB: detail_obj = self.clbentrydetail_set.first() # 补充clb域名 clb_dns = ClusterEntry.objects.filter(forward_to=self, cluster_entry_type=ClusterEntryType.CLBDNS).first() - return {**model_to_dict(detail_obj), **{"clb_domain": getattr(clb_dns, "entry", "")}} if detail_obj else {} + detail = ( + {**model_to_dict(detail_obj), **{"clb_domain": getattr(clb_dns, "entry", "")}} if detail_obj else {} + ) if self.cluster_entry_type == ClusterEntryType.POLARIS: detail_obj = self.polarisentrydetail_set.first() - return {**model_to_dict(detail_obj), **{"url": getattr(detail_obj, "url", "")}} if detail_obj else {} + detail = {**model_to_dict(detail_obj), **{"url": getattr(detail_obj, "url", "")}} if detail_obj else {} if self.cluster_entry_type == ClusterEntryType.CLBDNS: detail_obj = self.forward_to - return model_to_dict(detail_obj) if detail_obj else {} + detail = model_to_dict(detail_obj) if detail_obj else {} + + if proxy: + detail.update({"port": proxy.port}) - return {} + return detail def __str__(self): return "{}:{}".format(self.cluster_entry_type, self.entry) diff --git a/dbm-ui/backend/db_services/dbbase/resources/query.py b/dbm-ui/backend/db_services/dbbase/resources/query.py index 857b8e9d2d..6c39761d00 100644 --- a/dbm-ui/backend/db_services/dbbase/resources/query.py +++ b/dbm-ui/backend/db_services/dbbase/resources/query.py @@ -64,7 +64,7 @@ def query_cluster_entry_details(cls, cluster_details, **kwargs): bk_biz_id=cluster_details["bk_biz_id"], bk_cloud_id=cluster_details["bk_cloud_id"] ).get_domain(entry.entry) else: - target_details = entry.detail + target_details = [entry.detail] entry_details.append( {