diff --git a/src/commands/serverCommand.ts b/src/commands/serverCommand.ts index a277b704..6c53cb1b 100644 --- a/src/commands/serverCommand.ts +++ b/src/commands/serverCommand.ts @@ -192,8 +192,8 @@ export async function editInsightsConnection( } else { const oldKey = getKeyForServerName(oldAlias); const newKey = insightsData.alias; + removeConnFromLabels(oldAlias); if (insights[oldKey] && oldAlias !== insightsData.alias) { - removeConnFromLabels(oldAlias); const uInsights = Object.keys(insights).filter((insight) => { return insight !== oldKey; }); @@ -452,6 +452,7 @@ export async function editKdbConnection( return; } else { const oldKey = getKeyForServerName(oldAlias); + removeConnFromLabels(oldKey); const newKey = kdbData.serverAlias; const removedAuth = editAuth && (kdbData.username === "" || kdbData.password === ""); @@ -526,6 +527,11 @@ export async function editKdbConnection( export async function removeConnection(viewItem: KdbNode | InsightsNode) { const connMngService = new ConnectionManagementService(); + removeConnFromLabels( + viewItem instanceof KdbNode + ? viewItem.details.serverAlias + : viewItem.details.alias, + ); await connMngService.removeConnection(viewItem); }