def get(self, request, *args, **kwargs): """ 获取某个插件的配置信息 --- parameters: - name: tenantName description: 租户名 required: true type: string paramType: path - name: plugin_id description: 插件ID required: true type: string paramType: path - name: build_version description: 版本 required: true type: string paramType: path """ config_groups = plugin_config_service.get_config_details( self.plugin_version.plugin_id, self.plugin_version.build_version) data = self.plugin_version.to_dict() main_url = region_services.get_region_wsurl(self.response_region) data["web_socket_url"] = "{0}/event_log".format(main_url) result = general_message(200, "success", "查询成功", bean=data, list=config_groups) return Response(result, status=result["code"])
def get(self, request, *args, **kwargs): self.tenantName = kwargs.get('tenantName', None) self.serviceAlias = kwargs.get('serviceAlias', None) tenant = team_repo.get_team_by_team_name(self.tenantName) if tenant: self.tenant = tenant else: raise http.Http404 service = service_repo.get_service_by_tenant_and_alias( self.tenant.tenant_id, self.serviceAlias) if service: self.service = service else: raise http.Http404 context = dict() response = redirect( get_redirect_url( "/#/app/{0}/overview".format(self.service.service_alias), request)) try: docker_c_id = request.COOKIES.get('docker_c_id', '') docker_h_id = request.COOKIES.get('docker_h_id', '') docker_s_id = request.COOKIES.get('docker_s_id', '') if docker_c_id != "" and docker_h_id != "" and docker_s_id != "" and docker_s_id == self.service.service_id: t_docker_h_id = docker_h_id.lower() context["tenant_id"] = self.service.tenant_id context["service_id"] = docker_s_id context["ctn_id"] = docker_c_id context["md5"] = md5fun(self.service.tenant_id + "_" + docker_s_id + "_" + docker_c_id) main_url = region_services.get_region_wsurl( self.service.service_region) if main_url == "auto": context[ "ws_uri"] = '{}://{}:6060/docker_console?nodename={}'.format( settings.DOCKER_WSS_URL["type"], settings.DOCKER_WSS_URL[ self.service.service_region], t_docker_h_id) else: context[ "ws_uri"] = "{0}/docker_console?nodename={1}".format( main_url, t_docker_h_id) response = TemplateResponse(self.request, "www/console.html", context) response.delete_cookie('docker_c_id') response.delete_cookie('docker_h_id') response.delete_cookie('docker_s_id') except Exception as e: logger.exception(e) return response
def get(self, request, *args, **kwargs): """ 获取console TTY页面 --- parameters: - name: tenantName description: 租户名 required: true type: string paramType: path - name: serviceAlias description: 组件别名 required: true type: string paramType: path """ response = redirect(get_redirect_url("/index#/index", request)) try: docker_c_id = request.COOKIES.get('docker_c_id', '') docker_h_id = request.COOKIES.get('docker_h_id', '') docker_s_id = request.COOKIES.get('docker_s_id', '') bean = dict() if docker_c_id != "" and docker_h_id != "" and docker_s_id != "" and docker_s_id == self.service.service_id: t_docker_h_id = docker_h_id.lower() bean["tenant_id"] = self.service.tenant_id bean["service_id"] = docker_s_id bean["ctn_id"] = docker_c_id bean["md5"] = md5fun(self.service.tenant_id + "_" + docker_s_id + "_" + docker_c_id) main_url = region_services.get_region_wsurl( self.service.service_region) if main_url == "auto": bean[ "ws_uri"] = '{}://{}:6060/docker_console?nodename={}'.format( settings.DOCKER_WSS_URL["type"], settings.DOCKER_WSS_URL[ self.service.service_region], t_docker_h_id) else: bean["ws_uri"] = "{0}/docker_console?nodename={1}".format( main_url, t_docker_h_id) response = Response(general_message(200, "success", "信息获取成功"), status=200, template_name="www/console.html") except Exception as e: logger.exception(e) return response
def get(self, request, *args, **kwargs): context = self.get_context() response = redirect( get_redirect_url( "/apps/{0}/{1}/detail/".format(self.tenantName, self.serviceAlias), request)) try: docker_c_id = request.COOKIES.get('docker_c_id', '') docker_h_id = request.COOKIES.get('docker_h_id', '') docker_s_id = request.COOKIES.get('docker_s_id', '') if docker_c_id != "" and docker_h_id != "" and docker_s_id != "" and docker_s_id == self.service.service_id: t_docker_h_id = docker_h_id.lower() context["tenant_id"] = self.service.tenant_id context["service_id"] = docker_s_id context["ctn_id"] = docker_c_id context["md5"] = md5fun(self.service.tenant_id + "_" + docker_s_id + "_" + docker_c_id) main_url = region_services.get_region_wsurl( self.service.service_region) if main_url == "auto": context[ "ws_uri"] = '{}://{}:6060/docker_console?nodename={}'.format( settings.DOCKER_WSS_URL["type"], settings.DOCKER_WSS_URL[ self.service.service_region], t_docker_h_id) else: context[ "ws_uri"] = "{0}/docker_console?nodename={1}".format( main_url, t_docker_h_id) response = TemplateResponse(self.request, "www/console.html", context) response.delete_cookie('docker_c_id') response.delete_cookie('docker_h_id') response.delete_cookie('docker_s_id') except Exception as e: logger.exception(e) return response