Skip to content

chore: git modularisation disconnect modal#37938

Merged
ashit-rath merged 1 commit intoreleasefrom
chore/git-mod-disconnect-modal
Dec 6, 2024
Merged

chore: git modularisation disconnect modal#37938
ashit-rath merged 1 commit intoreleasefrom
chore/git-mod-disconnect-modal

Conversation

@ashit-rath
Copy link
Contributor

@ashit-rath ashit-rath commented Dec 4, 2024

Description

Decouple and move disconnect modal

Fixes #37811

Automation

/ok-to-test tags="@tag.Git"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12155733900
Commit: f30ad80
Cypress dashboard.
Tags: @tag.Git
Spec:


Wed, 04 Dec 2024 09:17:09 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced the DisconnectModal component for disconnecting Git repositories from applications.
    • Added input validation for the application name with a "Revoke" button that is conditionally enabled.
    • Included a warning message about the irreversible action and a link to documentation.
  • Tests

    • Implemented a comprehensive test suite for the DisconnectModal to ensure correct functionality and user interactions.

@ashit-rath ashit-rath requested a review from brayn003 December 4, 2024 08:22
@ashit-rath ashit-rath self-assigned this Dec 4, 2024
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 4, 2024

Walkthrough

This pull request introduces a new DisconnectModal component in React for managing the disconnection of a Git repository from an application. It includes a comprehensive test suite that verifies the component's functionality, such as rendering based on props, managing input state, and handling user interactions. Key features include enabling/disabling the "Revoke" button based on input validation and logging analytics events. The modal also provides user feedback and documentation links.

Changes

File Path Change Summary
app/client/src/git/components/DisconnectModal/index.tsx Introduced DisconnectModal component with state management for application name and disconnection logic.
app/client/src/git/components/DisconnectModal/index.test.tsx Added a test suite for DisconnectModal, covering rendering, button states, callbacks, and analytics logging.

Possibly related PRs

Suggested labels

Task, Git Product, Git Platform, ok-to-test

Suggested reviewers

  • ankitakinger
  • albinAppsmith

🎉 In the realm of code, a modal takes flight,
To disconnect Git, it shines so bright.
With tests all around, it stands tall and true,
Ensuring each click does just what it should do.
So here’s to the changes, both clever and neat,
In the world of development, we can’t be beat! 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added Packages & Git Pod All issues belonging to Packages and Git Packages Pod issues that belong to the packages pod Task A simple Todo labels Dec 4, 2024
@ashit-rath ashit-rath added the ok-to-test Required label for CI label Dec 4, 2024
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Dec 4, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (5)
app/client/src/git/components/DisconnectModal/index.tsx (3)

26-34: Consider moving documentation URL to constants and adding type safety

The documentation URL should be moved to a constants file for better maintainability, and the link props should be typed.

+interface DocsLinkProps {
+  children: string;
+  to: string;
+  className: string;
+}

-const DOCS_LINK_PROPS = [
+const DOCS_LINK_PROPS: DocsLinkProps[] = [

67-70: Consider case-insensitive comparison for app name validation

The strict equality comparison might frustrate users if they match the name but with different casing.

-    appName !== disconnectingApp.name ||
+    appName.toLowerCase() !== disconnectingApp.name.toLowerCase() ||

109-116: Enhance accessibility with ARIA attributes

Consider adding aria-label and aria-describedby to improve screen reader support.

 <Input
   className="t--git-app-name-input"
   label={createMessage(APPLICATION_NAME)}
   onBlur={inputOnBlur}
   onChange={inputOnChange}
   size="md"
   value={appName}
+  aria-label="Confirm application name for disconnection"
+  aria-describedby="disconnect-warning"
 />
app/client/src/git/components/DisconnectModal/index.test.tsx (2)

27-105: Add tests for edge cases

Consider adding tests for:

  • Modal close behavior when clicking outside
  • Error handling for empty app ID
  • Maximum length validation for input

106-165: Add async behavior tests

Consider adding tests for:

  • Loading states during disconnect operation
  • Error handling during disconnect
  • Retry scenarios
it('should show loading state during disconnect', async () => {
  // Test implementation
});
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 1078a03 and f30ad80.

📒 Files selected for processing (2)
  • app/client/src/git/components/DisconnectModal/index.test.tsx (1 hunks)
  • app/client/src/git/components/DisconnectModal/index.tsx (1 hunks)
🔇 Additional comments (3)
app/client/src/git/components/DisconnectModal/index.tsx (2)

37-51: LGTM! Clean props interface and styling


81-89: Review analytics data exposure

The analytics event logs both the user input and expected app name. Consider hashing or omitting sensitive data.

app/client/src/git/components/DisconnectModal/index.test.tsx (1)

1-26: LGTM! Well-structured test setup with proper mocks

@ashit-rath ashit-rath merged commit a9471f0 into release Dec 6, 2024
@ashit-rath ashit-rath deleted the chore/git-mod-disconnect-modal branch December 6, 2024 05:19
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Dec 9, 2024
## Description
Decouple and move disconnect modal

Fixes appsmithorg#37811

## Automation

/ok-to-test tags="@tag.Git"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12155733900>
> Commit: f30ad80
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12155733900&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Git`
> Spec:
> <hr>Wed, 04 Dec 2024 09:17:09 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Introduced the `DisconnectModal` component for disconnecting Git
repositories from applications.
- Added input validation for the application name with a "Revoke" button
that is conditionally enabled.
- Included a warning message about the irreversible action and a link to
documentation.

- **Tests**
- Implemented a comprehensive test suite for the `DisconnectModal` to
ensure correct functionality and user interactions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@coderabbitai coderabbitai bot mentioned this pull request Dec 23, 2024
2 tasks
@coderabbitai coderabbitai bot mentioned this pull request Dec 30, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Required label for CI Packages & Git Pod All issues belonging to Packages and Git Packages Pod issues that belong to the packages pod skip-changelog Adding this label to a PR prevents it from being listed in the changelog Task A simple Todo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Task] Git mod - Components - Disconnect git

2 participants