import { Component , Injector } from '@angular/core' ; import { PagedListingComponentBase , PagedRequestDto , } from '@shared/common/paged-listing-component-base' ; import { RoleListDto , RoleServiceProxy , } from '@shared/service-proxies/service-proxies' ; import { CreateOrEditRoleModalComponent } from './create-or-edit-role-modal.component' ; import { finalize } from 'rxjs/operators' ; @ Component ( { selector : 'app-roles' , templateUrl : './roles.component.html' , styles : [ ] , } ) export class RolesComponent extends PagedListingComponentBase < RoleListDto > { advancedFiltersVisible = false ; selectedPermissions = [ ] ; constructor ( injector , private _roleService ) { super ( injector ) ; } protected fetchDataList ( request , pageNumber , finishedCallback ) { this . _roleService . getRoles ( this . selectedPermissions ) . pipe ( finalize ( finishedCallback ) ) . subscribe ( result => { this . dataList = result . items ; } ) ; } delete ( entity ) { this . _roleService . deleteRole ( entity . id ) . subscribe ( ( ) => { this . refresh ( ) ; this . notify . success ( this . l ( 'SuccessfullyDeleted' ) ) ; } ) ; } createOrEdit ( id ? ) { this . modalHelper . createStatic ( CreateOrEditRoleModalComponent , { roleId : id } , { size : 'md' , includeTabs : true } ) . subscribe ( res => { if ( res ) { this . refresh ( ) ; } } ) ; } batchDelete ( ) { this . message . warn ( 'method not implement!' ) ; } }