[id]="'userParentSection'" | [id]="'userParentSection'" | ||||
#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"> | <div class="spinner-border text-primary" role="status"> | ||||
<span class="sr-only">Loading...</span> | <span class="sr-only">Loading...</span> | ||||
</div> | </div> | ||||
</ng-template> | </ng-template> | ||||
</ng-container> | </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"> | <table class="table table-striped table-bordered"> | ||||
<thead class="thead-light"> | <thead class="thead-light"> | ||||
<tr sorted [sortFieldEmitter]="userParentSection.sortFieldChange" | <tr sorted [sortFieldEmitter]="userParentSection.sortFieldChange" | ||||
</tr> | </tr> | ||||
</thead> | </thead> | ||||
<tbody> | <tbody> | ||||
<tr *ngFor="let user of userItem.data"> | |||||
<tr *ngFor="let parentUser of parentUserItem.data"> | |||||
<td><span data-toggle="tooltip" placement="left" | <td><span data-toggle="tooltip" placement="left" | ||||
ngbTooltip="{{user.id}}">{{user.user_id}}</span> | |||||
ngbTooltip="{{parentUser.id}}">{{parentUser.user_id}}</span> | |||||
</td> | </td> | ||||
<td>{{user.full_name}}</td> | |||||
<td>{{parentUser.full_name}}</td> | |||||
</tr> | </tr> | ||||
</tbody> | </tbody> | ||||
</table> | </table> | ||||
[displayControlsIfSinglePage]="false" | [displayControlsIfSinglePage]="false" | ||||
#userSection> | #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"> | <div class="spinner-border text-primary" role="status"> | ||||
<span class="sr-only">Loading...</span> | <span class="sr-only">Loading...</span> | ||||
</div> | </div> |
~ specific language governing permissions and limitations | ~ specific language governing permissions and limitations | ||||
~ under the License. | ~ 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"> | <div class="col-lg-4 col-md-2 col-sm-1"> | ||||
<label class="sr-only" for="searchQuery">{{'search.label' |translate}}</label> | <label class="sr-only" for="searchQuery">{{'search.label' |translate}}</label> | ||||
<input type="text" class="form-control" id="searchQuery" placeholder="{{'search.input'|translate}}" #searchTerm | <input type="text" class="form-control" id="searchQuery" placeholder="{{'search.input'|translate}}" #searchTerm | ||||
<ng-content></ng-content> | <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" | [collectionSize]="total$|async" [pageSize]="pageSize" [maxSize]="pagination.maxSize" [rotate]="pagination.rotate" | ||||
[boundaryLinks]="pagination.boundaryLinks" [ellipses]="pagination.ellipses" | [boundaryLinks]="pagination.boundaryLinks" [ellipses]="pagination.ellipses" | ||||
[(page)]="page" (pageChange)="changePage($event)" aria-label="Pagination"></ngb-pagination> | [(page)]="page" (pageChange)="changePage($event)" aria-label="Pagination"></ngb-pagination> |
pluck, | pluck, | ||||
refCount, | refCount, | ||||
startWith, | startWith, | ||||
switchMap | |||||
switchMap, tap | |||||
} from "rxjs/operators"; | } from "rxjs/operators"; | ||||
import {EntityService} from "@app/model/entity-service"; | import {EntityService} from "@app/model/entity-service"; | ||||
import {FieldToggle} from "@app/model/field-toggle"; | import {FieldToggle} from "@app/model/field-toggle"; | ||||
multicast(new Subject()), | multicast(new Subject()), | ||||
refCount() | 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)); | 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) { | search(terms: string) { |