768a3034d7979b1b93f8d69c788e2ad70d7b2eb7
[oweals/peertube.git] / client / src / app / +admin / users / user-list / user-list.component.html
1 <div class="admin-sub-header">
2   <div i18n class="form-sub-title">Users list</div>
3
4   <a class="add-button" routerLink="/admin/users/create">
5     <my-global-icon iconName="add"></my-global-icon>
6     <ng-container i18n>Create user</ng-container>
7   </a>
8 </div>
9
10 <p-table
11   [value]="users" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
12   [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id" [resizableColumns]="true"
13   [(selection)]="selectedUsers"
14   [showCurrentPageReport]="true" i18n-currentPageReportTemplate
15   currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} users"
16   (onPage)="onPage($event)" [expandedRowKeys]="expandedRows"
17 >
18   <ng-template pTemplate="caption">
19     <div class="caption">
20       <div>
21         <my-action-dropdown
22           *ngIf="isInSelectionMode()" i18n-label label="Batch actions" theme="orange"
23           [actions]="bulkUserActions" [entry]="selectedUsers"
24         >
25         </my-action-dropdown>
26       </div>
27
28       <div class="has-feedback has-clear">
29         <input
30           type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..."
31           (keyup)="onSearch($event)"
32         >
33         <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetSearch()"></a>
34         <span class="sr-only" i18n>Clear filters</span>
35       </div>
36     </div>
37   </ng-template>
38
39   <ng-template pTemplate="header">
40     <tr>
41       <th style="width: 40px">
42         <p-tableHeaderCheckbox></p-tableHeaderCheckbox>
43       </th>
44       <th style="width: 40px"></th>
45       <th pResizableColumn i18n pSortableColumn="username">Username <p-sortIcon field="username"></p-sortIcon></th>
46       <th i18n>Email</th>
47       <th style="width: 140px;" i18n pSortableColumn="videoQuotaUsed">Video quota <p-sortIcon field="videoQuotaUsed"></p-sortIcon></th>
48       <th style="width: 120px;" i18n>Role</th>
49       <th style="width: 140px;" pResizableColumn i18n>Auth plugin</th>
50       <th style="width: 150px;" i18n pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th>
51       <th style="width: 50px;"></th>
52     </tr>
53   </ng-template>
54
55   <ng-template pTemplate="body" let-expanded="expanded" let-user>
56
57     <tr [pSelectableRow]="user" [ngClass]="{ banned: user.blocked }">
58       <td>
59         <p-tableCheckbox [value]="user"></p-tableCheckbox>
60       </td>
61
62       <td class="expand-cell">
63         <span *ngIf="user.blockedReason" class="expander" [pRowToggler]="user">
64           <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i>
65         </span>
66       </td>
67
68       <td>
69         <a i18n-title title="Open account in a new tab" target="_blank" rel="noopener noreferrer" [routerLink]="[ '/accounts/' + user.username ]">
70           <div class="chip two-lines">
71             <img
72               class="avatar"
73               [src]="user?.account?.avatar?.path"
74               (error)="switchToDefaultAvatar($event)"
75               alt="Avatar"
76             >
77             <div>
78               {{ user.account.displayName }}
79               <span class="text-muted">{{ user.username }}</span>
80             </div>
81           </div>
82           <span i18n *ngIf="user.blocked" class="banned-info">(banned)</span>
83         </a>
84       </td>
85
86       <td *ngIf="!requiresEmailVerification || user.blocked; else emailWithVerificationStatus" [title]="user.email">{{ user.email }}</td>
87
88       <ng-template #emailWithVerificationStatus>
89         <td *ngIf="user.emailVerified === false; else emailVerifiedNotFalse" i18n-title title="User's email must be verified to login">
90           <em>? {{ user.email }}</em>
91         </td>
92         <ng-template #emailVerifiedNotFalse>
93           <td i18n-title title="User's email is verified / User can login without email verification">
94             &#x2713; {{ user.email }}
95           </td>
96         </ng-template>
97       </ng-template>
98
99       <td>{{ user.videoQuotaUsed }} / {{ user.videoQuota }}</td>
100       <td>{{ user.roleLabel }}</td>
101
102       <td>
103         <ng-container *ngIf="user.pluginAuth">{{ user.pluginAuth }}</ng-container>
104       </td>
105
106       <td [title]="user.createdAt">{{ user.createdAt | date: 'short' }}</td>
107
108       <td class="action-cell">
109         <my-user-moderation-dropdown *ngIf="!isInSelectionMode()" [user]="user" (userChanged)="onUserChanged()" (userDeleted)="onUserChanged()">
110         </my-user-moderation-dropdown>
111       </td>
112     </tr>
113   </ng-template>
114
115   <ng-template pTemplate="rowexpansion" let-user>
116     <tr class="user-blocked-reason">
117       <td colspan="7">
118         <span i18n class="ban-reason-label">Ban reason:</span>
119         {{ user.blockedReason }}
120       </td>
121     </tr>
122   </ng-template>
123 </p-table>
124
125 <my-user-ban-modal #userBanModal (userBanned)="onUserChanged()"></my-user-ban-modal>