Skip to content

Commit

Permalink
[GEN-2214]: add Tier and InstallationMethod fields to Describe Odigos (
Browse files Browse the repository at this point in the history
…#2185)

Following up with a UI update in reference to #2184 

---

This pull request introduces several changes to the `frontend/graph` and
`frontend/webapp` components to add support for `tier` and
`installationMethod` fields in the `OdigosAnalyze` structure. The most
important changes include updates to the GraphQL schema, resolvers, and
TypeScript definitions.

### GraphQL Schema and Resolvers:

* Added `tier` and `installationMethod` fields to the `OdigosAnalyze`
struct in `frontend/graph/generated.go` and updated the corresponding
complexity functions.
[[1]](diffhunk://#diff-4bacf1f13939a5c243f3f83d21f4560b331d13667d81ea5945ed1f57ddb205f2R327-R333)
[[2]](diffhunk://#diff-4bacf1f13939a5c243f3f83d21f4560b331d13667d81ea5945ed1f57ddb205f2R1770-R1776)
[[3]](diffhunk://#diff-4bacf1f13939a5c243f3f83d21f4560b331d13667d81ea5945ed1f57ddb205f2R1812-R1818)
* Implemented resolver functions for the new `tier` and
`installationMethod` fields in `frontend/graph/generated.go`.
* Updated the `OdigosAnalyze` query to include the new fields in
`frontend/graph/generated.go`.
[[1]](diffhunk://#diff-4bacf1f13939a5c243f3f83d21f4560b331d13667d81ea5945ed1f57ddb205f2R13327-R13330)
[[2]](diffhunk://#diff-4bacf1f13939a5c243f3f83d21f4560b331d13667d81ea5945ed1f57ddb205f2R20112-R20121)

### TypeScript and GraphQL Queries:

* Updated the `OdigosAnalyze` type definition to include `tier` and
`installationMethod` in `frontend/graph/model/models_gen.go` and
`frontend/graph/schema.graphqls`.
[[1]](diffhunk://#diff-642ccd7ed71fdfa394bd7f7fd99c9c33e20ff18c876a91cb989d379a44390469R389-R390)
[[2]](diffhunk://#diff-bc07b91dedd1782d9ddbbb6374ad97c7604f9a267de5174645723d863c732f80R547-R548)
* Modified the `convertOdigosToGQL` function to map the new fields in
`frontend/services/describe/odigos_describe/odigos_describe.go`.
* Extended the GraphQL query `DESCRIBE_ODIGOS` to fetch `tier` and
`installationMethod` in `frontend/webapp/graphql/queries/describe.ts`.
* Updated the `useDescribeOdigos` hook to handle the new fields in
`frontend/webapp/hooks/describe/useDescribeOdigos.ts`.
* Added `tier` and `installationMethod` to the `OdigosAnalyze` interface
in `frontend/webapp/types/describe.ts`.
  • Loading branch information
BenElferink authored Jan 12, 2025
1 parent 4576883 commit c567fa9
Show file tree
Hide file tree
Showing 7 changed files with 161 additions and 1 deletion.
138 changes: 138 additions & 0 deletions frontend/graph/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions frontend/graph/model/models_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions frontend/graph/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,8 @@ type NodeCollectorAnalyze {

type OdigosAnalyze {
odigosVersion: EntityProperty!
tier: EntityProperty!
installationMethod: EntityProperty!
numberOfDestinations: Int!
numberOfSources: Int!
clusterCollector: ClusterCollectorAnalyze!
Expand Down
2 changes: 2 additions & 0 deletions frontend/services/describe/odigos_describe/odigos_describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ func convertOdigosToGQL(odigos *odigos.OdigosAnalyze) *model.OdigosAnalyze {
}
return &model.OdigosAnalyze{
OdigosVersion: describe_utils.ConvertEntityPropertyToGQL(&odigos.OdigosVersion),
Tier: describe_utils.ConvertEntityPropertyToGQL(&odigos.Tier),
InstallationMethod: describe_utils.ConvertEntityPropertyToGQL(&odigos.InstallationMethod),
NumberOfDestinations: odigos.NumberOfDestinations,
NumberOfSources: odigos.NumberOfSources,
ClusterCollector: convertClusterCollectorToGQL(&odigos.ClusterCollector),
Expand Down
12 changes: 12 additions & 0 deletions frontend/webapp/graphql/queries/describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ export const DESCRIBE_ODIGOS = gql`
status
explain
}
tier {
name
value
status
explain
}
installationMethod {
name
value
status
explain
}
numberOfDestinations
numberOfSources
clusterCollector {
Expand Down
4 changes: 3 additions & 1 deletion frontend/webapp/hooks/describe/useDescribeOdigos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ export const useDescribeOdigos = () => {
if (!code) return {};

const payload: Record<string, any> = {
[code.odigosVersion.name]: code.odigosVersion.value,
[`${code.odigosVersion.name}@tooltip=${code.odigosVersion.explain}`]: code.odigosVersion.value,
[`${code.tier.name}@tooltip=${code.tier.explain}`]: code.tier.value,
[`${code.installationMethod.name}@tooltip=${code.installationMethod.explain}`]: code.installationMethod.value,
'Number Of Sources': code.numberOfSources,
'Number Of Destinations': code.numberOfDestinations,
};
Expand Down
2 changes: 2 additions & 0 deletions frontend/webapp/types/describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ interface NodeCollectorAnalyze {

interface OdigosAnalyze {
odigosVersion: EntityProperty;
tier: EntityProperty;
installationMethod: EntityProperty;
numberOfDestinations: number;
numberOfSources: number;
clusterCollector: ClusterCollectorAnalyze;
Expand Down

0 comments on commit c567fa9

Please sign in to comment.