@@ -166,14 +166,14 @@ | |||
[id]="'userParentSection'" | |||
#userParentSection> | |||
<ng-container *ngIf="userParentSection.items$ |async as itemLoader"> | |||
<ng-template [ngIf]="itemLoader.loading"> | |||
<ng-container *ngIf="userParentSection.items$ |async as userParentItemLoader"> | |||
<ng-template [ngIf]="userParentItemLoader.loading"> | |||
<div class="spinner-border text-primary" role="status"> | |||
<span class="sr-only">Loading...</span> | |||
</div> | |||
</ng-template> | |||
</ng-container> | |||
<ng-container *ngIf="userParentSection.items$ |stripLoading|async as userItem"> | |||
<ng-container *ngIf="userParentSection.items$ |stripLoading|async as parentUserItem"> | |||
<table class="table table-striped table-bordered"> | |||
<thead class="thead-light"> | |||
<tr sorted [sortFieldEmitter]="userParentSection.sortFieldChange" | |||
@@ -186,11 +186,11 @@ | |||
</tr> | |||
</thead> | |||
<tbody> | |||
<tr *ngFor="let user of userItem.data"> | |||
<tr *ngFor="let parentUser of parentUserItem.data"> | |||
<td><span data-toggle="tooltip" placement="left" | |||
ngbTooltip="{{user.id}}">{{user.user_id}}</span> | |||
ngbTooltip="{{parentUser.id}}">{{parentUser.user_id}}</span> | |||
</td> | |||
<td>{{user.full_name}}</td> | |||
<td>{{parentUser.full_name}}</td> | |||
</tr> | |||
</tbody> | |||
</table> | |||
@@ -205,8 +205,8 @@ | |||
[displayControlsIfSinglePage]="false" | |||
#userSection> | |||
<ng-container *ngIf="userSection.items$ |async as itemLoader"> | |||
<ng-template [ngIf]="itemLoader.loading"> | |||
<ng-container *ngIf="userSection.items$ |async as userItemLoader"> | |||
<ng-template [ngIf]="userItemLoader.loading"> | |||
<div class="spinner-border text-primary" role="status"> | |||
<span class="sr-only">Loading...</span> | |||
</div> |
@@ -15,10 +15,17 @@ | |||
~ specific language governing permissions and limitations | |||
~ under the License. | |||
--> | |||
<!-- | |||
<ng-template [ngIf]="((total$|async)>0 || displayIfEmpty)" [ngIfElse]="noContent" > | |||
--> | |||
<ng-template [ngIf]="true" [ngIfElse]="noContent" > | |||
<ng-template [ngIf]="(displayIfEmpty || (total$|async)>0)" [ngIfElse]="noContent" > | |||
<form class="mt-3 mb-3"> | |||
<div class="form-row align-items-center" *ngIf="displayControlsIfSinglePage||(multiplePages$|async)"> | |||
<form class="mt-3 mb-3"> | |||
<!-- | |||
<div class="form-row align-items-center" *ngIf="(multiplePages$|async)||displayControlsIfSinglePage"> | |||
--> | |||
<div class="form-row align-items-center" *ngIf="(multiplePages$|async)==true"> | |||
<div class="col-lg-4 col-md-2 col-sm-1"> | |||
<label class="sr-only" for="searchQuery">{{'search.label' |translate}}</label> | |||
<input type="text" class="form-control" id="searchQuery" placeholder="{{'search.input'|translate}}" #searchTerm | |||
@@ -34,7 +41,7 @@ | |||
<ng-content></ng-content> | |||
<ngb-pagination *ngIf="displayControlsIfSinglePage||(multiplePages$|async)" | |||
<ngb-pagination *ngIf="(multiplePages$|async)==true" | |||
[collectionSize]="total$|async" [pageSize]="pageSize" [maxSize]="pagination.maxSize" [rotate]="pagination.rotate" | |||
[boundaryLinks]="pagination.boundaryLinks" [ellipses]="pagination.ellipses" | |||
[(page)]="page" (pageChange)="changePage($event)" aria-label="Pagination"></ngb-pagination> |
@@ -27,7 +27,7 @@ import { | |||
pluck, | |||
refCount, | |||
startWith, | |||
switchMap | |||
switchMap, tap | |||
} from "rxjs/operators"; | |||
import {EntityService} from "@app/model/entity-service"; | |||
import {FieldToggle} from "@app/model/field-toggle"; | |||
@@ -187,11 +187,11 @@ export class PaginatedEntitiesComponent<T> implements OnInit, FieldToggle, After | |||
multicast(new Subject()), | |||
refCount() | |||
); | |||
this.total$ = source.pipe(filter(val=>val.hasValue()),map(val=>val.value), | |||
pluck('pagination', 'total_count')); | |||
this.multiplePages$ = source.pipe(filter(val => val.hasValue()), | |||
this.total$ = source.pipe(tap((el)=>console.log("Total pipe "+this.id+": "+typeof(el)+" - "+JSON.stringify(el))),filter(val=>val.hasValue()),map(val=>val.value), | |||
pluck('pagination', 'total_count'),tap((el)=>console.log("Total end "+this.id+" - "+el))); | |||
this.multiplePages$ = source.pipe(tap((el)=>console.log("Multipage pipe "+this.id+": "+typeof(el)+" - "+JSON.stringify(el))),filter(val => val.hasValue()), | |||
map(val => val.value.pagination.total_count > val.value.pagination.limit)); | |||
this.items$ = source; | |||
this.items$ = source.pipe(tap((el)=>console.log("Item pipe "+this.id+": "+typeof(el)+" - "+JSON.stringify(el)))); | |||
} | |||
search(terms: string) { |