From 54826b5fe33c5b38da69f91554f8d5f9186314e0 Mon Sep 17 00:00:00 2001 From: Charles Gagnon Date: Mon, 24 Aug 2020 18:07:08 -0700 Subject: [PATCH] Fix dnd auto-connecting profiles when dragging (#11935) * Fix dnd auto-connecting profiles when dragging * Expand connected nodes * fix --- .../objectExplorer/browser/asyncServerTreeDragAndDrop.ts | 2 +- .../objectExplorer/browser/dragAndDropController.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sql/workbench/services/objectExplorer/browser/asyncServerTreeDragAndDrop.ts b/src/sql/workbench/services/objectExplorer/browser/asyncServerTreeDragAndDrop.ts index f1689594e5..019719ed64 100644 --- a/src/sql/workbench/services/objectExplorer/browser/asyncServerTreeDragAndDrop.ts +++ b/src/sql/workbench/services/objectExplorer/browser/asyncServerTreeDragAndDrop.ts @@ -56,7 +56,7 @@ export class AsyncServerTreeDragAndDrop implements ITreeDragAndDroporiginalEvent); if (canDragOver.accept) { - return TreeDragOverReactions.acceptBubbleDown(true); + return TreeDragOverReactions.acceptBubbleDown(canDragOver.autoExpand); } else { return { accept: false }; } diff --git a/src/sql/workbench/services/objectExplorer/browser/dragAndDropController.ts b/src/sql/workbench/services/objectExplorer/browser/dragAndDropController.ts index 601e30bbfb..1d90f1f4ce 100644 --- a/src/sql/workbench/services/objectExplorer/browser/dragAndDropController.ts +++ b/src/sql/workbench/services/objectExplorer/browser/dragAndDropController.ts @@ -157,6 +157,14 @@ export class ServerTreeDragAndDrop implements IDragAndDrop { } if (canDragOver) { + if (targetElement instanceof ConnectionProfile) { + const isConnected = this._connectionManagementService.isProfileConnected(targetElement); + // Don't auto-expand disconnected connections - doing so will try to connect the connection + // when expanded which is not something we want to support currently + return DRAG_OVER_ACCEPT_BUBBLE_DOWN(isConnected); + } + // Auto-expand other elements (groups, tree nodes) so their children can be + // exposed for further dragging return DRAG_OVER_ACCEPT_BUBBLE_DOWN(true); } else { return DRAG_OVER_REJECT;