Skip to content
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

[GEN-1843]: restructure webapp/functions/* dir #1902

Merged
merged 256 commits into from
Dec 4, 2024

Conversation

BenElferink
Copy link
Contributor

@BenElferink BenElferink commented Dec 2, 2024

This pull request includes significant refactoring and reorganization of utility functions in the frontend/webapp/utils/functions directory. The changes primarily focus on modularizing the existing functions into separate files and ensuring they are properly exported.

Refactoring and modularization:

  • Removed multiple utility functions from frontend/webapp/utils/functions/formatters.ts and split them into individual files within the formatters directory. ([frontend/webapp/utils/functions/formatters.tsL1-L58](https://github.com/odigos-io/odigos/pull/1902/files#diff-f4d01ef4e907ca01fe7613d46bab600d0da8b6909ec17a53d800b95f21418df8L1-L58))
  • Created new files for each formatter function, such as clean-object-empty-strings-values, extract-monitors, format-bytes, get-id-from-sse-target, get-sse-target-from-id, parse-json-string-to-pretty-string, safe-json-parse, and stringify-non-string-values. ([[1]](https://github.com/odigos-io/odigos/pull/1902/files#diff-04c575a8ed7cc731c639cd213a8ed5dff09014e62987f1efc10509d0af30d24eR1-R43), [[2]](https://github.com/odigos-io/odigos/pull/1902/files#diff-360cf905712382733646f229c6914bec3e7310b3dfaabee6442f537c2628f1c7R1-R7), [[3]](https://github.com/odigos-io/odigos/pull/1902/files#diff-1c597ef6a08d013d592b4a56ac5d0f0a66a128c63e27726f9fb11323af4b1a4aR1-R9), [[4]](https://github.com/odigos-io/odigos/pull/1902/files#diff-d72ccb9f5a1929724cb925b6c2dba797054c60b9006cc9b2b3e7c6d4dc2d94caR1-R23), [[5]](https://github.com/odigos-io/odigos/pull/1902/files#diff-0dc58ee13be4d22e5e76371424d64dc5f6c520941cb1a706a5ae6769370762a7R1-R20), [[6]](https://github.com/odigos-io/odigos/pull/1902/files#diff-99da4681420f74b5dd4d010da30596628f9f945ecc31d6b5daf959203180bddfR1-R33), [[7]](https://github.com/odigos-io/odigos/pull/1902/files#diff-ee341525c9301000acc3d7e3579a573f1eab27284320fda320bc0241acc676cfR1-R10), [[8]](https://github.com/odigos-io/odigos/pull/1902/files#diff-53a3d503caa90abfba13035cc2ef533b43fbf144dca8443fe3c60c8fbf72d19cR1-R12))
  • Updated the main formatters index file to export all newly created formatter functions. ([frontend/webapp/utils/functions/formatters/index.tsR1-R8](https://github.com/odigos-io/odigos/pull/1902/files#diff-801ac659dba2f09a5dbfcf41f6d6479ab5719cbbcea26548a42f67683ebf06faR1-R8))

Icon utility functions reorganization:

  • Removed icon-related utility functions from frontend/webapp/utils/functions/icons.ts and split them into individual files within the icons directory. ([frontend/webapp/utils/functions/icons.tsL1-L69](https://github.com/odigos-io/odigos/pull/1902/files#diff-869883e9c9018f4ea6797d1fd860989852023765e868dcdee9fc50d72ad667c2L1-L69))
  • Created new files for each icon function, such as get-action-icon, get-entity-icon, get-programming-language-icon, get-rule-icon, and get-status-icon. ([[1]](https://github.com/odigos-io/odigos/pull/1902/files#diff-c6475af11b116f4fe9ebf0b0b818b43a1c94ec849e299119cdcb3e9338e2a39bR1-R15), [[2]](https://github.com/odigos-io/odigos/pull/1902/files#diff-145358e893f684597685dbe568daca027a7bae765120d26095b447f175e9f642R1-R9), [[3]](https://github.com/odigos-io/odigos/pull/1902/files#diff-974c781bedbf4e15ff5543fecfe9538aa7c8b4ccbd417191aec39e70149f61f0R1-R26), [[4]](https://github.com/odigos-io/odigos/pull/1902/files#diff-604d485e21e38de944908527c49c95bacd9874fd1666b79932ee465b64a2897cR1-R11), [[5]](https://github.com/odigos-io/odigos/pull/1902/files#diff-e975607108c340d4e57ec9806fdb808deede1e6ba28ee6045711bfec295e8f50R1-R20))
  • Updated the main icons index file to export all newly created icon functions. ([frontend/webapp/utils/functions/icons/index.tsR1-R5](https://github.com/odigos-io/odigos/pull/1902/files#diff-cc9362526bbc0edd12d785a06d51f8312e8a58cc06a3505b82f9f4ebecb3575bR1-R5))

General cleanup and reorganization:

  • Updated the main functions index file to reflect the new structure and ensure proper exports. ([frontend/webapp/utils/functions/index.tsL1-R3](https://github.com/odigos-io/odigos/pull/1902/files#diff-9a0b1bdbbd795b694de9117cbd137eb25263d4d4c888360d0e342b10605d75cdL1-R3))
  • Added a new resolvers directory and updated the functions index file to export the resolver functions. ([frontend/webapp/utils/functions/resolvers/index.tsR1](https://github.com/odigos-io/odigos/pull/1902/files#diff-24c64e1f6bad8c9ac4c2e338e9d6be1654e7da44da8447c1008d3aa080ef1f38R1))

BenElferink and others added 30 commits October 22, 2024 10:54
This pull request introduces changes to the `DeleteAction` functionality
in the `frontend/graph` package, adding support for an `actionType`
parameter. This enhancement allows for more specific handling of
different action types during deletion.

Key changes include:

### GraphQL Schema and Resolvers

*
[`frontend/graph/schema.graphqls`](diffhunk://#diff-bc07b91dedd1782d9ddbbb6374ad97c7604f9a267de5174645723d863c732f80L314-R314):
Updated the `deleteAction` mutation to include an `actionType`
parameter.
*
[`frontend/graph/schema.resolvers.go`](diffhunk://#diff-8e6e95029056db2c0301fc338e0ca5a04356ce5d45ee9514bbd167f2d85bae70L603-R620):
Modified the `DeleteAction` resolver to handle different action types
based on the `actionType` parameter.

### Generated Code

*
[`frontend/graph/generated.go`](diffhunk://#diff-4bacf1f13939a5c243f3f83d21f4560b331d13667d81ea5945ed1f57ddb205f2L200-R200):
Updated the `DeleteAction` method signatures and complexity calculations
to include the `actionType` parameter.
[[1]](diffhunk://#diff-4bacf1f13939a5c243f3f83d21f4560b331d13667d81ea5945ed1f57ddb205f2L200-R200)
[[2]](diffhunk://#diff-4bacf1f13939a5c243f3f83d21f4560b331d13667d81ea5945ed1f57ddb205f2L266-R266)
[[3]](diffhunk://#diff-4bacf1f13939a5c243f3f83d21f4560b331d13667d81ea5945ed1f57ddb205f2L911-R911)
[[4]](diffhunk://#diff-4bacf1f13939a5c243f3f83d21f4560b331d13667d81ea5945ed1f57ddb205f2R1342-R1350)
[[5]](diffhunk://#diff-4bacf1f13939a5c243f3f83d21f4560b331d13667d81ea5945ed1f57ddb205f2L5793-R5802)

### Action Services

*
[`frontend/services/actions/addclusterinfo.go`](diffhunk://#diff-c2da2861415e61f772e3b44d22810aa34b4eba6070f744709c4b1b6b919a3f09R148-R162):
Added the `DeleteAddClusterInfo` function to handle the deletion of
`AddClusterInfo` actions.
*
[`frontend/services/actions/addclusterinfo.go`](diffhunk://#diff-c2da2861415e61f772e3b44d22810aa34b4eba6070f744709c4b1b6b919a3f09R13):
Imported `apierrors` for error handling in the new deletion function.
[GEN-1515]: fix stringify for graphql (odigos-io#1615)
This pull request introduces a new `ProbabilisticSamplerAction` to the
codebase, along with the necessary updates to support its creation,
update, and deletion. The key changes include adding the new action
type, updating the GraphQL schema, and implementing the corresponding
service functions.

### Addition of `ProbabilisticSamplerAction`:

*
[`frontend/graph/model/models_gen.go`](diffhunk://#diff-642ccd7ed71fdfa394bd7f7fd99c9c33e20ff18c876a91cb989d379a44390469R311-R337):
Added the `ProbabilisticSamplerAction` struct and its methods to the
model.
*
[`frontend/graph/schema.graphqls`](diffhunk://#diff-bc07b91dedd1782d9ddbbb6374ad97c7604f9a267de5174645723d863c732f80R309-R318):
Updated the GraphQL schema to include the `ProbabilisticSamplerAction`
type.

### Resolver Updates:

*
[`frontend/graph/schema.resolvers.go`](diffhunk://#diff-8e6e95029056db2c0301fc338e0ca5a04356ce5d45ee9514bbd167f2d85bae70L568-R571):
Updated the `CreateAction`, `UpdateAction`, and `DeleteAction` resolvers
to handle the new `ProbabilisticSamplerAction` type.
[[1]](diffhunk://#diff-8e6e95029056db2c0301fc338e0ca5a04356ce5d45ee9514bbd167f2d85bae70L568-R571)
[[2]](diffhunk://#diff-8e6e95029056db2c0301fc338e0ca5a04356ce5d45ee9514bbd167f2d85bae70L586-R591)
[[3]](diffhunk://#diff-8e6e95029056db2c0301fc338e0ca5a04356ce5d45ee9514bbd167f2d85bae70L617-R630)

### Constants Update:

*
[`frontend/services/actions/constants.go`](diffhunk://#diff-377602090c56364ea3a4d6cdadda1ad9b1c6ba9e122f882e5a1f640b1e62acf8L8-R9):
Added `ActionTypeProbabilisticSampler` and corrected the naming of
`ActionTypeLatencySampler`.

### Service Implementation:

*
[`frontend/services/actions/probabilisticsampler.go`](diffhunk://#diff-2f6dc14f04b67e0a11a5b999216a0e08f575927294c5033187b84f1179fb5624R1-R139):
Implemented the service functions `CreateProbabilisticSampler`,
`UpdateProbabilisticSampler`, and `DeleteProbabilisticSampler` to manage
`ProbabilisticSamplerAction` in Kubernetes.
Copy link

@BenElferink BenElferink enabled auto-merge (squash) December 2, 2024 15:26
@BenElferink BenElferink merged commit aacf22e into odigos-io:main Dec 4, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants