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

AWS Integration: Account settings modal #6808

Open
wants to merge 8 commits into
base: integrate-now-modal
Choose a base branch
from

Conversation

ahmadshaheer
Copy link
Collaborator

@ahmadshaheer ahmadshaheer commented Jan 13, 2025

Summary

Related Issues / PR's

Screenshots

NA

Affected Areas and Manually Tested Areas


Important

Add AWS account settings modal for configuration and region management, with UI enhancements and refactoring for integration management.

  • Features:
    • Add AccountSettingsModal in AccountActions.tsx for AWS account configuration.
    • Implement updateAccountConfig in index.ts to update AWS account settings.
    • Add ServiceStatus component in ServiceDetails.tsx to display service connection status.
  • UI Enhancements:
    • Update SignozModal to use rootClassName instead of className.
    • Add styles for AccountSettingsModal and CloudAccountSetupModal.
    • Add IntegrationsUninstallBar to AccountSettingsModal.tsx for uninstalling integrations.
  • Refactoring:
    • Refactor useAccountSettingsModal and useIntegrationModal hooks for better state management.
    • Rename ServiceStatus interface to IServiceStatus in types.ts.

This description was created by Ellipsis for 0a362df. It will automatically update as commits are pushed.

@ahmadshaheer ahmadshaheer requested a review from YounixM as a code owner January 13, 2025 07:28
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

1 similar comment
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Reviewed everything up to a976e18 in 1 minute and 54 seconds

More details
  • Looked at 826 lines of code in 14 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. frontend/src/pages/Integrations/CloudIntegrationPage/HeroSection/AccountSettingsModal.tsx:99
  • Draft comment:
    Consider using native array methods for comparison instead of isEqual from lodash-es for better performance, especially if the arrays are simple.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code uses isEqual from lodash-es which might not be necessary for simple array comparison. Using native methods could improve performance.
2. frontend/src/pages/Integrations/CloudIntegrationPage/HeroSection/AccountSettingsModal.tsx:6
  • Draft comment:
    Consider using native array methods for comparison instead of isEqual from lodash-es for better performance, especially if the arrays are simple. This comment also applies to other instances in this file.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The code uses isEqual from lodash-es which might not be necessary for simple array comparison. Using native methods could improve performance.
3. frontend/src/pages/Integrations/CloudIntegrationPage/HeroSection/AccountActions.tsx:97
  • Draft comment:
    Avoid using inline styles in React components. Use external stylesheets, CSS classes, or styled components instead. This is also applicable on line 97.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_h9GQt5mdQGoTAJe1


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

payload: AccountConfigPayload,
): Promise<AccountConfigResponse> => {
const response = await axios.put<AccountConfigResponse>(
`http://localhost:3000/api/v1/cloud-integrations/aws/accounts/${accountId}/config`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using hardcoded URLs for API requests. Consider using environment variables to manage API endpoints. This comment also applies to other instances in this file.

</button>
</div>
<Select
style={{ height: '44px' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using inline styles in React components. Use external stylesheets, CSS classes, or styled components instead.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Incremental review on 294b1e1 in 1 minute and 3 seconds

More details
  • Looked at 1703 lines of code in 17 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. frontend/src/container/CloudIntegrationPage/HeroSection/components/AccountActions.tsx:143
  • Draft comment:
    Consider adding a null check for activeAccount before passing it to AccountSettingsModal to avoid potential runtime errors.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The AccountSettingsModal button is only shown when accounts?.length is truthy (line 92). When this is true, activeAccount will always have a value because initialAccount is set to accounts[0] when accounts exist (line 64). The type assertion is actually unnecessary but not harmful. A null check isn't needed here because the component's logic prevents this case.
    I could be wrong about the initialization logic - there might be edge cases where accounts array becomes empty after initialization. Also, the type assertion suggests the original author was unsure about nullability.
    The component's structure ensures activeAccount will have a value when the modal can be opened - the button to open it only appears when accounts exist, and activeAccount is always initialized with accounts[0] in this case.
    The comment should be deleted because the suggested null check is unnecessary given the component's logic that prevents this edge case.
2. frontend/src/components/SignozModal/SignozModal.tsx:8
  • Draft comment:
    Consider handling both className and rootClassName props for better flexibility and to avoid confusion.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The SignozModal component in SignozModal.tsx uses rootClassName but the className prop is not used. This could lead to confusion or missed styling opportunities. It's better to handle both className and rootClassName for flexibility.
3. frontend/src/container/CloudIntegrationPage/HeroSection/components/AccountSettingsModal.tsx:45
  • Draft comment:
    Wrap renderRegionSelector in useCallback to optimize performance and prevent unnecessary re-renders.
  • Reason this comment was not posted:
    Confidence changes required: 40%
    The AccountSettingsModal.tsx file imports useCallback but does not use it for the renderRegionSelector function. This could lead to unnecessary re-renders. Wrapping renderRegionSelector in useCallback would optimize performance.
4. frontend/src/container/CloudIntegrationPage/HeroSection/components/AccountSettingsModal.tsx:94
  • Draft comment:
    Wrap renderAccountDetails in useCallback to optimize performance and prevent unnecessary re-renders.
  • Reason this comment was not posted:
    Confidence changes required: 40%
    The AccountSettingsModal.tsx file imports useCallback but does not use it for the renderAccountDetails function. This could lead to unnecessary re-renders. Wrapping renderAccountDetails in useCallback would optimize performance.

Workflow ID: wflow_ypwtuKbzg9EahAZt


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

</button>
</div>
<Select
style={{ height: '44px' }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid using inline styles in React components. Consider using CSS classes or styled components instead.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Incremental review on 7305c2d in 52 seconds

More details
  • Looked at 33 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. frontend/src/pages/IntegrationsModulePage/IntegrationsModulePage.tsx:5
  • Draft comment:
    Remove the old import statement for CloudIntegrationPage to avoid redundancy and confusion.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
2. frontend/src/pages/IntegrationsModulePage/IntegrationsModulePage.tsx:5
  • Draft comment:
    Avoid using the component/index.tsx file structure approach, as it makes it difficult to debug and find components using global search tools like VS Code. This applies to the CloudIntegrationPage import.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_OozjWcDG1mHTUnAR


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested. Incremental review on 0a362df in 1 minute and 13 seconds

More details
  • Looked at 1724 lines of code in 18 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. frontend/src/container/CloudIntegrationPage/HeroSection/components/AccountActions.tsx:143
  • Draft comment:
    Consider adding a null check for activeAccount before rendering AccountSettingsModal to avoid potential runtime errors.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The AccountSettingsModal is only accessible via a button that's inside a conditional block (accounts?.length). This means the button to open the modal is only shown when there are accounts, and in that case activeAccount will always have a value (either from URL or first account). The force type casting is actually safe here because the UI flow prevents null cases.
    I could be wrong about the UI flow - there might be edge cases where accounts data is loaded/changed after initial render. Also, defensive programming generally favors explicit null checks over implicit safety.
    The component's logic ensures activeAccount is populated before the modal can be opened - the type assertion is a implementation detail that doesn't create actual runtime risk. Adding a null check would be defensive programming without practical benefit.
    The comment should be deleted because the suggested null check is unnecessary - the component's structure already ensures type safety through its UI flow.
2. frontend/src/container/CloudIntegrationPage/HeroSection/components/AccountSettingsModal.tsx:104
  • Draft comment:
    Since account is a required prop, the optional chaining (?.) is unnecessary. Consider removing it for cleaner code. This applies to other instances in this file as well.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The AccountSettingsModal component uses account?.id in multiple places. Since account is a required prop, the optional chaining is unnecessary and can be removed for cleaner code.
3. frontend/src/container/CloudIntegrationPage/HeroSection/HeroSection.tsx:16
  • Draft comment:
    Avoid using inline styles for the background image. Consider using a CSS class instead.
  • Reason this comment was not posted:
    Comment was not on a valid diff hunk.
4. frontend/src/container/CloudIntegrationPage/HeroSection/components/AccountActions.tsx:35
  • Draft comment:
    Use a design token or predefined color constant instead of hardcoding the color value for the Check component.
  • Reason this comment was not posted:
    Comment was not on a valid diff hunk.
5. frontend/src/container/CloudIntegrationPage/HeroSection/components/AccountActions.tsx:99
  • Draft comment:
    Use a design token or predefined color constant instead of hardcoding the color value for the ChevronDown component.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_bYZ7eg2kFD76dvLa


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

if (checked) {
setSelectedRegions(['all']);
} else {
setSelectedRegions([]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider retaining the previously selected regions when includeAllRegions is unchecked instead of clearing them entirely. This might provide a better user experience.

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.

1 participant