Skip to content

Commit 55fa8b4

Browse files
committed
Implements list query filter for users/roles/tenants in angular template #394: Small changes
1 parent d119893 commit 55fa8b4

File tree

8 files changed

+95
-111
lines changed

8 files changed

+95
-111
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="row clearfix" [@routerTransition]>
1+
<div class="row clearfix" [@routerTransition]>
22
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
33
<div class="card main-content">
44
<div class="header">
@@ -22,7 +22,7 @@ <h2>{{ "Roles" | localize }}</h2>
2222
<div class="row clearfix">
2323
<form>
2424
<mat-form-field>
25-
<input matInput [placeholder]="l('Keyword')" [(ngModel)]="keyword" name="keyword">
25+
<input matInput [placeholder]="l('Filter')" [(ngModel)]="keyword" name="keyword">
2626
</mat-form-field>
2727

2828
<button mat-raised-button color="primary" (click)="getDataPage(1)">{{ 'Search' | localize }}</button>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="row clearfix" [@routerTransition]>
1+
<div class="row clearfix" [@routerTransition]>
22
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
33
<div class="card main-content">
44
<div class="header">
@@ -26,7 +26,7 @@ <h2>{{ "Tenants" | localize }}</h2>
2626
<div class="row clearfix">
2727
<form>
2828
<mat-form-field>
29-
<input matInput [placeholder]="l('Keyword')" [(ngModel)]="keyword" name="keyword">
29+
<input matInput [placeholder]="l('Filter')" [(ngModel)]="keyword" name="keyword">
3030
</mat-form-field>
3131

3232
<mat-form-field>
Lines changed: 86 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
11
<div class="row clearfix" [@routerTransition]>
2-
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
3-
<div class="card main-content">
4-
<div class="header">
5-
<h2>{{ "Users" | localize }}</h2>
6-
<ul class="header-dropdown m-r--5">
7-
<li>
8-
<button mat-icon-button [matMenuTriggerFor]="headerMenu" class="header-dropdown-mat-icon-button">
9-
<mat-icon>more_vert</mat-icon>
10-
</button>
11-
<mat-menu #headerMenu="matMenu">
12-
<button mat-menu-item (click)="refresh()">
13-
<mat-icon>refresh</mat-icon>
14-
<span>{{ "Refresh" | localize }}</span>
15-
</button>
16-
</mat-menu>
17-
</li>
18-
</ul>
19-
</div>
20-
<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>
2+
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
3+
<div class="card main-content">
4+
<div class="header">
5+
<h2>{{ "Users" | localize }}</h2>
6+
<ul class="header-dropdown m-r--5">
7+
<li>
8+
<button mat-icon-button [matMenuTriggerFor]="headerMenu" class="header-dropdown-mat-icon-button">
9+
<mat-icon>more_vert</mat-icon>
10+
</button>
11+
<mat-menu #headerMenu="matMenu">
12+
<button mat-menu-item (click)="refresh()">
13+
<mat-icon>refresh</mat-icon>
14+
<span>{{ "Refresh" | localize }}</span>
15+
</button>
16+
</mat-menu>
17+
</li>
18+
</ul>
19+
</div>
20+
<div class="body table-responsive">
21+
<!--query start-->
22+
<div class="row clearfix">
23+
<form>
24+
<mat-form-field>
25+
<input matInput [placeholder]="l('Filter')" [(ngModel)]="keyword" name="keyword">
26+
</mat-form-field>
2727

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>
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>
3535

36-
<button mat-raised-button color="primary" (click)="getDataPage(1)">{{ 'Search' | localize }}</button>
36+
<button mat-raised-button color="primary" (click)="getDataPage(1)">{{ 'Search' | localize }}</button>
3737

38-
</form>
39-
</div>
40-
<!--query end-->
41-
<table class="table table-hover table-striped" [busy]="isTableLoading">
42-
<thead>
43-
<tr>
44-
<th>{{ "UserName" | localize }}</th>
45-
<th>{{ "FullName" | localize }}</th>
46-
<th>{{ "EmailAddress" | localize }}</th>
47-
<th>
48-
<div style="text-align:center">{{ "IsActive" | localize }}</div>
49-
</th>
50-
<th>{{ "Actions" | localize }}</th>
51-
</tr>
52-
</thead>
53-
<tbody>
54-
<tr *ngFor="
38+
</form>
39+
</div>
40+
<!--query end-->
41+
<table class="table table-hover table-striped" [busy]="isTableLoading">
42+
<thead>
43+
<tr>
44+
<th>{{ "UserName" | localize }}</th>
45+
<th>{{ "FullName" | localize }}</th>
46+
<th>{{ "EmailAddress" | localize }}</th>
47+
<th>
48+
<div style="text-align:center">{{ "IsActive" | localize }}</div>
49+
</th>
50+
<th>{{ "Actions" | localize }}</th>
51+
</tr>
52+
</thead>
53+
<tbody>
54+
<tr *ngFor="
5555
let user of (users
5656
| paginate
5757
: {
@@ -61,43 +61,43 @@ <h2>{{ "Users" | localize }}</h2>
6161
totalItems: totalItems
6262
})
6363
">
64-
<td>{{ user.userName }}</td>
65-
<td>{{ user.fullName }}</td>
66-
<td>{{ user.emailAddress }}</td>
67-
<td align="center">
68-
<i class="material-icons" *ngIf="user.isActive" style="color:green;">
69-
check_box
70-
</i>
71-
<i class="material-icons" *ngIf="!user.isActive" style="color:red;">
72-
indeterminate_check_box
73-
</i>
74-
</td>
75-
<td>
76-
<button class="action-button" mat-icon-button [matMenuTriggerFor]="actionsMenu">
77-
<mat-icon>menu</mat-icon>
64+
<td>{{ user.userName }}</td>
65+
<td>{{ user.fullName }}</td>
66+
<td>{{ user.emailAddress }}</td>
67+
<td align="center">
68+
<i class="material-icons" *ngIf="user.isActive" style="color:green;">
69+
check_box
70+
</i>
71+
<i class="material-icons" *ngIf="!user.isActive" style="color:red;">
72+
indeterminate_check_box
73+
</i>
74+
</td>
75+
<td>
76+
<button class="action-button" mat-icon-button [matMenuTriggerFor]="actionsMenu">
77+
<mat-icon>menu</mat-icon>
78+
</button>
79+
<mat-menu #actionsMenu="matMenu">
80+
<button mat-menu-item (click)="editUser(user)">
81+
<mat-icon>edit</mat-icon>
82+
<span>{{ "Edit" | localize }}</span>
83+
</button>
84+
<button mat-menu-item (click)="delete(user)">
85+
<mat-icon>delete</mat-icon>
86+
<span>{{ "Delete" | localize }}</span>
87+
</button>
88+
</mat-menu>
89+
</td>
90+
</tr>
91+
</tbody>
92+
</table>
93+
<div class="abp-pagination-controls-wrapper" *ngIf="totalItems > pageSize">
94+
<abp-pagination-controls (pageChange)="getDataPage($event)" id="server">
95+
</abp-pagination-controls>
96+
</div>
97+
<button mat-mini-fab color="primary" class="pull-right" (click)="createUser()">
98+
<mat-icon>add</mat-icon>
7899
</button>
79-
<mat-menu #actionsMenu="matMenu">
80-
<button mat-menu-item (click)="editUser(user)">
81-
<mat-icon>edit</mat-icon>
82-
<span>{{ "Edit" | localize }}</span>
83-
</button>
84-
<button mat-menu-item (click)="delete(user)">
85-
<mat-icon>delete</mat-icon>
86-
<span>{{ "Delete" | localize }}</span>
87-
</button>
88-
</mat-menu>
89-
</td>
90-
</tr>
91-
</tbody>
92-
</table>
93-
<div class="abp-pagination-controls-wrapper" *ngIf="totalItems > pageSize">
94-
<abp-pagination-controls (pageChange)="getDataPage($event)" id="server">
95-
</abp-pagination-controls>
100+
</div>
96101
</div>
97-
<button mat-mini-fab color="primary" class="pull-right" (click)="createUser()">
98-
<mat-icon>add</mat-icon>
99-
</button>
100-
</div>
101102
</div>
102-
</div>
103103
</div>

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ import { PagedListingComponentBase, PagedRequestDto } from 'shared/paged-listing
66
import { UserServiceProxy, UserDto, PagedResultDtoOfUserDto } from '@shared/service-proxies/service-proxies';
77
import { CreateUserDialogComponent } from './create-user/create-user-dialog.component';
88
import { EditUserDialogComponent } from './edit-user/edit-user-dialog.component';
9-
import { Moment } from 'moment';
109

1110
class PagedUsersRequestDto extends PagedRequestDto {
1211
keyword: string;
1312
isActive: boolean | null;
14-
from: Moment | null;
15-
to: Moment | null;
1613
}
1714

1815
@Component({
@@ -30,8 +27,6 @@ export class UsersComponent extends PagedListingComponentBase<UserDto> {
3027
users: UserDto[] = [];
3128
keyword = '';
3229
isActive: boolean | null;
33-
from: Moment | null;
34-
to: Moment | null;
3530

3631
constructor(
3732
injector: Injector,
@@ -49,11 +44,9 @@ export class UsersComponent extends PagedListingComponentBase<UserDto> {
4944

5045
request.keyword = this.keyword;
5146
request.isActive = this.isActive;
52-
request.from = this.from;
53-
request.to = this.to;
5447

5548
this._userService
56-
.getAll(request.keyword, request.isActive, request.from, request.to, request.skipCount, request.maxResultCount)
49+
.getAll(request.keyword, request.isActive, request.skipCount, request.maxResultCount)
5750
.pipe(
5851
finalize(() => {
5952
finishedCallback();

angular/src/shared/service-proxies/service-proxies.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,22 +1516,16 @@ export class UserServiceProxy {
15161516
/**
15171517
* @param keyword (optional)
15181518
* @param isActive (optional)
1519-
* @param from (optional)
1520-
* @param to (optional)
15211519
* @param skipCount (optional)
15221520
* @param maxResultCount (optional)
15231521
* @return Success
15241522
*/
1525-
getAll(keyword: string | null | undefined, isActive: boolean | null | undefined, from: moment.Moment | null | undefined, to: moment.Moment | null | undefined, skipCount: number | null | undefined, maxResultCount: number | null | undefined): Observable<PagedResultDtoOfUserDto> {
1523+
getAll(keyword: string | null | undefined, isActive: boolean | null | undefined, skipCount: number | null | undefined, maxResultCount: number | null | undefined): Observable<PagedResultDtoOfUserDto> {
15261524
let url_ = this.baseUrl + "/api/services/app/User/GetAll?";
15271525
if (keyword !== undefined)
15281526
url_ += "Keyword=" + encodeURIComponent("" + keyword) + "&";
15291527
if (isActive !== undefined)
15301528
url_ += "IsActive=" + encodeURIComponent("" + isActive) + "&";
1531-
if (from !== undefined)
1532-
url_ += "From=" + encodeURIComponent(from ? "" + from.toJSON() : "") + "&";
1533-
if (to !== undefined)
1534-
url_ += "To=" + encodeURIComponent(to ? "" + to.toJSON() : "") + "&";
15351529
if (skipCount !== undefined)
15361530
url_ += "SkipCount=" + encodeURIComponent("" + skipCount) + "&";
15371531
if (maxResultCount !== undefined)

aspnet-core/src/AbpCompanyName.AbpProjectName.Application/Users/Dto/PagedUserResultRequestDto.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@ public class PagedUserResultRequestDto : PagedResultRequestDto
88
{
99
public string Keyword { get; set; }
1010
public bool? IsActive { get; set; }
11-
public DateTimeOffset? From { get; set; }//javascript date within timezone
12-
public DateTimeOffset? To { get; set; }//javascript date within timezone
1311
}
1412
}

aspnet-core/src/AbpCompanyName.AbpProjectName.Application/Users/UserAppService.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,8 @@ protected override UserDto MapToEntityDto(User user)
129129
protected override IQueryable<User> CreateFilteredQuery(PagedUserResultRequestDto input)
130130
{
131131
return Repository.GetAllIncluding(x => x.Roles)
132-
.WhereIf(!input.Keyword.IsNullOrWhiteSpace(), x => x.UserName.Contains(input.Keyword) || x.Name.Contains(input.Keyword))
133-
.WhereIf(input.IsActive.HasValue, x => x.IsActive == input.IsActive)
134-
.WhereIf(input.From.HasValue, x => x.CreationTime >= input.From.Value.LocalDateTime)
135-
.WhereIf(input.To.HasValue, x => x.CreationTime <= input.To.Value.LocalDateTime);
132+
.WhereIf(!input.Keyword.IsNullOrWhiteSpace(), x => x.UserName.Contains(input.Keyword) || x.Name.Contains(input.Keyword) || x.EmailAddress.Contains(input.Keyword))
133+
.WhereIf(input.IsActive.HasValue, x => x.IsActive == input.IsActive);
136134
}
137135

138136
protected override async Task<User> GetEntityByIdAsync(long id)

aspnet-core/src/AbpCompanyName.AbpProjectName.Core/Localization/SourceFiles/AbpProjectName.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,5 +91,6 @@
9191
<text name="StartTyping">Start Typing</text>
9292
<text name="Skins">Skins</text>
9393
<text name="Settings">Settings</text>
94+
<text name="Filter">Filter</text>
9495
</texts>
9596
</localizationDictionary>

0 commit comments

Comments
 (0)