|
|
@ -1,5 +1,5 @@ |
|
|
import { ABP, ConfigState } from '@abp/ng.core'; |
|
|
import { ABP, ConfigState } from '@abp/ng.core'; |
|
|
import { ConfirmationService, Toaster } from '@abp/ng.theme.shared'; |
|
|
import { ConfirmationService, Confirmation } from '@abp/ng.theme.shared'; |
|
|
import { Component, OnInit, TemplateRef, TrackByFunction, ViewChild } from '@angular/core'; |
|
|
import { Component, OnInit, TemplateRef, TrackByFunction, ViewChild } from '@angular/core'; |
|
|
import { |
|
|
import { |
|
|
AbstractControl, |
|
|
AbstractControl, |
|
|
@ -17,7 +17,6 @@ import snq from 'snq'; |
|
|
import { |
|
|
import { |
|
|
CreateUser, |
|
|
CreateUser, |
|
|
DeleteUser, |
|
|
DeleteUser, |
|
|
GetRoles, |
|
|
|
|
|
GetUserById, |
|
|
GetUserById, |
|
|
GetUserRoles, |
|
|
GetUserRoles, |
|
|
GetUsers, |
|
|
GetUsers, |
|
|
@ -25,6 +24,7 @@ import { |
|
|
} from '../../actions/identity.actions'; |
|
|
} from '../../actions/identity.actions'; |
|
|
import { Identity } from '../../models/identity'; |
|
|
import { Identity } from '../../models/identity'; |
|
|
import { IdentityState } from '../../states/identity.state'; |
|
|
import { IdentityState } from '../../states/identity.state'; |
|
|
|
|
|
import { IdentityService } from '../../services/identity.service'; |
|
|
@Component({ |
|
|
@Component({ |
|
|
selector: 'abp-users', |
|
|
selector: 'abp-users', |
|
|
templateUrl: './users.component.html', |
|
|
templateUrl: './users.component.html', |
|
|
@ -81,6 +81,7 @@ export class UsersComponent implements OnInit { |
|
|
private confirmationService: ConfirmationService, |
|
|
private confirmationService: ConfirmationService, |
|
|
private fb: FormBuilder, |
|
|
private fb: FormBuilder, |
|
|
private store: Store, |
|
|
private store: Store, |
|
|
|
|
|
private identityService: IdentityService, |
|
|
) {} |
|
|
) {} |
|
|
|
|
|
|
|
|
ngOnInit() { |
|
|
ngOnInit() { |
|
|
@ -119,8 +120,8 @@ export class UsersComponent implements OnInit { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
buildForm() { |
|
|
buildForm() { |
|
|
this.store.dispatch(new GetRoles({ maxResultCount: 1000, skipCount: 0 })).subscribe(() => { |
|
|
this.identityService.getAllRoles().subscribe(({ items }) => { |
|
|
this.roles = this.store.selectSnapshot(IdentityState.getRoles); |
|
|
this.roles = items; |
|
|
this.form = this.fb.group({ |
|
|
this.form = this.fb.group({ |
|
|
userName: [this.selected.userName || '', [Validators.required, Validators.maxLength(256)]], |
|
|
userName: [this.selected.userName || '', [Validators.required, Validators.maxLength(256)]], |
|
|
email: [ |
|
|
email: [ |
|
|
@ -223,8 +224,8 @@ export class UsersComponent implements OnInit { |
|
|
.warn('AbpIdentity::UserDeletionConfirmationMessage', 'AbpIdentity::AreYouSure', { |
|
|
.warn('AbpIdentity::UserDeletionConfirmationMessage', 'AbpIdentity::AreYouSure', { |
|
|
messageLocalizationParams: [userName], |
|
|
messageLocalizationParams: [userName], |
|
|
}) |
|
|
}) |
|
|
.subscribe((status: Toaster.Status) => { |
|
|
.subscribe((status: Confirmation.Status) => { |
|
|
if (status === Toaster.Status.confirm) { |
|
|
if (status === Confirmation.Status.confirm) { |
|
|
this.store.dispatch(new DeleteUser(id)).subscribe(() => this.get()); |
|
|
this.store.dispatch(new DeleteUser(id)).subscribe(() => this.get()); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|