Skip to content

Commit 6c71d46

Browse files
2 parents f703fbd + d0e5415 commit 6c71d46

File tree

13 files changed

+465
-462
lines changed

13 files changed

+465
-462
lines changed

angular/src/app/roles/roles.component.ts

Lines changed: 73 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -3,91 +3,95 @@ import { MatDialog } from '@angular/material';
33
import { finalize } from 'rxjs/operators';
44
import { appModuleAnimation } from '@shared/animations/routerTransition';
55
import {
6-
PagedListingComponentBase,
7-
PagedRequestDto
6+
PagedListingComponentBase,
7+
PagedRequestDto
88
} from '@shared/paged-listing-component-base';
99
import {
10-
RoleServiceProxy,
11-
RoleDto,
12-
PagedResultDtoOfRoleDto
10+
RoleServiceProxy,
11+
RoleDto,
12+
PagedResultDtoOfRoleDto
1313
} from '@shared/service-proxies/service-proxies';
1414
import { CreateRoleDialogComponent } from './create-role/create-role-dialog.component';
1515
import { EditRoleDialogComponent } from './edit-role/edit-role-dialog.component';
1616

17+
class PagedRolesRequestDto extends PagedRequestDto {
18+
keyword: string;
19+
}
20+
1721
@Component({
18-
templateUrl: './roles.component.html',
19-
animations: [appModuleAnimation()]
22+
templateUrl: './roles.component.html',
23+
animations: [appModuleAnimation()]
2024
})
2125
export class RolesComponent extends PagedListingComponentBase<RoleDto> {
22-
roles: RoleDto[] = [];
26+
roles: RoleDto[] = [];
2327

24-
constructor(
25-
injector: Injector,
26-
private _rolesService: RoleServiceProxy,
27-
private _dialog: MatDialog
28-
) {
29-
super(injector);
30-
}
31-
32-
list(
33-
request: PagedRequestDto,
34-
pageNumber: number,
35-
finishedCallback: Function
36-
): void {
37-
this._rolesService
38-
.getAll(request.skipCount, request.maxResultCount)
39-
.pipe(
40-
finalize(() => {
41-
finishedCallback();
42-
})
43-
)
44-
.subscribe((result: PagedResultDtoOfRoleDto) => {
45-
this.roles = result.items;
46-
this.showPaging(result, pageNumber);
47-
});
48-
}
28+
constructor(
29+
injector: Injector,
30+
private _rolesService: RoleServiceProxy,
31+
private _dialog: MatDialog
32+
) {
33+
super(injector);
34+
}
4935

50-
delete(role: RoleDto): void {
51-
abp.message.confirm(
52-
this.l('RoleDeleteWarningMessage', role.displayName),
53-
(result: boolean) => {
54-
if (result) {
55-
this._rolesService
56-
.delete(role.id)
36+
list(
37+
request: PagedRolesRequestDto,
38+
pageNumber: number,
39+
finishedCallback: Function
40+
): void {
41+
this._rolesService
42+
.getAll(request.keyword, request.skipCount, request.maxResultCount)
5743
.pipe(
58-
finalize(() => {
59-
abp.notify.success(this.l('SuccessfullyDeleted'));
60-
this.refresh();
61-
})
44+
finalize(() => {
45+
finishedCallback();
46+
})
6247
)
63-
.subscribe(() => { });
64-
}
65-
}
66-
);
67-
}
48+
.subscribe((result: PagedResultDtoOfRoleDto) => {
49+
this.roles = result.items;
50+
this.showPaging(result, pageNumber);
51+
});
52+
}
6853

69-
createRole(): void {
70-
this.showCreateOrEditRoleDialog();
71-
}
54+
delete(role: RoleDto): void {
55+
abp.message.confirm(
56+
this.l('RoleDeleteWarningMessage', role.displayName),
57+
(result: boolean) => {
58+
if (result) {
59+
this._rolesService
60+
.delete(role.id)
61+
.pipe(
62+
finalize(() => {
63+
abp.notify.success(this.l('SuccessfullyDeleted'));
64+
this.refresh();
65+
})
66+
)
67+
.subscribe(() => { });
68+
}
69+
}
70+
);
71+
}
7272

73-
editRole(role: RoleDto): void {
74-
this.showCreateOrEditRoleDialog(role.id);
75-
}
73+
createRole(): void {
74+
this.showCreateOrEditRoleDialog();
75+
}
7676

77-
showCreateOrEditRoleDialog(id?: number): void {
78-
let createOrEditRoleDialog;
79-
if (id === undefined || id <= 0) {
80-
createOrEditRoleDialog = this._dialog.open(CreateRoleDialogComponent);
81-
} else {
82-
createOrEditRoleDialog = this._dialog.open(EditRoleDialogComponent, {
83-
data: id
84-
});
77+
editRole(role: RoleDto): void {
78+
this.showCreateOrEditRoleDialog(role.id);
8579
}
8680

87-
createOrEditRoleDialog.afterClosed().subscribe(result => {
88-
if (result) {
89-
this.refresh();
90-
}
91-
});
92-
}
81+
showCreateOrEditRoleDialog(id?: number): void {
82+
let createOrEditRoleDialog;
83+
if (id === undefined || id <= 0) {
84+
createOrEditRoleDialog = this._dialog.open(CreateRoleDialogComponent);
85+
} else {
86+
createOrEditRoleDialog = this._dialog.open(EditRoleDialogComponent, {
87+
data: id
88+
});
89+
}
90+
91+
createOrEditRoleDialog.afterClosed().subscribe(result => {
92+
if (result) {
93+
this.refresh();
94+
}
95+
});
96+
}
9397
}

angular/src/app/tenants/tenants.component.ts

Lines changed: 74 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -3,91 +3,96 @@ import { MatDialog } from '@angular/material';
33
import { finalize } from 'rxjs/operators';
44
import { appModuleAnimation } from '@shared/animations/routerTransition';
55
import {
6-
PagedListingComponentBase,
7-
PagedRequestDto
6+
PagedListingComponentBase,
7+
PagedRequestDto
88
} from 'shared/paged-listing-component-base';
99
import {
10-
TenantServiceProxy,
11-
TenantDto,
12-
PagedResultDtoOfTenantDto
10+
TenantServiceProxy,
11+
TenantDto,
12+
PagedResultDtoOfTenantDto
1313
} from '@shared/service-proxies/service-proxies';
1414
import { CreateTenantDialogComponent } from './create-tenant/create-tenant-dialog.component';
1515
import { EditTenantDialogComponent } from './edit-tenant/edit-tenant-dialog.component';
1616

17+
class PagedTenantsRequestDto extends PagedRequestDto {
18+
keyword: string;
19+
isActive: boolean | null;
20+
}
21+
1722
@Component({
18-
templateUrl: './tenants.component.html',
19-
animations: [appModuleAnimation()]
23+
templateUrl: './tenants.component.html',
24+
animations: [appModuleAnimation()]
2025
})
2126
export class TenantsComponent extends PagedListingComponentBase<TenantDto> {
22-
tenants: TenantDto[] = [];
27+
tenants: TenantDto[] = [];
2328

24-
constructor(
25-
injector: Injector,
26-
private _tenantService: TenantServiceProxy,
27-
private _dialog: MatDialog
28-
) {
29-
super(injector);
30-
}
31-
32-
list(
33-
request: PagedRequestDto,
34-
pageNumber: number,
35-
finishedCallback: Function
36-
): void {
37-
this._tenantService
38-
.getAll(request.skipCount, request.maxResultCount)
39-
.pipe(
40-
finalize(() => {
41-
finishedCallback();
42-
})
43-
)
44-
.subscribe((result: PagedResultDtoOfTenantDto) => {
45-
this.tenants = result.items;
46-
this.showPaging(result, pageNumber);
47-
});
48-
}
29+
constructor(
30+
injector: Injector,
31+
private _tenantService: TenantServiceProxy,
32+
private _dialog: MatDialog
33+
) {
34+
super(injector);
35+
}
4936

50-
delete(tenant: TenantDto): void {
51-
abp.message.confirm(
52-
this.l('TenantDeleteWarningMessage', tenant.name),
53-
(result: boolean) => {
54-
if (result) {
55-
this._tenantService
56-
.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)
5744
.pipe(
58-
finalize(() => {
59-
abp.notify.success(this.l('SuccessfullyDeleted'));
60-
this.refresh();
61-
})
45+
finalize(() => {
46+
finishedCallback();
47+
})
6248
)
63-
.subscribe(() => {});
64-
}
65-
}
66-
);
67-
}
49+
.subscribe((result: PagedResultDtoOfTenantDto) => {
50+
this.tenants = result.items;
51+
this.showPaging(result, pageNumber);
52+
});
53+
}
6854

69-
createTenant(): void {
70-
this.showCreateOrEditTenantDialog();
71-
}
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+
}
7273

73-
editTenant(tenant: TenantDto): void {
74-
this.showCreateOrEditTenantDialog(tenant.id);
75-
}
74+
createTenant(): void {
75+
this.showCreateOrEditTenantDialog();
76+
}
7677

77-
showCreateOrEditTenantDialog(id?: number): void {
78-
let createOrEditTenantDialog;
79-
if (id === undefined || id <= 0) {
80-
createOrEditTenantDialog = this._dialog.open(CreateTenantDialogComponent);
81-
} else {
82-
createOrEditTenantDialog = this._dialog.open(EditTenantDialogComponent, {
83-
data: id
84-
});
78+
editTenant(tenant: TenantDto): void {
79+
this.showCreateOrEditTenantDialog(tenant.id);
8580
}
8681

87-
createOrEditTenantDialog.afterClosed().subscribe(result => {
88-
if (result) {
89-
this.refresh();
90-
}
91-
});
92-
}
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+
}
9398
}

0 commit comments

Comments
 (0)