-
Notifications
You must be signed in to change notification settings - Fork 5
Feat: Allow users to remove one than 1 connection #398
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
base: next
Are you sure you want to change the base?
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.
Pull Request Overview
This PR removes the unused removeAzureConnection wrapper function and adds performance timing for cluster connection deletion operations. However, the PR title suggests enabling multi-connection removal ("Allow users to remove one than 1 connection"), which doesn't align with the actual changes made - no multi-selection functionality has been added.
Key Changes:
- Removed the deprecated
removeAzureConnectionfunction wrapper - Added performance.now() timing measurements for cluster connection deletion
- Add support for multi-selection (node and nodes parameters) - Remove performance timing logs (performance.now() calls) - Implement resilient deletion loop that continues on failure - Add detailed logging to ext.outputChannel for each deletion - Add summary messages for multi-deletion operations - Add telemetry measurement for number of removed connections - Update confirmation logic for single vs. multiple deletions - Update localization files with new strings Co-authored-by: tnaum-ms <[email protected]>
- Replace complex ternary chain with explicit if-else statements - Add error handling for single connection deletion failure - Update localization with new error message string Co-authored-by: tnaum-ms <[email protected]>
- Renamed removedConnections to connectionsToDelete for clarity - Added connectionsDeleted to track successfully deleted connections - Now collects both metrics: connections targeted for deletion and actual deletions Co-authored-by: tnaum-ms <[email protected]>
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.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| context.telemetry.properties.error = 'RemoveConnectionError'; | ||
| context.telemetry.properties.errorMessage = error instanceof Error ? error.message : String(error); |
Copilot
AI
Nov 21, 2025
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.
When multiple deletions fail, the telemetry properties for error and errorMessage are overwritten in each iteration of the loop. This means only the last error's details are preserved in telemetry, losing information about previous failures.
Consider either:
- Recording only the first error (move these lines outside the loop after it completes)
- Using array-based telemetry to capture all errors
- Using a different telemetry property for multi-connection deletion errors
Example fix for option 1:
let firstError: Error | undefined;
// ... in the catch block:
if (!firstError) {
firstError = error instanceof Error ? error : new Error(String(error));
}
// ... after the loop:
if (firstError) {
context.telemetry.properties.error = 'RemoveConnectionError';
context.telemetry.properties.errorMessage = firstError.message;
}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.
@copilot, this is totally fine, capturing one is enough, I was aware of it. Please add a comment explaining that we're aware of it. and.. well, add, once when metrics are set, the errorCount as well. This is a derived value, but will add context.
|
|
||
| await removeConnection(context, node); | ||
| } | ||
| if (connectionsToDelete.length === 0) { |
Copilot
AI
Nov 21, 2025
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.
When the function is called with no connections to delete (both node and nodes are undefined or empty), it returns silently without any user feedback. This could leave users confused if the command is invoked unexpectedly without a selection.
Consider logging a warning or showing a message to inform the user:
if (connectionsToDelete.length === 0) {
ext.outputChannel.warn(l10n.t('No connections selected to remove.'));
return;
}| if (connectionsToDelete.length === 0) { | |
| if (connectionsToDelete.length === 0) { | |
| ext.outputChannel.warn(l10n.t('No connections selected to remove.')); |
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.
@copilot agreed, please add this line, remember about running 'npm run prettier-fix' and 'npm run l10n' after making the edits.
Co-authored-by: tnaum-ms <[email protected]>
Co-authored-by: tnaum-ms <[email protected]>
This pull request enhances the connection removal feature by adding support for batch deletion of connections, improving user feedback, and making the process more resilient to errors. The changes include updates to both the localization file and the connection removal logic to provide clear messages and robust error handling during single or multiple connection deletions.
Connection Removal Improvements:
removeConnectioncommand to support deleting multiple connections at once, including confirmation prompts tailored for single or multiple deletions. The deletion process now continues even if some deletions fail, and a summary of successes and failures is displayed to the user.User Feedback and Localization: