mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Add null checks for server tree view (#24038)
This commit is contained in:
@@ -70,12 +70,17 @@ class ConnectionProfileGroupTemplate extends Disposable {
|
||||
matches: createMatches(filterData)
|
||||
});
|
||||
|
||||
const actionProvider = this._objectExplorerService.getServerTreeView().treeActionProvider;
|
||||
const tree = this._objectExplorerService.getServerTreeView().tree;
|
||||
let serverTreeView = this._objectExplorerService.getServerTreeView();
|
||||
if (serverTreeView) {
|
||||
const actionProvider = serverTreeView.treeActionProvider;
|
||||
const tree = serverTreeView.tree;
|
||||
const actions = actionProvider.getActions(tree, element, true);
|
||||
this._actionBar.context = this._objectExplorerService.getServerTreeView().getActionContext(element);
|
||||
this._actionBar.context = serverTreeView.getActionContext(element);
|
||||
this._actionBar.clear();
|
||||
this._actionBar.pushAction(actions, { icon: true, label: false });
|
||||
} else {
|
||||
console.log('Server Tree view not loaded, action bar will not be populated.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,11 +155,13 @@ class ConnectionProfileTemplate extends Disposable {
|
||||
matches: createMatches(filterData)
|
||||
});
|
||||
this._root.title = treeNode?.filters?.length > 0 ? getLabelWithFilteredSuffix(element.serverInfo) : element.serverInfo;
|
||||
const actionProvider = this._objectExplorerService.getServerTreeView().treeActionProvider;
|
||||
let serverTreeView = this._objectExplorerService.getServerTreeView();
|
||||
if (serverTreeView) {
|
||||
const actionProvider = serverTreeView.treeActionProvider;
|
||||
if (!this._isCompact) {
|
||||
const tree = this._objectExplorerService.getServerTreeView().tree;
|
||||
const tree = serverTreeView.tree;
|
||||
const actions = actionProvider.getActions(tree, element, true);
|
||||
this._actionBar.context = this._objectExplorerService.getServerTreeView().getActionContext(element);
|
||||
this._actionBar.context = serverTreeView.getActionContext(element);
|
||||
this._actionBar.clear();
|
||||
this._actionBar.pushAction(actions, { icon: true, label: false });
|
||||
} else {
|
||||
@@ -163,6 +170,9 @@ class ConnectionProfileTemplate extends Disposable {
|
||||
this._actionBar.clear();
|
||||
this._actionBar.pushAction(actions, { icon: true, label: false });
|
||||
}
|
||||
} else {
|
||||
console.log('Server Tree view not loaded, action bar will not be populated.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,12 +257,17 @@ class TreeNodeTemplate extends Disposable {
|
||||
matches: createMatches(filterData)
|
||||
});
|
||||
this._root.title = labelText;
|
||||
const tree = this._objectExplorerService.getServerTreeView().tree;
|
||||
const actionProvider = this._objectExplorerService.getServerTreeView().treeActionProvider;
|
||||
let serverTreeView = this._objectExplorerService.getServerTreeView();
|
||||
if (serverTreeView) {
|
||||
const tree = serverTreeView.tree;
|
||||
const actionProvider = serverTreeView.treeActionProvider;
|
||||
const actions = actionProvider.getActions(tree, element, true);
|
||||
this._actionBar.context = this._objectExplorerService.getServerTreeView().getActionContext(element);
|
||||
this._actionBar.context = serverTreeView.getActionContext(element);
|
||||
this._actionBar.clear();
|
||||
this._actionBar.pushAction(actions, { icon: true, label: false });
|
||||
} else {
|
||||
console.log('Server Tree view not loaded, action bar will not be populated.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user