1
0
mirror of https://github.com/google/nomulus synced 2026-07-20 23:12:40 +00:00

Add delete user to the console (#2603)

* Add delete user to the console

* Add delete user to the console

* Add delete user to the console
This commit is contained in:
Pavlo Tkach
2024-11-08 13:20:01 -05:00
committed by GitHub
parent ae61cd443d
commit 35f95bbbe4
14 changed files with 584 additions and 167 deletions
@@ -22,15 +22,8 @@ import { SelectedRegistrarModule } from '../app.module';
import { MaterialModule } from '../material.module';
import { RegistrarService } from '../registrar/registrar.service';
import { SnackBarModule } from '../snackbar.module';
import { User, UsersService } from './users.service';
const roleToDescription = (role: String) => {
if (!role) return 'N/A';
else if (role.toLowerCase().startsWith('account_manager')) {
return 'Viewer';
}
return 'Editor';
};
import { UserEditComponent } from './userEdit.component';
import { roleToDescription, User, UsersService } from './users.service';
export const columns = [
{
@@ -55,6 +48,7 @@ export const columns = [
SnackBarModule,
CommonModule,
SelectedRegistrarModule,
UserEditComponent,
],
providers: [UsersService],
})
@@ -92,6 +86,7 @@ export class UsersComponent {
this.usersService.fetchUsers().subscribe({
error: (err: HttpErrorResponse) => {
this._snackBar.open(err.error || err.message);
this.isLoading = false;
},
complete: () => {
this.isLoading = false;
@@ -102,21 +97,17 @@ export class UsersComponent {
createNewUser() {
this.isLoading = true;
this.usersService.createNewUser().subscribe({
next: (newUser) => {
this._snackBar.open(
`New user with email ${newUser.emailAddress} has been created.`,
'',
{
duration: 2000,
}
);
},
error: (err: HttpErrorResponse) => {
this._snackBar.open(err.error || err.message);
this.isLoading = false;
},
complete: () => {
this.isLoading = false;
},
});
}
openDetails(emailAddress: string) {
this.usersService.currentlyOpenUserEmail.set(emailAddress);
}
}