|
|
@ -1,8 +1,13 @@ |
|
|
import { ListService, PagedAndSortedResultRequestDto } from '@abp/ng.core'; |
|
|
import { ListService, PagedAndSortedResultRequestDto } from '@abp/ng.core'; |
|
|
import { ePermissionManagementComponents } from '@abp/ng.permission-management'; |
|
|
import { ePermissionManagementComponents } from '@abp/ng.permission-management'; |
|
|
import { Confirmation, ConfirmationService } from '@abp/ng.theme.shared'; |
|
|
import { Confirmation, ConfirmationService } from '@abp/ng.theme.shared'; |
|
|
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'; |
|
|
import { |
|
|
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; |
|
|
EXTENSIONS_IDENTIFIER, |
|
|
|
|
|
FormPropData, |
|
|
|
|
|
generateFormFromProps, |
|
|
|
|
|
} from '@abp/ng.theme.shared/extensions'; |
|
|
|
|
|
import { Component, ElementRef, Injector, OnInit, ViewChild } from '@angular/core'; |
|
|
|
|
|
import { FormGroup } from '@angular/forms'; |
|
|
import { Select, Store } from '@ngxs/store'; |
|
|
import { Select, Store } from '@ngxs/store'; |
|
|
import { Observable } from 'rxjs'; |
|
|
import { Observable } from 'rxjs'; |
|
|
import { finalize, pluck } from 'rxjs/operators'; |
|
|
import { finalize, pluck } from 'rxjs/operators'; |
|
|
@ -13,13 +18,20 @@ import { |
|
|
GetRoles, |
|
|
GetRoles, |
|
|
UpdateRole, |
|
|
UpdateRole, |
|
|
} from '../../actions/identity.actions'; |
|
|
} from '../../actions/identity.actions'; |
|
|
|
|
|
import { eIdentityComponents } from '../../enums/components'; |
|
|
import { IdentityRoleDto } from '../../proxy/identity/models'; |
|
|
import { IdentityRoleDto } from '../../proxy/identity/models'; |
|
|
import { IdentityState } from '../../states/identity.state'; |
|
|
import { IdentityState } from '../../states/identity.state'; |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
selector: 'abp-roles', |
|
|
selector: 'abp-roles', |
|
|
templateUrl: './roles.component.html', |
|
|
templateUrl: './roles.component.html', |
|
|
providers: [ListService], |
|
|
providers: [ |
|
|
|
|
|
ListService, |
|
|
|
|
|
{ |
|
|
|
|
|
provide: EXTENSIONS_IDENTIFIER, |
|
|
|
|
|
useValue: eIdentityComponents.Roles, |
|
|
|
|
|
}, |
|
|
|
|
|
], |
|
|
}) |
|
|
}) |
|
|
export class RolesComponent implements OnInit { |
|
|
export class RolesComponent implements OnInit { |
|
|
@Select(IdentityState.getRoles) |
|
|
@Select(IdentityState.getRoles) |
|
|
@ -51,9 +63,9 @@ export class RolesComponent implements OnInit { |
|
|
|
|
|
|
|
|
constructor( |
|
|
constructor( |
|
|
public readonly list: ListService<PagedAndSortedResultRequestDto>, |
|
|
public readonly list: ListService<PagedAndSortedResultRequestDto>, |
|
|
private confirmationService: ConfirmationService, |
|
|
protected confirmationService: ConfirmationService, |
|
|
private fb: FormBuilder, |
|
|
protected store: Store, |
|
|
private store: Store, |
|
|
protected injector: Injector, |
|
|
) {} |
|
|
) {} |
|
|
|
|
|
|
|
|
ngOnInit() { |
|
|
ngOnInit() { |
|
|
@ -61,14 +73,8 @@ export class RolesComponent implements OnInit { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
buildForm() { |
|
|
buildForm() { |
|
|
this.form = this.fb.group({ |
|
|
const data = new FormPropData(this.injector, this.selected); |
|
|
name: new FormControl({ value: this.selected.name || '', disabled: this.selected.isStatic }, [ |
|
|
this.form = generateFormFromProps(data); |
|
|
Validators.required, |
|
|
|
|
|
Validators.maxLength(256), |
|
|
|
|
|
]), |
|
|
|
|
|
isDefault: [this.selected.isDefault || false], |
|
|
|
|
|
isPublic: [this.selected.isPublic || false], |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
openModal() { |
|
|
openModal() { |
|
|
|