mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 01:25:38 -05:00
remove SQL Login from CMS and add error messages (#5873)
This commit is contained in:
@@ -20,7 +20,6 @@ export class CmsConnectionController extends ConnectionController {
|
||||
connectionProperties: ConnectionProviderProperties,
|
||||
callback: IConnectionComponentCallbacks,
|
||||
providerName: string,
|
||||
authTypeChanged: boolean = false,
|
||||
@IInstantiationService _instantiationService: IInstantiationService) {
|
||||
super(connectionManagementService, connectionProperties, callback, providerName, _instantiationService);
|
||||
let specialOptions = this._providerOptions.filter(
|
||||
@@ -34,11 +33,11 @@ export class CmsConnectionController extends ConnectionController {
|
||||
serverName, authenticationType, userName, password).then(result => {
|
||||
return result;
|
||||
})
|
||||
}, providerName, authTypeChanged);
|
||||
}, providerName);
|
||||
}
|
||||
|
||||
public showUiComponent(container: HTMLElement, authTypeChanged: boolean = false): void {
|
||||
public showUiComponent(container: HTMLElement): void {
|
||||
this._databaseCache = new Map<string, string[]>();
|
||||
this._connectionWidget.createConnectionWidget(container, authTypeChanged);
|
||||
this._connectionWidget.createConnectionWidget(container);
|
||||
}
|
||||
}
|
||||
@@ -35,13 +35,12 @@ export class CmsConnectionWidget extends ConnectionWidget {
|
||||
|
||||
private _serverDescriptionInputBox: InputBox;
|
||||
protected _authTypeMap: { [providerName: string]: AuthenticationType[] } = {
|
||||
[Constants.cmsProviderName]: [AuthenticationType.SqlLogin, AuthenticationType.Integrated, AuthenticationType.AzureMFA]
|
||||
[Constants.cmsProviderName]: [AuthenticationType.Integrated]
|
||||
};
|
||||
|
||||
constructor(options: azdata.ConnectionOption[],
|
||||
callbacks: IConnectionComponentCallbacks,
|
||||
providerName: string,
|
||||
authTypeChanged: boolean = false,
|
||||
@IThemeService _themeService: IThemeService,
|
||||
@IContextViewService _contextViewService: IContextViewService,
|
||||
@ILayoutService _layoutService: ILayoutService,
|
||||
@@ -54,14 +53,8 @@ export class CmsConnectionWidget extends ConnectionWidget {
|
||||
super(options, callbacks, providerName, _themeService, _contextViewService, _connectionManagementService, _capabilitiesService,
|
||||
_clipboardService, _configurationService, _accountManagementService);
|
||||
let authTypeOption = this._optionsMaps[ConnectionOptionSpecialType.authType];
|
||||
if (authTypeOption) {
|
||||
if (OS === OperatingSystem.Windows || authTypeChanged) {
|
||||
authTypeOption.defaultValue = this.getAuthTypeDisplayName(AuthenticationType.Integrated);
|
||||
} else {
|
||||
authTypeOption.defaultValue = this.getAuthTypeDisplayName(AuthenticationType.SqlLogin);
|
||||
}
|
||||
this._authTypeSelectBox = new SelectBox(authTypeOption.categoryValues.map(c => c.displayName), authTypeOption.defaultValue, this._contextViewService, undefined, { ariaLabel: authTypeOption.displayName });
|
||||
}
|
||||
authTypeOption.defaultValue = this.getAuthTypeDisplayName(AuthenticationType.Integrated);
|
||||
this._authTypeSelectBox = new SelectBox(authTypeOption.categoryValues.map(c => c.displayName), authTypeOption.defaultValue, this._contextViewService, undefined, { ariaLabel: authTypeOption.displayName });
|
||||
}
|
||||
|
||||
protected registerListeners(): void {
|
||||
@@ -71,12 +64,12 @@ export class CmsConnectionWidget extends ConnectionWidget {
|
||||
}
|
||||
}
|
||||
|
||||
protected fillInConnectionForm(authTypeChanged: boolean = false): void {
|
||||
protected fillInConnectionForm(): void {
|
||||
// Server Name
|
||||
this.addServerNameOption();
|
||||
|
||||
// Authentication type
|
||||
this.addAuthenticationTypeOption(authTypeChanged);
|
||||
this.addAuthenticationTypeOption();
|
||||
|
||||
// Login Options
|
||||
this.addLoginOptions();
|
||||
@@ -91,25 +84,16 @@ export class CmsConnectionWidget extends ConnectionWidget {
|
||||
this.addAdvancedOptions();
|
||||
}
|
||||
|
||||
protected addAuthenticationTypeOption(authTypeChanged: boolean = false): void {
|
||||
super.addAuthenticationTypeOption(authTypeChanged);
|
||||
protected addAuthenticationTypeOption(): void {
|
||||
super.addAuthenticationTypeOption();
|
||||
let authTypeOption = this._optionsMaps[ConnectionOptionSpecialType.authType];
|
||||
let newAuthTypes = authTypeOption.categoryValues;
|
||||
// True when opening a CMS dialog to add a registered server
|
||||
if (authTypeChanged) {
|
||||
// Registered Servers only support Integrated Auth
|
||||
newAuthTypes = authTypeOption.categoryValues.filter((option) => option.name === AuthenticationType.Integrated);
|
||||
this._authTypeSelectBox.setOptions(newAuthTypes.map(c => c.displayName), 0);
|
||||
authTypeOption.defaultValue = AuthenticationType.Integrated;
|
||||
} else {
|
||||
// CMS supports all auth types
|
||||
if (OS === OperatingSystem.Windows) {
|
||||
authTypeOption.defaultValue = this.getAuthTypeDisplayName(AuthenticationType.Integrated);
|
||||
} else {
|
||||
authTypeOption.defaultValue = this.getAuthTypeDisplayName(AuthenticationType.SqlLogin);
|
||||
}
|
||||
this._authTypeSelectBox.setOptions(authTypeOption.categoryValues.map(c => c.displayName), 1);
|
||||
}
|
||||
|
||||
// CMS only supports Integrated Auth
|
||||
newAuthTypes = authTypeOption.categoryValues.filter((option) => option.name === AuthenticationType.Integrated);
|
||||
this._authTypeSelectBox.setOptions(newAuthTypes.map(c => c.displayName), 0);
|
||||
authTypeOption.defaultValue = AuthenticationType.Integrated;
|
||||
this._authTypeSelectBox.setOptions(authTypeOption.categoryValues.map(c => c.displayName), 1);
|
||||
}
|
||||
|
||||
private addServerDescriptionOption(): void {
|
||||
@@ -123,10 +107,10 @@ export class CmsConnectionWidget extends ConnectionWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public createConnectionWidget(container: HTMLElement, authTypeChanged: boolean = false): void {
|
||||
public createConnectionWidget(container: HTMLElement): void {
|
||||
this._container = DOM.append(container, DOM.$('div.connection-table'));
|
||||
this._tableContainer = DOM.append(this._container, DOM.$('table.connection-table-content'));
|
||||
this.fillInConnectionForm(authTypeChanged);
|
||||
this.fillInConnectionForm();
|
||||
this.registerListeners();
|
||||
if (this._authTypeSelectBox) {
|
||||
this.onAuthTypeSelected(this._authTypeSelectBox.value);
|
||||
|
||||
@@ -284,7 +284,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
this._connectionManagementService,
|
||||
this._capabilitiesService.getCapabilities(providerName).connection, {
|
||||
onSetConnectButton: (enable: boolean) => this.handleSetConnectButtonEnable(enable)
|
||||
}, providerName, this._inputModel ? this._inputModel.options.authTypeChanged : false);
|
||||
}, providerName);
|
||||
} else {
|
||||
this._connectionControllerMap[providerName] =
|
||||
this._instantiationService.createInstance(ConnectionController,
|
||||
@@ -322,12 +322,8 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
||||
this._model.providerName = this._currentProviderType;
|
||||
|
||||
this._model = new ConnectionProfile(this._capabilitiesService, this._model);
|
||||
if (this._inputModel && this._inputModel.options) {
|
||||
this.uiController.showUiComponent(input.container,
|
||||
this._inputModel.options.authTypeChanged);
|
||||
} else {
|
||||
this.uiController.showUiComponent(input.container);
|
||||
}
|
||||
this.uiController.showUiComponent(input.container);
|
||||
|
||||
}
|
||||
|
||||
private handleInitDialog() {
|
||||
|
||||
@@ -123,13 +123,13 @@ export class ConnectionWidget {
|
||||
this._providerName = providerName;
|
||||
}
|
||||
|
||||
public createConnectionWidget(container: HTMLElement, authTypeChanged: boolean = false): void {
|
||||
public createConnectionWidget(container: HTMLElement): void {
|
||||
this._serverGroupOptions = [this.DefaultServerGroup];
|
||||
this._serverGroupSelectBox = new SelectBox(this._serverGroupOptions.map(g => g.name), this.DefaultServerGroup.name, this._contextViewService, undefined, { ariaLabel: this._serverGroupDisplayString });
|
||||
this._previousGroupOption = this._serverGroupSelectBox.value;
|
||||
this._container = DOM.append(container, DOM.$('div.connection-table'));
|
||||
this._tableContainer = DOM.append(this._container, DOM.$('table.connection-table-content'));
|
||||
this.fillInConnectionForm(authTypeChanged);
|
||||
this.fillInConnectionForm();
|
||||
this.registerListeners();
|
||||
if (this._authTypeSelectBox) {
|
||||
this.onAuthTypeSelected(this._authTypeSelectBox.value);
|
||||
@@ -155,12 +155,12 @@ export class ConnectionWidget {
|
||||
}
|
||||
}
|
||||
|
||||
protected fillInConnectionForm(authTypeChanged: boolean = false): void {
|
||||
protected fillInConnectionForm(): void {
|
||||
// Server Name
|
||||
this.addServerNameOption();
|
||||
|
||||
// Authentication type
|
||||
this.addAuthenticationTypeOption(authTypeChanged);
|
||||
this.addAuthenticationTypeOption();
|
||||
|
||||
// Login Options
|
||||
this.addLoginOptions();
|
||||
@@ -178,7 +178,7 @@ export class ConnectionWidget {
|
||||
this.addAdvancedOptions();
|
||||
}
|
||||
|
||||
protected addAuthenticationTypeOption(authTypeChanged: boolean = false): void {
|
||||
protected addAuthenticationTypeOption(): void {
|
||||
if (this._optionsMaps[ConnectionOptionSpecialType.authType]) {
|
||||
let authType = DialogHelper.appendRow(this._tableContainer, this._optionsMaps[ConnectionOptionSpecialType.authType].displayName, 'connection-label', 'connection-input');
|
||||
DialogHelper.appendInputSelectBox(authType, this._authTypeSelectBox);
|
||||
|
||||
Reference in New Issue
Block a user