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(wip): add custom step #5323

Merged
merged 11 commits into from May 5, 2024
Merged

feat(wip): add custom step #5323

merged 11 commits into from May 5, 2024

Conversation

djabarovgeorge
Copy link
Contributor

What change does this PR introduce?

Why was this change needed?

Other information (Screenshots)

Copy link

netlify bot commented Mar 20, 2024

Deploy Preview for dev-web-novu ready!

Name Link
🔨 Latest commit 711988e
🔍 Latest deploy log https://app.netlify.com/sites/dev-web-novu/deploys/66379a0cbdcfa600083d334d
😎 Deploy Preview https://deploy-preview-5323--dev-web-novu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

await this.jobRepository.updateOne(
{ _id: command.job._id, _environmentId: command.environmentId },
{
$set: { 'overrides.customStep': command.chimeraData?.outputs },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we definitely need to find a better place for this data.

Comment on lines +116 to +119
stepType === StepTypeEnum.DELAY ||
stepType === StepTypeEnum.DIGEST ||
stepType === StepTypeEnum.TRIGGER ||
stepType === StepTypeEnum.CUSTOM;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Create ActionStepTypeEnum and skip by it

Suggested change
stepType === StepTypeEnum.DELAY ||
stepType === StepTypeEnum.DIGEST ||
stepType === StepTypeEnum.TRIGGER ||
stepType === StepTypeEnum.CUSTOM;
const skipStep = ActionStepTypeEnum.values.includes((action) => action === stepType)

@scopsy
Copy link
Contributor

scopsy commented Apr 10, 2024

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Apr 10, 2024

Walkthrough

The recent updates primarily focus on enhancing the integration and management of custom steps in the application workflow. The changes include the introduction of a new CUSTOM step type across various components, improved memory allocation for script execution, and adjustments in UI components to support custom step configurations. Additionally, backend logic has been refined to handle these custom steps effectively, ensuring seamless integration and execution within the system's workflow.

Changes

File Path Change Summary
.../get-active-integrations-status.usecase.ts Added a condition to skip steps of type CUSTOM.
.../web/package.json Increased memory allocation for the start script.
.../ChannelPreview.tsx, .../ChannelStepEditor.tsx Enhanced UI to support CUSTOM step type, including new component rendering and conditional logic.
.../TemplateCustomEditor.tsx Introduced a new component for custom template editing using react-hook-form and @mantine/core.
.../constants.tsx, .../AddStepMenu.tsx, .../channels.ts Updated constants and UI components to include CUSTOM step type and filtering logic.
.../send-message.usecase.ts, .../workflow.module.ts Integrated custom step execution logic in the messaging workflow.
.../job.entity.ts, .../index.ts Updated type annotations and added CUSTOM to StepTypeEnum.

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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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
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: 1

Comment on lines 12 to 20
@InstrumentUsecase()
public async execute(command: SendMessageCommand) {
await this.jobRepository.updateOne(
{ _id: command.job._id, _environmentId: command.environmentId },
{
$set: { 'overrides.customStep': command.chimeraData?.outputs },
}
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding error handling for the database operation to manage potential failures gracefully.

  public async execute(command: SendMessageCommand) {
    try {
      await this.jobRepository.updateOne(
        { _id: command.job._id, _environmentId: command.environmentId },
        { $set: { 'overrides.customStep': command.chimeraData?.outputs } }
      );
    } catch (error) {
      // Handle error appropriately
      console.error('Failed to execute custom step:', error);
      throw error;
    }
  }

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.

Suggested change
@InstrumentUsecase()
public async execute(command: SendMessageCommand) {
await this.jobRepository.updateOne(
{ _id: command.job._id, _environmentId: command.environmentId },
{
$set: { 'overrides.customStep': command.chimeraData?.outputs },
}
);
}
@InstrumentUsecase()
public async execute(command: SendMessageCommand) {
try {
await this.jobRepository.updateOne(
{ _id: command.job._id, _environmentId: command.environmentId },
{
$set: { 'overrides.customStep': command.chimeraData?.outputs },
}
);
} catch (error) {
// Handle error appropriately
console.error('Failed to execute custom step:', error);
throw error;
}
}

Copy link

netlify bot commented Apr 30, 2024

Deploy Preview for novu-design ready!

Name Link
🔨 Latest commit 711988e
🔍 Latest deploy log https://app.netlify.com/sites/novu-design/deploys/66379a0c6e5ecd00083e897c
😎 Deploy Preview https://deploy-preview-5323--novu-design.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ainouzgali ainouzgali marked this pull request as ready for review May 5, 2024 14:40
@ainouzgali ainouzgali requested a review from a team as a code owner May 5, 2024 14:40
@ainouzgali ainouzgali requested a review from scopsy May 5, 2024 14:44
@ainouzgali ainouzgali merged commit 1dbf84d into next May 5, 2024
28 checks passed
@ainouzgali ainouzgali deleted the add-custom-step branch May 5, 2024 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants