Skip to content

Commit

Permalink
Move new login dialog's advanced options into the general section
Browse files Browse the repository at this point in the history
  • Loading branch information
corivera committed Sep 29, 2023
1 parent 731dc63 commit 9449d58
Showing 1 changed file with 24 additions and 30 deletions.
54 changes: 24 additions & 30 deletions extensions/mssql/src/objectManagement/ui/loginDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export class LoginDialog extends PrincipalDialogBase<Login, LoginViewInfo> {
private generalSection: azdata.GroupContainer;
private sqlAuthSection: azdata.GroupContainer;
private serverRoleSection: azdata.GroupContainer;
private advancedSection: azdata.GroupContainer;
private nameInput: azdata.InputBoxComponent;
private authTypeDropdown: azdata.DropDownComponent;
private passwordInput: azdata.InputBoxComponent;
Expand Down Expand Up @@ -99,14 +98,11 @@ export class LoginDialog extends PrincipalDialogBase<Login, LoginViewInfo> {
sections.push(this.serverRoleSection);
sections.push(this.securableSection);

if (this.viewInfo.supportAdvancedOptions) {
this.initializeAdvancedSection();
sections.push(this.advancedSection);
}
this.formContainer.addItems(sections, this.getSectionItemLayout());
}

private initializeGeneralSection(): void {
const items: azdata.Component[] = [];
this.nameInput = this.createInputBox(async (newValue) => {
this.objectInfo.name = newValue;
}, {
Expand All @@ -115,8 +111,9 @@ export class LoginDialog extends PrincipalDialogBase<Login, LoginViewInfo> {
enabled: this.options.isNewObject,
value: this.objectInfo.name
});

const nameContainer = this.createLabelInputContainer(objectManagementLoc.NameText, this.nameInput);
items.push(nameContainer);

this.authTypeDropdown = this.createDropdown(objectManagementLoc.AuthTypeText,
async (newValue) => {
this.objectInfo.authenticationType = objectManagementLoc.getAuthenticationTypeByDisplayName(newValue);
Expand All @@ -125,13 +122,32 @@ export class LoginDialog extends PrincipalDialogBase<Login, LoginViewInfo> {
this.viewInfo.authenticationTypes.map(authType => objectManagementLoc.getAuthenticationTypeDisplayName(authType)),
objectManagementLoc.getAuthenticationTypeDisplayName(this.objectInfo.authenticationType),
this.options.isNewObject);

const authTypeContainer = this.createLabelInputContainer(objectManagementLoc.AuthTypeText, this.authTypeDropdown);
items.push(authTypeContainer);

this.enabledCheckbox = this.createCheckbox(objectManagementLoc.EnabledText, async (checked) => {
this.objectInfo.isEnabled = checked;
}, this.objectInfo.isEnabled);
this.generalSection = this.createGroup(objectManagementLoc.GeneralSectionHeader, [nameContainer, authTypeContainer, this.enabledCheckbox], false);
items.push(this.enabledCheckbox);

this.defaultDatabaseDropdown = this.createDropdown(objectManagementLoc.DefaultDatabaseText, async (newValue) => {
this.objectInfo.defaultDatabase = newValue;
}, this.viewInfo.databases, this.objectInfo.defaultDatabase);
const defaultDatabaseContainer = this.createLabelInputContainer(objectManagementLoc.DefaultDatabaseText, this.defaultDatabaseDropdown);
items.push(defaultDatabaseContainer);

this.defaultLanguageDropdown = this.createDropdown(objectManagementLoc.DefaultLanguageText, async (newValue) => {
this.objectInfo.defaultLanguage = newValue;
}, this.viewInfo.languages, this.objectInfo.defaultLanguage);
const defaultLanguageContainer = this.createLabelInputContainer(objectManagementLoc.DefaultLanguageText, this.defaultLanguageDropdown);
items.push(defaultLanguageContainer);

this.connectPermissionCheckbox = this.createCheckbox(objectManagementLoc.PermissionToConnectText, async (checked) => {
this.objectInfo.connectPermission = checked;
}, this.objectInfo.connectPermission);
items.push(this.connectPermissionCheckbox);

this.generalSection = this.createGroup(objectManagementLoc.GeneralSectionHeader, items, false);
}

private initializeSqlAuthSection(): void {
Expand Down Expand Up @@ -207,28 +223,6 @@ export class LoginDialog extends PrincipalDialogBase<Login, LoginViewInfo> {
return this.objectInfo.password !== this.originalObjectInfo.password
}

private initializeAdvancedSection(): void {
const items: azdata.Component[] = [];
if (this.viewInfo.supportAdvancedOptions) {
this.defaultDatabaseDropdown = this.createDropdown(objectManagementLoc.DefaultDatabaseText, async (newValue) => {
this.objectInfo.defaultDatabase = newValue;
}, this.viewInfo.databases, this.objectInfo.defaultDatabase);
const defaultDatabaseContainer = this.createLabelInputContainer(objectManagementLoc.DefaultDatabaseText, this.defaultDatabaseDropdown);

this.defaultLanguageDropdown = this.createDropdown(objectManagementLoc.DefaultLanguageText, async (newValue) => {
this.objectInfo.defaultLanguage = newValue;
}, this.viewInfo.languages, this.objectInfo.defaultLanguage);
const defaultLanguageContainer = this.createLabelInputContainer(objectManagementLoc.DefaultLanguageText, this.defaultLanguageDropdown);

this.connectPermissionCheckbox = this.createCheckbox(objectManagementLoc.PermissionToConnectText, async (checked) => {
this.objectInfo.connectPermission = checked;
}, this.objectInfo.connectPermission);
items.push(defaultDatabaseContainer, defaultLanguageContainer, this.connectPermissionCheckbox);
}

this.advancedSection = this.createGroup(objectManagementLoc.AdvancedSectionHeader, items, true, true);
}

private initializeServerRolesSection(): void {
this.serverRoleTable = this.createTableList(objectManagementLoc.ServerRoleSectionHeader,
[objectManagementLoc.ServerRoleTypeDisplayNameInTitle],
Expand Down

0 comments on commit 9449d58

Please sign in to comment.