]>
Commit | Line | Data |
---|---|---|
ab998f7b | 1 | <p-table |
25a42e29 | 2 | [value]="users" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions" |
df4c603d | 3 | [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id" [resizableColumns]="true" |
791645e6 | 4 | [(selection)]="selectedUsers" |
2bc9bd08 | 5 | [showCurrentPageReport]="true" i18n-currentPageReportTemplate |
45c14ae1 | 6 | currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} users" |
25a42e29 | 7 | (onPage)="onPage($event)" [expandedRowKeys]="expandedRows" |
04e0fc48 | 8 | > |
791645e6 C |
9 | <ng-template pTemplate="caption"> |
10 | <div class="caption"> | |
11 | <div> | |
12 | <my-action-dropdown | |
13 | *ngIf="isInSelectionMode()" i18n-label label="Batch actions" theme="orange" | |
14 | [actions]="bulkUserActions" [entry]="selectedUsers" | |
15 | > | |
16 | </my-action-dropdown> | |
17 | </div> | |
18 | ||
8491293b RK |
19 | <div class="ml-auto"> |
20 | <div class="input-group has-feedback has-clear"> | |
21 | <div class="input-group-prepend c-hand" ngbDropdown placement="bottom-left auto" container="body"> | |
22 | <div class="input-group-text" ngbDropdownToggle> | |
23 | <span class="caret" aria-haspopup="menu" role="button"></span> | |
24 | </div> | |
25 | ||
26 | <div role="menu" ngbDropdownMenu> | |
27 | <h6 class="dropdown-header" i18n>Advanced user filters</h6> | |
28 | <a [routerLink]="[ '/admin/users/list' ]" [queryParams]="{ 'search': 'banned:true' }" class="dropdown-item" i18n>Banned users</a> | |
29 | </div> | |
30 | </div> | |
31 | <input | |
32 | type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..." | |
33 | (keyup)="onUserSearch($event)" | |
34 | > | |
35 | <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetTableFilter()"></a> | |
36 | <span class="sr-only" i18n>Clear filters</span> | |
37 | </div> | |
791645e6 | 38 | </div> |
8491293b | 39 | |
c7b83630 | 40 | <a class="ml-2 add-button" routerLink="/admin/users/create"> |
ea7337cf | 41 | <my-global-icon iconName="user-add" aria-hidden="true"></my-global-icon> |
c7b83630 RK |
42 | <ng-container i18n>Create user</ng-container> |
43 | </a> | |
791645e6 C |
44 | </div> |
45 | </ng-template> | |
46 | ||
ab998f7b C |
47 | <ng-template pTemplate="header"> |
48 | <tr> | |
791645e6 | 49 | <th style="width: 40px"> |
2cae5f13 | 50 | <p-tableHeaderCheckbox></p-tableHeaderCheckbox> |
791645e6 | 51 | </th> |
2cae5f13 | 52 | <th style="width: 40px"></th> |
bc99dfe5 RK |
53 | <th *ngIf="getColumn('username')" pResizableColumn i18n pSortableColumn="username">{{ getColumn('username').label }} <p-sortIcon field="username"></p-sortIcon></th> |
54 | <th *ngIf="getColumn('email')" i18n>{{ getColumn('email').label }}</th> | |
55 | <th *ngIf="getColumn('quota')" style="width: 160px;" i18n pSortableColumn="videoQuotaUsed">{{ getColumn('quota').label }} <p-sortIcon field="videoQuotaUsed"></p-sortIcon></th> | |
56 | <th *ngIf="getColumn('quotaDaily')" style="width: 160px;" i18n>{{ getColumn('quotaDaily').label }}</th> | |
57 | <th *ngIf="getColumn('role')" style="width: 120px;" i18n pSortableColumn="role">{{ getColumn('role').label }} <p-sortIcon field="role"></p-sortIcon></th> | |
58 | <th *ngIf="getColumn('pluginAuth')" style="width: 140px;" pResizableColumn i18n>{{ getColumn('pluginAuth').label }}</th> | |
59 | <th *ngIf="getColumn('createdAt')" style="width: 150px;" i18n pSortableColumn="createdAt">{{ getColumn('createdAt').label }} <p-sortIcon field="createdAt"></p-sortIcon></th> | |
60 | <th *ngIf="getColumn('lastLoginDate')" style="width: 150px;" i18n pSortableColumn="lastLoginDate">{{ getColumn('lastLoginDate').label }} <p-sortIcon field="lastLoginDate"></p-sortIcon></th> | |
61 | <th style="width: 60px;"> | |
62 | <div class="c-hand" ngbDropdown placement="bottom-right auto" container="body" autoClose="outside"> | |
63 | <my-global-icon iconName="columns" ngbDropdownToggle></my-global-icon> | |
30814423 | 64 | |
bc99dfe5 RK |
65 | <div role="menu" class="dropdown-menu" ngbDropdownMenu> |
66 | <div class="dropdown-header" i18n>Table parameters</div> | |
67 | <div ngbDropdownItem class="dropdown-item"> | |
68 | <p-multiSelect | |
69 | [options]="columns" [showToggleAll]="true" [(ngModel)]="selectedColumns" optionLabel="label" | |
70 | emptyFilterMessage="No matching column found" i18n-emptyFilterMessage [filter]="false" | |
71 | selectedItemsLabel="{0} columns displayed" i18n-emptyFilterMessage [showHeader]="false" | |
72 | [maxSelectedLabels]="4" | |
73 | ></p-multiSelect> | |
74 | </div> | |
75 | <div ngbDropdownItem class="dropdown-item"> | |
76 | <my-peertube-checkbox inputName="highlightBannedUsers" [(ngModel)]="highlightBannedUsers" | |
77 | i18n-labelText labelText="Highlight banned users"></my-peertube-checkbox> | |
78 | </div> | |
79 | </div> | |
80 | </div> | |
81 | </th> | |
ab998f7b C |
82 | </tr> |
83 | </ng-template> | |
84 | ||
141b177d C |
85 | <ng-template pTemplate="body" let-expanded="expanded" let-user> |
86 | ||
bc99dfe5 | 87 | <tr [pSelectableRow]="user" [ngClass]="{ banned: highlightBannedUsers && user.blocked }"> |
d6af8146 | 88 | <td> |
791645e6 C |
89 | <p-tableCheckbox [value]="user"></p-tableCheckbox> |
90 | </td> | |
91 | ||
d6af8146 | 92 | <td class="expand-cell"> |
141b177d C |
93 | <span *ngIf="user.blockedReason" class="expander" [pRowToggler]="user"> |
94 | <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i> | |
95 | </span> | |
96 | </td> | |
791645e6 | 97 | |
30814423 K |
98 | <td class="action-cell"> |
99 | <my-user-moderation-dropdown *ngIf="!isInSelectionMode()" [user]="user" container="body" | |
100 | (userChanged)="onUserChanged()" (userDeleted)="onUserChanged()"> | |
101 | </my-user-moderation-dropdown> | |
102 | </td> | |
103 | ||
bc99dfe5 | 104 | <td *ngIf="getColumn('username')"> |
d6af8146 RK |
105 | <a i18n-title title="Open account in a new tab" target="_blank" rel="noopener noreferrer" [routerLink]="[ '/accounts/' + user.username ]"> |
106 | <div class="chip two-lines"> | |
107 | <img | |
108 | class="avatar" | |
109 | [src]="user?.account?.avatar?.path" | |
110 | (error)="switchToDefaultAvatar($event)" | |
111 | alt="Avatar" | |
112 | > | |
113 | <div> | |
bc99dfe5 | 114 | <span class="user-table-primary-text">{{ user.account.displayName }}</span> |
d6af8146 RK |
115 | <span class="text-muted">{{ user.username }}</span> |
116 | </div> | |
117 | </div> | |
af5767ff | 118 | </a> |
141b177d | 119 | </td> |
5abb9fbb | 120 | |
4f5d0459 RK |
121 | <td *ngIf="getColumn('email')" [title]="user.email"> |
122 | <ng-container *ngIf="!requiresEmailVerification || user.blocked; else emailWithVerificationStatus"> | |
123 | <a class="table-email" [href]="'mailto:' + user.email">{{ user.email }}</a> | |
124 | </ng-container> | |
bc99dfe5 | 125 | </td> |
5abb9fbb | 126 | |
fc2ec87a JM |
127 | <ng-template #emailWithVerificationStatus> |
128 | <td *ngIf="user.emailVerified === false; else emailVerifiedNotFalse" i18n-title title="User's email must be verified to login"> | |
129 | <em>? {{ user.email }}</em> | |
130 | </td> | |
131 | <ng-template #emailVerifiedNotFalse> | |
132 | <td i18n-title title="User's email is verified / User can login without email verification"> | |
133 | ✓ {{ user.email }} | |
134 | </td> | |
135 | </ng-template> | |
136 | </ng-template> | |
5abb9fbb | 137 | |
bc99dfe5 RK |
138 | <td *ngIf="getColumn('quota')"> |
139 | <div class="progress" i18n-title title="Total video quota"> | |
140 | <div class="progress-bar" role="progressbar" [style]="{ width: getUserVideoQuotaPercentage(user) + '%' }" | |
141 | [attr.aria-valuenow]="user.rawVideoQuotaUsed" aria-valuemin="0" [attr.aria-valuemax]="user.rawVideoQuota"> | |
142 | </div> | |
143 | <span>{{ user.videoQuotaUsed }}</span> | |
144 | <span>{{ user.videoQuota }}</span> | |
145 | </div> | |
146 | </td> | |
147 | ||
148 | <td *ngIf="getColumn('quotaDaily')"> | |
149 | <div class="progress" i18n-title title="Total daily video quota"> | |
150 | <div class="progress-bar secondary" role="progressbar" [style]="{ width: getUserVideoQuotaDailyPercentage(user) + '%' }" | |
151 | [attr.aria-valuenow]="user.rawVideoQuotaUsedDaily" aria-valuemin="0" [attr.aria-valuemax]="user.rawVideoQuotaDaily"> | |
152 | </div> | |
153 | <span>{{ user.videoQuotaUsedDaily }}</span> | |
154 | <span>{{ user.videoQuotaDaily }}</span> | |
155 | </div> | |
156 | </td> | |
8bb71f2e | 157 | |
bc99dfe5 RK |
158 | <td *ngIf="getColumn('role')"> |
159 | <span *ngIf="user.blocked" class="badge badge-banned" i18n-title title="The user was banned">{{ user.roleLabel }}</span> | |
160 | <span *ngIf="!user.blocked" class="badge" [ngClass]="getRoleClass(user.role)">{{ user.roleLabel }}</span> | |
161 | </td> | |
162 | ||
163 | <td *ngIf="getColumn('pluginAuth')"> | |
8bb71f2e C |
164 | <ng-container *ngIf="user.pluginAuth">{{ user.pluginAuth }}</ng-container> |
165 | </td> | |
166 | ||
bc99dfe5 RK |
167 | <td *ngIf="getColumn('createdAt')" [title]="user.createdAt">{{ user.createdAt | date: 'short' }}</td> |
168 | ||
169 | <td *ngIf="getColumn('lastLoginDate')" [title]="user.lastLoginDate">{{ user.lastLoginDate | date: 'short' }}</td> | |
141b177d C |
170 | </tr> |
171 | </ng-template> | |
172 | ||
173 | <ng-template pTemplate="rowexpansion" let-user> | |
174 | <tr class="user-blocked-reason"> | |
175 | <td colspan="7"> | |
176 | <span i18n class="ban-reason-label">Ban reason:</span> | |
177 | {{ user.blockedReason }} | |
ab998f7b C |
178 | </td> |
179 | </tr> | |
180 | </ng-template> | |
181 | </p-table> | |
141b177d | 182 | |
2fbe7f19 | 183 | <my-user-ban-modal #userBanModal (userBanned)="onUserChanged()"></my-user-ban-modal> |