mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Removing oe service changes from release 1.43 (#22593)
* Revert "Fixing connection without saved password not connecting in Async Server Tree (#22535)" This reverts commitd49ff85afc. * Revert "Adding caching in OE service (#22539)" This reverts commita1acaf2096.
This commit is contained in:
@@ -472,11 +472,6 @@ export class ServerTreeView extends Disposable implements IServerTreeView {
|
|||||||
await this._connectionManagementService.deleteConnection(profile);
|
await this._connectionManagementService.deleteConnection(profile);
|
||||||
}
|
}
|
||||||
const connectionProfile = this.getConnectionInTreeInput(profile.id);
|
const connectionProfile = this.getConnectionInTreeInput(profile.id);
|
||||||
|
|
||||||
// For the connection profile, we need to clear the password from the last session if the user doesn't want to save it
|
|
||||||
if (!connectionProfile.savePassword) {
|
|
||||||
connectionProfile.password = '';
|
|
||||||
}
|
|
||||||
// Delete the node from the tree
|
// Delete the node from the tree
|
||||||
await this._objectExplorerService.deleteObjectExplorerNode(connectionProfile);
|
await this._objectExplorerService.deleteObjectExplorerNode(connectionProfile);
|
||||||
// Collapse the node
|
// Collapse the node
|
||||||
|
|||||||
@@ -270,9 +270,6 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
|||||||
showFirewallRuleOnError: true
|
showFirewallRuleOnError: true
|
||||||
};
|
};
|
||||||
|
|
||||||
if (params && options.params === undefined) {
|
|
||||||
options.params = params;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
const connectionResult = await this._connectionManagementService.connectAndSaveProfile(connection, uri, options, params && params.input);
|
const connectionResult = await this._connectionManagementService.connectAndSaveProfile(connection, uri, options, params && params.input);
|
||||||
this._connecting = false;
|
this._connecting = false;
|
||||||
|
|||||||
@@ -416,9 +416,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
|||||||
connectionType: this._connectionStatusManager.isEditorTypeUri(owner.uri) ? ConnectionType.editor : ConnectionType.default,
|
connectionType: this._connectionStatusManager.isEditorTypeUri(owner.uri) ? ConnectionType.editor : ConnectionType.default,
|
||||||
input: owner,
|
input: owner,
|
||||||
runQueryOnCompletion: RunQueryOnConnectionMode.none,
|
runQueryOnCompletion: RunQueryOnConnectionMode.none,
|
||||||
showDashboard: options.showDashboard,
|
showDashboard: options.showDashboard
|
||||||
isEditConnection: true,
|
|
||||||
oldProfileId: connection.id
|
|
||||||
};
|
};
|
||||||
return this.showConnectionDialog(params, options, connection, connectionResult).then(() => {
|
return this.showConnectionDialog(params, options, connection, connectionResult).then(() => {
|
||||||
return connectionResult;
|
return connectionResult;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export class AsyncServerTree extends WorkbenchAsyncDataTree<ConnectionProfileGro
|
|||||||
* This method overrides the original implementation to find the node by comparing the ids of the elements.
|
* This method overrides the original implementation to find the node by comparing the ids of the elements.
|
||||||
* If the node is not found in the original implementation, we search for the node in the nodes map by ids.
|
* If the node is not found in the original implementation, we search for the node in the nodes map by ids.
|
||||||
*/
|
*/
|
||||||
public override getDataNode(element: ServerTreeElement, throwError: boolean = true): IAsyncDataTreeNode<ConnectionProfileGroup, ServerTreeElement> | undefined {
|
public override getDataNode(element: ConnectionProfileGroup | ServerTreeElement): IAsyncDataTreeNode<ConnectionProfileGroup, ServerTreeElement> {
|
||||||
try {
|
try {
|
||||||
const node = super.getDataNode(element);
|
const node = super.getDataNode(element);
|
||||||
return node;
|
return node;
|
||||||
@@ -79,11 +79,8 @@ export class AsyncServerTree extends WorkbenchAsyncDataTree<ConnectionProfileGro
|
|||||||
if (node) {
|
if (node) {
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
if (throwError) {
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -135,12 +132,45 @@ export class AsyncServerTree extends WorkbenchAsyncDataTree<ConnectionProfileGro
|
|||||||
|
|
||||||
public async expandElements(elements: ServerTreeElement[]): Promise<void> {
|
public async expandElements(elements: ServerTreeElement[]): Promise<void> {
|
||||||
for (let element of elements) {
|
for (let element of elements) {
|
||||||
const node = this.getDataNode(element, false);
|
const id = element.id;
|
||||||
|
const node = this.getDataNodeById(id);
|
||||||
if (node) {
|
if (node) {
|
||||||
await this.expand(node.element);
|
await this.expand(node.element);
|
||||||
|
} else {
|
||||||
|
// If the node is not found in the nodes map, we search for the node by comparing the relative paths of the elements
|
||||||
|
if (element) {
|
||||||
|
const elementPath = this.getRelativePath(element);
|
||||||
|
for (let n of this.nodes.values()) {
|
||||||
|
if (this.getRelativePath(n.element) === elementPath) {
|
||||||
|
await this.expand(n.element);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the relative path of the element in the tree. For connection and group, the path is the id of the element.
|
||||||
|
* For other elements, the path is the node path of the element and the id of the connection they belong to.
|
||||||
|
*/
|
||||||
|
private getRelativePath(element: ServerTreeElement): string {
|
||||||
|
let path = '';
|
||||||
|
if (element instanceof TreeNode) {
|
||||||
|
path = element.nodePath;
|
||||||
|
let parent = element.parent;
|
||||||
|
while (parent.parent) {
|
||||||
|
parent = parent.parent;
|
||||||
|
}
|
||||||
|
if (parent.connection) {
|
||||||
|
path = parent.connection.id + '/' + path;
|
||||||
|
}
|
||||||
|
} else if (element instanceof ConnectionProfile || element instanceof ConnectionProfileGroup) {
|
||||||
|
path = element.id;
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mark the element as dirty so that it will be refreshed when it is expanded next time
|
* Mark the element as dirty so that it will be refreshed when it is expanded next time
|
||||||
|
|||||||
@@ -179,9 +179,6 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
|||||||
|
|
||||||
private _connectionsWaitingForSession: Map<string, boolean> = new Map<string, boolean>();
|
private _connectionsWaitingForSession: Map<string, boolean> = new Map<string, boolean>();
|
||||||
|
|
||||||
// Cache of tree nodes for each connection by session ids
|
|
||||||
private _treeNodeCache: Map<string, Map<string, TreeNode>> = new Map<string, Map<string, TreeNode>>();
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
|
||||||
@IAdsTelemetryService private _telemetryService: IAdsTelemetryService,
|
@IAdsTelemetryService private _telemetryService: IAdsTelemetryService,
|
||||||
@@ -236,7 +233,6 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
|||||||
if (!session) {
|
if (!session) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._treeNodeCache.delete(session.sessionId);
|
|
||||||
await this.closeSession(connection.providerName, session);
|
await this.closeSession(connection.providerName, session);
|
||||||
delete this._activeObjectExplorerNodes[connectionUri];
|
delete this._activeObjectExplorerNodes[connectionUri];
|
||||||
delete this._sessions[session.sessionId!];
|
delete this._sessions[session.sessionId!];
|
||||||
@@ -344,8 +340,6 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
|||||||
try {
|
try {
|
||||||
if (session.success && session.rootNode) {
|
if (session.success && session.rootNode) {
|
||||||
let server = this.toTreeNode(session.rootNode, undefined);
|
let server = this.toTreeNode(session.rootNode, undefined);
|
||||||
this._treeNodeCache.set(sessionId, new Map<string, TreeNode>());
|
|
||||||
this._treeNodeCache.get(sessionId)!.set(this.getTreeNodeCacheKey(server.toNodeInfo()), server);
|
|
||||||
server.connection = connection;
|
server.connection = connection;
|
||||||
server.session = session;
|
server.session = session;
|
||||||
this._activeObjectExplorerNodes[connection!.id] = server;
|
this._activeObjectExplorerNodes[connection!.id] = server;
|
||||||
@@ -736,31 +730,9 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
|||||||
throw new Error('Failed to expand node - no provider name');
|
throw new Error('Failed to expand node - no provider name');
|
||||||
}
|
}
|
||||||
const expandResult = await this.callExpandOrRefreshFromService(providerName, session, parentTree, refresh);
|
const expandResult = await this.callExpandOrRefreshFromService(providerName, session, parentTree, refresh);
|
||||||
const sessionTreeNodeCache = this._treeNodeCache.get(session.sessionId!);
|
|
||||||
if (expandResult && expandResult.nodes) {
|
if (expandResult && expandResult.nodes) {
|
||||||
// In case of refresh, we want to clear the cache of the descendants of the node being refreshed
|
|
||||||
if (refresh && parentTree?.children) {
|
|
||||||
const stack = [...parentTree.children];
|
|
||||||
while (stack.length > 0) {
|
|
||||||
const currentTreeNode = stack.pop();
|
|
||||||
if (currentTreeNode) {
|
|
||||||
sessionTreeNodeCache.delete(this.getTreeNodeCacheKey(currentTreeNode.toNodeInfo()));
|
|
||||||
if (currentTreeNode.children) {
|
|
||||||
stack.push(...currentTreeNode.children);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const children = expandResult.nodes.map(node => {
|
const children = expandResult.nodes.map(node => {
|
||||||
const cacheKey = this.getTreeNodeCacheKey(node);
|
return this.toTreeNode(node, parentTree);
|
||||||
// In case of refresh, we want to update the existing node in the cache
|
|
||||||
if (!refresh && sessionTreeNodeCache.has(cacheKey)) {
|
|
||||||
return sessionTreeNodeCache.get(cacheKey);
|
|
||||||
} else {
|
|
||||||
const treeNode = this.toTreeNode(node, parentTree);
|
|
||||||
sessionTreeNodeCache.set(cacheKey, treeNode);
|
|
||||||
return treeNode;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
parentTree.children = children.filter(c => c !== undefined);
|
parentTree.children = children.filter(c => c !== undefined);
|
||||||
return children;
|
return children;
|
||||||
@@ -1032,8 +1004,4 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
|||||||
public getObjectExplorerTimeout(): number {
|
public getObjectExplorerTimeout(): number {
|
||||||
return this._configurationService.getValue<number>(NODE_EXPANSION_CONFIG);
|
return this._configurationService.getValue<number>(NODE_EXPANSION_CONFIG);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getTreeNodeCacheKey(node: azdata.NodeInfo): string {
|
|
||||||
return node.nodePath;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -305,8 +305,8 @@ export class TreeUpdateUtils {
|
|||||||
|
|
||||||
// If the node update takes too long, reject the promise
|
// If the node update takes too long, reject the promise
|
||||||
const nodeUpdateTimeout = () => {
|
const nodeUpdateTimeout = () => {
|
||||||
cleanup();
|
|
||||||
reject(new Error(nls.localize('objectExplorerTimeout', "Object Explorer expansion timed out for '{0}'", connection.databaseName)));
|
reject(new Error(nls.localize('objectExplorerTimeout', "Object Explorer expansion timed out for '{0}'", connection.databaseName)));
|
||||||
|
cleanup();
|
||||||
}
|
}
|
||||||
const nodeUpdateTimer = setTimeout(nodeUpdateTimeout, expansionTimeoutValueSec * 1000);
|
const nodeUpdateTimer = setTimeout(nodeUpdateTimeout, expansionTimeoutValueSec * 1000);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user