mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Use faster, editable dropdown for Collations in database dialogs (#23974)
* Also fixed an issue where a manually edited text field doesn't get updated when selecting the same dropdown value from before the manual edit. --------- Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -161,7 +161,7 @@ export const MemberSectionHeader = localize('objectManagement.membersLabel', "Me
|
||||
export const SchemaText = localize('objectManagement.schemaLabel', "Schema");
|
||||
|
||||
// Database
|
||||
export const DatabaseExistsError = (dbName: string) => localize('objectManagement.databaseExistsError', "Database '{0}' already exists. Choose a different database name.", dbName);
|
||||
export const CollationNotValidError = (collationName: string) => localize('objectManagement.collationNotValidError', "The selected collation '{0}' is not valid. Please choose a different collation.", collationName);
|
||||
export const CollationText = localize('objectManagement.collationLabel', "Collation");
|
||||
export const RecoveryModelText = localize('objectManagement.recoveryModelLabel', "Recovery Model");
|
||||
export const CompatibilityLevelText = localize('objectManagement.compatibilityLevelLabel', "Compatibility Level");
|
||||
|
||||
@@ -134,6 +134,14 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
|
||||
}
|
||||
}
|
||||
|
||||
protected override async validateInput(): Promise<string[]> {
|
||||
let errors = await super.validateInput();
|
||||
if (this.viewInfo.collationNames?.length > 0 && !this.viewInfo.collationNames.some(name => name.toLowerCase() === this.objectInfo.collationName?.toLowerCase())) {
|
||||
errors.push(localizedConstants.CollationNotValidError(this.objectInfo.collationName ?? ''));
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
|
||||
//#region Create Database
|
||||
private initializeGeneralSection(): azdata.GroupContainer {
|
||||
let containers: azdata.Component[] = [];
|
||||
@@ -167,7 +175,7 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
|
||||
this.objectInfo.collationName = this.viewInfo.collationNames[0];
|
||||
let collationDropbox = this.createDropdown(localizedConstants.CollationText, async () => {
|
||||
this.objectInfo.collationName = collationDropbox.value as string;
|
||||
}, this.viewInfo.collationNames, this.viewInfo.collationNames[0]);
|
||||
}, this.viewInfo.collationNames, this.viewInfo.collationNames[0], true, DefaultInputWidth, true, true);
|
||||
containers.push(this.createLabelInputContainer(localizedConstants.CollationText, collationDropbox));
|
||||
}
|
||||
|
||||
@@ -277,7 +285,7 @@ export class DatabaseDialog extends ObjectManagementDialogBase<Database, Databas
|
||||
// Collation
|
||||
let collationDropbox = this.createDropdown(localizedConstants.CollationText, async (newValue) => {
|
||||
this.objectInfo.collationName = newValue as string;
|
||||
}, this.viewInfo.collationNames, this.objectInfo.collationName);
|
||||
}, this.viewInfo.collationNames, this.objectInfo.collationName, true, DefaultInputWidth, true, true);
|
||||
containers.push(this.createLabelInputContainer(localizedConstants.CollationText, collationDropbox));
|
||||
|
||||
// Recovery Model
|
||||
|
||||
Reference in New Issue
Block a user