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

chore: [Plugin Action Editor] Convert to Module #36305

Merged
merged 21 commits into from
Sep 13, 2024

Conversation

hetunandu
Copy link
Member

@hetunandu hetunandu commented Sep 13, 2024

Description

CE PR for: https://github.com/appsmithorg/appsmith-ee/pull/5134

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10845636973
Commit: 1f40848
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Fri, 13 Sep 2024 08:48:25 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features
    • Enhanced flexibility for child components in the Plugin Action Editor, allowing single or multiple React nodes.
    • Introduced a new toolbar with a dropdown menu for additional actions.
    • Added components for converting actions into modules, including callouts and disablers for better user feedback.
  • Bug Fixes
    • Improved user experience by providing notifications during the action conversion process.

Copy link
Contributor

coderabbitai bot commented Sep 13, 2024

Walkthrough

The changes in this pull request involve modifications to several components within the application, primarily focusing on enhancing the flexibility of the children prop in the ChildrenProps interface. Additionally, new components related to converting actions into modules have been introduced, including ConvertToModuleCTA, ConvertToModuleCallout, and ConvertToModuleDisabler. The restructuring of the AppPluginActionEditor component also reflects a shift towards a more modular approach, improving the organization and functionality of the user interface.

Changes

File Change Summary
app/client/src/PluginActionEditor/PluginActionContext.tsx Modified children type in ChildrenProps from ReactNode[] to `ReactNode
app/client/src/PluginActionEditor/PluginActionEditor.tsx Modified children type in ChildrenProps from ReactNode[] to `ReactNode
app/client/src/PluginActionEditor/components/PluginActionToolbar.tsx Added menuContent prop to PluginActionToolbarProps, allowing for flexible content in the toolbar's dropdown menu.
app/client/src/ce/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx Removed PluginActionToolbar and replaced it with AppPluginActionToolbar, introducing ConvertToModuleDisabler and ConvertToModuleCallout.
app/client/src/ce/pages/Editor/AppPluginActionEditor/components/AppPluginActionToolbar.tsx Introduced AppPluginActionToolbar component, utilizing PluginActionToolbar and integrating ConvertToModuleCTA.
app/client/src/ce/pages/Editor/AppPluginActionEditor/components/ConvertToModule/ConvertToModuleCTA.tsx Added ConvertToModuleCTA component for converting actions into modules, with permission checks for user actions.
app/client/src/ce/pages/Editor/AppPluginActionEditor/components/ConvertToModule/ConvertToModuleCallout.tsx Added ConvertToModuleCallout component to notify users during action conversion.
app/client/src/ce/pages/Editor/AppPluginActionEditor/components/ConvertToModule/ConvertToModuleDisabler.tsx Added ConvertToModuleDisabler component to conditionally disable child components during action conversion.
app/client/src/ce/pages/Editor/AppPluginActionEditor/components/ConvertToModule/index.tsx Exported ConvertToModuleCTA, ConvertToModuleDisabler, and ConvertToModuleCallout components for modular use.

Possibly related PRs

  • chore: Plugin Action Editor Context #36187: This PR introduces a new context for managing plugin actions, which directly relates to the changes made in the PluginActionContext.tsx file of the main PR, enhancing the management of plugin action states.
  • chore: Move Toolbar to IDE #36214: This PR involves the redesign of the toolbar at the IDE level, which is relevant to the PluginActionToolbar changes in the main PR, as it aims to improve the integration and functionality of toolbars within the application.

Suggested labels

IDE Product, Task, skip-changelog, IDE Pod, ok-to-test

Poem

In the realm of code, changes take flight,
Components restructured, a wondrous sight.
From props that are flexible, to menus that gleam,
Converting actions, a developer's dream.
With each little tweak, the interface sings,
Enhancing our tools, oh, the joy that it brings! 🎉

Tip

OpenAI O1 model for chat
  • We have deployed OpenAI's latest O1 model for chat.
  • OpenAI claims that this model has superior reasoning capabilities than their GPT-4o model.
  • Please share any feedback with us in the discussions post.

Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1760132 and 1f40848.

Files selected for processing (9)
  • app/client/src/PluginActionEditor/PluginActionContext.tsx (1 hunks)
  • app/client/src/PluginActionEditor/PluginActionEditor.tsx (1 hunks)
  • app/client/src/PluginActionEditor/components/PluginActionToolbar.tsx (2 hunks)
  • app/client/src/ce/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx (1 hunks)
  • app/client/src/ce/pages/Editor/AppPluginActionEditor/components/AppPluginActionToolbar.tsx (1 hunks)
  • app/client/src/ce/pages/Editor/AppPluginActionEditor/components/ConvertToModule/ConvertToModuleCTA.tsx (1 hunks)
  • app/client/src/ce/pages/Editor/AppPluginActionEditor/components/ConvertToModule/ConvertToModuleCallout.tsx (1 hunks)
  • app/client/src/ce/pages/Editor/AppPluginActionEditor/components/ConvertToModule/ConvertToModuleDisabler.tsx (1 hunks)
  • app/client/src/ce/pages/Editor/AppPluginActionEditor/components/ConvertToModule/index.tsx (1 hunks)
Files skipped from review due to trivial changes (1)
  • app/client/src/ce/pages/Editor/AppPluginActionEditor/components/ConvertToModule/index.tsx
Additional comments not posted (12)
app/client/src/ce/pages/Editor/AppPluginActionEditor/components/AppPluginActionToolbar.tsx (1)

5-7: Great work on the AppPluginActionToolbar component!

The component is correctly implemented and follows the functional component syntax. It's also making good use of the shared PluginActionToolbar component and the custom ConvertToModuleCTA component.

Exporting the component as the default export is a common and recommended pattern for React components.

app/client/src/ce/pages/Editor/AppPluginActionEditor/components/ConvertToModule/ConvertToModuleDisabler.tsx (1)

11-17: Great work on the ConvertToModuleDisabler component! 👏

The component is well-structured and follows best practices:

  • It uses the usePluginActionContext hook to access the current action, avoiding prop drilling.
  • It uses the useSelector hook to access the isConverting state for the current action, minimizing unnecessary re-renders.
  • It passes the isConverting state as the isDisabled prop to the Disabler component, keeping the component focused on a single responsibility.

Keep up the good work! 🌟

app/client/src/ce/pages/Editor/AppPluginActionEditor/AppPluginActionEditor.tsx (3)

7-11: Great job importing the new components! Can you provide more details about their purpose and functionality?

The imports for ConvertToModuleDisabler and ConvertToModuleCallout are correctly structured. Based on their names, these components seem to be related to the module conversion feature. To help reviewers understand the changes better, can you please provide a brief explanation of what these components do and how they fit into the overall module conversion process?


16-21: Excellent work restructuring the component hierarchy! This modular approach enhances the user experience.

The new component structure, with ConvertToModuleDisabler wrapping the AppPluginActionToolbar, ConvertToModuleCallout, PluginActionForm, and PluginActionResponsePane components, is a great way to organize the user interface and handle user interactions related to module conversion.

This modular approach not only improves code readability but also allows for a more flexible and maintainable codebase. The placement of PluginActionForm and PluginActionResponsePane within the new hierarchy suggests a more complex interaction model that likely provides additional context and functionality to users during the module conversion process.

Keep up the good work!


17-18: Nice work adding the new components! Can you provide more details about their functionality and appearance?

The introduction of the AppPluginActionToolbar and ConvertToModuleCallout components is a great addition to the AppPluginActionEditor. Based on the context, it seems that AppPluginActionToolbar replaces the functionality of the removed PluginActionToolbar, while ConvertToModuleCallout adds a new callout feature related to module conversion.

To help reviewers understand these changes better, can you please provide a brief description of what these components do, how they interact with the user, and what they look like? Screenshots or GIFs showcasing their appearance and behavior would be really helpful!

app/client/src/ce/pages/Editor/AppPluginActionEditor/components/ConvertToModule/ConvertToModuleCallout.tsx (1)

13-38: Great job with the ConvertToModuleCallout component! 👏

The component is well-structured and follows best practices for functional components. It effectively uses hooks to access the necessary data and conditionally renders the notification based on the conversion status. The icon resolution logic is nicely abstracted into a separate utility function, promoting code reusability and maintainability.

Keep up the excellent work! 🌟

app/client/src/PluginActionEditor/components/PluginActionToolbar.tsx (3)

3-3: Great job importing the necessary components!

The imported components Menu, MenuContent, MenuTrigger from the @appsmith/ads library are relevant to the changes made in this file. This is a good practice to keep the imports focused and avoid unnecessary bloat.


9-9: Excellent addition of the menuContent prop!

The new optional prop menuContent in the PluginActionToolbarProps interface allows for flexible content to be passed to the menu component. The type definition React.ReactNode[] | React.ReactNode is appropriate and provides the necessary flexibility.


33-45: Fantastic implementation of the Menu component!

The new Menu component is a great addition to the toolbar. It enhances the functionality by providing a dropdown menu for additional actions. Here's what I like about this implementation:

  • The MenuTrigger correctly wraps the button that serves as the trigger for the menu. This is a good use of the component.
  • The MenuContent renders the content passed via the menuContent prop, which allows for flexibility in what is displayed in the menu.
  • The menuContent prop is correctly used to pass the content to the MenuContent component.

Overall, this is a well-structured and correctly implemented addition to the toolbar. Great work!

app/client/src/ce/pages/Editor/AppPluginActionEditor/components/ConvertToModule/ConvertToModuleCTA.tsx (1)

1-35: Great work on the ConvertToModuleCTA component! 👍

The component is well-structured and makes good use of hooks and selectors to determine the necessary information. Here are a few key points:

  1. The usage of usePluginActionContext hook to access the action object is a good practice.
  2. Checking the feature flag status using the useFeatureFlag hook ensures that the component behaves correctly based on the feature flag.
  3. Using the useSelector hook to get the page permissions is a clean approach.
  4. The helper functions getHasCreateActionPermission and getHasDeleteActionPermission are used correctly to determine the create and delete permissions based on the feature flag and permissions.
  5. The component correctly passes the necessary props to the ConvertToModuleInstanceCTA component.

Overall, the component is implemented correctly and follows best practices. Keep up the good work! 🌟

app/client/src/PluginActionEditor/PluginActionContext.tsx (1)

23-23: Great work on enhancing the flexibility of the children prop! 👍

By modifying the type definition of the children property in the ChildrenProps interface to accept either a single ReactNode or an array of ReactNode, you have made it more versatile. This change allows components utilizing this context to accommodate both singular and multiple child components without enforcing an array structure.

This adjustment opens up more flexible usage patterns and simplifies the integration of this context into various component structures. Well done on improving the adaptability of the code! 🌟

app/client/src/PluginActionEditor/PluginActionEditor.tsx (1)

21-21: Great work on making the component more flexible! 👍

By updating the children prop type to React.ReactNode | React.ReactNode[], you've made the PluginActionEditor component more versatile and easier to use. It can now accept either a single child or an array of children without requiring any additional wrapping.

This change enhances the component's usability and reduces the burden on developers using it, as they no longer need to ensure that the children are always passed as an array.

Well done on this improvement! 🌟


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Sep 13, 2024
@hetunandu hetunandu added the ok-to-test Required label for CI label Sep 13, 2024
Copy link

⚠️ Cyclic Dependency Check:

This PR has increased the number of cyclic dependencies by 2, when compared with the release branch.

Refer this document to identify the cyclic dependencies introduced by this PR.

@hetunandu hetunandu merged commit f593ed3 into release Sep 13, 2024
48 checks passed
@hetunandu hetunandu deleted the chore/plugin-action-editor-1 branch September 13, 2024 08:59
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Sep 26, 2024
## Description

CE PR for: https://github.com/appsmithorg/appsmith-ee/pull/5134




## Automation

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

### 🔍 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/10845636973>
> Commit: 1f40848
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10845636973&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity`
> Spec:
> <hr>Fri, 13 Sep 2024 08:48:25 UTC
<!-- end of auto-generated comment: Cypress test results  -->


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


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

## Summary by CodeRabbit

- **New Features**
- Enhanced flexibility for child components in the Plugin Action Editor,
allowing single or multiple React nodes.
	- Introduced a new toolbar with a dropdown menu for additional actions.
- Added components for converting actions into modules, including
callouts and disablers for better user feedback.
- **Bug Fixes**
- Improved user experience by providing notifications during the action
conversion process.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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 skip-changelog Adding this label to a PR prevents it from being listed in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants