allow nothing is selected as initial state (#22260)

This commit is contained in:
Alan Ren
2023-03-09 08:44:35 -08:00
committed by GitHub
parent 5fc69a0445
commit ec515a3b23
4 changed files with 33 additions and 57 deletions

View File

@@ -57,6 +57,10 @@ export class UserDialog extends ObjectManagementDialogBase<ObjectManagement.User
&& (this.isNewObject || this.objectInfo.password !== this.originalObjectInfo.password)) {
errors.push(localizedConstants.InvalidPasswordError);
}
} else if (this.objectInfo.type === UserType.WithLogin) {
if (!this.objectInfo.loginName) {
errors.push(localizedConstants.LoginNotSelectedError);
}
}
return errors;
}
@@ -97,28 +101,17 @@ export class UserDialog extends ObjectManagementDialogBase<ObjectManagement.User
await this.runValidation(false);
}));
const nameContainer = this.createLabelInputContainer(localizedConstants.NameText, this.nameInput);
this.defaultSchemaDropdown = this.modelView.modelBuilder.dropDown().withProps({
ariaLabel: localizedConstants.DefaultSchemaText,
values: this.viewInfo.schemas,
value: this.objectInfo.defaultSchema,
width: DefaultInputWidth
}).component();
this.defaultSchemaDropdown = this.createDropdown(localizedConstants.DefaultSchemaText, this.viewInfo.schemas, this.objectInfo.defaultSchema);
this.defaultSchemaContainer = this.createLabelInputContainer(localizedConstants.DefaultSchemaText, this.defaultSchemaDropdown);
this.disposables.push(this.defaultSchemaDropdown.onValueChanged(() => {
this.objectInfo.defaultSchema = <string>this.defaultSchemaDropdown.value;
this.onObjectValueChange();
}));
this.typeDropdown = this.modelView.modelBuilder.dropDown().withProps({
ariaLabel: localizedConstants.UserTypeText,
// only supporting user with login for initial preview
//values: [localizedConstants.UserWithLoginText, localizedConstants.UserWithWindowsGroupLoginText, localizedConstants.ContainedUserText, localizedConstants.UserWithNoConnectAccess],
values: [localizedConstants.UserWithLoginText],
value: getUserTypeDisplayName(this.objectInfo.type),
width: DefaultInputWidth,
enabled: this.isNewObject
}).component();
// only supporting user with login for initial preview
// const userTypes = [localizedConstants.UserWithLoginText, localizedConstants.UserWithWindowsGroupLoginText, localizedConstants.ContainedUserText, localizedConstants.UserWithNoConnectAccess],
const userTypes = [localizedConstants.UserWithLoginText];
this.typeDropdown = this.createDropdown(localizedConstants.UserTypeText, userTypes, getUserTypeDisplayName(this.objectInfo.type), this.isNewObject);
this.disposables.push(this.typeDropdown.onValueChanged(async () => {
this.objectInfo.type = getUserTypeByDisplayName(<string>this.typeDropdown.value);
this.onObjectValueChange();
@@ -126,17 +119,11 @@ export class UserDialog extends ObjectManagementDialogBase<ObjectManagement.User
await this.runValidation(false);
}));
this.typeContainer = this.createLabelInputContainer(localizedConstants.UserTypeText, this.typeDropdown);
this.loginDropdown = this.modelView.modelBuilder.dropDown().withProps({
ariaLabel: localizedConstants.LoginText,
values: this.viewInfo.logins,
value: this.objectInfo.loginName,
width: DefaultInputWidth,
enabled: this.isNewObject
}).component();
this.disposables.push(this.loginDropdown.onValueChanged(() => {
this.loginDropdown = this.createDropdown(localizedConstants.LoginText, this.viewInfo.logins, this.objectInfo.loginName, this.isNewObject);
this.disposables.push(this.loginDropdown.onValueChanged(async () => {
this.objectInfo.loginName = <string>this.loginDropdown.value;
this.onObjectValueChange();
await this.runValidation(false);
}));
this.loginContainer = this.createLabelInputContainer(localizedConstants.LoginText, this.loginDropdown);
@@ -150,13 +137,7 @@ export class UserDialog extends ObjectManagementDialogBase<ObjectManagement.User
if (this.viewInfo.supportAADAuthentication) {
authTypes.push(localizedConstants.AADAuthenticationTypeDisplayText);
}
this.authTypeDropdown = this.modelView.modelBuilder.dropDown().withProps({
ariaLabel: localizedConstants.AuthTypeText,
values: authTypes,
value: getAuthenticationTypeDisplayName(this.objectInfo.authenticationType),
width: DefaultInputWidth,
enabled: this.isNewObject
}).component();
this.authTypeDropdown = this.createDropdown(localizedConstants.AuthTypeText, authTypes, getAuthenticationTypeDisplayName(this.objectInfo.authenticationType), this.isNewObject);
this.authTypeContainer = this.createLabelInputContainer(localizedConstants.AuthTypeText, this.authTypeDropdown);
this.disposables.push(this.authTypeDropdown.onValueChanged(async () => {
this.objectInfo.authenticationType = getAuthenticationTypeByDisplayName(<string>this.authTypeDropdown.value);
@@ -204,12 +185,7 @@ export class UserDialog extends ObjectManagementDialogBase<ObjectManagement.User
}
private initializeAdvancedSection(): void {
this.defaultLanguageDropdown = this.modelView.modelBuilder.dropDown().withProps({
ariaLabel: localizedConstants.DefaultLanguageText,
values: this.viewInfo.languages,
value: this.objectInfo.defaultLanguage,
width: DefaultInputWidth
}).component();
this.defaultLanguageDropdown = this.createDropdown(localizedConstants.DefaultLanguageText, this.viewInfo.languages, this.objectInfo.defaultLanguage);
this.disposables.push(this.defaultLanguageDropdown.onValueChanged(() => {
this.objectInfo.defaultLanguage = <string>this.defaultLanguageDropdown.value;
this.onObjectValueChange();