mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 10:38:31 -05:00
Some cleanup and fixes for Arc/BDC dashboards (#11075)
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user