Some cleanup and fixes for Arc/BDC dashboards (#11075)

This commit is contained in:
Charles Gagnon
2020-06-24 12:41:33 -07:00
committed by GitHub
parent 6f6bf3f3b3
commit c62394262a
19 changed files with 1021 additions and 1063 deletions

View File

@@ -7,7 +7,6 @@ import * as azdata from 'azdata';
import * as vscode from 'vscode';
import { ControllerTreeNode } from './controllerTreeNode';
import { TreeNode } from './treeNode';
import { LoadingControllerNode as LoadingTreeNode } from './loadingTreeNode';
import { ControllerModel, ControllerInfo } from '../../models/controllerModel';
const mementoToken = 'arcControllers';
@@ -23,7 +22,6 @@ export class AzureArcTreeDataProvider implements vscode.TreeDataProvider<TreeNod
readonly onDidChangeTreeData: vscode.Event<TreeNode | undefined> = this._onDidChangeTreeData.event;
private _loading: boolean = true;
private _loadingNode = new LoadingTreeNode();
private _controllerNodes: ControllerTreeNode[] = [];
@@ -33,9 +31,14 @@ export class AzureArcTreeDataProvider implements vscode.TreeDataProvider<TreeNod
public async getChildren(element?: TreeNode): Promise<TreeNode[]> {
if (this._loading) {
return [this._loadingNode];
return [];
}
// We set the context here since VS Code takes a bit of time to process the _onDidChangeTreeData
// and so if we set it as soon as we finished loading the controllers it would briefly flash
// the "connect to controller" welcome view
await vscode.commands.executeCommand('setContext', 'arc.loaded', true);
if (element) {
return element.getChildren();
} else {

View File

@@ -35,7 +35,7 @@ export class ControllerTreeNode extends TreeNode {
// First reset our deferred promise so we're sure we'll get the refreshed children
this._childrenRefreshPromise = new Deferred();
try {
await this.model.refresh();
await this.model.refresh(false);
await this._childrenRefreshPromise.promise;
} catch (err) {
// Couldn't get the children and TreeView doesn't have a way to collapse a node

View File

@@ -1,18 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
import * as loc from '../../localizedConstants';
import { TreeNode } from './treeNode';
/**
* A placeholder TreeNode to display while we're loading the initial set of stored nodes
*/
export class LoadingControllerNode extends TreeNode {
constructor() {
super(loc.loading, vscode.TreeItemCollapsibleState.None, 'loading');
}
}