Skip to content

feat: Add delete confirmation dialog for servers and folders#1186

Open
eduardomozart wants to merge 12 commits intognmyt:mainfrom
eduardomozart:patch-12
Open

feat: Add delete confirmation dialog for servers and folders#1186
eduardomozart wants to merge 12 commits intognmyt:mainfrom
eduardomozart:patch-12

Conversation

@eduardomozart
Copy link
Copy Markdown
Contributor

@eduardomozart eduardomozart commented Feb 25, 2026

📋 Description

Introduce an ActionConfirmDialog to confirm server and folder deletions. Adds deleteConfirmDialog state, openDeleteServerConfirm and handleDeleteConfirm handlers, and replaces direct deleteServer and deleteFolder calls from the context menu with the confirmation flow. The dialog displays the server/folder name via i18n and triggers deleteRequest + loadServers on confirm, then closes the dialog.

🚀 Changes made to ...

  • 🔧 Server
  • 🖥️ Client
  • 📚 Documentation
  • 🔄 Other: ___

✅ Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have looked for similar pull requests in the repository and found none
  • This pull request does not contain translations (translations are managed through Crowdin)

🔗 Related Issues

Closes #1178

Introduce an ActionConfirmDialog to confirm server deletions. Adds deleteConfirmDialog state, openDeleteServerConfirm and handleDeleteConfirm handlers, and replaces direct deleteServer calls from the context menu with the confirmation flow. The dialog displays the server name via i18n and triggers deleteRequest + loadServers on confirm, then closes the dialog.
@eduardomozart eduardomozart changed the title feat: Add delete confirmation dialog for servers feat: Add delete confirmation dialog for servers and folders Feb 25, 2026
Eduardo Oliveira added 3 commits February 24, 2026 22:38
Replace direct folder deletion with a confirm dialog flow. Introduces openDeleteFolderConfirm to populate deleteConfirmDialog (including entryType) by finding the folder entry, updates the context menu to open the dialog instead of calling deleteFolder, and removes the old deleteFolder helper. handleDeleteConfirm now checks entryType to call the correct endpoint (folders/{id} vs entries/{id}) and resets entryType when closing. The dialog text also uses a folder-specific translation when appropriate.
Ensure flattenEntries is called with a proper array (guards against servers being undefined) when finding a folder for deletion, and simplify the delete confirmation text to always use the fileManager translation key. This avoids potential runtime errors and removes the conditional branching for the dialog message.
Add i18n keys for delete failures (deleteFailFile, deleteFailFolder) and update ServerList logic to reliably locate folder entries by comparing IDs as strings. Add .catch handlers to folder/entry delete requests to show error toasts using the new translation keys. Also add debug console logs for servers/contextClickedId and close the delete confirm dialog after handling.
@eduardomozart eduardomozart marked this pull request as draft February 25, 2026 02:01
Remove leftover console.log statements and simplify folder lookup by using the servers array directly instead of calling flattenEntries. This avoids unnecessary flattening when finding the folder entry by id before opening the delete confirmation.
@eduardomozart eduardomozart marked this pull request as ready for review February 25, 2026 02:06
Eduardo Oliveira added 7 commits February 26, 2026 14:23
Add findEntryById to recursively locate an entry (server/folder/org) by id within nested entries, and consolidate delete confirmation logic into openDeleteEntryConfirm. Replace separate openDeleteServerConfirm/openDeleteFolderConfirm flows and folder-specific lookup with a single handler, and update context menu actions to call the unified function. This simplifies deletion handling for nested structures and preserves entry name/id/type in the confirm dialog.
Move the duplicated recursive findEntryById function out of the ServerList component and into module scope. Removes the nested duplicate implementation and consolidates the entry lookup logic (handles nested folder/organization entries) so it can be reused without changing behavior. Reduces code duplication and improves clarity.
Insert console.log statements in findEntryById to output the entries array and the requested id (contextClickedId) during lookup. This change is meant to aid debugging of entry lookup failures and tracing what data is being passed; these logs are likely temporary and can be removed once the issue is resolved.
Remove stray console.log calls from findEntryById and add logging in openDeleteEntryConfirm to output 'servers' and 'contextClickedId' when the delete confirmation is opened. This shifts debug output to the user action context, making it easier to inspect state when deleting an entry.
Coerce entry.id and the target id to Numbers before comparing to ensure matches when one value is a string and the other a number. Added console.log statements to aid debugging of entries and ids during lookup. Recursive search behavior is unchanged.
Remove leftover console.log calls in ServerList.jsx (inside findEntryById and openDeleteEntryConfirm) to clean up noisy console output. No functional changes; only debug statements were removed.
@sonarqubecloud
Copy link
Copy Markdown

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.

[Feature] Add confirmation prompt before deleting a connection entry

1 participant