Fix context menu for disconnected server nodes (#12018)

* Fix context menu for disconnected server nodes

* Fix strict compile
This commit is contained in:
Charles Gagnon
2020-08-31 13:34:21 -07:00
committed by GitHub
parent cb1d892747
commit f7c7274463
2 changed files with 4 additions and 2 deletions

View File

@@ -1372,7 +1372,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
return credentials;
}
public getServerInfo(profileId: string): azdata.ServerInfo {
public getServerInfo(profileId: string): azdata.ServerInfo | undefined {
let profile = this._connectionStatusManager.findConnectionByProfileId(profileId);
if (!profile) {
return undefined;

View File

@@ -143,7 +143,9 @@ export class ServerTreeActionProvider {
let serverInfoContextKey = new ServerInfoContextKey(scopedContextService);
if (connectionProfile.id) {
let serverInfo = this._connectionManagementService.getServerInfo(connectionProfile.id);
serverInfoContextKey.set(serverInfo);
if (serverInfo) {
serverInfoContextKey.set(serverInfo);
}
}
let treeNodeContextKey = new TreeNodeContextKey(scopedContextService);
if (context.treeNode) {