Skip to content

Commit 037b32b

Browse files
committed
implements list filter for users/roles/tenants
1 parent 2f76d69 commit 037b32b

File tree

8 files changed

+117
-72
lines changed

8 files changed

+117
-72
lines changed

angular/src/app/roles/roles.component.html

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
<h2>{{ "Roles" | localize }}</h2>
66
<ul class="header-dropdown m-r--5">
77
<li>
8-
<button
9-
mat-icon-button
10-
[matMenuTriggerFor]="headerMenu"
11-
class="header-dropdown-mat-icon-button"
12-
>
8+
<button mat-icon-button [matMenuTriggerFor]="headerMenu" class="header-dropdown-mat-icon-button">
139
<mat-icon>more_vert</mat-icon>
1410
</button>
1511
<mat-menu #headerMenu="matMenu">
@@ -22,6 +18,18 @@ <h2>{{ "Roles" | localize }}</h2>
2218
</ul>
2319
</div>
2420
<div class="body table-responsive">
21+
<!--query start-->
22+
<div class="row clearfix">
23+
<form>
24+
<mat-form-field>
25+
<input matInput [placeholder]="l('Keyword')" [(ngModel)]="keyword" name="keyword">
26+
</mat-form-field>
27+
28+
<button mat-raised-button color="primary" (click)="getDataPage(1)">{{ 'Search' | localize }}</button>
29+
30+
</form>
31+
</div>
32+
<!--query end-->
2533
<table class="table table-hover table-striped" [busy]="isTableLoading">
2634
<thead>
2735
<tr>
@@ -31,8 +39,7 @@ <h2>{{ "Roles" | localize }}</h2>
3139
</tr>
3240
</thead>
3341
<tbody>
34-
<tr
35-
*ngFor="
42+
<tr *ngFor="
3643
let role of (roles
3744
| paginate
3845
: {
@@ -41,8 +48,7 @@ <h2>{{ "Roles" | localize }}</h2>
4148
currentPage: pageNumber,
4249
totalItems: totalItems
4350
})
44-
"
45-
>
51+
">
4652
<td>{{ role.name }}</td>
4753
<td>{{ role.displayName }}</td>
4854
<td>
@@ -63,22 +69,11 @@ <h2>{{ "Roles" | localize }}</h2>
6369
</tr>
6470
</tbody>
6571
</table>
66-
<div
67-
class="abp-pagination-controls-wrapper"
68-
*ngIf="totalItems > pageSize"
69-
>
70-
<abp-pagination-controls
71-
(pageChange)="getDataPage($event)"
72-
id="server"
73-
>
72+
<div class="abp-pagination-controls-wrapper" *ngIf="totalItems > pageSize">
73+
<abp-pagination-controls (pageChange)="getDataPage($event)" id="server">
7474
</abp-pagination-controls>
7575
</div>
76-
<button
77-
mat-mini-fab
78-
color="primary"
79-
class="pull-right"
80-
(click)="createRole()"
81-
>
76+
<button mat-mini-fab color="primary" class="pull-right" (click)="createRole()">
8277
<mat-icon>add</mat-icon>
8378
</button>
8479
</div>

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,20 @@ class PagedRolesRequestDto extends PagedRequestDto {
2020

2121
@Component({
2222
templateUrl: './roles.component.html',
23-
animations: [appModuleAnimation()]
23+
animations: [appModuleAnimation()],
24+
styles: [
25+
`
26+
mat-form-field {
27+
padding: 10px;
28+
}
29+
`
30+
]
2431
})
2532
export class RolesComponent extends PagedListingComponentBase<RoleDto> {
2633
roles: RoleDto[] = [];
2734

35+
keyword = '';
36+
2837
constructor(
2938
injector: Injector,
3039
private _rolesService: RoleServiceProxy,
@@ -38,6 +47,9 @@ export class RolesComponent extends PagedListingComponentBase<RoleDto> {
3847
pageNumber: number,
3948
finishedCallback: Function
4049
): void {
50+
51+
request.keyword = this.keyword;
52+
4153
this._rolesService
4254
.getAll(request.keyword, request.skipCount, request.maxResultCount)
4355
.pipe(

angular/src/app/tenants/tenants.component.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,26 @@ <h2>{{ "Tenants" | localize }}</h2>
2222
</ul>
2323
</div>
2424
<div class="body table-responsive">
25+
<!--query start-->
26+
<div class="row clearfix">
27+
<form>
28+
<mat-form-field>
29+
<input matInput [placeholder]="l('Keyword')" [(ngModel)]="keyword" name="keyword">
30+
</mat-form-field>
31+
32+
<mat-form-field>
33+
<mat-select [placeholder]="l('IsActive')" [(ngModel)]="isActive" name="isActive">
34+
<mat-option value="">{{ 'All' | localize }}</mat-option>
35+
<mat-option value="true">{{ 'Yes' | localize }}</mat-option>
36+
<mat-option value="false">{{ 'No' | localize }}</mat-option>
37+
</mat-select>
38+
</mat-form-field>
39+
40+
<button mat-raised-button color="primary" (click)="getDataPage(1)">{{ 'Search' | localize }}</button>
41+
42+
</form>
43+
</div>
44+
<!--query end-->
2545
<table class="table table-hover table-striped" [busy]="isTableLoading">
2646
<thead>
2747
<tr>

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,19 @@ class PagedTenantsRequestDto extends PagedRequestDto {
2121

2222
@Component({
2323
templateUrl: './tenants.component.html',
24-
animations: [appModuleAnimation()]
24+
animations: [appModuleAnimation()],
25+
styles: [
26+
`
27+
mat-form-field {
28+
padding: 10px;
29+
}
30+
`
31+
]
2532
})
2633
export class TenantsComponent extends PagedListingComponentBase<TenantDto> {
2734
tenants: TenantDto[] = [];
35+
keyword = '';
36+
isActive: boolean | null;
2837

2938
constructor(
3039
injector: Injector,
@@ -39,6 +48,10 @@ export class TenantsComponent extends PagedListingComponentBase<TenantDto> {
3948
pageNumber: number,
4049
finishedCallback: Function
4150
): void {
51+
52+
request.keyword = this.keyword;
53+
request.isActive = this.isActive;
54+
4255
this._tenantService
4356
.getAll(request.keyword, request.isActive, request.skipCount, request.maxResultCount)
4457
.pipe(

angular/src/app/users/users.component.html

Lines changed: 28 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
<h2>{{ "Users" | localize }}</h2>
66
<ul class="header-dropdown m-r--5">
77
<li>
8-
<button
9-
mat-icon-button
10-
[matMenuTriggerFor]="headerMenu"
11-
class="header-dropdown-mat-icon-button"
12-
>
8+
<button mat-icon-button [matMenuTriggerFor]="headerMenu" class="header-dropdown-mat-icon-button">
139
<mat-icon>more_vert</mat-icon>
1410
</button>
1511
<mat-menu #headerMenu="matMenu">
@@ -22,6 +18,26 @@ <h2>{{ "Users" | localize }}</h2>
2218
</ul>
2319
</div>
2420
<div class="body table-responsive">
21+
<!--query start-->
22+
<div class="row clearfix">
23+
<form>
24+
<mat-form-field>
25+
<input matInput [placeholder]="l('Keyword')" [(ngModel)]="keyword" name="keyword">
26+
</mat-form-field>
27+
28+
<mat-form-field>
29+
<mat-select [placeholder]="l('IsActive')" [(ngModel)]="isActive" name="isActive">
30+
<mat-option value="">{{ 'All' | localize }}</mat-option>
31+
<mat-option value="true">{{ 'Yes' | localize }}</mat-option>
32+
<mat-option value="false">{{ 'No' | localize }}</mat-option>
33+
</mat-select>
34+
</mat-form-field>
35+
36+
<button mat-raised-button color="primary" (click)="getDataPage(1)">{{ 'Search' | localize }}</button>
37+
38+
</form>
39+
</div>
40+
<!--query end-->
2541
<table class="table table-hover table-striped" [busy]="isTableLoading">
2642
<thead>
2743
<tr>
@@ -35,8 +51,7 @@ <h2>{{ "Users" | localize }}</h2>
3551
</tr>
3652
</thead>
3753
<tbody>
38-
<tr
39-
*ngFor="
54+
<tr *ngFor="
4055
let user of (users
4156
| paginate
4257
: {
@@ -45,24 +60,15 @@ <h2>{{ "Users" | localize }}</h2>
4560
currentPage: pageNumber,
4661
totalItems: totalItems
4762
})
48-
"
49-
>
63+
">
5064
<td>{{ user.userName }}</td>
5165
<td>{{ user.fullName }}</td>
5266
<td>{{ user.emailAddress }}</td>
5367
<td align="center">
54-
<i
55-
class="material-icons"
56-
*ngIf="user.isActive"
57-
style="color:green;"
58-
>
68+
<i class="material-icons" *ngIf="user.isActive" style="color:green;">
5969
check_box
6070
</i>
61-
<i
62-
class="material-icons"
63-
*ngIf="!user.isActive"
64-
style="color:red;"
65-
>
71+
<i class="material-icons" *ngIf="!user.isActive" style="color:red;">
6672
indeterminate_check_box
6773
</i>
6874
</td>
@@ -84,22 +90,11 @@ <h2>{{ "Users" | localize }}</h2>
8490
</tr>
8591
</tbody>
8692
</table>
87-
<div
88-
class="abp-pagination-controls-wrapper"
89-
*ngIf="totalItems > pageSize"
90-
>
91-
<abp-pagination-controls
92-
(pageChange)="getDataPage($event)"
93-
id="server"
94-
>
93+
<div class="abp-pagination-controls-wrapper" *ngIf="totalItems > pageSize">
94+
<abp-pagination-controls (pageChange)="getDataPage($event)" id="server">
9595
</abp-pagination-controls>
9696
</div>
97-
<button
98-
mat-mini-fab
99-
color="primary"
100-
class="pull-right"
101-
(click)="createUser()"
102-
>
97+
<button mat-mini-fab color="primary" class="pull-right" (click)="createUser()">
10398
<mat-icon>add</mat-icon>
10499
</button>
105100
</div>

angular/src/app/users/users.component.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,8 @@ import { Component, Injector } from '@angular/core';
22
import { MatDialog } from '@angular/material';
33
import { finalize } from 'rxjs/operators';
44
import { appModuleAnimation } from '@shared/animations/routerTransition';
5-
import {
6-
PagedListingComponentBase,
7-
PagedRequestDto
8-
} from 'shared/paged-listing-component-base';
9-
import {
10-
UserServiceProxy,
11-
UserDto,
12-
PagedResultDtoOfUserDto
13-
} from '@shared/service-proxies/service-proxies';
5+
import { PagedListingComponentBase, PagedRequestDto } from 'shared/paged-listing-component-base';
6+
import { UserServiceProxy, UserDto, PagedResultDtoOfUserDto } from '@shared/service-proxies/service-proxies';
147
import { CreateUserDialogComponent } from './create-user/create-user-dialog.component';
158
import { EditUserDialogComponent } from './edit-user/edit-user-dialog.component';
169
import { Moment } from 'moment';
@@ -24,10 +17,21 @@ class PagedUsersRequestDto extends PagedRequestDto {
2417

2518
@Component({
2619
templateUrl: './users.component.html',
27-
animations: [appModuleAnimation()]
20+
animations: [appModuleAnimation()],
21+
styles: [
22+
`
23+
mat-form-field {
24+
padding: 10px;
25+
}
26+
`
27+
]
2828
})
2929
export class UsersComponent extends PagedListingComponentBase<UserDto> {
3030
users: UserDto[] = [];
31+
keyword = '';
32+
isActive: boolean | null;
33+
from: Moment | null;
34+
to: Moment | null;
3135

3236
constructor(
3337
injector: Injector,
@@ -42,6 +46,12 @@ export class UsersComponent extends PagedListingComponentBase<UserDto> {
4246
pageNumber: number,
4347
finishedCallback: Function
4448
): void {
49+
50+
request.keyword = this.keyword;
51+
request.isActive = this.isActive;
52+
request.from = this.from;
53+
request.to = this.to;
54+
4555
this._userService
4656
.getAll(request.keyword, request.isActive, request.from, request.to, request.skipCount, request.maxResultCount)
4757
.pipe(

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Host/appsettings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"ConnectionStrings": {
3-
"Default": "Server=localhost; Database=AbpProjectNameDb; Trusted_Connection=True;"
4-
},
2+
"ConnectionStrings": {
3+
"Default": "Data Source=(localdb)\\ProjectsV13;Initial Catalog=AbpProjectNameDb;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False"
4+
},
55
"App": {
66
"ServerRootAddress": "http://localhost:21021/",
77
"ClientRootAddress": "http://localhost:4200/",

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Host/web.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<configuration>
33
<system.webServer>
44
<handlers>
5-
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
5+
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
66
</handlers>
77
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" startupTimeLimit="3600" requestTimeout="23:00:00">
88
<environmentVariables />

0 commit comments

Comments
 (0)