Skip to content

Added feature to check for unsaved files in a folder upon deletion. #1559

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 28 commits into
base: main
Choose a base branch
from

Conversation

kpatl1
Copy link
Collaborator

@kpatl1 kpatl1 commented Jul 16, 2025

Summary
I have added a function that checks if there are unsaved files within a folder. If so, it will open a modal asking if the user wants to actually delete the folder. On deletion it will then move to recycle bin.
Testing
How did you test this change?
I followed the steps to recreate the feature request by joining a viya server, making a new folder with two unsaved files, and then try to delete the folder. After deleting it, I got the message if I truly did want to and then I had the option to continue or cancel. On continuation, the folder then moved to recycle bin.

Fixes #1136

@kpatl1 kpatl1 requested a review from scnwwu July 16, 2025 19:32
@kpatl1 kpatl1 added the good first issue Good for newcomers label Jul 16, 2025
@scnwwu scnwwu removed the good first issue Good for newcomers label Jul 21, 2025
@kpatl1
Copy link
Collaborator Author

kpatl1 commented Jul 23, 2025

Added fixes. Put the logic into the UI and Service layer. Children are found recursively for the folder and added to a set. Open files are then referenced into the set to see if they are within it. If the file is dirty and in the children set, a popup will appear. Overall, time complexity boils down to O(N + M) I believe where N is the number of files within a root directory and M being the number of files being open in the window.

kpatl1 added 5 commits July 24, 2025 13:54
I, Kishan Patel <[email protected]>, hereby add my Signed-off-by to this commit: 5ef4032
I, Kishan Patel <[email protected]>, hereby add my Signed-off-by to this commit: 3195f1d
I, Kishan Patel <[email protected]>, hereby add my Signed-off-by to this commit: 9166f84

Signed-off-by: Kishan Patel <[email protected]>
Copy link
Member

@scnwwu scnwwu left a comment

Choose a reason for hiding this comment

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

@kpatl1, for your nested folder question, if you dump your uriToParentMap, you'll see that the Uri format in key and value are different.
I've added suggestions that will make it work

Copy link
Member

Choose a reason for hiding this comment

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

please do NOT change this file when no dependencies changed

@@ -523,5 +540,4 @@ class ContentNavigator implements SubscriptionProvider {
}
}
}

Copy link
Member

Choose a reason for hiding this comment

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

unnecessary change

? Messages.FolderDeletionError
: Messages.FileDeletionError,
);
if (resource.contextValue.includes("delete")) {
Copy link
Member

Choose a reason for hiding this comment

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

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.

No warning message if trying to delete a folder which contains unsaved files
2 participants