diff --git a/lang/en.json b/lang/en.json index c9a9c11929c5e68924cf201b129ea2e74247d63b..c8e331ebaf809525b531a3a929b91b780a9f6a8d 100755 --- a/lang/en.json +++ b/lang/en.json @@ -649,6 +649,8 @@ "licence": "GNU GPLv3 license", "groupsToManage": "Choose the authorized assignment groups", "unlinkGroup": "Unlink group", - "emptyGroups": "No groups available to associate" + "emptyGroups": "No groups available to associate", + "emptyGroupUsers": "No users associated with this group", + "emptyUsers": "No users available to associate" } } \ No newline at end of file diff --git a/lang/fr.json b/lang/fr.json index bfcad10f72c2eb42d69b84a58c76a82d3411a956..2ff57f0027a27dbe5f574353be065f27886125ba 100755 --- a/lang/fr.json +++ b/lang/fr.json @@ -648,6 +648,8 @@ "licence": "licence GNU GPLv3", "groupsToManage": "Choisir les groupes d'affectations autorisés", "unlinkGroup": "Dissocier le groupe", - "emptyGroups": "Aucun groupe disponible à associer" + "emptyGroups": "Aucun groupe disponible à associer", + "emptyGroupUsers": "Aucun utilisateur associé à ce groupe", + "emptyUsers": "Aucun utilisateur disponible à associer" } } diff --git a/src/frontend/app/administration/group/group.component.html b/src/frontend/app/administration/group/group.component.html index 4643365fa63bd6b55163dd8d7d3bc9abb3b39f23..2d2fd6526dd72e574b4a8e27bc1ff80d2aa3e024 100644 --- a/src/frontend/app/administration/group/group.component.html +++ b/src/frontend/app/administration/group/group.component.html @@ -29,52 +29,61 @@ </ion-button> </ion-item> </div> - <ion-item lines="none" *ngIf="!creationMode"> - <ion-label color="secondary">{{'lang.linkedUsers' | translate}} :</ion-label> - </ion-item> - <ion-searchbar [placeholder]="'lang.filter' | translate" style="margin-left: 4x; display: flex; width: 50%;" - (ionChange)="applyFilter($event.detail.value)"> - </ion-searchbar> - <ion-card *ngIf="!creationMode" style="height: 400px; overflow-y: auto;"> - <ion-list> - <ion-item style="position: sticky;top:0px;z-index:1;"> - <ng-container style="display: flex;align-items: center;justify-content: center;width: 100%;background: white;"> - <ion-label color="primary" matSort [matSortActive]="displayedColumns[1]" matSortDirection='asc' - style="display: flex;font-size: 12px;align-items: center;" (matSortChange)="sortData($event)"> - <ng-container *ngFor="let col of displayedColumns"> - <div [mat-sort-header]="col" disableClear style="flex: 1" *ngIf="col!=='actions'"> - {{'lang.' + col | translate}} - </div> - </ng-container> - <div style="flex: 1;text-align: right;" *ngIf="displayedColumns.indexOf('actions') > -1"> - <ion-button slot="end" color="primary" fille="outline" shape="round" - (click)="openUserList()"> - {{'lang.add' | translate}} - </ion-button> - </div> - </ion-label> - </ng-container> - <ion-button slot="end" fill="clear" shape="round" disabled> - <ion-icon></ion-icon> - </ion-button> - </ion-item> - <ion-virtual-scroll [items]="sortedData" approxItemHeight="50px"> - <ion-item *virtualItem="let element" style="display: flex;"> - <ion-label style="display: flex;cursor: pointer;" - routerLink="/administration/users/{{element.id}}"> - <div style="flex: 1" *ngFor="let col of displayedColumns"> - {{element[col]}} + <ng-container *ngIf="!creationMode"> + <ion-item lines="none"> + <ion-label color="secondary">{{'lang.linkedUsers' | translate}} :</ion-label> + </ion-item> + <ion-searchbar [placeholder]="'lang.filter' | translate" style="margin-left: 4x; display: flex; width: 50%;" + (ionChange)="applyFilter($event.detail.value)"> + </ion-searchbar> + <ion-content style="height: 400px; overflow-y: auto;"> + <ion-list> + <ion-item style="position: sticky;top:0px;z-index:1;"> + <ng-container style="display: flex;align-items: center;justify-content: center;width: 100%;background: white;"> + <ion-label color="primary" matSort [matSortActive]="displayedColumns[1]" matSortDirection='asc' + style="display: flex;font-size: 12px;align-items: center;" (matSortChange)="sortData($event)"> + <ng-container *ngFor="let col of displayedColumns"> + <div [mat-sort-header]="col" disableClear style="flex: 1" *ngIf="col!=='actions'"> + {{'lang.' + col | translate}} + </div> + </ng-container> + <div style="flex: 1;text-align: right;" *ngIf="displayedColumns.indexOf('actions') > -1"> + <ion-button slot="end" color="primary" fille="outline" shape="round" + (click)="openUserList()"> + {{'lang.add' | translate}} + </ion-button> </div> </ion-label> - <ion-button slot="end" fill="clear" shape="round" - (click)="$event.stopPropagation();unlinkUser(element)" - title="{{'lang.unlinkUser' | translate}}"> - <ion-icon color="danger" slot="icon-only" name="close-outline"></ion-icon> + </ng-container> + <ion-button slot="end" fill="clear" shape="round" disabled> + <ion-icon></ion-icon> </ion-button> </ion-item> - </ion-virtual-scroll> - </ion-list> - </ion-card> + <ion-virtual-scroll [items]="sortedData" approxItemHeight="50px"> + <ion-item *virtualItem="let element" style="display: flex;"> + <ion-label style="display: flex;cursor: pointer;" + routerLink="/administration/users/{{element.id}}"> + <div style="flex: 1" *ngFor="let col of displayedColumns"> + {{element[col]}} + </div> + </ion-label> + <ion-button slot="end" fill="clear" shape="round" + (click)="$event.stopPropagation();unlinkUser(element)" + title="{{'lang.unlinkUser' | translate}}"> + <ion-icon color="danger" slot="icon-only" name="close-outline"></ion-icon> + </ion-button> + </ion-item> + </ion-virtual-scroll> + <ion-infinite-scroll threshold="100px" (ionInfinite)="loadData($event)" *ngIf="group.users.length > 7"> + <ion-infinite-scroll-content loadingSpinner="bubbles" [loadingText]="'lang.loadingMoreData' | translate"> + </ion-infinite-scroll-content> + </ion-infinite-scroll> + </ion-list> + <ion-item lines="none" *ngIf="group.users.length === 0" style="text-align: center; font-size: 20px; color: gray; margin-top: 5px;"> + <ion-label>{{ 'lang.emptyGroupUsers' | translate }}</ion-label> + </ion-item> + </ion-content> + </ng-container> <ion-item text-center lines="none" style="position: sticky;bottom:0px;z-index:1;"> <div style="display: flex;align-items: center;justify-content: center;width: 100%;background: white;"> <ion-button type="submit" shape="round" size="large" fill="outline" color="primary" diff --git a/src/frontend/app/administration/group/group.component.ts b/src/frontend/app/administration/group/group.component.ts index d17dee44095f02f094368a2768cf93b649fd7ea6..4f7916496dfd136f71a46c28a9f61d1ab93850de 100644 --- a/src/frontend/app/administration/group/group.component.ts +++ b/src/frontend/app/administration/group/group.component.ts @@ -84,7 +84,7 @@ export class GroupComponent implements OnInit { this.creationMode = false; this.usersList = []; - this.http.get('../rest/groups/' + params['id']) + this.http.get(`../rest/groups/${params['id']}`) .pipe( map((data: any) => data.group), finalize(() => { @@ -462,6 +462,11 @@ export class GroupComponent implements OnInit { canManage(privilege: any) { return privilege.id === 'manage_users' && privilege.checked; } + + loadData(event: any) { + event.target.complete(); + event.target.disabled = true; + } } diff --git a/src/frontend/app/administration/group/list/users.component.html b/src/frontend/app/administration/group/list/users.component.html index 2af53a9763a8c074cdb47950f5e74a4dbad21a1d..7d5ba32e6c5388a536e983d87cc83ac976aaf380 100644 --- a/src/frontend/app/administration/group/list/users.component.html +++ b/src/frontend/app/administration/group/list/users.component.html @@ -4,7 +4,7 @@ </ion-toolbar> </ion-header> <ion-content> - <ion-list> + <ion-list *ngIf="usersList.length > 0"> <ion-virtual-scroll [items]="usersList" approxItemHeight="50px" style="height: 450px;"> <ion-item button *virtualItem="let element" (click)="selectUser(element)"> <ion-label> @@ -13,4 +13,7 @@ </ion-item> </ion-virtual-scroll> </ion-list> + <ion-item lines="none" *ngIf="usersList.length === 0" style="text-align: center; font-size: 20px; color: gray; margin-top: 35%;"> + <ion-label>{{'lang.emptyUsers' | translate}}</ion-label> + </ion-item> </ion-content> \ No newline at end of file