diff options
author | Chocobozzz <me@florianbigard.com> | 2018-02-23 14:36:16 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-02-23 14:36:16 +0100 |
commit | ab998f7b6dffbe461d830d3696cb46491ad6afb0 (patch) | |
tree | f819e4049ca62b5389fd31ebfcbcb6ffbe0eaf0b /client/src/app/+admin/users/user-list | |
parent | 621d99f53f47a11919ec243e05273ecf5907b444 (diff) | |
download | PeerTube-ab998f7b6dffbe461d830d3696cb46491ad6afb0.tar.gz PeerTube-ab998f7b6dffbe461d830d3696cb46491ad6afb0.tar.zst PeerTube-ab998f7b6dffbe461d830d3696cb46491ad6afb0.zip |
Improve admin tables
Diffstat (limited to 'client/src/app/+admin/users/user-list')
-rw-r--r-- | client/src/app/+admin/users/user-list/user-list.component.html | 44 | ||||
-rw-r--r-- | client/src/app/+admin/users/user-list/user-list.component.ts | 10 |
2 files changed, 35 insertions, 19 deletions
diff --git a/client/src/app/+admin/users/user-list/user-list.component.html b/client/src/app/+admin/users/user-list/user-list.component.html index 08f4caeb9..8dbe9ddc4 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.html +++ b/client/src/app/+admin/users/user-list/user-list.component.html | |||
@@ -7,20 +7,32 @@ | |||
7 | </a> | 7 | </a> |
8 | </div> | 8 | </div> |
9 | 9 | ||
10 | <p-dataTable | 10 | <p-table |
11 | [value]="users" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" | 11 | [value]="users" [lazy]="true" [paginator]="true" [totalRecords]="totalRecords" [rows]="rowsPerPage" |
12 | sortField="id" (onLazyLoad)="loadLazy($event)" | 12 | [sortField]="sort.field" [sortOrder]="sort.order" (onLazyLoad)="loadLazy($event)" |
13 | > | 13 | > |
14 | <p-column field="id" header="ID" [sortable]="true" [style]="{ width: '60px' }"></p-column> | 14 | <ng-template pTemplate="header"> |
15 | <p-column field="username" header="Username" [sortable]="true"></p-column> | 15 | <tr> |
16 | <p-column field="email" header="Email"></p-column> | 16 | <th pSortableColumn="username">Username <p-sortIcon field="username"></p-sortIcon></th> |
17 | <p-column field="videoQuota" header="Video quota"></p-column> | 17 | <th>Email</th> |
18 | <p-column field="roleLabel" header="Role"></p-column> | 18 | <th>Video quota</th> |
19 | <p-column field="createdAt" header="Created date" [sortable]="true"></p-column> | 19 | <th>Role</th> |
20 | <p-column styleClass="action-cell"> | 20 | <th pSortableColumn="createdAt">Created <p-sortIcon field="createdAt"></p-sortIcon></th> |
21 | <ng-template pTemplate="body" let-user="rowData"> | 21 | <th></th> |
22 | <my-edit-button [routerLink]="getRouterUserEditLink(user)"></my-edit-button> | 22 | </tr> |
23 | <my-delete-button (click)="removeUser(user)"></my-delete-button> | 23 | </ng-template> |
24 | </ng-template> | 24 | |
25 | </p-column> | 25 | <ng-template pTemplate="body" let-user> |
26 | </p-dataTable> | 26 | <tr> |
27 | <td>{{ user.username }}</td> | ||
28 | <td>{{ user.email }}</td> | ||
29 | <td>{{ user.videoQuota }}</td> | ||
30 | <td>{{ user.roleLabel }}</td> | ||
31 | <td>{{ user.createdAt }}</td> | ||
32 | <td class="action-cell"> | ||
33 | <my-edit-button [routerLink]="getRouterUserEditLink(user)"></my-edit-button> | ||
34 | <my-delete-button (click)="removeUser(user)"></my-delete-button> | ||
35 | </td> | ||
36 | </tr> | ||
37 | </ng-template> | ||
38 | </p-table> | ||
diff --git a/client/src/app/+admin/users/user-list/user-list.component.ts b/client/src/app/+admin/users/user-list/user-list.component.ts index 512152808..a52df49c0 100644 --- a/client/src/app/+admin/users/user-list/user-list.component.ts +++ b/client/src/app/+admin/users/user-list/user-list.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | 2 | ||
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | import { SortMeta } from 'primeng/components/common/sortmeta' | 4 | import { SortMeta } from 'primeng/components/common/sortmeta' |
@@ -12,11 +12,11 @@ import { UserService } from '../shared' | |||
12 | templateUrl: './user-list.component.html', | 12 | templateUrl: './user-list.component.html', |
13 | styleUrls: [ './user-list.component.scss' ] | 13 | styleUrls: [ './user-list.component.scss' ] |
14 | }) | 14 | }) |
15 | export class UserListComponent extends RestTable { | 15 | export class UserListComponent extends RestTable implements OnInit { |
16 | users: User[] = [] | 16 | users: User[] = [] |
17 | totalRecords = 0 | 17 | totalRecords = 0 |
18 | rowsPerPage = 10 | 18 | rowsPerPage = 10 |
19 | sort: SortMeta = { field: 'id', order: 1 } | 19 | sort: SortMeta = { field: 'createdAt', order: 1 } |
20 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } | 20 | pagination: RestPagination = { count: this.rowsPerPage, start: 0 } |
21 | 21 | ||
22 | constructor ( | 22 | constructor ( |
@@ -27,6 +27,10 @@ export class UserListComponent extends RestTable { | |||
27 | super() | 27 | super() |
28 | } | 28 | } |
29 | 29 | ||
30 | ngOnInit () { | ||
31 | this.loadSort() | ||
32 | } | ||
33 | |||
30 | async removeUser (user: User) { | 34 | async removeUser (user: User) { |
31 | if (user.username === 'root') { | 35 | if (user.username === 'root') { |
32 | this.notificationsService.error('Error', 'You cannot delete root.') | 36 | this.notificationsService.error('Error', 'You cannot delete root.') |