Show current connection info in the status bar (#551)

This commit is contained in:
Matt Irvine
2018-01-26 14:31:49 -08:00
committed by GitHub
parent f640bda802
commit 9a1ac20710
5 changed files with 58 additions and 102 deletions

View File

@@ -61,6 +61,8 @@ export interface IObjectExplorerService {
getSelectedProfileAndDatabase(): { profile: ConnectionProfile, databaseName: string };
isFocused(): boolean;
onSelectionOrFocusChange: Event<void>;
}
interface SessionStatus {
@@ -94,6 +96,8 @@ export class ObjectExplorerService implements IObjectExplorerService {
private _serverTreeView: ServerTreeView;
private _onSelectionOrFocusChange: Emitter<void>;
constructor(
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@ITelemetryService private _telemetryService: ITelemetryService
@@ -102,12 +106,20 @@ export class ObjectExplorerService implements IObjectExplorerService {
this._activeObjectExplorerNodes = {};
this._sessions = {};
this._providers = {};
this._onSelectionOrFocusChange = new Emitter<void>();
}
public get onUpdateObjectExplorerNodes(): Event<ObjectExplorerNodeEventArgs> {
return this._onUpdateObjectExplorerNodes.event;
}
/**
* Event fired when the selection or focus of Object Explorer changes
*/
public get onSelectionOrFocusChange(): Event<void> {
return this._onSelectionOrFocusChange.event;
}
public updateObjectExplorerNodes(connection: IConnectionProfile): Promise<void> {
return this._connectionManagementService.addSavedPassword(connection).then(withPassword => {
let connectionProfile = ConnectionProfile.convertToConnectionProfile(
@@ -370,6 +382,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
throw new Error('The object explorer server tree view is already registered');
}
this._serverTreeView = view;
this._serverTreeView.onSelectionOrFocusChange(() => this._onSelectionOrFocusChange.fire());
}
/**