Skip to content

Commit

Permalink
fix: civo dep graph nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
AvineshTripathi committed Nov 9, 2023
1 parent 34ecdf8 commit ed3ac52
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions dashboard/components/explorer/hooks/useDependencyGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function GetData(res: any) {
data: {
label: ele.name,
service: ele.service,
provider: 'AWS',
provider: ele.provider,
id: ele.resourceId,
isRoot: true
}
Expand All @@ -40,7 +40,7 @@ function GetData(res: any) {
label: rel.name,
service: ele.service,
type: rel.type,
provider: 'AWS', // when supporting new provider this could be made dynamic
provider: ele.provider,
isRoot: false
}
};
Expand Down
11 changes: 6 additions & 5 deletions handlers/resources_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,14 +400,14 @@ func (handler *ApiHandler) RelationStatsHandler(c *gin.Context) {

query := ""
if len(filters) == 0 {
query = "SELECT DISTINCT resources.resource_id, resources.name, resources.service, resources.relations FROM resources WHERE (jsonb_array_length(relations) > 0)"
query = "SELECT DISTINCT resources.resource_id, resources.provider, resources.name, resources.service, resources.relations FROM resources WHERE (jsonb_array_length(relations) > 0)"
if handler.db.Dialect().Name() == dialect.SQLite {
query = "SELECT DISTINCT resources.resource_id, resources.name, resources.service, resources.relations FROM resources WHERE (json_array_length(relations) > 0)"
query = "SELECT DISTINCT resources.resource_id, resources.provider, resources.name, resources.service, resources.relations FROM resources WHERE (json_array_length(relations) > 0)"
}
} else {
query = "SELECT DISTINCT resources.resource_id, resources.name, resources.service, resources.relations FROM resources WHERE (jsonb_array_length(relations) > 0) AND " + whereClause
query = "SELECT DISTINCT resources.resource_id, resources.provider, resources.name, resources.service, resources.relations FROM resources WHERE (jsonb_array_length(relations) > 0) AND " + whereClause
if handler.db.Dialect().Name() == dialect.SQLite {
query = "SELECT DISTINCT resources.resource_id, resources.name, resources.service, resources.relations FROM resources WHERE (json_array_length(relations) > 0) AND " + whereClause
query = "SELECT DISTINCT resources.resource_id, resources.provider, resources.name, resources.service, resources.relations FROM resources WHERE (json_array_length(relations) > 0) AND " + whereClause
}
}

Expand All @@ -423,9 +423,10 @@ func (handler *ApiHandler) RelationStatsHandler(c *gin.Context) {
Name: ele.Name,
Type: ele.Service,
Link: ele.Relations,
Provider: ele.Provider,
})
}

c.JSON(http.StatusOK, out)

}
Expand Down
1 change: 1 addition & 0 deletions models/relation.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ type OutputRelationResponse struct {
Type string `json:"service" bun:"service"`
Name string `json:"name" bun:"name"`
Link []Link `json:"relations" bun:"relations"`
Provider string `json:"provider" bun:"provider"`
}

0 comments on commit ed3ac52

Please sign in to comment.