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