Revert "#124 [intUI/Filter] for UserRoleAssignment"
I am reverting because I need to fix a bug in this commit and it's a tagged HOWTO commit.
This commit is contained in:
parent
fbb356c8e9
commit
5e001c59f9
@ -21,34 +21,6 @@
|
|||||||
<th jhiSortBy="user.login"><span jhiTranslate="hsadminNgApp.userRoleAssignment.user">User</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
<th jhiSortBy="user.login"><span jhiTranslate="hsadminNgApp.userRoleAssignment.user">User</span> <fa-icon [icon]="'sort'"></fa-icon></th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<!-- filter start: -->
|
|
||||||
<tr>
|
|
||||||
<th style="width: 10%"></th>
|
|
||||||
<th style="width: 10%"><input type="text" class="form-control" style="max-width: 20em" [(ngModel)]="filter.criteria.entityTypeId" (keyup)="filter.trigger($event)"></th>
|
|
||||||
<th style="width: 10%"><input type="text" class="form-control" style="max-width: 20em" [(ngModel)]="filter.criteria.entityObjectId" (keyup)="filter.trigger($event)"></th>
|
|
||||||
<th style="width: 10%">
|
|
||||||
<select class="form-control" [(ngModel)]="filter.criteria.assignedRole" (change)="filter.trigger($event)">
|
|
||||||
<option value=""></option>
|
|
||||||
<option value="HOSTMASTER" jhiTranslate="{{'hsadminNgApp.UserRole.HOSTMASTER'}}">HOSTMASTER</option>
|
|
||||||
<option value="ADMIN" jhiTranslate="{{'hsadminNgApp.UserRole.ADMIN'}}">ADMIN</option>
|
|
||||||
<option value="SUPPORTER" jhiTranslate="{{'hsadminNgApp.UserRole.SUPPORTER'}}">SUPPORTER</option>
|
|
||||||
<option value="CONTRACTUAL_CONTACT" jhiTranslate="{{'hsadminNgApp.UserRole.CONTRACTUAL_CONTACT'}}">CONTRACTUAL_CONTACT</option>
|
|
||||||
<option value="FINANCIAL_CONTACT" jhiTranslate="{{'hsadminNgApp.UserRole.FINANCIAL_CONTACT'}}">FINANCIAL_CONTACT</option>
|
|
||||||
<option value="TECHNICAL_CONTACT" jhiTranslate="{{'hsadminNgApp.UserRole.TECHNICAL_CONTACT'}}">TECHNICAL_CONTACT</option>
|
|
||||||
<option value="CUSTOMER_USER" jhiTranslate="{{'hsadminNgApp.UserRole.CUSTOMER_USER'}}">CUSTOMER_USER</option>
|
|
||||||
</select>
|
|
||||||
</th>
|
|
||||||
<th style="width: 30%">
|
|
||||||
<select id="field_user" class="form-control" name="user" [(ngModel)]="filter.criteria.userId" (change)="filter.trigger($event)">
|
|
||||||
<option [ngValue]="null" selected></option>
|
|
||||||
<option [ngValue]="userOption.id" *ngFor="let userOption of users; trackBy: trackId">{{userOption.login}}</option>
|
|
||||||
</select>
|
|
||||||
</th>
|
|
||||||
<th style="width: 20%"><button class="btn btn-primary float-left" (click)="filter.reset()">Reset Filter</button></th>
|
|
||||||
</tr>
|
|
||||||
<!-- filter end. -->
|
|
||||||
|
|
||||||
</thead>
|
</thead>
|
||||||
<tbody infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0">
|
<tbody infinite-scroll (scrolled)="loadPage(page + 1)" [infiniteScrollDisabled]="page >= links['last']" [infiniteScrollDistance]="0">
|
||||||
<tr *ngFor="let userRoleAssignment of userRoleAssignments ;trackBy: trackId">
|
<tr *ngFor="let userRoleAssignment of userRoleAssignments ;trackBy: trackId">
|
||||||
|
@ -9,9 +9,6 @@ import { AccountService } from 'app/core';
|
|||||||
|
|
||||||
import { ITEMS_PER_PAGE } from 'app/shared';
|
import { ITEMS_PER_PAGE } from 'app/shared';
|
||||||
import { UserRoleAssignmentService } from './user-role-assignment.service';
|
import { UserRoleAssignmentService } from './user-role-assignment.service';
|
||||||
import { IUser } from 'app/core/user/user.model';
|
|
||||||
import { UserService } from 'app/core/user/user.service';
|
|
||||||
import { TableFilter, queryEquals, queryContains } from 'app/shared/util/tablefilter';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'jhi-user-role-assignment',
|
selector: 'jhi-user-role-assignment',
|
||||||
@ -27,17 +24,9 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy {
|
|||||||
predicate: any;
|
predicate: any;
|
||||||
reverse: any;
|
reverse: any;
|
||||||
totalItems: number;
|
totalItems: number;
|
||||||
users: IUser[];
|
|
||||||
filter: TableFilter<{
|
|
||||||
entityTypeId?: string;
|
|
||||||
entityObjectId?: string;
|
|
||||||
assignedRole?: string;
|
|
||||||
userId?: string;
|
|
||||||
}>;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
protected userRoleAssignmentService: UserRoleAssignmentService,
|
protected userRoleAssignmentService: UserRoleAssignmentService,
|
||||||
protected userService: UserService,
|
|
||||||
protected jhiAlertService: JhiAlertService,
|
protected jhiAlertService: JhiAlertService,
|
||||||
protected eventManager: JhiEventManager,
|
protected eventManager: JhiEventManager,
|
||||||
protected parseLinks: JhiParseLinks,
|
protected parseLinks: JhiParseLinks,
|
||||||
@ -51,24 +40,11 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy {
|
|||||||
};
|
};
|
||||||
this.predicate = 'id';
|
this.predicate = 'id';
|
||||||
this.reverse = true;
|
this.reverse = true;
|
||||||
this.filter = new TableFilter(
|
|
||||||
{
|
|
||||||
entityTypeId: queryContains,
|
|
||||||
entityObjectId: queryEquals,
|
|
||||||
assignedRole: queryEquals,
|
|
||||||
userId: queryEquals
|
|
||||||
},
|
|
||||||
500,
|
|
||||||
() => {
|
|
||||||
this.loadAll();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loadAll() {
|
loadAll() {
|
||||||
this.userRoleAssignmentService
|
this.userRoleAssignmentService
|
||||||
.query({
|
.query({
|
||||||
...this.filter.buildQueryCriteria(),
|
|
||||||
page: this.page,
|
page: this.page,
|
||||||
size: this.itemsPerPage,
|
size: this.itemsPerPage,
|
||||||
sort: this.sort()
|
sort: this.sort()
|
||||||
@ -95,13 +71,6 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy {
|
|||||||
this.accountService.identity().then(account => {
|
this.accountService.identity().then(account => {
|
||||||
this.currentAccount = account;
|
this.currentAccount = account;
|
||||||
});
|
});
|
||||||
this.userService
|
|
||||||
.query()
|
|
||||||
.pipe(
|
|
||||||
filter((mayBeOk: HttpResponse<IUser[]>) => mayBeOk.ok),
|
|
||||||
map((response: HttpResponse<IUser[]>) => response.body)
|
|
||||||
)
|
|
||||||
.subscribe((res: IUser[]) => (this.users = res), (res: HttpErrorResponse) => this.onError(res.message));
|
|
||||||
this.registerChangeInUserRoleAssignments();
|
this.registerChangeInUserRoleAssignments();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +78,7 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy {
|
|||||||
this.eventManager.destroy(this.eventSubscriber);
|
this.eventManager.destroy(this.eventSubscriber);
|
||||||
}
|
}
|
||||||
|
|
||||||
trackId(index: number, item: { id: number }) {
|
trackId(index: number, item: IUserRoleAssignment) {
|
||||||
return item.id;
|
return item.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,7 +97,6 @@ export class UserRoleAssignmentComponent implements OnInit, OnDestroy {
|
|||||||
protected paginateUserRoleAssignments(data: IUserRoleAssignment[], headers: HttpHeaders) {
|
protected paginateUserRoleAssignments(data: IUserRoleAssignment[], headers: HttpHeaders) {
|
||||||
this.links = this.parseLinks.parse(headers.get('link'));
|
this.links = this.parseLinks.parse(headers.get('link'));
|
||||||
this.totalItems = parseInt(headers.get('X-Total-Count'), 10);
|
this.totalItems = parseInt(headers.get('X-Total-Count'), 10);
|
||||||
this.userRoleAssignments = [];
|
|
||||||
for (let i = 0; i < data.length; i++) {
|
for (let i = 0; i < data.length; i++) {
|
||||||
this.userRoleAssignments.push(data[i]);
|
this.userRoleAssignments.push(data[i]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user