mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
remove SQL Login from CMS and add error messages (#5873)
This commit is contained in:
@@ -86,17 +86,9 @@
|
|||||||
"defaultValue": null,
|
"defaultValue": null,
|
||||||
"objectType": null,
|
"objectType": null,
|
||||||
"categoryValues": [
|
"categoryValues": [
|
||||||
{
|
|
||||||
"displayName": "%cms.connectionOptions.authType.categoryValues.sqlLogin%",
|
|
||||||
"name": "SqlLogin"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"displayName": "%cms.connectionOptions.authType.categoryValues.integrated%",
|
"displayName": "%cms.connectionOptions.authType.categoryValues.integrated%",
|
||||||
"name": "Integrated"
|
"name": "Integrated"
|
||||||
},
|
|
||||||
{
|
|
||||||
"displayName": "%cms.connectionOptions.authType.categoryValues.azureMFA%",
|
|
||||||
"name": "AzureMFA"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"isRequired": true,
|
"isRequired": true,
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export class CmsResourceTreeNode extends CmsResourceTreeNodeBase {
|
|||||||
}
|
}
|
||||||
}, (error) => {
|
}, (error) => {
|
||||||
let errorText = localize('cms.errors.expandCmsFail', 'The Central Management Server {0} could not be found or is offline', this.name);
|
let errorText = localize('cms.errors.expandCmsFail', 'The Central Management Server {0} could not be found or is offline', this.name);
|
||||||
this.appContext.apiWrapper.showErrorMessage(errorText);
|
this.appContext.apiWrapper.showErrorMessage(error ? error : errorText);
|
||||||
return [];
|
return [];
|
||||||
});
|
});
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
@@ -143,9 +143,7 @@ export class CmsUtils {
|
|||||||
providerName: undefined,
|
providerName: undefined,
|
||||||
saveProfile: undefined,
|
saveProfile: undefined,
|
||||||
id: undefined,
|
id: undefined,
|
||||||
options: {
|
options: {}
|
||||||
authTypeChanged: true
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return this.openConnectionDialog([cmsProvider], initialProfile, { saveConnection: false }).then(async (connection) => {
|
return this.openConnectionDialog([cmsProvider], initialProfile, { saveConnection: false }).then(async (connection) => {
|
||||||
if (connection && connection.options) {
|
if (connection && connection.options) {
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import { ListRegisteredServersResult } from '../api/mssqlapis';
|
|||||||
export class CmsService {
|
export class CmsService {
|
||||||
|
|
||||||
constructor(private appContext: AppContext, private client: SqlOpsDataClient) {
|
constructor(private appContext: AppContext, private client: SqlOpsDataClient) {
|
||||||
|
|
||||||
this.appContext.registerService<CmsService>(constants.CmsService, this);
|
this.appContext.registerService<CmsService>(constants.CmsService, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ export class CmsService {
|
|||||||
},
|
},
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.CreateCentralManagementServerRequest.type, e);
|
this.client.logFailedRequest(contracts.CreateCentralManagementServerRequest.type, e);
|
||||||
return Promise.resolve(undefined);
|
return Promise.reject(e.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -43,7 +42,7 @@ export class CmsService {
|
|||||||
},
|
},
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.ListRegisteredServersRequest.type, e);
|
this.client.logFailedRequest(contracts.ListRegisteredServersRequest.type, e);
|
||||||
return Promise.resolve(undefined);
|
return Promise.reject(e.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -56,7 +55,7 @@ export class CmsService {
|
|||||||
},
|
},
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.AddRegisteredServerRequest.type, e);
|
this.client.logFailedRequest(contracts.AddRegisteredServerRequest.type, e);
|
||||||
return Promise.resolve(undefined);
|
return Promise.reject(e.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -69,7 +68,7 @@ export class CmsService {
|
|||||||
},
|
},
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.RemoveRegisteredServerRequest.type, e);
|
this.client.logFailedRequest(contracts.RemoveRegisteredServerRequest.type, e);
|
||||||
return Promise.resolve(undefined);
|
return Promise.reject(e.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -82,7 +81,7 @@ export class CmsService {
|
|||||||
},
|
},
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.AddServerGroupRequest.type, e);
|
this.client.logFailedRequest(contracts.AddServerGroupRequest.type, e);
|
||||||
return Promise.resolve(undefined);
|
return Promise.reject(e.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -95,7 +94,7 @@ export class CmsService {
|
|||||||
},
|
},
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.RemoveServerGroupRequest.type, e);
|
this.client.logFailedRequest(contracts.RemoveServerGroupRequest.type, e);
|
||||||
return Promise.resolve(undefined);
|
return Promise.reject(e.message);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ export class CmsConnectionController extends ConnectionController {
|
|||||||
connectionProperties: ConnectionProviderProperties,
|
connectionProperties: ConnectionProviderProperties,
|
||||||
callback: IConnectionComponentCallbacks,
|
callback: IConnectionComponentCallbacks,
|
||||||
providerName: string,
|
providerName: string,
|
||||||
authTypeChanged: boolean = false,
|
|
||||||
@IInstantiationService _instantiationService: IInstantiationService) {
|
@IInstantiationService _instantiationService: IInstantiationService) {
|
||||||
super(connectionManagementService, connectionProperties, callback, providerName, _instantiationService);
|
super(connectionManagementService, connectionProperties, callback, providerName, _instantiationService);
|
||||||
let specialOptions = this._providerOptions.filter(
|
let specialOptions = this._providerOptions.filter(
|
||||||
@@ -34,11 +33,11 @@ export class CmsConnectionController extends ConnectionController {
|
|||||||
serverName, authenticationType, userName, password).then(result => {
|
serverName, authenticationType, userName, password).then(result => {
|
||||||
return 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._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;
|
private _serverDescriptionInputBox: InputBox;
|
||||||
protected _authTypeMap: { [providerName: string]: AuthenticationType[] } = {
|
protected _authTypeMap: { [providerName: string]: AuthenticationType[] } = {
|
||||||
[Constants.cmsProviderName]: [AuthenticationType.SqlLogin, AuthenticationType.Integrated, AuthenticationType.AzureMFA]
|
[Constants.cmsProviderName]: [AuthenticationType.Integrated]
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(options: azdata.ConnectionOption[],
|
constructor(options: azdata.ConnectionOption[],
|
||||||
callbacks: IConnectionComponentCallbacks,
|
callbacks: IConnectionComponentCallbacks,
|
||||||
providerName: string,
|
providerName: string,
|
||||||
authTypeChanged: boolean = false,
|
|
||||||
@IThemeService _themeService: IThemeService,
|
@IThemeService _themeService: IThemeService,
|
||||||
@IContextViewService _contextViewService: IContextViewService,
|
@IContextViewService _contextViewService: IContextViewService,
|
||||||
@ILayoutService _layoutService: ILayoutService,
|
@ILayoutService _layoutService: ILayoutService,
|
||||||
@@ -54,14 +53,8 @@ export class CmsConnectionWidget extends ConnectionWidget {
|
|||||||
super(options, callbacks, providerName, _themeService, _contextViewService, _connectionManagementService, _capabilitiesService,
|
super(options, callbacks, providerName, _themeService, _contextViewService, _connectionManagementService, _capabilitiesService,
|
||||||
_clipboardService, _configurationService, _accountManagementService);
|
_clipboardService, _configurationService, _accountManagementService);
|
||||||
let authTypeOption = this._optionsMaps[ConnectionOptionSpecialType.authType];
|
let authTypeOption = this._optionsMaps[ConnectionOptionSpecialType.authType];
|
||||||
if (authTypeOption) {
|
authTypeOption.defaultValue = this.getAuthTypeDisplayName(AuthenticationType.Integrated);
|
||||||
if (OS === OperatingSystem.Windows || authTypeChanged) {
|
this._authTypeSelectBox = new SelectBox(authTypeOption.categoryValues.map(c => c.displayName), authTypeOption.defaultValue, this._contextViewService, undefined, { ariaLabel: authTypeOption.displayName });
|
||||||
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 });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected registerListeners(): void {
|
protected registerListeners(): void {
|
||||||
@@ -71,12 +64,12 @@ export class CmsConnectionWidget extends ConnectionWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fillInConnectionForm(authTypeChanged: boolean = false): void {
|
protected fillInConnectionForm(): void {
|
||||||
// Server Name
|
// Server Name
|
||||||
this.addServerNameOption();
|
this.addServerNameOption();
|
||||||
|
|
||||||
// Authentication type
|
// Authentication type
|
||||||
this.addAuthenticationTypeOption(authTypeChanged);
|
this.addAuthenticationTypeOption();
|
||||||
|
|
||||||
// Login Options
|
// Login Options
|
||||||
this.addLoginOptions();
|
this.addLoginOptions();
|
||||||
@@ -91,25 +84,16 @@ export class CmsConnectionWidget extends ConnectionWidget {
|
|||||||
this.addAdvancedOptions();
|
this.addAdvancedOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected addAuthenticationTypeOption(authTypeChanged: boolean = false): void {
|
protected addAuthenticationTypeOption(): void {
|
||||||
super.addAuthenticationTypeOption(authTypeChanged);
|
super.addAuthenticationTypeOption();
|
||||||
let authTypeOption = this._optionsMaps[ConnectionOptionSpecialType.authType];
|
let authTypeOption = this._optionsMaps[ConnectionOptionSpecialType.authType];
|
||||||
let newAuthTypes = authTypeOption.categoryValues;
|
let newAuthTypes = authTypeOption.categoryValues;
|
||||||
// True when opening a CMS dialog to add a registered server
|
|
||||||
if (authTypeChanged) {
|
// CMS only supports Integrated Auth
|
||||||
// Registered Servers only support Integrated Auth
|
newAuthTypes = authTypeOption.categoryValues.filter((option) => option.name === AuthenticationType.Integrated);
|
||||||
newAuthTypes = authTypeOption.categoryValues.filter((option) => option.name === AuthenticationType.Integrated);
|
this._authTypeSelectBox.setOptions(newAuthTypes.map(c => c.displayName), 0);
|
||||||
this._authTypeSelectBox.setOptions(newAuthTypes.map(c => c.displayName), 0);
|
authTypeOption.defaultValue = AuthenticationType.Integrated;
|
||||||
authTypeOption.defaultValue = AuthenticationType.Integrated;
|
this._authTypeSelectBox.setOptions(authTypeOption.categoryValues.map(c => c.displayName), 1);
|
||||||
} 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private addServerDescriptionOption(): void {
|
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._container = DOM.append(container, DOM.$('div.connection-table'));
|
||||||
this._tableContainer = DOM.append(this._container, DOM.$('table.connection-table-content'));
|
this._tableContainer = DOM.append(this._container, DOM.$('table.connection-table-content'));
|
||||||
this.fillInConnectionForm(authTypeChanged);
|
this.fillInConnectionForm();
|
||||||
this.registerListeners();
|
this.registerListeners();
|
||||||
if (this._authTypeSelectBox) {
|
if (this._authTypeSelectBox) {
|
||||||
this.onAuthTypeSelected(this._authTypeSelectBox.value);
|
this.onAuthTypeSelected(this._authTypeSelectBox.value);
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
|||||||
this._connectionManagementService,
|
this._connectionManagementService,
|
||||||
this._capabilitiesService.getCapabilities(providerName).connection, {
|
this._capabilitiesService.getCapabilities(providerName).connection, {
|
||||||
onSetConnectButton: (enable: boolean) => this.handleSetConnectButtonEnable(enable)
|
onSetConnectButton: (enable: boolean) => this.handleSetConnectButtonEnable(enable)
|
||||||
}, providerName, this._inputModel ? this._inputModel.options.authTypeChanged : false);
|
}, providerName);
|
||||||
} else {
|
} else {
|
||||||
this._connectionControllerMap[providerName] =
|
this._connectionControllerMap[providerName] =
|
||||||
this._instantiationService.createInstance(ConnectionController,
|
this._instantiationService.createInstance(ConnectionController,
|
||||||
@@ -322,12 +322,8 @@ export class ConnectionDialogService implements IConnectionDialogService {
|
|||||||
this._model.providerName = this._currentProviderType;
|
this._model.providerName = this._currentProviderType;
|
||||||
|
|
||||||
this._model = new ConnectionProfile(this._capabilitiesService, this._model);
|
this._model = new ConnectionProfile(this._capabilitiesService, this._model);
|
||||||
if (this._inputModel && this._inputModel.options) {
|
this.uiController.showUiComponent(input.container);
|
||||||
this.uiController.showUiComponent(input.container,
|
|
||||||
this._inputModel.options.authTypeChanged);
|
|
||||||
} else {
|
|
||||||
this.uiController.showUiComponent(input.container);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleInitDialog() {
|
private handleInitDialog() {
|
||||||
|
|||||||
@@ -123,13 +123,13 @@ export class ConnectionWidget {
|
|||||||
this._providerName = providerName;
|
this._providerName = providerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public createConnectionWidget(container: HTMLElement, authTypeChanged: boolean = false): void {
|
public createConnectionWidget(container: HTMLElement): void {
|
||||||
this._serverGroupOptions = [this.DefaultServerGroup];
|
this._serverGroupOptions = [this.DefaultServerGroup];
|
||||||
this._serverGroupSelectBox = new SelectBox(this._serverGroupOptions.map(g => g.name), this.DefaultServerGroup.name, this._contextViewService, undefined, { ariaLabel: this._serverGroupDisplayString });
|
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._previousGroupOption = this._serverGroupSelectBox.value;
|
||||||
this._container = DOM.append(container, DOM.$('div.connection-table'));
|
this._container = DOM.append(container, DOM.$('div.connection-table'));
|
||||||
this._tableContainer = DOM.append(this._container, DOM.$('table.connection-table-content'));
|
this._tableContainer = DOM.append(this._container, DOM.$('table.connection-table-content'));
|
||||||
this.fillInConnectionForm(authTypeChanged);
|
this.fillInConnectionForm();
|
||||||
this.registerListeners();
|
this.registerListeners();
|
||||||
if (this._authTypeSelectBox) {
|
if (this._authTypeSelectBox) {
|
||||||
this.onAuthTypeSelected(this._authTypeSelectBox.value);
|
this.onAuthTypeSelected(this._authTypeSelectBox.value);
|
||||||
@@ -155,12 +155,12 @@ export class ConnectionWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fillInConnectionForm(authTypeChanged: boolean = false): void {
|
protected fillInConnectionForm(): void {
|
||||||
// Server Name
|
// Server Name
|
||||||
this.addServerNameOption();
|
this.addServerNameOption();
|
||||||
|
|
||||||
// Authentication type
|
// Authentication type
|
||||||
this.addAuthenticationTypeOption(authTypeChanged);
|
this.addAuthenticationTypeOption();
|
||||||
|
|
||||||
// Login Options
|
// Login Options
|
||||||
this.addLoginOptions();
|
this.addLoginOptions();
|
||||||
@@ -178,7 +178,7 @@ export class ConnectionWidget {
|
|||||||
this.addAdvancedOptions();
|
this.addAdvancedOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected addAuthenticationTypeOption(authTypeChanged: boolean = false): void {
|
protected addAuthenticationTypeOption(): void {
|
||||||
if (this._optionsMaps[ConnectionOptionSpecialType.authType]) {
|
if (this._optionsMaps[ConnectionOptionSpecialType.authType]) {
|
||||||
let authType = DialogHelper.appendRow(this._tableContainer, this._optionsMaps[ConnectionOptionSpecialType.authType].displayName, 'connection-label', 'connection-input');
|
let authType = DialogHelper.appendRow(this._tableContainer, this._optionsMaps[ConnectionOptionSpecialType.authType].displayName, 'connection-label', 'connection-input');
|
||||||
DialogHelper.appendInputSelectBox(authType, this._authTypeSelectBox);
|
DialogHelper.appendInputSelectBox(authType, this._authTypeSelectBox);
|
||||||
|
|||||||
Reference in New Issue
Block a user