CMS fit and finish (#5542)

* cms connections dont save

* added value to enum

* remove refresh and update provider name for cms

* removed ownerUri from saved connection and contributed to array

* removed owneruri

* ownerUri not needed any more

* removed AAD from cms

* initial review

* changed comments

* add back saveProfile option for connectionProfile

* review fixes and other UI improvements

* fixed auth

* added cms integration tests

* added constants

* removed utils from apiwrapper

* changed connection type name

* review comments

* clearer code and addressed reviews
This commit is contained in:
Aditya Bist
2019-05-31 11:14:37 -07:00
committed by GitHub
parent fa52478ffa
commit 1773dede25
27 changed files with 546 additions and 278 deletions

View File

@@ -7,7 +7,7 @@ import { SqlExtHostContext, SqlMainContext, ExtHostConnectionManagementShape, Ma
import * as azdata from 'azdata';
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
import { IConnectionManagementService, ConnectionType } from 'sql/platform/connection/common/connectionManagement';
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/common/objectExplorerService';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
@@ -60,15 +60,23 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
}
public async $openConnectionDialog(providers: string[], initialConnectionProfile?: IConnectionProfile, connectionCompletionOptions?: azdata.IConnectionCompletionOptions): Promise<azdata.connection.Connection> {
// Here we default to ConnectionType.editor which saves the connecton in the connection store by default
let connectionType = ConnectionType.editor;
// If the API call explicitly set saveConnection to false, set it to ConnectionType.extension
// which doesn't save the connection by default
if (connectionCompletionOptions && !connectionCompletionOptions.saveConnection) {
connectionType = ConnectionType.temporary;
}
let connectionProfile = await this._connectionDialogService.openDialogAndWait(this._connectionManagementService,
{ connectionType: 1, providers: providers }, initialConnectionProfile, undefined);
{ connectionType: connectionType, providers: providers }, initialConnectionProfile, undefined);
const connection = connectionProfile ? {
connectionId: connectionProfile.id,
options: connectionProfile.options,
providerName: connectionProfile.providerName
} : undefined;
if (connectionCompletionOptions) {
if (connectionCompletionOptions && connectionCompletionOptions.saveConnection) {
// Somehow, connectionProfile.saveProfile is false even if initialConnectionProfile.saveProfile is true, reset the flag here.
connectionProfile.saveProfile = initialConnectionProfile.saveProfile;
await this._connectionManagementService.connectAndSaveProfile(connectionProfile, undefined, {
@@ -79,7 +87,6 @@ export class MainThreadConnectionManagement implements MainThreadConnectionManag
showFirewallRuleOnError: isUndefinedOrNull(connectionCompletionOptions.showFirewallRuleOnError) ? true : connectionCompletionOptions.showFirewallRuleOnError
});
}
return connection;
}

View File

@@ -121,8 +121,8 @@ export function createApiFactory(
getUriForConnection(connectionId: string): Thenable<string> {
return extHostConnectionManagement.$getUriForConnection(connectionId);
},
connect(connectionProfile: azdata.IConnectionProfile): Thenable<azdata.ConnectionResult> {
return extHostConnectionManagement.$connect(connectionProfile);
connect(connectionProfile: azdata.IConnectionProfile, saveConnection: boolean, showDashboard: boolean): Thenable<azdata.ConnectionResult> {
return extHostConnectionManagement.$connect(connectionProfile, saveConnection, showDashboard);
}
};