]>
Commit | Line | Data |
---|---|---|
ab998f7b | 1 | <p-table |
2e46eb97 C |
2 | [value]="users" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions" |
3 | [sortField]="sort.field" [sortOrder]="sort.order" dataKey="id" [resizableColumns]="true" [(selection)]="selectedUsers" | |
4 | [lazy]="true" (onLazyLoad)="loadLazy($event)" [lazyLoadOnInit]="false" | |
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"> | |
9c1a88e3 | 11 | <div class="left-buttons"> |
791645e6 C |
12 | <my-action-dropdown |
13 | *ngIf="isInSelectionMode()" i18n-label label="Batch actions" theme="orange" | |
14 | [actions]="bulkUserActions" [entry]="selectedUsers" | |
15 | > | |
16 | </my-action-dropdown> | |
9c1a88e3 C |
17 | |
18 | <a *ngIf="!isInSelectionMode()" class="add-button" routerLink="/admin/users/create"> | |
19 | <my-global-icon iconName="user-add" aria-hidden="true"></my-global-icon> | |
20 | <ng-container i18n>Create user</ng-container> | |
21 | </a> | |
791645e6 C |
22 | </div> |
23 | ||
8491293b | 24 | <div class="ml-auto"> |
2e46eb97 | 25 | <my-advanced-input-filter [filters]="inputFilters" (search)="onSearch($event)"></my-advanced-input-filter> |
791645e6 | 26 | </div> |
8491293b | 27 | |
791645e6 C |
28 | </div> |
29 | </ng-template> | |
30 | ||
ab998f7b C |
31 | <ng-template pTemplate="header"> |
32 | <tr> | |
791645e6 | 33 | <th style="width: 40px"> |
1916c966 | 34 | <p-tableHeaderCheckbox ariaLabel="Select all rows" i18n-ariaLabel></p-tableHeaderCheckbox> |
791645e6 | 35 | </th> |
2cae5f13 | 36 | <th style="width: 40px"></th> |
bc99dfe5 | 37 | <th style="width: 60px;"> |
9a423632 | 38 | <div class="c-hand column-toggle" ngbDropdown placement="bottom-left auto" container="body" autoClose="outside"> |
bc99dfe5 | 39 | <my-global-icon iconName="columns" ngbDropdownToggle></my-global-icon> |
30814423 | 40 | |
bc99dfe5 RK |
41 | <div role="menu" class="dropdown-menu" ngbDropdownMenu> |
42 | <div class="dropdown-header" i18n>Table parameters</div> | |
43 | <div ngbDropdownItem class="dropdown-item"> | |
52c4976f C |
44 | <my-select-checkbox |
45 | name="columns" | |
46 | [availableItems]="columns" | |
47 | [selectableGroup]="false" [(ngModel)]="selectedColumns" | |
857961f0 | 48 | i18n-placeholder placeholder="Select columns" |
52c4976f C |
49 | > |
50 | </my-select-checkbox> | |
bc99dfe5 RK |
51 | </div> |
52 | <div ngbDropdownItem class="dropdown-item"> | |
53 | <my-peertube-checkbox inputName="highlightBannedUsers" [(ngModel)]="highlightBannedUsers" | |
54 | i18n-labelText labelText="Highlight banned users"></my-peertube-checkbox> | |
55 | </div> | |
56 | </div> | |
57 | </div> | |
58 | </th> | |
fe9cc718 C |
59 | <th *ngIf="isSelected('username')" pResizableColumn pSortableColumn="username">{{ getColumn('username').label }} <p-sortIcon field="username"></p-sortIcon></th> |
60 | <th *ngIf="isSelected('email')">{{ getColumn('email').label }}</th> | |
61 | <th *ngIf="isSelected('quota')" style="width: 160px;" pSortableColumn="videoQuotaUsed">{{ getColumn('quota').label }} <p-sortIcon field="videoQuotaUsed"></p-sortIcon></th> | |
62 | <th *ngIf="isSelected('quotaDaily')" style="width: 160px;">{{ getColumn('quotaDaily').label }}</th> | |
63 | <th *ngIf="isSelected('role')" style="width: 120px;" pSortableColumn="role">{{ getColumn('role').label }} <p-sortIcon field="role"></p-sortIcon></th> | |
64 | <th *ngIf="isSelected('pluginAuth')" style="width: 140px;" pResizableColumn >{{ getColumn('pluginAuth').label }}</th> | |
65 | <th *ngIf="isSelected('createdAt')" style="width: 150px;" pSortableColumn="createdAt">{{ getColumn('createdAt').label }} <p-sortIcon field="createdAt"></p-sortIcon></th> | |
66 | <th *ngIf="isSelected('lastLoginDate')" style="width: 150px;" pSortableColumn="lastLoginDate">{{ getColumn('lastLoginDate').label }} <p-sortIcon field="lastLoginDate"></p-sortIcon></th> | |
ab998f7b C |
67 | </tr> |
68 | </ng-template> | |
69 | ||
141b177d C |
70 | <ng-template pTemplate="body" let-expanded="expanded" let-user> |
71 | ||
bc99dfe5 | 72 | <tr [pSelectableRow]="user" [ngClass]="{ banned: highlightBannedUsers && user.blocked }"> |
7706b370 | 73 | <td class="checkbox-cell"> |
1916c966 | 74 | <p-tableCheckbox [value]="user" ariaLabel="Select this row" i18n-ariaLabel></p-tableCheckbox> |
791645e6 C |
75 | </td> |
76 | ||
d6af8146 | 77 | <td class="expand-cell"> |
141b177d C |
78 | <span *ngIf="user.blockedReason" class="expander" [pRowToggler]="user"> |
79 | <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i> | |
80 | </span> | |
81 | </td> | |
791645e6 | 82 | |
30814423 K |
83 | <td class="action-cell"> |
84 | <my-user-moderation-dropdown *ngIf="!isInSelectionMode()" [user]="user" container="body" | |
85 | (userChanged)="onUserChanged()" (userDeleted)="onUserChanged()"> | |
86 | </my-user-moderation-dropdown> | |
87 | </td> | |
88 | ||
52c4976f | 89 | <td *ngIf="isSelected('username')"> |
71887396 | 90 | <a i18n-title title="Open account in a new tab" target="_blank" rel="noopener noreferrer" [routerLink]="[ '/a/' + user.username ]"> |
d6af8146 | 91 | <div class="chip two-lines"> |
746018f6 | 92 | <my-actor-avatar [account]="user?.account" size="32"></my-actor-avatar> |
fbdcd4ec | 93 | <div> |
bc99dfe5 | 94 | <span class="user-table-primary-text">{{ user.account.displayName }}</span> |
d6af8146 RK |
95 | <span class="text-muted">{{ user.username }}</span> |
96 | </div> | |
97 | </div> | |
af5767ff | 98 | </a> |
141b177d | 99 | </td> |
5abb9fbb | 100 | |
52c4976f | 101 | <td *ngIf="isSelected('email')" [title]="user.email"> |
4f5d0459 RK |
102 | <ng-container *ngIf="!requiresEmailVerification || user.blocked; else emailWithVerificationStatus"> |
103 | <a class="table-email" [href]="'mailto:' + user.email">{{ user.email }}</a> | |
104 | </ng-container> | |
bc99dfe5 | 105 | </td> |
5abb9fbb | 106 | |
fc2ec87a JM |
107 | <ng-template #emailWithVerificationStatus> |
108 | <td *ngIf="user.emailVerified === false; else emailVerifiedNotFalse" i18n-title title="User's email must be verified to login"> | |
109 | <em>? {{ user.email }}</em> | |
110 | </td> | |
111 | <ng-template #emailVerifiedNotFalse> | |
112 | <td i18n-title title="User's email is verified / User can login without email verification"> | |
113 | ✓ {{ user.email }} | |
114 | </td> | |
115 | </ng-template> | |
116 | </ng-template> | |
5abb9fbb | 117 | |
52c4976f | 118 | <td *ngIf="isSelected('quota')"> |
bc99dfe5 RK |
119 | <div class="progress" i18n-title title="Total video quota"> |
120 | <div class="progress-bar" role="progressbar" [style]="{ width: getUserVideoQuotaPercentage(user) + '%' }" | |
121 | [attr.aria-valuenow]="user.rawVideoQuotaUsed" aria-valuemin="0" [attr.aria-valuemax]="user.rawVideoQuota"> | |
122 | </div> | |
123 | <span>{{ user.videoQuotaUsed }}</span> | |
124 | <span>{{ user.videoQuota }}</span> | |
125 | </div> | |
126 | </td> | |
127 | ||
52c4976f | 128 | <td *ngIf="isSelected('quotaDaily')"> |
bc99dfe5 RK |
129 | <div class="progress" i18n-title title="Total daily video quota"> |
130 | <div class="progress-bar secondary" role="progressbar" [style]="{ width: getUserVideoQuotaDailyPercentage(user) + '%' }" | |
131 | [attr.aria-valuenow]="user.rawVideoQuotaUsedDaily" aria-valuemin="0" [attr.aria-valuemax]="user.rawVideoQuotaDaily"> | |
132 | </div> | |
133 | <span>{{ user.videoQuotaUsedDaily }}</span> | |
134 | <span>{{ user.videoQuotaDaily }}</span> | |
135 | </div> | |
136 | </td> | |
8bb71f2e | 137 | |
52c4976f | 138 | <td *ngIf="isSelected('role')"> |
bc99dfe5 RK |
139 | <span *ngIf="user.blocked" class="badge badge-banned" i18n-title title="The user was banned">{{ user.roleLabel }}</span> |
140 | <span *ngIf="!user.blocked" class="badge" [ngClass]="getRoleClass(user.role)">{{ user.roleLabel }}</span> | |
141 | </td> | |
142 | ||
52c4976f | 143 | <td *ngIf="isSelected('pluginAuth')"> |
8bb71f2e C |
144 | <ng-container *ngIf="user.pluginAuth">{{ user.pluginAuth }}</ng-container> |
145 | </td> | |
146 | ||
52c4976f | 147 | <td *ngIf="isSelected('createdAt')" [title]="user.createdAt">{{ user.createdAt | date: 'short' }}</td> |
bc99dfe5 | 148 | |
52c4976f | 149 | <td *ngIf="isSelected('lastLoginDate')" [title]="user.lastLoginDate">{{ user.lastLoginDate | date: 'short' }}</td> |
141b177d C |
150 | </tr> |
151 | </ng-template> | |
152 | ||
153 | <ng-template pTemplate="rowexpansion" let-user> | |
154 | <tr class="user-blocked-reason"> | |
155 | <td colspan="7"> | |
156 | <span i18n class="ban-reason-label">Ban reason:</span> | |
157 | {{ user.blockedReason }} | |
ab998f7b C |
158 | </td> |
159 | </tr> | |
160 | </ng-template> | |
161 | </p-table> | |
141b177d | 162 | |
2fbe7f19 | 163 | <my-user-ban-modal #userBanModal (userBanned)="onUserChanged()"></my-user-ban-modal> |