-
Notifications
You must be signed in to change notification settings - Fork 272
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add user email prefix to the console user create (#2623)
- Loading branch information
Showing
11 changed files
with
224 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<form (ngSubmit)="saveEdit($event)" #form> | ||
<p *ngIf="isNew()"> | ||
<mat-form-field appearance="outline"> | ||
<mat-label | ||
>User name prefix: | ||
<mat-icon | ||
matTooltip="Prefix will be combined with registrar ID to create a unique user name - {prefix}.{registrarId}@registry.google" | ||
>help_outline</mat-icon | ||
></mat-label | ||
> | ||
<input | ||
matInput | ||
minlength="3" | ||
maxlength="3" | ||
[required]="true" | ||
[(ngModel)]="user().emailAddress" | ||
[ngModelOptions]="{ standalone: true }" | ||
/> | ||
</mat-form-field> | ||
</p> | ||
<p> | ||
<mat-form-field appearance="outline"> | ||
<mat-label | ||
>User Role: | ||
<mat-icon | ||
matTooltip="Viewer role doesn't allow making updates; Editor role allows updates, like Contacts delete or SSL certificate change" | ||
>help_outline</mat-icon | ||
></mat-label | ||
> | ||
<mat-select [(ngModel)]="user().role" name="userRole"> | ||
<mat-option value="PRIMARY_CONTACT">Editor</mat-option> | ||
<mat-option value="ACCOUNT_MANAGER">Viewer</mat-option> | ||
</mat-select> | ||
</mat-form-field> | ||
</p> | ||
<button mat-flat-button color="primary" aria-label="Save user" type="submit"> | ||
Save | ||
</button> | ||
</form> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// Copyright 2024 The Nomulus Authors. All Rights Reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
import { CommonModule } from '@angular/common'; | ||
import { | ||
Component, | ||
ElementRef, | ||
EventEmitter, | ||
input, | ||
Output, | ||
ViewChild, | ||
} from '@angular/core'; | ||
import { MaterialModule } from '../material.module'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { User } from './users.service'; | ||
|
||
@Component({ | ||
selector: 'app-user-edit-form', | ||
templateUrl: './userEditForm.component.html', | ||
styleUrls: ['./userEditForm.component.scss'], | ||
standalone: true, | ||
imports: [FormsModule, MaterialModule, CommonModule], | ||
providers: [], | ||
}) | ||
export class UserEditFormComponent { | ||
@ViewChild('form') form!: ElementRef; | ||
isNew = input<boolean>(false); | ||
user = input<User>( | ||
{ | ||
emailAddress: '', | ||
role: 'ACCOUNT_MANAGER', | ||
}, | ||
// @ts-ignore - legit option, typescript fails to match it to a proper type | ||
{ transform: (user: User) => structuredClone(user) } | ||
); | ||
|
||
@Output() onEditComplete = new EventEmitter<User>(); | ||
|
||
saveEdit(e: SubmitEvent) { | ||
e.preventDefault(); | ||
if (this.form.nativeElement.checkValidity()) { | ||
this.onEditComplete.emit(this.user()); | ||
} else { | ||
this.form.nativeElement.reportValidity(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.