feat: optional description for robots
Summary by CodeRabbit
-
New Features
- Added a new optional "Description" field for each robot, allowing users to store, edit, and view textual descriptions.
- Introduced a description input field in the Save Recording modal with character limit and live count.
- Enabled updating robot descriptions via the recording update endpoint and workflow saving process.
- Displayed robot descriptions in the Robot Settings modal as a read-only field.
-
Bug Fixes
- Updated environment variable loading to improve compatibility.
"""
Walkthrough
The changes introduce a new description field to the robot entity in both the database and the TypeScript model. A database migration script is added to create the new column, and the Sequelize model and TypeScript interfaces are updated to reflect this addition. In the front-end, a new state variable and input field for a recording description are added to the save recording modal, and this description is now included in the save payload sent via socket. On the server side, the workflow save handler and method are updated to accept and store the optional description. Additionally, the database configuration file updates its environment variable loading syntax from ES module to CommonJS.
Changes
| File(s) | Change Summary |
|---|---|
| server/src/db/config/database.js | Changed dotenv import/configuration from ES module to CommonJS syntax. |
| server/src/db/migrations/20250501194640-add-description-to-robot.js | Added migration to add a nullable description column (type TEXT) to the robot table. |
| server/src/models/Robot.ts | Added optional description field to RobotAttributes interface and Robot class; updated Sequelize model. |
| src/components/recorder/SaveRecording.tsx | Added state and input field for recording description in the save recording modal; included description in save payload. |
| server/src/workflow-management/classes/Generator.ts | Updated socket save event handler and saveNewWorkflow method to accept and store optional description field; updated logs. |
| server/src/routes/storage.ts | Extended PUT /recordings/:id endpoint to accept and update the description field on robot records. |
| src/api/storage.ts | Extended updateRecording function to accept optional description field in data parameter. |
| src/components/robot/RobotEdit.tsx | Refactored credential extraction logic; added support for editing and saving a robot description with UI and validation. |
| src/components/robot/RobotSettings.tsx | Added optional description field to RobotSettings interface; added read-only description display in settings modal. |
Sequence Diagram(s)
sequenceDiagram
participant User
participant SaveRecordingModal
participant State
User->>SaveRecordingModal: Open modal
SaveRecordingModal->>State: Initialize saveRecordingDescription
User->>SaveRecordingModal: Enter description in TextField
SaveRecordingModal->>State: Update saveRecordingDescription
SaveRecordingModal->>Socket: Emit save event with fileName, description, etc.
sequenceDiagram
participant Socket
participant WorkflowGenerator
participant Database
Socket->>WorkflowGenerator: save(fileName, userId, isLogin, robotId, description)
WorkflowGenerator->>Database: Update or create robot with description
WorkflowGenerator->>WorkflowGenerator: Log robot saving with description
sequenceDiagram
participant MigrationScript
participant Database
MigrationScript->>Database: Add 'description' column to 'robot' table (up)
Note right of Database: Column is nullable, type TEXT
MigrationScript-->>Database: Remove 'description' column (down)
Possibly related PRs
- getmaxun/maxun#579: Related changes to the PUT
/recordings/:idendpoint focusing on request payload handling for limits, complementary to this PR’s description field addition. - getmaxun/maxun#617: Both PRs modify dotenv import/config usage in
server/src/db/config/database.jsbut with different approaches. - getmaxun/maxun#385: Overlapping enhancements in
src/components/robot/RobotEdit.tsxincluding credential logic and description field support.
Suggested labels
Type: Feature
Suggested reviewers
- amhsirak
Poem
In the warren of code, a new field appears,
Robots now have stories, to laughter and cheers!
A modal with input, for tales yet unsaid,
While dotenv’s syntax tucks variables in bed.
Hopping through migrations, the schema expands—
More room for descriptions, in bunny-built lands!
🐇✨ """
✨ Finishing Touches
- [ ] 📝 Generate Docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
🪧 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.Explain this complex logic.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai explain this code block.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin 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 explain its main purpose.@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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai generate sequence diagramto generate a sequence diagram of the changes in this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile 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.
@RohitR311 review.
@AmitChauhan63390 Resolve merge conflicts.
@RohitR311 is this PR good to go?