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

feat: cli remote update token #2173

Merged

Conversation

AvihuHenya
Copy link
Contributor

declaring remote flag in cli pro command for enabling update token via Odigos ui

@AvihuHenya AvihuHenya force-pushed the cli-remote-update-token branch from f76e3ac to f8f64f4 Compare January 9, 2025 15:32
@AvihuHenya AvihuHenya changed the base branch from main to feature/token-crud-ui January 12, 2025 09:05
… bottom of the viewport (odigos-io#2190)

This pull request includes enhancements to the `Dropdown` component in
the `frontend/webapp/reuseable-components/dropdown/index.tsx` file,
focusing on improving its functionality and user experience. The most
important changes include adding a feature to open the dropdown upwards
if it is near the bottom of the screen and updating related styles and
logic.

Enhancements to `Dropdown` component:

* Introduced the `openUpwards` state and `handleDirection` function to
determine the direction in which the dropdown should open based on its
position relative to the viewport.
* Passed the `openUpwards` state as a prop to the `DropdownList`
component to control its rendering direction.
* Updated the `AbsoluteContainer` styled component to conditionally
apply the `top` or `bottom` style based on the `$openUpwards` prop.
* Modified the `DropdownList` component to accept the `openUpwards` prop
and pass it to the `AbsoluteContainer` for dynamic positioning.
…odigos-io#2185)

Following up with a UI update in reference to odigos-io#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`.
…awer to display tokens in UI (odigos-io#2175)

This pull request includes several changes to add support for API
tokens, introduce new icons, and update the frontend components to
reflect these changes. The most important changes include adding API
token support, creating new icon components, and updating the main
header and overview drawers.

API token support:

*
[`frontend/gqlgen.yml`](diffhunk://#diff-53053c2ca35acf8830a765ef72835e81aec5118b5194f0db21cbd80446405a0cR47-R48):
Added `apiTokens` resolver to `ComputePlatform` fields.
*
[`frontend/graph/common.go`](diffhunk://#diff-ffa020f42888de4cce165f880d16fcea61971412669e39abd225c638af94e77dR1-R30):
Implemented `extractJWTPayload` function to decode JWT tokens.
*
[`frontend/graph/model/models_gen.go`](diffhunk://#diff-642ccd7ed71fdfa394bd7f7fd99c9c33e20ff18c876a91cb989d379a44390469R57-R63):
Introduced `APIToken` type and added `apiTokens` field to
`ComputePlatform` struct.
[[1]](diffhunk://#diff-642ccd7ed71fdfa394bd7f7fd99c9c33e20ff18c876a91cb989d379a44390469R57-R63)
[[2]](diffhunk://#diff-642ccd7ed71fdfa394bd7f7fd99c9c33e20ff18c876a91cb989d379a44390469R84)
*
[`frontend/graph/schema.graphqls`](diffhunk://#diff-bc07b91dedd1782d9ddbbb6374ad97c7604f9a267de5174645723d863c732f80R192-R201):
Added `ApiToken` type and `apiTokens` field to `ComputePlatform`.
*
[`frontend/graph/schema.resolvers.go`](diffhunk://#diff-8e6e95029056db2c0301fc338e0ca5a04356ce5d45ee9514bbd167f2d85bae70R22-R67):
Implemented `APITokens` resolver for `ComputePlatform`.

New icon components:

*
[`frontend/webapp/assets/icons/common/copy-icon.tsx`](diffhunk://#diff-d35e120e9fdda5b20903db9d0dfc2838be8d384811933709564d464edf38e73fR1-R16):
Added `CopyIcon` component.
*
[`frontend/webapp/assets/icons/common/key-icon.tsx`](diffhunk://#diff-21611251ee97e59e22133d5c510ba2404aeba805402fc811b875a5d43ad25bbaR1-R16):
Added `KeyIcon` component.
*
[`frontend/webapp/assets/icons/common/terminal-icon.tsx`](diffhunk://#diff-4e3c0134ff5cb358bb022884856d6fa8ae0c059f23cceaab812870fc837e33e0R1-R16):
Added `TerminalIcon` component.
*
[`frontend/webapp/assets/icons/common/index.ts`](diffhunk://#diff-296ed595d55f81134becefd3bd98f603053606a5a1d310efc5ca36c85f2f9506R8):
Exported new icon components.
[[1]](diffhunk://#diff-296ed595d55f81134becefd3bd98f603053606a5a1d310efc5ca36c85f2f9506R8)
[[2]](diffhunk://#diff-296ed595d55f81134becefd3bd98f603053606a5a1d310efc5ca36c85f2f9506R19-R26)

Main header and overview drawers updates:

*
[`frontend/webapp/components/main/header/index.tsx`](diffhunk://#diff-2c96f91ec30d2116981a9c0a562820ff9fd87c8292cb5dca11a45d6fb2ac6c04R2-R9):
Updated main header to include a button for the new CLI drawer.
[[1]](diffhunk://#diff-2c96f91ec30d2116981a9c0a562820ff9fd87c8292cb5dca11a45d6fb2ac6c04R2-R9)
[[2]](diffhunk://#diff-2c96f91ec30d2116981a9c0a562820ff9fd87c8292cb5dca11a45d6fb2ac6c04L37-R38)
[[3]](diffhunk://#diff-2c96f91ec30d2116981a9c0a562820ff9fd87c8292cb5dca11a45d6fb2ac6c04L49-R55)
*
[`frontend/webapp/components/overview/all-drawers/cli-drawer.tsx`](diffhunk://#diff-05c3af50f20a5a1195555bcff0f9a44be51f03ad2f4cd080dff2a3b2ee6ababcR1-R109):
Created a new drawer component for displaying API tokens and Odigos CLI
information.
*
[`frontend/webapp/components/overview/all-drawers/index.tsx`](diffhunk://#diff-bf25245ffa5cb1c7ea54b941a97fc9f53caf28b7154cb4eda9b88c7b6f0944d1R2-L3):
Updated drawer selection logic to include the new CLI drawer.
[[1]](diffhunk://#diff-bf25245ffa5cb1c7ea54b941a97fc9f53caf28b7154cb4eda9b88c7b6f0944d1R2-L3)
[[2]](diffhunk://#diff-bf25245ffa5cb1c7ea54b941a97fc9f53caf28b7154cb4eda9b88c7b6f0944d1L25-R26)
*
[`frontend/webapp/graphql/queries/compute-platform.ts`](diffhunk://#diff-31f9118ffb7e3400a45302bd5f30d621f58adaf33d086beb183bd302b980c521R6-R11):
Updated GraphQL query to fetch `apiTokens`.
*
[`frontend/webapp/hooks/common/index.ts`](diffhunk://#diff-e91dfaad8acf2180d9c3e07b98c4f7d5bdab76542b7ab14d5e84202a42aeba29R2):
Added export for `useCopy` hook.
BenElferink and others added 9 commits January 12, 2025 11:02
This pull request includes several updates to the `frontend/webapp`
project, focusing on dependency updates, type improvements, and
refactoring of reusable components. The most important changes include
updating dependencies in `package.json`, improving type definitions for
React components, and refactoring the monitoring checkboxes component.

### Dependency Updates:
*
[`frontend/webapp/package.json`](diffhunk://#diff-ccf6337b0064354343f900ffd8b4ee91aa8cd014f3292548a800ad3dac39c1f4L14-R37):
Updated multiple dependencies, including `@apollo/client`, `graphql`,
`next`, `react`, and `typescript` to their latest versions.

### Type Improvements:
*
[`frontend/webapp/hooks/common/useOnClickOutside.ts`](diffhunk://#diff-10b0c59a5713cf46c8babbd395cf003553a8f54b757b1593968ebb32e0774c73L3-R3):
Updated the `ref` parameter type in the `useOnClickOutside` hook to
`React.RefObject<HTMLElement | null>`.
*
[`frontend/webapp/reuseable-components/badge/index.tsx`](diffhunk://#diff-5b2e817e2d630b757f44f84f327c95dc303dbbb5924fccb29c0055da353bd126R1-R5):
Changed the `label` prop type from `JSX.Element` to `React.ReactNode`.
*
[`frontend/webapp/reuseable-components/data-tab/index.tsx`](diffhunk://#diff-afbf1606ee29d25bd9273d63b66a4746dbdd1cd8406ad651cfd123ac28f72006L19-R20):
Updated the `renderExtended` and `renderActions` prop types from
`JSX.Element` to `React.ReactNode`.
*
[`frontend/webapp/reuseable-components/fade-loader/index.tsx`](diffhunk://#diff-9c241dfa787c4d925e8e5ad0f74db81dd5dd4c0fb628f68ba66da4daf7cca634L40-R35):
Updated the return type of the `FadeLoader` function from `JSX.Element |
null` to `React.ReactNode | null`.

### Refactoring:
*
[`frontend/webapp/reuseable-components/monitoring-checkboxes/index.tsx`](diffhunk://#diff-b548a18fe8dc75a96aa84df48e9f1360b626d6d5640abdc1e925b5839630bde5L4-R4):
Refactored the monitoring checkboxes component to use `MONITORS_OPTIONS`
and updated the logic to handle the new structure of monitoring options.
[[1]](diffhunk://#diff-b548a18fe8dc75a96aa84df48e9f1360b626d6d5640abdc1e925b5839630bde5L4-R4)
[[2]](diffhunk://#diff-b548a18fe8dc75a96aa84df48e9f1360b626d6d5640abdc1e925b5839630bde5L29-R29)
[[3]](diffhunk://#diff-b548a18fe8dc75a96aa84df48e9f1360b626d6d5640abdc1e925b5839630bde5L47-R49)
[[4]](diffhunk://#diff-b548a18fe8dc75a96aa84df48e9f1360b626d6d5640abdc1e925b5839630bde5L82-R87)
*
[`frontend/webapp/utils/constants/monitors.tsx`](diffhunk://#diff-2d10cf3afe0daae8da71ac62534459526be574fcf9d6e0aea186730f33df3877L2-R22):
Refactored the monitoring options constants to simplify the structure
and remove unused properties.
…io#2188)

This pull request includes changes to improve the handling and parsing
of JSON data in the dynamic fields and form data for destinations in the
frontend web application. The most important changes include adding the
`safeJsonParse` utility function to handle JSON parsing safely and
refactoring the components to use this function.

Improvements to JSON parsing:

*
[`frontend/webapp/containers/main/destinations/destination-form-body/dynamic-fields/index.tsx`](diffhunk://#diff-c17889e1ffea148a206f57df5da9f8cc755e7e522a9057a339f6887c01ed5815L3-R3):
Added the `safeJsonParse` utility function to the imports.
*
[`frontend/webapp/containers/main/destinations/destination-form-body/dynamic-fields/index.tsx`](diffhunk://#diff-c17889e1ffea148a206f57df5da9f8cc755e7e522a9057a339f6887c01ed5815L34-R52):
Updated the `InputList` and `KeyValueInputsList` components to use
`safeJsonParse` for safely parsing JSON values.

Refactoring:

*
[`frontend/webapp/hooks/destinations/useDestinationFormData.ts`](diffhunk://#diff-74e478b5171cbecdf7abf376e9bc1428c38d585bc6252dc463216f9869bf9f77L36-L50):
Removed redundant parsing logic for `MULTI_INPUT` component type,
simplifying the code.
*
[`frontend/webapp/hooks/destinations/useDestinationFormData.ts`](diffhunk://#diff-74e478b5171cbecdf7abf376e9bc1428c38d585bc6252dc463216f9869bf9f77R107-R108):
Added a console log statement to debug the parsed fields in the
`useDestinationFormData` function.
This pull request includes several changes to improve the behavior of
input components in the `frontend/webapp/reuseable-components`
directory. The main focus is on ensuring that the delete button
functionality is consistent and that input validation is properly
handled.

Improvements to input validation and delete button functionality:

*
[`frontend/webapp/reuseable-components/input-list/index.tsx`](diffhunk://#diff-a00687e99957ec5d2b28432fc1959a9819b6f87371692a0bef21cf567bea7bfdL1-R2):
Added the `isEmpty` utility function and modified the logic to disable
the delete button when there is only one row and all inputs are empty.
The `autoFocus` attribute was also updated to use `isEmpty`.
[[1]](diffhunk://#diff-a00687e99957ec5d2b28432fc1959a9819b6f87371692a0bef21cf567bea7bfdL1-R2)
[[2]](diffhunk://#diff-a00687e99957ec5d2b28432fc1959a9819b6f87371692a0bef21cf567bea7bfdR108-R110)
[[3]](diffhunk://#diff-a00687e99957ec5d2b28432fc1959a9819b6f87371692a0bef21cf567bea7bfdL117-R129)
*
[`frontend/webapp/reuseable-components/input-table/index.tsx`](diffhunk://#diff-511aed49818334957716043c1273ee4e2a4c6bdc789f95e3cc2958f4cf603a1eL1-L5):
Included the `isEmpty` utility function and updated the logic to disable
the delete button under similar conditions as the input list. The
`autoFocus` attribute was adjusted accordingly.
[[1]](diffhunk://#diff-511aed49818334957716043c1273ee4e2a4c6bdc789f95e3cc2958f4cf603a1eL1-L5)
[[2]](diffhunk://#diff-511aed49818334957716043c1273ee4e2a4c6bdc789f95e3cc2958f4cf603a1eL109-R111)
[[3]](diffhunk://#diff-511aed49818334957716043c1273ee4e2a4c6bdc789f95e3cc2958f4cf603a1eL144-R145)
[[4]](diffhunk://#diff-511aed49818334957716043c1273ee4e2a4c6bdc789f95e3cc2958f4cf603a1eL153-R163)
*
[`frontend/webapp/reuseable-components/key-value-input-list/index.tsx`](diffhunk://#diff-be0b643b1628d8036777fd4a042b1d241af86dd5035bfe9548a3b58b0dd0d327L1-R2):
Integrated the `isEmpty` utility function and modified the delete button
logic to ensure it is disabled when appropriate. The `autoFocus` and
`hasError` attributes were also updated to use `isEmpty`.
[[1]](diffhunk://#diff-be0b643b1628d8036777fd4a042b1d241af86dd5035bfe9548a3b58b0dd0d327L1-R2)
[[2]](diffhunk://#diff-be0b643b1628d8036777fd4a042b1d241af86dd5035bfe9548a3b58b0dd0d327L80-R81)
[[3]](diffhunk://#diff-be0b643b1628d8036777fd4a042b1d241af86dd5035bfe9548a3b58b0dd0d327R116-R118)
[[4]](diffhunk://#diff-be0b643b1628d8036777fd4a042b1d241af86dd5035bfe9548a3b58b0dd0d327L130-R132)
[[5]](diffhunk://#diff-be0b643b1628d8036777fd4a042b1d241af86dd5035bfe9548a3b58b0dd0d327L139-R154)
@AvihuHenya AvihuHenya merged commit 86274eb into odigos-io:feature/token-crud-ui Jan 12, 2025
3 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.

3 participants