@@ -3,96 +3,96 @@ import { MatDialog } from '@angular/material';
33import { finalize } from 'rxjs/operators' ;
44import { appModuleAnimation } from '@shared/animations/routerTransition' ;
55import {
6- PagedListingComponentBase ,
7- PagedRequestDto
6+ PagedListingComponentBase ,
7+ PagedRequestDto
88} from 'shared/paged-listing-component-base' ;
99import {
10- TenantServiceProxy ,
11- TenantDto ,
12- PagedResultDtoOfTenantDto
10+ TenantServiceProxy ,
11+ TenantDto ,
12+ PagedResultDtoOfTenantDto
1313} from '@shared/service-proxies/service-proxies' ;
1414import { CreateTenantDialogComponent } from './create-tenant/create-tenant-dialog.component' ;
1515import { EditTenantDialogComponent } from './edit-tenant/edit-tenant-dialog.component' ;
1616
17- class PagedTenantsRequestDto extends PagedRequestDto {
17+ class PagedTenantsRequestDto extends PagedRequestDto {
1818 keyword : string ;
1919 isActive : boolean | null ;
2020}
2121
2222@Component ( {
23- templateUrl : './tenants.component.html' ,
24- animations : [ appModuleAnimation ( ) ]
23+ templateUrl : './tenants.component.html' ,
24+ animations : [ appModuleAnimation ( ) ]
2525} )
2626export class TenantsComponent extends PagedListingComponentBase < TenantDto > {
27- tenants : TenantDto [ ] = [ ] ;
27+ tenants : TenantDto [ ] = [ ] ;
2828
29- constructor (
30- injector : Injector ,
31- private _tenantService : TenantServiceProxy ,
32- private _dialog : MatDialog
33- ) {
34- super ( injector ) ;
35- }
36-
37- list (
38- request : PagedRequestDto ,
39- pageNumber : number ,
40- finishedCallback : Function
41- ) : void {
42- this . _tenantService
43- . getAll ( request . skipCount , request . maxResultCount )
44- . pipe (
45- finalize ( ( ) => {
46- finishedCallback ( ) ;
47- } )
48- )
49- . subscribe ( ( result : PagedResultDtoOfTenantDto ) => {
50- this . tenants = result . items ;
51- this . showPaging ( result , pageNumber ) ;
52- } ) ;
53- }
29+ constructor (
30+ injector : Injector ,
31+ private _tenantService : TenantServiceProxy ,
32+ private _dialog : MatDialog
33+ ) {
34+ super ( injector ) ;
35+ }
5436
55- delete ( tenant : TenantDto ) : void {
56- abp . message . confirm (
57- this . l ( 'TenantDeleteWarningMessage' , tenant . name ) ,
58- ( result : boolean ) => {
59- if ( result ) {
60- this . _tenantService
61- . delete ( tenant . id )
37+ list (
38+ request : PagedTenantsRequestDto ,
39+ pageNumber : number ,
40+ finishedCallback : Function
41+ ) : void {
42+ this . _tenantService
43+ . getAll ( request . keyword , request . isActive , request . skipCount , request . maxResultCount )
6244 . pipe (
63- finalize ( ( ) => {
64- abp . notify . success ( this . l ( 'SuccessfullyDeleted' ) ) ;
65- this . refresh ( ) ;
66- } )
45+ finalize ( ( ) => {
46+ finishedCallback ( ) ;
47+ } )
6748 )
68- . subscribe ( ( ) => { } ) ;
69- }
70- }
71- ) ;
72- }
49+ . subscribe ( ( result : PagedResultDtoOfTenantDto ) => {
50+ this . tenants = result . items ;
51+ this . showPaging ( result , pageNumber ) ;
52+ } ) ;
53+ }
7354
74- createTenant ( ) : void {
75- this . showCreateOrEditTenantDialog ( ) ;
76- }
55+ delete ( tenant : TenantDto ) : void {
56+ abp . message . confirm (
57+ this . l ( 'TenantDeleteWarningMessage' , tenant . name ) ,
58+ ( result : boolean ) => {
59+ if ( result ) {
60+ this . _tenantService
61+ . delete ( tenant . id )
62+ . pipe (
63+ finalize ( ( ) => {
64+ abp . notify . success ( this . l ( 'SuccessfullyDeleted' ) ) ;
65+ this . refresh ( ) ;
66+ } )
67+ )
68+ . subscribe ( ( ) => { } ) ;
69+ }
70+ }
71+ ) ;
72+ }
7773
78- editTenant ( tenant : TenantDto ) : void {
79- this . showCreateOrEditTenantDialog ( tenant . id ) ;
80- }
74+ createTenant ( ) : void {
75+ this . showCreateOrEditTenantDialog ( ) ;
76+ }
8177
82- showCreateOrEditTenantDialog ( id ?: number ) : void {
83- let createOrEditTenantDialog ;
84- if ( id === undefined || id <= 0 ) {
85- createOrEditTenantDialog = this . _dialog . open ( CreateTenantDialogComponent ) ;
86- } else {
87- createOrEditTenantDialog = this . _dialog . open ( EditTenantDialogComponent , {
88- data : id
89- } ) ;
78+ editTenant ( tenant : TenantDto ) : void {
79+ this . showCreateOrEditTenantDialog ( tenant . id ) ;
9080 }
9181
92- createOrEditTenantDialog . afterClosed ( ) . subscribe ( result => {
93- if ( result ) {
94- this . refresh ( ) ;
95- }
96- } ) ;
97- }
82+ showCreateOrEditTenantDialog ( id ?: number ) : void {
83+ let createOrEditTenantDialog ;
84+ if ( id === undefined || id <= 0 ) {
85+ createOrEditTenantDialog = this . _dialog . open ( CreateTenantDialogComponent ) ;
86+ } else {
87+ createOrEditTenantDialog = this . _dialog . open ( EditTenantDialogComponent , {
88+ data : id
89+ } ) ;
90+ }
91+
92+ createOrEditTenantDialog . afterClosed ( ) . subscribe ( result => {
93+ if ( result ) {
94+ this . refresh ( ) ;
95+ }
96+ } ) ;
97+ }
9898}
0 commit comments