Fix connection dialog Saved Connections refresh timing (#4346)

This commit is contained in:
Karl Burtram
2019-03-08 11:45:11 -08:00
committed by GitHub
parent bcfbe5a284
commit 26274e6c5d
2 changed files with 12 additions and 12 deletions

View File

@@ -22,7 +22,7 @@ export class TreeUpdateUtils {
/** /**
* Set input for the tree. * Set input for the tree.
*/ */
public static structuralTreeUpdate(tree: ITree, viewKey: string, connectionManagementService: IConnectionManagementService, providers?: string[]): void { public static structuralTreeUpdate(tree: ITree, viewKey: string, connectionManagementService: IConnectionManagementService, providers?: string[]): Thenable<void> {
let selectedElement: any; let selectedElement: any;
let targetsToExpand: any[]; let targetsToExpand: any[];
if (tree) { if (tree) {
@@ -44,7 +44,7 @@ export class TreeUpdateUtils {
treeInput = TreeUpdateUtils.getTreeInput(connectionManagementService, providers); treeInput = TreeUpdateUtils.getTreeInput(connectionManagementService, providers);
} }
tree.setInput(treeInput).then(() => { return tree.setInput(treeInput).then(() => {
// Make sure to expand all folders that where expanded in the previous session // Make sure to expand all folders that where expanded in the previous session
if (targetsToExpand) { if (targetsToExpand) {
tree.expandAll(targetsToExpand); tree.expandAll(targetsToExpand);

View File

@@ -169,8 +169,7 @@ export class ConnectionDialogWidget extends Modal {
this._panel.onTabChange(c => { this._panel.onTabChange(c => {
if (c === savedConnectionTabId && this._savedConnectionTree.getContentHeight() === 0) { if (c === savedConnectionTabId && this._savedConnectionTree.getContentHeight() === 0) {
// Update saved connection tree // Update saved connection tree
TreeUpdateUtils.structuralTreeUpdate(this._savedConnectionTree, 'saved', this._connectionManagementService, this._providers); TreeUpdateUtils.structuralTreeUpdate(this._savedConnectionTree, 'saved', this._connectionManagementService, this._providers).then(() => {
if (this._savedConnectionTree.getContentHeight() > 0) { if (this._savedConnectionTree.getContentHeight() > 0) {
this._noSavedConnectionBuilder.hide(); this._noSavedConnectionBuilder.hide();
this._savedConnectionBuilder.show(); this._savedConnectionBuilder.show();
@@ -179,6 +178,7 @@ export class ConnectionDialogWidget extends Modal {
this._savedConnectionBuilder.hide(); this._savedConnectionBuilder.hide();
} }
this._savedConnectionTree.layout(DOM.getTotalHeight(this._savedConnectionTree.getHTMLElement())); this._savedConnectionTree.layout(DOM.getTotalHeight(this._savedConnectionTree.getHTMLElement()));
});
} }
}); });