-<div class="row">
- <div class="content-padding">
-
- <h3>Users list</h3>
-
- <p-dataTable
- [value]="users" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage"
- sortField="id" (onLazyLoad)="loadLazy($event)"
- >
- <p-column field="id" header="ID" [sortable]="true"></p-column>
- <p-column field="username" header="Username" [sortable]="true"></p-column>
- <p-column field="email" header="Email"></p-column>
- <p-column field="videoQuota" header="Video quota"></p-column>
- <p-column field="role" header="Role"></p-column>
- <p-column field="createdAt" header="Created date" [sortable]="true"></p-column>
- <p-column header="Edit" styleClass="action-cell">
- <ng-template pTemplate="body" let-user="rowData">
- <a [routerLink]="getRouterUserEditLink(user)" title="Edit this user">
- <span class="glyphicon glyphicon-pencil glyphicon-black"></span>
- </a>
- </ng-template>
- </p-column>
- <p-column header="Delete" styleClass="action-cell">
- <ng-template pTemplate="body" let-user="rowData">
- <span (click)="removeUser(user)" class="glyphicon glyphicon-remove glyphicon-black" title="Remove this user"></span>
+<p-table
+ [value]="users" [lazy]="true" [paginator]="totalRecords > 0" [totalRecords]="totalRecords" [rows]="rowsPerPage" [rowsPerPageOptions]="rowsPerPageOptions"
+ [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" dataKey="id" [resizableColumns]="true"
+ [(selection)]="selectedUsers"
+ [showCurrentPageReport]="true" i18n-currentPageReportTemplate
+ currentPageReportTemplate="Showing {{'{first}'}} to {{'{last}'}} of {{'{totalRecords}'}} users"
+ (onPage)="onPage($event)" [expandedRowKeys]="expandedRows"
+>
+ <ng-template pTemplate="caption">
+ <div class="caption">
+ <div class="left-buttons">
+ <my-action-dropdown
+ *ngIf="isInSelectionMode()" i18n-label label="Batch actions" theme="orange"
+ [actions]="bulkUserActions" [entry]="selectedUsers"
+ >
+ </my-action-dropdown>
+
+ <a *ngIf="!isInSelectionMode()" class="add-button" routerLink="/admin/users/create">
+ <my-global-icon iconName="user-add" aria-hidden="true"></my-global-icon>
+ <ng-container i18n>Create user</ng-container>
+ </a>
+ </div>
+
+ <div class="ml-auto">
+ <div class="input-group has-feedback has-clear">
+ <div class="input-group-prepend c-hand" ngbDropdown placement="bottom-left auto" container="body">
+ <div class="input-group-text" ngbDropdownToggle>
+ <span class="caret" aria-haspopup="menu" role="button"></span>
+ </div>
+
+ <div role="menu" ngbDropdownMenu>
+ <h6 class="dropdown-header" i18n>Advanced user filters</h6>
+ <a [routerLink]="[ '/admin/users/list' ]" [queryParams]="{ 'search': 'banned:true' }" class="dropdown-item" i18n>Banned users</a>
+ </div>
+ </div>
+ <input
+ type="text" name="table-filter" id="table-filter" i18n-placeholder placeholder="Filter..."
+ (keyup)="onSearch($event)"
+ >
+ <a class="glyphicon glyphicon-remove-sign form-control-feedback form-control-clear" (click)="resetTableFilter()"></a>
+ <span class="sr-only" i18n>Clear filters</span>
+ </div>
+ </div>
+
+ </div>
+ </ng-template>
+
+ <ng-template pTemplate="header">
+ <tr>
+ <th style="width: 40px">
+ <p-tableHeaderCheckbox ariaLabel="Select all rows" i18n-ariaLabel></p-tableHeaderCheckbox>
+ </th>
+ <th style="width: 40px"></th>
+ <th style="width: 60px;">
+ <div class="c-hand column-toggle" ngbDropdown placement="bottom-left auto" container="body" autoClose="outside">
+ <my-global-icon iconName="columns" ngbDropdownToggle></my-global-icon>
+
+ <div role="menu" class="dropdown-menu" ngbDropdownMenu>
+ <div class="dropdown-header" i18n>Table parameters</div>
+ <div ngbDropdownItem class="dropdown-item">
+ <my-select-checkbox
+ name="columns"
+ [availableItems]="columns"
+ [selectableGroup]="false" [(ngModel)]="selectedColumns"
+ i18n-placeholder placeholder="Select columns"
+ >
+ </my-select-checkbox>
+ </div>
+ <div ngbDropdownItem class="dropdown-item">
+ <my-peertube-checkbox inputName="highlightBannedUsers" [(ngModel)]="highlightBannedUsers"
+ i18n-labelText labelText="Highlight banned users"></my-peertube-checkbox>
+ </div>
+ </div>
+ </div>
+ </th>
+ <th *ngIf="isSelected('username')" pResizableColumn pSortableColumn="username">{{ getColumn('username').label }} <p-sortIcon field="username"></p-sortIcon></th>
+ <th *ngIf="isSelected('email')">{{ getColumn('email').label }}</th>
+ <th *ngIf="isSelected('quota')" style="width: 160px;" pSortableColumn="videoQuotaUsed">{{ getColumn('quota').label }} <p-sortIcon field="videoQuotaUsed"></p-sortIcon></th>
+ <th *ngIf="isSelected('quotaDaily')" style="width: 160px;">{{ getColumn('quotaDaily').label }}</th>
+ <th *ngIf="isSelected('role')" style="width: 120px;" pSortableColumn="role">{{ getColumn('role').label }} <p-sortIcon field="role"></p-sortIcon></th>
+ <th *ngIf="isSelected('pluginAuth')" style="width: 140px;" pResizableColumn >{{ getColumn('pluginAuth').label }}</th>
+ <th *ngIf="isSelected('createdAt')" style="width: 150px;" pSortableColumn="createdAt">{{ getColumn('createdAt').label }} <p-sortIcon field="createdAt"></p-sortIcon></th>
+ <th *ngIf="isSelected('lastLoginDate')" style="width: 150px;" pSortableColumn="lastLoginDate">{{ getColumn('lastLoginDate').label }} <p-sortIcon field="lastLoginDate"></p-sortIcon></th>
+ </tr>
+ </ng-template>
+
+ <ng-template pTemplate="body" let-expanded="expanded" let-user>
+
+ <tr [pSelectableRow]="user" [ngClass]="{ banned: highlightBannedUsers && user.blocked }">
+ <td class="checkbox-cell">
+ <p-tableCheckbox [value]="user" ariaLabel="Select this row" i18n-ariaLabel></p-tableCheckbox>
+ </td>
+
+ <td class="expand-cell">
+ <span *ngIf="user.blockedReason" class="expander" [pRowToggler]="user">
+ <i [ngClass]="expanded ? 'glyphicon glyphicon-menu-down' : 'glyphicon glyphicon-menu-right'"></i>
+ </span>
+ </td>
+
+ <td class="action-cell">
+ <my-user-moderation-dropdown *ngIf="!isInSelectionMode()" [user]="user" container="body"
+ (userChanged)="onUserChanged()" (userDeleted)="onUserChanged()">
+ </my-user-moderation-dropdown>
+ </td>
+
+ <td *ngIf="isSelected('username')">
+ <a i18n-title title="Open account in a new tab" target="_blank" rel="noopener noreferrer" [routerLink]="[ '/accounts/' + user.username ]">
+ <div class="chip two-lines">
+ <my-account-avatar [account]="user?.account"></my-account-avatar>
+ <div>
+ <span class="user-table-primary-text">{{ user.account.displayName }}</span>
+ <span class="text-muted">{{ user.username }}</span>
+ </div>
+ </div>
+ </a>
+ </td>
+
+ <td *ngIf="isSelected('email')" [title]="user.email">
+ <ng-container *ngIf="!requiresEmailVerification || user.blocked; else emailWithVerificationStatus">
+ <a class="table-email" [href]="'mailto:' + user.email">{{ user.email }}</a>
+ </ng-container>
+ </td>
+
+ <ng-template #emailWithVerificationStatus>
+ <td *ngIf="user.emailVerified === false; else emailVerifiedNotFalse" i18n-title title="User's email must be verified to login">
+ <em>? {{ user.email }}</em>
+ </td>
+ <ng-template #emailVerifiedNotFalse>
+ <td i18n-title title="User's email is verified / User can login without email verification">
+ ✓ {{ user.email }}
+ </td>