@@ -3,96 +3,96 @@ import { MatDialog } from '@angular/material';
3
3
import { finalize } from 'rxjs/operators' ;
4
4
import { appModuleAnimation } from '@shared/animations/routerTransition' ;
5
5
import {
6
- PagedListingComponentBase ,
7
- PagedRequestDto
6
+ PagedListingComponentBase ,
7
+ PagedRequestDto
8
8
} from 'shared/paged-listing-component-base' ;
9
9
import {
10
- TenantServiceProxy ,
11
- TenantDto ,
12
- PagedResultDtoOfTenantDto
10
+ TenantServiceProxy ,
11
+ TenantDto ,
12
+ PagedResultDtoOfTenantDto
13
13
} from '@shared/service-proxies/service-proxies' ;
14
14
import { CreateTenantDialogComponent } from './create-tenant/create-tenant-dialog.component' ;
15
15
import { EditTenantDialogComponent } from './edit-tenant/edit-tenant-dialog.component' ;
16
16
17
- class PagedTenantsRequestDto extends PagedRequestDto {
17
+ class PagedTenantsRequestDto extends PagedRequestDto {
18
18
keyword : string ;
19
19
isActive : boolean | null ;
20
20
}
21
21
22
22
@Component ( {
23
- templateUrl : './tenants.component.html' ,
24
- animations : [ appModuleAnimation ( ) ]
23
+ templateUrl : './tenants.component.html' ,
24
+ animations : [ appModuleAnimation ( ) ]
25
25
} )
26
26
export class TenantsComponent extends PagedListingComponentBase < TenantDto > {
27
- tenants : TenantDto [ ] = [ ] ;
27
+ tenants : TenantDto [ ] = [ ] ;
28
28
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
+ }
54
36
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 )
62
44
. pipe (
63
- finalize ( ( ) => {
64
- abp . notify . success ( this . l ( 'SuccessfullyDeleted' ) ) ;
65
- this . refresh ( ) ;
66
- } )
45
+ finalize ( ( ) => {
46
+ finishedCallback ( ) ;
47
+ } )
67
48
)
68
- . subscribe ( ( ) => { } ) ;
69
- }
70
- }
71
- ) ;
72
- }
49
+ . subscribe ( ( result : PagedResultDtoOfTenantDto ) => {
50
+ this . tenants = result . items ;
51
+ this . showPaging ( result , pageNumber ) ;
52
+ } ) ;
53
+ }
73
54
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
+ }
77
73
78
- editTenant ( tenant : TenantDto ) : void {
79
- this . showCreateOrEditTenantDialog ( tenant . id ) ;
80
- }
74
+ createTenant ( ) : void {
75
+ this . showCreateOrEditTenantDialog ( ) ;
76
+ }
81
77
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 ) ;
90
80
}
91
81
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
+ }
98
98
}
0 commit comments