mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 09:35:37 -05:00
Move focus to inside sql database projects dialogs when they open (#13512)
This commit is contained in:
@@ -39,6 +39,8 @@ export class AddDatabaseReferenceDialog {
|
||||
public serverVariableTextbox: azdata.InputBoxComponent | undefined;
|
||||
public suppressMissingDependenciesErrorsCheckbox: azdata.CheckBoxComponent | undefined;
|
||||
public exampleUsage: azdata.TextComponent | undefined;
|
||||
private projectRadioButton: azdata.RadioButtonComponent | undefined;
|
||||
private systemDatabaseRadioButton: azdata.RadioButtonComponent | undefined;
|
||||
|
||||
public currentReferenceType: ReferenceType | undefined;
|
||||
|
||||
@@ -114,6 +116,12 @@ export class AddDatabaseReferenceDialog {
|
||||
await view.initializeModel(formModel);
|
||||
this.updateEnabledInputBoxes();
|
||||
|
||||
if (this.currentReferenceType === ReferenceType.project) {
|
||||
this.projectRadioButton?.focus();
|
||||
} else {
|
||||
this.systemDatabaseRadioButton?.focus();
|
||||
}
|
||||
|
||||
this.initDialogComplete?.resolve();
|
||||
});
|
||||
}
|
||||
@@ -155,23 +163,23 @@ export class AddDatabaseReferenceDialog {
|
||||
}
|
||||
|
||||
private createRadioButtons(): azdata.FormComponent {
|
||||
const projectRadioButton = this.view!.modelBuilder.radioButton()
|
||||
this.projectRadioButton = this.view!.modelBuilder.radioButton()
|
||||
.withProperties({
|
||||
name: 'referenceType',
|
||||
label: constants.projectRadioButtonTitle
|
||||
}).component();
|
||||
|
||||
projectRadioButton.onDidClick(() => {
|
||||
this.projectRadioButton.onDidClick(() => {
|
||||
this.projectRadioButtonClick();
|
||||
});
|
||||
|
||||
const systemDatabaseRadioButton = this.view!.modelBuilder.radioButton()
|
||||
this.systemDatabaseRadioButton = this.view!.modelBuilder.radioButton()
|
||||
.withProperties({
|
||||
name: 'referenceType',
|
||||
label: constants.systemDatabaseRadioButtonTitle
|
||||
}).component();
|
||||
|
||||
systemDatabaseRadioButton.onDidClick(() => {
|
||||
this.systemDatabaseRadioButton.onDidClick(() => {
|
||||
this.systemDbRadioButtonClick();
|
||||
});
|
||||
|
||||
@@ -186,19 +194,19 @@ export class AddDatabaseReferenceDialog {
|
||||
});
|
||||
|
||||
if (this.projectDropdown?.values?.length) {
|
||||
projectRadioButton.checked = true;
|
||||
this.projectRadioButton.checked = true;
|
||||
this.currentReferenceType = ReferenceType.project;
|
||||
} else {
|
||||
systemDatabaseRadioButton.checked = true;
|
||||
this.systemDatabaseRadioButton.checked = true;
|
||||
this.currentReferenceType = ReferenceType.systemDb;
|
||||
|
||||
// disable projects radio button if there aren't any projects that can be added as a reference
|
||||
projectRadioButton.enabled = false;
|
||||
this.projectRadioButton.enabled = false;
|
||||
}
|
||||
|
||||
let flexRadioButtonsModel: azdata.FlexContainer = this.view!.modelBuilder.flexContainer()
|
||||
.withLayout({ flexFlow: 'column' })
|
||||
.withItems([projectRadioButton, systemDatabaseRadioButton, dacpacRadioButton])
|
||||
.withItems([this.projectRadioButton, this.systemDatabaseRadioButton, dacpacRadioButton])
|
||||
.withProperties({ ariaRole: 'radiogroup' })
|
||||
.component();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user