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

@@ -10,7 +10,6 @@ import { TreeNode } from './treeNode';
import { IControllerTreeChangeHandler } from './controllerTreeChangeHandler';
import { ControllerRootNode, ControllerNode } from './controllerTreeNode';
import { showErrorMessage } from '../utils';
import { LoadingControllerNode } from './loadingControllerNode';
import { AuthType } from 'bdc';
const localize = nls.loadMessageBundle();
@@ -35,7 +34,6 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
constructor(private memento: vscode.Memento) {
this.root = new ControllerRootNode(this);
this.root.addChild(new LoadingControllerNode());
}
public async getChildren(element?: TreeNode): Promise<TreeNode[]> {
@@ -45,6 +43,11 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
if (!this.initialized) {
this.loadSavedControllers().catch(err => { vscode.window.showErrorMessage(localize('bdc.controllerTreeDataProvider.error', "Unexpected error loading saved controllers: {0}", err)); });
} else {
// 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', 'bdc.loaded', true);
}
return this.root.getChildren();
@@ -87,21 +90,9 @@ export class ControllerTreeDataProvider implements vscode.TreeDataProvider<TreeN
}
private removeNonControllerNodes(): void {
this.removePlaceholderNodes(this.root.children);
this.removeDefectiveControllerNodes(this.root.children);
}
private removePlaceholderNodes(nodes: TreeNode[]): void {
if (nodes.length > 0) {
for (let i = 0; i < nodes.length; ++i) {
if (nodes[i] instanceof LoadingControllerNode
) {
nodes.splice(i--, 1);
}
}
}
}
private removeDefectiveControllerNodes(nodes: TreeNode[]): void {
if (nodes.length > 0) {
for (let i = 0; i < nodes.length; ++i) {