mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
@@ -63,7 +63,7 @@ export class CommandLineService implements ICommandLineProcessing {
|
|||||||
// prompt the user for a new connection on startup if no profiles are registered
|
// prompt the user for a new connection on startup if no profiles are registered
|
||||||
this._connectionManagementService.showConnectionDialog();
|
this._connectionManagementService.showConnectionDialog();
|
||||||
} else if (this._connectionProfile) {
|
} else if (this._connectionProfile) {
|
||||||
this._connectionManagementService.connectIfNotConnected(this._connectionProfile, 'connection')
|
this._connectionManagementService.connectIfNotConnected(this._connectionProfile, 'connection', true)
|
||||||
.then(result => TaskUtilities.newQuery(this._connectionProfile,
|
.then(result => TaskUtilities.newQuery(this._connectionProfile,
|
||||||
this._connectionManagementService,
|
this._connectionManagementService,
|
||||||
this._queryEditorService,
|
this._queryEditorService,
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ export interface IConnectionManagementService {
|
|||||||
* otherwise tries to make a connection and returns the owner uri when connection is complete
|
* otherwise tries to make a connection and returns the owner uri when connection is complete
|
||||||
* The purpose is connection by default
|
* The purpose is connection by default
|
||||||
*/
|
*/
|
||||||
connectIfNotConnected(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection'): Promise<string>;
|
connectIfNotConnected(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection', saveConnection?: boolean): Promise<string>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the successful connection to MRU and send the connection error back to the connection handler for failed connections
|
* Adds the successful connection to MRU and send the connection error back to the connection handler for failed connections
|
||||||
|
|||||||
@@ -380,14 +380,14 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
|||||||
* otherwise tries to make a connection and returns the owner uri when connection is complete
|
* otherwise tries to make a connection and returns the owner uri when connection is complete
|
||||||
* The purpose is connection by default
|
* The purpose is connection by default
|
||||||
*/
|
*/
|
||||||
public connectIfNotConnected(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection'): Promise<string> {
|
public connectIfNotConnected(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection', saveConnection: boolean = false): Promise<string> {
|
||||||
return new Promise<string>((resolve, reject) => {
|
return new Promise<string>((resolve, reject) => {
|
||||||
let ownerUri: string = Utils.generateUri(connection, purpose);
|
let ownerUri: string = Utils.generateUri(connection, purpose);
|
||||||
if (this._connectionStatusManager.isConnected(ownerUri)) {
|
if (this._connectionStatusManager.isConnected(ownerUri)) {
|
||||||
resolve(this._connectionStatusManager.getOriginalOwnerUri(ownerUri));
|
resolve(this._connectionStatusManager.getOriginalOwnerUri(ownerUri));
|
||||||
} else {
|
} else {
|
||||||
const options: IConnectionCompletionOptions = {
|
const options: IConnectionCompletionOptions = {
|
||||||
saveTheConnection: false,
|
saveTheConnection: saveConnection,
|
||||||
showConnectionDialogOnError: true,
|
showConnectionDialogOnError: true,
|
||||||
showDashboard: purpose === 'dashboard',
|
showDashboard: purpose === 'dashboard',
|
||||||
params: undefined,
|
params: undefined,
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ suite('commandLineService tests', () => {
|
|||||||
environmentService.setup(e => e.args).returns(() => args).verifiable(TypeMoq.Times.atLeastOnce());
|
environmentService.setup(e => e.args).returns(() => args).verifiable(TypeMoq.Times.atLeastOnce());
|
||||||
connectionManagementService.setup((c) => c.showConnectionDialog()).verifiable(TypeMoq.Times.never());
|
connectionManagementService.setup((c) => c.showConnectionDialog()).verifiable(TypeMoq.Times.never());
|
||||||
connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => true).verifiable(TypeMoq.Times.atMostOnce());
|
connectionManagementService.setup(c => c.hasRegisteredServers()).returns(() => true).verifiable(TypeMoq.Times.atMostOnce());
|
||||||
connectionManagementService.setup(c => c.connectIfNotConnected(TypeMoq.It.isAny(), 'connection'))
|
connectionManagementService.setup(c => c.connectIfNotConnected(TypeMoq.It.isAny(), 'connection', true))
|
||||||
.returns(() => new Promise<string>((resolve, reject) => { reject('unused');}))
|
.returns(() => new Promise<string>((resolve, reject) => { reject('unused');}))
|
||||||
.verifiable(TypeMoq.Times.once());
|
.verifiable(TypeMoq.Times.once());
|
||||||
let service = getCommandLineService(connectionManagementService.object, environmentService.object, capabilitiesService);
|
let service = getCommandLineService(connectionManagementService.object, environmentService.object, capabilitiesService);
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ export class TestConnectionManagementService implements IConnectionManagementSer
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
connectIfNotConnected(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection'): Promise<string> {
|
connectIfNotConnected(connection: IConnectionProfile, purpose?: 'dashboard' | 'insights' | 'connection', saveConnection: boolean = false): Promise<string> {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user