Fix empty connection name in delete connection prompt (#22001)

* Fix empty name in delete connection prompt

* Update src/sql/workbench/services/objectExplorer/browser/connectionTreeAction.ts

Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>

---------

Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
Lewis Sanchez
2023-02-21 17:43:29 -08:00
committed by GitHub
parent ee60319f70
commit 656a86a103

View File

@@ -290,7 +290,8 @@ export class DeleteConnectionAction extends Action {
const deleteConnectionConfirmationNo = localize('deleteConnectionConfirmationNo', "No");
if (this.element instanceof ConnectionProfile) {
const modalResult = await this._dialogService.show(Severity.Warning, localize('deleteConnectionConfirmation', "Are you sure you want to delete connection '{0}'?", this.element.connectionName),
const name = this.element.connectionName || this.element.serverName;
const modalResult = await this._dialogService.show(Severity.Warning, localize('deleteConnectionConfirmation', "Are you sure you want to delete connection '{0}'?", name),
[deleteConnectionConfirmationYes, deleteConnectionConfirmationNo]);
if (modalResult.choice === 0) {
await this._connectionManagementService.deleteConnection(this.element);