Skip to content

feat: n8n Integration #578

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

Draft
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

AmitChauhan63390
Copy link
Contributor

@AmitChauhan63390 AmitChauhan63390 commented May 1, 2025

Summary by CodeRabbit

  • New Features

    • Added support for the "n8n" integration type in the integration settings interface and modal, including a new selection button with custom icon and navigation.
  • Style

    • Corrected image paths for Google Sheets and Airtable icons in the integration modal.

Copy link

coderabbitai bot commented May 1, 2025

Walkthrough

The changes introduce support for a new integration type, "n8n", into the integration settings modal alongside the existing "googleSheets" and "airtable" options. The IntegrationSettings interface and related React state were updated to accommodate "n8n". The modal UI was modified to add a button for selecting "n8n", including its icon and navigation logic. Additionally, image source paths for existing integration icons were corrected. Minor formatting adjustments were made in the recording save component, but no functional changes occurred there.

Changes

File(s) Change Summary
src/components/integration/IntegrationSettings.tsx Added support for "n8n" integration type in interface, state, and modal UI; fixed icon image paths.
src/components/recorder/SaveRecording.tsx Modified import formatting and added blank lines after saveRecording() call; no functional changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant IntegrationModal
    participant Router

    User->>IntegrationModal: Opens integration settings
    IntegrationModal->>User: Shows integration type options (Google Sheets, Airtable, n8n)
    User->>IntegrationModal: Clicks "n8n" button
    IntegrationModal->>IntegrationModal: Sets selectedIntegrationType to "n8n"
    IntegrationModal->>Router: Navigates to /robots/{recordingId}/integrate/n8n
Loading

Suggested labels

Type: Feature

Poem

A new friend joins the integration crew,
"n8n" hops in, with buttons and icons new!
Sheets and Airtable, don't feel blue—
Your image paths are fixed up too.
With every click, a rabbit grins,
For integrations grow, and everyone wins!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between df1ea5e and f4fd851.

📒 Files selected for processing (1)
  • src/components/recorder/SaveRecording.tsx (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/components/recorder/SaveRecording.tsx
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

Copy link

@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: 2

🧹 Nitpick comments (2)
src/components/recorder/SaveRecording.tsx (1)

11-11: Updated import to include redirect from react-router-dom.

The import statement now includes the redirect function from 'react-router-dom', alongside the existing useNavigate. This change is likely related to supporting the new n8n integration navigation paths, although redirect isn't currently used in this file.

Consider removing the unused redirect import if it's not being utilized in this component.

src/components/integration/IntegrationSettings.tsx (1)

422-422: n8n icon sizing is inconsistent with other integration icons.

The n8n icon is being rendered with explicit height and width attributes (100px), making it appear larger than the other integration icons that use the default size with just margin.

Consider using consistent sizing across all integration icons for better UI alignment:

-              <img src="/svg/n8n.svg" alt="n8n" height={100} width={100}  style={{ margin: "30px" }} />
+              <img src="/svg/n8n.svg" alt="n8n" style={{ margin: "6px" }} />
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 60176fe and df1ea5e.

⛔ Files ignored due to path filters (1)
  • public/svg/n8n.svg is excluded by !**/*.svg
📒 Files selected for processing (2)
  • src/components/integration/IntegrationSettings.tsx (4 hunks)
  • src/components/recorder/SaveRecording.tsx (2 hunks)
🔇 Additional comments (6)
src/components/recorder/SaveRecording.tsx (1)

57-59: Added blank lines after saveRecording() call.

Two blank lines were added after the saveRecording() function call, which is a minor formatting change that doesn't affect functionality. This change maintains consistent code style.

src/components/integration/IntegrationSettings.tsx (5)

37-37: Extended the IntegrationSettings interface to support n8n.

The integrationType field in the IntegrationSettings interface now includes "n8n" as a valid option alongside the existing "googleSheets" and "airtable" types.


87-87: Updated selectedIntegrationType state type to include n8n.

The state type for selectedIntegrationType now includes "n8n" as a valid option, aligning with the interface update.


397-397: Corrected image source path for Google Sheets icon.

The image source path was updated by removing the /public prefix, which is the correct approach since the public directory serves as the root for static assets.


410-410: Corrected image source path for Airtable icon.

Similarly, the Airtable icon path was fixed by removing the /public prefix from the source path.


1-670:

✅ Verification successful

Verify n8n SVG asset exists in the public directory.

The code references a new SVG file for the n8n icon at "/svg/n8n.svg", but it's not clear if this file has been included in the pull request.


🏁 Script executed:

#!/bin/bash
# Check if the n8n SVG file exists in the public directory
if [ -f "public/svg/n8n.svg" ]; then
  echo "n8n.svg exists in public/svg directory"
else
  echo "ERROR: n8n.svg does not exist in public/svg directory"
  # List files in the public/svg directory to see what's available
  echo "Available files in public/svg:"
  ls -la public/svg/
fi

Length of output: 118


n8n.svg asset verified
The public/svg/n8n.svg file exists in the repository, so the icon reference is correct.

Comment on lines +413 to +424
<Button
variant="outlined"
onClick={() => {
setSelectedIntegrationType("airtable");
setSettings({ ...settings, integrationType: "n8n" });
navigate(`/robots/${recordingId}/integrate/n8n`);
}}
style={{ display: "flex", flexDirection: "column", alignItems: "center", background: 'white', color: '#ff00c3' }}
>
<img src="/svg/n8n.svg" alt="n8n" height={100} width={100} style={{ margin: "30px" }} />
n8n
</Button>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Missing UI implementation for n8n integration settings.

While the n8n integration type has been added to the interface and a button has been added to select it, there's no corresponding UI implementation for n8n integration settings in the modal. The modal only has conditions for handling "googleSheets" and "airtable" types, but nothing for "n8n".

Add a condition for handling the n8n integration type in the modal, similar to how the other integration types are implemented. This can be done by adding a new conditional block in the return statement around line 654:

{settings.integrationType === "n8n" && (
  <>
    <Typography variant="h6">
      {t("integration_settings.n8n.title") || "n8n Integration"}
    </Typography>
    
    {/* Add n8n specific UI elements here */}
    <p>{t("integration_settings.n8n.descriptions.sync_info") || "Connect your Robot to n8n workflows."}</p>
    
    {/* Additional implementation as needed */}
  </>
)}

⚠️ Potential issue

Added n8n integration button but with incorrect integration type.

The button for the n8n integration was added, but there's an inconsistency in the implementation. When the button is clicked, setSelectedIntegrationType("airtable") is called instead of setSelectedIntegrationType("n8n").

Fix the integration type being set when the n8n button is clicked:

-                setSelectedIntegrationType("airtable");
+                setSelectedIntegrationType("n8n");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Button
variant="outlined"
onClick={() => {
setSelectedIntegrationType("airtable");
setSettings({ ...settings, integrationType: "n8n" });
navigate(`/robots/${recordingId}/integrate/n8n`);
}}
style={{ display: "flex", flexDirection: "column", alignItems: "center", background: 'white', color: '#ff00c3' }}
>
<img src="/svg/n8n.svg" alt="n8n" height={100} width={100} style={{ margin: "30px" }} />
n8n
</Button>
<Button
variant="outlined"
onClick={() => {
- setSelectedIntegrationType("airtable");
+ setSelectedIntegrationType("n8n");
setSettings({ ...settings, integrationType: "n8n" });
navigate(`/robots/${recordingId}/integrate/n8n`);
}}
style={{ display: "flex", flexDirection: "column", alignItems: "center", background: 'white', color: '#ff00c3' }}
>
<img src="/svg/n8n.svg" alt="n8n" height={100} width={100} style={{ margin: "30px" }} />
n8n
</Button>

@amhsirak amhsirak added Type: Feature New features Type: Integration All issues/PRs related to integrations labels May 1, 2025
@amhsirak amhsirak changed the title N8n Integration feat: n8n Integration May 2, 2025
@amhsirak amhsirak marked this pull request as draft May 2, 2025 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New features Type: Integration All issues/PRs related to integrations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants