Example #1
0
 def get(self, request, *args, **kwargs):
     """
     查询构建源信息
     ---
     """
     from console.services.service_services import base_service
     service_ids = [self.service.service_id]
     build_infos = base_service.get_build_infos(self.tenant, service_ids)
     bean = build_infos.get(self.service.service_id, None)
     result = general_message(200, "success", "查询成功", bean=bean)
     return Response(result, status=result["code"])
    def get_group_services_with_build_source(self, tenant, region_name,
                                             group_id):
        group_services = base_service.get_group_services_list(
            tenant.tenant_id, region_name, group_id)
        if not group_services:
            return []
        service_ids = [
            group_service.get("service_id") for group_service in group_services
        ]
        build_infos = base_service.get_build_infos(tenant, service_ids)

        for group_service in group_services:
            group_service["app_name"] = group_service.get("group_name")
            if build_infos.get(group_service["service_id"], None):
                group_service["build_source"] = build_infos[
                    group_service["service_id"]]
                group_service["build_source"]["service_id"] = group_service[
                    "service_id"]
        return group_services