Similarityoung commented on code in PR #1429:
URL: https://github.com/apache/dubbo-admin/pull/1429#discussion_r3004840566


##########
pkg/console/service/service.go:
##########
@@ -160,6 +162,456 @@ func ToServiceSearchRespByConsumer(res 
*meshresource.ServiceConsumerMetadataReso
        }
 }
 
+type serviceMethodCandidate struct {
+       detail    *model.ServiceMethodDetailResp
+       signature string
+       method    *meshproto.Method
+}
+
+type serviceProviderMetadataLookupReq struct {
+       ServiceName     string
+       Group           string
+       Version         string
+       Mesh            string
+       ProviderAppName string
+}
+
+type serviceMethodLookupReq struct {
+       Metadata   serviceProviderMetadataLookupReq
+       MethodName string
+       Signature  string
+}
+
+type serviceMethodResolveReq struct {
+       ServiceName string
+       MethodName  string
+       Signature   string
+}
+
+type resolvedServiceMethod struct {
+       metadataList []*meshresource.ServiceProviderMetadataResource
+       candidate    *serviceMethodCandidate
+}
+
+func newServiceProviderMetadataLookupReqFromServiceMethodsReq(req 
model.ServiceMethodsReq) serviceProviderMetadataLookupReq {
+       return serviceProviderMetadataLookupReq{
+               ServiceName: req.ServiceName,
+               Group:       req.Group,
+               Version:     req.Version,
+               Mesh:        req.Mesh,
+       }
+}
+
+func newServiceMethodLookupReqFromServiceMethodDetailReq(req 
model.ServiceMethodDetailReq) serviceMethodLookupReq {
+       return serviceMethodLookupReq{
+               Metadata:   
newServiceProviderMetadataLookupReqFromServiceMethodsReq(req.ServiceMethodsReq),
+               MethodName: req.MethodName,
+               Signature:  req.Signature,
+       }
+}
+
+func newServiceMethodLookupReqFromGenericInvokeReq(req 
model.ServiceGenericInvokeReq, providerAppName string) serviceMethodLookupReq {
+       return serviceMethodLookupReq{
+               Metadata: serviceProviderMetadataLookupReq{
+                       ServiceName:     req.ServiceName,
+                       Group:           req.Group,
+                       Version:         req.Version,
+                       Mesh:            req.Mesh,
+                       ProviderAppName: providerAppName,
+               },
+               MethodName: req.MethodName,
+               Signature:  req.Signature,
+       }
+}
+
+func GetServiceMethodNames(ctx consolectx.Context, req 
model.ServiceMethodsReq) ([]model.ServiceMethodSummaryResp, error) {
+       metadataList, err := listServiceProviderMetadata(ctx, 
newServiceProviderMetadataLookupReqFromServiceMethodsReq(req))
+       if err != nil {
+               return nil, err
+       }
+
+       return buildServiceMethodSummaries(metadataList), nil
+}
+
+func GetServiceMethodDetail(ctx consolectx.Context, req 
model.ServiceMethodDetailReq) (*model.ServiceMethodDetailResp, error) {
+       resolvedMethod, err := resolveServiceMethod(ctx, 
newServiceMethodLookupReqFromServiceMethodDetailReq(req))
+       if err != nil {
+               return nil, err
+       }
+
+       detail := cloneServiceMethodDetailResp(resolvedMethod.candidate.detail)

Review Comment:
   fix



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to