No browser from common (#7178)

* no browser from common

* clean up some imports
This commit is contained in:
Anthony Dresser
2019-09-12 14:52:42 -07:00
committed by GitHub
parent a67e62b2d0
commit 823d136a00
134 changed files with 269 additions and 274 deletions

View File

@@ -11,7 +11,6 @@ import {
IConnectionParams, IConnectionResult, RunQueryOnConnectionMode
} from 'sql/platform/connection/common/connectionManagement';
import { ConnectionStore } from 'sql/platform/connection/common/connectionStore';
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
import { ConnectionManagementInfo } from 'sql/platform/connection/common/connectionManagementInfo';
import * as Utils from 'sql/platform/connection/common/utils';
import * as Constants from 'sql/platform/connection/common/constants';
@@ -46,7 +45,7 @@ import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { IConnectionDialogService } from 'sql/workbench/services/connection/common/connectionDialogService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ILogService } from 'vs/platform/log/common/log';
import * as interfaces from './interfaces';
import * as interfaces from 'sql/platform/connection/common/interfaces';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { Memento } from 'vs/workbench/common/memento';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
@@ -59,7 +58,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
private _providers = new Map<string, { onReady: Promise<azdata.ConnectionProvider>, properties: ConnectionProviderProperties }>();
private _iconProviders = new Map<string, azdata.IconProvider>();
private _uriToProvider: { [uri: string]: string; } = Object.create(null);
private _onAddConnectionProfile = new Emitter<IConnectionProfile>();
private _onAddConnectionProfile = new Emitter<interfaces.IConnectionProfile>();
private _onDeleteConnectionProfile = new Emitter<void>();
private _onConnect = new Emitter<IConnectionParams>();
private _onDisconnect = new Emitter<IConnectionParams>();
@@ -128,7 +127,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
}
// Event Emitters
public get onAddConnectionProfile(): Event<IConnectionProfile> {
public get onAddConnectionProfile(): Event<interfaces.IConnectionProfile> {
return this._onAddConnectionProfile.event;
}
@@ -180,7 +179,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
* @param params Include the uri, type of connection
* @param model the existing connection profile to create a new one from
*/
public showConnectionDialog(params?: INewConnectionParams, options?: IConnectionCompletionOptions, model?: IConnectionProfile, connectionResult?: IConnectionResult): Promise<void> {
public showConnectionDialog(params?: INewConnectionParams, options?: IConnectionCompletionOptions, model?: interfaces.IConnectionProfile, connectionResult?: IConnectionResult): Promise<void> {
if (!params) {
params = { connectionType: ConnectionType.default };
}
@@ -197,7 +196,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
* Load the password for the profile
* @param connectionProfile Connection Profile
*/
public async addSavedPassword(connectionProfile: IConnectionProfile): Promise<IConnectionProfile> {
public async addSavedPassword(connectionProfile: interfaces.IConnectionProfile): Promise<interfaces.IConnectionProfile> {
await this.fillInOrClearAzureToken(connectionProfile);
return this._connectionStore.addSavedPassword(connectionProfile).then(result => result.profile);
}
@@ -220,7 +219,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
* @param owner of the connection. Can be the editors
* @param options to use after the connection is complete
*/
private tryConnect(connection: IConnectionProfile, owner: IConnectableInput, options?: IConnectionCompletionOptions): Promise<IConnectionResult> {
private tryConnect(connection: interfaces.IConnectionProfile, owner: IConnectableInput, options?: IConnectionCompletionOptions): Promise<IConnectionResult> {
// Load the password if it's not already loaded
return this._connectionStore.addSavedPassword(connection).then(async result => {
let newConnection = result.profile;
@@ -261,7 +260,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
* otherwise does nothing
*/
private showConnectionDialogOnError(
connection: IConnectionProfile,
connection: interfaces.IConnectionProfile,
owner: IConnectableInput,
connectionResult: IConnectionResult,
options?: IConnectionCompletionOptions): Promise<IConnectionResult> {
@@ -287,7 +286,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
* @param options to be used after the connection is completed
* @param callbacks to call after the connection is completed
*/
public connect(connection: IConnectionProfile, uri: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks): Promise<IConnectionResult> {
public connect(connection: interfaces.IConnectionProfile, uri: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks): Promise<IConnectionResult> {
if (!uri) {
uri = Utils.generateUri(connection);
}
@@ -316,7 +315,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
* otherwise tries to make a connection and returns the owner uri when connection is complete
* The purpose is connection by default
*/
public connectIfNotConnected(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection' | 'notebook', saveConnection: boolean = false): Promise<string> {
public connectIfNotConnected(connection: interfaces.IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection' | 'notebook', saveConnection: boolean = false): Promise<string> {
let ownerUri: string = Utils.generateUri(connection, purpose);
if (this._connectionStatusManager.isConnected(ownerUri)) {
return Promise.resolve(this._connectionStatusManager.getOriginalOwnerUri(ownerUri));
@@ -343,7 +342,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
* This method doesn't load the password because it only gets called from the
* connection dialog and password should be already in the profile
*/
public connectAndSaveProfile(connection: IConnectionProfile, uri: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks):
public connectAndSaveProfile(connection: interfaces.IConnectionProfile, uri: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks):
Promise<IConnectionResult> {
if (!options) {
options = {
@@ -360,7 +359,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
return this.connectWithOptions(connection, uri, options, callbacks);
}
private async connectWithOptions(connection: IConnectionProfile, uri: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks): Promise<IConnectionResult> {
private async connectWithOptions(connection: interfaces.IConnectionProfile, uri: string, options?: IConnectionCompletionOptions, callbacks?: IConnectionCallbacks): Promise<IConnectionResult> {
connection.options['groupId'] = connection.groupId;
connection.options['databaseDisplayName'] = connection.databaseName;
@@ -440,7 +439,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
});
}
private handleConnectionError(connection: IConnectionProfile, uri: string, options: IConnectionCompletionOptions, callbacks: IConnectionCallbacks, connectionResult: IConnectionResult) {
private handleConnectionError(connection: interfaces.IConnectionProfile, uri: string, options: IConnectionCompletionOptions, callbacks: IConnectionCallbacks, connectionResult: IConnectionResult) {
let connectionNotAcceptedError = nls.localize('connectionNotAcceptedError', "Connection Not Accepted");
if (options.showFirewallRuleOnError && connectionResult.errorCode) {
return this.handleFirewallRuleError(connection, connectionResult).then(success => {
@@ -462,7 +461,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
}
}
private handleFirewallRuleError(connection: IConnectionProfile, connectionResult: IConnectionResult): Promise<boolean> {
private handleFirewallRuleError(connection: interfaces.IConnectionProfile, connectionResult: IConnectionResult): Promise<boolean> {
return this._resourceProviderService.handleFirewallRule(connectionResult.errorCode, connectionResult.errorMessage, connection.providerName).then(response => {
if (response.canHandleFirewallRule) {
connectionResult.errorHandled = true;
@@ -510,11 +509,11 @@ export class ConnectionManagementService extends Disposable implements IConnecti
return this._mementoObj.CONNECTION_ICON_ID[connectionId];
}
public showDashboard(connection: IConnectionProfile): Thenable<boolean> {
public showDashboard(connection: interfaces.IConnectionProfile): Thenable<boolean> {
return this.showDashboardForConnectionManagementInfo(connection);
}
private showDashboardForConnectionManagementInfo(connectionProfile: IConnectionProfile): Thenable<boolean> {
private showDashboardForConnectionManagementInfo(connectionProfile: interfaces.IConnectionProfile): Thenable<boolean> {
// if dashboard profile is already open, focus on that tab
if (!this.focusDashboard(connectionProfile)) {
let dashboardInput: DashboardInput = this._instantiationService ? this._instantiationService.createInstance(DashboardInput, connectionProfile) : undefined;
@@ -526,7 +525,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
}
}
private focusDashboard(profile: IConnectionProfile): boolean {
private focusDashboard(profile: interfaces.IConnectionProfile): boolean {
let found: boolean = false;
this._editorService.editors.map(editor => {
@@ -567,7 +566,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
return this._connectionStore.clearRecentlyUsed();
}
public clearRecentConnection(connectionProfile: IConnectionProfile): void {
public clearRecentConnection(connectionProfile: interfaces.IConnectionProfile): void {
this._connectionStore.removeRecentConnection(connectionProfile);
}
@@ -639,7 +638,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
return false;
}
public getConnectionUri(connectionProfile: IConnectionProfile): string {
public getConnectionUri(connectionProfile: interfaces.IConnectionProfile): string {
return this._connectionStatusManager.getOriginalOwnerUri(Utils.generateUri(connectionProfile));
}
@@ -647,7 +646,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
* Returns a formatted URI in case the database field is empty for the original
* URI, which happens when the connected database is master or the default database
*/
public getFormattedUri(uri: string, connectionProfile: IConnectionProfile): string {
public getFormattedUri(uri: string, connectionProfile: interfaces.IConnectionProfile): string {
if (this._connectionStatusManager.isDefaultTypeUri(uri)) {
return this.getConnectionUri(connectionProfile);
} else {
@@ -701,7 +700,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
* and clears it if it isn't.
* @param connection The connection to fill in or update
*/
private async fillInOrClearAzureToken(connection: IConnectionProfile): Promise<boolean> {
private async fillInOrClearAzureToken(connection: interfaces.IConnectionProfile): Promise<boolean> {
if (connection.authenticationType !== Constants.azureMFA) {
connection.options['azureAccountToken'] = undefined;
return true;
@@ -742,7 +741,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
}
// Request Senders
private async sendConnectRequest(connection: IConnectionProfile, uri: string): Promise<boolean> {
private async sendConnectRequest(connection: interfaces.IConnectionProfile, uri: string): Promise<boolean> {
let connectionInfo = Object.assign({}, {
options: connection.options
});
@@ -800,7 +799,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
});
}
private saveToSettings(id: string, connection: IConnectionProfile): Promise<string> {
private saveToSettings(id: string, connection: interfaces.IConnectionProfile): Promise<string> {
return this._connectionStore.saveProfile(connection).then(savedProfile => {
let newId = this._connectionStatusManager.updateConnectionProfile(savedProfile, id);
return newId;
@@ -810,7 +809,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
/**
* Add a connection to the active connections list.
*/
private tryAddActiveConnection(connectionManagementInfo: ConnectionManagementInfo, newConnection: IConnectionProfile, addToMru: boolean): void {
private tryAddActiveConnection(connectionManagementInfo: ConnectionManagementInfo, newConnection: interfaces.IConnectionProfile, addToMru: boolean): void {
if (newConnection && addToMru) {
this._connectionStore.addRecentConnection(newConnection)
.then(() => {
@@ -835,7 +834,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
});
}
private addTelemetryForConnectionDisconnected(connection: IConnectionProfile): void {
private addTelemetryForConnectionDisconnected(connection: interfaces.IConnectionProfile): void {
TelemetryUtils.addTelemetry(this._telemetryService, this._logService, TelemetryKeys.DatabaseDisconnected, {
provider: connection.providerName
});
@@ -863,11 +862,11 @@ export class ConnectionManagementService extends Disposable implements IConnecti
}
public onConnectionChangedNotification(handle: number, changedConnInfo: azdata.ChangedConnectionInfo): void {
let profile: IConnectionProfile = this._connectionStatusManager.onConnectionChanged(changedConnInfo);
let profile: interfaces.IConnectionProfile = this._connectionStatusManager.onConnectionChanged(changedConnInfo);
this._notifyConnectionChanged(profile, changedConnInfo.connectionUri);
}
private _notifyConnectionChanged(profile: IConnectionProfile, connectionUri: string): void {
private _notifyConnectionChanged(profile: interfaces.IConnectionProfile, connectionUri: string): void {
if (profile) {
this._onConnectionChanged.fire(<IConnectionParams>{
connectionProfile: profile,
@@ -946,7 +945,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
*/
// Connect an open URI to a connection profile
private createNewConnection(uri: string, connection: IConnectionProfile): Promise<IConnectionResult> {
private createNewConnection(uri: string, connection: interfaces.IConnectionProfile): Promise<IConnectionResult> {
const self = this;
this._logService.info(`Creating new connection ${uri}`);
return new Promise<IConnectionResult>((resolve, reject) => {
@@ -988,7 +987,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
});
}
private doDisconnect(fileUri: string, connection?: IConnectionProfile): Promise<boolean> {
private doDisconnect(fileUri: string, connection?: interfaces.IConnectionProfile): Promise<boolean> {
let disconnectParams = new ConnectionContracts.DisconnectParams();
disconnectParams.ownerUri = fileUri;
@@ -1013,11 +1012,11 @@ export class ConnectionManagementService extends Disposable implements IConnecti
});
}
public disconnect(connection: IConnectionProfile): Promise<void>;
public disconnect(connection: interfaces.IConnectionProfile): Promise<void>;
public disconnect(ownerUri: string): Promise<void>;
public disconnect(input: string | IConnectionProfile): Promise<void> {
public disconnect(input: string | interfaces.IConnectionProfile): Promise<void> {
let uri: string;
let profile: IConnectionProfile;
let profile: interfaces.IConnectionProfile;
if (typeof input === 'object') {
uri = Utils.generateUri(input);
profile = input;
@@ -1035,7 +1034,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
});
}
public cancelConnection(connection: IConnectionProfile): Thenable<boolean> {
public cancelConnection(connection: interfaces.IConnectionProfile): Thenable<boolean> {
let fileUri = Utils.generateUri(connection);
return this.cancelConnectionForUri(fileUri);
}
@@ -1071,7 +1070,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
* Finds existing connection for given profile and purpose is any exists.
* The purpose is connection by default
*/
public findExistingConnection(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection' | 'notebook'): ConnectionProfile {
public findExistingConnection(connection: interfaces.IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection' | 'notebook'): ConnectionProfile {
let connectionUri = Utils.generateUri(connection, purpose);
let existingConnection = this._connectionStatusManager.findConnection(connectionUri);
if (existingConnection && this._connectionStatusManager.isConnected(connectionUri)) {
@@ -1081,12 +1080,12 @@ export class ConnectionManagementService extends Disposable implements IConnecti
}
}
public isProfileConnected(connectionProfile: IConnectionProfile): boolean {
public isProfileConnected(connectionProfile: interfaces.IConnectionProfile): boolean {
let connectionManagement = this._connectionStatusManager.findConnectionProfile(connectionProfile);
return connectionManagement && !connectionManagement.connecting;
}
public isProfileConnecting(connectionProfile: IConnectionProfile): boolean {
public isProfileConnecting(connectionProfile: interfaces.IConnectionProfile): boolean {
let connectionManagement = this._connectionStatusManager.findConnectionProfile(connectionProfile);
return connectionManagement && connectionManagement.connecting;
}
@@ -1095,7 +1094,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
return this._connectionStatusManager.isConnecting(fileUri);
}
public getConnectionProfile(fileUri: string): IConnectionProfile {
public getConnectionProfile(fileUri: string): interfaces.IConnectionProfile {
return this._connectionStatusManager.isConnected(fileUri) ? this._connectionStatusManager.getConnectionProfile(fileUri) : undefined;
}
@@ -1210,7 +1209,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
return Promise.resolve(undefined);
}
private _notifyDisconnected(connectionProfile: IConnectionProfile, connectionUri: string): void {
private _notifyDisconnected(connectionProfile: interfaces.IConnectionProfile, connectionUri: string): void {
this._onDisconnect.fire(<IConnectionParams>{
connectionUri: connectionUri,
connectionProfile: connectionProfile
@@ -1247,7 +1246,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
return matchingGroup.color;
}
public removeConnectionProfileCredentials(originalProfile: IConnectionProfile): IConnectionProfile {
public removeConnectionProfileCredentials(originalProfile: interfaces.IConnectionProfile): interfaces.IConnectionProfile {
return this._connectionStore.getProfileWithoutPassword(originalProfile);
}
@@ -1280,7 +1279,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
return serverInfo;
}
public getConnectionProfileById(profileId: string): IConnectionProfile {
public getConnectionProfileById(profileId: string): interfaces.IConnectionProfile {
let profile = this._connectionStatusManager.findConnectionByProfileId(profileId);
if (!profile) {
return undefined;

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { TestConnectionDialogService } from 'sql/workbench/services/connection/test/common/testConnectionDialogService';
import { ConnectionManagementService } from 'sql/platform/connection/common/connectionManagementService';
import { ConnectionManagementService } from 'sql/platform/connection/browser/connectionManagementService';
import { ConnectionStatusManager } from 'sql/platform/connection/common/connectionStatusManager';
import { ConnectionStore } from 'sql/platform/connection/common/connectionStore';
import {

View File

@@ -6,7 +6,7 @@
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { Event } from 'vs/base/common/event';
import { IView, IModelView } from 'sql/platform/model/common/modelViewService';
import { IView, IModelView } from 'sql/platform/model/browser/modelViewService';
export const SERVICE_ID = 'dashboardViewService';

View File

@@ -3,9 +3,9 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IDashboardViewService, IDashboardWebview } from 'sql/platform/dashboard/common/dashboardViewService';
import { IDashboardViewService, IDashboardWebview } from 'sql/platform/dashboard/browser/dashboardViewService';
import { Event, Emitter } from 'vs/base/common/event';
import { IModelView } from 'sql/platform/model/common/modelViewService';
import { IModelView } from 'sql/platform/model/browser/modelViewService';
export class DashboardViewService implements IDashboardViewService {
_serviceBrand: any;

View File

@@ -6,7 +6,7 @@
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { Event } from 'vs/base/common/event';
import { IModelView } from 'sql/platform/model/common/modelViewService';
import { IModelView } from 'sql/platform/model/browser/modelViewService';
export const SERVICE_ID = 'modelViewService';
@@ -16,4 +16,4 @@ export interface IModelViewService {
registerModelView(widget: IModelView);
}
export const IModelViewService = createDecorator<IModelViewService>(SERVICE_ID);
export const IModelViewService = createDecorator<IModelViewService>(SERVICE_ID);

View File

@@ -3,9 +3,9 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IModelViewService } from 'sql/platform/modelComponents/common/modelViewService';
import { IModelViewService } from 'sql/platform/modelComponents/browser/modelViewService';
import { Event, Emitter } from 'vs/base/common/event';
import { IModelView } from 'sql/platform/model/common/modelViewService';
import { IModelView } from 'sql/platform/model/browser/modelViewService';
export class ModelViewService implements IModelViewService {
_serviceBrand: any;

View File

@@ -18,7 +18,7 @@ import { MssqlRestoreInfo } from 'sql/platform/restore/common/mssqlRestoreInfo';
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
import { ProviderConnectionInfo } from 'sql/platform/connection/common/providerConnectionInfo';
import * as Utils from 'sql/platform/connection/common/utils';
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/common/objectExplorerService';
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerService';
import { ITaskService } from 'sql/platform/tasks/common/tasksService';
import { TaskStatus, TaskNode } from 'sql/platform/tasks/common/tasksNode';
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';