-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Feat/topology #1426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: feat/topology
Are you sure you want to change the base?
Feat/topology #1426
Changes from all commits
e20fd47
d4397cc
13f7855
c9e76b5
605e63e
82474b6
82e2512
7b1550d
a570632
14a9f70
7820521
9adece0
705adf1
c91ca09
4906c48
6d6a353
3295434
2d44a99
4d17607
ec894a1
6fb340d
1efdb31
07d3027
8ee5b0d
862778a
d66cf0a
cdfef00
4eee43b
89d38ca
6d6f5ce
5ed12b5
76c9443
4f0b9f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -229,3 +229,61 @@ func ServiceConfigArgumentRoutePUT(ctx consolectx.Context) gin.HandlerFunc { | |||||||||||||||||||||||||||||||||||||||
| c.JSON(http.StatusOK, model.NewSuccessResp(nil)) | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| // GetServiceGraph returns the service graph as graph data (nodes and edges) for visualization | ||||||||||||||||||||||||||||||||||||||||
| func GetServiceGraph(ctx consolectx.Context) gin.HandlerFunc { | ||||||||||||||||||||||||||||||||||||||||
| return func(c *gin.Context) { | ||||||||||||||||||||||||||||||||||||||||
| req := &model.ServiceGraphReq{} | ||||||||||||||||||||||||||||||||||||||||
| if err := c.ShouldBindQuery(req); err != nil { | ||||||||||||||||||||||||||||||||||||||||
| c.JSON(http.StatusBadRequest, model.NewErrorResp(err.Error())) | ||||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| resp, err := service.GraphServices(ctx, req) | ||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||
| util.HandleServiceError(c, err) | ||||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| c.JSON(http.StatusOK, model.NewSuccessResp(resp)) | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| // GetServiceDetail returns service detail information | ||||||||||||||||||||||||||||||||||||||||
| func GetServiceDetail(ctx consolectx.Context) gin.HandlerFunc { | ||||||||||||||||||||||||||||||||||||||||
| return func(c *gin.Context) { | ||||||||||||||||||||||||||||||||||||||||
| req := &model.ServiceDetailReq{} | ||||||||||||||||||||||||||||||||||||||||
| if err := c.ShouldBindQuery(req); err != nil { | ||||||||||||||||||||||||||||||||||||||||
| c.JSON(http.StatusBadRequest, model.NewErrorResp(err.Error())) | ||||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| resp, err := service.GetServiceDetail(ctx, req) | ||||||||||||||||||||||||||||||||||||||||
| if err != nil { | ||||||||||||||||||||||||||||||||||||||||
| util.HandleServiceError(c, err) | ||||||||||||||||||||||||||||||||||||||||
| return | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| c.JSON(http.StatusOK, model.NewSuccessResp(resp)) | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| // GetServiceInterfaces returns service interfaces information | ||||||||||||||||||||||||||||||||||||||||
| func GetServiceInterfaces(ctx consolectx.Context) gin.HandlerFunc { | ||||||||||||||||||||||||||||||||||||||||
| // return func(c *gin.Context) { | ||||||||||||||||||||||||||||||||||||||||
| // req := &model.ServiceInterfacesReq{} | ||||||||||||||||||||||||||||||||||||||||
| // if err := c.ShouldBindQuery(req); err != nil { | ||||||||||||||||||||||||||||||||||||||||
| // c.JSON(http.StatusBadRequest, model.NewErrorResp(err.Error())) | ||||||||||||||||||||||||||||||||||||||||
| // return | ||||||||||||||||||||||||||||||||||||||||
| // } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| // resp, err := service.GetServiceInterfaces(ctx, req) | ||||||||||||||||||||||||||||||||||||||||
| // if err != nil { | ||||||||||||||||||||||||||||||||||||||||
| // util.HandleServiceError(c, err) | ||||||||||||||||||||||||||||||||||||||||
| // return | ||||||||||||||||||||||||||||||||||||||||
| // } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| // c.JSON(http.StatusOK, model.NewSuccessResp(resp)) | ||||||||||||||||||||||||||||||||||||||||
| // } | ||||||||||||||||||||||||||||||||||||||||
| return nil | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+273
to
+288
|
||||||||||||||||||||||||||||||||||||||||
| // return func(c *gin.Context) { | |
| // req := &model.ServiceInterfacesReq{} | |
| // if err := c.ShouldBindQuery(req); err != nil { | |
| // c.JSON(http.StatusBadRequest, model.NewErrorResp(err.Error())) | |
| // return | |
| // } | |
| // resp, err := service.GetServiceInterfaces(ctx, req) | |
| // if err != nil { | |
| // util.HandleServiceError(c, err) | |
| // return | |
| // } | |
| // c.JSON(http.StatusOK, model.NewSuccessResp(resp)) | |
| // } | |
| return nil | |
| return func(c *gin.Context) { | |
| c.JSON(http.StatusNotImplemented, model.NewErrorResp("service interfaces endpoint is not implemented")) | |
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package model | ||
|
|
||
| import ( | ||
| meshresource "github.com/apache/dubbo-admin/pkg/core/resource/apis/mesh/v1alpha1" | ||
|
|
||
| "github.com/apache/dubbo-admin/pkg/common/constants" | ||
| ) | ||
|
|
||
| // GraphNode represents a node in the graph for AntV G6 | ||
| type GraphNode struct { | ||
| ID string `json:"id"` | ||
| Label string `json:"label"` | ||
| Type string `json:"type"` // "application" or "service" | ||
| Rule string `json:"rule"` // "provider", "consumer", or "" | ||
| Data interface{} `json:"data,omitempty"` | ||
| } | ||
|
|
||
| // GraphEdge represents an edge in the graph for AntV G6 | ||
| type GraphEdge struct { | ||
| Source string `json:"source"` | ||
| Target string `json:"target"` | ||
| Data map[string]interface{} `json:"data,omitempty"` // Additional data for the edge | ||
| } | ||
|
|
||
| // GraphData represents the complete graph structure for AntV G6 | ||
| type GraphData struct { | ||
| Nodes []GraphNode `json:"nodes"` | ||
| Edges []GraphEdge `json:"edges"` | ||
| } | ||
|
|
||
| // CrossNode represents a node in the cross-linked list structure | ||
| type CrossNode struct { | ||
| Instance *meshresource.InstanceResource | ||
| Next *CrossNode // pointer to next node in the same row | ||
| Down *CrossNode // pointer to next node in the same column | ||
| } | ||
|
|
||
| // CrossLinkedListGraph represents the cross-linked list structure as a directed graph | ||
| type CrossLinkedListGraph struct { | ||
| Head *CrossNode | ||
| Rows int // number of rows | ||
| Cols int // number of columns | ||
| } | ||
|
|
||
| // ServiceGraphReq represents the request parameters for fetching the service graph | ||
| type ServiceGraphReq struct { | ||
| Mesh string `json:"mesh" form:"mesh" binding:"required"` | ||
| ServiceName string `json:"serviceName" form:"serviceName" binding:"required"` | ||
| Version string `json:"version" form:"version"` | ||
| Group string `json:"group" form:"group"` | ||
| } | ||
|
|
||
| // ServiceKey returns the unique service identifier | ||
| func (s *ServiceGraphReq) ServiceKey() string { | ||
| return s.ServiceName + constants.ColonSeparator + s.Version + constants.ColonSeparator + s.Group | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个功能我记得zerui已经实现了,合并一下develop看看