-
Notifications
You must be signed in to change notification settings - Fork 81
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
Add ability to rename projects #306
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Changes requested. Reviewed everything up to 757f01a in 40 seconds
More details
- Looked at
197
lines of code in3
files - Skipped
0
files when reviewing. - Skipped posting
2
drafted comments based on config settings.
1. frontend/app/api/projects/[projectId]/route.ts:11
- Draft comment:
Consider adding validation for thename
field to ensure it meets any necessary criteria (e.g., length, character restrictions) before proceeding with the update. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
While input validation is generally good practice, we don't have enough context about the project's requirements or the schema constraints. The validation rules would be arbitrary without knowing the actual requirements. The current null check provides basic validation, and database-level constraints would catch any serious issues.
The comment suggests a reasonable security/validation practice. Not having proper input validation could lead to data quality issues.
Without seeing the schema or requirements, suggesting specific validation would be speculative. The database schema likely already has constraints, and we shouldn't duplicate them without good reason.
Delete the comment as it's speculative without context and could lead to arbitrary validation rules that may conflict with actual requirements or existing database constraints.
2. frontend/components/settings/rename-project.tsx:33
- Draft comment:
Consider adding a try-catch block around the fetch call to handle network errors gracefully. - Reason this comment was not posted:
Decided after close inspection that this draft comment was likely wrong and/or not actionable:
The comment has merit since network errors would leave the UI in a bad state with perpetual loading. However, the code already has basic error handling. The improvement would be incremental rather than fixing a serious bug. The current error handling may be sufficient for the app's needs.
I may be underestimating the importance of handling network errors properly. An uncaught error could cause other issues in the app.
While network error handling is important, the existing error handling catches most cases and logs errors. The UI impact is limited since the dialog can be closed and reopened.
The comment suggests a valid improvement but isn't critical enough to warrant keeping, given the existing error handling and limited impact of network errors in this context.
Workflow ID: wflow_OJmil0CHFtDVI3s4
Want Ellipsis to fix these issues? Tag @ellipsis-dev
in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet
mode, and more.
window.location.reload(); | ||
} else { | ||
// Handle error (e.g., show toast or error message) | ||
console.error('Failed to rename project'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider providing user feedback for errors, such as displaying a toast notification or an error message, instead of just logging to the console.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
export async function DELETE( | ||
export async function PUT( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you delete DELETE endpoint? Also, we prefer to use POST instead of PUT for updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I should not have to delete DELETE endpoint. Can you suggest me how to handle DELETE endpoint in absence of auth related lines since auth related lines are redundant? Should I directly perform the delete operation in the database?
I will convert PUT to POST in next commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just remove the auth-related lines in the route handler itself. This is already handled in middleware.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After removing auth-related lines in the route its just stop working. May be DELETE route rely on requiring apiKey or user session . if something I missing here please guide me .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ve reverted the DELETE endpoint as per your feedback. Additionally, I’ve converted the previous PUT method to POST for updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll checkout to your repo/branch later this week to try and reproduce the auth-related issue. If I manage to get things working, I'll merge the rest, thanks
title: 'Project Renamed', | ||
description: `Project renamed successfully!.`, | ||
}); | ||
window.location.reload(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we change this to router.refresh()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, of course! I can make that change to use router.refresh()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
}); | ||
router.refresh(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should probably do setIsRenameDialogOpen(false)
here. Now the dialog does not close on successful rename
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thank you for reviewing and merging my PR! I appreciate your time and feedback. |
* Merge pull request #311 from lmnr-ai/fix/dashboard-tooltip fix double conversion date in chart tooltip too * Collapsable trace tree (#312) * Add ability to rename projects (#306) * Add ability to rename projects * Added user feedback notifiaction and convert PUT to POST * change to router.refresh * add close dialog after rename * Custom-formatter (#305) --------- Co-authored-by: skull8888888 <skull8888888@gmail.com> Co-authored-by: Nidhi Singh <120259299+nidhi-wa@users.noreply.github.com>
Description:
This PR introduces the ability to rename existing projects via a new PUT route (/projects/[projectId]) and updates the frontend to allow users to rename projects through the UI.
Currently, projects cannot be renamed after creation. This feature will allow users to update project names easily.
Changes Made
error responses are returned.
Allows users to rename a project from the UI.
Refactored DELETE Route:
Removed redundant authentication lines, as they are now handled by middleware.
#300
Important
Adds functionality to rename projects via a new API route and UI component, and refactors DELETE route authentication.
PUT
route inroute.ts
to rename projects using Drizzle ORM.RenameProject
component inrename-project.tsx
for renaming projects via a dialog.RenameProject
intosettings.tsx
.DELETE
route inroute.ts
to remove redundant authentication.This description was created by for 757f01a. It will automatically update as commits are pushed.