mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-13 03:28:33 -05:00
move code from parts to contrib (#8319)
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
import { ConnectionSummary } from 'azdata';
|
||||
import * as LocalizedConstants from 'sql/workbench/contrib/connection/common/localizedConstants';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
|
||||
// Status when making connections from the viewlet
|
||||
export class ConnectionGlobalStatus {
|
||||
|
||||
private _displayTime: number = 5000; // (in ms)
|
||||
|
||||
constructor(
|
||||
@INotificationService private _notificationService: INotificationService
|
||||
) {
|
||||
}
|
||||
|
||||
public setStatusToConnected(connectionSummary: ConnectionSummary): void {
|
||||
if (this._notificationService) {
|
||||
let text: string;
|
||||
let connInfo: string = connectionSummary.serverName;
|
||||
if (connInfo) {
|
||||
if (connectionSummary.databaseName && connectionSummary.databaseName !== '') {
|
||||
connInfo = connInfo + ' : ' + connectionSummary.databaseName;
|
||||
} else {
|
||||
connInfo = connInfo + ' : ' + '<default>';
|
||||
}
|
||||
text = LocalizedConstants.onDidConnectMessage + ' ' + connInfo;
|
||||
}
|
||||
this._notificationService.status(text, { hideAfter: this._displayTime });
|
||||
}
|
||||
}
|
||||
|
||||
public setStatusToDisconnected(fileUri: string): void {
|
||||
if (this._notificationService) {
|
||||
this._notificationService.status(LocalizedConstants.onDidDisconnectMessage, { hideAfter: this._displayTime });
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user