Skip to content

Feat/allow renaming project path #1737

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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

pranavtartey
Copy link

@pranavtartey pranavtartey commented Apr 5, 2025

Description

Closes: #1425

  1. Added the popup while the user is trying to change the path from the settings.
  2. Shows popup to confirm path change.
  3. Copies the folder and the content inside to the updated address while keeping the original copy.
  4. After the confirmation shows toast message for the path update.
  5. Popup and toast are supported in all four languages.

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Release
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

flip-buttons-screenshot

after-path-update

Additional Notes


Important

Adds feature to rename project paths with confirmation dialog, toast notifications, and localization support.

  • Behavior:
    • Adds moveFolder() in index.ts to copy project folder to a new path.
    • Implements MOVE_PROJECT_FOLDER channel in code.ts to handle folder move requests.
    • Displays confirmation dialog and toast notification in Project/index.tsx for path updates.
  • UI Components:
    • Adds AlertDialog for path update confirmation in Project/index.tsx.
    • Uses toast for success/error notifications in Project/index.tsx.
  • Localization:
    • Updates translation files (en, ja, ko, zh) to support new dialog and toast messages.
  • Misc:
    • Adds MOVE_PROJECT_FOLDER to MainChannels in ipc.ts.

This description was created by Ellipsis for 43e2c44. It will automatically update as commits are pushed.

Copy link

@ellipsis-dev ellipsis-dev bot left a 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 43e2c44 in 2 minutes and 35 seconds

More details
  • Looked at 550 lines of code in 9 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. apps/studio/src/components/Modals/Settings/Project/index.tsx:86
  • Draft comment:
    Ensure consistency in toast keys: the success toast uses key 'projects.dialogs.updatePath.success' but in some locales the key is named 'toast'.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50%
  1. The comment makes a claim about inconsistent translation keys but doesn't provide clear evidence. 2. The Japanese translation file shows the updatePath section exists but doesn't show the full key structure. 3. Without seeing the actual conflicting keys in the locale files, we can't verify this claim. 4. The comment is speculative without strong evidence.
    I might be missing other translation files that could show the inconsistency. The reviewer may have access to more locale files that demonstrate this issue.
    Even if other locale files exist, we should see clear evidence of the inconsistency before keeping a comment that asks for verification. Without that evidence, this is speculative.
    Delete the comment because there isn't clear evidence of the translation key inconsistency, making this comment speculative.
2. packages/models/src/constants/ipc.ts:30
  • Draft comment:
    Confirm that the new MOVE_PROJECT_FOLDER channel is correctly integrated with frontend and backend.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50%
    None
3. apps/studio/electron/main/code/index.ts:105
  • Draft comment:
    Consider using the promise-based API (e.g. fs.promises.mkdir and fs.promises.cp) instead of providing callbacks. This ensures proper error handling with async/await. Current callback approach may bypass try/catch.
  • Reason this comment was not posted:
    Marked as duplicate.
4. apps/studio/src/components/Modals/Settings/Project/index.tsx:9
  • Draft comment:
    Possible typo in the import path 'ReinstallButon'. Consider renaming it to 'ReinstallButton' for consistency.
  • Reason this comment was not posted:
    Comment was on unchanged code.
5. apps/studio/src/components/Modals/Settings/Project/index.tsx:9
  • Draft comment:
    It appears that the module is imported from './ReinstallButon' but the component is called 'ReinstallButton'. Please double-check if the filename is misspelled, and correct it if necessary.
  • Reason this comment was not posted:
    Comment was on unchanged code.
6. packages/models/src/constants/ipc.ts:55
  • Draft comment:
    Typo alert: The value for CLEAN_CODE_KEYS appears to be 'clean-move-keys', which seems likely to be a typo. It may be intended to be 'clean-code-keys'. Please review.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_vYN7RJC8zeUFR6zh


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.


toast({
title: `${t('projects.dialogs.updatePath.success')}`,
variant: 'warning',
Copy link

Choose a reason for hiding this comment

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

For the success toast in confirmUpdatePath, consider using a 'success' variant (if available) instead of 'warning' to more clearly indicate a successful update.

Suggested change
variant: 'warning',
variant: 'success',

"updatePath" : {
"title":"경로 업데이트",
"description":"프로젝트 위치를 업데이트하시겠습니까?",
"toast": " 프로젝트 경로가 업데이트되었습니다.",
Copy link

Choose a reason for hiding this comment

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

Remove the extra leading space in the 'toast' message value (' 프로젝트 경로가 업데이트되었습니다.') to ensure the text appears correctly.

Suggested change
"toast": " 프로젝트 경로가 업데이트되었습니다.",
"toast": "프로젝트 경로가 업데이트되었습니다.",

@spartan-uyen
Copy link

Title: Confirmation does not disappear after selecting new project path

Summary: After selecting a new path for the project, the confirmation message stays on screen and remains clickable, creating confusion for the user about whether the action was completed.

Steps to Reproduce:

  1. Open the project settings.
  2. Select a new path for the project.
  3. Click the Confirm button
  4. Observe the confirmation message

Actual Result:
The confirmation message does not disappear.
It remains clickable, which may lead the user to believe the action hasn't been completed.

Expected Result:
The confirmation should disappear automatically after a successful update.
A success message should be displayed briefly to notify the user that the change was applied.

@spartan-uyen
Copy link

Hi, I have a concern:
In the case where I change the path of a project and then delete the corresponding folder, will there be an error or some kind of notification to inform the user when they try to use the project in our application?
Currently, if I delete the folder and then try to change the path again, I receive an error: "Failed to update path." and can't update the path afterward.
Do you have any suggestions on how to handle this scenario?

Steps to reproduce:

  1. Create a new project
  2. Change the path of the project
  3. Go to the file explorer and delete the folder at the new path
  4. Reopen the project in the application
  5. Try to change the path to a different (valid) folder

@pranavtartey
Copy link
Author

pranavtartey commented Apr 19, 2025

Hi, I have a concern: In the case where I change the path of a project and then delete the corresponding folder, will there be an error or some kind of notification to inform the user when they try to use the project in our application? Currently, if I delete the folder and then try to change the path again, I receive an error: "Failed to update path." and can't update the path afterward. Do you have any suggestions on how to handle this scenario?

Steps to reproduce:

  1. Create a new project
  2. Change the path of the project
  3. Go to the file explorer and delete the folder at the new path
  4. Reopen the project in the application
  5. Try to change the path to a different (valid) folder

Hi, @Kitenite @spartan-uyen this is my solution for the issues addressed above.

Error Message:
If the project is already moved and then deleted the project folder from the explorer and trying to move to a valid folder.

official copy error message

Copying when instance is not running:

Copy process Instance not running

Copying when the instance is running:

Running Instance copy message

Copying process is in progress:

Copying Process working

Copy process success:

Copy process success

My Solution :
I have created a CopyManager that will handle all the events from the main process and will keep the track of the progress of the copy process from main process and will be displaying it on the copy loading modal (An Alert modal) so that until the process either finishes successfully or throws an error the user has to wait and can not proceed forward.

Copy link
Contributor

@Kitenite Kitenite left a comment

Choose a reason for hiding this comment

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

Hey @pranavtartey , this looks really good. Just 2 last notes.

  1. Could you refactor the Moving folder component into its own file, looks like the functionality got pretty large.
  2. When selecting a new folder, there is a situation we want to handle which is that the folder has been moved in the filesystem already and we just want to point to that new location. Could we make the move/copy folder optional by making it a checkbox in the confirmation? Similar pattern to when deleting the project you can select whether the folder gets deleted as well. Does this make sense?
image image

@pranavtartey
Copy link
Author

Hey @pranavtartey , this looks really good. Just 2 last notes.

  1. Could you refactor the Moving folder component into its own file, looks like the functionality got pretty large.
  2. When selecting a new folder, there is a situation we want to handle which is that the folder has been moved in the filesystem already and we just want to point to that new location. Could we make the move/copy folder optional by making it a checkbox in the confirmation? Similar pattern to when deleting the project you can select whether the folder gets deleted as well. Does this make sense?

image image

Hey @Kitenite, Thanks for the suggestions! The changes are in. Please take a final look

Changes:

  1. Added a Copy component in the project folder that holds all the logic for the copy/move project.
  2. Added a checkbox (making the copy process optional). Now you can either make a new copy of the project and point to the updated address/location or you can uncheck the checkbox and simply point to the new address without actually creating a copy.

Reference Images:

running instance copy checkbox

optional copy checkbox instance not running

ja-copy checkbox instance running

@pranavtartey pranavtartey requested a review from Kitenite May 4, 2025 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] Allow renaming project path that would move the project folder
3 participants