mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -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 serverVariableTextbox: azdata.InputBoxComponent | undefined;
|
||||||
public suppressMissingDependenciesErrorsCheckbox: azdata.CheckBoxComponent | undefined;
|
public suppressMissingDependenciesErrorsCheckbox: azdata.CheckBoxComponent | undefined;
|
||||||
public exampleUsage: azdata.TextComponent | undefined;
|
public exampleUsage: azdata.TextComponent | undefined;
|
||||||
|
private projectRadioButton: azdata.RadioButtonComponent | undefined;
|
||||||
|
private systemDatabaseRadioButton: azdata.RadioButtonComponent | undefined;
|
||||||
|
|
||||||
public currentReferenceType: ReferenceType | undefined;
|
public currentReferenceType: ReferenceType | undefined;
|
||||||
|
|
||||||
@@ -114,6 +116,12 @@ export class AddDatabaseReferenceDialog {
|
|||||||
await view.initializeModel(formModel);
|
await view.initializeModel(formModel);
|
||||||
this.updateEnabledInputBoxes();
|
this.updateEnabledInputBoxes();
|
||||||
|
|
||||||
|
if (this.currentReferenceType === ReferenceType.project) {
|
||||||
|
this.projectRadioButton?.focus();
|
||||||
|
} else {
|
||||||
|
this.systemDatabaseRadioButton?.focus();
|
||||||
|
}
|
||||||
|
|
||||||
this.initDialogComplete?.resolve();
|
this.initDialogComplete?.resolve();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -155,23 +163,23 @@ export class AddDatabaseReferenceDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private createRadioButtons(): azdata.FormComponent {
|
private createRadioButtons(): azdata.FormComponent {
|
||||||
const projectRadioButton = this.view!.modelBuilder.radioButton()
|
this.projectRadioButton = this.view!.modelBuilder.radioButton()
|
||||||
.withProperties({
|
.withProperties({
|
||||||
name: 'referenceType',
|
name: 'referenceType',
|
||||||
label: constants.projectRadioButtonTitle
|
label: constants.projectRadioButtonTitle
|
||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
projectRadioButton.onDidClick(() => {
|
this.projectRadioButton.onDidClick(() => {
|
||||||
this.projectRadioButtonClick();
|
this.projectRadioButtonClick();
|
||||||
});
|
});
|
||||||
|
|
||||||
const systemDatabaseRadioButton = this.view!.modelBuilder.radioButton()
|
this.systemDatabaseRadioButton = this.view!.modelBuilder.radioButton()
|
||||||
.withProperties({
|
.withProperties({
|
||||||
name: 'referenceType',
|
name: 'referenceType',
|
||||||
label: constants.systemDatabaseRadioButtonTitle
|
label: constants.systemDatabaseRadioButtonTitle
|
||||||
}).component();
|
}).component();
|
||||||
|
|
||||||
systemDatabaseRadioButton.onDidClick(() => {
|
this.systemDatabaseRadioButton.onDidClick(() => {
|
||||||
this.systemDbRadioButtonClick();
|
this.systemDbRadioButtonClick();
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -186,19 +194,19 @@ export class AddDatabaseReferenceDialog {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (this.projectDropdown?.values?.length) {
|
if (this.projectDropdown?.values?.length) {
|
||||||
projectRadioButton.checked = true;
|
this.projectRadioButton.checked = true;
|
||||||
this.currentReferenceType = ReferenceType.project;
|
this.currentReferenceType = ReferenceType.project;
|
||||||
} else {
|
} else {
|
||||||
systemDatabaseRadioButton.checked = true;
|
this.systemDatabaseRadioButton.checked = true;
|
||||||
this.currentReferenceType = ReferenceType.systemDb;
|
this.currentReferenceType = ReferenceType.systemDb;
|
||||||
|
|
||||||
// disable projects radio button if there aren't any projects that can be added as a reference
|
// 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()
|
let flexRadioButtonsModel: azdata.FlexContainer = this.view!.modelBuilder.flexContainer()
|
||||||
.withLayout({ flexFlow: 'column' })
|
.withLayout({ flexFlow: 'column' })
|
||||||
.withItems([projectRadioButton, systemDatabaseRadioButton, dacpacRadioButton])
|
.withItems([this.projectRadioButton, this.systemDatabaseRadioButton, dacpacRadioButton])
|
||||||
.withProperties({ ariaRole: 'radiogroup' })
|
.withProperties({ ariaRole: 'radiogroup' })
|
||||||
.component();
|
.component();
|
||||||
|
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ export class CreateProjectFromDatabaseDialog {
|
|||||||
|
|
||||||
let formModel = this.formBuilder.component();
|
let formModel = this.formBuilder.component();
|
||||||
await view.initializeModel(formModel);
|
await view.initializeModel(formModel);
|
||||||
|
this.selectConnectionButton?.focus();
|
||||||
this.initDialogComplete?.resolve();
|
this.initDialogComplete?.resolve();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,6 +142,8 @@ export class PublishDatabaseDialog {
|
|||||||
|
|
||||||
let formModel = this.formBuilder.component();
|
let formModel = this.formBuilder.component();
|
||||||
await view.initializeModel(formModel);
|
await view.initializeModel(formModel);
|
||||||
|
|
||||||
|
this.loadProfileTextBox!.focus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user