mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
* fix the server group disapearing issue #1835 * address review comments
This commit is contained in:
@@ -153,6 +153,19 @@ export class ConnectionProfileGroup implements IConnectionProfileGroup {
|
||||
return this.parent;
|
||||
}
|
||||
|
||||
public isAncestorOf(node: ConnectionProfileGroup | ConnectionProfile): boolean {
|
||||
let isAncestor = false;
|
||||
let currentNode = node;
|
||||
while (currentNode) {
|
||||
if (currentNode.parent && currentNode.parent.id === this.id) {
|
||||
isAncestor = true;
|
||||
break;
|
||||
}
|
||||
currentNode = currentNode.parent;
|
||||
}
|
||||
return isAncestor;
|
||||
}
|
||||
|
||||
public static getGroupFullNameParts(groupFullName: string): string[] {
|
||||
groupFullName = groupFullName ? groupFullName : '';
|
||||
let groupNames: string[] = groupFullName.split(ConnectionProfileGroup.GroupNameSeparator);
|
||||
|
||||
@@ -74,6 +74,10 @@ export class ServerTreeDragAndDrop implements IDragAndDrop {
|
||||
if (!this._connectionManagementService.canChangeConnectionConfig(source, targetConnectionProfileGroup.id)) {
|
||||
canDragOver = false;
|
||||
}
|
||||
} else if (source instanceof ConnectionProfileGroup) {
|
||||
// Dropping a group to itself or its descendants nodes is not allowed
|
||||
// to avoid creating a circular structure.
|
||||
canDragOver = source.id !== targetElement.id && !source.isAncestorOf(targetElement);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user